query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
a7c9ac03317d4bcec57db08615abafb0
Get a flow execution&39;s details. Flow execution details are available for several days after the flow is started.
[ { "docid": "c6a1e156ee8ed921dfb78117a8bd95e4", "score": "0.6684863", "text": "def get_flows_execution_with_http_info(flow_execution_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flows_execution ...\"\n end\n \n \n # verify the required parameter 'flow_execution_id' is set\n fail ArgumentError, \"Missing the required parameter 'flow_execution_id' when calling ArchitectApi.get_flows_execution\" if flow_execution_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows/executions/{flowExecutionId}\".sub('{format}','json').sub('{' + 'flowExecutionId' + '}', flow_execution_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\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 => 'FlowRuntimeExecution')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_flows_execution\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "83f5d3de5265d760aa9f3cc9c7f57315", "score": "0.73162925", "text": "def get_execution_info\n execution = @swf.describe_workflow_execution(\n domain: @domain,\n execution: @execution\n )\n execution[\"executionInfo\"]\n end", "title": "" }, { "docid": "dcd0e3bcfa2fbf2255a9aaa2f39f70d0", "score": "0.62897223", "text": "def get_flows_execution(flow_execution_id, opts = {})\n data, _status_code, _headers = get_flows_execution_with_http_info(flow_execution_id, opts)\n return data\n end", "title": "" }, { "docid": "c8b0166db6feec6cd0aa02c00fb6d7a6", "score": "0.62055814", "text": "def get_execution_info; end", "title": "" }, { "docid": "23c4835348617a5fcdf8f0821e5c0906", "score": "0.58502614", "text": "def execution(id, options = {})\n e = get(\"/execution/#{id}\", options)\n # Temporary fix for https://github.com/dblessing/rundeck-ruby/issues/25\n begin\n objectify e['result']['executions']['execution']\n rescue\n objectify e['executions']['execution']\n end\n end", "title": "" }, { "docid": "17cb2da6d6371b74738d247e8c89f550", "score": "0.56756693", "text": "def get_flow(_task)\n @last_flow ||= nil\n flow = @last_flow&.first\n @last_flow = nil\n flow\n end", "title": "" }, { "docid": "d756253a22674543a2146952f0b03293", "score": "0.56574154", "text": "def get_execution_result\n @result\n end", "title": "" }, { "docid": "3b6e76f1c4f0fd0be7c60f85aa71d9f2", "score": "0.5492947", "text": "def execution_state(id, options = {})\n objectify get(\"/execution/#{id}/state\", options)['result']['executionState']\n end", "title": "" }, { "docid": "d95f8f8fdd3b4f0c26e0fa44298e5c31", "score": "0.54913133", "text": "def show\n @title = t('view.flows.show_title')\n @flow = Flow.find(params[:id])\n end", "title": "" }, { "docid": "f15939d1b0f5727dd55e6867bf90f0f3", "score": "0.5473083", "text": "def execution_sequence\n return @execution_sequence\n end", "title": "" }, { "docid": "fc50545e7ba697d2cd7252a67d048cad", "score": "0.53819484", "text": "def execution_count\n flow_entry_count\n end", "title": "" }, { "docid": "2d20ba9699cae4bbf22b20b4e83f6515", "score": "0.5345458", "text": "def _execution_id\n attributes['id']\n end", "title": "" }, { "docid": "e208e127806ef9926b2df68ebc43a8b3", "score": "0.5329407", "text": "def step_flows\n self.workflow.step_flows\n end", "title": "" }, { "docid": "fb80460ba83e7302561aebf6a497af52", "score": "0.53089255", "text": "def find_flow name\n @flows.select { |f| f.name == name }.first\n end", "title": "" }, { "docid": "bc1d9b88bef45f499f66c5a30296e3c3", "score": "0.5297309", "text": "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsContext #{context}>\"\n end", "title": "" }, { "docid": "04e71de546b3a1951bc87e0cdb846d33", "score": "0.5269949", "text": "def show\n @exec = Exec.find(params[:id])\n @meetings = @exec.meetings.available\n @scheduled = @exec.scheduled\n end", "title": "" }, { "docid": "cf0e373a281c8f82e585907747ee6574", "score": "0.51856595", "text": "def get_flows()\n\tputs \"Getting flows\"\n\tresponse = request_get('/api/partner/flow')\n\tputs response.body\nend", "title": "" }, { "docid": "5236963222679302ba7657a27d981260", "score": "0.5167729", "text": "def execution_info\n @info ||= Execution::Info.new(@payload,\n @warnings,\n @keyspace,\n @statement,\n @options,\n @hosts,\n @consistency,\n @retries,\n @trace_id ?\n Execution::Trace.new(@trace_id, @client, @options.load_balancing_policy) :\n nil)\n end", "title": "" }, { "docid": "714c7091b3bf17238119955453dae034", "score": "0.5161511", "text": "def show\n @next_inspection_schedule = @equipment.next_inspection_schedule\n @inspection_histories = @equipment.inspection_schedules.where(schedule_status: ScheduleStatus.of_completed)\n end", "title": "" }, { "docid": "7cb3ef6c3bd4bf120b786d5190123abc", "score": "0.51500344", "text": "def flow_expression\n\n @dict.fexp\n end", "title": "" }, { "docid": "96b3c57410b87e92e4e3af34c1d2e14c", "score": "0.51357335", "text": "def events\n @execution.events if @execution\n end", "title": "" }, { "docid": "1dbba4fd4166f33e97a940fe0a44f6c7", "score": "0.5114639", "text": "def executions(id)\n get(\"/accounts/#{id}/executions\")['executions']\n end", "title": "" }, { "docid": "fae1c06a14bbd13d71e77c4b6bf48ea2", "score": "0.5066574", "text": "def execution_info\n @info ||= Execution::Info.new(@payload,\n @warnings,\n @keyspace,\n @statement,\n @options,\n @hosts,\n @consistency,\n @retries,\n nil)\n end", "title": "" }, { "docid": "fae1c06a14bbd13d71e77c4b6bf48ea2", "score": "0.5066574", "text": "def execution_info\n @info ||= Execution::Info.new(@payload,\n @warnings,\n @keyspace,\n @statement,\n @options,\n @hosts,\n @consistency,\n @retries,\n nil)\n end", "title": "" }, { "docid": "fae1c06a14bbd13d71e77c4b6bf48ea2", "score": "0.5066574", "text": "def execution_info\n @info ||= Execution::Info.new(@payload,\n @warnings,\n @keyspace,\n @statement,\n @options,\n @hosts,\n @consistency,\n @retries,\n nil)\n end", "title": "" }, { "docid": "fae1c06a14bbd13d71e77c4b6bf48ea2", "score": "0.5066574", "text": "def execution_info\n @info ||= Execution::Info.new(@payload,\n @warnings,\n @keyspace,\n @statement,\n @options,\n @hosts,\n @consistency,\n @retries,\n nil)\n end", "title": "" }, { "docid": "fae1c06a14bbd13d71e77c4b6bf48ea2", "score": "0.5066574", "text": "def execution_info\n @info ||= Execution::Info.new(@payload,\n @warnings,\n @keyspace,\n @statement,\n @options,\n @hosts,\n @consistency,\n @retries,\n nil)\n end", "title": "" }, { "docid": "dd139161157b65aee9c453c135684a62", "score": "0.5062098", "text": "def workflow_execution_type\n return @workflow_execution_type\n end", "title": "" }, { "docid": "0bdee44b92e9f9772351e5112b494369", "score": "0.50405836", "text": "def find_flow(name)\n name = name.to_sym unless name.nil?\n @flows[name]\n end", "title": "" }, { "docid": "f790826e8ca2030a63e87de21a36d0f2", "score": "0.50358313", "text": "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsInstance #{values}>\"\n end", "title": "" }, { "docid": "5c5db34a5b415adf2ee895dcd39c97c3", "score": "0.50182223", "text": "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsInstance #{values}>\"\n end", "title": "" }, { "docid": "798edd8eea6302bc593c85e87a20bd09", "score": "0.5014053", "text": "def outcome_details\n begin\n @project_id = params[:project_id]\n user_assigned = current_user.is_assigned_to_project(params[:project_id])\n @data_point = OutcomeDetailDataPoint.new\n action = ''\n\n # Now get any additional user instructions for this section\n @ef_instruction = EfInstruction.find(:first, :conditions=>[\"ef_id = ? and section = ? and data_element = ?\", params[:extraction_form_id].to_s, \"OUTCOME_DETAILS\", \"GENERAL\"])\n @ef_instruction = @ef_instruction.nil? ? \"\" : @ef_instruction.instructions\n\n by_category = EfSectionOption.is_section_by_category?(params[:extraction_form_id], 'outcome_detail')\n if by_category\n @data = QuestionBuilder.get_questions(\"outcome_detail\", params[:study_id], params[:extraction_form_id], {:user_assigned => user_assigned, :is_by_outcome=>true, :include_total=>false})\n action = 'question_based_section_by_category'\n else\n action = 'question_based_section'\n @data = QuestionBuilder.get_questions(\"outcome_detail\", params[:study_id], params[:extraction_form_id], {:user_assigned => user_assigned})\n end\n render :action=>\"#{action}\", :layout=>false\n rescue Exception => e\n puts \"ERROR: #{e.message}\\n\\n#{e.backtrace}\\n\\n\"\n end\n end", "title": "" }, { "docid": "712947fa2258d8c6f667c53c009701c2", "score": "0.50094336", "text": "def show\n json_response(@flight_execution.decorate, :ok)\n end", "title": "" }, { "docid": "04985d96b835156a2f7a6acafd04c27b", "score": "0.5007907", "text": "def execution_state\n return :pending if self.test_executions.empty?\n\n self.test_executions.ordered_by_date.first.state\n end", "title": "" }, { "docid": "76a081608640d04b783bd243e9875c4d", "score": "0.49932346", "text": "def execution_context\n @context\n end", "title": "" }, { "docid": "e36bb97aace672093722a56be6d44619", "score": "0.49899036", "text": "def show\n workflow_steps = WorkflowStep.where(\n repository: params[:repo],\n druid: params[:druid],\n workflow: params[:workflow]\n ).order(:workflow, created_at: :asc)\n @workflow = Workflow.new(name: params[:workflow], repository: params[:repo], druid: params[:druid], steps: workflow_steps)\n end", "title": "" }, { "docid": "3a7e3297bd0504e4f0949887ab91a317", "score": "0.4971513", "text": "def latest_execution\n executions.order(updated_at: :desc).first&.updated_at\n end", "title": "" }, { "docid": "efbb899e01bdcc8cdd39bf0bfe640924", "score": "0.49412012", "text": "def steps\n step_flows.collect(&:current_step)\n end", "title": "" }, { "docid": "8dbd0bbf32278f63f90e1a28da73960b", "score": "0.49396107", "text": "def getInput(events)\n\tevents.each do |e|\n\t\tif e.to_h[:event_type] == 'WorkflowExecutionStarted'\n\t\t\treturn e.to_h[:attributes][:input]\n\t\tend\n\tend\n\treturn \"\"\nend", "title": "" }, { "docid": "d24c37c96eed9a3e712a71ac311ea52b", "score": "0.4937475", "text": "def flow_params\n params.fetch(:flow, {})\n end", "title": "" }, { "docid": "e2e570ec17c9294ff9699f6f8d98a22d", "score": "0.49306703", "text": "def set_execution\n @execution = Execution.find(params[:id])\n end", "title": "" }, { "docid": "e2e570ec17c9294ff9699f6f8d98a22d", "score": "0.49293953", "text": "def set_execution\n @execution = Execution.find(params[:id])\n end", "title": "" }, { "docid": "7d7cf53f065907ed87c8b5988f2ffa50", "score": "0.4915613", "text": "def get_traceflow(traceflow_id, opts = {})\n data, _status_code, _headers = get_traceflow_with_http_info(traceflow_id, opts)\n data\n end", "title": "" }, { "docid": "ff1bb1ba189f84dfcd3de2c42c8e20ac", "score": "0.491476", "text": "def current_execution_context\n @current_execution_context || self.project.current_execution_cycle.id\n end", "title": "" }, { "docid": "68f31fcb46e5b82d44ef69ad01fa36eb", "score": "0.4913805", "text": "def task\n Camunda::Task.find_by_business_key_and_task_definition_key! business_key, task_key\n end", "title": "" }, { "docid": "97a23022753dc1fe6fb59fc8025f2c8d", "score": "0.4895828", "text": "def show\n @title = t('view.flows.show_title')\n @flow = Flow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flow }\n end\n end", "title": "" }, { "docid": "2248bc01ecb09516588e43e2ccfb5c9d", "score": "0.4878783", "text": "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Taskrouter.V1.WorkflowStatisticsInstance #{values}>\"\n end", "title": "" }, { "docid": "d6ca268cd96b79b9fa5cf09a8b0eee27", "score": "0.48664698", "text": "def execution_id\n value = @execution_id.value\n return if value.instance_of?(Object)\n\n value\n end", "title": "" }, { "docid": "22c33cb2bd1cae8924796091786312de", "score": "0.48647004", "text": "def execution_query(project, options = {})\n options = project_options_query(project, options)\n q = get('/executions', options)\n # Temporary fix for https://github.com/dblessing/rundeck-ruby/issues/25\n begin\n objectify q['result']['executions']\n rescue\n objectify q['executions']\n end\n end", "title": "" }, { "docid": "068b784b04545e4b988f2e476c9f80df", "score": "0.48609406", "text": "def fetch_flow_logs(region)\n ec2_client = get_ec2_client(region)\n next_token = nil\n flow_logs = []\n\n loop do\n options = { next_token: nil, max_results: 50 }\n resp = ec2_client.describe_flow_logs(options)\n next_token = resp.next_token\n flow_logs += resp.flow_logs\n break unless next_token\n end\n flow_logs\n end", "title": "" }, { "docid": "70dd67d095ccb6137cb22467ce394e40", "score": "0.48594812", "text": "def show\n @todos = @getflow.todos\n @groups = @getflow.groups\n end", "title": "" }, { "docid": "a53b43a1a4da4640953c66e0a5ca4e81", "score": "0.48498097", "text": "def flow_types\n return @flow_types\n end", "title": "" }, { "docid": "9de915ffd735cecba89e7ae3e923aa46", "score": "0.48483148", "text": "def inspect\n \"<Twilio.Studio.V2.FlowValidateInstance>\"\n end", "title": "" }, { "docid": "ddd20f8485f27b7c71616332e755acd0", "score": "0.4843602", "text": "def get_flow_history_history_id_with_http_info(flow_id, history_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flow_history_history_id ...\"\n end\n \n \n # verify the required parameter 'flow_id' is set\n fail ArgumentError, \"Missing the required parameter 'flow_id' when calling ArchitectApi.get_flow_history_history_id\" if flow_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'history_id' is set\n fail ArgumentError, \"Missing the required parameter 'history_id' when calling ArchitectApi.get_flow_history_history_id\" if history_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'sort_by'] && !['action', 'timestamp', 'user'].include?(opts[:'sort_by'])\n fail ArgumentError, 'invalid value for \"sort_by\", must be one of action, timestamp, user'\n end\n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows/{flowId}/history/{historyId}\".sub('{format}','json').sub('{' + 'flowId' + '}', flow_id.to_s).sub('{' + 'historyId' + '}', history_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'action'] = @api_client.build_collection_param(opts[:'action'], :multi) if opts[:'action']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\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 => 'HistoryListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_flow_history_history_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "f5dcc349db0488ce5173c7d746692efc", "score": "0.4843602", "text": "def get_flow_history_history_id_with_http_info(flow_id, history_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flow_history_history_id ...\"\n end\n \n \n # verify the required parameter 'flow_id' is set\n fail ArgumentError, \"Missing the required parameter 'flow_id' when calling ArchitectApi.get_flow_history_history_id\" if flow_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'history_id' is set\n fail ArgumentError, \"Missing the required parameter 'history_id' when calling ArchitectApi.get_flow_history_history_id\" if history_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'sort_by'] && !['action', 'timestamp', 'user'].include?(opts[:'sort_by'])\n fail ArgumentError, 'invalid value for \"sort_by\", must be one of action, timestamp, user'\n end\n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows/{flowId}/history/{historyId}\".sub('{format}','json').sub('{' + 'flowId' + '}', flow_id.to_s).sub('{' + 'historyId' + '}', history_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'action'] = @api_client.build_collection_param(opts[:'action'], :multi) if opts[:'action']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\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 => 'HistoryListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_flow_history_history_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "633d9f09c6fd08f7a4d52c807867062e", "score": "0.48304623", "text": "def inspect\n result = \"Transition: #{fsm.name} to #{new_state}\"\n case self.transition_proc\n when Proc\n filename, line = self.transition_proc.source_location\n result << \" on exec of #{Pathname.new(filename).basename}:#{line}\"\n when Symbol\n result << \" on exec of #{transition_proc.to_s}\"\n end\n result\n end", "title": "" }, { "docid": "f1b29172ae3ad786cf7300cb889f7b5c", "score": "0.48162755", "text": "def execution_time\n @process.instance_variable_get(:@execution_time).total\n end", "title": "" }, { "docid": "4b89f340b216dd99f27cdba76082ee3d", "score": "0.48082736", "text": "def dump\n unless @obsolete then\n puts \" WorkFlow task ##{ @id } '#{ @label }':\"\n puts \" #{ @inflows.count{ |f| !f.obsolete }} incoming flows:\"\n @inflows.each_with_index do |f,i|\n puts \" (#{ i }) #{ f.dump_info_from }\" unless f.obsolete\n end\n puts \" #{ @outflows.count{ |f| !f.obsolete }} outgoing flows:\"\n @outflows.each_with_index do |f,i| \n puts \" (#{ i }) #{ f.dump_info_to }\" unless f.obsolete\n end\n end\n end", "title": "" }, { "docid": "c301f43b0b536480f423c7efcf4825ba", "score": "0.4800765", "text": "def flow?\n parse\n @flow_id\n end", "title": "" }, { "docid": "4af210c78fdf191e0c4dc8a7b6748e7a", "score": "0.47960916", "text": "def execution_params\n params.require(:execution).permit(:state, :task_id)\n end", "title": "" }, { "docid": "4ca175f2c7a23fb5a9d230238dc1b301", "score": "0.47889256", "text": "def show\n @work_flow_info = WorkFlowInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @work_flow_info }\n end\n end", "title": "" }, { "docid": "0ffefbd54badd3acf09e0c7438c81388", "score": "0.47786525", "text": "def execution_history(symbol = 'XBTUSD', timestamp = Date.today)\n get 'executionHistory', symbol: symbol, timestamp: timestamp\n end", "title": "" }, { "docid": "c6d4415e5417c3bfdd13ee4e275fe290", "score": "0.4765861", "text": "def set_task_execution\n @task_execution = TaskExecution.find(params[:id])\n end", "title": "" }, { "docid": "5e831c50e2d59faf25f1dbbc4113bb7c", "score": "0.47655845", "text": "def get_traceflow_with_http_info(traceflow_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiTroubleshootingAndMonitoringTraceflowApi.get_traceflow ...'\n end\n # verify the required parameter 'traceflow_id' is set\n if @api_client.config.client_side_validation && traceflow_id.nil?\n fail ArgumentError, \"Missing the required parameter 'traceflow_id' when calling ManagementPlaneApiTroubleshootingAndMonitoringTraceflowApi.get_traceflow\"\n end\n # resource path\n local_var_path = '/traceflows/{traceflow-id}'.sub('{' + 'traceflow-id' + '}', traceflow_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'Traceflow')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiTroubleshootingAndMonitoringTraceflowApi#get_traceflow\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "e15fca200174a2d1c185480ba48e4e11", "score": "0.47621125", "text": "def execution_scope()\n return MicrosoftGraph::IdentityGovernance::LifecycleWorkflows::Workflows::Item::ExecutionScope::ExecutionScopeRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "d192db1b4ad0aa3d92ce416e98ffc735", "score": "0.47556603", "text": "def execution_context\n raise \"Execution Context is not available in detached frame \\\"#{frame.url}\\\" (are you trying to evaluate?)\" if @_detached\n\n @_context_promise.value\n end", "title": "" }, { "docid": "c4f6bcbff4c851b58963187f08476c69", "score": "0.47513103", "text": "def get_configured_flow(table_id: nil, flow_id: nil)\n raise ArgumentError, \"Table ID (table_id) required\" unless table_id\n raise ArgumentError, \"Flow ID (flow_id) required\" unless flow_id\n get_uri = \"#{@controller.get_node_config_uri(self)}/table/#{table_id}/\"\\\n \"flow/#{flow_id}\"\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", "title": "" }, { "docid": "8c9bb78878a1ca73c01377beda8d388b", "score": "0.47475567", "text": "def get_flows_outcome_with_http_info(flow_outcome_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flows_outcome ...\"\n end\n \n \n # verify the required parameter 'flow_outcome_id' is set\n fail ArgumentError, \"Missing the required parameter 'flow_outcome_id' when calling ArchitectApi.get_flows_outcome\" if flow_outcome_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows/outcomes/{flowOutcomeId}\".sub('{format}','json').sub('{' + 'flowOutcomeId' + '}', flow_outcome_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\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 => 'FlowOutcome')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_flows_outcome\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a2ecc883b307fb993c864f05a1b52f0d", "score": "0.47458628", "text": "def malware_execution_state_summary\n return @malware_execution_state_summary\n end", "title": "" }, { "docid": "546717dd4c95e3db1b94c2ab4454caf9", "score": "0.4744056", "text": "def show\n @work_flow = WorkFlow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @work_flow }\n end\n end", "title": "" }, { "docid": "f0a02fa865c20e66b3a6081dbd065364", "score": "0.47337535", "text": "def evaluando_resultados\n screen_name(\"#{@task.class.to_s}/evaluando_resultados\")\n\n @am_result = AmResult.where(\"ot_id = #{@ot.id}\").order(\"run_date DESC\").first\n\n respond_to do |format|\n format.html { render action: \"evaluando_resultados\" }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d0d6d40ce1e4da3613cc44f3598390d2", "score": "0.47254366", "text": "def evaluation_detail\n name\n end", "title": "" }, { "docid": "0e20043c693e9f32c4e737d88c73ce9d", "score": "0.47231868", "text": "def get_execution request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_execution_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Notebooks::V1::Execution.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "e9a1c189e78b13cd6bb3d6bd36af357a", "score": "0.46963295", "text": "def show\n @completed_tasks_count = @network_event.network_event_tasks.where.not(completed_at: nil).count\n @network_event_task = NetworkEventTask.new\n end", "title": "" }, { "docid": "b41c4d1a11ddd3cf296e81654fd947b5", "score": "0.4696316", "text": "def show\n @test_execution = TestExecution.find(params[:id])\n respond_to do |format|\n # Don't send tons of JSON until we have results. In the meantime, just update the client on our calculation status.\n format.js\n format.html\n end\n end", "title": "" }, { "docid": "c0160aca0a3a99394d4c2fce27793544", "score": "0.46930426", "text": "def show_workflow(id, opts = {})\n data, _status_code, _headers = show_workflow_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "c0160aca0a3a99394d4c2fce27793544", "score": "0.46930426", "text": "def show_workflow(id, opts = {})\n data, _status_code, _headers = show_workflow_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "144107c851533b47c2d2535490df9adb", "score": "0.46883982", "text": "def show\r\n @project = Project.find params[:project_id] if params[:project_id]\r\n @project ||= @round.projects.first\r\n @issue = Issue.find params[:issue_id] if params[:issue_id]\r\n @scenario = Scenario.find params[:scenario_id] if params[:scenario_id]\r\n\r\n @label = Label.find params[:label_id] if params[:label_id]\r\n @no_label = params[:no_label]\r\n @unexecuted = params[:unexecuted]\r\n @execution_result = params[:execution_result]\r\n\r\n conditions = {}\r\n conditions[:issue_id] = @issue.id if @issue\r\n\r\n @scenario_folders = @project.requirements\r\n\r\n @scenarios_grid = ScenarioGrid.new do |scope|\r\n r = scope.where(conditions)\r\n r = r.label(@label) if @label\r\n r = r.no_label if @no_label\r\n r = r.unexecuted(@round) if @unexecuted\r\n r = r.execution_result(@round, @execution_result) if @execution_result\r\n r.page(params[:page]).per(20)\r\n end\r\n @scenarios_grid.column_names = [:execution_title, :defects, :labels, \"execution_buttons project-actions\"]\r\n\r\n @defects = Defect.current_scenario(@scenario) if @scenario\r\n end", "title": "" }, { "docid": "ad8b4d74e6c51816d3ca82a710fe3a4a", "score": "0.46852514", "text": "def show\n @eval = Eval.find(params[:id])\n end", "title": "" }, { "docid": "8eb0756861102bb4ff1f15e2aa18ee04", "score": "0.46815988", "text": "def show\n @eval = Eval.find(params[:id])\n Thread.new {\n begin\n result = eval(@eval.code)\n rescue Exception => e\n result = \"OH NO: #{e}\"\n ensure\n @result = \"Current Thread:#{Thread.current}, Result: #{result}\"\n end\n }.join(10)\n respond_with(@eval)\n end", "title": "" }, { "docid": "1f9848dc8bdd503e4455a0cf87c73bb5", "score": "0.4678437", "text": "def getCompareExecution\n data = Hash.new\n begin\n data[:current_execution]=Execution.find_by(id: params[:id])\n data[:compare_execution]=Execution.find_by(id: params[:compare_id])\n render json: data\n rescue Exception => e\n data[:error] = e.message.strip\n data[:trace] = e.backtrace.join(\"<br>\")\n render json: data\n end\n end", "title": "" }, { "docid": "aadc0b86160a5d78e56baa4fe685f04b", "score": "0.46764848", "text": "def execution(reload=false)\n\n exid = @values[:exid]; return nil unless exid\n\n @flor_model_cache_execution = nil if reload\n\n @flor_model_cache_execution ||= unit.executions[exid: exid]\n end", "title": "" }, { "docid": "b700eaf692e0caa95ca4c8ec458f2ad9", "score": "0.46713105", "text": "def get_flows_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flows ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'secure'] && !['any', 'checkedin', 'published'].include?(opts[:'secure'])\n fail ArgumentError, 'invalid value for \"secure\", must be one of any, checkedin, published'\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'type'] = @api_client.build_collection_param(opts[:'type'], :multi) if opts[:'type']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'description'] = opts[:'description'] if opts[:'description']\n query_params[:'nameOrDescription'] = opts[:'name_or_description'] if opts[:'name_or_description']\n query_params[:'publishVersionId'] = opts[:'publish_version_id'] if opts[:'publish_version_id']\n query_params[:'editableBy'] = opts[:'editable_by'] if opts[:'editable_by']\n query_params[:'lockedBy'] = opts[:'locked_by'] if opts[:'locked_by']\n query_params[:'lockedByClientId'] = opts[:'locked_by_client_id'] if opts[:'locked_by_client_id']\n query_params[:'secure'] = opts[:'secure'] if opts[:'secure']\n query_params[:'deleted'] = opts[:'deleted'] if opts[:'deleted']\n query_params[:'includeSchemas'] = opts[:'include_schemas'] if opts[:'include_schemas']\n query_params[:'publishedAfter'] = opts[:'published_after'] if opts[:'published_after']\n query_params[:'publishedBefore'] = opts[:'published_before'] if opts[:'published_before']\n query_params[:'divisionId'] = @api_client.build_collection_param(opts[:'division_id'], :multi) if opts[:'division_id']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\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 => 'FlowEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_flows\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "74b47b05f643b81638c3bf3762bdebdb", "score": "0.46700367", "text": "def execution_parameters\n @execution_parameters ||= []\n end", "title": "" }, { "docid": "7760f7f20ce7d150c38ab26771a13a2b", "score": "0.4665911", "text": "def data\n @run_status.to_h\n end", "title": "" }, { "docid": "62e4b3383eae350c4c97515899f20836", "score": "0.46539843", "text": "def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n else\n puts \"No task running!\"\n end\n end", "title": "" }, { "docid": "960e9600bfb390cbd52c253f73332aab", "score": "0.4652007", "text": "def get_flows_with_http_info(type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flows ...\"\n end\n \n \n # verify the required parameter 'type' is set\n fail ArgumentError, \"Missing the required parameter 'type' when calling ArchitectApi.get_flows\" if type.nil?\n \n # verify enum value\n unless ['inboundcall', 'inboundemail', 'inboundshortmessage', 'outboundcall', 'inqueuecall', 'speech', 'securecall', 'surveyinvite', 'workflow'].include?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of inboundcall, inboundemail, inboundshortmessage, outboundcall, inqueuecall, speech, securecall, surveyinvite, workflow\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if opts[:'secure'] && !['any', 'checkedin', 'published'].include?(opts[:'secure'])\n fail ArgumentError, 'invalid value for \"secure\", must be one of any, checkedin, published'\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'type'] = type\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'description'] = opts[:'description'] if opts[:'description']\n query_params[:'nameOrDescription'] = opts[:'name_or_description'] if opts[:'name_or_description']\n query_params[:'publishVersionId'] = opts[:'publish_version_id'] if opts[:'publish_version_id']\n query_params[:'editableBy'] = opts[:'editable_by'] if opts[:'editable_by']\n query_params[:'lockedBy'] = opts[:'locked_by'] if opts[:'locked_by']\n query_params[:'secure'] = opts[:'secure'] if opts[:'secure']\n query_params[:'deleted'] = opts[:'deleted'] if opts[:'deleted']\n query_params[:'includeSchemas'] = opts[:'include_schemas'] if opts[:'include_schemas']\n query_params[:'publishedAfter'] = opts[:'published_after'] if opts[:'published_after']\n query_params[:'publishedBefore'] = opts[:'published_before'] if opts[:'published_before']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\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 => 'FlowEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_flows\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "94f8bfb5f31dae5283cbf3eaf2a96906", "score": "0.46410578", "text": "def getflow_params\n params.require(:getflow).permit(:name, :title, :completed)\n end", "title": "" }, { "docid": "d27eee9e89b2cf3776c2065129debbdf", "score": "0.4640773", "text": "def executions order = nil\n connection.executions_for_user id, order\n end", "title": "" }, { "docid": "2fbdbc2f636f4501045a0f27b1aa84e1", "score": "0.46315503", "text": "def get_flow_latestconfiguration_with_http_info(flow_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flow_latestconfiguration ...\"\n end\n \n \n # verify the required parameter 'flow_id' is set\n fail ArgumentError, \"Missing the required parameter 'flow_id' when calling ArchitectApi.get_flow_latestconfiguration\" if flow_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows/{flowId}/latestconfiguration\".sub('{format}','json').sub('{' + 'flowId' + '}', flow_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'deleted'] = opts[:'deleted'] if opts[:'deleted']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_flow_latestconfiguration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c3c5edf8640bc89ade1f1c4c44b621dd", "score": "0.46314776", "text": "def show\n \n begin\n\n if session[:role_type] == \"Admin\" || session[:role_type] == \"Teacher\"\n\n @event = Event.find(params[:id])\n @school_user = @event.school_user\n method(:getEventDetails).call \n \n\n else # Event detail for Parent\n \n\n end \n\n rescue Exception => e\n \n end\n end", "title": "" }, { "docid": "c9ff678fdea51fe5d94e10f236a34311", "score": "0.46311438", "text": "def quality_details\n begin\n @project_id = params[:project_id]\n user_assigned = current_user.is_assigned_to_project(params[:project_id])\n @data_point = QualityDetailDataPoint.new\n action = ''\n\n # Now get any additional user instructions for this section\n @ef_instruction = EfInstruction.find(:first, :conditions=>[\"ef_id = ? and section = ? and data_element = ?\", params[:extraction_form_id].to_s, \"QUALITY\", \"GENERAL\"])\n @ef_instruction = @ef_instruction.nil? ? \"\" : @ef_instruction.instructions\n\n by_category = EfSectionOption.is_section_by_category?(params[:extraction_form_id], 'quality_detail')\n if by_category\n @data = QuestionBuilder.get_questions(\"quality_detail\", params[:study_id], params[:extraction_form_id], {:user_assigned => user_assigned, :is_by_outcome=>true, :include_total=>false})\n action = 'question_based_section_by_category'\n else\n action = 'question_based_section'\n @data = QuestionBuilder.get_questions(\"quality_detail\", params[:study_id], params[:extraction_form_id], {:user_assigned => user_assigned})\n end\n render :action=>\"#{action}\", :layout=>false\n rescue Exception => e\n puts \"ERROR: #{e.message}\\n\\n#{e.backtrace}\\n\\n\"\n end\n end", "title": "" }, { "docid": "d3274f69f846adc773161b51b2502477", "score": "0.46304646", "text": "def get_flow_latestconfiguration_with_http_info(flow_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flow_latestconfiguration ...\"\n end\n \n \n # verify the required parameter 'flow_id' is set\n fail ArgumentError, \"Missing the required parameter 'flow_id' when calling ArchitectApi.get_flow_latestconfiguration\" if flow_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows/{flowId}/latestconfiguration\".sub('{format}','json').sub('{' + 'flowId' + '}', flow_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'deleted'] = opts[:'deleted'] if opts[:'deleted']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_flow_latestconfiguration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c0dff65d70757c5af6a810adad507751", "score": "0.46162078", "text": "def flow\n end", "title": "" }, { "docid": "692b6ef768c4309453516479db8d8ab3", "score": "0.46153837", "text": "def task_steps_simple\n # this is a read-only display of workflow steps needed or completed\n # D - C - P - B - S\n # maybe it'll contain a id of the related item\n steps = Task.find_all_by_job_id(self).sort { |a, b| (a.order || 1) <=> (b.order || 1) } \n \n #puts steps.class\n end", "title": "" }, { "docid": "0ff356c6db95cf4ff6b30a3bf47c9a36", "score": "0.4614904", "text": "def post_flows_executions_with_http_info(flow_launch_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.post_flows_executions ...\"\n end\n \n \n # verify the required parameter 'flow_launch_request' is set\n fail ArgumentError, \"Missing the required parameter 'flow_launch_request' when calling ArchitectApi.post_flows_executions\" if flow_launch_request.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/flows/executions\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(flow_launch_request)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'FlowExecutionLaunchResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#post_flows_executions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "772c13f3f97d85abcc35e5556e272f64", "score": "0.46082407", "text": "def show\n @auditflows_flownode = AuditflowsFlownode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auditflows_flownode }\n end\n end", "title": "" }, { "docid": "ce93a85536002e35b2b33dd2ed14cd3b", "score": "0.46034834", "text": "def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsContext #{context}>\"\n end", "title": "" }, { "docid": "14326b6d823e15fb4f04d876f98f2e6c", "score": "0.46034154", "text": "def show\n @lab_flow = LabFlow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_flow }\n end\n end", "title": "" }, { "docid": "6c7ca73e3b1dcb656100d489d8a0d201", "score": "0.45865506", "text": "def execution_conditions\n return @execution_conditions\n end", "title": "" }, { "docid": "58ef30ef9cf02085d2e43f8e3362a5d3", "score": "0.45802182", "text": "def fetchActivityDetails(whoId)\n return checkRecordCreated(\"Task\", \"SELECT id ,Markets_Interested__c,Country_Code__c,Locale__c,Market__c, Subject , CreatedDate,Status , Owner.Name,Lead_Source__c , Lead_Source_Detail__c,Locations_Interested__c, Number_of_Full_Time_Employees__c,Interested_in_Number_of_Desks__c,Company__c,WhoId,Priority,Email__c,Who.Name,Type FROM Task WHERE WhoId = '#{whoId}' order by CreatedDate\")\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "456eaf3ced45512dfe1455dbf3ee6402", "score": "0.0", "text": "def set_share\n # @share = Share.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.5946146", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.591683", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58349305", "text": "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.5776858", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.5652805", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.5621621", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54210985", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53402257", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.53394014", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.53321576", "text": "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.53124547", "text": "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.529654", "text": "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.5296262", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.52952296", "text": "def setup_handler\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.52600986", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.52442724", "text": "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.5232394", "text": "def workflow\n end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.523231", "text": "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5227454", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.52201617", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.5212327", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.52079266", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.52050185", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.51754695", "text": "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.51726824", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.5166172", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.5159343", "text": "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.51578903", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.51522785", "text": "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152022", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.51518047", "text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.51456624", "text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.5133759", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.5112076", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.5106169", "text": "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.509231", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.50873137", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5081088", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.508059", "text": "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50677156", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.50562143", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5050554", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50474834", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50474834", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.5036181", "text": "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5026331", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.5022976", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.5015441", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.50121695", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.5000944", "text": "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.5000019", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.4996878", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989888", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989888", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49864885", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.49797225", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49785787", "text": "def after_set_callback; end", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.4976161", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.49683493", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.4965126", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.4958034", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49559742", "text": "def release_actions; end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.4954353", "text": "def around_hooks; end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.49535993", "text": "def save_action; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.4952725", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.49467874", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.49423352", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.49325448", "text": "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.49282882", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49269363", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49269104", "text": "def default_action; end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49252945", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4923091", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49194667", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.49174926", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49173003", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.49171105", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.4915879", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49155936", "text": "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6879baffd0009d8fbf6d6f310b0465a4", "score": "0.0", "text": "def daily_work_params\n params.require(:daily_work).permit(\n :date,\n :user_id,\n daily_work_kpis_attributes: [:id, :title, :kpi_id, :task_id, :hours, :comment, :_destroy],\n )\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74968386", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958337", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69237196", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.6895035", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.6787112", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6745602", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6683643", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6638232", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.6630457", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.6628529", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65637696", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.64917076", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6479415", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6455687", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.6400469", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63837224", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.6364913", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.6341023", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336676", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.632594", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.63209516", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63157374", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63150436", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6307892", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6302733", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.6300768", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.62979907", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6293644", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.6293644", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.62795895", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6274884", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.626915", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256255", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.6255966", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62533283", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.62366754", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.62303895", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.6229292", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6228921", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.62272227", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6202016", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.6192254", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61834604", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179201", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61642444", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.61629325", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6156991", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61561215", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.613715", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61347073", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.6120685", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61168665", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61168665", "text": "def check_params; true; end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.6115135", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61118466", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6104071", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.6104071", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.60990196", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.60990196", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.6087115", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.6086125", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60847986", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6079096", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60765314", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60691494", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6068547", "text": "def need_params\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.60680497", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60678715", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6065353", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6063699", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6062299", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.6058447", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60495216", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60495216", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.6049383", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6047766", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6042084", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.6036135", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.603078", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6026199", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.60226476", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.602105", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6018039", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.6016154", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60098565", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60080767", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60080767", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.60066646", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.6004359", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6003022", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60029835", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.600259", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.600259", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.6000775", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59989756", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59989756", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59950405", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5995033", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5994783", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.5992111", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.5991984", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" } ]
1194369afc25bf3aea34be4a8b9e8c36
PUT /businesses/1 PUT /businesses/1.json
[ { "docid": "65fae3d8ed9d011f937350feaf40c1bf", "score": "0.535841", "text": "def update\n @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(params[:business])\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "664e7b8d3595cf3ab2f18fabc22d1fe5", "score": "0.65456283", "text": "def update\n @bus.update(bus_params)\n respond_with(@bus)\n end", "title": "" }, { "docid": "06cfaceed9673b50336302398877e3a4", "score": "0.65383804", "text": "def update\n update_object(@business, \"#{businesses_url}?scheme_id=#{@business.scheme_id}\", business_params)\n end", "title": "" }, { "docid": "319b29cfef4475e8cf6e345c2c9e18b8", "score": "0.6169936", "text": "def update\n @bus = Bus.find(params[:id])\n\n respond_to do |format|\n if @bus.update_attributes(params[:bus])\n format.html { redirect_to @bus, notice: 'Bus was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a77ba7f0f7088be3127eaab1067a24f", "score": "0.6089796", "text": "def update\n respond_to do |format|\n if @bus.update(bus_params)\n format.html { redirect_to @bus, notice: \"Bus was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bce127a4d44e3db298297738107ce8ac", "score": "0.605473", "text": "def update\n respond_to do |format|\n if @bus.update(bus_params)\n format.html { redirect_to @bus, notice: 'Bus was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bce127a4d44e3db298297738107ce8ac", "score": "0.605473", "text": "def update\n respond_to do |format|\n if @bus.update(bus_params)\n format.html { redirect_to @bus, notice: 'Bus was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bce127a4d44e3db298297738107ce8ac", "score": "0.605473", "text": "def update\n respond_to do |format|\n if @bus.update(bus_params)\n format.html { redirect_to @bus, notice: 'Bus was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4b938960b9e6b8349b43df6b55a5770", "score": "0.5859291", "text": "def update\n respond_to do |format|\n if(@bus==nil)\n format.html { redirect_to buses_path, notice: 'Bus id not found' }\n elsif @bus.update(bus_params)\n format.html { redirect_to @bus, notice: 'Bus was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7f4757c7e55d5e2af4bf456744e2a22", "score": "0.5846843", "text": "def update \n @bus = Bus.find(params[:id]) \n if @bus.update_attributes(bus_params) \n flash[:notice] = 'Bus updated!' \n redirect_to buses_path \n else \n flash[:error] = 'Failed to edit bus!' \n render :edit \n end \n end", "title": "" }, { "docid": "426f9c32ae94e0535376e66c7ba77e05", "score": "0.5828884", "text": "def update\n @bus, status = Bus.updateBus(@bus, params)\n respond_to do |format|\n if status == true\n format.html { redirect_to @bus, notice: 'Bus was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus }\n else\n format.html { render :edit }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3cb9dea10eb7f71e84dc6f8467efd8ce", "score": "0.5821126", "text": "def update\n respond_to do |format|\n if @busroute.update(busroute_params)\n format.html { redirect_to @busroute, notice: 'Busroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @busroute.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c35f89f4e93251128bbf53c08021b3d", "score": "0.5792932", "text": "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", "title": "" }, { "docid": "8526bda945752e27df3ffdba1b7efea0", "score": "0.5756022", "text": "def update_mobile_carrier(args = {}) \n put(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "title": "" }, { "docid": "22058e69b37928600f68b67cb6a1d810", "score": "0.57386357", "text": "def update\n respond_to do |format|\n if @bus_model.update(bus_model_params)\n format.html { redirect_to @bus_model, notice: 'Bus model was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_model }\n else\n format.html { render :edit }\n format.json { render json: @bus_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c43d3faa277b2f216892828997a347a", "score": "0.5730827", "text": "def index\n @businesses = Business.all\n render json: @businesses\n end", "title": "" }, { "docid": "991054dd499fc3af27aafb32404f04c4", "score": "0.57219064", "text": "def update\n @businesses_in_category = BusinessesInCategory.find(params[:id])\n\n respond_to do |format|\n if @businesses_in_category.update_attributes(params[:businesses_in_category])\n format.html { redirect_to @businesses_in_category, notice: 'Businesses in category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @businesses_in_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b497fa0442e34207b450617c5c478a0", "score": "0.57192856", "text": "def update\n respond_to do |format|\n if @bus_route.update(bus_route_params)\n format.html { redirect_to @bus_route, notice: 'Bus route was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_route }\n else\n format.html { render :edit }\n format.json { render json: @bus_route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "699115a1dc63114faeb65e31229a9aac", "score": "0.57154566", "text": "def update\n @bus_entry = BusEntry.find(params[:id])\n\n respond_to do |format|\n if @bus_entry.update_attributes(params[:bus_entry])\n format.html { redirect_to @bus_entry, notice: 'Bus entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f79ae388d0642463d86c4930df55b91", "score": "0.5693613", "text": "def update\n @bus = Bus.find(params[:id])\n\n respond_to do |format|\n if @bus.update_attributes(params[:bus])\n format.html { redirect_to(@bus, :notice => 'Bus was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bus.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f79ae388d0642463d86c4930df55b91", "score": "0.5693613", "text": "def update\n @bus = Bus.find(params[:id])\n\n respond_to do |format|\n if @bus.update_attributes(params[:bus])\n format.html { redirect_to(@bus, :notice => 'Bus was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bus.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b354fbebb96d8730a0d515f1530528a3", "score": "0.5692523", "text": "def update\n respond_to do |format|\n if @bus_line.update(bus_line_params)\n format.html { redirect_to @bus_line, notice: \"Bus line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bus_line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bus_line.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c534e4bb0039271265789426f52ada7", "score": "0.5684798", "text": "def update\n @business = current_user.businesses.find(params[:id])\n @businesses = current_user.try(:businesses) || []\n\n respond_to do |format|\n if @business.update_attributes(params[:business])\n flash[:notice] = 'Location was successfully updated.'\n format.html { redirect_to(edit_business_path(@business.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @business.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "773a6658f62250448659cc414efe069a", "score": "0.5641117", "text": "def update\n boat = Boat.find_by(name: params[:name])\n\n if boat.update(boat_params)\n render json: BoatSerializer.new(boat).serialized_json\n else\n render json: errors(boat), status: 422\n end\n\n end", "title": "" }, { "docid": "a72cafb2a37f92fa678898dba17fac80", "score": "0.5612389", "text": "def set_bus\n @bus = Bus.find(params[:id])\n end", "title": "" }, { "docid": "ecc9e2a1cf1b0619cb26e877c779d6a7", "score": "0.56100917", "text": "def booking_businesses=(value)\n @booking_businesses = value\n end", "title": "" }, { "docid": "f81422c5eb54d5c555f733e1cb7bbd49", "score": "0.5608833", "text": "def update\n if @business.update(business_params)\n redirect_to user_businesses_path, notice: \"#{@business.name} was successfully updated.\"\n else\n render :edit\n end\n end", "title": "" }, { "docid": "03f75df8530a7f5b44552b85b3c5ee1b", "score": "0.55843604", "text": "def update\n respond_to do |format|\n if @busform.update(busform_params)\n format.html { redirect_to @busform, notice: 'Busform was successfully updated.' }\n format.json { render :show, status: :ok, location: @busform }\n else\n format.html { render :edit }\n format.json { render json: @busform.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b08d0f45c8047a856c5abec1a167db8", "score": "0.5563452", "text": "def update\n respond_to do |format|\n if @bus_request.update(bus_request_params)\n format.html { redirect_to @bus_request, notice: 'Bus request was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_request }\n else\n format.html { render :edit }\n format.json { render json: @bus_request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e57b7344a5a21ab8e1851795b97c16cf", "score": "0.5549147", "text": "def set_busine\n @busine = Busine.find(params[:id])\n end", "title": "" }, { "docid": "47444b214834207c77916ba58083e6f8", "score": "0.5542699", "text": "def update\n respond_to do |format|\n if @bus_reservation.update(bus_reservation_params)\n format.html { redirect_to @bus_reservation, notice: 'Bus reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_reservation }\n else\n format.html { render :edit }\n format.json { render json: @bus_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9664847f9c63cd11a0429fe445609b21", "score": "0.55287534", "text": "def set_bus\n @bus = Bus.find(params[:bus_id])\n end", "title": "" }, { "docid": "97291e019e4369008c5c92f153f30975", "score": "0.5510762", "text": "def set_bus\n @bus = Bus.find_by_id(params[:id])\n end", "title": "" }, { "docid": "7f195da7898a058dd00339f6f4ece71a", "score": "0.55080485", "text": "def set_bus\n @bus = Bus.find(params[:id])\n end", "title": "" }, { "docid": "7f195da7898a058dd00339f6f4ece71a", "score": "0.55080485", "text": "def set_bus\n @bus = Bus.find(params[:id])\n end", "title": "" }, { "docid": "7f195da7898a058dd00339f6f4ece71a", "score": "0.55080485", "text": "def set_bus\n @bus = Bus.find(params[:id])\n end", "title": "" }, { "docid": "7f195da7898a058dd00339f6f4ece71a", "score": "0.55080485", "text": "def set_bus\n @bus = Bus.find(params[:id])\n end", "title": "" }, { "docid": "bb07becddcb6eb606b187d303744c881", "score": "0.54909843", "text": "def update\n if @business.update(business_params)\n redirect_to businesses_path, notice: \"#{@business.name} was successfully updated.\"\n else\n render :edit\n end\n end", "title": "" }, { "docid": "b8576fbbc7a6d68f7649f73acdad569d", "score": "0.5486992", "text": "def set_bus\n if params[:id]\n @bus = Bus.find(params[:id])\n else\n @bus = Bus.find(params[:bus_id])\n end\n end", "title": "" }, { "docid": "42eaf070920549a983dc3363c176fb02", "score": "0.54868776", "text": "def create\n @bus = Bus.new(bus_params)\n @bus.save\n respond_with(@bus)\n end", "title": "" }, { "docid": "ba846b0394e1bf03e14eb919437d6d92", "score": "0.54700476", "text": "def update\n @bus_route = BusRoute.find(params[:id])\n\n respond_to do |format|\n if @bus_route.update_attributes(params[:bus_route])\n flash[:notice] = 'BusRoute was successfully updated.'\n format.html { redirect_to(@bus_route) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bus_route.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5aaed2a49615db52e39accdc14608614", "score": "0.5454718", "text": "def create\n @bus = Bus.new(bus_params)\n\n respond_to do |format|\n if @bus.save\n format.html { redirect_to buses_path, notice: 'Bus was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f61132f51f3bd432d55baf556ed4858b", "score": "0.545309", "text": "def create\n @bus = Bus.new(params[:bus])\n\n respond_to do |format|\n if @bus.save\n format.html { redirect_to @bus, notice: 'Bus was successfully created.' }\n format.json { render json: @bus, status: :created, location: @bus }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7627a831205add50fbdd8ab2a57efa9", "score": "0.5445971", "text": "def index\n @businesses = Business.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @businesses }\n end\n end", "title": "" }, { "docid": "0a05ae0124209d5799e65fddf047a776", "score": "0.5425091", "text": "def update\n @bus_stop = BusStop.get(params[:id])\n\n respond_to do |format|\n if @bus_stop.update(params[:bus_stop])\n format.html { redirect_to @bus_stop, notice: 'Bus stop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus_stop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c31a41c451d08db3e7ad600adb9ea30", "score": "0.5411571", "text": "def update\n respond_to do |format|\n if @rebus.update(rebus_params)\n format.html { redirect_to @rebus, notice: 'Rebus was successfully updated.' }\n format.json { render :show, status: :ok, location: @rebus }\n else\n format.html { render :edit }\n format.json { render json: @rebus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c719ec6f3ec0383d020eb26f7b54f3d", "score": "0.5400212", "text": "def save_option(businesses, count, user)\n business_name = businesses[count - 1][:name]\n business_address = businesses[count -1][:address]\n place = Place.create(name: business_name, address: business_address)\n saved_location = SavedLocation.create(user_id: user.id, place_id: place.id, name: business_name)\nend", "title": "" }, { "docid": "497a6e9c931722af6cb79aa8f94ef24e", "score": "0.5399128", "text": "def update\n @booking.update_attributes(params[:booking])\n respond_with(@booking, location: bnb_bookings_url(@booking.bnb))\n end", "title": "" }, { "docid": "2c5ccaf77062df57e280f999f6cce735", "score": "0.5395212", "text": "def update\n @bus = Bus.find(params[:id])\n authorize! :edit, Bus\n\n respond_to do |format|\n if @bus.update_attributes(params[:bus])\n format.html { redirect_to @bus, notice: 'Bus was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.5390249", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "0f8872308cd71e90aed963baf02fd23e", "score": "0.53810316", "text": "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", "title": "" }, { "docid": "e1d7844594d01cbff56fe6d5d9109e55", "score": "0.5368333", "text": "def update\n respond_to do |format|\n if @busking.update(busking_params)\n format.html { redirect_to @busking, notice: 'Busking was successfully updated.' }\n format.json { render :show, status: :ok, location: @busking }\n else\n format.html { render :edit }\n format.json { render json: @busking.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac7c27589b9f3b4eedaf1ed6e07857d4", "score": "0.5367281", "text": "def update_baas_business_using_put_with_http_info(nucleus_business_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BaasApi.update_baas_business_using_put ...'\n end\n # verify the required parameter 'nucleus_business_id' is set\n if @api_client.config.client_side_validation && nucleus_business_id.nil?\n fail ArgumentError, \"Missing the required parameter 'nucleus_business_id' when calling BaasApi.update_baas_business_using_put\"\n end\n # resource path\n local_var_path = '/baas/business/{nucleus_business_id}'.sub('{' + 'nucleus_business_id' + '}', nucleus_business_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'baas_business_co'])\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BaasBusinessVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BaasApi#update_baas_business_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "aa0b87a16ede7353758305dbbaf57c22", "score": "0.5363096", "text": "def put(*a) route 'PUT', *a end", "title": "" }, { "docid": "0410404f3e5477611130f2b21fb092f4", "score": "0.5362508", "text": "def complete_service(service_id, taxi_id, verification_code)\n assert_no_difference 'Service.all.size' do \n put :update, {:format=>:json, :id=>service_id, \n :state=>Service.complete, :taxi_id=>taxi_id, :verification_code=>verification_code} \n end\n\n end", "title": "" }, { "docid": "2b988498c5b08cc8f654a532bccd108d", "score": "0.53543985", "text": "def set_busroute\n @busroute = Busroute.find(params[:id])\n end", "title": "" }, { "docid": "6113a1ac060729daef13a106f9055892", "score": "0.53523254", "text": "def create\n @bus = Bus.new(bus_params)\n\n respond_to do |format|\n if @bus.save\n format.html { redirect_to @bus, notice: \"Bus was successfully created.\" }\n format.json { render :show, status: :created, location: @bus }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a21658e8869b48b877bfbe57de8fb717", "score": "0.5349638", "text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.put(\n url,\n { Contact: { email: \"[email protected]\" } } )\n \nend", "title": "" }, { "docid": "b434f7b350de8c29f3d7fb34cf9307cf", "score": "0.5341579", "text": "def update\n @about_boss.update(about_boss_params)\n @about_bosses = AboutBoss.all\n @about_boss = AboutBoss.new\n end", "title": "" }, { "docid": "8abae36c48cdd974b7feaec9308067cf", "score": "0.5337766", "text": "def create\n @bus = Bus.new(bus_params)\n\n respond_to do |format|\n if @bus.save\n format.html { redirect_to @bus, notice: 'Bus was successfully created.' }\n format.json { render :show, status: :created, location: @bus }\n else\n format.html { render :new }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8abae36c48cdd974b7feaec9308067cf", "score": "0.5337766", "text": "def create\n @bus = Bus.new(bus_params)\n\n respond_to do |format|\n if @bus.save\n format.html { redirect_to @bus, notice: 'Bus was successfully created.' }\n format.json { render :show, status: :created, location: @bus }\n else\n format.html { render :new }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e082ece7cef1f4c22a84ddfc54a9c156", "score": "0.5335326", "text": "def update\n if params[:id]\n @bus_stop = BusStop.find(params[:id])\n else\n @bus_stop = BusStop.find_by_name(params[:find_name])\n end\n respond_to do |format|\n if @bus_stop.update_attributes(params[:bus_stop])\n format.html { redirect_to @bus_stop, notice: 'Bus stop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus_stop.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d79ab0f2756bb121358f75875eac5a9d", "score": "0.53330123", "text": "def set_bus_route\n @bus_route = BusRoute.find(params[:id])\n end", "title": "" }, { "docid": "f11b9965f8865f204bad98cfa5d7360e", "score": "0.5332809", "text": "def create\n @bus, status = Bus.addNewBus(params)\n\n respond_to do |format|\n if status == true\n format.html { redirect_to @bus, notice: 'Bus was successfully created.' }\n format.json { render :show, status: :created, location: @bus }\n else\n format.html { render :new }\n format.json { render json: @bus.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "0b9509746d4693bceaf6a79779da0d57", "score": "0.5320328", "text": "def index\n @businesses = Business.all\n end", "title": "" }, { "docid": "1e70404570c307d299544e0a09ac2461", "score": "0.5317299", "text": "def update_company(id, model) path = \"/api/v2/companies/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "title": "" }, { "docid": "0d5090da09bc6e07b5cb204d4ba4ee5d", "score": "0.5314981", "text": "def update\n if @business.update(business_params)\n render json: { status: 200, data: {business: @business} , message: \"Business was successfully updated\" }\n else\n render json: { status: 401, errors: @business.errors.full_messages }\n end\n end", "title": "" }, { "docid": "b611fa3272a45f76edf60d808167f714", "score": "0.5306784", "text": "def update\n @business = Business.find(params[:id])\n @treasury = @business.treasury\n return if needs_treasury_supervisor(@treasury)\n\n respond_to do |format|\n if @business.update_attributes(business_params)\n format.html { redirect_to treasury_businesses_path(@treasury), notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: { errors: @business.errors }, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2572fb900123dab962d92dfd5cd31505", "score": "0.53051037", "text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend", "title": "" }, { "docid": "f7fa1001d8a6ae1aa5ff49f652b69c4a", "score": "0.530467", "text": "def update\n render json: @beacon.errors unless @beacon.update(beacon_params)\n end", "title": "" }, { "docid": "8dac5fca5170bbb2cf0ed50083bd5ff9", "score": "0.52919376", "text": "def update\n \n if @api_v1_address.update(api_v1_address_params)\n render json: @api_v1_address\n else\n render json: @api_v1_address.errors, status: 400\n end\n \n end", "title": "" }, { "docid": "92d21128b07735e35b16f9af746af92f", "score": "0.52825963", "text": "def create\n @business = current_user.businesses.build(business_params)\n\n respond_to do |format|\n if @business.save\n format.html { redirect_to @business, notice: \"Business was successfully created.\" }\n format.json { render :show, status: :created, location: @business }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ba75bae159ec6e2db7294c7940d3aa0", "score": "0.5275803", "text": "def bus_params\n params.require(:bus).permit(:plate, :model, :nSeats)\n end", "title": "" }, { "docid": "88268cb8a0fe256f8c5b604909a0da9e", "score": "0.52675617", "text": "def update\n venue = Venue.find(params[:id])\n if venue.update(venue_params)\n render json: venue, status: 200, location: [:api, venue]\n else\n failed_to_update(venue, \"venue\")\n end\n end", "title": "" }, { "docid": "882c8317370987b86425c0adbf5bfe8c", "score": "0.526735", "text": "def update_aos_version(args = {}) \n put(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "c6afcb9c8dd691d4406d6639e98eb871", "score": "0.5265835", "text": "def update\n if @business.update(ParamsHelper.business_params(params))\n render json: BusinessDTO.instance_to_hash(@business), status: :ok\n else\n logger.warn \"Trying to update business{#{@business.inspect}} resulted in errors: #{@business.errors.full_messages}\"\n errors = errors_to_hash(@business)\n render json: errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e8b684d05b24e5f37fea1699063f8e7f", "score": "0.52631664", "text": "def update\n respond_to do |format|\n @business.status = 0\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Centro de trabajo actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5bc28fb324b8bba254d6b704167034ab", "score": "0.52579385", "text": "def update\n @burger_place = BurgerPlace.find(params[:id])\n\n if @burger_place.update(burger_place_params)\n head :no_content\n else\n render json: @burger_place.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "62902f04e6426dc1a895e418ef57e559", "score": "0.52522886", "text": "def set_bus_line\n @bus_line = BusLine.find(params[:id])\n end", "title": "" }, { "docid": "20d4050399260afa71e7f4a7433a203c", "score": "0.52518386", "text": "def update\n @responded = false\n respond_to do |format|\n Business.transaction do\n Address.transaction do\n @business.update(business_params)\n @business.shipping_address.update(shipping_address_params)\n @business.billing_address.update(billing_address_params)\n format.html {redirect_to dashboard_path, notice: 'Business was successfully updated.'}\n format.json {render :show, status: :ok, location: dashboard_path}\n @responded = true\n end\n end\n if !@responded\n format.html {render :edit}\n format.json {render json: @business.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "bb59fbcbfa2694db209d64c462bf00a8", "score": "0.524973", "text": "def set_bus_reservation\n @bus_reservation = BusReservation.find(params[:id])\n end", "title": "" }, { "docid": "d43fa3e62de2af20de023c00887c3f59", "score": "0.52495164", "text": "def create\n @bus_driver = BusDriver.new(bus_driver_params)\n @bus_driver.bus_id = params[:bus_id]\n\n respond_to do |format|\n if @bus_driver.save\n format.html { redirect_to buses_path }\n format.json { render action: 'show', status: :created, location: @bus_driver }\n else\n format.html { render action: 'new' }\n format.json { render json: @bus_driver.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26f21c7d38b2d4d9cffd83f9854372d8", "score": "0.5243668", "text": "def update\n beer = Beer.find(params[:id])\n beer.update(beer_params)\n render json: beer\n end", "title": "" }, { "docid": "c38dc2c2294217345f76fa5738159c66", "score": "0.5240819", "text": "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66e1b1e1d76c1dfe8b13d1fcc2c640b6", "score": "0.5238928", "text": "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66e1b1e1d76c1dfe8b13d1fcc2c640b6", "score": "0.5238928", "text": "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66e1b1e1d76c1dfe8b13d1fcc2c640b6", "score": "0.5238928", "text": "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66e1b1e1d76c1dfe8b13d1fcc2c640b6", "score": "0.5238928", "text": "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66e1b1e1d76c1dfe8b13d1fcc2c640b6", "score": "0.5238928", "text": "def update\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { render :show, status: :ok, location: @business }\n else\n format.html { render :edit }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
5a39233b39d9d8b330e872f4aff27d42
is there still a new TopStory theme
[ { "docid": "3f122de60fef1f4e5d614985fa0ee689", "score": "0.5557049", "text": "def isTopStoryUpToDate?\n TopStory.last.created_at.strftime('%d').eql? Time.now.strftime('%d')\n end", "title": "" } ]
[ { "docid": "a4ade44e83f03e6b15d9b17ec38e791f", "score": "0.7142343", "text": "def has_theme?(theme_tag) has_tag(:theme, theme_tag) end", "title": "" }, { "docid": "7d2598200f29025394184bb9df1198c6", "score": "0.66920424", "text": "def applied?\n SpreeTheme.site_class.current.template_theme ==self \n end", "title": "" }, { "docid": "2842975e4e1986ebf3f1a2f154ac4840", "score": "0.6658125", "text": "def theme; end", "title": "" }, { "docid": "2842975e4e1986ebf3f1a2f154ac4840", "score": "0.6658125", "text": "def theme; end", "title": "" }, { "docid": "2842975e4e1986ebf3f1a2f154ac4840", "score": "0.6658125", "text": "def theme; end", "title": "" }, { "docid": "9c050b949ff09a99dfe3b2fe47d3857a", "score": "0.66461337", "text": "def is_child_theme\n TEMPLATEPATH != STYLESHEETPATH\n end", "title": "" }, { "docid": "bff1879264c3de7e62f005f401ae3185", "score": "0.6621921", "text": "def switch_theme(stylesheet)\n # TS_INFO: Manage themes not implemented\n end", "title": "" }, { "docid": "c47d06e90e9ea218a668c7ada54b2b31", "score": "0.66086817", "text": "def default_theme\n nil\n end", "title": "" }, { "docid": "5aef3b419d9280b6f4619849f141f718", "score": "0.65829664", "text": "def in_theme?(theme_name=nil)\n File.file? theme_path(theme_name)\n end", "title": "" }, { "docid": "95717c6a8e6f6bd0a354d669d42ed596", "score": "0.6561922", "text": "def applied?\n Spree::Store.current.template_theme ==self\n end", "title": "" }, { "docid": "846a7fbe0c01d954ad44e581ad6eda40", "score": "0.65495396", "text": "def theme\n @theme || 'plastik'\n end", "title": "" }, { "docid": "570bd5ec02699723c4bd783df6435de1", "score": "0.6419368", "text": "def theme\n @theme\n end", "title": "" }, { "docid": "d564817e0477951bf50771cca21a0f85", "score": "0.6384623", "text": "def imported?\n # theme should has page_layout, param_values\n themes = TemplateTheme.native.includes(:current_template_release)\n #theme.current_template_release may be nil\n themes.select{|theme| theme.current_template_release.try(:theme_id) == self.id}.present? \n end", "title": "" }, { "docid": "80d53f7322e0c4cbc3810a28f0e1047e", "score": "0.63505274", "text": "def imported?\n # theme should has page_layout, param_values\n themes = TemplateTheme.native.includes(:current_template_release)\n #theme.current_template_release may be nil\n themes.select{|theme| theme.current_template_release.try(:theme_id) == self.id}.present?\n end", "title": "" }, { "docid": "5f934933c8c1d74b524852e39ff29281", "score": "0.629058", "text": "def require_theme_deps; end", "title": "" }, { "docid": "799dc2b6f86bbcf2e4e3e28defd408fa", "score": "0.628583", "text": "def landed_on_uninstall_theme(theme)\n end", "title": "" }, { "docid": "22dfb7709cb0cf4275720ffb3dbc685a", "score": "0.62846774", "text": "def previewable?\n if self.root.assigned_theme_ids.include?(0)\n return !self.assigned_theme_ids.include?(0)\n else\n return true \n end\n end", "title": "" }, { "docid": "6895f536b7b3dc46c8cf5d71bc7e130a", "score": "0.6251434", "text": "def theme_exists?(theme_name)\n File.exist?(\"#{themes_path}/#{theme_name}\")\n end", "title": "" }, { "docid": "4d732a02f3c3d898f98fad95ef1985c2", "score": "0.61664265", "text": "def get_theme\n\t\tif @current_user and @current_user.theme\n\t\t\t@current_theme = @current_user.theme.css_class\n\t\telse\n\t\t\t@current_theme = \"pond\"\n\t\tend\n\tend", "title": "" }, { "docid": "d40ea621fe1db55f5765db99e5188bdd", "score": "0.6084354", "text": "def theme\n Design::Theme.array.find_by_name(self.theme_name) || site.theme\n end", "title": "" }, { "docid": "0b051fafe7fff5598d641b2596d5888b", "score": "0.6072946", "text": "def color_themes # :nologin:\n end", "title": "" }, { "docid": "ea4cdb5bcfd4ebfede4ec1a7fd7cccc1", "score": "0.599367", "text": "def theme\n options.fetch(:theme, nil)\n end", "title": "" }, { "docid": "c5241146a35e0040839e866a6f23cc87", "score": "0.5986334", "text": "def remove_theme_support(feature)\n # TS_INFO: Customizer not implemented\n false\n end", "title": "" }, { "docid": "f18f82274d38e67d3335d0e8c29dd826", "score": "0.594202", "text": "def theme\n return @theme\n end", "title": "" }, { "docid": "175a136545c88ac4332d5f43654c4f24", "score": "0.59284097", "text": "def theme=(_arg0); end", "title": "" }, { "docid": "0c23ae5a98d0f5476c1c7a5acca35cce", "score": "0.58975625", "text": "def concept_themes\n find_related_frbr_objects( :has_as_its_theme, :which_concepts?) \n end", "title": "" }, { "docid": "0c23ae5a98d0f5476c1c7a5acca35cce", "score": "0.58975625", "text": "def concept_themes\n find_related_frbr_objects( :has_as_its_theme, :which_concepts?) \n end", "title": "" }, { "docid": "beac9c85996c2642faa2696e2ce1214b", "score": "0.589401", "text": "def theme_selector themed_object\n unless themed_object.blank?\n @stpl_theme = themed_object.current_theme || StplTheme.new\n render 'stpl_themes/select_theme', :themed_object => themed_object\n else\n raise \"Themed object not found. Please provide object to be themed.\"\n end\n end", "title": "" }, { "docid": "26c0b644de02bef8e067b4af68a62f3b", "score": "0.5857745", "text": "def get_theme\n use_theme = Preference.get_setting('CURRENT_THEME')\n (use_theme == '' ? 'default' : use_theme).downcase\n end", "title": "" }, { "docid": "bbf590f4e0df916afaeab4e0b67f822a", "score": "0.58215046", "text": "def theme\n @theme ||= resource.cache.theme(theme_id)\n end", "title": "" }, { "docid": "bd1e56e8080b6300e86f6857d02f80fc", "score": "0.58081627", "text": "def get_theme_support(feature, *args)\n # TS_INFO: Customizer not implemented\n false\n end", "title": "" }, { "docid": "99ecb03d16dfadb7b2f90a2fadb63b61", "score": "0.57828486", "text": "def site_on_on_install_theme(theme)\n return if theme.get_option('installed_at').present?\n\n # Home page post type\n install_homepage\n\n # Portfolio post type\n install_portfolio\n\n # Reviews\n install_reviews\n\n\n # Template custom fields\n install_theme_settings(theme)\n\n end", "title": "" }, { "docid": "1be83cbe767a749ccd62b1dc310197f9", "score": "0.5742616", "text": "def theme_changed\n assert_privileges('my_settings_visuals')\n # ui1 theme changed\n @edit = session[:edit]\n @edit[:new][:display][:theme] = params[:theme] # Capture the new setting\n session[:changed] = (@edit[:new] != @edit[:current])\n @changed = session[:changed]\n render :update do |page|\n page << javascript_prologue\n page.replace('tab_div', :partial => 'ui_1')\n end\n end", "title": "" }, { "docid": "ac3bb8d3f8a7180a681a47ff10e95c7d", "score": "0.56706583", "text": "def china_india_dialogue_on_uninstall_theme(theme)\n end", "title": "" }, { "docid": "27a584b14a17ef03ee58e198c18cfe9a", "score": "0.56679624", "text": "def parent_theme\n ThemesForRails.config.parent_theme(current_theme)\n end", "title": "" }, { "docid": "d64d06af81cf373fa97e96f29d19df4b", "score": "0.56406415", "text": "def current_theme(passed_theme = nil)\n theme_name = unless passed_theme .blank?\n passed_theme\n else\n current_blog_user ? current_blog_user.blog_config.theme_name : ''\n end\n Theme.find(theme_name)\n end", "title": "" }, { "docid": "85194fec71a04efa15b22822f4427d30", "score": "0.56144935", "text": "def theme=(value)\n @theme = value\n end", "title": "" }, { "docid": "24df470e53f0c815181bca6ddfbe2cfd", "score": "0.556813", "text": "def current_theme\n account_prefix\n end", "title": "" }, { "docid": "8f603927d3b2e8ffbfd613f883734990", "score": "0.5498917", "text": "def current_theme(passed_theme = nil)\n @current_theme ||= get_current_theme(passed_theme)\n end", "title": "" }, { "docid": "f4010ad7a9429c20470005c5cd64eec2", "score": "0.5491197", "text": "def connected?\n File.exist?(\"#{RAILS_ROOT}/public/themes/#{self.directory_name}/#{self.template_filename}\")\n end", "title": "" }, { "docid": "10ed8063dc0dddd0c44b4bdb1afdb83b", "score": "0.54707617", "text": "def set_theme_mod(name, value)\n # TS_INFO: Manage themes not implemented\n end", "title": "" }, { "docid": "46b8b21a2d9c56d1bbb90ab22b3a5326", "score": "0.54621047", "text": "def gemed_themes\n @@gemed_themes ||= @@gem_theme_classes.uniq.collect {|listener| listener.instance}\n end", "title": "" }, { "docid": "3fec46d4c2554f739005854206e3406b", "score": "0.5437048", "text": "def original_template_theme\n #duplicated_from 有自己的page_layouts\n has_native_layout? ? self : duplicated_from\n #self.class.where(:page_layout_root_id=>self.page_layout_root_id).first\n end", "title": "" }, { "docid": "783c12a62f3a6d1c5fe2f474002e2231", "score": "0.5428081", "text": "def name\n theme.name\n end", "title": "" }, { "docid": "d9ae74f0dc57f32f007dbff6124f3e1e", "score": "0.5427611", "text": "def is_customize_preview\n # TS_INFO: Customizer not implemented\n false\n end", "title": "" }, { "docid": "2817d2d891074342859ce05b05fb9fd3", "score": "0.53996277", "text": "def gobierno_linea_on_install_theme(theme)\n default_post_type = [\n {name: 'Index', description: 'Historia y demas', options: {has_category: false, has_tags: false, not_deleted: true, has_summary: false, has_content: true, has_comments: false, has_picture: true, has_template: true, has_layout: true}},\n {name: 'Nuestro Municipio', description: 'Nuestro Municipio', options: {has_category: false, has_tags: false, not_deleted: true, has_summary: false, has_content: true, has_comments: false, has_picture: true, has_template: true, has_layout: true}},\n {name: 'Alcaldía', description: 'Alcaldía', options: {has_category: false, has_tags: false, not_deleted: true, has_summary: false, has_content: true, has_comments: false, has_picture: true, has_template: true, has_layout: true}},\n {name: 'Atencion al Ciudadano', description: 'Atencion al ciudadano', options: {has_category: false, has_tags: false, not_deleted: true, has_summary: false, has_content: true, has_comments: false, has_picture: true, has_template: true, has_layout: true}},\n {name: 'Tramites y Servicios', description: 'Tramites y Servicios', options: {has_category: false, has_tags: false, not_deleted: true, has_summary: false, has_content: true, has_comments: false, has_picture: true, has_template: true, has_layout: true}},\n {name: 'Participación Ciudadana', description: 'Participación Ciudadana', options: {has_category: false, has_tags: false, not_deleted: true, has_summary: false, has_content: true, has_comments: false, has_picture: true, has_template: true, has_layout: true}},\n \n {name: 'Estratificación Socioeconómica', description: 'Certificado de estratificación socioeconómica', options: {has_category: false, has_tags: false, not_deleted: true, has_summary: false, has_content: true, has_comments: false, has_picture: true, has_template: true, has_layout: true}}\n ]\n default_post_type.each do |pt|\n model_pt = theme.site.post_types.create({name: pt[:name], slug: pt[:name].to_s.parameterize, description: pt[:description], data_options: pt[:options]})\n end\n\n # nav menus\n unless theme.site.nav_menus.where(slug: \"gel_help_menu\").any?\n theme.site.nav_menus.create(name: \"GEL Help menu\", slug: \"gel_help_menu\") \n end\n\n unless theme.site.nav_menus.where(slug: \"gel_main_menu\").any?\n @nav_menu = theme.site.nav_menus.new({name: \"GEL Main menu\", slug: \"gel_main_menu\"})\n if @nav_menu.save\n theme.site.post_types.all.each do |pt|\n unless pt.slug == 'post' || pt.slug == 'page'\n # title = pt.name\n # slug = pt.slug\n # content = pt.description\n # post = pt.add_post({title: title, slug: slug, content: content, user_id: 1, status: 'published'})\n @nav_menu.append_menu_item({label: pt.slug, type: pt.taxonomy, link: pt.id})\n end\n end\n end\n end\n\n # Main Color\n theme.add_field({\"name\"=>\"Color principal\", \"slug\"=>\"main_color\"},{field_key: \"colorpicker\", color_format: \"rgb\", default_value: \"rgb(4,57,80)\"})\n\n # Secondary Color\n theme.add_field({\"name\"=>\"Color segundario\", \"slug\"=>\"secondary_color\"},{field_key: \"colorpicker\", color_format: \"rgb\", default_value: \"rgb(243,165,54)\"})\n\n # Main image\n theme.add_field({\"name\"=>\"Imagen principal\", \"slug\"=>\"main_image\"},{field_key: \"image\"})\n\n # Home Slider\n gr = current_theme.add_field_group({name: \"GEL Slider\", slug: \"gel_slider\", is_repeat: true})\n gr.add_field({\"name\"=>\"Title\", \"slug\"=>\"gel_slider_title\"},{field_key: \"text_box\", translate: true})\n gr.add_field({\"name\"=>\"Image\", \"slug\"=>\"gel_slider_image\"},{field_key: \"image\"})\n gr.add_field({\"name\"=>\"Description\", \"slug\"=>\"gel_slider_descr\"},{field_key: \"text_box\", translate: true})\n\n # Footer\n group = theme.add_field_group({name: \"Footer\", slug: \"footer\"})\n group.add_field({\"name\"=>\"Superior\", \"slug\"=>\"footer_left\"}, {field_key: \"editor\", translate: true, default_value: \"<h4>My Bunker</h4><p>Some Address 987,<br> +34 9054 5455, <br> Madrid, Spain. </p>\"})\n group.add_field({\"name\"=>\"Centro\", \"slug\"=>\"footer_center\"}, {field_key: \"editor\", translate: true, default_value: \"<h4>My Links</h4> <p><a href='#'>Dribbble</a><br> <a href='#'>Twitter</a><br> <a href='#'>Facebook</a></p>\"})\n group.add_field({\"name\"=>\"Inferior\", \"slug\"=>\"footer_right\"}, {field_key: \"editor\", translate: true, default_value: \"<h4>About Theme</h4><p>This cute theme was created to showcase your work in a simple way. Use it wisely.</p>\"})\n\n # Terminos y servicios\n gr = current_theme.add_field_group({name: \"GEL Servicios\", slug: \"gel_services\", is_repeat: true})\n gr.add_field({\"name\"=>\"Title\", \"slug\"=>\"gel_services_title\"},{field_key: \"text_box\", translate: true})\n gr.add_field({\"name\"=>\"Image\", \"slug\"=>\"gel_services_image\"},{field_key: \"image\"})\n gr.add_field({\"name\"=>\"Description\", \"slug\"=>\"gel_services_descr\"},{field_key: \"text_box\", translate: true})\n gr.add_field({\"name\"=>\"Link\", \"slug\"=>\"gel_services_url\"},{field_key: \"url\"})\n\n # Colaboradores\n gr = current_theme.add_field_group({name: \"GEL Colaboradores\", slug: \"gel_collaborators\", is_repeat: true})\n gr.add_field({\"name\"=>\"Title\", \"slug\"=>\"gel_collaborators_title\"},{field_key: \"text_box\", translate: true})\n gr.add_field({\"name\"=>\"Image\", \"slug\"=>\"gel_collaborators_image\"},{field_key: \"image\"})\n gr.add_field({\"name\"=>\"Link\", \"slug\"=>\"gel_collaborators_url\"},{field_key: \"url\"})\n\n # Datos del tipo documental del formulario\n gr = current_theme.add_field_group({name: \"GEL Datos tipo documental\", slug: \"gel_typedocumetal\", is_repeat: false}, 'tramites-y-servicios')\n gr.add_field({\"name\"=>\"Codigo de Area\", \"slug\"=>\"gel_typedocumetal_areaCode\"},{field_key: \"numeric\"})\n gr.add_field({\"name\"=>\"Codigo tipo documental\", \"slug\"=>\"gel_typedocumetal_typedocument\"},{field_key: \"numeric\"})\n gr.add_field({\"name\"=>\"Serie\", \"slug\"=>\"gel_typedocumetal_serie\"},{field_key: \"numeric\", default_value: 4})\n gr.add_field({\"name\"=>\"Sub-Serie\", \"slug\"=>\"gel_typedocumetal_subserie\"},{field_key: \"numeric\", default_value: 4.1})\n \n # Formulario del tipo documental\n gr = current_theme.add_field_group({name: \"GEL Formularios\", slug: \"gel_forms\", is_repeat: true}, 'tramites-y-servicios')\n gr.add_field({\"name\"=>\"Title\", \"slug\"=>\"gel_forms_title\"},{field_key: \"text_box\", translate: true})\n gr.add_field({\"name\"=>\"Es Requerido?\", \"slug\"=>\"gel_forms_required\"}, {field_key: \"checkbox\", multiple_options: [\n {title: \"¿Es requerido?\", value: \"true\", default: true}\n ]})\n gr.add_field({\"name\"=>\"Tipo de campo\", \"slug\"=>\"gel_forms_type\"}, {field_key: \"select\", multiple_options: [\n {title: \"Campo de texto\", value: \"text_area_tag\", default: true},\n {title: \"Telefono\", value: \"telephone_field\"},\n {title: \"Fecha\", value: \"date_field\"},\n {title: \"Email\", value: \"email_field\"},\n {title: \"Numerico\", value: \"number_field\"},\n ]})\n gr.add_field({\"name\"=>\"Numero Metadato\", \"slug\"=>\"gel_forms_metadato\"},{field_key: \"numeric\"})\n end", "title": "" }, { "docid": "5df645b52771162c8dc62f3a095147bf", "score": "0.5365989", "text": "def dark; end", "title": "" }, { "docid": "5df645b52771162c8dc62f3a095147bf", "score": "0.5365989", "text": "def dark; end", "title": "" }, { "docid": "f83e8d21029f0d0428c109042d2b51ed", "score": "0.5363176", "text": "def reset_themes\n @theme_options = {}\n end", "title": "" }, { "docid": "3e441ef42a6e0cc730b3af8137935fc0", "score": "0.53529245", "text": "def theme\n @theme ||= Theme.unscoped.find(params[:id])\n halt 404 unless @theme\n @theme\n end", "title": "" }, { "docid": "3b3c93f021e6c537f97a87802ada2e16", "score": "0.53528947", "text": "def set_theme\n # @theme = Theme.find(params[:id])\n @theme = Theme.current_theme\n end", "title": "" }, { "docid": "ff6fef37244986911e82f9324d143c91", "score": "0.53431386", "text": "def has_activate_gold_status_link?\n has_css? @activate_gold_status_link\n end", "title": "" }, { "docid": "158c64b4fb5b0c8ef5e7264e5c7a4c06", "score": "0.5313121", "text": "def use_style?\n end", "title": "" }, { "docid": "65d11a6dc97d4cb9df8a1d6b9fe85e75", "score": "0.530736", "text": "def current_theme(passed_theme=nil)\n theme = passed_theme || self.class.read_inheritable_attribute(\"theme\")\n \n @active_theme = case theme\n when Symbol then send(theme)\n when Proc then theme.call(self)\n when String then theme\n end\n end", "title": "" }, { "docid": "1059c4659e9491b930bbaa0f63b3c5e9", "score": "0.5305839", "text": "def upgrade_customization?\n if self.customization_of.present?\n funder_template = Template.published(self.customization_of).select(:created_at).first\n if funder_template.present?\n return funder_template.created_at > self.created_at\n end\n end\n return false\n end", "title": "" }, { "docid": "3fbf28ba5c4be504beb788c836a4bf56", "score": "0.530556", "text": "def fetch_random_theme\n fetch_themes(:type => :random, :limit => 1).first\n end", "title": "" }, { "docid": "bceab885685edbd73cb6ba62a6292dd1", "score": "0.5288798", "text": "def design_changed?\n modified?(\"design/style.sass\") || modified?(\"design/script.js\")\n end", "title": "" }, { "docid": "959d9c7616b589725ce4bf2d620dd178", "score": "0.5278442", "text": "def update_current_theme(name, options = {})\n self.class.renders_theme(name, options)\n Rails.application.config.theme.name = current_theme_name\n Rails.application.config.theme.layout = current_theme_layout\n ShinyThemes::Engine.theme_config.save unless options[:dont_save]\n self.class.theme # return current theme object\n end", "title": "" }, { "docid": "c73bb01734af16afee543efb48f5e0fb", "score": "0.5265812", "text": "def theme_selected?\n user_selections.params['thm']\n end", "title": "" }, { "docid": "36783f75c36b20aa8ed8fadbdfa9ad49", "score": "0.52614564", "text": "def update_theme user\n user.theme = Theme.get(params[\"theme\"])\n end", "title": "" }, { "docid": "b4b3da67dbf7a2236aead088ada9450d", "score": "0.5254592", "text": "def set_node_has_theme\n @node_has_theme = NodeHasTheme.find(params[:id])\n end", "title": "" }, { "docid": "d5be26bbbf9f24cd960ecfaa67e0d278", "score": "0.52526957", "text": "def template_changed?\n modified?(\"design/template.slim\") || modified?(\".clayoven/hidden\") ||\n modified?(\".clayoven/tz\") || modified?(\".clayoven/subtopics\")\n end", "title": "" }, { "docid": "01d80f7ae2e2e510c167e5c92e4d3ef7", "score": "0.5226372", "text": "def theme_37signals\n # Colors\n @green = '#339933'\n @purple = '#cc99cc'\n @blue = '#336699'\n @yellow = '#FFF804'\n @red = '#ff0000'\n @orange = '#cf5910'\n @black = 'black'\n @colors = [@yellow, @blue, @green, @red, @purple, @orange, @black]\n\n self.theme = {\n :colors => @colors,\n :marker_color => 'black',\n :font_color => 'black',\n :background_colors => ['#d1edf5', 'white']\n }\n end", "title": "" }, { "docid": "ce3c4ebd5b0882f5de16ef8860fef212", "score": "0.52167535", "text": "def efashion_on_uninstall_theme(theme)\n post_type = current_site.the_post_type('commerce')\n if post_type.present?\n post_type.set_option('posts_feature_image_dimension', current_theme.get_option('backup_posts_feature_image_dimension'))\n end\n theme.destroy\n end", "title": "" }, { "docid": "3565bcec57a9722fb6aa1e2dadc5b68e", "score": "0.52056783", "text": "def fetch_random_theme\n url = build_url( :type => :random, :limit => 1 )\n xml = Nokogiri::XML( open(url) ).at( \"//kuler:themeItem\" )\n return Kuler::Theme.new( xml )\n end", "title": "" }, { "docid": "37c06e79ca58c1b587c9ef70c7a71191", "score": "0.52014655", "text": "def theme_resolver\n theme(current_account.account_prefix) if DmCore.config.enable_themes\n end", "title": "" }, { "docid": "5d0780dbb36af242f02370b2c7d7f524", "score": "0.51958907", "text": "def theme_keynote\n self.theme = Themes::KEYNOTE\n end", "title": "" }, { "docid": "5d85b90793708bfcda85043d4c9921be", "score": "0.5194381", "text": "def go_themes\n FileUtils.cd(TXMP_SUPPORT_PATH + \"/themes\")\nend", "title": "" }, { "docid": "952b4473e046bdf5abe8c526d6696fd4", "score": "0.5193843", "text": "def count\n THEMES.size\n end", "title": "" }, { "docid": "c21215d261bce23203a292908b3e1e10", "score": "0.5178449", "text": "def check_theme_version_from_readme(theme_name, fixed_version = nil, vuln_introduced_version = nil)\n check_version_from_readme(:theme, theme_name, fixed_version, vuln_introduced_version)\n end", "title": "" }, { "docid": "1ddbc6aecf8bb64e4ec876b8139a92ed", "score": "0.5168184", "text": "def classic?\n current == :classic\n end", "title": "" }, { "docid": "7a2daeae903724641d3cccdfc4e08bbc", "score": "0.51669776", "text": "def has_style?(style)\n @styles.include? style\n end", "title": "" }, { "docid": "0ba5ef4c1efb0e385b09c84223be83e4", "score": "0.5162928", "text": "def generate_theme(theme_name)\n theme = Theme.find_by_name(theme_name)\n if !theme #theme doesn't exist, create a new one\n generate_log(\"Generating a New Theme: #{theme_name}\")\n theme = Theme.new()\n theme.name = theme_name\n theme.save\n else\n generate_log(\"Theme Exists: #{theme_name}\")\n end\n theme\nend", "title": "" }, { "docid": "3e780cc93f827061e6ba5c7eda47654a", "score": "0.5162842", "text": "def clear_gemed_theme\n @@gem_theme_classes = []\n clear_gemed_theme_instances\n end", "title": "" }, { "docid": "7784e8ee138583ec4ab3e01e02812c95", "score": "0.51596016", "text": "def isTutorial?\n\t\treturn false\n\tend", "title": "" }, { "docid": "7323dcd1a8d4de4666b05f42a4c95d39", "score": "0.51479936", "text": "def is_displayed_on_site?\n feed.feed_type.name == \"Article\"\n end", "title": "" }, { "docid": "461bd5c80481e2eb5ce0337b56e554b4", "score": "0.5144652", "text": "def theme_name\n if params[:action] == \"home\"\n @theme_name = ThemeOption.where(user_id: current_user.id).first.template.downcase\n else\n \"application\"\n end\n end", "title": "" }, { "docid": "853700a2e84d2cb8f9828a3cc86bdca8", "score": "0.51443106", "text": "def landed_on_install_theme(theme)\n\n\n \n\n # # Sample Meta Value\n theme.set_meta(\"installed_at\", Time.current.to_s) # save a custom value\n \n end", "title": "" }, { "docid": "bc6bdb12db26f55afa6b70ff905ba757", "score": "0.5137669", "text": "def get_theme\n @theme = Broadcaster::Theme.find(params[:theme_id])\n end", "title": "" }, { "docid": "bc6bdb12db26f55afa6b70ff905ba757", "score": "0.5137669", "text": "def get_theme\n @theme = Broadcaster::Theme.find(params[:theme_id])\n end", "title": "" }, { "docid": "bc6bdb12db26f55afa6b70ff905ba757", "score": "0.5137669", "text": "def get_theme\n @theme = Broadcaster::Theme.find(params[:theme_id])\n end", "title": "" }, { "docid": "31fe355fe472d5793132cda67f8d3810", "score": "0.51343906", "text": "def live?\n !draft?\n end", "title": "" }, { "docid": "ea496b1934e17ee143db44f24e945af0", "score": "0.51196426", "text": "def themes_menu(user)\n pastel = Pastel.new\n puts \" \"\n puts pastel.white.inverse.bold(\"Here are a list of themes, please select one.\") \n puts \"*********************\"\n Joke.all_themes \n puts \"*********************\"\n user_theme = gets.chomp\n if Joke.find_by_theme(user_theme) == []\n puts \"*********************\"\n puts pastel.white.inverse.bold(\"No such theme, please try again.\")\n puts \"*********************\"\n self.return_to_menu(user)\n else Joke.puts_user_theme_jokes(user_theme)\n puts \" \"\n self.return_to_menu(user)\n end\n end", "title": "" }, { "docid": "bd77d7402991b9afe6adec37fd81c23d", "score": "0.51149964", "text": "def chrome_themecolor\n return unless zone&.chrome_themecolor&.present?\n\n tag :meta, name: 'theme-color', content: zone.chrome_themecolor\n end", "title": "" }, { "docid": "d94ed1c4fb3dcbb5715f49c8f130aac0", "score": "0.51077986", "text": "def needs_customization?\n return false\n end", "title": "" }, { "docid": "b2a9e7c23a45b8ddb6e65931e3ade4f0", "score": "0.5105532", "text": "def get_box_theme(id)\n return @themes[id]\n end", "title": "" }, { "docid": "02efdeec5b157fd59a8c1d92a28ab183", "score": "0.50980294", "text": "def current_windowskin\n @windowskin_overwrite || current_layout.windowskin || $game_system.windowskin_name\n end", "title": "" }, { "docid": "6326011688306a8d67f2a02919b5656f", "score": "0.5097462", "text": "def use_default_style?\n return @use_default_style\n end", "title": "" }, { "docid": "781045a1bd7fc8f992e234530bb11dd5", "score": "0.5091529", "text": "def find_theme\n @theme = Theme.find(params[:theme_id])\n end", "title": "" }, { "docid": "258a6c1ca24c74024c72a47d6cd71c9b", "score": "0.5079491", "text": "def is_blog_article?\n !current_article.nil?\n end", "title": "" }, { "docid": "fc4dfd5eb680c3832b692079164e2d0c", "score": "0.50785625", "text": "def theme_path\n \"#{ThemesForRails.config.themes_path}/#{current_theme}\"\n end", "title": "" }, { "docid": "04cbf3afc6d5fd253ff326fdf43e187d", "score": "0.506596", "text": "def set_theme\n @theme = params[:id].to_i.zero? ? Theme.new : Theme.find(params[:id])\n end", "title": "" }, { "docid": "cfab4afd5b634cd1fa039d1370fb4637", "score": "0.5064413", "text": "def theme(theme)\n case theme\n when :dark\n @methods[:theme] = MIDNIGHT\n when :deep\n @methods[:theme] = SUBMARINE\n when :light\n @methods[:theme] = BLUESCALE\n else\n throw ArgumentError.new('Not a valid theme')\n end\n end", "title": "" }, { "docid": "bfda839ee94e31bb24eaf763b194c29e", "score": "0.50641304", "text": "def get_theme\n @theme = Theme.find(params[:theme_id])\n end", "title": "" }, { "docid": "28635915dae2f5921b4f0d4eea67bc48", "score": "0.5062438", "text": "def e_shop_on_install_theme(theme)\n unless theme.site.nav_menus.where(slug: \"eshop_footer_main_menu\").present? # verify if theme was installed before\n group = theme.add_field_group({name: \"Home Slider\", slug: \"home_slider\", description: \"\"})\n # group.add_field({\"name\"=>\"Text Slider\", \"slug\"=>\"home_slider_tabs\"},{field_key: \"text_box\", translate: true, multiple: true})\n # group.add_field({\"name\"=>\"Home Slider Image (1000px1000px)\", \"slug\"=>\"home_slider_bg\"},{field_key: \"image\" })\n # group.add_field({\"name\"=>\"Home Slider Product\", \"slug\"=>\"home_slider_product\"},{field_key: \"select_eval\", required: true, command: 'options_from_collection_for_select(current_site.the_posts(\"commerce\").decorate, :id, :the_title)' })\n # theme.save_field_value('home_slider_tabs', ['One Click Installation', 'Easy Configuration', 'Easy Administration', 'Shop Online'])\n\n menu = current_site.nav_menus.create(name: \"E-shop Header Menu\", slug: \"eshop_header_main_menu\")\n menu.append_menu_item({label: \"Home\", type: \"external\", link: \"root_url\"})\n menu_item = menu.append_menu_item({label: \"MEN\", type: \"external\", link: \"#\"})\n new_in = menu_item.append_menu_item({label: \"NEW IN\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Watches\", type: \"external\", link: \"#\"})\n\n new_in = menu_item.append_menu_item({label: \"Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n\n new_in = menu_item.append_menu_item({label: \"Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Watches\", type: \"external\", link: \"#\"})\n\n new_in = menu.append_menu_item({label: \"WOMEN\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Watches\", type: \"external\", link: \"#\"})\n\n new_in = menu.append_menu_item({label: \"KIDS\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Watches\", type: \"external\", link: \"#\"})\n\n pt_pages = current_site.post_types.where(slug: \"page\").first\n page = pt_pages.add_post(title: \"Contact Form\", content: '<p><iframe style=\"border: 0;\" src=\"https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6632.248000703498!2d151.265683!3d-33.7832959!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6b12abc7edcbeb07%3A0x5017d681632bfc0!2sManly+Vale+NSW+2093%2C+Australia!5e0!3m2!1sen!2sin!4v1433329298259\" width=\"100%\" height=\"330\"></iframe></p> <p>[forms slug=eshop]</p>') if pt_pages.present?\n menu.append_menu_item({label: \"Contact\", type: \"post\", link: page.id})\n\n # footer menus\n menu = current_site.nav_menus.create(name: \"E-shop Footer Menu\", slug: \"eshop_footer_main_menu\")\n item = menu.append_menu_item({label: \"Show\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"New Arrivals\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Men\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Women\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Accessories\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Kids\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Brands\", type: \"external\", link: '#'})\n\n item = menu.append_menu_item({label: \"Help\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"New Arrivals\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Men\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Women\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Accessories\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Kids\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Brands\", type: \"external\", link: '#'})\n\n item = menu.append_menu_item({label: \"Popular\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"New Arrivals\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Men\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Women\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Accessories\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Kids\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Brands\", type: \"external\", link: '#'})\n\n e_shop_add_main_slider\n end\n\n if current_site.plugin_installed?('ecommerce')\n eshop_ecommerce_after_install({})\n else\n plugin_install('ecommerce')\n end\n\n plugin_install('cama_subscriber') unless current_site.plugin_installed?('cama_subscriber')\n\n ### Forms\n plugin_install('cama_contact_form') unless current_site.plugin_installed?('cama_contact_form')\n form_eshop = current_site.contact_forms.create(name: \"eshop\", slug: \"eshop\", settings: '{\"railscf_mail\":{\"previous_html\":\"\\u003cdiv class=\\'contact-form\\'\\u003e\",\"after_html\":\"\\u003c/div\\u003e\",\"to\":\"[email protected]\",\"subject\":\"\\u003c!--:en--\\u003eSite contact\\u003c!--:--\\u003e\\u003c!--:es--\\u003eSite contact\\u003c!--:--\\u003e\",\"body\":\"\\u003c!--:en--\\u003easdasdasdasdas\\u003c!--:--\\u003e\\u003c!--:es--\\u003e\\u003c!--:--\\u003e\",\"to_answer\":\"[c7]\",\"subject_answer\":\"\\u003c!--:en--\\u003eThanks for contact us\\u003c!--:--\\u003e\\u003c!--:es--\\u003egrcas\\u003c!--:--\\u003e\",\"body_answer\":\"\\u003c!--:en--\\u003easdasdas\\u003c!--:--\\u003e\\u003c!--:es--\\u003e\\u003c!--:--\\u003e\"},\"railscf_message\":{\"mail_sent_ok\":\"\",\"mail_sent_ng\":\"\",\"invalid_required\":\"\",\"invalid_email\":\"\",\"captcha_not_match\":\"\"},\"railscf_form_button\":{\"name_button\":\"Send\"}}', value: '{\"fields\":[{\"field_type\":\"text\",\"cid\":\"c2\",\"label\":\"\\u003c!--:en--\\u003eName\\u003c!--:--\\u003e\\u003c!--:es--\\u003eNombre\\u003c!--:--\\u003e\",\"required\":\"true\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"\\u003cdiv class=\\'contact-left\\'\\u003e\\r\\n[ci]\",\"field_attributes\":\"{\\\"placeholder\\\": \\\"[label ci]\\\"}\"},\"default_value\":\"\"},{\"field_type\":\"email\",\"cid\":\"c7\",\"label\":\"\\u003c!--:en--\\u003eEmail\\u003c!--:--\\u003e\\u003c!--:es--\\u003eCorreo\\u003c!--:--\\u003e\",\"required\":\"true\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"[ci]\",\"field_attributes\":\"{\\\"placeholder\\\": \\\"[label ci]\\\"}\"},\"default_value\":\"\"},{\"field_type\":\"text\",\"cid\":\"c4\",\"label\":\"\\u003c!--:en--\\u003eSubject\\u003c!--:--\\u003e\\u003c!--:es--\\u003eAsunto\\u003c!--:--\\u003e\",\"required\":\"true\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"[ci]\\r\\n\\u003c/div\\u003e\",\"field_attributes\":\"{\\\"placeholder\\\": \\\"[label ci]\\\"}\"},\"default_value\":\"\"},{\"field_type\":\"paragraph\",\"cid\":\"c5\",\"label\":\"\\u003c!--:en--\\u003eMessage\\u003c!--:--\\u003e\\u003c!--:es--\\u003eMensaje\\u003c!--:--\\u003e\",\"required\":\"true\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"\\u003cdiv class=\\'contact-right\\'\\u003e\\r\\n[ci]\\r\\n\\u003c/div\\u003e\\r\\n\",\"field_attributes\":\"{\\\"placeholder\\\": \\\"[label ci]\\\"}\"},\"default_value\":\"\"},{\"field_type\":\"submit\",\"cid\":\"c6\",\"label\":\"\\u003c!--:en--\\u003eSubmit\\u003c!--:--\\u003e\\u003c!--:es--\\u003eEnviar\\u003c!--:--\\u003e\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"\\u003cdiv class=\\\"clearfix\\\"\\u003e\\u003c/div\\u003e\\r\\n[ci]\",\"field_attributes\":\"\"}}]}')\n\n end", "title": "" }, { "docid": "256c6f170eedf3a6ae92969746b609f1", "score": "0.50565094", "text": "def theme_settings\n (settings_data ? settings_data['general'].presence : nil) || {}\n end", "title": "" }, { "docid": "7e31b80db7b818911b3f3f1d5df53e15", "score": "0.5044193", "text": "def theme\n {\n variant: {\n name: cookies[:themeVariantName],\n hue: cookies[:themeVariantHue]\n },\n mode: cookies[:themeMode] || \"light\"\n }\n end", "title": "" }, { "docid": "41a5a44cd20ddb36742b7e6cf7b6ca82", "score": "0.50424653", "text": "def in_theme_dir(*paths); end", "title": "" }, { "docid": "0eb70b9229c99197bc0cdf7c8bb30da7", "score": "0.5038484", "text": "def color_theme_from_hash(name)\n return {} unless all_themes.include?(name)\n return {} unless Hash === YAML::load(File.open(config_file_with_name(name)))\n YAML::load(File.open(config_file_with_name(name)))\n end", "title": "" }, { "docid": "74ac7c24867e00fa72d8edd0264992f0", "score": "0.5035154", "text": "def is_syndicated_blog_post?\n feed.feed_type.name == \"Blog\"\n end", "title": "" } ]
91848726edf1439a2a9c2ca34b2b833a
PUT /quotations/1 PUT /quotations/1.json
[ { "docid": "77a38e65c2f79c71d722ff30f2ce81a3", "score": "0.57715553", "text": "def update\n\n respond_to do |format|\n if @quotation.update_attributes(params[:quotation])\n format.html { redirect_to orcamentos_path(@quotation.vendor), notice: 'O orçamento foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quotation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "f655b09a5dd5e724582884c8b433b1f1", "score": "0.70140976", "text": "def update\n megam_rest.update_quotas(to_hash)\n end", "title": "" }, { "docid": "1d7cf8b953e3e56ab4d417fa387b45b4", "score": "0.66660666", "text": "def set_quotation\n @quotation = Quotation.find(params[:id])\n\t \n end", "title": "" }, { "docid": "f0db10eb2e5760c6403137eb8507b6e9", "score": "0.6649448", "text": "def set_quotation\n @quotation = Quotation.find(params[:id])\n end", "title": "" }, { "docid": "f0db10eb2e5760c6403137eb8507b6e9", "score": "0.6649448", "text": "def set_quotation\n @quotation = Quotation.find(params[:id])\n end", "title": "" }, { "docid": "f0db10eb2e5760c6403137eb8507b6e9", "score": "0.6649448", "text": "def set_quotation\n @quotation = Quotation.find(params[:id])\n end", "title": "" }, { "docid": "e461a03649566515501b4ff3a0f72abc", "score": "0.658887", "text": "def update\n respond_to do |format|\n if @quotation.update(quotation_params)\n format.html { redirect_to @quotation, notice: 'Quotation was successfully updated.' }\n format.json { render :show, status: :ok, location: @quotation }\n else\n format.html { render :edit }\n format.json { render json: @quotation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "651a4c4977a2b04562ff19bb713157d5", "score": "0.6454284", "text": "def update\n respond_to do |format|\n if @quotation.update(quotation_params)\n format.html { redirect_to @quotation, notice: 'Quotation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quotation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "787e9f74e22d9eada29a01e10746e003", "score": "0.62936765", "text": "def update\n @quote.update_attributes(params[:quote])\n respond_with(@quote)\n end", "title": "" }, { "docid": "0d3eb53e4513432108e8cb0e1570c4f0", "score": "0.6251031", "text": "def update\n @quote.update(quote_params)\n end", "title": "" }, { "docid": "b3baa259365c54e67a28b5054eb58f7e", "score": "0.6241577", "text": "def set_quot\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "dff3db6730a5e4d1cb09eccd7d56ccb1", "score": "0.60537213", "text": "def quotation_params\n params.require(:quotation).permit!\n end", "title": "" }, { "docid": "195a4895fec2c55e094a2daea9b809b3", "score": "0.5982144", "text": "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "58f96aee2865440785e9b9afd3bdd4ce", "score": "0.59787834", "text": "def update\n @quote = Quote.find(params[:id])\n @quote.update_attributes(quote_params)\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbac6b9c4da4d23193b8e49d38da6996", "score": "0.5963626", "text": "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbac6b9c4da4d23193b8e49d38da6996", "score": "0.59635514", "text": "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbac6b9c4da4d23193b8e49d38da6996", "score": "0.59635514", "text": "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3014678f4b015c8d4825e26b53ec8df3", "score": "0.59220254", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: \"Quote was successfully updated.\" }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "721535a6107944d1c50eb6f18ad5aba7", "score": "0.5898476", "text": "def set_quotation_list\n @quotation_list = QuotationList.find(params[:quotation_list_id])\n end", "title": "" }, { "docid": "a74a591e41cf185d31cbca20e73bd549", "score": "0.58916175", "text": "def quotation_params\n params[:quotation].permit!\n end", "title": "" }, { "docid": "c6693ef42833b88933005568c58976f8", "score": "0.58856237", "text": "def set_quotations\n qid = PurchaseOrder.select(:quotation_id).map(&:quotation_id)\n @quotations = Quotation.where.not(id: qid)\n end", "title": "" }, { "docid": "bafdefc0c32fd443dc3ed774ca29dc91", "score": "0.5881965", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bafdefc0c32fd443dc3ed774ca29dc91", "score": "0.5881965", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bafdefc0c32fd443dc3ed774ca29dc91", "score": "0.5881965", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bafdefc0c32fd443dc3ed774ca29dc91", "score": "0.5881965", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bafdefc0c32fd443dc3ed774ca29dc91", "score": "0.5881965", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bafdefc0c32fd443dc3ed774ca29dc91", "score": "0.5881965", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bafdefc0c32fd443dc3ed774ca29dc91", "score": "0.5881965", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "595e499bda9c317e2dcf078911805550", "score": "0.5863599", "text": "def set_quotation_unit\n @quotation_unit = QuotationUnit.find(params[:id])\n end", "title": "" }, { "docid": "283ec9082f773915100da64913a07b96", "score": "0.583094", "text": "def update\n respond_to do |format|\n if @quotation_unit.update(quotation_unit_params)\n format.html { redirect_to @quotation_unit, notice: 'Quotation unit was successfully updated.' }\n format.json { render :show, status: :ok, location: @quotation_unit }\n else\n format.html { render :edit }\n format.json { render json: @quotation_unit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af1ef24dcfdf62e6d5e16f9e10240de6", "score": "0.58291817", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'QUOTE WAS SUCCESSFULLY UPDATED.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e4b61f10841d6c5b6da72a6240d5e9d", "score": "0.5802751", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to edit_admin_quote_url(@quote), notice: 'Quote was successfully updated.' }\n format.json { render json: @quote, status: :ok }\n else\n format.html { redirect_to view_context.admin_model_url(@quote.source), notice: 'Oops! an error occurred while updating the quote.' }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "adea404847d96a81dfdb2c21b9ca334d", "score": "0.57805276", "text": "def update\r\n respond_to do |format|\r\n if @quote.update(quote_params)\r\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @quote }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @quote.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "3a63fb60ff1bec58df1f18f8874e272a", "score": "0.5773036", "text": "def update\n @quote = Quote.find(params[:quote_id])\n @quote_vendor = @quote.quote_vendors.find(params[:id])\n\n respond_to do |format|\n if @quote_vendor.update_attributes(params[:quote_vendor])\n format.html { redirect_to(@quote, :notice => 'Quote vendor was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @quote_vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23092ce645d81e29695ea575f05079d5", "score": "0.57524097", "text": "def set_sale_quotation\n @sale_quotation = Sale::Quotation.find(params[:id])\n end", "title": "" }, { "docid": "4b5e00d0479adb972d8e7f5069e5b896", "score": "0.5740549", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c8cef49bae53bf822435183648724571", "score": "0.5734262", "text": "def update\n @quotation = Quotation.find(params[:id])\n \n respond_to do |format|\n if @quotation.update_attributes(params[:quotation])\n format.html { # CANCLE \n\t\t if @quotation.cancel == true\n\t\t\t @quotation.approve = false\n\t\t\t @quotation.update_attributes(params[@quotation])\n\t\t\t @invoices = Invoice.find(:all, :conditions => { :ref_id => @quotation.id , :cancel => false})\n\t\t\t @invoices.each do |invoice| \n\t\t\t invoice.cancel = true\n\t\t\t invoice.update_attributes(params[:invoice])\n\t\t\t end \n\t\t\t \n\t\t\tredirect_to(@quotation, :notice => 'quotation\\'s data was successfully updated.') \n\t\t else if @quotation.approve == true\n\t\t\t redirect_to(@quotation, :notice => 'quotation\\'s data was successfully updated.') \n\t\t\t else\n\t\t\t redirect_to(manageitem_quotation_path(@quotation), :notice => 'quotation\\'s data was successfully updated.') \n\t\t\t end\n\t\t end\n\t\t }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quotation.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4907bf9c3eaabced67f07d453d6345ee", "score": "0.57227665", "text": "def update\n @quote = Quote.find(params[:id])\n title=params['q_param']['title']\n total=params['q_param']['total']\n tax_rate=params['q_param']['tax_rate']\n l=params['q_param']['list']\n comment=params['q_param']['comment']\n list=Array.new\n l.keys.each do |j|\n list << [l[j][0],l[j][1],l[j][2],l[j][3]]\n end\n quote_p={:title=>title,:total=>total,:list=>list,:tax_rate=>tax_rate,:comment=>comment}\n @quote.update(quote_p)\n\n # respond_to do |format|\n # if @quote.update(quote_p)\n # format.html {}\n format.json { head :no_content }\n # else\n # format.html {}\n # format.json { render json: @quote.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "8b2e05f26ab3d35120634438b0495741", "score": "0.5696528", "text": "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to(@quote, :notice => :quote_updated) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8ba360434035074f7097b698d47337f", "score": "0.56910145", "text": "def quote(params)\n request(Resources::RESOURCE_QUOTE, HTTP_METHOD_POST, params)\n end", "title": "" }, { "docid": "85e0ccd3130fe88711bc19c341fc0acc", "score": "0.5684199", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "940641bb3a8482dfa2f61d39c8f2430c", "score": "0.5666348", "text": "def update\n quotes = Quote.where(:sale_id => @sale.id)\n\n quotes.each { |q| q.destroy }\n\n respond_to do |format|\n if @sale.update(sale_params)\n quantity = params[:quotes_quantity].gsub(/[^\\d^\\.]/, '').to_i\n\n for i in 1..quantity\n @quote = Quote.new\n @quote.amount = (params[:amount]).gsub(/[^\\d^\\.]/, '').to_f\n @quote.is_paid = false\n @quote.number = i\n @quote.total = quantity\n @quote.mounth = (@sale.date + i.month).month\n @quote.year = (@sale.date + i.month).year\n @quote.sale = @sale\n @quote.save\n end\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a205904220062cb9783072c727131f05", "score": "0.56592155", "text": "def set_quote\r\n @quote = Quote.find(params[:id])\r\n end", "title": "" }, { "docid": "9f268ad99f6e68c049bca8bf9254e92f", "score": "0.56352466", "text": "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Frase atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b842212e8f74a95d79783973f378ac2f", "score": "0.5632324", "text": "def edit\n quote = Quote.find(params[:id])\n url = \"quotes/#{params[:id]}\"\n render :json => {:data => quote, :url => url}\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56058544", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "c176cf735db29f1ef30cdd2d17553b91", "score": "0.56056", "text": "def set_quote\n @quote = Quote.find(params[:id])\n end", "title": "" }, { "docid": "e145ceb5a91144b946c86e6635856f42", "score": "0.5596923", "text": "def set_quote\n @quotes= Quote.find(params[:id])\n end", "title": "" }, { "docid": "5fecd2c820d58345b1a359707c25dcac", "score": "0.5584102", "text": "def update\n @q = Q.find_by_unique_id(params[:id])\n\n respond_to do |format|\n if @q.update_attributes(params[:q])\n format.html { redirect_to @q, notice: 'Q was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "141a2ad732f885a00510e7a2cf0c25a1", "score": "0.55599654", "text": "def update\n @quarter = Quarter.find(params[:id])\n\n respond_to do |format|\n if @quarter.update_attributes(params[:quarter])\n format.html { redirect_to @quarter, notice: 'Quarter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quarter.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73782cd45c6aa734564b29f7f3f42e7f", "score": "0.55594456", "text": "def quote_params\n params.require(:quote).permit(:quote, :author, :cnt)\n end", "title": "" }, { "docid": "94e40c49637245c355e7aaaa9c04274c", "score": "0.5559192", "text": "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to(@quote, :notice => 'Quote was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94e40c49637245c355e7aaaa9c04274c", "score": "0.5559192", "text": "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to(@quote, :notice => 'Quote was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26ac8aaed3ee1d23c02dfd6f7ce9d535", "score": "0.5551305", "text": "def update\n @quotetags = Quotetags.find(params[:id])\n\n respond_to do |format|\n if @quotetags.update_attributes(params[:quotetags])\n flash[:notice] = 'Quotetags was successfully updated.'\n format.html { redirect_to(@quotetags) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quotetags.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e016f1b9186a834b636eb542d56dd150", "score": "0.5506823", "text": "def save_quote\n event_id = params[\"event_id\"]\n for each in Specification.where(event_id: event_id).where(exclude_from_quote: nil)\n if params[\"quoted_price-#{each.id}\"] == nil\n each.quoted_price = 0\n else\n each.quoted_price = (params[\"quoted_price-#{each.id}\"].gsub(\",\" , \"\").to_f * 100).round(2)\n end\n items_cost = params[\"per_item_cost-#{each.id}\"].to_f * 100.0\n each.per_item_cost = items_cost.round(2)\n each.per_item_list_price = (params[\"per_item_list_price-#{each.id}\"].to_f * 100).round(2)\n each.extended_list_price = (params[\"extended_list_price-#{each.id}\"].to_f * 100).round(2)\n each.save!\n end\n quote = Quote.where(event_id: event_id).first\n quote.quote_name = params[\"quote_name\"]\n quote.quote_style = params[\"quote_style\"]\n quoted_total_price = 0\n quoted_total_cost = 0\n for each in Specification.where(event_id: event_id).where(exclude_from_quote: nil)\n if each.quoted_price == nil\n each.quoted_price = 0\n else # do nothing\n end\n quoted_total_price = quoted_total_price + each.quoted_price\n quoted_total_cost = quoted_total_cost + (((each.per_item_cost / 100.0) * (each.item_quantity / 100.0)).round(2) * 100.0).round(2)\n end \n quote.total_price = quoted_total_price\n quote.total_cost = quoted_total_cost\n if quoted_total_cost != 0\n quote.markup = (quoted_total_price / quoted_total_cost) * 100\n else # do nothing\n end\n quote.status = params[\"status\"]\n if params[\"status\"] != \"Completed\" && params[\"status\"] != \"Ordered\"\n quote.wholesale_order_date = nil\n else # do nothing\n end\n quote.save!\n event = Event.where(id: event_id).first\n event.event_status = params[\"status\"]\n event.quote_message = params[\"quote_message\"]\n event.save!\n redirect_to \"/generate_quote/#{event_id}\" and return\n end", "title": "" }, { "docid": "79ffbf69ec1c223b8e95ccc5ed367618", "score": "0.5503327", "text": "def quote_params\n params.require(:quote).permit(:quote_config_id, :customer_id, :manufacturer_id, :series_id, :model_id,\n :specific_equipment_id, :tire_replacement_front_id,\n :implement_id, :attachment_id, :tire_replacement_rear_id,\n :base_quote_price, :total_price,\n :quote_date, :markup_percentage, :finalize_date,\n :sale_finalized, :discount_id)\n end", "title": "" }, { "docid": "db4c1f5716f38fbe796edcfb385612f0", "score": "0.54911155", "text": "def create\n @quotation = Quotation.new(quotation_params)\n authorize @quotation\n respond_to do |format|\n if @quotation.save\n format.html { redirect_to @quotation, notice: 'Quotation was successfully created.' }\n format.json { render :show, status: :created, location: @quotation }\n else\n format.html { render :new }\n format.json { render json: @quotation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a95824e8b6e30029af9b0f218cac9bc1", "score": "0.5480128", "text": "def update\n @quize = Quize.find(params[:id])\n\n respond_to do |format|\n if @quize.update_attributes(params[:quize])\n format.html { redirect_to @quize, notice: 'Quize was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quize.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d24b16cb91ee10cdf7f5da4c3134fc0", "score": "0.5473127", "text": "def update\n @participant_quote = ParticipantQuote.find(params[:id])\n\n respond_to do |format|\n if @participant_quote.update_attributes(params[:participant_quote])\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "514e6db37e8704d8423d707aa0f4e3f3", "score": "0.5471066", "text": "def destroy\n @quotation.destroy\n respond_to do |format|\n format.html { redirect_to quotations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "19a41f758bfef75f5ff6fdc1b8606d20", "score": "0.5464268", "text": "def update\n @quote.tag_list = params[:tags]\n respond_to do |format|\n if @quote.update(quote_params)\n format.json { render :show, status: :ok, location: @quote }\n else\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09cc733c41860e16e0a7294b427eb044", "score": "0.54574823", "text": "def update\n @quote_detail = QuoteDetail.find(params[:id])\n\n respond_to do |format|\n if @quote_detail.update_attributes(params[:quote_detail])\n format.html { redirect_to @quote_detail, notice: 'Quote detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b21a5b5b5c8fcf3007f4d695cb63a606", "score": "0.543994", "text": "def quote_params\n params.require(:quote).permit(:text, :quoted, :user_id)\n end", "title": "" }, { "docid": "487fbcc905146fb075f3fb273cef4481", "score": "0.54390895", "text": "def quotation_params\n params.require(:quotation).permit(:name, :email, :subject, :message, :phone_number)\n end", "title": "" }, { "docid": "6b84dbac067485ad1ef695dc781054fc", "score": "0.54236937", "text": "def destroy\n @quotation = Quotation.find(params[:id])\n @quotation.destroy\n\n respond_to do |format|\n format.html { redirect_to(quotations_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "36ded39610442f7ec9ac295b64d3fc3e", "score": "0.5404819", "text": "def update\n @qu = Qu.find(params[:id])\n respond_to do |format|\n if @qu.update_attributes(params[:qu])\n format.html { redirect_to @qu, :notice => 'Qu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36ded39610442f7ec9ac295b64d3fc3e", "score": "0.5404819", "text": "def update\n @qu = Qu.find(params[:id])\n respond_to do |format|\n if @qu.update_attributes(params[:qu])\n format.html { redirect_to @qu, :notice => 'Qu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9072bbbddb1bbffe3eb5fb11a35f2bf", "score": "0.5404113", "text": "def update\n @symptom = Symptom.find(params[:id])\n\n if @symptom.update(symptom_params)\n render json: @symptom, status: :updated\n else\n render json: @symptom.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "292de49986b157a7a9bc3dd339f68633", "score": "0.539899", "text": "def update\n @price_quote = PriceQuote.find(params[:id])\n\n respond_to do |format|\n if @price_quote.update_attributes(params[:price_quote])\n format.html { redirect_to @price_quote, notice: 'Price quote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @price_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "117ed87c5ce3deba0e31524b0bfa1e51", "score": "0.5395962", "text": "def update\r\n @quote_box = QuoteBox.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @quote_box.update_attributes(params[:quote_box])\r\n format.html { redirect_to @quote_box, notice: 'Quote box was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @quote_box.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "993fa59714a825865da6ff1b3d16cf57", "score": "0.5384022", "text": "def set_quote\n @quote = Core::Quote.find(params[:id])\n end", "title": "" }, { "docid": "1de6fcd281d8a813a25598c016823720", "score": "0.5368435", "text": "def quotations\n response = self.class.get('/quotations', OPTIONS)\n\n if response.success?\n parse_quotations(response)\n else\n []\n end\n end", "title": "" }, { "docid": "a540850bb3562e8ba7cc86f2ff836215", "score": "0.5339985", "text": "def update\n @queuing = Queuing.find(params[:id])\n\n respond_to do |format|\n if @queuing.update_attributes(params[:queuing])\n format.html { redirect_to @queuing, notice: 'queuing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @queuing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "965f7ec35157d95f5262822b7174235d", "score": "0.5333834", "text": "def update\n\t\t\t\t\n\t\t\t\ttparams = params.require(:testimony).permit :quote,:author,:sort,:created_at,:updated_at\n\n\t\t\t\t@testimony = Testimony.find params[:id]\n\n\t\t\t\tif @testimony.update(tparams)\n\n\t\t\t\t\trender json: nil,status: 200\n\n\t\t\t\telse\n\n\t\t\t\t\trender json: nil,status: 422\n\n\t\t\t\tend\n\n\t\t\tend", "title": "" }, { "docid": "d885e1fc9566a8b83c0a5b70925810fd", "score": "0.532626", "text": "def update\n @quarter_income_tax.update(quarter_income_tax_params) \n @quarter_income_tax = QuarterIncomeTax.new\n @quarter_income_taxes = QuarterIncomeTax.all\n end", "title": "" }, { "docid": "3b6ec66ad182c9aafebe6f5230b40463", "score": "0.5324513", "text": "def create\n @quotation = Quotation.new(quotation_params)\n\tif(@quotation.user_id==nil) \n\[email protected]_id=current_user.id\n\tend\n\t#puts @myincidents\n respond_to do |format|\n if @quotation.save\n format.html { redirect_to @quotation, notice: 'Quotation was successfully created. Please Remember Your Identification number for later retrieve!' }\n format.json { render action: 'show', status: :created, location: @quotation }\n else\n format.html { render action: 'new' }\n format.json { render json: @quotation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd64c27879fd5aaf4d025fd2e43125ef", "score": "0.5316854", "text": "def update\n @tax = Tax.find(params[:id])\n\n if @tax.update(tax_params)\n head :no_content\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "7849eb000da495c284e1d6de00beac3b", "score": "0.5313856", "text": "def update\n quote = Quote.find(params[:id])\n response = Unirest.post \"https://twinword-sentiment-analysis.p.rapidapi.com/analyze/\",\n headers:{\n \"X-RapidAPI-Host\" => \"twinword-sentiment-analysis.p.rapidapi.com\",\n \"X-RapidAPI-Key\" => \"f8988f3300msh1bf9aec476d3e6fp11f826jsn5bb5ceaa92d7\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\"\n },\n parameters:{\n \"text\" => quote.text\n }\n # puts response.body[\"type\"]\n\n @quote.update(\n saved: params[:saved],\n sentiment: response.body[\"type\"]\n )\n @quote.save\n end", "title": "" }, { "docid": "5648a3dd1e18a6fe372224c9af8a5025", "score": "0.5309559", "text": "def update\n respond_to do |format|\n if @kid_quote.update(kid_quote_params)\n format.html { redirect_to kid_quotes_path, notice: 'Kid quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kid_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7877d5ea458830e772fcd993606692b1", "score": "0.52943003", "text": "def quote_params\n params.require(:quote).permit(:my_query_id, :body, :user)\n end", "title": "" }, { "docid": "f4f820033d88f5d192fb5959e05524fa", "score": "0.52820116", "text": "def update\n @taxirequest = Taxirequest.find(params[:id])\n\n respond_to do |format|\n if @taxirequest.update_attributes(params[:taxirequest])\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxirequest.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ca96d71b0cdb38d3f527d32598f6791", "score": "0.5274808", "text": "def update\n respond_to do |format|\n if @quize.update(quize_params)\n format.html { redirect_to @quize, notice: 'Quize was successfully updated.' }\n format.json { render :show, status: :ok, location: @quize }\n else\n format.html { render :edit }\n format.json { render json: @quize.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b8c06f9b06087ecf61240cacb759804", "score": "0.52729505", "text": "def update\n respond_to do |format|\n if @quote_item.update(quote_item_params)\n format.html { redirect_to @quote_item, notice: 'Quote item was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote_item }\n else\n format.html { render :edit }\n format.json { render json: @quote_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "824c55ca5d6202ea590e23d29e86e18a", "score": "0.52718693", "text": "def destroy\n @quotation.destroy\n respond_to do |format|\n format.html { redirect_to quotations_url, notice: 'Quotation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "26d9faab796afa91f92e19091c7eb5eb", "score": "0.5270434", "text": "def update\n respond_to do |format|\n if @quotation.update(quotation_params)\n @quotation.device_transactions.update_all(purchase_order_id: @quotation.purchase_order.id)\n format.html { redirect_to @quotation.purchase_order, notice: 'Purchase order was successfully updated.' }\n format.json { render :show, status: :ok, location: @quotation.purchase_order }\n else\n @purchase_order = @quotation.purchase_order\n @device_transactions = @quotation.device_transactions\n @uploads = @purchase_order.uploads.blank? ? @purchase_order.uploads.build : @purchase_order.uploads \n format.html { render :edit }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d36b0c40fb1d2b4f788f7dd5a8b87d9", "score": "0.5260978", "text": "def update\n @invoice = Invoice.find(params[:id])\n title=params['q_param']['title']\n total=params['q_param']['total']\n tax_rate=params['q_param']['tax_rate']\n l=params['q_param']['list']\n comment=params['q_param']['comment']\n list=Array.new\n l.keys.each do |j|\n list << [l[j][0],l[j][1],l[j][2],l[j][3]]\n end\n invoice={:title=>title,:total=>total,:list=>list,:tax_rate=>tax_rate,:comment=>comment}\n @invoice.update(invoice)\n format.json { head :no_content }\n end", "title": "" }, { "docid": "b06e17a6ee3195795af4a38c911c058f", "score": "0.5258337", "text": "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "title": "" }, { "docid": "3f6ab9d9cfed561e074242a6d330548d", "score": "0.524902", "text": "def set_quote_item\n @quote_item = QuoteItem.find(params[:id])\n end", "title": "" }, { "docid": "f0450d2ad3db5ce38f770e44e2288749", "score": "0.524202", "text": "def set_quote\n @quote = current_user.quotes.find(params[:id])\n end", "title": "" } ]
24891f0be1dc7644e02c7b3f6eac9381
Use to fill normal frame
[ { "docid": "7e776a0cd42835d94e46f8708c04bb5c", "score": "0.5312006", "text": "def add_normal_frame(index, frame)\n pin = @pins[index]\n if @pins[index.succ].nil?\n frame.score = pin\n @skip_flag = true\n else\n frame.score = pin + @pins[index.succ]\n @skip_flag = true\n end\n end", "title": "" } ]
[ { "docid": "e307f38a6b6e928e44eef65c8d8a59cb", "score": "0.66658455", "text": "def fillrect(*)\n super\n end", "title": "" }, { "docid": "e1d8130298a72d7d1bce6f8472e370fd", "score": "0.6623773", "text": "def fill\n \t@fill\n end", "title": "" }, { "docid": "99a449661c6db08f8ed2ad81d236a67c", "score": "0.645842", "text": "def fill\n self.each {|image| image.fill}\n end", "title": "" }, { "docid": "d881420ce361a0db81d082cf77ac1d22", "score": "0.6326849", "text": "def fill_setup(gc)\n if @obj.fill\n gc.set_background @obj.fill\n gc.set_alpha @obj.fill_alpha\n true\n end\n end", "title": "" }, { "docid": "f1060dcc9394c6481066256fed31c32d", "score": "0.6265394", "text": "def setfillcolorind(*)\n super\n end", "title": "" }, { "docid": "0e24f8fcda56530a6d37f6a2d49c3be3", "score": "0.6258051", "text": "def fill_graphicsblock(*args)\n @p.fill_graphicsblock(self, *args)\n end", "title": "" }, { "docid": "98ced8c6db026ffa6cdc61b6e2d13004", "score": "0.6192416", "text": "def fill_paint(paint)\n end", "title": "" }, { "docid": "4b4ffa1237c495b33b860d19140c614f", "score": "0.6090936", "text": "def fillarc(*)\n super\n end", "title": "" }, { "docid": "d9645d5dbe69fc58fda2fdd97dd31817", "score": "0.60820854", "text": "def fill_imageblock(*args)\n @p.fill_imageblock(self, *args)\n end", "title": "" }, { "docid": "18e15069eac701cb540d7dbbe485a365", "score": "0.59779555", "text": "def fill_rect(*args)\n raise \"not implemented\"\n end", "title": "" }, { "docid": "632b588c01aef6ce8dbfbdde2fb7629d", "score": "0.59646285", "text": "def update_fill\n end", "title": "" }, { "docid": "3b14b5bd453f53fe90c7b77af01ae42a", "score": "0.5948521", "text": "def fill(cx, cy, half_width, half_height)\n surface = cy\n\n ((cx - half_width)..(cx + half_width)).each { |x|\n ((cy - half_height)..(cy + half_height)).each { |y|\n put_block(x, y, @block_map[:dirt].dup)\n }\n }\n\n put_block(0, 0, @block_map[:rock].dup)\n end", "title": "" }, { "docid": "a46a79eaaae07530756a2332694eaedb", "score": "0.5926375", "text": "def fill\n return @fill\n end", "title": "" }, { "docid": "1a237db24854365df59c5cdde15f3859", "score": "0.5894949", "text": "def scale_to_fill(new_size, position:position)\n scale_to_fill(new_size, position: position, scale: self.scale)\n end", "title": "" }, { "docid": "f726ff3c487ff067ba9d3bd091ef8801", "score": "0.5882468", "text": "def fill\n fit\n rounding_error\n border_x = (@x - rmagick_img.columns)/2\n border_y = (@y - rmagick_img.rows)/2\n\n rmagick_img.border!(border_x,border_y,\"white\")\n end", "title": "" }, { "docid": "668b5d46084b6cfbd0a6505d883926c7", "score": "0.58711964", "text": "def frame\n @rad.frame(0)\n end", "title": "" }, { "docid": "fa08e14670c5ef5667313e92131ac061", "score": "0.5856061", "text": "def scale_to_fill(new_size)\n scale_to_fill(new_size, position: :center)\n end", "title": "" }, { "docid": "4e163ae2a0dd4c51ada437f90badc203", "score": "0.5839377", "text": "def fill(pipeline, width, height, gravity = \"Center\")\n pipeline.resize_to_fill!(width, height, gravity: gravity)\n end", "title": "" }, { "docid": "e716676e3baa922363b4a45e7d4d5635", "score": "0.5825871", "text": "def setup \n size 640, 360 \n no_stroke\n rect_mode CENTER \n frame_rate 30 \n @a, @s = 0.0, 0.0\nend", "title": "" }, { "docid": "2fa1995cf9d6bd01e1d5d1fe9bca506f", "score": "0.5797123", "text": "def initial_fill alpha\n alpha_top.wmes.each do |wme|\n alpha.activate wme if wme =~ alpha.template\n end\n end", "title": "" }, { "docid": "889bfbcdb22c9cdd0d4e907dcd2a5cc7", "score": "0.5772898", "text": "def fill=(value)\n @fill = value\n end", "title": "" }, { "docid": "f2871f3a0641828691aa9503339be3d6", "score": "0.5756303", "text": "def cover\n manipulate! do |frame, index|\n frame if index.zero?\n end\n end", "title": "" }, { "docid": "072f1964caa8499634dfed1b5f36a14c", "score": "0.57531226", "text": "def fill_and_stroke\n cur_page.fill_and_stroke\n end", "title": "" }, { "docid": "24795a00731098c8cbd860d10a424fd5", "score": "0.5752574", "text": "def setup \n size 640, 360 \n\tbackground 127 \n\tno_stroke\t\n\t(0...height).step(20) do |i|\n\t\tfill 0 \n\t\trect 0, i, width, 10 \n\t\tfill 255 \n\t\trect i, 0, 10, height \n\tend\nend", "title": "" }, { "docid": "771cdbb859ac995da163bbc6cb94f625", "score": "0.57328844", "text": "def reset(cols, rows)\n\n\t@cols = cols.to_i.abs\n\t@rows = rows.to_i.abs\n\t@created = true\n\n\tx = 0\n\tuntil x > @rows\n\t y = 0\n\t until y > @cols\n\t\tset_pixel(\"#{y}-#{x}\", COLOR_WHITE)\n\t\ty = y+1\n\t end\n\t x = x+1\n\tend\n\n end", "title": "" }, { "docid": "80e476438579da1676531c65d1eb7bf7", "score": "0.5694046", "text": "def initialize\n @frame = Rect.zeroRect\n end", "title": "" }, { "docid": "7c465f563e012cfd3f5232a2153c2fe4", "score": "0.567901", "text": "def _beam1\n b = Bitmap.new(24, 1)\n (1...12).each {|i|\n b.fill_rect(i, 0, 1, 1, Color.new(255, 255, 255, i**2*3))\n b.fill_rect(23-i, 0, 1, 1, Color.new(255, 255, 255, i**2*3))}\n return b\n end", "title": "" }, { "docid": "233c45717947f50ae5f0950b49f89cf6", "score": "0.56778735", "text": "def block_fill(x, y)\n marked = Array.new(@image.height) { Array.new(@image.width) }\n find_block_info_recursive(marked, 0, @dp, @cc, x, y, x, y)\n end", "title": "" }, { "docid": "03ccad5a63fb1c4d13cdebf07da13c10", "score": "0.5671051", "text": "def frame=(pos); end", "title": "" }, { "docid": "ff4ac99e42e21c376dd2d794681fd70e", "score": "0.56271034", "text": "def fill\n cur_page.fill\n end", "title": "" }, { "docid": "4ad557d4ca222e9bd7450ac3fe459a2a", "score": "0.5595227", "text": "def fast_rect x, y, w, h, c\n screen.fill_rect x, self.h-y-h, w, h, color[c]\n end", "title": "" }, { "docid": "8cdd2495a8321ff58e8766fd47553497", "score": "0.5586254", "text": "def setfillstyle(*)\n super\n end", "title": "" }, { "docid": "a6a61a0cbff42d8e630529d2eebbdb91", "score": "0.5585102", "text": "def new_fill(value)\n self.class.new(*shape).fill(value)\n end", "title": "" }, { "docid": "92a2af4ffb6e5fca729b6f7460bff338", "score": "0.5544442", "text": "def inqfillcolorind\n inquiry_int { |pt| super(pt) }\n end", "title": "" }, { "docid": "92a2af4ffb6e5fca729b6f7460bff338", "score": "0.5544442", "text": "def inqfillcolorind\n inquiry_int { |pt| super(pt) }\n end", "title": "" }, { "docid": "74ed13ad0ac985f08aa20d9798ab03ad", "score": "0.55315125", "text": "def reset\n @max_color_distance = @color_distance_limit ? 0 : nil\n @left = @top = @right = @bottom = nil\n end", "title": "" }, { "docid": "fefcf23a34715c8a0f6c40a9dcafa872", "score": "0.5529563", "text": "def fill(color)\n @window.fill_with(color)\n end", "title": "" }, { "docid": "5d17ed28d429fcf191cb30954bf13e7e", "score": "0.5475499", "text": "def rect_filled(x1, y1, x2, y2)\n\t\[email protected] x1, y1, x2-x1, y2-y1, @color_fg, 255\n\tend", "title": "" }, { "docid": "538e1746ac066452fb3a63c58ce8a7b9", "score": "0.54327273", "text": "def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.ox = @cw/2\n self.opacity = 255\n end", "title": "" }, { "docid": "6ae83c6e10d9a32e53998a8071c87077", "score": "0.5426488", "text": "def clear\n @pixels.fill WHITE\n end", "title": "" }, { "docid": "574ac612778a89e6324b245930cb4ccc", "score": "0.542378", "text": "def pbBGMFade(x=0.0); pbBGMStop(x);end", "title": "" }, { "docid": "2d0f136c6e0d94b11150f0509477e7db", "score": "0.5421834", "text": "def setup \n size 640, 360\n no_stroke\n frame_rate 30 \n @x, @y = 0.0, 0.0\n @size = 80.0\nend", "title": "" }, { "docid": "e306f4bb8fd4c246a1ae90ae1ba33793", "score": "0.5417943", "text": "def fill_pdfblock(*args)\n @p.fill_pdfblock(self, *args)\n end", "title": "" }, { "docid": "8bb9c7331f387db427218e790240d420", "score": "0.54162467", "text": "def reset(cols, rows)\n\t\t@holeSize = 3 + rand(2)\n\t\t@holeHeight = rows / 4 + rand * (rows / 2)\n\t\t@tubePosition = cols - 1\n\t\t@lastPosition = @tubePosition\n\t\t@passed = false\n\tend", "title": "" }, { "docid": "77b7a41fe9d72573fdd7e198a6658bcd", "score": "0.54058325", "text": "def setup\n size 640, 360 \n \n stroke 255\n no_fill\nend", "title": "" }, { "docid": "706acf0068cb7dc6d82821847d0087dd", "score": "0.5401689", "text": "def clear_tsbs\n super\n @ori_x = 0\n @ori_y = 0\n end", "title": "" }, { "docid": "45d603359767422f34535d7f217f581e", "score": "0.5388894", "text": "def scale_to_fill(new_size, scale: scale)\n scale_to_fill(new_size, position: :center, scale: scale)\n end", "title": "" }, { "docid": "81381b4121e4d5ce5cb90205f69e2558", "score": "0.53727674", "text": "def blit; end", "title": "" }, { "docid": "b0a9367ae8cf80866ede179546c41eb2", "score": "0.5354212", "text": "def update_bitmap\n ### The following commented lines may be used for animation frames ###\n # # Get the graphic that represents the current frame\n # sx = @unit.frame * @cw\n # # Take the square graphic from the rectangular picture\n # self.src_rect.set(sx, 0, @cw, @ch)\n self.src_rect.set(0, 0, @cw, @ch)\n end", "title": "" }, { "docid": "33602e4308b58a86f08d656aa1cf5b6f", "score": "0.53363484", "text": "def fill\n\t\t# Go through each item\n\t\[email protected] do |i|\n\t\t\[email protected] do |offset|\n\t\t\t\tleft = i - offset\n\t\t\t\tright = i + offset\n\n\t\t\t\t# The equation is the following:\n\t\t\t\t# value of 46 given to the item staying on the current item\n\t\t\t\t# As you move right and left item, the value is given by 50 - (distance from center note + 2)^2\n\t\t\t\tval = 50 - ((offset + 1) ** 2)\n\t\t\t\tval = 0 if val < 0\n\n\t\t\t\tif left >= 0\n\t\t\t\t\t@matrix[[i, left]] = val\n\t\t\t\tend\n\n\t\t\t\tif right < @items.length\n\t\t\t\t\t@matrix[[i, right]] = val\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "bad381403e4adaa5c0f256048d678c6c", "score": "0.53320163", "text": "def clear\n\t\[email protected]_rect 0, 0, @width, @height, @color_bg\n\tend", "title": "" }, { "docid": "9d1734312bee0cb1da2f05a378cc2cde", "score": "0.53266376", "text": "def empty\n @x = @y = @width = @height = self.true_x = self.true_y =\n self.true_width = self.true_height = 0\n self\n end", "title": "" }, { "docid": "1ff08debd206c07f1bf8321006c919e1", "score": "0.5325285", "text": "def clear(options = {})\r\n options = {\r\n :color => :alpha,\r\n :fill => true\r\n }.merge!(options)\r\n\r\n capture {\r\n rect 0, 0, width - 1, height - 1, options\r\n \r\n self\r\n }\r\n end", "title": "" }, { "docid": "b5a6c5cbf0b08c0249ed8a97e2190f6d", "score": "0.53249264", "text": "def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fill = args[:fill] if args.key?(:fill)\n @shape = args[:shape] if args.key?(:shape)\n end", "title": "" }, { "docid": "134b9000ce63f184122c2e2745e027ab", "score": "0.532105", "text": "def deanimate\n @frame=0\n @currentIndex=0\n @actualBitmap.clear\n @actualBitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmap,Rect.new(@currentIndex*(@width/@scale),0,@width/@scale,@height/@scale))\n end", "title": "" }, { "docid": "134b9000ce63f184122c2e2745e027ab", "score": "0.532105", "text": "def deanimate\n @frame=0\n @currentIndex=0\n @actualBitmap.clear\n @actualBitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmap,Rect.new(@currentIndex*(@width/@scale),0,@width/@scale,@height/@scale))\n end", "title": "" }, { "docid": "0d6bf9e3178e74eb91cb9b0e6e6a57e9", "score": "0.5316256", "text": "def space\n canvas = (1..@height).to_a.collect {|_| [:empty] * @width}\n @crates.each do |sc|\n range_y = (sc.min_y..sc.max_y)\n range_x = (sc.min_x..sc.max_x)\n sc.fill_coordinates.each do |x, y|\n canvas[y][x] = :filled\n end\n end\n canvas\n end", "title": "" }, { "docid": "7b879c6e45ab56a94add6b9b36a278b2", "score": "0.53103817", "text": "def setup\n size 640, 360\n @xvals = Array.new width, 0\n @yvals = Array.new width, 0\n @bvals = Array.new width, 0\nend", "title": "" }, { "docid": "4dcf94bfb2e0e7e833d6e536755c8c49", "score": "0.52998954", "text": "def attach(frame)\n detach if attached?\n self.size = Rect.new(\n top: frame.top + frame.height - 1,\n left: frame.left,\n width: frame.width,\n height: 1\n )\n @frame = frame\n @frame.mini_buffer = self\n set_current_buffer(buffer)\n end", "title": "" }, { "docid": "ce10cf33f0344c16e605f306d815625c", "score": "0.5297394", "text": "def fill(pattern)\n @style[:fill] = pattern(pattern)\n end", "title": "" }, { "docid": "a181a05064f1a44debc8b34aa3e2836a", "score": "0.5286822", "text": "def restart\n pbBGMStop(0)\n 51.times do\n @viewport.tone.red-=5\n @viewport.tone.green-=5\n @viewport.tone.blue-=5\n self.updateElements\n Graphics.update\n end\n raise Reset.new\n end", "title": "" }, { "docid": "b4a5e7842d0875c34d1fe44c9be64d7a", "score": "0.52731776", "text": "def update_frame\n # If animation frame is different, change graphic\n if @anim_frame != @unit.frame\n @anim_frame = @unit.frame\n end\n end", "title": "" }, { "docid": "cfcf674978dfd9d8f091ca4895bf3e4f", "score": "0.5270367", "text": "def initialize(fill_board = true)\n place_figures(fill_board)\n end", "title": "" }, { "docid": "01abd06dab8d58daf3e2ecf935b96126", "score": "0.5264172", "text": "def fast_rect x, y, w, h, c\n screen.fill_rect x, y, w, h, color[c]\n end", "title": "" }, { "docid": "e7899a2ebf12b8cace7196c8448a411d", "score": "0.52637106", "text": "def draw\n # draw the \"background\" translucid energy bar\n super\n \n @energy = Engine::Game.game_state.energy\n # clip the opaque image to draw only the remaining energy\n Engine::Game.instance.clip_to(@x - @image.width / 2, @y - @image.height / 2, @energy * BarWidth, @image.height) do\n @image, @image_full = @image_full, @image # swap transparent and opaque images\n super # draw the \"foreground\" opaque var\n end\n \n @image, @image_full = @image_full, @image # back to normal\n end", "title": "" }, { "docid": "9fb09a1e528c8623dd7d66e295c98764", "score": "0.52634364", "text": "def background_fill\n @background_fill ||= begin\n digest = \"0.#{Digest::MD5.hexdigest(@name).to_i(16).to_s}\".to_f\n index = (digest * (@background_colors.length - 1)).round\n @background_colors[index]\n end\n end", "title": "" }, { "docid": "785edb6ebd3a2466b32e57826e6fb9b0", "score": "0.52616495", "text": "def paint_fill(screen, point, new_color, old_color = nil)\n x = point[0]\n y = point[1]\n\n old_color ||= screen[y][x]\n if screen[y][x] != old_color\n return\n else\n screen[y][x] = new_color\n paint_fill(screen, [x, y + 1], new_color, old_color) if y + 1 < screen.length\n paint_fill(screen, [x, y - 1], new_color, old_color) if y - 1 >= 0\n paint_fill(screen, [x + 1, y], new_color, old_color) if x + 1 < screen[0].length\n paint_fill(screen, [x - 1, y], new_color, old_color) if x - 1 >= 0\n end\n screen\nend", "title": "" }, { "docid": "0630970fac14555b1be21e59c5d0bed1", "score": "0.5256023", "text": "def update_frame\n # If animation frame is different, change graphic\n if @unit.frame != Graphics.frame_count % 60 / 15\n @unit.frame = Graphics.frame_count % 60 / 15\n end\n #Update the flag graphic\n # Is $viewing ranges necessary?#\n unless @is_moving or @unit.selected\n @flag.moveto(@unit.x, @unit.y)\n @flag.update\n @health.moveto(@unit.x, @unit.y)\n @health.update\n else\n @flag.bitmap = nil\n @health.bitmap = nil\n end\n \n end", "title": "" }, { "docid": "c12b09eb0c9488552d978b200960c5c0", "score": "0.5254509", "text": "def setfillintstyle(*)\n super\n end", "title": "" }, { "docid": "6bb98f5c726e4c68b854907dac000a05", "score": "0.5217966", "text": "def initialize(x, y)\n super(x, y, 84, WLH + 32)\n refresh\n end", "title": "" }, { "docid": "3fe844f8e4f51a4969ba2e49d749e56b", "score": "0.520436", "text": "def reset(window)\n\t\t# put the horse back in the center\n\t\t@x = window.width / 2 - @image.width / 2\n\t\t@y = window.height / 2 - @image.height / 2\n\tend", "title": "" }, { "docid": "a6f03a7e4e7a8b2dce83dc072be53f08", "score": "0.520291", "text": "def fill_color(color)\n end", "title": "" }, { "docid": "645020ad4ca6812ad4d3fc4a78fdfc0d", "score": "0.5197801", "text": "def matte_reset!\n alpha(TransparentAlphaChannel)\n self\n end", "title": "" }, { "docid": "9103155c13505dd3a68ba62fbf1d87e4", "score": "0.5197159", "text": "def blur!\r\n ones = get_ones\r\n ones.each do |found_row_number, found_col_number| \r\n @picture[found_row_number -1][found_col_number] = 1 unless found_row_number == 0 #up\r\n @picture[found_row_number +1][found_col_number] = 1 unless found_row_number == @picture.length-1 #down\r\n @picture[found_row_number][found_col_number -1] = 1 unless found_col_number == 0 #left\r\n @picture[found_row_number][found_col_number +1] = 1 unless found_col_number == @picture[found_row_number].length-1 #right\r\n end\r\n end", "title": "" }, { "docid": "f40dd3ea70fa3e5f4c73b0241f506d1e", "score": "0.5188993", "text": "def update_src_rect\n @sap_frame_count %= @sap_time_interval\n if @sap_frame_count == 0\n @sap_current_frame += 1\n @sap_current_frame = 0 if self.bitmap.width < (@sap_current_frame + 1)*@sap_frame_width\n sx = @sap_current_frame*@sap_frame_width\n self.src_rect.set(sx, 0, @sap_frame_width, self.bitmap.height)\n end\n @sap_frame_count += 1\n end", "title": "" }, { "docid": "dccdd97cd998da9da4e9e50bc44c1ad8", "score": "0.5180444", "text": "def draw_new\n\t @board=Array.new(@y) {Array.new(@x){'*'}}\n\t \n end", "title": "" }, { "docid": "bd358f165f9cc613676afad9ef09d59f", "score": "0.5174293", "text": "def frame_reset\n @delta_time = @frame_to_skip = 0\n @ruby_time = @current_time = @last_time = @last_second_time = Time.new\n reset_gc_time\n reset_ruby_time\n @last_frame_count = Graphics.frame_count\n end", "title": "" }, { "docid": "a163c063a1331714339897f4d40abac5", "score": "0.5169622", "text": "def clear\n @x = 0.0\n @y = 0.0\n end", "title": "" }, { "docid": "ba947e1726d1383a82c38d84e2d79d5e", "score": "0.51653004", "text": "def pbBGSFade(x=0.0); pbBGSStop(x);end", "title": "" }, { "docid": "8284354972d135b6d072de9f52722dff", "score": "0.51613474", "text": "def animation_frame=(value)\r\n @pattern = @original_pattern = value\r\n end", "title": "" }, { "docid": "71b84a0b52bf5b632ac68434c14d8d7f", "score": "0.51605165", "text": "def delay(frame)\n (frame*40).to_i.times {Graphics.update}\n end", "title": "" }, { "docid": "ae5811266350a773516f76106db6b7b1", "score": "0.5158141", "text": "def refresh\n generate_part_rects\n generate_buffers\n self\n end", "title": "" }, { "docid": "62bdac0dbf1d8091edbf078bf0f605d8", "score": "0.5153233", "text": "def fill\n matrix = [ { :loc_x => 0, :loc_y => 0, :value => 1, :dir => \"right\"}, { :loc_x => 1, :loc_y => 0, :value => 1, :dir => \"up\"} ]\n current = matrix.last\n while current[:value] < 800\n last_index = matrix.length - 1\n # 325489\n if current[:value] == \"up\"\n matrix << { :loc_x => matrix[last_index - 1], :loc_y => matrix[last_index - 1] + 1, :value => 1, :dir => \"\" }\n end\n\n val = current[:value]\n end\n p val\nend", "title": "" }, { "docid": "9946222deb3bc2b4597038ab6d72b22f", "score": "0.514887", "text": "def fill_region(x, y, colour)\n return if invalid?(x,y)\n x = xform(x)\n y = xform(y)\n target_colour = @matrix.element(y, x)\n @matrix.flood_fill(x, y, target_colour, colour)\n end", "title": "" }, { "docid": "ee81fc3d77a26a920d1b9bca70d7b2c3", "score": "0.5139668", "text": "def filler(y, x)\n screen.board[y][x].state = \"o\"\n self\n end", "title": "" }, { "docid": "4256501c44ac1f0be78a41e7cc9d8386", "score": "0.5138603", "text": "def setup \n size 200, 200 \n @y = 100 \n stroke 255\n no_loop\nend", "title": "" }, { "docid": "e98d4132908914f04860d078e8543108", "score": "0.5132028", "text": "def initialize\n self.frames = []\n self.options = {}\n reset_for_fullscreen\n end", "title": "" }, { "docid": "adf6019c385a49589dc40b8839b6b1dd", "score": "0.5124024", "text": "def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 255\n update_origin\n end", "title": "" }, { "docid": "c1a9d0191509ecf856fef5213467a250", "score": "0.5121012", "text": "def fill_from_gemo\r\n end", "title": "" }, { "docid": "8839bae9e553fc8b1bfe76e94bbc3283", "score": "0.51185614", "text": "def fill_empty_y(x, x_end, y_start, y_end, canvas)\n if x < x_end\n if x <= 0\n y_fill_start = yield(x) + 1\n y_fill_end = yield(x - 1) - 1\n else\n y_fill_start = yield(x) + 1\n y_fill_end = yield(x + 1) - 1\n end\n y_fill_mid = y_fill_start + ((y_fill_end - y_fill_start) / 2)\n y_fill_start.upto(y_fill_end) do |y_fill|\n if y_fill >= y_start && y_fill <= y_end\n canvas[x + @x_neg_offset, y_fill + @y_neg_offset] = PNG::Color.new(255, 0, 0)\n end\n end\n end\n end", "title": "" }, { "docid": "d27acef9809841d68a57b6f2d751c115", "score": "0.5116653", "text": "def set_frame\n frames = @animations[@playing_animation]\n case frames\n when Range\n reset_clipping_rect\n @clip_x = @current_frame * @clip_width\n when Array\n f = frames[@current_frame]\n @clip_x = f[:x] || @defaults[:clip_x]\n @clip_y = f[:y] || @defaults[:clip_y]\n @clip_width = f[:width] || @defaults[:clip_width]\n @clip_height = f[:height] || @defaults[:clip_height]\n @frame_time = f[:time] || @defaults[:frame_time]\n end\n end", "title": "" }, { "docid": "685c2cdd2c18d59788b005bea940a214", "score": "0.5100771", "text": "def blur(n)\n\t\tn.times do\n\t\t\ttransform(one_index)\n\t\tend\n#\t\tupdate_cell(row_index+1,col_index,1)\n#\t\tupdate_cell(row_index,col_index+1,1)\n#\t\tupdate_cell(row_index,col_index-1,1)\n#\t\tupdate_cell(row_index-1,col_index,1)\n\tend", "title": "" }, { "docid": "cf32f21680ebe3b1837fb3561ddd8d2f", "score": "0.5087593", "text": "def stretch(&block)\n clone.stretch!(&block)\n end", "title": "" }, { "docid": "47e36bbac923bf9b2c01d50c136034d7", "score": "0.5073656", "text": "def draw\n\t\t# Complete the missing code\n\t\tdraw_background()\n\tend", "title": "" }, { "docid": "3f2076be63a63f506a1453635ad02869", "score": "0.5072047", "text": "def transparent!\n @transparency = 1.0\n self\n end", "title": "" }, { "docid": "1565762f1620fc3ba0df3a4e48b3d5f0", "score": "0.5067188", "text": "def fill_color(color=nil)\n cur_page.fill_color(color)\n end", "title": "" }, { "docid": "cda81e2b434c0edaa16084329de1094a", "score": "0.5064709", "text": "def fillColor=(color)\n @fill_color = color.CGColor\n self.setNeedsDisplay\n end", "title": "" }, { "docid": "78de1e84522a0467a09cacfba6887223", "score": "0.50609756", "text": "def fill_board\n MAXY.times do |t|\n @board << Array.new(MAXX, 0) if @board[t].nil?\n end\n\n @board.map! do |row|\n row << [0] * (MAXX - row.size)\n row.flatten\n end\n end", "title": "" }, { "docid": "1a7b8d8e29f1f1e348cc8ec05a727c16", "score": "0.50609446", "text": "def reset\n @output = Array.new(Vedeu.height + 1) do |y|\n Array.new(Vedeu.width + 1) do |x|\n Vedeu::Models::Cell.new(position: [y, x])\n end\n end\n end", "title": "" }, { "docid": "1b9bda5a09b0b7f64e092e7286317bb0", "score": "0.505868", "text": "def draw_background\r\n Gosu.draw_rect 0, 0, self.width, self.height, Gosu::Color::BLACK\r\n end", "title": "" } ]
819f4b0cbd9569c15c17a47ec8b1f6ea
4) Displays a form to the user.
[ { "docid": "e68f46bfd8877386c908a622b4cb009b", "score": "0.0", "text": "def new\n @post = Post.new\n end", "title": "" } ]
[ { "docid": "4c5ddadeffb8658af85b4d31d78c26f0", "score": "0.72435373", "text": "def form; end", "title": "" }, { "docid": "4359f17cccd1b44ee098eeaaa38305d9", "score": "0.7154046", "text": "def form\n end", "title": "" }, { "docid": "ab5f721237b79940671bfc35760303b2", "score": "0.7136088", "text": "def form\n\n end", "title": "" }, { "docid": "a66231c8093cacba4e12452f05171fa3", "score": "0.70721245", "text": "def form\n end", "title": "" }, { "docid": "a66231c8093cacba4e12452f05171fa3", "score": "0.70721245", "text": "def form\n end", "title": "" }, { "docid": "cd71eac12c3cd1be590f670ab625779c", "score": "0.68478465", "text": "def show\n render :form\n end", "title": "" }, { "docid": "7950dc7a707c7c5ab20276610e03d655", "score": "0.6683839", "text": "def form\n template = cortex.read :form, \"#{@name}/#{@method}\"\n form = template.new argv.options\n form.validate!\n form\n end", "title": "" }, { "docid": "96b950561a08c1b9ff887c1b64175e8d", "score": "0.6677432", "text": "def show_form_for(record)\n self.RR.show_form_for(@util.dom_id(record), @util.render('form'))\n end", "title": "" }, { "docid": "df8a8831a61101252cf4515069139306", "score": "0.6504141", "text": "def the_form( options={}, &proc)\n self.expects(:ubiquo_user_path).returns(\"/ubiquo/users/1\")\n options[:builder] = Ubiquo::Helpers::UbiquoFormBuilder\n user = User.new\n form_for([:ubiquo,user], options, &proc)\n @rendered = \"\"\n end", "title": "" }, { "docid": "8e1e5f0e82f9a2ead8b78b0878a034c5", "score": "0.64888847", "text": "def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end", "title": "" }, { "docid": "1780bd684114196e482a1bb2b2502b26", "score": "0.648558", "text": "def welcome_form(name, path, param, text_label)\n form_tag path, id: \"#{name}-form\" do\n out = \"\\n\"\n out << label_tag(param, text_label, class: \"form-description\")\n out << \"\\n\"\n out << text_field_tag(param)\n out << \"\\n\"\n out << submit_tag(\"Submit\", id: \"#{name}-submit\")\n out.html_safe\n end\n end", "title": "" }, { "docid": "145299a516ed8d776021f91a9cb49359", "score": "0.6385517", "text": "def show\n @form = Form.find(params[:id])\n \n #respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @form }\n #end\n redirect_to :action => \"display_form\"\n end", "title": "" }, { "docid": "9f23f592c4ceb6b9df25f87f56943d61", "score": "0.63703597", "text": "def show\n respond_with @form\n end", "title": "" }, { "docid": "80a27348d53daffeb3dc1b8c2a76a070", "score": "0.63692033", "text": "def show\n if @form.formtype == 'nonprofit'\n nonprofit\n elsif @form.formtype == 'food'\n food\n send_data(@form.kc_file_contents,\n type: @form.kc_content_type,\n filename: @form.kc_filename)\n elsif @form.formtype == 'commercial'\n commercial\n elsif @form.formtype == 'retail'\n retail\n end\n end", "title": "" }, { "docid": "a77885218fccf491ba50daa9d6d1c155", "score": "0.6304555", "text": "def the_form(options = {}, &proc)\n self.ubiquo.stubs(:users_path).returns(\"/ubiquo/users\")\n self.ubiquo.stubs(:user_path).returns(\"/ubiquo/users/1\")\n options[:url] = ubiquo.users_path\n options[:builder] = Ubiquo::Helpers::UbiquoFormBuilder\n render :text => form_for(User.new, options, &proc)\n end", "title": "" }, { "docid": "aeb29baeb37d55ead3ac9951064c52d0", "score": "0.62960714", "text": "def print_form\n NamespaceModuleName.print_form(@namespace, @module_name, :version => @version)\n end", "title": "" }, { "docid": "434cb5537e7a19f35632a518febb761e", "score": "0.6292462", "text": "def form\n render :inline => <<-html\n <html>\n <body>\n <hr>\n <em>valid</em>:#{ Raptcha.valid?(params) ? :true : :false }\n <hr>\n <% form_tag do %>\n #{ Raptcha.input }\n <hr>\n <input type=submit name=submit value=submit />\n <hr>\n <a href=\"#{ request.request_uri }\">new</a>\n <% end %>\n </body>\n </html>\n html\n end", "title": "" }, { "docid": "8ba544b9f90f525f7dfe545ebb321496", "score": "0.6285865", "text": "def forms\n @browser.link(:text=>\"Forms\", :class=>\"icon-sakai-metaobj\").click\n Forms.new(@browser)\n end", "title": "" }, { "docid": "8ba544b9f90f525f7dfe545ebb321496", "score": "0.6285865", "text": "def forms\n @browser.link(:text=>\"Forms\", :class=>\"icon-sakai-metaobj\").click\n Forms.new(@browser)\n end", "title": "" }, { "docid": "d7a1c83f9cec5175d1a8761012b5825f", "score": "0.62595797", "text": "def form(*options, &block)\r\n\r\n sync_swing_thread do\r\n \r\n is_panel = false\r\n\r\n if options.length == 0\r\n is_panel = false\r\n elsif options[0] == :as_panel\r\n is_panel = true\r\n end\r\n\r\n if is_panel\r\n x = ::Panel.new\r\n else\r\n x = ::Frame.new\r\n end\r\n\r\n x.extend(Form)\r\n x.setup is_panel\r\n\r\n x.instance_eval(&block) unless block.nil?\r\n\r\n x.refresh_tooltips\r\n x.apply_styles\r\n\r\n x\r\n \r\n end\r\n\r\n end", "title": "" }, { "docid": "ddfc9c8446713f38934f0d5c52660b4d", "score": "0.62571925", "text": "def form\n provides :html\n render :layout => :uploader\n end", "title": "" }, { "docid": "2489e60f10487289c8ddd25535d03c3c", "score": "0.6222667", "text": "def show\r\n @styles = AppStyles.new()\r\n @page_style = @styles.css.html_safe\r\n\r\n tasks = Task.where(\"user_id = #{session[:user_id]} and task_id is null\").order('name ASC')\r\n html_dsl = HtmlDsl.new()\r\n html_dsl.form(\"task\", {id: 'task_form', action: 'task', authenticity_token: form_authenticity_token}) do\r\n html_dsl.div() do\r\n task_html = create_task_table(tasks)\r\n html_dsl.inject(task_html)\r\n end\r\n\r\n html_dsl.div({classes: [@styles.inline_div]}) do\r\n create_task_management(html_dsl)\r\n end\r\n\r\n # Selecting categories\r\n html_dsl.div({classes: [@styles.inline_div]}) do\r\n show_categories(html_dsl)\r\n end\r\n\r\n html_dsl.div({classes: [@styles.clear_both]}) {}\r\n end\r\n\r\n @task_html = get_html(html_dsl.html_gen.xdoc).html_safe\r\n @javascript = create_row_click_javascript('task', ['name'], 1).html_safe # javascript for when user clicks on a row to populate edit boxes.\r\n\r\n nil\r\n end", "title": "" }, { "docid": "84a59e4ae6168435e7aae9c1a6727d5c", "score": "0.62140846", "text": "def render_form(action)\n body_class << action\n @title = t(\"labels.user.#{action}\")\n render :form\n end", "title": "" }, { "docid": "b3b09a9c9c1a6edc630c5ca12336afc3", "score": "0.6209861", "text": "def set_form\n end", "title": "" }, { "docid": "f4cfbf1f40672565c784b839eb0e4d69", "score": "0.62050706", "text": "def medical_form_submit\n\n puts \"submitting form\"\n client = user_client\n mixpanel_tab_event(\"Medical Credentialing\", \"Form Submit\")\n\n if(params[:formSubmit] == \"true\")\n # use form variables to fill out html template file,\n # convert html file to a pdf and upload to Box\n filename = \"tmp/Medical Application Form.pdf\"\n\n # the \"Doc\" module code can be found in app/models/\n doc = Doc.new({:id => params[:id], :name => params[:name],\n :date => params[:date], :specialty => params[:specialty],\n :degree => params[:degree],\n :username => session[:userinfo]['info']['name']})\n\n path = \"#{session[:userinfo]['info']['name']}\\ -\\ Medical\\ Credentialing\"\n doc.configure_pdf(client, filename, path, ENV['MEDICAL_FORM'])\n end\n\n flash[:notice] = \"Thanks for submitting! Please upload credentials for review.\"\n redirect_to medical_path\n end", "title": "" }, { "docid": "3cb9bf27066323366f99c467b5259ef3", "score": "0.6204592", "text": "def login_signup_form(action)\n\t<<-HTML\n\t\t<form action='#{action}' method=post>\n\t\t\t<label>\n\t\t\t\tName\n\t\t\t\t<input type=text name=name />\n\t\t\t</label>\n\t\t\t<input type=submit />\n\t\t</form>\n\tHTML\nend", "title": "" }, { "docid": "9ef5ba3396f67a90e42d129462ee0336", "score": "0.6202442", "text": "def show_uoc_info_form\n logger.info 'Showing the Use of Collections Info form'\n wait_for_element_and_click form_show_hide_button('Use of Collections Information')\n end", "title": "" }, { "docid": "dfff4b255e2209d12c60419270064da0", "score": "0.6162269", "text": "def send_message_form(options={})\n\n erb 'new_message'.to_sym, :layout => false \n\n end", "title": "" }, { "docid": "b00541070e43dfa7ff00712d7bbcd227", "score": "0.6156434", "text": "def emit_form(apacheid, mdata, button_help, uimap)\n title = mdata.empty?() ? 'Volunteer to Mentor a New ASF Member' : 'Update your Mentor Record'\n _whimsy_panel(\"#{title} (#{apacheid})\", style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n if mdata.has_key?(MentorFormat::ERRORS)\n _div.alert.alert_danger role: 'alert' do\n _p 'There was an error parsing the .json; you might need to manually edit it instead:'\n _p.text_error mdata[MentorFormat::ERRORS]\n end\n end\n\n _whimsy_forms_subhead(label: 'How Mentees Should Work With You')\n\n emit_mentor_input('contact', mdata, uimap, 'glyphicon-bullhorn', req: true)\n field = 'timezone'\n _whimsy_forms_select(label: uimap[field][0], name: field,\n values: (mdata[field] ? mdata[field] : ''),\n options: MentorFormat::TZ.sort,\n icon: 'glyphicon-time', iconlabel: 'clock',\n helptext: uimap[field][1]\n )\n emit_mentor_input('availability', mdata, uimap, 'glyphicon-hourglass')\n field = 'prefers'\n _whimsy_forms_select(label: uimap[field][0], name: field, multiple: true,\n values: (mdata[field] ? mdata[field] : ''),\n options: MentorFormat::PREFERS_TYPES,\n icon: 'glyphicon-ok-sign', iconlabel: 'ok-sign',\n helptext: uimap[field][1]\n )\n field = 'languages'\n _whimsy_forms_select(label: uimap[field][0], name: field, multiple: true,\n values: (mdata[field] ? mdata[field] : ''),\n options: MentorFormat::LANGUAGES,\n icon: 'glyphicon-globe', iconlabel: 'globe',\n helptext: uimap[field][1]\n )\n\n _whimsy_forms_subhead(label: 'What You Could Help Mentees With')\n\n emit_mentor_input('experience', mdata, uimap, 'glyphicon-certificate')\n emit_mentor_input('available', mdata, uimap, 'glyphicon-plus-sign')\n emit_mentor_input('mentoring', mdata, uimap, 'glyphicon-minus-sign')\n\n _whimsy_forms_subhead(label: 'More About You Personally')\n\n emit_mentor_input('homepage', mdata, uimap, 'glyphicon-console')\n emit_mentor_input('pronouns', mdata, uimap, 'glyphicon-user')\n field = 'aboutme'\n _whimsy_forms_input(label: uimap[field][0], name: field, rows: 3,\n icon: 'glyphicon-info-sign', value: (mdata[field] ? mdata[field] : ''),\n helptext: uimap[field][1]\n )\n\n _div.form_group do\n _whimsy_forms_subhead(label: 'Temporarily Opt Out From Any NEW Mentees')\n _label.control_label.col_sm_3 'Not Accepting New Mentees', for: MentorFormat::NOTAVAILABLE\n _div.col_sm_9 do\n _div.input_group do\n _label MentorFormat::NOTAVAILABLE do\n args = { type: 'checkbox', id: MentorFormat::NOTAVAILABLE, name: MentorFormat::NOTAVAILABLE, value: MentorFormat::NOTAVAILABLE }\n args[:checked] = true if mdata[MentorFormat::NOTAVAILABLE]\n _input ' Stop accepting NEW Mentees', args\n end\n end\n _span.help_block do\n _ \"Select checkbox to no longer be listed in active mentor list (you can still work with existing Mentees).\"\n end\n end\n end\n\n _div.col_sm_offset_3.col_sm_9 do\n _span.text_info button_help\n _br\n _input.btn.btn_default type: 'submit', value: 'Update Your Mentor Data'\n end\n end\n end\nend", "title": "" }, { "docid": "c7e23d2d777525075867f800ec2147b8", "score": "0.6149759", "text": "def render_form(action)\n body_class << action\n @title = t(\"labels.expert.#{action}\")\n render :form\n end", "title": "" }, { "docid": "7489299961549b0014d0e193bf550f1c", "score": "0.6144795", "text": "def change_form; end", "title": "" }, { "docid": "7489299961549b0014d0e193bf550f1c", "score": "0.6144795", "text": "def change_form; end", "title": "" }, { "docid": "f1e12dffbf50b352f5c699e9c40ea4aa", "score": "0.6133093", "text": "def form(num, &block)\n @manager.form(num, &block)\n end", "title": "" }, { "docid": "1068b6308c22fac30f0c977dff56732e", "score": "0.61183107", "text": "def output(form, *args)\n if args.length == 0\n puts form\n else\n puts format(form, *args)\n end\n end", "title": "" }, { "docid": "a3cc9ece92af962ad0077493c20b53e6", "score": "0.6105598", "text": "def create_page(form=nil)\n begin\n if form.nil? then\n form = self.generic_input_data(@subject,@url,@attributes,@attribute_names) \n end \n self.get_communication.execute_command\n style = self.get_communication.get_style\n puts '<HTML>'\n puts '<HEAD>'\n puts style\n puts '</HEAD>'\n puts \"<BODY>\"\n puts self.get_top(@title)\n puts form\n puts self.show_data(@subject,@url,@attributes,@attribute_names)\n puts self.create_footer\n puts \"</BODY>\"\n puts \"</HTML>\"\n rescue\n puts 'Probleem bij weergeven pagina'\n exit\n end\n end", "title": "" }, { "docid": "474a2a83dea7566f986476d3ce5763ea", "score": "0.61030865", "text": "def form\n render :inline => <<-html\n <html>\n <body>\n <hr>\n <em>valid</em>:#{ Raptcha.valid?(params) ? :true : :false }\n <hr>\n <%= form_tag do %>\n #{ Raptcha.input }\n <hr>\n <input type=submit name=submit value=submit />\n <hr>\n <a href=\"#{ request.fullpath }\">new</a>\n <% end %>\n </body>\n </html>\n html\n end", "title": "" }, { "docid": "32837257fa56d80b647985cda4cbc38d", "score": "0.6095368", "text": "def build_main_form\n add_form_line_text('Hostname: ', :@hostname)\n add_form_line_text('Username: ', :@username)\n add_form_pass_text('Password: ', :@password)\n add_form_pass_text('Root Password: ', :@root_password)\n add_form_line_text('Port: ', :@port)\n\n add_form_line_toggle('Use Sudo', :@sudo)\n add_submit_button('Run Profile') { run_profile }\n end", "title": "" }, { "docid": "8e33a3db8688908e329571ceb4d4e842", "score": "0.6069581", "text": "def display\n \n end", "title": "" }, { "docid": "8e33a3db8688908e329571ceb4d4e842", "score": "0.6069581", "text": "def display\n \n end", "title": "" }, { "docid": "1fdff9e967ae9ee8a8bd5cb4d4442e01", "score": "0.60680515", "text": "def show_forms\n if allForms = document.forms\n count = allForms.length\n puts \"There are #{count} forms\"\n for i in 0..count-1 do\n wrapped = FormWrapper.new(allForms.item(i))\n puts \"Form name: #{wrapped.name}\"\n puts \" id: #{wrapped.id}\"\n puts \" method: #{wrapped.method}\"\n puts \" action: #{wrapped.action}\"\n end\n else\n puts \"No forms\"\n end\n end", "title": "" }, { "docid": "1fdff9e967ae9ee8a8bd5cb4d4442e01", "score": "0.60680515", "text": "def show_forms\n if allForms = document.forms\n count = allForms.length\n puts \"There are #{count} forms\"\n for i in 0..count-1 do\n wrapped = FormWrapper.new(allForms.item(i))\n puts \"Form name: #{wrapped.name}\"\n puts \" id: #{wrapped.id}\"\n puts \" method: #{wrapped.method}\"\n puts \" action: #{wrapped.action}\"\n end\n else\n puts \"No forms\"\n end\n end", "title": "" }, { "docid": "ae2db9f331a665d79c64a29d85358ebc", "score": "0.6059338", "text": "def new\n @form = Form.new\n @form.formName = \"personal\" # sets the default name\n # Do not let the users specify the User ID. it can show them others forms.\n @form.user_id = @user.id # specify the user id in the form yourself. \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @form }\n end\n end", "title": "" }, { "docid": "a899dbaf6b3fb0d74e7720a2a02832dd", "score": "0.6059264", "text": "def new #displays a form\n @user = User.new\n render :new\n end", "title": "" }, { "docid": "91ddff50d6e2049f2a4dd9ec5611e117", "score": "0.60541505", "text": "def form args = nil\n args = form_attributs_avec args\n (\n app.checkform_hidden_field(args[:id]) +\n yield\n ).in_form(args)\n rescue AlreadySubmitForm => e\n error e.message\n rescue Exception => e\n debug e\n return \"<div>Impossible de construire le formulaire du watcher ##{id} : #{e.message}</div>\"\n end", "title": "" }, { "docid": "3272385cb7d9845f21c457126d1fcf4d", "score": "0.60491425", "text": "def foundation_form_for(record, options = {}, &block)\n options[:builder] = FoundationFormBuilder\n form_for record, options, &block\n end", "title": "" }, { "docid": "d0314269640b70becf0244b19f5ead7a", "score": "0.6041729", "text": "def form(options={}, &block)\n @edit_form_options = @new_form_options = {:view=>@view}.merge(options)\n @edit_form_block = @new_form_block = block\n end", "title": "" }, { "docid": "82cb1bea96694e9e7fc5491e3dd9eb00", "score": "0.6039839", "text": "def details\n render :layout => 'pubform'\n end", "title": "" }, { "docid": "3cc4151b1b4d84968cf877448d900dfa", "score": "0.60364187", "text": "def form_block(title=\"\", options={}, &block)\n render \"/outpost/shared/form_block\",\n :title => title,\n :body => capture(&block),\n :options => options\n end", "title": "" }, { "docid": "d75289fa77e8c7423b816eec32acbb35", "score": "0.60310674", "text": "def onSubmit(request, response, form, errors)\r\n \r\n # Check the errors first.\r\n if errors.getErrorCount() > 0\r\n # Revert back to the entry screen\r\n form.viewName = \"botverse_editheadline\"\r\n return form\r\n end\r\n \r\n # tranform form to business object\r\n banner = BotListAdminMainBanner.new\r\n banner.headline = form.headline\r\n banner.section = \"botverse\"\r\n banner.bannerEnabled = true\r\n @dao.createBanner(banner)\r\n \r\n form.viewName = \"newadmin/admin_confirm\"\r\n return form\r\n end", "title": "" }, { "docid": "065a660bed9706bde77b1282687d0814", "score": "0.6022866", "text": "def form(name)\n if found_form = @view.form(name)\n presenter_for(found_form, type: FormPresenter)\n else\n nil\n end\n end", "title": "" }, { "docid": "bd5cd157ce6ef47e88f59322432259bc", "score": "0.6019154", "text": "def index\n\n # hide User form\n @show_form = false\n end", "title": "" }, { "docid": "45719ca7df9defa06132f30c24666da6", "score": "0.60087997", "text": "def uni_form_for(name, object = nil, options = {}, &proc)\n concat(content_tag(:p, '<em>*</em> indicates a required field', :class => 'form_required') + \"\\n\")\n options.merge!(:builder => UniFormBuilder)\n if options[:html]\n if options[:html][:class]\n options[:html][:class] = options[:html][:class] + ' uniForm'\n else\n options[:html][:class] = 'uniForm'\n end\n else\n options.merge! :html => {:class => 'uniForm'}\n end\n form_for(name, object, options, &proc)\n end", "title": "" }, { "docid": "453ba58d58f6e5ce106d8c387e4721c8", "score": "0.6008213", "text": "def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend", "title": "" }, { "docid": "a4cfa5317fbf98e64c3e2fed69265994", "score": "0.60066", "text": "def contact_form\n @contact=Contact.new\n render :layout => 'signin', :action => \"contact_form\"\n end", "title": "" }, { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", "score": "0.6006463", "text": "def show() end", "title": "" }, { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", "score": "0.6006463", "text": "def show() end", "title": "" }, { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", "score": "0.6006463", "text": "def show() end", "title": "" }, { "docid": "fb4d5466ebe6d46c53770b3c2dc6762a", "score": "0.6006463", "text": "def show() end", "title": "" }, { "docid": "881c05102d05fabb0666234c200154d9", "score": "0.6002192", "text": "def render_form(action)\n body_class << action\n @title = t(\"labels.partner.#{action}\")\n render :form\n end", "title": "" }, { "docid": "36c815a95ac9da86ffd939d284b5c31e", "score": "0.5997934", "text": "def complete_clubcard_form\n\t\t# binding.pry\n\t\tsleep(0.1)\n\t\tcomplete_name_details\n\t\tcomplete_address_and_phone_details\n\t\tcomplete_security_and_tcs\n\t\t# Submit form\t\t\n\t\tconfirmation_buttons[0].click\n\tend", "title": "" }, { "docid": "da14bb7cf5909052e5f34b202156660b", "score": "0.598969", "text": "def form(opts = nil, contents = browser_contents)\n if opts[:action] and ::Waw::ActionController::Action===opts[:action]\n action = opts[:action]\n opts = {:id => action.id}.merge(opts || {}).forget(:action)\n form = tag('form', opts, contents)\n form[:action] = action if form\n form\n else\n tag('form', opts, contents)\n end\n end", "title": "" }, { "docid": "368220a0644b6c65330025b8f7398538", "score": "0.59628135", "text": "def show\n @formulario = Formulario.find(params[:id])\n\n\t\t\n\t\t\n\t\[email protected] = RedCloth.new(@formulario.arguments).to_html \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @formulario }\n end\n end", "title": "" }, { "docid": "91c66c6b358659961470ea66d5387c78", "score": "0.5961989", "text": "def html_form(*)\n super {|field| [ field.text(:name, mandatory: true), field.submit ] }\n end", "title": "" }, { "docid": "0280350f152bcc3f511afc873f227958", "score": "0.5955553", "text": "def form_entete args = nil\n args = form_attributs_avec(args)\n String.opened_tag('form', args)\n end", "title": "" }, { "docid": "0d85596d4af5b7e5e2d39a26feba7e85", "score": "0.59481496", "text": "def show\n # how do we know if the form was created?\n if current_user.nil?\n return\n end\n authorize_admin\n end", "title": "" }, { "docid": "93f5625fe8a630fe813227253aa942cf", "score": "0.5946258", "text": "def render_form(model,object,method)\n object = model.new unless object\n render(model.name.downcase + 'form', binding)\n end", "title": "" }, { "docid": "40da551a14d4275df201e3fccbaf0022", "score": "0.5945547", "text": "def show\n @form = Form.find(params[:id])\n end", "title": "" }, { "docid": "b8701ade4d7e723ea555c8d19d4e3446", "score": "0.5943703", "text": "def fill_form\n\t\tfill_in('first_name', :with => 'Joe')\n\t\tfill_in('last_name', :with => 'Bloggs')\n\t\tfill_in('new_email', :with => '[email protected]')\n\t\tfill_in('new_password', :with => 'examplepass')\n\t\tfind(:xpath, \"//*[@id=\\\"agree_to_terms_label\\\"]\").click\n\t\tclick_button('Join Quidco free')\n\tend", "title": "" }, { "docid": "e1c47d46d67e42eb2122698e527e23c7", "score": "0.59246707", "text": "def openid_login_form(caption=\"login\")\n %{\n<form method=\"GET\" action=\"#{rs(:openid_begin)}\">\n Identity URL: <input type=\"text\" name=\"url\" />\n <input type=\"submit\" value=\"#{caption}\"/>\n</form>\n }\n end", "title": "" }, { "docid": "10816df3b3bebdaba877e4f48bb6240f", "score": "0.5922706", "text": "def show\n @form = Form.find(params[:id])\n @page = @form.page\n return unless page_administrator!\n @filled_forms = @form.visible_filled_forms(current_user)\n @payments = @form.payments_for_user(current_user)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @form }\n end\n end", "title": "" }, { "docid": "a7b173ef1ff7ee6c9f012816332fd10b", "score": "0.5921755", "text": "def auto_submitted_form(body)\n html = <<EOS\n<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n</head>\n<body onload=\"document.forms[0].submit();\" style=\"visibility:hidden;\">\n#{body}\n</body>\n</html>\nEOS\n html\n end", "title": "" }, { "docid": "357aa24015b662fef283f51acdc4a613", "score": "0.5919945", "text": "def new\n @order = Order.new\n @user = current_user\n render :layout => \"form\"\n end", "title": "" }, { "docid": "23d7b90d6bf91cbfd47aa6a3fd0d25dd", "score": "0.59198403", "text": "def square_form\n \n render(\"calculations/square_form_template.html.erb\")\n end", "title": "" }, { "docid": "dcf79b80e0be2fdfa1afe0b6f18a5513", "score": "0.5916996", "text": "def form(action, options = {}, &block)\n options = {:method => :post, :action => action}.merge(options)\n form_builder = options.delete(:builder) || configatron.mack.default_form_builder.camelcase.constantize.new(Thread.current[:view_template])\n if options[:id]\n options = {:class => options[:id]}.merge(options)\n end\n if options[:multipart]\n options = {:enctype => \"multipart/form-data\"}.merge(options)\n options.delete(:multipart)\n end\n meth = nil\n unless options[:method] == :get || options[:method] == :post\n meth = \"<input name=\\\"_method\\\" type=\\\"hidden\\\" value=\\\"#{options[:method]}\\\" />\\n\"\n options[:method] = :post\n end\n concat(\"<form#{build_options(options)}>\\n\", block.binding)\n concat(meth, block.binding) unless meth.blank?\n concat(form_authenticity_field, block.binding) unless configatron.mack.disable_forgery_detector\n yield form_builder\n concat(\"\\n</form>\", block.binding)\n # content_tag(:form, options, &block)\n end", "title": "" }, { "docid": "3b78deff81bb270f552e0f523ce6021a", "score": "0.5916642", "text": "def display\n end", "title": "" }, { "docid": "020da2a49b7d7f4d977d3dbd0c58cb84", "score": "0.59107834", "text": "def new\n @filled_form = @filled_forms.create\n redirect_to [:edit, :admin, @form, @filled_form] and return\n end", "title": "" }, { "docid": "050aeaea18a9d7ed4d70b1b29466f223", "score": "0.5909052", "text": "def form_with_proc p\n puts \"<form>\"\n p.call true\n puts \"</form>\"\nend", "title": "" }, { "docid": "dc63eb185ba500e64b09534f8df41efc", "score": "0.5908877", "text": "def new\n @planet = Planet.create\n \n#show a form\n end", "title": "" }, { "docid": "047ac22d8f3aed20a7882f5341b1ebf7", "score": "0.5889449", "text": "def new\n # :new is the route and corresponding view the user wants to get the form.\n render :new\n end", "title": "" }, { "docid": "9cb8c2e5bd7c4711bd23bcd98a46923d", "score": "0.58842003", "text": "def set_form(easy)\n end", "title": "" }, { "docid": "9fab9f3fa0abd21c4d9f67e2e463acea", "score": "0.5881483", "text": "def display(*)\n render\n end", "title": "" }, { "docid": "793b0cd50d331b3fe80f61f290a02b8e", "score": "0.58810955", "text": "def new\n # TODO prepare the form if necessary\n\n\n\n end", "title": "" }, { "docid": "c6f4a14725968a8bf0b6cff107f31af5", "score": "0.5878491", "text": "def form\n render :layout => :uploader\n end", "title": "" }, { "docid": "0dcabd48c64b54e83c5dde258a8e7e8a", "score": "0.5877899", "text": "def draw_login_form\n term.print_block(17, 32, <<END.freeze)\n type 'new' to join\n there is no guest ID\n┌─────────────────────────────────┐\n│ ID : │\n│ PW : │\n│ │\n└─────────────────────────────────┘\nEND\n end", "title": "" }, { "docid": "78aa20d382fa979e1d1485f226b48b6b", "score": "0.5877837", "text": "def display_form\n @fields.each do |name, validations|\n puts \"Veuillez renseigner votre #{name}\"\n @values[name] = gets.chomp\n end\n end", "title": "" }, { "docid": "d7d3fa782cc79200c3d8bb28850a2f60", "score": "0.58713394", "text": "def new\n # Form for new user\n end", "title": "" }, { "docid": "aea18f1533e900d89216e9c8d3c7ed46", "score": "0.58710444", "text": "def output(form_name, options = {})\n @options = options\n @post_to = @options[:post_to] || cgi.path_info\n @form_name = form_name\n @submit_name = 'submit_'+@form_name\n @form_errors = {}\n\n setup\n \n get_form_variables\n\n if posted? then\n @before_validate_variables = before_validate(request_parameters.dup)\n validate(@before_validate_variables)\n if @form_errors.empty? then\n return on_submit\n else\n form\n end\n else\n form\n end\n end", "title": "" }, { "docid": "6de95bbfe359b621a3a606d5763aaf06", "score": "0.58688706", "text": "def new\n @move = Move.new\n @move.build_start\n @move.build_end\n @move.build_installation\n\n \n @user = current_user\n render :layout => \"form\"\n end", "title": "" }, { "docid": "45efe10cb1810a2c76461d1ed2a7c25a", "score": "0.58592397", "text": "def emit_form(title, prev_data)\n _whimsy_panel(title, style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n _whimsy_forms_subhead(label: 'Example Form Section')\n field = 'text1'\n _whimsy_forms_input(label: 'Example Text Field', name: field, id: field,\n value: prev_data[field], helptext: 'Enter some text, keep it polite!'\n )\n field = 'listbox'\n _whimsy_forms_select(label: 'Select Some Values', name: field,\n multiple: true, values: prev_data[field],\n options: ['another value', 'yet another value'],\n icon: 'glyphicon-time', iconlabel: 'clock',\n helptext: 'Select as many values as ya like!'\n )\n field = 'text2'\n _whimsy_forms_input(label: 'A multi-line Text Field', name: field, id: field, rows: 10,\n value: prev_data[field], helptext: 'Pretty boring form example, huh?'\n )\n _whimsy_forms_submit(value: 'PUSH ME!')\n end\n end\nend", "title": "" }, { "docid": "3efc4651100e4043921b34e0ac858f7c", "score": "0.5859115", "text": "def new\n @contact_form = ContactForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "title": "" }, { "docid": "7db5e0633d5bd35763c20a0571706049", "score": "0.5858285", "text": "def standard_import_form\n render('standard_import/form')\n end", "title": "" }, { "docid": "e63f2928accbce937bac0e3503732fb5", "score": "0.5846192", "text": "def show\n\t \n end", "title": "" }, { "docid": "e63f2928accbce937bac0e3503732fb5", "score": "0.5846192", "text": "def show\n\t \n end", "title": "" }, { "docid": "f81e73cef57dc3e100433a4d4ba94b26", "score": "0.5841272", "text": "def edit\n # return an HTML form for editing a specific thing\n end", "title": "" }, { "docid": "251f0bcefdd55579e5c1a35667ed81aa", "score": "0.5838303", "text": "def show\n \n end", "title": "" }, { "docid": "c8d28aefaa5fc1a5160277a901127ce4", "score": "0.5828168", "text": "def standard_form name, object, &block\n url = { :action => object.new_record? ? \"index\" : \"show\" }\n html = { :class => \"standard\",\n :style => (@edit_on ? '' : \"display: none;\"),\n :multipart => true }\n concat form_tag(url, html) + \"<fieldset>\"\n concat '<input name=\"_method\" type=\"hidden\" value=\"put\" />' unless object.new_record?\n yield LabelingFormBuilder.new(name, object, self, {}, block)\n concat \"</fieldset>\"\n end", "title": "" }, { "docid": "b38191648ac7b3dd052c50a0b0c40e53", "score": "0.5827876", "text": "def square_form\n render(\"calculations/square_form.html.erb\")\n end", "title": "" }, { "docid": "b1244a5c81c75f7e97adcf73a15d1e1c", "score": "0.5827145", "text": "def show ; end", "title": "" }, { "docid": "cd601c43e3d0060b04e4b20ff4eb871e", "score": "0.5825375", "text": "def show\n \n end", "title": "" }, { "docid": "cd601c43e3d0060b04e4b20ff4eb871e", "score": "0.5825375", "text": "def show\n \n end", "title": "" }, { "docid": "b12fd5056bf604df6cddda03642575f4", "score": "0.58213913", "text": "def upload_form\r\n\r\n render :layout => 'minimal'\r\n end", "title": "" } ]
edee01767f3190b0670f185036d8b12c
'password' is a virtual attribute
[ { "docid": "9609fa13a05512bdfd51106d0d95feab", "score": "0.0", "text": "def password=(password)\n @password = password\n if password.present?\n generate_salt\n self.hashed_password = self.class.encrypt_password(password, salt)\n end\n end", "title": "" } ]
[ { "docid": "c062c7fa71e4b7d8b767e45a3377d938", "score": "0.8463913", "text": "def password; self[:password] end", "title": "" }, { "docid": "ef33d01ddcdc985225d590bda266f56c", "score": "0.81615293", "text": "def password\n @attributes[:password]\n end", "title": "" }, { "docid": "ef33d01ddcdc985225d590bda266f56c", "score": "0.81615293", "text": "def password\n @attributes[:password]\n end", "title": "" }, { "docid": "ef33d01ddcdc985225d590bda266f56c", "score": "0.81615293", "text": "def password\n @attributes[:password]\n end", "title": "" }, { "docid": "ef33d01ddcdc985225d590bda266f56c", "score": "0.81615293", "text": "def password\n @attributes[:password]\n end", "title": "" }, { "docid": "ef33d01ddcdc985225d590bda266f56c", "score": "0.81615293", "text": "def password\n @attributes[:password]\n end", "title": "" }, { "docid": "381d62591fe1a4b1953d1ff46f2c9e6c", "score": "0.8069165", "text": "def password\r\n @password\r\n end", "title": "" }, { "docid": "381d62591fe1a4b1953d1ff46f2c9e6c", "score": "0.8069165", "text": "def password\r\n @password\r\n end", "title": "" }, { "docid": "381d62591fe1a4b1953d1ff46f2c9e6c", "score": "0.8069165", "text": "def password\r\n @password\r\n end", "title": "" }, { "docid": "381d62591fe1a4b1953d1ff46f2c9e6c", "score": "0.8069165", "text": "def password\r\n @password\r\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "a3eeaeb20068eb782504ebc28db2fc05", "score": "0.80647916", "text": "def password\n @password\n end", "title": "" }, { "docid": "4a97b34f8a525653aedfc12931467fdc", "score": "0.8043672", "text": "def password\n @password\n end", "title": "" }, { "docid": "f1780881d3a4ab48b1cb878e5f5141b6", "score": "0.8042657", "text": "def password \n @password\n end", "title": "" }, { "docid": "8e64388a04c42e787c8bd176a8c7e22c", "score": "0.8036165", "text": "def password=(v); self[:password]=v end", "title": "" }, { "docid": "6b6807142571f3da12f96739db6cd733", "score": "0.80082875", "text": "def password\n @password\n end", "title": "" }, { "docid": "a0758b8a91712bcd270268f2c770bae2", "score": "0.80031204", "text": "def password\n super\n end", "title": "" }, { "docid": "a0758b8a91712bcd270268f2c770bae2", "score": "0.80031204", "text": "def password\n super\n end", "title": "" }, { "docid": "5af19eda1f6b82be7dfb08de7841a05a", "score": "0.7986219", "text": "def user_password\n @password\n end", "title": "" }, { "docid": "293cb30ab2074c8318515859c8e92e84", "score": "0.797837", "text": "def password\n @password\n end", "title": "" }, { "docid": "5a2f41a7d8051df31ec7f8995915181c", "score": "0.7964068", "text": "def password\n @password\n end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "970961c591c56a9cf91c3cdbd4106cdb", "score": "0.7942966", "text": "def password; end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.7925849", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.7925849", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.792573", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.792573", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79252744", "text": "def password\n @password\n end", "title": "" }, { "docid": "fe2398822539f583a883cd9b281ba7c1", "score": "0.79250103", "text": "def password\n @password\n end", "title": "" }, { "docid": "77ba0cafcdb7d56b4bad7d1df65363dd", "score": "0.79245543", "text": "def password\n\t\t@password\n\tend", "title": "" } ]
84f141c9032a7147440379910bbe94f1
metodos para replicacao nos dbfs
[ { "docid": "9ba58dde6ff83dc9c48c790092511dc3", "score": "0.57127327", "text": "def dbf_delete\n sql = \"select excluir_duplicata_receber_dbf(#{self.id}) as resultado\"\n x = Duplicata.replicando_no_banco(sql)\n end", "title": "" } ]
[ { "docid": "526f41cef05e3d0b35f9fdfd22b046f4", "score": "0.6536235", "text": "def clone_database\n \n end", "title": "" }, { "docid": "34f510cc81fb4e7236fae7c011d3f12f", "score": "0.6504157", "text": "def flushdb; end", "title": "" }, { "docid": "2010259cadefde50e17641e1dcda7511", "score": "0.63738185", "text": "def update_db\n # Implement in sub-classes.\n end", "title": "" }, { "docid": "f7d2bc5593e17138e730d5f63f3f6868", "score": "0.61836666", "text": "def db=(_db); end", "title": "" }, { "docid": "f7d2bc5593e17138e730d5f63f3f6868", "score": "0.61836666", "text": "def db=(_db); end", "title": "" }, { "docid": "946ee82a0e7c9d0c939a417fa5b5e032", "score": "0.61823714", "text": "def move_database\n \n end", "title": "" }, { "docid": "d3c6543b80eda7523dab0bc1ddf8eea4", "score": "0.61500174", "text": "def recreate_database(name, options = T.unsafe(nil)); end", "title": "" }, { "docid": "622d8c4c3afe35c3290973874d224aff", "score": "0.6028788", "text": "def original\n\n @db\n end", "title": "" }, { "docid": "622d8c4c3afe35c3290973874d224aff", "score": "0.6028788", "text": "def original\n\n @db\n end", "title": "" }, { "docid": "4658457b94028eb29b7ab5746fe6149d", "score": "0.59725386", "text": "def psql_db_derivative__sample_db_reassign *args\n [\n nil,\n psql_db__sample_superuser_example, # psql_db, having database access info\n nil,\n nil,\n psql_db__sample_example, # psql_db, having the user to assing the db\n nil,\n ]\n end", "title": "" }, { "docid": "5cda7e86e817217784485659fef44203", "score": "0.5971467", "text": "def move_faves\n #clear faves tables\n addToNewDb \"truncate faves\"\n with_db(DB[:source]) do |db|\n res = db.query(\"select o,oid,uid,created from tracker\")\n res.each do |r|\n insert_values = []\n atp_columns = []\n #add user id\n atp_columns << \"user_id\"\n insert_values << r[2]\n #add created\n atp_columns << \"created_on\"\n insert_values << r[3]\n #add obj_type\n atp_columns << \"obj_type\"\n insert_values << TRACKER_TYPES[r[0]]\n #add obj_id\n atp_columns << \"obj_id\"\n insert_values << r[1]\n #insert into faves table\n stmt = \"INSERT INTO faves (#{atp_columns.join(\", \")}) VALUES ('#{insert_values.join(\"','\")}')\"\n addToNewDb stmt\n end \n end\nend", "title": "" }, { "docid": "c0c573fa9f0d782680c3f91b71b3d056", "score": "0.5891464", "text": "def reset_db\n \n end", "title": "" }, { "docid": "c0c573fa9f0d782680c3f91b71b3d056", "score": "0.5891464", "text": "def reset_db\n \n end", "title": "" }, { "docid": "154837bb1a8f2c64cc816e98258d5cc2", "score": "0.5806855", "text": "def updatated\n end", "title": "" }, { "docid": "4f51f8f0856eac1da293ec1e2d36ef28", "score": "0.5791461", "text": "def cdb_save\n self.couchdb_rev = couchdb.store(\"pack\", @name, self)[\"rev\"]\n end", "title": "" }, { "docid": "262501351dbc18e9a832d2e2694ed57a", "score": "0.5769044", "text": "def autorestore; end", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.57614064", "text": "def commit; end", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.57614064", "text": "def commit; end", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.57614064", "text": "def commit; end", "title": "" }, { "docid": "78c8b451ec3ac26ef83da20bd1062caf", "score": "0.5740149", "text": "def save\n # iterate over each instance variable and insert create row to table\n\t\t\t\tobj = self.object #self.inst_strip_braces(self.object)\n\t\t\t\tnSrcID = self.get_inst_source_id\n db = ::Rho::RHO.get_src_db(get_inst_source_name)\n db_partition = Rho::RhoConfig.sources[get_inst_source_name]['partition'].to_s\n\t\t\t\ttableName = is_inst_schema_source() ? get_inst_schema_table_name() : 'object_values'\n\t\t\t\tisSchemaSrc = is_inst_schema_source()\n\n #call create if item does not exists\n is_new_item = false\n begin\n db.lock_db()\n if isSchemaSrc\n existing_attribs = db.execute_sql(\"SELECT object FROM \\\"#{tableName}\\\" WHERE object=? LIMIT 1 OFFSET 0\",obj)\n else\n existing_attribs = db.execute_sql(\"SELECT object FROM \\\"#{tableName}\\\" WHERE object=? AND source_id=? LIMIT 1 OFFSET 0\",obj,nSrcID)\n end\n\n unless existing_attribs && existing_attribs.length > 0\n is_new_item = true\n create();\n end\n\n db.unlock_db\n rescue Exception => e\n puts 'save Exception: ' + e.inspect\n db.unlock_db\n\n raise\n end\n\n\t\t\t\treturn if is_new_item\n\n begin\n db.start_transaction\n\n update_type = 'update'\n ignore_changed_values = true\n resUpdateType = nil\n if is_inst_sync_source()\n resUpdateType = db.select_from_table('changed_values', 'update_type', {\"object\"=>obj, \"source_id\"=>nSrcID, 'sent'=>0})\n update_type = resUpdateType[0]['update_type'] if resUpdateType && resUpdateType.length > 0\n ignore_changed_values = update_type=='create'\n\n #if is_inst_full_update\n # unless resUpdateType && resUpdateType.length > 0\n # db.insert_into_table('changed_values', {\"source_id\"=>nSrcID, \"object\"=>obj, \"attrib\"=>'object', \"value\"=>\"\", \"update_type\"=>update_type})\n # end\n # ignore_changed_values = update_type=='update'\n #end\n end\n\n self.vars.each do |key_a,value|\n key = key_a.to_s\n next if ::Rhom::RhomObject.method_name_reserved?(key)\n\n val = value.to_s #self.inst_strip_braces(value.to_s)\n\n # add rows excluding object, source_id and update_type\n fields = {\"source_id\"=>nSrcID,\n \"object\"=>obj,\n \"attrib\"=>key,\n \"value\"=>val,\n \"update_type\"=>update_type}\n fields = is_blob_attrib(db_partition, nSrcID, key) ? fields.merge!({\"attrib_type\" => \"blob.file\"}) : fields\n resValue = nil\n if isSchemaSrc\n resValue = db.select_from_table(tableName, key, {\"object\"=>obj})\n else\n resValue = db.select_from_table(tableName, 'value', {\"object\"=>obj, \"attrib\"=>key, \"source_id\"=>nSrcID})\n end\n\n if resValue && resValue.length > 0\n\n isModified = false\n\n #if is_inst_full_update\n # isModified = true\n #else\n oldValue = isSchemaSrc ? resValue[0][key] : resValue[0]['value']\n\n isModified = oldValue != val\n if isModified && val && oldValue.nil? && val.to_s().length == 0\n isModified = false\n end\n if isModified && oldValue && val.nil? && oldValue.to_s().length == 0\n isModified = false\n end\n #end\n\n if isModified\n\n unless ignore_changed_values\n resUpdateType = db.select_from_table('changed_values', 'update_type', {\"object\"=>obj, \"attrib\"=>key, \"source_id\"=>nSrcID, 'sent'=>0})\n if resUpdateType && resUpdateType.length > 0\n db.update_into_table('changed_values', {\"value\"=>val}, {\"object\"=>obj, \"attrib\"=>key, \"source_id\"=>nSrcID})\n else\n db.insert_into_table('changed_values', fields)\n end\n\n end\n\n if isSchemaSrc\n db.update_into_table(tableName, {key=>val}, {\"object\"=>obj})\n else\n db.update_into_table(tableName, {\"value\"=>val}, {\"object\"=>obj, \"attrib\"=>key, \"source_id\"=>nSrcID})\n end\n end\n else\n db.insert_into_table('changed_values', fields) unless ignore_changed_values\n fields.delete(\"update_type\")\n fields.delete(\"attrib_type\")\n\n if isSchemaSrc\n db.insert_into_table(tableName, {key=>val, \"object\"=>obj})\n else\n db.insert_into_table(tableName, fields)\n end\n end\n\n end\n db.commit\n\n rescue Exception => e\n puts 'save Exception: ' + e.inspect\n db.rollback\n\n raise\n end\n\n true\n end", "title": "" }, { "docid": "b0c43fba028b2f9099fabaa396f0ce83", "score": "0.5737796", "text": "def swap(uploaded_file)\n record.db.transaction do\n break if record.send(\"#{name}_data\") != record.reload.send(\"#{name}_data\")\n super\n end\n rescue ::Sequel::Error\n end", "title": "" }, { "docid": "1359ce0b93583fec4298e35eecd444dd", "score": "0.571084", "text": "def backup; end", "title": "" }, { "docid": "f806bec9914709c3fadb1007258fe201", "score": "0.56947476", "text": "def close\n rewind()\n if @mode == :write || @mode == :append\n Java::EdLangRuby::GridFS.save(self.class.connection, self)\n end\n super\n end", "title": "" }, { "docid": "a92cfdbbd0f968bc25945bba666a179a", "score": "0.56838363", "text": "def flush_db\n raise NotImplementedError\n end", "title": "" }, { "docid": "6afa04c3fa15cd7dbd6c71ade9a3dd6a", "score": "0.5666647", "text": "def db; end", "title": "" }, { "docid": "6afa04c3fa15cd7dbd6c71ade9a3dd6a", "score": "0.5666647", "text": "def db; end", "title": "" }, { "docid": "9152d00e7d8b9b9be4bd7ba9df21f15c", "score": "0.5651785", "text": "def read\n\t\t\tdb_delete\t\n\t\tend", "title": "" }, { "docid": "a5393d0f606bb11c28ce589d74997d19", "score": "0.5633308", "text": "def recycle\n end", "title": "" }, { "docid": "ba48460aa3821a9370786e9b7298c05b", "score": "0.56289214", "text": "def get_revisions(file_path, sequence_number, client, db)\n @log.debug \"Getting revisions of \" + file_path\n\n revisions = client.revisions file_path\n revisions.each do |rev|\n # File blobs (versions) from dropbox to the history store\n contents = client.get_file file_path, rev['rev']\n\n # Make sure the parent directories all exist\n file_name = File.basename rev['path']\n suff_path = HISTORY_DIR+rev['rev']+file_name\n target_path = '/tmp/'+suff_path\n parent_dir_path = File.dirname(target_path)\n FileUtils.mkdir_p(parent_dir_path)\n\n add_time = Time.parse(rev['modified']).to_i\n\n @log.debug \"Writing file\"\n # Write this out\n File.open(target_path, 'w+') { |f| f.write contents }\n final_path = '/.DocumentRevisions-V100/'+suff_path\n FileUtils.touch target_path, { :mtime => add_time }\n @log.debug target_path\n @log.debug final_path\n file_size = File.size target_path\n `sudo mv \"#{target_path}\" \"#{final_path}\"`\n # Change the creation/mod time on the file\n\n # Insertion of records into version database\n # generation_id, (auto incremented)\n # generation_storage_id, (row # of file)\n # generation_name, (rev id)\n # generation_client_id, (com.apple.DocumentVersions for versions, com.apple.ubiquity for icloud) \n # generation_path, (file path)\n # generation_options, (1, 7, 9 ?)\n # generation_status, (1 ?)\n # generation_add_time, (creation datetime)\n # generation_size (filesize)\n\n db.execute \"insert into generations values (NULL, ?, ?, ?, ?, 1, 1, ?, ?);\", [sequence_number, rev['rev']+file_name, 'com.apple.documentVersions', suff_path, add_time, file_size] \n end\nend", "title": "" }, { "docid": "a9f80590745898b7ae413688fb42402d", "score": "0.56146574", "text": "def update_sql; end", "title": "" }, { "docid": "9c25fc1e1c02bf94e59b252665b08817", "score": "0.5610026", "text": "def backup\n \n end", "title": "" }, { "docid": "e9c8434f4824303825a85b6bc5808247", "score": "0.55982006", "text": "def new_migrated_datafile id \n new_datafile_override MIGRATED_FILES, id\n end", "title": "" }, { "docid": "f53fa9c6eab0afbbe37b815667773ae4", "score": "0.5584096", "text": "def db_repair\n\n rows = DB.view('Post/all', :include_docs => true)['rows']\n\n res = \"\"\n logger = Logger.new(STDERR)\n rows.each do |row| \n post = row['doc']\n if not post.key? 'board' or post['board'].nil? then\n res += \"Post #{post['_id']} has no board\\n\"\n end\n DB.update_doc post['_id'] do |doc|\n doc['board'] = 'main'\n doc\n end\n end\n res\n\nend", "title": "" }, { "docid": "50e8d4e937899a0c207ca1cc718d63bf", "score": "0.558406", "text": "def ChangeDB(url,name)\n\n\n\tGetTBWorkBook(url,name)\n\n\n \nend", "title": "" }, { "docid": "d6f27c67321e3c314415600d2518b59e", "score": "0.5569323", "text": "def createDevfile(f, commit) #:doc:\n \n dev_file = nil\n blob = nil\n b_in_c = nil\n \n # If file already exists, raises an error but nothing needs to be deleted (except the commit is cancelled)\n begin \n dev_file = Devfile.find_by_name_and_path_and_device_id(f['name'], f['path'], @device.id)\n if dev_file != nil\n puts \"Devfile: #{f['path'] + f['name']} already exits, cannot create, use update instead\"\n #raise ArgumentError.new(\"Devfile already exits for this device, cannot use CREATE -method, use UPDATE instead to add new version\")\n \n # This is tested! Not sure how well it works..\n puts \"Devfile already found -> updates it!\"\n #updateDevfile(f, commit)\n end\n rescue Exception => e\n puts e.to_s\n puts e.backtrace[0].to_s\n raise e\n end\nputs \"name: #{f['name']}\"\nputs \"path: #{f['path']}\"\n \n # If something goes wrong, raises an error, and deletes the data created\n begin\n \n puts \"Creating new dev_file, blob etc..\"\n \n \n f_filedate = DateTime.strptime(f['filedate'], \"%T %F\")\n f_filedate = f_filedate.strftime('%F %T').to_s\n \n now = DateTime.now\n \n # get or create devfile\n dev_file = Devfile.find_or_create_by_name_and_path_and_device_id(f['name'], f['path'], @device.id)\n if dev_file.created_at >= now\n sql = \"update devfiles set filetype='#{f['filetype']}', path='#{f['path']}', privatefile=0 where id=#{dev_file.id}\" \n ActiveRecord::Base.connection.execute(sql)\n end\n \n # get or create blob\n blob = Blob.find_or_create_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id)\n if blob.created_at >= now # if just created\n # Version number\n version = 0\n predecessor_blob_id = \"NULL\"\n follower_blob_id = \"NULL\"\n if dev_file.blob_id != nil\n predecessor_blob_id = dev_file.blobs.find_by_id(dev_file.blob_id) ? dev_file.blobs.find_by_follower_id(dev_file.blob_id).id.to_s : \"NULL\"\n follower_blob_id = dev_file.blobs.find_by_predecessor_id(blob.id) ? dev_file.blobs.find_by_predecessor_id(blob.id).id.to_s : \"NULL\"\n version = dev_file.blobs.find_by_id(dev_file.blob_id).version + 1 \n end\n \nputs \"predecessor_id=#{predecessor_blob_id.to_s},\"\nputs \"follower_id=#{follower_blob_id.to_s},\"\nputs \"size=#{f['size'].to_s},\" \nputs \"filedate='#{f_filedate.to_s}',\" \nputs \"version=#{version.to_s},\" \nputs \"uploaded=#{f['uploaded'].to_s},\" \nputs \"latitude=#{@commit_location['latitude'].to_s}, \" \nputs \"longitude=#{@commit_location['longitude'].to_s} \" \n \n if f['uploaded']\n puts \"uploaded: true\"\n ul = '1'\n else\n puts \"uploaded: false\"\n ul = '0'\n end\n \n sql = \"update blobs set uploaded=#{ul}, predecessor_id=#{predecessor_blob_id.to_s}, follower_id=#{follower_blob_id.to_s}, size=#{f['size'].to_s}, filedate='#{f_filedate.to_s}', version=#{version.to_s}, latitude=#{@commit_location['latitude'].to_s}, longitude=#{@commit_location['longitude'].to_s} where id=#{blob.id};\"\nputs \"sql: \" + sql\n \n ActiveRecord::Base.connection.execute(sql)\n end\n \n # Creates association between blob and commit\n b_in_c = BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id)\n \n # update blob_id to devfile\n if dev_file.blob_id != blob.id\n sql = \"update devfiles set blob_id=#{blob.id} where id=#{dev_file.id};\"\n ActiveRecord::Base.connection.execute(sql)\n end\n \n \n #checkForObservers(dev_file)\n \n # If parent_blob_hash is given, tries to find the parent, and creates new branch from the parent\n if f['file_origin'] \n createBranch(f['file_origin'], blob)\n end\n\n rescue Exception => e\n puts \" -- Error in createDevfile: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n \n puts \"Deleting created data..\"\n \n # If dev_file was created now, deletes it\n dev_file.delete if dev_file\n puts \"Deleted created dev_file!\" if dev_file\n \n if blob \n if b_in_c\n BlobsInCommit.delete_all([\"commit_id = ? AND blob_id = ?\", b_in_c.commit_id.to_s, blob.blob_id.to_s])\n puts \"Deleted created blobs_in_commits!\" if b_in_c\n end\n blob.delete \n puts \"Deleted created blob!\"\n end\n \n # Throws forward the exception..\n raise e\n end\n puts \"File created\"\n return dev_file\n end", "title": "" }, { "docid": "37d84cf081ecc2ce4257405ad958b162", "score": "0.55522597", "text": "def command_save\n \t#save fdb & log\n\[email protected]\n\[email protected]\n end", "title": "" }, { "docid": "e005fbaa525e608f0c5120f8449a4807", "score": "0.5552142", "text": "def db; @db; end", "title": "" }, { "docid": "aced885727c7c4e4fae088fb096dbbd2", "score": "0.5550904", "text": "def reset_db(dbname)\n\tSTDOUT.print(\"[reset_db] creating a new database as : #{dbname}\\n\")\n\n\tFile.delete(dbname) if (File.exists?(dbname))\n\tdb = SQLite3::Database.new(dbname)\n\n\tDDL.each_pair{|key, value|\n\t\tdb.execute( value )\n\t}\n\n\tdb.execute(\"INSERT INTO appl_arcan VALUES('dbversion', 2);\");\n\n\tdb\n\nrescue => er\n\tSTDOUT.print(\"Couldn't complete request (reset_db), reason: #{er}\\n\")\nend", "title": "" }, { "docid": "b47b0c84c6e7e0bcb7aea71b5a75b0b2", "score": "0.55365235", "text": "def UpdateDBList\n @tv_dbs.get_model.clear\n @dbconn.dbs.getDBs.each do |db|\n @tv_dbs.get_model.append([db.getName])\n end\n end", "title": "" }, { "docid": "9807fdda1276dcd683054435e3c0c23d", "score": "0.551815", "text": "def save_on_gridfs\n FileUtils.cd(self.class.base_dir)\n f = Maleable::Base.gridfs.put(::File.open(self.name),\n :filename => self.name)\n collection.update({:_id => self.id}, {'$set' => {:gridfs_id => f}})\n Maleable::Base.debug(\"Save on gridfs the file : #{self.name}\")\n end", "title": "" }, { "docid": "1c63ca0dec2e23acd190bdaa7e009ef6", "score": "0.5513348", "text": "def proxy_database\n\tCouchRest.database! \"#{Sdsapp.couch_base}ps_#{id}\"\n end", "title": "" }, { "docid": "aaba45b623d2820f6b4fe393f6929766", "score": "0.5509507", "text": "def insert_member(fedora_object)\n if (fedora_object.instance_of?(Multiresimage))\n \n #add to the members ds\n members.insert_member(:member_id=>fedora_object.pid, :member_title=>fedora_object.titleSet_display, :member_type=>'image')\n \n #add to the rels-ext ds\n fedora_object.add_relationship(:is_member_of, \"info:fedora/#{self.pid}\")\n add_relationship(:has_image, \"info:fedora/#{fedora_object.pid}\")\n \n #self.multiresimages << fedora_object\n #self.add_relationship(:has_image, \"info:fedora/#{fedora_object.pid}\")\n \n elsif (fedora_object.instance_of?(DILCollection))\n \n #Can't add a collection to itself\n if (fedora_object.pid != self.pid)\n #Check to see if subcollection is already in collection\n subcollection_not_found = true\n self.subcollections.each do |subcollection|\n if (subcollection.pid == fedora_object.pid)\n subcollection_not_found = false\n break\n end\n end\n \n # Add subcollection if not found\n if subcollection_not_found\n #add to the members ds\n members.insert_member(:member_id=>fedora_object.pid, :member_title=>fedora_object.title, :member_type=>'collection')\n \n #add to the rels-ext ds\n fedora_object.add_relationship(:is_member_of, \"info:fedora/#{self.pid}\")\n add_relationship(:has_subcollection, \"info:fedora/#{fedora_object.pid}\")\n end\n end\n \n end\n \n logger.debug(\"before image save #{Time.new}\")\n fedora_object.save!\n logger.debug(\"after image save #{Time.new}\")\n self.save!\n logger.debug(\"after collection save #{Time.new}\")\n\n end", "title": "" }, { "docid": "38949b4e43b990d5a6ef2da74a5d685a", "score": "0.55087274", "text": "def update_database(bird)\n @collection.push(bird)\n File.open(\"@collection.yml\", \"w\") { |file| file.write(@collection.to_yaml) }\n end", "title": "" }, { "docid": "977af87756e1eefecb3ce1bb84f20364", "score": "0.5508235", "text": "def replicate_dbs(replication_specs, delete_source_dbs = false)\n replication_specs = [replication_specs].flatten\n \n Chef::Log.debug \"replicate_dbs: replication_specs = #{replication_specs.inspect}, delete_source_dbs = #{delete_source_dbs}\"\n \n replication_specs.each do |spec|\n source_db = spec[:source_db]\n target_db = spec[:target_db]\n\n # Delete and re-create the target db\n begin\n Chef::Log.debug(\"Deleting #{target_db}, if exists\")\n RestClient.delete(target_db)\n rescue RestClient::ResourceNotFound => e\n end\n\n # Sometimes Couch returns a '412 Precondition Failed' when creating a database,\n # via a PUT to its URL, as the DELETE from the previous step has not yet finished. \n # This condition disappears if you try again. So here we try up to 10 times if \n # PreconditionFailed occurs. See\n # http://tickets.opscode.com/browse/CHEF-1788 and\n # http://tickets.opscode.com/browse/CHEF-1764.\n #\n # According to https://issues.apache.org/jira/browse/COUCHDB-449, setting the \n # 'X-Couch-Full-Commit: true' header on the DELETE should work around this issue, \n # but it does not.\n db_created = nil\n max_tries = 10\n num_tries = 1\n while !db_created && num_tries <= max_tries\n begin\n Chef::Log.debug(\"Creating #{target_db}\")\n RestClient.put(target_db, nil)\n db_created = true\n rescue RestClient::PreconditionFailed => e\n if num_tries <= max_tries\n Chef::Log.debug(\"In creating #{target_db} try #{num_tries}/#{max_tries}, got #{e}; try again\")\n sleep 0.25\n else\n Chef::Log.error(\"In creating #{target_db}, tried #{max_tries} times: got #{e}; giving up\")\n end\n end\n num_tries += 1\n end\n\n Chef::Log.debug(\"Replicating #{source_db} to #{target_db} using bulk (batch) method\")\n bulk_get_paged(source_db, 100) do |paged_rows|\n #puts \"incoming paged_rows is #{paged_rows.inspect}\"\n paged_rows = paged_rows.map do |row|\n doc_in_row = row['doc']\n doc_in_row.delete '_rev'\n doc_in_row\n end\n\n RestClient.post(\"#{target_db}/_bulk_docs\", Chef::JSONCompat.to_json({\"docs\" => paged_rows}), :content_type => \"application/json\")\n end\n\n # Delete the source if asked to..\n if delete_source_dbs\n Chef::Log.debug(\"Deleting #{source_db}\")\n RestClient.delete(source_db)\n end\n end\nend", "title": "" }, { "docid": "d994c1fe045e0ba3eeb720d070855ef5", "score": "0.55030006", "text": "def reconcile_with_db fs_pcaps\n fs_pcaps = fs_pcaps.dup \n\n indexed = Set.new\n @db.each_in_view(\"pcaps/indexed\") do |row|\n indexed << row['key']\n end\n\n @db.each_in_view(\"pcaps/by_filename\") do |row|\n path = row['key']\n\n # Delete record if from database if pcap is not present on the \n # file system.\n if not fs_pcaps.include? path\n Logger.warn \"Indexer: removing database entry for missing pcap #{path}\"\n @db.delete_doc @db.get(row['id'])\n remove_index_for(path)\n\n next\n end\n\n # Requeue pcap if xtractr index is missing or is older than the pcap.\n if indexed.include? path\n pcap_index_dir = File.join(@index_dir, path)\n if not Xtractr.index_dir?(pcap_index_dir)\n Logger.warn \"Index is missing, requeueing #{path}\"\n requeue_pcap path\n elsif Xtractr.index_time(pcap_index_dir) < File.mtime(pcap_path(path)).to_f\n Logger.info \"Pcap is newer than index, requeueing #{path}\"\n requeue_pcap path\n end\n end\n\n fs_pcaps.delete path\n end\n\n # Remaining pcaps are unknown, add them to database\n fs_pcaps.each do |path|\n Logger.debug \"New pcap: #{path}\"\n add_pcap path\n end\n end", "title": "" }, { "docid": "52b2fcdacbdcbe55122efb63ade7585d", "score": "0.5500769", "text": "def update_db\n require \"../conf/db_schema.rb\"\n Knj::Db::Revision.new.init_db(\"debug\" => false, \"db\" => @db, \"schema\" => Openall_time_applet::DB_SCHEMA)\n end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "c3f11e80d4ed9199aaaf751efade4812", "score": "0.54952335", "text": "def update; end", "title": "" }, { "docid": "5427f5d335714727bc9add21dfc436a1", "score": "0.5494406", "text": "def persist\n end", "title": "" }, { "docid": "ea00f8589ec148adfc5d46b8280333c7", "score": "0.54773843", "text": "def feature_4809\n create_table(:logdb)\n\n @db.run \"DROP TABLE IF EXISTS old_zone_pool;\"\n @db.run \"ALTER TABLE zone_pool RENAME TO old_zone_pool;\"\n create_table(:zone_pool)\n\n @db.transaction do\n @db.fetch(\"SELECT * FROM old_zone_pool\") do |row|\n doc = nokogiri_doc(row[:body], 'old_zone_pool')\n\n server_pool = doc.create_element \"SERVER_POOL\"\n doc.root.add_child(server_pool)\n\n row[:body] = doc.root.to_s\n\n @db[:zone_pool].insert(row)\n end\n end\n\n @db.run \"DROP TABLE old_zone_pool;\"\n end", "title": "" }, { "docid": "de5561a09894b43878cfc025bb655672", "score": "0.54764396", "text": "def sync\n\n lib.abs_sync(@db)\n end", "title": "" }, { "docid": "685b51b369c4d69e3369bf488564b5e0", "score": "0.5471608", "text": "def sequel_reload\n record.db.transaction { yield record.dup.lock! }\n end", "title": "" }, { "docid": "685b51b369c4d69e3369bf488564b5e0", "score": "0.5471608", "text": "def sequel_reload\n record.db.transaction { yield record.dup.lock! }\n end", "title": "" }, { "docid": "cca3a316190e6d9ed33122312a6cc4f3", "score": "0.5466444", "text": "def insert_member(fedora_object)\n if (fedora_object.instance_of?(Multiresimage))\n\n #add to the members ds\n members.insert_member(:member_id=>fedora_object.pid, :member_title=>fedora_object.titleSet_display, :member_type=>'image')\n\n #add to the rels-ext ds\n fedora_object.add_relationship(:is_member_of, \"info:fedora/#{self.pid}\")\n add_relationship(:has_image, \"info:fedora/#{fedora_object.pid}\")\n\n elsif (fedora_object.instance_of?(DILCollection))\n\n #Can't add a collection to itself\n if (fedora_object.pid != self.pid)\n #Check to see if subcollection is already in collection\n subcollection_not_found = true\n self.subcollections.each do |subcollection|\n if (subcollection.pid == fedora_object.pid)\n subcollection_not_found = false\n break\n end\n end\n\n # Add subcollection if not found\n if subcollection_not_found\n #add to the members ds\n members.insert_member(:member_id=>fedora_object.pid, :member_title=>fedora_object.title, :member_type=>'collection')\n\n #add to the rels-ext ds\n fedora_object.add_relationship(:is_member_of, \"info:fedora/#{self.pid}\")\n add_relationship(:has_subcollection, \"info:fedora/#{fedora_object.pid}\")\n end\n end\n\n end\n\n logger.debug(\"before image save #{Time.new}\")\n fedora_object.save!\n logger.debug(\"after image save #{Time.new}\")\n self.save!\n logger.debug(\"after collection save #{Time.new}\")\n\n end", "title": "" }, { "docid": "39e177a818166e031c06b83350463a72", "score": "0.5466094", "text": "def upd\n self\n end", "title": "" }, { "docid": "ee905e5089124b3ad290e7ae54dd2062", "score": "0.54628664", "text": "def closeDb(db)\n db.flush\n db.close\nend", "title": "" }, { "docid": "5ca2caa1a207739e77f437de35e41cf1", "score": "0.54489166", "text": "def update ; end", "title": "" }, { "docid": "85e39d5044fbf439efbf7a8f1ed60e4a", "score": "0.5445789", "text": "def migrate_without_lock; end", "title": "" }, { "docid": "1741e017fbc087e5e19c83b52dcf6b18", "score": "0.5445109", "text": "def reload\n set_attributes(Ecore::db[table_name].first(:id => @id))\n setup_orig_document_attributes\n self\n end", "title": "" }, { "docid": "dde6fbc5f135ab6497d12a25b66500e8", "score": "0.5440528", "text": "def flushdb(options = T.unsafe(nil)); end", "title": "" }, { "docid": "7f58c636e1d23ce22f0f6aa76d30eb0f", "score": "0.543583", "text": "def restore; end", "title": "" }, { "docid": "7f58c636e1d23ce22f0f6aa76d30eb0f", "score": "0.543583", "text": "def restore; end", "title": "" }, { "docid": "cfd27ff57a5d3ff580ad62120a7294bd", "score": "0.54350454", "text": "def save_db(filename)\n saveDB(filename)\nend", "title": "" }, { "docid": "424b45f2de7086ba0638d309a3686d47", "score": "0.5428272", "text": "def schema_cache; end", "title": "" }, { "docid": "424b45f2de7086ba0638d309a3686d47", "score": "0.5428272", "text": "def schema_cache; end", "title": "" }, { "docid": "af5051cd92e3af22957f38ab34a58808", "score": "0.5416127", "text": "def databaseReloaded(qbc, input_folder, has_changed, db, timestamp, refresh, menu_exists)\n require 'QuickBaseClient'\n\n imported_csv = input_folder + \"Med_Schedule_Items.csv\"\n numberlines_file = input_folder + \"numberlines.txt\"\n \n #---------------------------------------------------------------------------\n # if user indicated to refresh the database\n # or if user indicated to check for changes and database has changed\n #---------------------------------------------------------------------------\n if (refresh == \"true\") or (refresh == \"check\" and has_changed) or (not menu_exists)\n then\n #-------------------------------------------------------------------------\n # import the csv file\n #-------------------------------------------------------------------------\n qbc.makeSVFile(imported_csv, \",\", db, nil, nil, \"List All for CSV Export\") \n numberlines_slash_n = %x(wc --lines #{imported_csv} | cut -f1 -d' ')\n numberlines = `echo -n #{numberlines_slash_n}`\n %x(echo #{numberlines} > #{numberlines_file}) \n puts \" 3) DATABASE HAS BEEN RELOADED AND CONTAINS #{numberlines} LINES\"\n \n #-----------------------------------------------------------------------\n # compute the html file that is the top level menu for Special Camp\n #-----------------------------------------------------------------------\n puts \" 4) FROM NEW DATABASE DETERMINE CAMPER NAMES\"\n if Rails.env.production?\n then\n show_debug = %x(python ./public/meds/src/GoSpecialCamp.py ./public/meds/in/ ./public/meds/outIndex/)\n puts \"MAIN MENU HAS BEEN REGENERATED\"\n #puts show_debug \n #check = %x(cp --verbose ./public/meds/outIndex/CamperList/index.html ./app/views/meds/index.html.erb)\n # THIS CP DOES NOT WORK SO USE ./public/meds/outIndex/CamperList/index.html INSTEAD\n #check = %x(cp --verbose ./public/meds/outIndex/CamperList/index.html ./public/top_menu.html)\n #puts check\n else\n if false\n then\n show_debug = %x(python ./public/meds/src/GoSpecialCamp.py ./public/meds/in/ ./public/meds/outIndex/)\n #puts show_debug\n else \n # THIS IS NOT CORRECT BECAUSE I HARD-CODED ./public/meds/outIndex/\n show_debug = %x(python ./public/meds/src/GoSpecialCamp.py ./public/meds/in/ ./public/meds/outIndex/)\n #puts show_debug \n check = %x(cat ./public/meds/outIndex/CamperList/index.html | sed '[email protected]@0.0.0.0:3000@' > /tmp/special-camp.html)\n check = %x(cat /tmp/special-camp.html > ./public/meds/outIndex/CamperList/index.html)\n puts \"MAIN MENU HAS BEEN REGENERATED\"\n \n end \n #check = %x(cat ./public/meds/outIndex/CamperList/index.html > ./app/views/meds/menu.html.erb)\n #check = %x(cat ./public/meds/outIndex/CamperList/index.html | sed '[email protected]@0.0.0.0:3000@' > ./app/views/meds/index.html.erb)\n #check = %x(cat ./public/meds/outIndex/CamperList/index.html | sed '[email protected]@0.0.0.0:3000@' > ./public/top_menu.html)\n #puts check\n end\n puts \" 5) FROM NEW DATABASE CREATE TOP LEVEL HTML\"\n return true, numberlines\n else\n numberlines_slash_n = %x(wc --lines #{imported_csv} | cut -f1 -d' ')\n numberlines = `echo -n #{numberlines_slash_n}`\n return false, numberlines\n end\nend", "title": "" }, { "docid": "69f9f17168f542ee63430a88ed89b2cf", "score": "0.5412742", "text": "def recreate\n delete\n create\n end", "title": "" }, { "docid": "a9333f3ae85aad519286066fd53182a6", "score": "0.5408256", "text": "def expunge; end", "title": "" }, { "docid": "bf7e575bce73e7eec8f49c6975cfeb80", "score": "0.54042196", "text": "def commit_db_transaction; end", "title": "" }, { "docid": "bf7e575bce73e7eec8f49c6975cfeb80", "score": "0.54042196", "text": "def commit_db_transaction; end", "title": "" }, { "docid": "b487c92022031c384ccdf6662d49d4ce", "score": "0.5401502", "text": "def db=(_arg0); end", "title": "" }, { "docid": "1c5d6b3c6902d310cc7a9a06d94436d1", "score": "0.5391675", "text": "def regenerate_index_and_spaces\n PEROBS.log.warn \"Re-generating FlatFileDB index and space files\"\n @index.open unless @index.is_open?\n @index.clear\n @space_list.open unless @space_list.is_open?\n @space_list.clear\n\n @progressmeter.start('Re-generating database index', @f.size) do |pm|\n each_blob_header do |header|\n if header.is_valid?\n if (duplicate_pos = @index.get(header.id))\n PEROBS.log.error \"FlatFile contains multiple blobs for ID \" +\n \"#{header.id}. First blob is at address #{duplicate_pos}. \" +\n \"Other blob found at address #{header.addr}.\"\n if header.length > 0\n @space_list.add_space(header.addr, header.length)\n end\n discard_damaged_blob(header)\n else\n @index.insert(header.id, header.addr)\n end\n else\n if header.length > 0\n @space_list.add_space(header.addr, header.length)\n end\n end\n\n pm.update(header.addr)\n end\n end\n\n sync\n end", "title": "" }, { "docid": "8fce94691f885665f62e23684c834176", "score": "0.53914595", "text": "def schema_cache=(_arg0); end", "title": "" }, { "docid": "8fce94691f885665f62e23684c834176", "score": "0.53914595", "text": "def schema_cache=(_arg0); end", "title": "" }, { "docid": "04cffbb467c53eeeed4ef516918dacbc", "score": "0.53897697", "text": "def persist_new_records\n columns = [:key, :original_uri]\n new_records = REDIS.hgetall(QUEUE_REDIS_KEY)\n return if new_records.blank?\n ShortenedUri.import(columns, new_records.to_a, validate: false)\n REDIS.hdel(QUEUE_REDIS_KEY, new_records.keys)\n end", "title": "" }, { "docid": "945c4dcbb21bec24b6890a08e3624ae0", "score": "0.53846866", "text": "def book_update(folder=nil)\n config = Rails.configuration.database_configuration\n source=config[Rails.env][\"libroparlato_upload\"]\n mount_point=config[Rails.env][\"digital_objects_mount_point\"]\n destfolder=File.join(mount_point,'libroparlato')\n if folder.nil?\n if self.d_objects_folder_id.nil?\n raise \"parametro 'folder' mancante per #{self.class} #{self.id} (self.d_objects_folder_id è NULL)\"\n end\n folder=self.d_objects_folder.name.sub(/^libroparlato\\//,'')\n end\n puts \"aggiornamento da source #{source} a destfolder #{destfolder}\"\n puts \"folder di provenienza: #{folder}\"\n\n target=File.dirname(folder)\n puts \"source: #{source}\"\n puts \"target: #{target}\"\n puts \"destfolder: #{destfolder}\"\n puts \"mount_point: #{mount_point}\"\n\n source_folder=File.join(source,folder)\n target_folder=File.join(destfolder,target)\n old_folder=File.join(target_folder,File.basename(folder))\n\n puts \"source_folder: #{source_folder}\"\n if !Dir.exists?(source_folder)\n puts \"non aggiornabile, non esiste #{source_folder}, proseguo con i files già presenti\"\n else\n if Dir.exists?(old_folder)\n puts \"cancello #{old_folder}\"\n FileUtils.remove_dir(old_folder)\n end\n puts \"Aggiorno da #{source_folder}\"\n puts \"a: #{target_folder}\"\n FileUtils.cp_r(source_folder,target_folder,{preserve:true})\n end\n scan_dir=old_folder.sub(mount_point,'')\n puts \"nuovo scan da effettuare in #{scan_dir}\"\n numfiles=DObject.fs_scan(scan_dir)\n puts \"Analizzati e importati nel db #{numfiles} files\"\n\n collocazione=TalkingBook.filename2colloc(folder)\n collocazione = \"CD #{collocazione}\" if (collocazione =~ /^CD /).nil?\n puts \"ora inserisco collocazione #{collocazione} in tabella import_libroparlato_colloc\"\n\n newdestfolder=ActiveRecord::Base.connection.quote_string(scan_dir)\n puts \"newdestfolder: #{newdestfolder}\"\n sql=%Q{DELETE FROM import_libroparlato_colloc WHERE collocation='#{collocazione}';\n INSERT INTO import_libroparlato_colloc(collocation,position,d_object_id)\n (SELECT '#{collocazione}',row_number() over(order by win_sortfilename(o.name)), o.id\n from d_objects_folders f join d_objects o on(o.d_objects_folder_id=f.id)\n where f.name ~ '^#{newdestfolder}');}\n puts sql\n\n ActiveRecord::Base.connection.execute(sql)\n self.attachments_insert\n\n cm=self.clavis_manifestation\n puts \"Aggiorno mp3tags per #{cm.title} (t_book: #{self.id} = manifestation_id #{cm.id})\"\n cm.write_mp3tags_libroparlato\n self.create_or_replace_audio_zip\n end", "title": "" }, { "docid": "05c7dede32dcb89afad3e478d64aa742", "score": "0.5382731", "text": "def backup\n end", "title": "" }, { "docid": "243a70a6178d3a45da3e7a5a58cd0ccd", "score": "0.5380779", "text": "def merge_db\n\traw_edited_db = YAML.load_file $config[:db]\n\t# Convert all keys except \"SERIAL\" to lowercase since DNS names are case insensitive\n\tedited_db = Hash[ raw_edited_db.map{|key, value| [key != \"SERIAL\" ? key.downcase : key, value]} ]\n\t\n\tnew_users = edited_db.keys - $db.keys\n\tnew_users.each do |name|\n\t\t$db[name] = edited_db[name]\n\tend\n\t\n\tdeleted_users = $db.keys - edited_db.keys\n\tdeleted_users.each do |name|\n\t\t$db.delete name\n\tend\n\t\n\tedited_db.each do |name, edited_data|\n\t\tnext if name == \"SERIAL\"\n\t\t$db[name][\"pass\"] = edited_data[\"pass\"]\n\tend\n\t\n\t$db[\"SERIAL\"] += 1\n\t\n\tlog \"SERVER: Updated DB from file, added #{new_users.join(\", \")}, deleted #{deleted_users.join(\", \")}, updated passwords and serial\"\nrescue Errno::ENOENT\n\tnil\nend", "title": "" }, { "docid": "2bfc2f0b400a8373bb808367df3aabdb", "score": "0.53807324", "text": "def update_trustdb\n raise NotImplementedError # TODO\n end", "title": "" }, { "docid": "a2ca3839aaa6aa105654065c6c9f82ad", "score": "0.5379515", "text": "def _create_versions\n @db.transaction do\n filename = \"../versions.#{@db.adapter_scheme}.sql\"\n @db << File.read(File.expand_path(filename, __FILE__))\n end\n end", "title": "" }, { "docid": "ca1bd35479c52a215615a99ca1e3d786", "score": "0.5374019", "text": "def bug_3705\n @db.run \"DROP TABLE IF EXISTS old_datastore_pool;\"\n @db.run \"ALTER TABLE datastore_pool RENAME TO old_datastore_pool;\"\n create_table(:datastore_pool)\n\n @db.transaction do\n @db.fetch(\"SELECT * FROM old_datastore_pool\") do |row|\n doc = nokogiri_doc(row[:body], 'old_datastore_pool')\n\n type = xpath(doc, 'TYPE').to_i\n tm_mad = xpath(doc, 'TM_MAD')\n\n if (type == 0) && ([\"ceph\", \"fs_lvm\"].include?(tm_mad))\n doc.root.xpath(\"TEMPLATE/DRIVER\").each do |d|\n d.remove\n end\n\n driver = doc.create_element \"DRIVER\", \"raw\"\n doc.root.at_xpath(\"TEMPLATE\").add_child(driver)\n\n row[:body] = doc.root.to_s\n end\n\n @db[:datastore_pool].insert(row)\n end\n end\n\n @db.run \"DROP TABLE old_datastore_pool;\"\n end", "title": "" }, { "docid": "05ed82301d8d0a92eaa39585a8e45fc9", "score": "0.5369418", "text": "def defrag\n\n #raise(NotImplementedError.new(\n # \"defrag (misc) only available when opening db with :type => :abstract\"\n #)) unless @db.respond_to?(:misc)\n\n @db.misc('defrag', [])\n end", "title": "" }, { "docid": "6c4379e04d84ac2ce5ad1e9850cb3ebd", "score": "0.536738", "text": "def gcommit; end", "title": "" } ]
9825f4ee02b812b493446cca6fce3cb6
POST /opportunities POST /opportunities.json
[ { "docid": "5c31e1e27439ab6c4f362b2fa7db0bfd", "score": "0.68809533", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.user = current_user\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "a35d27193a76ec1a4f32e8c1d209f161", "score": "0.7642337", "text": "def create\n @opportunity = findable_opportunities.new(opportunity_params)\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: I18n.t('controllers.opportunities.create.success') }\n format.json { render :show, status: :created, location: @opportunity }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e7782d6797c5a3901c255eb92cb96f0d", "score": "0.74929905", "text": "def create\n @opportunity = current_company.opportunities.new(params[:opportunity])\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render json: @opportunity, status: :created, location: @opportunity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "059fd96a28d2cc7a5f00eaa09b3770b4", "score": "0.7443164", "text": "def create\n @opportunity = @account.opportunities.build(opportunity_params)\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to account_path(@account), notice: \"Opportunity was successfully created.\" }\n format.json { render :show, status: :created, location: @opportunity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20c079e7b956a14745d7f59fa668efa8", "score": "0.71943426", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to opportunities_path, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbb6084bebbcb3c8122aa761976d31f8", "score": "0.71687937", "text": "def opportunities_post(body, opts = {})\n opportunities_post_with_http_info(body, opts)\n nil\n end", "title": "" }, { "docid": "2626fdaae50acad7e53a70900b9e8718", "score": "0.70649284", "text": "def create\n @opportunity = Opportunity.new(params[:opportunity])\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render json: @opportunity, status: :created, location: @opportunity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6b5ab03e379aa99f0a87f21e396b292", "score": "0.700376", "text": "def create\n # @opportunity = Opportunity.create!(opportunity_params)\n @opportunity = Opportunity.new(opportunity_params)\n \n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf46bf6e9689edfc495b0fadcb642b5a", "score": "0.69907695", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d92570b8fd893f22832593abf74e9dfb", "score": "0.6945517", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @opportunity }\n else\n format.html { render action: 'new' }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d92570b8fd893f22832593abf74e9dfb", "score": "0.6945517", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @opportunity }\n else\n format.html { render action: 'new' }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "12fcf456022b5c98158256812c7accb7", "score": "0.6871751", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n\n @opportunity.propane_royalties = 0.3\n @opportunity.propane_turnkey_royalties = 0.1\n @opportunity.propane_price = 2.75\n @opportunity.propane_cost = 2.45\n @opportunity.propane_turnkey_cost = 2.65\n @opportunity.conversion_margin = 0.5\n @opportunity.gasoline_price = 3.65\n @opportunity.annual_management_charge = 6000.0\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Your opportunity is ready for analysis.' }\n format.json { render action: 'show', status: :created, location: @opportunity }\n else\n format.html { render action: 'new' }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9a519a816b16fe144a04cc28beaa7d3", "score": "0.6850593", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.color = ['#F44336', '#E91E63', '#9C27B0', '#2196F3', '#4CAF50', '#CDDC39'].sample\n if params[:calendar]\n @opportunity.schedule = SchedulerTool.schedule_from_params(params[:calendar], @opportunity)\n end\n @opportunity.save\n @opportunity.add_organization({id: @current_organization.id, administrator: true})\n if !params[:organizations].nil? && !params[:organizations].empty?\n params[:organizations].each do |o|\n @opportunity.add_organization(o)\n end\n end\n\n\n\n render json: @opportunity\n end", "title": "" }, { "docid": "1d953c6492462eef96b391c0bdf4e0a1", "score": "0.67908126", "text": "def create\n @other_opportunity = OtherOpportunity.new(other_opportunity_params)\n\n respond_to do |format|\n if @other_opportunity.save\n format.html { redirect_to @other_opportunity, notice: 'Other opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @other_opportunity }\n else\n format.html { render :new }\n format.json { render json: @other_opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f2ecfe04491dcc5d71bef1c65c57f209", "score": "0.6716658", "text": "def create\n\t\t@opportunity = Opportunity.new(opportunity_params)\n\n\t\trespond_to do |format|\n\t\t\tif @opportunity.save\n\t\t\t\tformat.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @opportunity }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @opportunity.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "3962aa91d1118581ac8a3325dc4a578e", "score": "0.67155075", "text": "def create\n @api_v1_opportunity = Api::V1::Opportunity.new(api_v1_opportunity_params)\n @api_v1_opportunity.creator_id = current_user.id\n\n if @api_v1_opportunity.save\n render json: @api_v1_opportunity, meta: { errors: nil }\n else\n render json: @api_v1_opportunity, meta: { errors: @api_v1_opportunity.errors.full_messages }\n end\n end", "title": "" }, { "docid": "ccf66b4038dcb91e61448be97a46f027", "score": "0.66414726", "text": "def create\n p = opportunity_params\n p[:email] = user_email\n @opportunity = Opportunity.new(p)\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e70e7127bcca5adc42139135eb54160", "score": "0.66383535", "text": "def create\r\n p = opportunity_params\r\n p[:email] = user_email\r\n @opportunity = Opportunity.new(p)\r\n\r\n respond_to do |format|\r\n if @opportunity.save\r\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\r\n format.json { render :show, status: :created, location: @opportunity }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "4aae237b8f068cbe0f5646b2b6090102", "score": "0.65549654", "text": "def create\n @opportunity = Opportunity.new(params[:opportunity])\n\n respond_to do |format|\n if @opportunity.save\n flash[:notice] = 'Opportunity was successfully created.'\n format.html { redirect_to(@opportunity) }\n format.xml { render :xml => @opportunity, :status => :created, :location => @opportunity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4dced58756552fc8af5543eea2a8bc06", "score": "0.65193737", "text": "def create\n @opportunity_answer = OpportunityAnswer.new(opportunity_answer_params)\n @opportunity = Opportunity.find(@opportunity_answer.opportunity)\n @plano = current_user.plano\n @opportunities = @plano.opportunities\n\n respond_to do |format|\n if @opportunity_answer.save\n format.html { redirect_to @opportunity_answer, notice: 'Opportunity answer was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity_answer }\n format.js\n else\n format.html { render :new }\n format.json { render json: @opportunity_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a36d999e5a6c4e268f121b8e9cf645c5", "score": "0.6446683", "text": "def create\n\n @opportunity = Opportunity.new(params[:opportunity])\n\n respond_to do |format|\n if @opportunity.save\n flash[:notice] = 'Opportunity was successfully created.'\n format.html { redirect_to(@opportunity) }\n #format.xml { render :xml => @opportunity, :status => :created, :location => @opportunity }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de2de8495b5097b79969a305f1450af6", "score": "0.6441755", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n # @school_years = SchoolYear.all\n # @opportunity.school_years = SchoolYear.new\n\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8fa26c93c3e4275612d4498571d6f593", "score": "0.64200044", "text": "def create\n @strength_opportunity = StrengthOpportunity.new(strength_opportunity_params)\n\n respond_to do |format|\n if @strength_opportunity.save\n format.html { redirect_to @strength_opportunity, notice: 'Strength opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @strength_opportunity }\n else\n format.html { render :new }\n format.json { render json: @strength_opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad5a0a60e78e82e3eaac7b9bcd1402d2", "score": "0.63902533", "text": "def index\n @opportunities = Opportunity.all\n end", "title": "" }, { "docid": "ad5a0a60e78e82e3eaac7b9bcd1402d2", "score": "0.63902533", "text": "def index\n @opportunities = Opportunity.all\n end", "title": "" }, { "docid": "ad5a0a60e78e82e3eaac7b9bcd1402d2", "score": "0.63902533", "text": "def index\n @opportunities = Opportunity.all\n end", "title": "" }, { "docid": "1776f4fdb9459e8c1ff2f296b979f7c4", "score": "0.6390179", "text": "def index\n @opportunities = current_company.opportunities\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opportunities }\n end\n end", "title": "" }, { "docid": "8e242952d6e8e691d78720fc83f911ac", "score": "0.635405", "text": "def create\n @fellow_opportunity = FellowOpportunity.new(fellow_opportunity_params)\n\n respond_to do |format|\n if @fellow_opportunity.save\n format.html { redirect_to admin_fellow_opportunity_path(@fellow_opportunity), notice: 'Fellow opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @fellow_opportunity }\n else\n format.html { render :new }\n format.json { render json: @fellow_opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84be7847e7ede0cbb093b1060c2d015b", "score": "0.63496643", "text": "def new\n @opportunity = Opportunity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opportunity }\n end\n end", "title": "" }, { "docid": "84be7847e7ede0cbb093b1060c2d015b", "score": "0.63496643", "text": "def new\n @opportunity = Opportunity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opportunity }\n end\n end", "title": "" }, { "docid": "051843f6f771ad11845c34196a275509", "score": "0.6298057", "text": "def create\n @opportunity = Opportunity.new(params[:opportunity])\n\n respond_to do |format|\n if @opportunity.save\n update_recent_items @opportunity\n format.html { redirect_to(@opportunity, :notice => 'Opportunity was successfully created.') }\n format.xml { render :xml => @opportunity, :status => :created, :location => @opportunity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67b0666a3c33dc620386cc03336389b3", "score": "0.6284379", "text": "def index\n @opportunities = @account.opportunities\n end", "title": "" }, { "docid": "30f56b4fd2dd368de3d2f371f27b4c13", "score": "0.62783587", "text": "def opportunities_post_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BookingOpportunitiesApi.opportunities_post ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling BookingOpportunitiesApi.opportunities_post\"\n end\n # resource path\n local_var_path = '/opportunities'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(body) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BookingOpportunitiesApi#opportunities_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "2b333cd063ba138fb5bf21206002f65e", "score": "0.6250081", "text": "def create\n @opportunity = Opportunity.new(params[:opportunity])\n\t\n\tif @opportunity.save\n flash[:success] = \"Opportunity was successfully created.\"\n redirect_to crm_path\n else\n render :action => 'new'# Clear page\n end\n\n #respond_to do |format|\n # if @opportunity.save\n # format.html { redirect_to(@opportunity, :notice => 'Opportunity was successfully created.') }\n # format.xml { render :xml => @opportunity, :status => :created, :location => @opportunity }\n # else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n # end\n #end\n end", "title": "" }, { "docid": "e9d4a30cfacd368acbdffc5f2dcffc1e", "score": "0.6228736", "text": "def create\n @employment_opportunity = EmploymentOpportunity.new(params[:employment_opportunity])\n\n respond_to do |format|\n if @employment_opportunity.save\n flash[:notice] = 'Employment Opportunity was successfully created.'\n format.html { redirect_to admin_employment_opportunity_path(@employment_opportunity) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @employment_opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ebf2ed4e48a9ce095cacae8fd79a5224", "score": "0.62103575", "text": "def create\n\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.organisation = @organisation\n\n unless opportunity_params[:new_activity].blank?\n activity = Activity.find_by_title(opportunity_params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => opportunity_params[:new_activity])\n activity.save\n end\n @opportunity.activity = activity\n end\n\n unless opportunity_params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(opportunity_params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => opportunity_params[:new_sub_activity])\n sub_activity.save\n end\n @opportunity.sub_activity = sub_activity\n end\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = []\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c745660c22178b6df8ddf1115d2d3c2a", "score": "0.61749583", "text": "def opportunity_params\n params.require(:opportunity).permit(:opportunity, :class_code, :agency, :opp_type, :post_date, :response_date, :link, :comments, :like, :management_evaluation)\n end", "title": "" }, { "docid": "bf9a04e0a16fe45d6cd7060b3daa211f", "score": "0.61552525", "text": "def opportunity_params\n params.require(:opportunity).permit(:description, :title, :deadline, :time, :location, :organization_id, :user_id, :points, :community_id, :venue_id)\n end", "title": "" }, { "docid": "3fa32d2ec95b554a95534fe1eed866fc", "score": "0.6120381", "text": "def create\n @competence = Competence.new(competence_params)\n\n @competence.save!\n render json: {status: :ok}\n end", "title": "" }, { "docid": "72dcdb8f77c2e5aa2e49c1d40a65607c", "score": "0.6107469", "text": "def create\n @opportunity_instance = OpportunityInstance.new(opportunity_instance_params)\n\n respond_to do |format|\n if @opportunity_instance.save\n format.html { redirect_to @opportunity_instance, notice: 'Opportunity instance was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity_instance }\n else\n format.html { render :new }\n format.json { render json: @opportunity_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "635d0f6721225c69e498a38b95372f71", "score": "0.60884696", "text": "def opportunity_params\n params.require(:opportunity).permit(:name, :amount, :stage, :account_id)\n end", "title": "" }, { "docid": "30be185a2bd0e5becb99b6d0841ec316", "score": "0.6077606", "text": "def index\n\t\t@opportunities = Opportunity.all\n\tend", "title": "" }, { "docid": "071d5be201c1b8f1b1064ed4e2bb71cf", "score": "0.6072589", "text": "def opportunity_params\n params.require(:opportunity).permit(:name, :description, :opportunity_type, :contact, :phone, :email, :address_1, :address_2, :city, :state, :zip, :pays_for_fuel, :fueling_location, :propane_royalties, :propane_turnkey_royalties, :propane_price, :propane_cost, :propane_turnkey_cost, :gasoline_price, :annual_management_charge, :conversion_margin)\n end", "title": "" }, { "docid": "4554dfb9b1281b61ab888318237c082d", "score": "0.6070174", "text": "def opportunity_params\n params.require(:opportunity).permit(:organisation_id, :user_id, :opportunity_status, :title, :description, :pay, :paid_engagement, :experiences, :employment_terms, :school_year_ids => [])\n end", "title": "" }, { "docid": "4f6a99352cb879c59013ca5162d32fc6", "score": "0.6051423", "text": "def create\n data=params\n @pagenumber=33\n data[:opportunity][:employee_user_id]=data[:contact][:employee_user_id]=@emp_user_id\n data[:opportunity][:created_by_user_id]= data[:contact][:created_by_user_id]= @current_user.id\n data[:opportunity][:company_id] = data[:contact][:company_id][email protected]\n data[:opportunity][:current_user_name]= data[:contact][:current_user_name]=@current_user.full_name\n data[:opportunity][:employee_user_id], data[:contact][:via]=@emp_user_id,\"Opportunity\"\n data[:opportunity][:status_updated_on]=Time.zone.now\n data[:opportunity][:follow_up] = Time.zone.parse(\"#{data[:opportunity][:follow_up]}T#{data[:opportunity][:follow_up_time]}\").getutc unless data[:opportunity][:follow_up].blank?\n @employees = User.find_user_not_admin_not_client(@company.id)\n get_available_campaigns if current_company.company_sources.find_by_id(@opportunity.source).try(:alvalue) == 'Campaign'\n @opportunity = Opportunity.new(data[:opportunity])\n @contact_stage = get_contact_stages(@company.contact_stages.array_to_hash('lvalue'),['Prospect','Client'])\n @comment = Comment.new\n @opportunity = @company.opportunities.new(data[:opportunity])\n if @opportunity.save_with_contact(data)\n flash[:notice] = \"#{t(:text_opportunity)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_created)}\"\n redirect_if(data[:button_pressed].eql?(\"save\"), edit_opportunity_path(@opportunity))\n redirect_if(data[:button_pressed].eql?(\"save_exit\"), opportunities_path)\n else\n @contact= @opportunity.contact || Contact.new\n render 'new'\n end\n end", "title": "" }, { "docid": "624928f1c1027891a9965fe2f0afa997", "score": "0.60192907", "text": "def create\n @opportunity_time = OpportunityTime.new(opportunity_time_params)\n @opportunity = Opportunity.find(params[:opportunity_id])\n # @opportunity_time.opportunity_id = params[:opportunity_id]\n\n respond_to do |format|\n if @opportunity_time.save\n # format.html { redirect_to @opportunity_time, notice: 'Opportunity time was successfully created.' } //original\n format.html { redirect_to @opportunity, notice: 'Opportunity time was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity_time }\n else\n format.html { render :new }\n format.json { render json: @opportunity_time.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed7e567e9c3d6df5726a6379c25f9f3c", "score": "0.6012482", "text": "def create\n @opportunity_type = OpportunityType.new(opportunity_type_params)\n\n respond_to do |format|\n if @opportunity_type.save\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @opportunity_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "01bbaccc2ec09cddd627015b1356d7cb", "score": "0.6008087", "text": "def create\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.author = current_user\n\n if params[:publish]\n @opportunity.publish\n\t\tend\n #@opportunity.create_activity :new_opportunity_added_to_program\n\n respond_to do |format|\n if @opportunity.save\n format.js \n\t\t\t\tformat.html { render :nothing => true } \n format.json { head :ok }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end", "title": "" }, { "docid": "53ef055fdc38006dee87834cd5ba7a90", "score": "0.59955937", "text": "def update\n @opportunity = Opportunity.find(params[:id])\n\n @opportunity.update(opportunity_params)\n\n\n render json: @opportunity\n end", "title": "" }, { "docid": "827e29da8603a767f3d4358bf5c5f8ed", "score": "0.5979731", "text": "def add_opportunity_with_http_info(api_opportunity, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OpportunitiesApi#add_opportunity ...\"\n end\n \n # verify the required parameter 'api_opportunity' is set\n fail \"Missing the required parameter 'api_opportunity' when calling add_opportunity\" if api_opportunity.nil?\n \n # resource path\n path = \"/Opportunities\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(api_opportunity)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'APIOpportunity')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OpportunitiesApi#add_opportunity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "889d5bf542ffaefbe9cead556dae2133", "score": "0.59632903", "text": "def opportunity_params\r\n params.require(:opportunity).permit(:name, :address, :city, :state, :zip_code, :transportation, :description, :frequency, :email, :on_date, :start_time, :end_time, :issue_area)\r\n end", "title": "" }, { "docid": "79ee7d7a89f1414f794b8b3397bf6796", "score": "0.5945886", "text": "def add_opportunity(name,\n address,\n city,\n state,\n zip_code,\n transportation,\n description,\n frequency)\n Opportunity.create(name: name,\n address: address,\n city: city,\n state: state,\n zip_code: zip_code,\n transportation: transportation,\n description: description,\n frequency: frequency,\n email: email)\n end", "title": "" }, { "docid": "36382913d1282df7904b85824a0d1e0d", "score": "0.59347796", "text": "def create_opportunity \n @pagenumber = 201\n data = params \n @campaigns = @company.campaigns\n @campaign_member = @company.campaign_members.find(data[:id])\n @campaign = @campaign_member.campaign\n @opportunity = Opportunity.new(:assigned_to_employee_user_id => @campaign.owner_employee_user_id, :company_id => @company.id)\n @contact = @campaign_member.contact if @campaign_member.contact_id\n @campaign_contact = @campaign_member \n @employees = User.find_user_not_admin_not_client(@company.id)\n if request.post?\n @campaign = @company.campaigns.find(data[:opportunity][:campaign_id])\n data[:opportunity][:source] = CompanySource.find_by_lvalue_and_company_id('Campaign',current_company).id\n data[:opportunity][:company_id] = @company.id\n data[:opportunity][:employee_user_id] = @emp_usr_id\n data[:opportunity][:follow_up] = Time.zone.parse(\"#{data[:opportunity][:follow_up]}T#{data[:opportunity][:follow_up_time]}\").getutc \n contact_stage_id = @company.contact_stages.find_by_lvalue('Prospect').id\n Campaign.transaction do\n @opportunity = Opportunity.new(data[:opportunity])\n unless data[:contact][:id].present?\n @contact = Contact.scoped_by_company_id(@campaign.company_id).first(:conditions => ['first_name = ? AND middle_name = ? AND last_name = ? AND email = ?', data[:contact][:first_name], data[:contact][:middle_name], data[:contact][:last_name], data[:contact][:email]])\n if @contact.present?\n data[:contact][:id] [email protected]\n else \n @contact= Contact.new(data[:contact].merge!(:company_id=> @company.id, :employee_user_id =>data[:opportunity][:assigned_to_employee_user_id],:assigned_to_employee_user_id =>data[:opportunity][:assigned_to_employee_user_id],:created_by_user_id =>get_employee_user_id,:contact_stage_id=>contact_stage_id,:source=>data[:opportunity][:source]))\n if @contact.save\n data[:contact][:id] [email protected]\n end\n end \n end\n @opportunity.current_user_name=get_user_name\n if @opportunity.save_with_contact(data)\n flash[:notice] = \"#{t(:text_opportunity)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_created)}\"\n @campaign_member.update_attributes(:opportunity_id=>@opportunity.id, :campaign_member_status_type_id=>current_company.campaign_member_status_types.find_by_lvalue(\"Opportunity\").id,:updated_by_user_id=>@current_user.id)\n redirect_to \"#{remember_past_edit_path(@campaign)}#{params[:fragment]}\"\n else\n render :action=>'create_opportunity'\n end\n end\n end\n end", "title": "" }, { "docid": "6c27129bc68a7412dcd72e4f6dadf9dc", "score": "0.5926791", "text": "def opportunity_params\n params.require(:opportunity).permit(:opportunity, :class_code, :agency, :opp_type, :post_date, :response_date, :link, :comments, :like, :management_evaluation, :team_ids =>[], :opportunity_ids=>[])\n #params.require(:comment).permit(:comment, :name, :opportunity_id)\n end", "title": "" }, { "docid": "1830b0242d0dc024b4a30d221fcbfb19", "score": "0.59174186", "text": "def new\n\n @opportunity = Opportunity.new\n @comments = @opportunity.comments\n @commentable = @opportunity\n @owners = User.by_initials.keep_if {|user| user.capture? }\n @bders = User.by_initials.keep_if {|user| user.bd? }\n\n @task = @opportunity.tasks.build()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opportunity }\n format.js { render :layout => false, :content_type => 'text/html' }\n end\n end", "title": "" }, { "docid": "1526b7f9a222b1d09c7259f1190e2af5", "score": "0.5904064", "text": "def opportunity_params\n params.require(:opportunity).permit(:name, :address, :city, :state, :zip_code, :transportation, :description, :frequency, :email, :on_date, :start_time, :end_time, :issue_area, :tag)\n end", "title": "" }, { "docid": "4ac1486c56a069106abe33b73905d626", "score": "0.590051", "text": "def opportunity_params\n params.require(:opportunity).permit(:opportunity_type, :opportunity_title, :activity_description, :skills_description,\n :major_id, :other_majors, :question_for_student, :date_ini, :opportunity_duration,\n :availability, :cost_or_offer_option, :opportunity_cost, :receive_portfolio,\n :number_of_students, :user_id, :student_availability, :date_ini_type, :opportunity_duration_type,:schedule,:contract_type,:description,:salary,:city_id,benefit_ids: [],\n major_ids: []\n )\n end", "title": "" }, { "docid": "e9a3e37087f84ee671fb656e19d9fb03", "score": "0.5867064", "text": "def create\n @opportunity_stage = OpportunityStage.new(opportunity_stage_params)\n\n respond_to do |format|\n if @opportunity_stage.save\n format.html { redirect_to admin_opportunity_stage_path(@opportunity_stage), notice: 'Opportunity stage was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity_stage }\n else\n format.html { render :new }\n format.json { render json: @opportunity_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "455487156a71eea8ecea58e6dff64d27", "score": "0.58668435", "text": "def set_opportunity\n @opportunity = @account.opportunities.find(params[:id])\n end", "title": "" }, { "docid": "d0b1afcbdca6ddff2c40722d68fa66ff", "score": "0.5864817", "text": "def publish(opportunity)\n enqueue(\"opportunities.update\", attributes(opportunity))\n end", "title": "" }, { "docid": "fc2d5c0480a247cd271441b3a8a55ee7", "score": "0.58594656", "text": "def create\n @tournament = Tournament.new(tournament_params)\n\n if @tournament.save\n render json: @tournament, status: :created, location: @tournament\n else\n render json: @tournament.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b56e8f2c2adf4f0e50b558494b520aa4", "score": "0.58450204", "text": "def index\n @other_opportunities = OtherOpportunity.all\n end", "title": "" }, { "docid": "cd6a8d7569e6a313c3d146cb0a659cc4", "score": "0.5843509", "text": "def save\n redirect(Opports.r(:index)) if request.params['cancel'] == \"Cancel\"\n \n # Fetch the request data to use for a new or updated object\n data = request.subset(:name, :stage, :closes_on, :probability,\n :amount, :discount)\n extra = request.subset(:assigned_to, :account_to)\n data['assigned_id'] = User[:email=>extra['assigned_to']].id\n data['account_id'] = Account[:name=>extra['account_to']].id if extra['account_to']\n data['closes_on'] = Time.at(0) if data['closes_on'] == \"0\"\n data['amount'] = data['amount'].gsub!(\",\",\"\")\n id = request.params['id']\n data['user_id'] = user.id\n # If an ID is given it's assumed the user wants to edit an existing Opport,\n # otherwise a new one will be created.\n if !id.nil? and !id.empty?\n @opport = Opport[id]\n\n # Let's make sure the Opport is valid\n if @opport.nil?\n flash[:error] = 'The specified Opport is invalid...'\n redirect_referrer\n end\n success = 'The Opportunity has been updated'\n error = 'The Opportunity could not be updated'\n # Create a new object\n else\n @opport = Opport.new\n success = 'The Opportunity has been successfully created'\n error = 'The Opportunity could not be created'\n end\n\n # Time to actually insert/update the data\n begin\n # If the object doesn't exist, it will be automatically created\n @opport.update(data)\n\n flash[:success] = success\n\n # Redirect the user back to the correct page.\n redirect(Opports.r(:index)) \n rescue => e\n Ramaze::Log.error(e)\n\n # Store the submitted data and the errors. The errors are used by BlueForm\n flash[:form_data] = @opport\n flash[:form_errors] = @opport.errors\n flash[:error] = error\n\n redirect_referrer\n end\n end", "title": "" }, { "docid": "3d0c8a6c90bf7af1971c485a212e0a39", "score": "0.58351207", "text": "def destroy\n @opportunity = current_company.opportunities.find(params[:id])\n @opportunity.destroy\n\n respond_to do |format|\n format.html { redirect_to opportunities_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "50eb0a8d496dc52f54e96f44aecdb8b3", "score": "0.5822058", "text": "def opportunity_params\n params.require(:opportunity).permit(:name, :category, :description, :activity_id, :sub_activity_id, :venue_id, :room, :start_time, :end_time, :day_of_week, :new_activity, :new_sub_activity,:skill_ids => [])\n end", "title": "" }, { "docid": "bd5c59fa27bb16ac9cfd53bc3f08044c", "score": "0.5815677", "text": "def create\n respond_to do |format|\n if @competency.save\n format.html { redirect_to referential_competency_path(@referential, @competency), notice: 'Competency was successfully created.' }\n format.json { render :show, status: :created, location: @competency }\n else\n format.html { render :new }\n format.json { render json: @competency.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a08c40ced991f9981852b2671e1f2ad", "score": "0.5814278", "text": "def create\n @ponto = Ponto.new(ponto_params)\n #binding.pry\n\n respond_to do |format|\n if @ponto.save\n format.html { redirect_to @ponto, notice: 'Ponto was successfully created.' }\n format.json { render :show, status: :created, location: @ponto }\n else\n format.html { render :new }\n format.json { render json: @ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eaca97994b52022551cab3171c11ba4e", "score": "0.580063", "text": "def opportunity_params\n #params.require(:opportunity).permit!\n params.require(:opportunity).permit(:title, \n :body, \n :kind, \n :budget,\n :deadline,\n :account_id,\n :territory,\n :public_opportunity,\n :image,\n :max_submisions_pr_user\n )\n end", "title": "" }, { "docid": "4e54c8a3bb79088f787ee0acde96fa11", "score": "0.5793202", "text": "def create\n @job_oportunity = JobOportunity.new(job_oportunity_params)\n\n if @job_oportunity.save\n render :show, status: :created, location: @job_oportunity\n else\n render json: @job_oportunity.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b5cc9460ecc51f8045fa4777b01b6270", "score": "0.57876533", "text": "def create(options)\n API::request(:post, 'investors', options)\n end", "title": "" }, { "docid": "7ae19f1d19638a88bc85301ffe069e4e", "score": "0.57874423", "text": "def api_v1_opportunity_params\n params.require(:opportunity).permit(:code, :name, :client_id, :amount, :remark, :status_id, :creator_id)\n end", "title": "" }, { "docid": "dad6e9582714ebe31d066ed48d068ed7", "score": "0.57831943", "text": "def opportunity_params\n params.require(:opportunity).permit(:proposalduedate__c, :systemmodstamp, :accountid, :currencyisocode, :stagename, :isdeleted, :closedate, :opportunity_md_d__c, :leadsource, :_hc_lastop, :primary_key_buyer__c, :probability, :amount, :_hc_err, :type, :sfid, :natureofwork__c, :pursuitteam__c, :createddate, :name)\n end", "title": "" }, { "docid": "d00c39afcfaeacc9287bdd4a0b7c811c", "score": "0.5782298", "text": "def create\n @investment = Investment.new(params[:investment])\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render json: @investment, status: :created, location: @investment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63dc7663332383f54a31f8d5f4a6cc37", "score": "0.5772634", "text": "def create\n @company_params = company_params.to_json\n @reponse = HTTParty.post(\"https://rails-api-ipo.herokuapp.com/api/v1/companies.json\",\n :body => @company_params,\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", "title": "" }, { "docid": "0d991a82aac5e230bd021bc1392c5042", "score": "0.5766895", "text": "def index\n @opportunities = Opportunity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @opportunities }\n end\n end", "title": "" }, { "docid": "1e9a6235098dfdbbdb859e4e77cef976", "score": "0.57635784", "text": "def create(options)\n API::request(:post, 'investments', options)\n end", "title": "" }, { "docid": "8890f738786e6d1e01d455cef89c659f", "score": "0.57631373", "text": "def other_opportunity_params\n params.require(:other_opportunity).permit(:opportunity)\n end", "title": "" }, { "docid": "7fc31040a05fe0ef797150031db7baa7", "score": "0.5757167", "text": "def create\n @opportunity_status = OpportunityStatus.new(params[:opportunity_status])\n\n respond_to do |format|\n if @opportunity_status.save\n flash[:notice] = 'OpportunityStatus was successfully created.'\n format.html { redirect_to(@opportunity_status) }\n format.xml { render :xml => @opportunity_status, :status => :created, :location => @opportunity_status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @opportunity_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f935a32660531238b2b4686b8d4a538", "score": "0.5749185", "text": "def opportunity_params\n params.require(:opportunity).permit(:organisation_id, :person_id, :job_title, :job_description, :category)\n end", "title": "" }, { "docid": "2ec3caf7d88471b630a176551edf348e", "score": "0.57479006", "text": "def new\n @opportunity = Opportunity.new\n end", "title": "" }, { "docid": "917494a8fae6f66af2200849756fc905", "score": "0.5743753", "text": "def create\n @opportunity = Opportunity.new(params[:opportunity])\n params[:opportunity][:source_title] = params[:opportunity][:source_type].constantize.find(params[:opportunity][:source_id]).title\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to(@opportunity, :notice => 'Opportunity was successfully created.') }\n format.xml { render :xml => @opportunity, :status => :created, :location => @opportunity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab88ef5877dfec7a77e5a9d9d37e7b28", "score": "0.5737649", "text": "def create\n @tally = Tally.new(params[:tally])\n\n respond_to do |format|\n if @tally.save\n format.html { redirect_to [user, GoalReward], notice: \"Your goal has been recorded#{reward_earned? ? ' and you earned a reward!' : '.'}\" }\n format.json { render json: @tally, status: :created, location: [user, @tally] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tally.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "78a5a0e83259868a178831e4d1355b7e", "score": "0.5728149", "text": "def create\n @exspense = Exspense.new(exspense_params.merge(trip_id: params[:exspense][:trip_id], traveler_id: current_traveler.id))\n\n respond_to do |format|\n if @exspense.save\n format.html { redirect_to @exspense, notice: 'Exspense was successfully created.' }\n format.json { render :show, status: :created, location: @exspense }\n else\n format.html { render :new }\n format.json { render json: @exspense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0df5859bc9d4fe6876a9aa0c786cc507", "score": "0.5728137", "text": "def create\n @vorganization = Vorganization.find(session[:vorgid])\n @vopportunity = @vorganization.vopportunities.build(vopportunity_params)\n @vopportunity.vorganization_id = session[:vorgid]\n\n respond_to do |format|\n if @vopportunity.save\n format.html { redirect_to @vorganization, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @vopportunity }\n else\n format.html { render :new }\n format.json { render json: @vopportunity.errors, notice: 'Something went wrong, please try again.' }\n end\n end\n \n #Original scaffolding code below \n # @vopportunity = Vopportunity.new(vopportunity_params)\n\n #respond_to do |format|\n # if @vopportunity.save\n # format.html { redirect_to @vopportunity, notice: 'Vopportunity was successfully created.' }\n # format.json { render :show, status: :created, location: @vopportunity }\n #else\n # format.html { render :new }\n #format.json { render json: @vopportunity.errors, status: :unprocessable_entity }\n #end\n #end\n end", "title": "" }, { "docid": "08e1b0ef5e61d8d965c39754e4f73fcd", "score": "0.5724728", "text": "def create\n @individual_portfolio_investment = IndividualPortfolioInvestment.new(individual_portfolio_investment_params)\n\n respond_to do |format|\n if @individual_portfolio_investment.save\n format.html { redirect_to @individual_portfolio_investment, notice: 'Individual portfolio investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @individual_portfolio_investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @individual_portfolio_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b98cb10d5d0491d18aec1211f6d879bc", "score": "0.5719312", "text": "def new\n @opportunity = Opportunity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opportunity }\n end\n end", "title": "" }, { "docid": "1f13bb996601d9cacb8bc328ad80a6c6", "score": "0.5710229", "text": "def create\n @tourney = Tourney.new(tourney_params)\n\n respond_to do |format|\n if @tourney.save\n format.html { redirect_to @tourney, notice: 'Tourney was successfully created.' }\n format.json { render :show, status: :created, location: @tourney }\n else\n format.html { render :new }\n format.json { render json: @tourney.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c01ff158a4d9605cd83cc9fdb7063015", "score": "0.5707047", "text": "def create\n @investment = Investment.new(investment_params)\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render :show, status: :created, location: @investment }\n else\n format.html { render :new }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c88710ce365940f7b8d950cedfd127eb", "score": "0.57056016", "text": "def create\n @tourney = current_user.tourneys.new(tourney_params)\n\n respond_to do |format|\n if @tourney.save\n format.html { redirect_to tourneys_url, notice: t('tourneyCreated') }\n format.json { render action: 'show', status: :created, location: @tourney }\n else\n format.html { render action: 'new' }\n format.json { render json: @tourney.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3f31644b9ac493c64a0a0d4a87b8f8b", "score": "0.5701449", "text": "def show\n @opportunity = current_company.opportunities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opportunity }\n end\n end", "title": "" }, { "docid": "3f7a97307c32688dcb74e8c31cbc0c09", "score": "0.57003593", "text": "def create\n @entrance = Entrance.new(entrance_params)\n\n respond_to do |format|\n if @entrance.save\n format.html { redirect_to @entrance, notice: 'Entrance was successfully created.' }\n format.json { render json: @entrance, status: :created, location: @entrance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entrance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "817378054c959d82dfe8799def15a588", "score": "0.56998366", "text": "def create\n @investigator = Investigator.new(investigator_params)\n\n profession = Profession.find( params[ :investigator ][ :profession_id ] )\n @investigator.influence = profession.influence\n @investigator.observation = profession.observation\n @investigator.will= profession.will\n @investigator.combat= profession.combat\n @investigator.sanity= profession.sanity\n @investigator.stamina= profession.stamina\n @investigator.game_board = @current_game_board\n\n action = Ga::Waiting.new( location_id: profession.start_place_id )\n action.save!\n @investigator.game_action = action\n\n respond_to do |format|\n if @investigator.save\n format.html { redirect_to game_board_investigators_path( @current_game_board ), notice: 'Investigator was successfully created.' }\n format.json { render :show, status: :created, location: @investigator }\n else\n format.html { render new_game_board_investigator_path(@current_game_board ) }\n format.json { render json: @investigator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b5bf0e465556f9c4b87ad19ee43ad0d8", "score": "0.5697814", "text": "def create\n @incident_investigator = IncidentInvestigator.new(params[:incident_investigator])\n\n respond_to do |format|\n if @incident_investigator.save\n format.html { redirect_to @incident_investigator, notice: 'Incident investigator was successfully created.' }\n format.json { render json: @incident_investigator, status: :created, location: @incident_investigator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_investigator.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b0e50e5e4a009108b8d696fe75308ba5", "score": "0.5694319", "text": "def create\n @user = current_user\n @business = Business.find params[:investment][:business_id]\n @investment = @user.investments.build params[:investment]\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to user_investment_url(@user, @investment), notice: 'Investment was successfully created.' }\n format.json { render json: @investment, status: :created, location: @investment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1cfd20aec061bfef28813a08608f22f", "score": "0.56941473", "text": "def create\n itinerary = current_user.itineraries.create!(itinerary_params)\n itinerary_id = current_user.itineraries.last\n \n events = params[:events]\n events.each do |event|\n itinerary_id = current_user.itineraries.last[:id]\n EventsItinerary.create(itinerary_id: itinerary_id, event_id: event[\"id\"])\n end\n render json: itinerary, status: 201 # , location: [:api, itineraries]\n end", "title": "" }, { "docid": "8f9c385699aba6a66e692665f7ba55eb", "score": "0.5692166", "text": "def opportunity_params\n params.require(:opportunity).permit(:title, :description, :companyName, :time, :hours, :location, :category_id)\n end", "title": "" }, { "docid": "73542337933708d315e4a954d8e2fa9a", "score": "0.569143", "text": "def create\n\n @expense = Expense.new(expense_params)\n @expense.user = current_user\n @expense.mine = @current_mine\n @tunnels = @current_mine.tunnels\n tunnels = params[:expense][:tunnels]\n tunnels.each do |tunnel|\n if tunnel.present?\n tun = Tunnel.find(tunnel)\n if @tunnels.include? tun\n @expense.tunnels << tun\n end\n end\n end\n\n respond_to do |format|\n\n if @expense.save\n\n Pusher.trigger('private-mine_channel', 'on_new_expense', {\n message: current_user.first_name + \" \" + current_user.last_name + ' added a fund request'\n })\n\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json\n format.js\n else\n format.html { render :new }\n format.js { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa6e26e14e8aa91920ba3445df118219", "score": "0.5683044", "text": "def create\n @assign_rental_item = AssignRentalItem.new(assign_rental_item_params)\n @assign_rental_item.save\n render json: @assign_rental_item\n end", "title": "" }, { "docid": "e10d73e682e8aac208c8ed0634771c1b", "score": "0.567686", "text": "def create\n @ponto = Ponto.new(ponto_params)\n\n respond_to do |format|\n if @ponto.save\n format.html { redirect_to @ponto, notice: \"Ponto was successfully created.\" }\n format.json { render :show, status: :created, location: @ponto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd4813c893aae00c4b412a093c0d23c2", "score": "0.56760573", "text": "def create\n @sport_interests_newcomer = SportInterestsNewcomer.new(sport_interests_newcomer_params)\n\n respond_to do |format|\n if @sport_interests_newcomer.save\n format.html { redirect_to @sport_interests_newcomer, notice: 'Rel newcomer sport was successfully created.' }\n format.json { render :show, status: :created, location: @sport_interests_newcomer }\n else\n format.html { render :new }\n format.json { render json: @sport_interests_newcomer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6cd5982d210d5e25501d6665f4af589", "score": "0.56706554", "text": "def new\r\n @opportunity = Opportunity.new\r\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "accff5f61daa8757d022a9ccc4d76b20", "score": "0.0", "text": "def set_venda\n @venda = Venda.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60320485", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6013371", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.5922535", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59156126", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59156126", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589823", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5890472", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890387", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890387", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890387", "text": "def actions; end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58775556", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863097", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5810218", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.5741132", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57315207", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.571736", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.56991524", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56929684", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5667968", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5652351", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5649619", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.5637822", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.56270146", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.56099445", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5595848", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5595191", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5588875", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.55566645", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.55566645", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55095106", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55039996", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5466593", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.54660857", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.5449364", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54439306", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5439483", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54181427", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54119074", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54119074", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.53994405", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53937256", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53937256", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5391617", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5387492", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53801376", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5358599", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5349504", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53479505", "text": "def register_action(action); end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.5346732", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.53440404", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5342186", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53266597", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53030294", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5285732", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5284358", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52565944", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52556264", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.5250511", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.52470475", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5237919", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.5233395", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52305096", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.5224124", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5220735", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.52206117", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215545", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.52138394", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.5210016", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.5207759", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.52053165", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.52050936", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.52028465", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5201899", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51971984", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51971984", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5189866", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5180898", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.5179142", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173538", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173538", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173538", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.51641655", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5151931", "text": "def after_setup; end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.5142854", "text": "def code_action_provider; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.51420087", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5141399", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51397336", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.5134713", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.51165104", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5114052", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5111094", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110216", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110216", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110216", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107504", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.51062083", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.5099243", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964487", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.50935394", "text": "def config(action, *args); end", "title": "" } ]
ab0f538b8865d2eb9746cd47912cf34e
outerName is a class name or a namespace
[ { "docid": "aceb4b4844995ceced2be329187ab847", "score": "0.0", "text": "def makeStubDef(outerName)\n constStr = (@constMemfunc) ? \"const \" : \"\"\n\n numberOfArgs = ArgumentSplitter.new(@typedArgSetWithoutDefault).argSet.size\n # Treat void-only arg empty\n numberOfArgs = 0 if @argSet.empty?\n\n # clang -cc1 adds classname:: to a return type for a member function\n # if the type is in a class scope.\n prefix = outerName.empty? ? \"\" : \"#{outerName}::\"\n str = \"#{@returnType} #{prefix}#{@funcName}(#{@typedArgSetWithoutDefault}) #{constStr}{\\n\"\n returnType = @returnType.tr(\"&\",\"\").strip\n # Support to return a struct instance\n if @returnVoid\n str += \" return;\\n\"\n else\n found, canInitializeByZero = findType(returnType)\n canInit = @returnType.include?(\"*\") || canInitializeByZero\n init = canInit ? \" = 0\" : \"\"\n str += \" #{returnType} result#{init};\\n\"\n str += \" return result;\\n\"\n end\n str += \"}\\n\"\n str\n end", "title": "" } ]
[ { "docid": "405ad21760ed7761ae5d1bff67be2b15", "score": "0.7327439", "text": "def class_name\n enclosing_names.join('::')\n end", "title": "" }, { "docid": "0f25860f2a151e7a28d164a186249cab", "score": "0.70342004", "text": "def outer_class\r\n if inner_class?\r\n JavaVMName.new(@this_class[/^[^$]+/])\r\n else\r\n @this_class\r\n end\r\n end", "title": "" }, { "docid": "e718c8db77e244b285a1eef92bfd0c88", "score": "0.69076633", "text": "def nested_class_name\n @nested_obj.class.to_s.downcase\n end", "title": "" }, { "docid": "ffe45e4a12a8156af5aae92055797bca", "score": "0.6899475", "text": "def class_name(name)\n if @prefix then\n @prefix + name[:name].split(\".\").last\n else\n name[:name]\n end\nend", "title": "" }, { "docid": "e02e39a3ab94001edc2d9f3ff39f104a", "score": "0.6709754", "text": "def qualified_name\n if @owner.is_a?(ClassSpec)\n \"#{@owner.name}::#{name}\"\n else\n name\n end\n end", "title": "" }, { "docid": "d25da90ef209082d408e5495937cc2e7", "score": "0.6708849", "text": "def bare_class_name\n name.split('::').last\n end", "title": "" }, { "docid": "04339188882c2558181ae087530fee89", "score": "0.65945154", "text": "def ruby_name\n base_name = base_name_of self\n\n return \"ANON:IMPL_ME\" unless base_name\n\n # Likely incorrect if Foo::Object where this Object is not ::Object\n return base_name if base_name == \"Object\" || base_name == \"BasicObject\"\n\n names = [base_name]\n\n cls = self\n loop do\n cls = cls.field 'parent'\n base_name = base_name_of cls\n\n break if !base_name || base_name == 'Object'\n names << base_name\n end\n\n names.reverse.join '::'\n end", "title": "" }, { "docid": "c70413bb8b6819885b3a068a81ad2cf9", "score": "0.65779585", "text": "def getNameFromTopNamespace(name)\n pos = name.index(\"::\")\n ((!pos.nil? && pos == 0) ? \"\" : \"::\") + name\n end", "title": "" }, { "docid": "f0eaf97e9e4b1ad6b78989dce3115f50", "score": "0.6563817", "text": "def non_namespaced_name\n non_namespaced_classname.downcase\n end", "title": "" }, { "docid": "0c1802b7e64a55ea24188a45f4293b8e", "score": "0.65621656", "text": "def getNonTypedFullname(name)\n nameChain = [name]\n parent = @parent\n\n while(parent)\n addedName = parent.getNamespace\n nameChain << addedName unless addedName.empty?\n parent = parent.parent\n end\n\n fullname = nameChain.reverse.join(\"::\")\n addTopNamespace(fullname)\n end", "title": "" }, { "docid": "5a8f23af94012836b29bc0163df9e285", "score": "0.654559", "text": "def namespaced_name\n \"#{parent.name}-#{name}\"\n end", "title": "" }, { "docid": "87a198544fee095f5c466872f32cd9a5", "score": "0.6507389", "text": "def correct_namespace_for_nested_classes(namespace)\r\n names = namespace.split('::')\r\n return namespace if names.length == 1\r\n\r\n working_namespace = names.first\r\n corrected_namespace = names.first\r\n \r\n 1.upto(names.length - 1) do |i|\r\n working_namespace += '::' + names[i]\r\n\r\n element = eval(working_namespace)\r\n separator = (element.instance_of?(Class) and\r\n element.instance_variable_get('@is_nested')) ? '+' : '.'\r\n\r\n corrected_namespace += separator + names[i]\r\n end\r\n corrected_namespace\r\n end", "title": "" }, { "docid": "80869e49c418327d98539493057f5989", "score": "0.6506712", "text": "def in_namespace(name); end", "title": "" }, { "docid": "d742c3cad79fe154dfa2e09bbfbce3b3", "score": "0.6505", "text": "def get_complete_class_name(c, name = c.name)\n if !c.parent.name.nil? && c.parent.is_a?(RDoc::NormalModule)\n get_complete_class_name(c.parent, \"#{c.parent.name}::#{name}\")\n else\n name\n end\n end", "title": "" }, { "docid": "cff4eaf7dd33214470b45501470c6efa", "score": "0.6504822", "text": "def class_name(depth: 0)\n m = binding.of_caller(depth + 1).eval('self.class.name')\n if m.nil? || m.empty?\n '<anonymous class>'\n elsif m == 'Class'\n binding.of_caller(depth + 1).eval('self.name')\n else\n m\n end\n end", "title": "" }, { "docid": "f7a8c5c79e6a96d0267666a2e5a1fc97", "score": "0.6425453", "text": "def get_complete_class_name(class_or_module, name = class_or_module.name)\n if !class_or_module.parent.name.nil? && class_or_module.parent.is_a?(RDoc::NormalModule)\n get_complete_class_name(class_or_module.parent, \"#{class_or_module.parent.name}::#{name}\")\n else\n name\n end\n end", "title": "" }, { "docid": "be0ad7001bdb75e053db7755ea11e70d", "score": "0.6390226", "text": "def qualified_name\n parent ? \"#{parent.qualified_name}.#{name}\" : name\n end", "title": "" }, { "docid": "c6c8e3703a752f6f0e1c721954dc0824", "score": "0.6365093", "text": "def classname\n name.split(\"::\")[1..-1].join(\"::\")\n end", "title": "" }, { "docid": "a4c6c5476ff7741972330dc5ce95037a", "score": "0.63462234", "text": "def unqualified_name()\n @unqualified_name ||= self.name.split(\"::\").last\n end", "title": "" }, { "docid": "8a4a3b366fdea7a296b3bee3cd4f9bd4", "score": "0.6331842", "text": "def classname(name)\n [@lexer.namespace, name].join(\"::\").sub(/^::/, '')\n end", "title": "" }, { "docid": "89cf94c8cedd92a6a92fa7ab1c4d6596", "score": "0.6324381", "text": "def name\n self.class.to_s.gsub(/^.*::/, \"\")\n end", "title": "" }, { "docid": "74aecf2416cfa8f4a1e215762afe8488", "score": "0.63187426", "text": "def js_class_name_to_scope(name)\n name.split(\"::\")[0..-2].join(\".\")\n end", "title": "" }, { "docid": "74aecf2416cfa8f4a1e215762afe8488", "score": "0.63187426", "text": "def js_class_name_to_scope(name)\n name.split(\"::\")[0..-2].join(\".\")\n end", "title": "" }, { "docid": "ad60833535fe29154897fd3a9599424b", "score": "0.6315293", "text": "def nested_name(mod)\n mod.to_s.split(\"::\")[-1]\n end", "title": "" }, { "docid": "cfad4cb433a2e341cbc5fb3ce4853c71", "score": "0.6303287", "text": "def clean_name(namespaced = false)\n class_context = self.class.name\n class_context = class_context.split(\"::\")[-1] if namespaced\n\n class_context.slice!(class_context.index(\"C\")..-1)\n\n class_context\n end", "title": "" }, { "docid": "cf4419874353d8a59528e5217151288d", "score": "0.6291758", "text": "def class_name_sym\n self.class.to_s.top_level_class.downcase.to_sym\n end", "title": "" }, { "docid": "cf4419874353d8a59528e5217151288d", "score": "0.6291758", "text": "def class_name_sym\n self.class.to_s.top_level_class.downcase.to_sym\n end", "title": "" }, { "docid": "975d0956fda869625aff2a6bb96b93b2", "score": "0.628367", "text": "def namespace_parent_name\n namespace_component_names[-2]\n end", "title": "" }, { "docid": "ec0921a3412a66e92ceb406fffa2fbd8", "score": "0.625605", "text": "def local_class_name\n self.name.to_s.camelize\n end", "title": "" }, { "docid": "6924041883c6f9c438028db6608a30a4", "score": "0.6250805", "text": "def namespace\n @namestack.join(\"::\")\n end", "title": "" }, { "docid": "7450dc71e2bb5da8880e1399fb182850", "score": "0.6221689", "text": "def full_name\n @full_name ||= if RDoc::ClassModule === @parent then\n \"#{@parent.full_name}::#{@name}\"\n else\n @name\n end\n end", "title": "" }, { "docid": "0e84e3f5dcc6a3501773d29dbdfc78dd", "score": "0.62137246", "text": "def top_level_class\n self.classify.split(\"::\").last.snake_case\n end", "title": "" }, { "docid": "04dfe9c7aadacbcba48113450cc77452", "score": "0.6211203", "text": "def test_splitNameSpaceClassOnly\n orig = 'ZeeKlass'\n ns, base = DataMetaDom.splitNameSpace('ZeeKlass')\n assert_nil(ns, \"for the original #{orig}, namespace must be nil\")\n assert_equal(orig, base)\n end", "title": "" }, { "docid": "6d49ec0d1c8fe4dda0215842a3013f36", "score": "0.6200849", "text": "def nesting\n @nesting ||= (const_name =~ /(.*)::.*\\z/ ? $1 : '')\n end", "title": "" }, { "docid": "3935cb6327727fecb619314747115fd6", "score": "0.61996394", "text": "def full_name\n res = @in_class.full_name\n res << \"::\" unless res.empty?\n res << @name\n end", "title": "" }, { "docid": "8d9cfcb6fc14ff825ecc8effc51d67e7", "score": "0.61976373", "text": "def name\n @name ||= klass.name.gsub(/.*::/, '').underscore\n end", "title": "" }, { "docid": "10a8e724e0781c8eab8a0748dae624a2", "score": "0.6191613", "text": "def name_hack namespace\n if namespace\n result = namespace.to_s.gsub(\"#<Class:\", \"\").gsub(\">\", \"\")\n result =~ /^\\d/ ? \"\" : result\n else\n \"\"\n end\n end", "title": "" }, { "docid": "03cf86bf6ac634c8ec99b789a671357b", "score": "0.61632323", "text": "def initialize name, outer_scope\n super(outer_scope)\n @klass_name = outer_scope.klass_name\n @name = name\n end", "title": "" }, { "docid": "5d97aa416cfac9cb53e219e980f8db32", "score": "0.6163172", "text": "def namespace_class_name\n [self.namespace, self.class_name].compact.join '.'\n end", "title": "" }, { "docid": "df6ce5dfa330616857a1d04ae0c40a25", "score": "0.6152215", "text": "def class_name\n name.split('::').last\n end", "title": "" }, { "docid": "a8691d958c8dab884594fe3e3e13d6f2", "score": "0.61468005", "text": "def name\n child_namespace? ? [parent.name, @name].join('.') : @name\n end", "title": "" }, { "docid": "aa0c9130a8b2e293cfa931d3ffc56103", "score": "0.6141658", "text": "def namespace_path\n local_namespace, outer_namespace =\n self.name.reverse.split('::', 2).map(&:reverse)\n\n outer_constant = Kernel.const_get outer_namespace\n outer_path = outer_constant.namespace_path\n\n local_path = '/' + local_namespace.underscore\n\n outer_path + local_path\n end", "title": "" }, { "docid": "6a13b398d64e0ba54fde1131d16a78f5", "score": "0.6137329", "text": "def namespace\n name.to_s.camelize\n end", "title": "" }, { "docid": "c98ec0bcbb34643bbc97b50171b6c7ac", "score": "0.6126274", "text": "def full_class_name\n end", "title": "" }, { "docid": "504b7c28dab819bf43e2c66d725d38a3", "score": "0.60971045", "text": "def class_name\n self.class.name.split(\"::\").last.downcase\n end", "title": "" }, { "docid": "eaf263dc33d242cb184086d6814313f6", "score": "0.60880184", "text": "def class_name?; end", "title": "" }, { "docid": "7fc86c094d1a158f2b0ba6475db1fcab", "score": "0.6085484", "text": "def convert_class_name(name)\n name = name.to_s\n\n if self.is_test_class(name) then\n if $r then\n name = name.gsub(/Test($|::)/, '\\1') # FooTest::BlahTest => Foo::Blah\n else\n name = name.gsub(/(^|::)Test/, '\\1') # TestFoo::TestBlah => Foo::Blah\n end\n else\n if $r then\n name = name.gsub(/($|::)/, 'Test\\1') # Foo::Blah => FooTest::BlahTest\n else\n name = name.gsub(/(^|::)/, '\\1Test') # Foo::Blah => TestFoo::TestBlah\n end\n end\n\n return name\n end", "title": "" }, { "docid": "d3f5346c2adc21875dcc866e8b63b65f", "score": "0.6083336", "text": "def test_test_translated_name_on_a_module_with_namespace_returns_the_class_name\n source = <<~RUBY\n class ::TestClass\n module SomeModule\n class AnotherModule\n end\n end\n end\n RUBY\n eval(source)\n\n expected = \"TestClass::SomeModule::AnotherModule\"\n assert_equal expected, TestClass::SomeModule::AnotherModule.translated_name\n end", "title": "" }, { "docid": "95d00d57f27b3dd9abc24ac32d9ba966", "score": "0.60752386", "text": "def class_name\n klass = self.class\n while klass.name.nil?\n klass = klass.superclass\n end # while\n klass.name.split(\"::\").last\n end", "title": "" }, { "docid": "0892830d42e88f3542e29246f81cea1b", "score": "0.6069596", "text": "def parent\n parent_name ? ActiveSupport::Inflector.constantize(parent_name) : Object\n end", "title": "" }, { "docid": "0892830d42e88f3542e29246f81cea1b", "score": "0.60690415", "text": "def parent\n parent_name ? ActiveSupport::Inflector.constantize(parent_name) : Object\n end", "title": "" }, { "docid": "1c11b4c62907ef454fc614fdb3902cb3", "score": "0.6065501", "text": "def namespace_name\n name.split(\"::\")[0..-2].join(\"::\")\n end", "title": "" }, { "docid": "4edb55d2c994557bae0d68b716c41660", "score": "0.60573167", "text": "def namespace\n self.class.namespaace\n end", "title": "" }, { "docid": "6fe2c0e8504fb4e3dc93612cf60285da", "score": "0.60471594", "text": "def class_for_name(className);Kernel.const_get(className.capitalize);end", "title": "" }, { "docid": "7205916c535887dbb4eb84391ff63429", "score": "0.6046805", "text": "def qualified_name\n parents.push(self).map{|p| p.name}.join NS_SEP_STRING\n end", "title": "" }, { "docid": "62d3b6aef653c4d9fcbcb128d8fbd524", "score": "0.6045829", "text": "def elem_name\n elem_name = self.class.to_s.split('::').last.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase\n end", "title": "" }, { "docid": "4d7cc6a12519dfd4b96b08b078dd4d35", "score": "0.60436106", "text": "def name(m)\n case m.scope\n when :instance\n m.to_s.sub(%r{#([^#]*?)$},'.\\1')\n when :class\n m.to_s\n else\n abort(\"Scope: #{m.scope} unknown\")\n end\n end", "title": "" }, { "docid": "2fc70ac9748c46c72e381cd1ef325a71", "score": "0.60365057", "text": "def containing_class\n c = self.to_s.split(\"::\"); c.pop\n (c.any?)? Object.full_const_get(c.join(\"::\")) : nil\n end", "title": "" }, { "docid": "09ad5edd901493db4c78ddf1ebd43f90", "score": "0.6024825", "text": "def class_name\n\t\t\t\tself.class.name.split('::').last\n\t\t\tend", "title": "" }, { "docid": "7deb070d16e68283f3f678b68bd03ccf", "score": "0.60175955", "text": "def qualify_class_name(klass_name)\n unless @namespace.nil? || @namespace.blank? || klass_name.include?('::')\n namespaces = @namespace.split(/\\.|::/)\n namespaces << klass_name\n klass_name = namespaces.join '::'\n end\n klass_name.camelize\n end", "title": "" }, { "docid": "362bd7837b25782576ec1a149e00bfc1", "score": "0.6007403", "text": "def namespace_of(name)\n modules_of(name).join('::')\n end", "title": "" }, { "docid": "a1cba5efd659391efe0357ea749034bf", "score": "0.6006791", "text": "def qualified_name_for(mod, name)\n mod_name = to_constant_name mod\n mod_name == \"Object\" ? name.to_s : \"#{mod_name}::#{name}\"\n end", "title": "" }, { "docid": "93318b6f277a27a00670061551eca038", "score": "0.6000166", "text": "def classname\n @name\n end", "title": "" }, { "docid": "93318b6f277a27a00670061551eca038", "score": "0.6000166", "text": "def classname\n @name\n end", "title": "" }, { "docid": "8c6ae2aeb30a1e791dd88c655760478d", "score": "0.5998244", "text": "def class_name\n assert_exists\n return @o.invoke(\"className\")\n end", "title": "" }, { "docid": "30ec52a89bf133466eb0fdb540c3d082", "score": "0.5989714", "text": "def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end", "title": "" }, { "docid": "4351f97b4f37ab6cafe43ca767e9e8e6", "score": "0.59885633", "text": "def classname\n self.class.to_s.split(\"::\")[1].capitalize\n end", "title": "" }, { "docid": "4351f97b4f37ab6cafe43ca767e9e8e6", "score": "0.59885633", "text": "def classname\n self.class.to_s.split(\"::\")[1].capitalize\n end", "title": "" }, { "docid": "f80792723fdbcb1895cf0423ad20fc50", "score": "0.5986", "text": "def class_name\n self.class.name.split(\"::\").last\n end", "title": "" }, { "docid": "d84bad1283763f582fb5392dc4f37cb0", "score": "0.59853584", "text": "def namespace\n self.class.namespace || self.class.name.split('::').join('_').downcase\n end", "title": "" }, { "docid": "2c3c24f8d2d258095ab29066ed25935a", "score": "0.5983422", "text": "def namespaced_class_name(name)\n class_name = \"#{name.split(\"/\").map(&:camelize).join(\"::\")}Controller\"\n if @namespaces.empty?\n class_name\n else\n @namespaces.map { |namespace| \"#{namespace.camelize}::\" }.join(\"\") + class_name\n end\n end", "title": "" }, { "docid": "3cfb4748144652950a6bd2dbd6c7de08", "score": "0.5973371", "text": "def class_name\n self.to_s.split(\"::\").last\n end", "title": "" }, { "docid": "b4642d00dc39f94df0a1289324959140", "score": "0.5964368", "text": "def name\n Module.nesting[0].to_s\n end", "title": "" }, { "docid": "bc1bb1e6ac4165ddbfea678207f97b9e", "score": "0.596319", "text": "def qualified_name\n parentname = @parent.nil? ? \"\" : @parent.to_s\n return \"\"==parentname ? @name : parentname + '/' + @name \n end", "title": "" }, { "docid": "30a2101faa41739749666be11266319a", "score": "0.59405583", "text": "def class_name\n name.camelize\n end", "title": "" }, { "docid": "30a2101faa41739749666be11266319a", "score": "0.59405583", "text": "def class_name\n name.camelize\n end", "title": "" }, { "docid": "e5aa8c79de4b710602ec63abfb666270", "score": "0.59261405", "text": "def class_name_from_object_name(object_name)\n object_name.to_s.split('_').map(&:capitalize).join\n end", "title": "" }, { "docid": "f527de1fe7c299367c4602d09ad18497", "score": "0.5925715", "text": "def namespace\n name[/^.*::/] || '' # Hooray for greedy matching\n end", "title": "" }, { "docid": "f527de1fe7c299367c4602d09ad18497", "score": "0.5925715", "text": "def namespace\n name[/^.*::/] || '' # Hooray for greedy matching\n end", "title": "" }, { "docid": "00889a92c1b2e4092561a830b5b0a296", "score": "0.59235823", "text": "def classname\n self.class.name.split(\"::\")[-1]\n end", "title": "" }, { "docid": "4a17fe1ac9b0a048c6d1dbc2e073321e", "score": "0.59206957", "text": "def define_named_parent(parent_class_name)\n #~ p \"parent_class_name : #{parent_class_name}\"\n define_method parent_class_name.underscore do\n @parent\n end\n end", "title": "" }, { "docid": "2e7e71ee1a0f2064364dc1eab2e436ef", "score": "0.59091896", "text": "def get_namespace\n namespace = @template.controller.class.parent_name.split('::') rescue []\n namespace = namespace.join('/') \n end", "title": "" }, { "docid": "95f41eef1107874d7a353e809ab00b54", "score": "0.59057885", "text": "def derive_class_context\n context = clean_name(is_namespaced?)\n end", "title": "" }, { "docid": "c99928d6ca900e5c937f88692010825f", "score": "0.59020716", "text": "def class_name\n self.class.to_s.split('::').last\n end", "title": "" }, { "docid": "15cb9addad195c88347dc1cd8b1ecde7", "score": "0.59003395", "text": "def class_for name\n sub_classes = name.split(/-/)\n\n # Start with object a the top of the hierarchy,\n # and traverse until we reach the correct class.\n parent = Object\n _class = sub_classes.each do |child|\n parent = parent.const_get(child)\n end\n\n _class\n end", "title": "" }, { "docid": "059572cbfe0513aa4381469f891a7315", "score": "0.5900179", "text": "def name\n self.class.name.split('::').last\n end", "title": "" }, { "docid": "f2db1268fe00ce50f677c8f6b644d240", "score": "0.590004", "text": "def class_name(name = nil)\n self.class_name = name if name\n self.class_name = (prefix + \".\" + to_s) unless @class_name\n @class_name \n end", "title": "" }, { "docid": "2b6b55c03e382f573951cbee102e87ce", "score": "0.5895066", "text": "def classname name_or_class\n name = if name_or_class.is_a? Class\n name_or_class.to_s.split('::').last\n elsif name_or_class.is_a? ActiveOrient::Model\n name_or_class.to_s.split('::').last\n else\n name_or_class.to_s.capitalize_first_letter\n end\n return name.to_s.capitalize_first_letter\n end", "title": "" }, { "docid": "9f953154334287a1204e342b7417e864", "score": "0.5888013", "text": "def class_name\n @class_name ||= self.name.split(/::/).last.downcase\n end", "title": "" }, { "docid": "06492e31274900b6f8c1f09cab5b5bad", "score": "0.58815783", "text": "def class_name\n self.class.to_s.split(\"::\").last.downcase\n end", "title": "" }, { "docid": "7fe518f35c8bed7494bec71e0e160881", "score": "0.5880881", "text": "def variable_name_to_class_name(name)\n name.to_s.\n gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.\n gsub(/(?:^|_)(.)/) { $1.upcase }\n end", "title": "" }, { "docid": "facabd3bb8fa280cee5833c9a7bdd767", "score": "0.58561844", "text": "def class_name\n self.class.to_s.split('::').last.downcase\n end", "title": "" }, { "docid": "510cc3c94293a77ba193fbf63762efaf", "score": "0.5855803", "text": "def namespace\n @namespace ||= Rails.application.class.parent_name.constantize\n end", "title": "" }, { "docid": "28443d7446e723ca05cb94a5c3ebb324", "score": "0.58502", "text": "def class_name; end", "title": "" }, { "docid": "28443d7446e723ca05cb94a5c3ebb324", "score": "0.58502", "text": "def class_name; end", "title": "" }, { "docid": "28443d7446e723ca05cb94a5c3ebb324", "score": "0.58502", "text": "def class_name; end", "title": "" }, { "docid": "28443d7446e723ca05cb94a5c3ebb324", "score": "0.58502", "text": "def class_name; end", "title": "" }, { "docid": "28443d7446e723ca05cb94a5c3ebb324", "score": "0.58502", "text": "def class_name; end", "title": "" }, { "docid": "c60a055ecb46507863a72c4482877a7e", "score": "0.58490443", "text": "def addTopNamespace(name)\n pos = name.index(\"::\")\n ((pos.nil? || pos == 0) ? \"\" : \"::\") + name\n end", "title": "" }, { "docid": "2425153f7c9372f0a9b9897f2541e669", "score": "0.58477664", "text": "def class_name\n self.class == Class ? self.name : self.class.name\n end", "title": "" }, { "docid": "16fe1027527005707955bae74eb16ca1", "score": "0.5842134", "text": "def full_name\n namespace.global? ? name : \"#{namespace.name}/#{name}\"\n end", "title": "" } ]
40faaa447a7413882a99f4d820dd1b6a
Helper method to call a customized drink by this name
[ { "docid": "e2476fc58ad977d5eef6e016c4c914c8", "score": "0.6812016", "text": "def custom_drink_name\n \"Customized Drink\"\nend", "title": "" } ]
[ { "docid": "9fb8389c31c940a23e36e112d4b1bafe", "score": "0.5969144", "text": "def make_drink\n puts 'a drink'\n end", "title": "" }, { "docid": "c7e60d7e99309f3c897d860d6d0c0f0e", "score": "0.572613", "text": "def sell_a_drink_to_guest(guest_obj, drink_name_str)\n @bar.sell_a_drink(guest_obj, drink_name_str)\n end", "title": "" }, { "docid": "ac643f84bdd8c16ba6e72bf25d294956", "score": "0.56426704", "text": "def buy_dog(dog_name)\n Dog.new(dog_name, self)\n end", "title": "" }, { "docid": "ac643f84bdd8c16ba6e72bf25d294956", "score": "0.56426704", "text": "def buy_dog(dog_name)\n Dog.new(dog_name, self)\n end", "title": "" }, { "docid": "2e791673b38952bdee525e7cfcdd02ca", "score": "0.5604061", "text": "def method_missing(name, *args, &block)\n #puts \"RedSkyTestCase method_missing called; name = #{name.inspect}; #{name.class}\"\n \n case name.to_s\n when /^browser$/\n browser\n when /^rs/i, /^google/\n RSPages.find(name.to_s) # return the page so that the helper-method can use it\n else\n super\n end\n end", "title": "" }, { "docid": "39b132b8ee1bc2010a6bf08cb902ad32", "score": "0.5568721", "text": "def method_missing(symbol, *args)\n @beverage.send(symbol, *args)\n end", "title": "" }, { "docid": "6392a7858feedc84fa199ebca9d757f9", "score": "0.555606", "text": "def buy_dog(name)\n Dog.new(name, self)\n end", "title": "" }, { "docid": "6392a7858feedc84fa199ebca9d757f9", "score": "0.555606", "text": "def buy_dog(name)\n Dog.new(name, self)\n end", "title": "" }, { "docid": "6392a7858feedc84fa199ebca9d757f9", "score": "0.555606", "text": "def buy_dog(name)\n Dog.new(name, self)\n end", "title": "" }, { "docid": "6392a7858feedc84fa199ebca9d757f9", "score": "0.555606", "text": "def buy_dog(name)\n Dog.new(name, self)\n end", "title": "" }, { "docid": "6fe78ba5921f6ffb1fb620a2a46b26d2", "score": "0.55551124", "text": "def derivation(name, *args, **options)\n Shrine::Derivation.new(\n name: name,\n args: args,\n source: self,\n options: options,\n )\n end", "title": "" }, { "docid": "b6c51d407bd0c5262ef3f889b169b36c", "score": "0.553035", "text": "def set_drink\n @drink = Drink.find(params[:id])\n end", "title": "" }, { "docid": "1a8cfbc1c2324d580b85dbddb0f9858a", "score": "0.5506147", "text": "def dochook(name, &block)\n method = \"dochook_#{name}\"\n\n meta_def method, &block\n end", "title": "" }, { "docid": "1a8cfbc1c2324d580b85dbddb0f9858a", "score": "0.5506147", "text": "def dochook(name, &block)\n method = \"dochook_#{name}\"\n\n meta_def method, &block\n end", "title": "" }, { "docid": "dd5f86218adfc0e4caaf4cf3824a5eaa", "score": "0.54860497", "text": "def what_is_this_dog_called\n puts \"this dog is called #{@name}\"\n end", "title": "" }, { "docid": "8e546d9f0de3ebe7568fb25b4ad24f93", "score": "0.54841506", "text": "def touch_drink(drink)\n add_drink(drink) if [email protected](drink)\n return drink\n end", "title": "" }, { "docid": "cce74bdd289e082267ea9c2aa44fb94d", "score": "0.54635245", "text": "def set_drink\n @drink = Drink.find(params[:id])\n end", "title": "" }, { "docid": "cce74bdd289e082267ea9c2aa44fb94d", "score": "0.54635245", "text": "def set_drink\n @drink = Drink.find(params[:id])\n end", "title": "" }, { "docid": "cce74bdd289e082267ea9c2aa44fb94d", "score": "0.54635245", "text": "def set_drink\n @drink = Drink.find(params[:id])\n end", "title": "" }, { "docid": "cce74bdd289e082267ea9c2aa44fb94d", "score": "0.54635245", "text": "def set_drink\n @drink = Drink.find(params[:id])\n end", "title": "" }, { "docid": "cce74bdd289e082267ea9c2aa44fb94d", "score": "0.54635245", "text": "def set_drink\n @drink = Drink.find(params[:id])\n end", "title": "" }, { "docid": "cce74bdd289e082267ea9c2aa44fb94d", "score": "0.54635245", "text": "def set_drink\n @drink = Drink.find(params[:id])\n end", "title": "" }, { "docid": "cce74bdd289e082267ea9c2aa44fb94d", "score": "0.54635245", "text": "def set_drink\n @drink = Drink.find(params[:id])\n end", "title": "" }, { "docid": "f0e9fe761152201bba773d6f08ce5fbe", "score": "0.5436991", "text": "def method_missing (name, *args)\n if name.to_s =~ /^(un)?train_/\n category = name.to_s.gsub(/(un)?train_/, '').to_sym\n send(\"#{$1}train\", args[0], category)\n else\n super\n end\n end", "title": "" }, { "docid": "e20a643b010a64a2698c0c6b838249ef", "score": "0.5420686", "text": "def method_missing(name, *args)\n run(\"#{name} #{args.join(' ')}\".strip)\n end", "title": "" }, { "docid": "7bb413dae04c29a455d66e551f592f69", "score": "0.54205024", "text": "def order_drink_by_name(drink_name)\n return drink_name\n end", "title": "" }, { "docid": "e4287c210898374671f4f8c7c80e4d43", "score": "0.5358397", "text": "def buy_dog(name)\n dog = Dog.new(name, self)\n end", "title": "" }, { "docid": "ee2cab35b3238090aa7e3f5504211d69", "score": "0.53032714", "text": "def finkcmd(*args)\n fink(*args)\n end", "title": "" }, { "docid": "60056160dc2866bd7b9aaa009f161c3c", "score": "0.5280718", "text": "def Scraper(name)\n Scraper.get(name)\nend", "title": "" }, { "docid": "5909b393bb384b93c5d0759479620517", "score": "0.52753395", "text": "def run(name); end", "title": "" }, { "docid": "12023a165e7f56eba9d50688820ff9f6", "score": "0.5262773", "text": "def get_drink_name_from_api(drink_hash)\n return drink_hash[\"drinks\"][0][\"strDrink\"]\nend", "title": "" }, { "docid": "1edb14799c40b9c404c7eaed4bc76cd9", "score": "0.52627206", "text": "def drink_classifcation(name)\n size = Drink::Sizes.select{|s| name.match(s) }.last\n milk = Drink::Milks.select{|s| name.match(s) }.last\n [size ? size.downcase : nil, milk ? milk.downcase : nil]\nend", "title": "" }, { "docid": "b4ffe5152e6ac1e5bb39261e04090aaf", "score": "0.5260414", "text": "def method_missing(name, *args, &block)\n dalli_client.send name, *args, &block\n end", "title": "" }, { "docid": "3f8c8934c5436e45cec5eebdb301371d", "score": "0.5257976", "text": "def method_missing(id, *args)\n call(id.id2name, args[0])\n end", "title": "" }, { "docid": "8616dc518a0630061c899992472c4b44", "score": "0.52520984", "text": "def perform(strategy, base_price)\n \"Billable::#{strategy.titleize}\".constantize.perform(base_price)\n end", "title": "" }, { "docid": "e344837c29ab94e6ff9558ec256d96b4", "score": "0.52338964", "text": "def run(name, *args)\n custom = self[name]\n return unless custom\n proc = Proc.new do\n custom.call *args\n end\n\n instance_exec &proc\n end", "title": "" }, { "docid": "dfaec54007a0be20d4f5a53e8c168e32", "score": "0.52314466", "text": "def set_drink_type\n @drink_type = DrinkType.friendly.find(params[:id])\n end", "title": "" }, { "docid": "5e07e8a55cfd65a135ee7b25ac83fe2c", "score": "0.52278876", "text": "def command(name); end", "title": "" }, { "docid": "1a4c3ecd03dc08bc298e8984754fa191", "score": "0.5224722", "text": "def choose_another_device_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-rcm-lnkAnotherDev\")), __method__, self)\n end", "title": "" }, { "docid": "a2017b71aa4cf1ca90757723da1c7fe5", "score": "0.52077365", "text": "def method_missing(name, *args)\n cmd.run2(@command, name, *args)\n end", "title": "" }, { "docid": "31d900e09466c44e1b5d3ca0d8d7ee4a", "score": "0.5199776", "text": "def guest_buys_drink(guest, drink)\n if guest_afford_drink?(guest, drink)\n drink.pour_shot\n guest_pays_drink(guest, drink)\n guest.drinks(drink)\n end\n end", "title": "" }, { "docid": "b586d178cd4dd4a77398c292e6c9ccd1", "score": "0.5188233", "text": "def set_drink\r\n $admenu = Admenu.where(:id => params[:myadmenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end", "title": "" }, { "docid": "fd14216e610669fd1540381569d95ef4", "score": "0.51781267", "text": "def make_espresso_for(drink_order)\n\n end", "title": "" }, { "docid": "640af3389b860fa49a15ae65f2bf57ad", "score": "0.51764077", "text": "def imbibe(drink)\n \n stats_adjust(drink.cost, drink.health, drink.swagger_clout, drink.sure_footedness, drink.bladder, drink.belly )\n \n end", "title": "" }, { "docid": "29250ec19df8b23a2eded7b553aa88d1", "score": "0.5169774", "text": "def dog(name)\n return 'spot'\n end", "title": "" }, { "docid": "c2a4fd1dc1632bc260c46222e0011d8c", "score": "0.51604915", "text": "def make_drip_coffee_for(drink_order)\n\n end", "title": "" }, { "docid": "61ad2a508ebdb61acd710b90dcc8df4d", "score": "0.5143178", "text": "def buy_drink(drink)\n # if can_buy?(drink) == true\n if can_buy?(drink)\n @wallet -= drink.price\n @drunkenness_lvl += drink.alcohol_lvl\n end\n end", "title": "" }, { "docid": "112e6c68afc320e4d3a14f56610d82c8", "score": "0.5110019", "text": "def set_drink\r\n $admenu = Admenu.where(:id => params[:adsmenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end", "title": "" }, { "docid": "32fea208d9f0a7c6588b577cdc398768", "score": "0.5100898", "text": "def method_missing(method_name,*args);\n case method_name.to_s\n when /^add_tiddler_(.*)$/\n add_tiddler(Tiddler.new.send($1,*args))\n end\n end", "title": "" }, { "docid": "7662b73615ee4ff55c1e8ab5459ae0e3", "score": "0.5098336", "text": "def method_missing(method_name, *arguments, &block)\n ardrone.send(method_name, *arguments, &block)\n end", "title": "" }, { "docid": "7662b73615ee4ff55c1e8ab5459ae0e3", "score": "0.5098336", "text": "def method_missing(method_name, *arguments, &block)\n ardrone.send(method_name, *arguments, &block)\n end", "title": "" }, { "docid": "efa0396933ce81d120c5ea76b662d450", "score": "0.509645", "text": "def link(name, locator)\r\n define_method(\"#{name}_text\") do\r\n adapter.link(locator).value\r\n end\r\n define_method(\"click_#{name}\") do\r\n adapter.link(locator).click\r\n end\r\n define_method(\"#{name}_view\") do\r\n adapter.link(locator).view\r\n end\r\n end", "title": "" }, { "docid": "063b5dff2d858aa8b7824abbe753b94a", "score": "0.50941795", "text": "def get_drink(drink_type)\n # if the drink exists return the drink to the user else return nil\n if(@drinks[drink_type] && @drinks[drink_type] > 0)\n return drink_type\n else\n return nil\n end\n end", "title": "" }, { "docid": "38e8e759da35038165316d2c3ec3de76", "score": "0.50796074", "text": "def method_missing(name, *args)\n execute name.to_sym, *args\n end", "title": "" }, { "docid": "90fddd70627d86b63e988b500f4a5296", "score": "0.506127", "text": "def method_missing(name, *args, &block)\n prefix = name.to_s.chomp(\"_pretender\")\n if args.empty? && !block && (class_name = \"#{prefix.classify}Pretender\").safe_constantize\n class_eval <<-EOM, __FILE__, __LINE__ + 1\n def #{prefix}\n @great_pretender_pretender_#{prefix} ||= begin\n init = #{class_name}.instance_method(:initialize)\n init.arity == 1 ? #{class_name}.new(mockup) : #{class_name}.new\n end\n end\n EOM\n\n return send(prefix)\n end\n\n super\n end", "title": "" }, { "docid": "482aa15c5a1d86285f1c10bc8f0a6f3f", "score": "0.50284654", "text": "def set_drink\n @drink = Drink.find(params[:id])\n @dishes = @category.dishes\n @drinks = @category.drinks\n end", "title": "" }, { "docid": "3384d715ecfcfa41366d7f9d725a55ad", "score": "0.5002573", "text": "def method_missing(name, *args, &block)\n if found_category = Categories.category_id_by_name(name)\n Command.new(category_id: found_category)\n else\n super\n end\n end", "title": "" }, { "docid": "32ae65f2bdc0c3c9c4917139c7c4593a", "score": "0.49963665", "text": "def method_missing(meth_name, *args, &block)\n raise \"No method named: #{meth_name}\" unless recipe.respond_to? meth_name\n recipe.send(meth_name, *args, &block)\n end", "title": "" }, { "docid": "d7e568503338436137cb7487cba8b78e", "score": "0.49897578", "text": "def buy_dog(dog)\n Dog.new(dog, self)\n end", "title": "" }, { "docid": "2087b41d145e2b50a89de7a7716484f2", "score": "0.49810705", "text": "def bark\n return \"Generic Bark\"\n end", "title": "" }, { "docid": "98c5847a8d3b3db342bdc063b146fddd", "score": "0.49804342", "text": "def bark\n return \"generic bark\"\n end", "title": "" }, { "docid": "c8d2152842a6fb40296160f6df87dd35", "score": "0.4977117", "text": "def run(name, *argv)\n command = @registry.find!(name)\n command.run(argv)\n end", "title": "" }, { "docid": "b5aab7dbd311757810fbd657a3e9163d", "score": "0.49724844", "text": "def test_check_drink_name\n assert_equal(\"wine\", @drink_1.check_drink_name)\n end", "title": "" }, { "docid": "ff692b1af526550059e2f4155400b667", "score": "0.49647003", "text": "def sell_drink(drink, customer)\n if check_age(customer) == false\n return nil\n elsif sober?(customer) == false\n return nil\n end\n\n if @drinks.include?(drink)\n customer.buy_drink(drink)\n add_money(drink.price)\n remove_drink(drink)\n end\n\n# Linked to the end question\n\n # if find_drink?(drink.name)\n # customer.buy_drink(drink)\n # add_money(drink.price)\n # remove_drink(drink)\n # end\n\n\n end", "title": "" }, { "docid": "acca888db334678bc307cf79c331120a", "score": "0.49618635", "text": "def drink(amount=10)\n @hydration_level += amount\n\n if @hydration_level > 100\n puts \"#{@name} is hyper-hydrated. #{@name} pukes the execess.\"\n @hydration_level = 100\n else\n puts \"#{@name} drinks happily.\"\n end # end of conditional for hyper-hydrated\n time_passed\n end", "title": "" }, { "docid": "edd51f3bc610dfa6239411471c707d3f", "score": "0.49611393", "text": "def buy_drink(drink)\n if drink.price <= @wallet\n @wallet -= drink.price\n @drunk_level += drink.alcohol_level\n end\n end", "title": "" }, { "docid": "a95a410833954982ede20c335869cdbd", "score": "0.49476478", "text": "def run\n print(\"#{@name} the dog runs\")\n end", "title": "" }, { "docid": "e82040addaa576394ea958d568e5002c", "score": "0.49398702", "text": "def method_missing(method_name, *args, &blk)\n super unless drb_object.respond_to?(method_name)\n\n drb_object.public_send(method_name, *args, &blk)\n end", "title": "" }, { "docid": "2ad970b033a57140a5c82695c6d8805c", "score": "0.4936445", "text": "def call_driver(method_name, *args)\n @logger.debug(\"Finding method #{method_name}\")\n method = driver().method(method_name) \n \n if args.length > 0\n method.call(@token, *args) \n else\n method.call(@token)\n end\n end", "title": "" }, { "docid": "b279aee2ad97e14c6d4308ba6a687c53", "score": "0.49279857", "text": "def command(name)\n self.class.command(name)\n end", "title": "" }, { "docid": "424812bc14775df8fcceb5c125a6d4fd", "score": "0.49259162", "text": "def method_missing(name, *args)\n Vips::call_base(name.to_s, self, \"\", args)\n end", "title": "" }, { "docid": "1092dbee6294750f5143e746470c952c", "score": "0.4919976", "text": "def dog(name)\n return name\n end", "title": "" }, { "docid": "79934da842c34d7d838dc0f4ffb36bf4", "score": "0.49181658", "text": "def proxy_method_name(base_name)\n begin\n meth = \"#{base_name}_#{Random.rand(999)}\"\n end while respond_to?(meth)\n meth\n end", "title": "" }, { "docid": "495869c9eb1f06936107161aa18cdfa6", "score": "0.4915288", "text": "def run_super(method, args=[])\n ExtraLoop::ScraperBase.instance_method(method).bind(self).call(*args)\n end", "title": "" }, { "docid": "4ad71b98e1268d08714a0aea83b41dc0", "score": "0.49142814", "text": "def api_return_name(drink)\n response_string = RestClient.get(\"https://www.thecocktaildb.com/api/json/v1/1/search.php?s=#{drink}\")\n response_hash = JSON.parse(response_string)\n drink_string = response_hash[\"drinks\"]\n drink_string\nend", "title": "" }, { "docid": "ad038860f584a0aaf32724a83d886740", "score": "0.49123037", "text": "def bark\n puts \"Generic Bark\"\n end", "title": "" }, { "docid": "ee82f0650a2c2807f342ace04569c8db", "score": "0.49083", "text": "def call_it(name)\n @settings[:name] = name\n end", "title": "" }, { "docid": "8480b03e01643fcb0b1068d58c4058a8", "score": "0.4904177", "text": "def method_missing(name, *args)\n instance = find_instance(name.to_sym)\n\n if (instance)\n refer_or_copy(instance)\n else\n raise Exception.new(\"I do not know what to do with '#{name}'.\")\n end\n end", "title": "" }, { "docid": "1881d2370f773a91b61469e329f5d320", "score": "0.48947796", "text": "def method_missing(sym, *args, &block)\n # base, extension = breakdown_method(sym)\n # if Runner.find(base) and extension == 'methodize'\n # Runner.methodize(base)\n # elsif Runner.find(base) and extension == 'to_s'\n # require 'rubygems'\n # require 'ruby-debug'\n # debugger\n # Runner.stringify_proc(base)\n if Runner.find(sym)\n Runner.run(sym, *args)\n # elsif Runner.respond_to?(sym)\n elsif Runner.respond_to?(sym)\n Runner.send(sym, *args, &block)\n else\n super\n end\n end", "title": "" }, { "docid": "c557176c6e90d42705e6d62a89c1d252", "score": "0.48893845", "text": "def kicker\n\n end", "title": "" }, { "docid": "080bf8b6c14dacd2904c8da4b5da4d2a", "score": "0.48848337", "text": "def find_dog_by_name(name)\n\nend", "title": "" }, { "docid": "0ce2827801addf026dc6210ad9d996e0", "score": "0.4883381", "text": "def bark\n puts \"My name is #{@name}\"\n end", "title": "" }, { "docid": "0541101677b1c2d7b5ad022022c37255", "score": "0.48811612", "text": "def method_missing(id, *args) \n request(@binding).call(id.id2name, args[0])\n end", "title": "" }, { "docid": "36a53933bb40525354bee0fa3b95b4e8", "score": "0.4880374", "text": "def find_drink_by_name(drink_name)\n found_drink = nil\n for drink in @stock\n found_drink = drink if drink.name == drink_name\n end\n return found_drink\n # @stock.find{|drink| drink == drink_name}\n end", "title": "" }, { "docid": "6e052e4dcd65c57cac73f840d6f1c17c", "score": "0.4878922", "text": "def buy_cat (name) \n Cat.new(name, self) \nend", "title": "" }, { "docid": "7ff027d75aaaeb5c50ce3ac8bfeb0660", "score": "0.4873906", "text": "def initialize options\n super\n\n require 'drip'\n\n @name = ['power_mitten', options[:name]].compact.join '-'\n @type = 'Drip'\n\n path = File.join '~/.drip', @name\n @drip = Drip.new File.expand_path path\n end", "title": "" }, { "docid": "6e590049e9e691f498581fa983d59e24", "score": "0.48729092", "text": "def call(name, ctx = context)\n varname = :\"@#{name}\"\n\n if ctx.respond_to?(name) \n ctx.send(name)\n elsif ctx.respond_to?(:has_key?) && ctx.has_key?(name.to_sym)\n ctx[name.to_sym]\n elsif ctx.instance_variables.include?(varname)\n ctx.instance_variable_get(varname)\n elsif parent\n call(name, parent) \n else \n raise NameError.new(\"Could not find reference to #{name} or @#{name} in context.\")\n end\n end", "title": "" }, { "docid": "ef698cdc2d5ed74ea8761468ee46c4d5", "score": "0.48727158", "text": "def call!(name, *args, &block)\n built = super\n resolved = __adapter__.new(@klass, built.to_resource)\n resolved.call!(*args, &block)\n resolved.result.payload\n end", "title": "" }, { "docid": "db271900b6cf249b4e13887bb5a209ca", "score": "0.48706996", "text": "def set_dr_method\n @dr_method = DrMethod.find(params[:id])\n end", "title": "" }, { "docid": "35d8d79e9b6373ed672c77073f7d9af9", "score": "0.48648524", "text": "def get_drink(db, name, decaf, drink_size, iced, number_of_shots)\n db.execute(\"INSERT INTO drinks (name, decaf, drink_size, iced, number_of_shots) VALUES (?, ?, ?, ?, ?)\", [name, decaf, drink_size, iced, number_of_shots])\nend", "title": "" }, { "docid": "b73baba934ceee1e645fb389338b6223", "score": "0.48623106", "text": "def scraper(name, &scraper_block)\n Scraptacular.world.register_scraper name, &scraper_block\n end", "title": "" }, { "docid": "fd6245796ca72a26359bbb6606eef463", "score": "0.48607346", "text": "def cartman (name)\nend", "title": "" }, { "docid": "d589fbf51271c0d3009783f147de504d", "score": "0.48569557", "text": "def method_missing(name)\n @item.send(name)\n end", "title": "" }, { "docid": "a254cee4766288d0428974cb8b294c34", "score": "0.4854984", "text": "def method_missing(name, *args, &block)\n command = registry[name]\n\n if args.size > 1\n command.new(*args, &block)\n else\n command.call(*args, &block)\n end\n end", "title": "" }, { "docid": "c18a35228c539a7c9c152b519a13a768", "score": "0.48544022", "text": "def name\n id, path = arguments\n \"HarvestItem(#{id}) for: #{path}\"\n end", "title": "" }, { "docid": "71782219b491ace37d3af8b178378770", "score": "0.4848247", "text": "def search_page_url(drink_type)\n return \"http://tastings.com/search_#{drink_type}.lasso\"\nend", "title": "" }, { "docid": "4a77aed48200da9bcb684d9a8396d914", "score": "0.48473063", "text": "def method_missing(name, *params)\n begin\n class_name = name.to_s.camelize.singularize\n # if there is a dependency, a method is created after the dependant class is evaluated\n eval class_name\n # if method created, call it\n if respond_to?(name) then\n send(name, params)\n # otherwise raise anything\n else\n raise \"No dependency found.\"\n end # if\n rescue\n # if there were some errors, method was not found\n raise \"Method #{name} not found.\"\n end # begin/rescue\n end", "title": "" }, { "docid": "880bf2aa38bc614d393eb1d9eb8ce619", "score": "0.48460966", "text": "def get_drink_id(drink)\n HTTParty.get(\"http://localhost:8000/api/v1/cocktails/#{drink['id']}\")\n end", "title": "" }, { "docid": "8006a118ee3202566777e4f9c24db978", "score": "0.48441878", "text": "def method_missing(name, *args, &block)\n if @config.respond_to?(name)\n @config.send(name, *args, *block)\n else\n Browsery.logger.debug(\"Connector(##{self.object_id})->#{name}(#{args.map { |a| a.inspect }.join(', ')})\")\n @driver.send(name, *args, &block)\n end\n end", "title": "" }, { "docid": "136f8f8ade7c62447ed698ab166ac512", "score": "0.48414335", "text": "def run(*)\n factory = FactoryBotStrategy.factory_bot_constant.factory_by_name(@name)\n FactoryBotStrategy.used_factories << factory.name.to_s\n super\n end", "title": "" } ]
aee3557cd123c098b6b7a5e460e1f4ab
partial update to show new entries
[ { "docid": "3a73b5d86394cdc608d7254fdd13b53e", "score": "0.0", "text": "def relist\n @chatroom \t= Chatroom.find(params['chatroom_id'])\n @user = current_user\n @membership = Membership.find(:all, :conditions => {:chatroom_id => @chatroom.id, :user_id => @user.id })\n @users = User.all(:joins => :entries, :select => \"users.*, count(entries.id) as entries_count\", :group => \"users.id\")\n @entries = @chatroom.entries #Entry.find(:all, :conditions => ['user_id = ? AND chatroom_id = ?', current_user.id, @chatroom.id])\n @title\t= @chatroom.name\n render :partial => \"entries\", :object => @entry\n end", "title": "" } ]
[ { "docid": "41dd207e9bad6792d80552db6da20d85", "score": "0.68064475", "text": "def edit\n find_and_show_entries(false)\n end", "title": "" }, { "docid": "b9dae03604327c75a7dc902ced2d3a52", "score": "0.6726519", "text": "def update\n respond_to do |format|\n if entry.update_attributes(params[:entry])\n format.html { redirect_to list, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: entry.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "title": "" }, { "docid": "78cf0f9e45f2f0b255e83fe7244edffd", "score": "0.6682688", "text": "def ajax_update_latest_entries\n\t\t\n \t@entries=get_latest_entries(@@numEntriesHomePage)\n \n render(:layout=>false)\n \t\n end", "title": "" }, { "docid": "fb02b48b1fbfd31d2da2649ea214cb45", "score": "0.65928704", "text": "def render_updated_records (klassname)\n\n klass = to_class(klassname)\n\n records = klass.find(:all)\n\n render :update do |page|\n\n page.replace_html(\n \"worklist_#{klassname}\",\n :partial => \"index_#{klassname.downcase}s\",\n :locals => { :records => records })\n end\n end", "title": "" }, { "docid": "4267973897f1a853a37d70b6d30d49c0", "score": "0.6449751", "text": "def update\n if @entry.update(entry_params)\n redirect_to entries_path , notice: t('.notice')\n else\n render :edit\n end\n end", "title": "" }, { "docid": "72da54b552e1c33482eb23c3d7a18f55", "score": "0.6439815", "text": "def show\n update\n end", "title": "" }, { "docid": "665f81cd67a41335d3e5278a5684f2d1", "score": "0.64354473", "text": "def partial_update()\n command('P')\n end", "title": "" }, { "docid": "af13761ed93d54a8575b4849284693cf", "score": "0.6399664", "text": "def edit\n respond_with(@entry)\n end", "title": "" }, { "docid": "6cd294bf4c8e581715e7f6682ef2b64d", "score": "0.6396939", "text": "def update_table\n respond_to do |type|\n type.js do\n do_list\n render(:partial => 'list', :layout => false)\n end\n type.html { return_to_main }\n end\n end", "title": "" }, { "docid": "1cf66eeeb476455d7edf148fa11ebfb0", "score": "0.63895595", "text": "def updated\n fetch_results('update')\n end", "title": "" }, { "docid": "c92b836366addefa3304aa00c2cf8fc7", "score": "0.636021", "text": "def update\n #\n end", "title": "" }, { "docid": "d2b5bb8a5e6c525b6e31dca7ebeb65b1", "score": "0.63286996", "text": "def update\n\t\trespond_to do |format|\n\t\t\tif @entry.update(entry_params)\n\t\t\t\tformat.json { render :show, status: :ok, location: @entry }\n\t\t\telse\n\t\t\t\tformat.json { render json: @entry.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "033111e01353cfb424a9530d19da6fd2", "score": "0.63264966", "text": "def update\r\n end", "title": "" }, { "docid": "033111e01353cfb424a9530d19da6fd2", "score": "0.63264966", "text": "def update\r\n end", "title": "" }, { "docid": "40b3a49b518a9d92a69dc7dc46dc891d", "score": "0.63203895", "text": "def updates\n\tend", "title": "" }, { "docid": "28209ee0aa3e250a92993c5783dadeb1", "score": "0.6310174", "text": "def update\n end", "title": "" }, { "docid": "319a917bfd31803b85537ae957395293", "score": "0.63069457", "text": "def edit\n @entry = Entry.find(params[:id])\n render :edit\n end", "title": "" }, { "docid": "93e91c2952dd29f0d82148b31bbe642e", "score": "0.630635", "text": "def update\n #TODO\n end", "title": "" }, { "docid": "07588accd334970711dc7f3965dab1b3", "score": "0.6294436", "text": "def update\n # TODO\n end", "title": "" }, { "docid": "446e745f2a2b8b09d23977881c083d70", "score": "0.62771153", "text": "def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.json { render :show, status: :ok, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f4030dd5a7fb425beffe25d595b00a0a", "score": "0.62705785", "text": "def update\n @entry.attributes = params[model_identifier]\n updated = with_callbacks(:update) { save_entry }\n \n respond_processed(updated, 'updated', 'edit')\n end", "title": "" }, { "docid": "b415bea97bf02b47f3938a4655e7ee79", "score": "0.62621593", "text": "def update\n # TODO:\n end", "title": "" }, { "docid": "7bacbba5294a373c4cd2ed10240e346c", "score": "0.6260797", "text": "def my_records\n @my_records = TFieldOrder.get_records_by_month(session[:user],params[:page])\n render :update do |page|\n page.replace_html 'content' , :partial => 'my_records'\n end\n end", "title": "" }, { "docid": "8088425a6cc84d43a48ea7f32e762863", "score": "0.6260258", "text": "def update\n #todo not yet done\n end", "title": "" }, { "docid": "0cddbcb6f56946e33ebbfc3ebad96292", "score": "0.626025", "text": "def update\n respond_to do |format|\n if @fermentable_addition.update(fermentable_addition_params)\n format.js { render :index }\n else\n format.js { render :edit}\n end\n end\n end", "title": "" }, { "docid": "8a96f2ef56ad87369d8a0b1445325603", "score": "0.6256906", "text": "def row_update\n __debug_route\n render_json editing_update(**current_params)\n rescue => error\n post_response(error)\n end", "title": "" }, { "docid": "f402bec0b71f321ed7b77af1bf7e1a2e", "score": "0.62520933", "text": "def update\n end", "title": "" }, { "docid": "f402bec0b71f321ed7b77af1bf7e1a2e", "score": "0.62520933", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.625135", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "007f976d25ffbdde53e6c6cd23cc1a12", "score": "0.6251221", "text": "def update\n end", "title": "" }, { "docid": "cb68c215f205ef15499b7b67070df339", "score": "0.6240795", "text": "def update\n update_helper(@entry, entry_params)\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" }, { "docid": "dc1181921395ed1c63f2b45eefaf0ee6", "score": "0.6235834", "text": "def update\n end", "title": "" } ]
c99f2e0d26e41c806a0611791e4d77ba
Add a dependencies by name, version requirements, and a final optional :dev or :development symbol indicating its for development.
[ { "docid": "9de9471f2d20bb25e402fa3ce43cd9b1", "score": "0.6884082", "text": "def depend( name, *args )\n if args.last == :dev || args.last == :development\n args.pop\n add_development_dependency( name, *args )\n else\n add_dependency( name, *args )\n end\n end", "title": "" } ]
[ { "docid": "8ff8da8d8bf4f163502efc9410b811a3", "score": "0.724554", "text": "def add_dependency(name, version = nil)\n @requires[name] = version\n end", "title": "" }, { "docid": "8a822c315cafe427e1ff3db679e43453", "score": "0.68907166", "text": "def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.dependencies << (version.nil? ? [name] : [name, \">= #{version}\"])\nend", "title": "" }, { "docid": "69f18f376b6e16db15cf2dc9af958ce9", "score": "0.6851411", "text": "def dependency(name, version = nil)\n @dependencies << [ name, version ]\n end", "title": "" }, { "docid": "b6168117c46515b1899f0cdf4fe3c945", "score": "0.68504065", "text": "def add_development_dependencies\n add_dependency(\"olag\") unless self.name == \"olag\"\n %w(Saikuro codnar fakefs flay rake rcov rdoc reek roodi test-spec).each do |gem|\n add_development_dependency(gem)\n end\n end", "title": "" }, { "docid": "2768fcae69a4a7618c19bf9547807573", "score": "0.66599333", "text": "def insert_development_dependencies(dd, g)\n\tdd_f = []\n\tdd.each do |dependency|\n\t\tdd_f << {\n\t\t\t'name' => dependency['name'],\n\t\t\t'requirements' => dependency['requirements'],\n\t\t\t'category' => \"development\"\n\t\t}\n\tend\n\n\tg.depends.create(dd_f)\nend", "title": "" }, { "docid": "7b1974f4f9749a395ad8140a9a6ad1e6", "score": "0.65873975", "text": "def dependencies(name, version)\n g = GemName.new(name, version)\n _dependencies(g)\n g\n end", "title": "" }, { "docid": "5d692611b654e0ea60a99c96bfe55e2a", "score": "0.65810496", "text": "def dep(name, *requirements)\n FoobarMod::Dependency.new name, *requirements\n end", "title": "" }, { "docid": "01d3fe073ee973c300fcd7224a451ec6", "score": "0.65308464", "text": "def create_deps(gemspec)\n gemspec.add_dependency('builder', '>= 2.1.2')\n gemspec.add_dependency('optiflag', '>= 0.6.5')\n gemspec.add_dependency('rake', '>= 0.7.1')\n gemspec.add_dependency('json', '>= 1.1.0')\nend", "title": "" }, { "docid": "6c32d2dedcfdd82b359a32d70a8a3367", "score": "0.6506476", "text": "def depends(nm, ver=nil) @all_depends[nm] = (ver ? %Q{\"#{nm}\", \"#{ver}\"} : %Q{\"#{nm}\"} ) ; end", "title": "" }, { "docid": "8fb9ab693bcba16fe56e9c4aab954deb", "score": "0.6474705", "text": "def add_dependency(package_name, versions = nil)\n if self.depends_on?(package_name)\n self.errors.add(:base, \"Dependency already present\")\n return false\n else \n (self.depends = \"\") unless self.depends\n self.depends += \", \" unless self.depends.blank?\n self.depends += package_name\n self.depends += \" (#{versions})\" if versions\n self.save\n end\n end", "title": "" }, { "docid": "94c3614e7f254e4be8bac59563cbec99", "score": "0.6470114", "text": "def dependency(*args)\n name, *version_requirements = args\n platform_name = platform.to_s\n spec.attributes_hash[platform_name] ||= {}\n spec.attributes_hash[platform_name][\"dependencies\"] ||= {}\n spec.attributes_hash[platform_name][\"dependencies\"][name] = version_requirements\n end", "title": "" }, { "docid": "ef0460839776ab76380bad1f8da0f135", "score": "0.64252037", "text": "def dependency(name, version)\n @_dependencies << Dependency.new(name, version)\n end", "title": "" }, { "docid": "6379afcc05e41e5669cbf50b87622f47", "score": "0.6402203", "text": "def add_dependency(gem, *requirements)\n requirements = ['> 0.0.0'] if requirements.empty?\n requirements.flatten!\n unless gem.respond_to?(:name) && gem.respond_to?(:version_requirements)\n gem = Dependency.new(gem, requirements)\n end\n dependencies << gem\n end", "title": "" }, { "docid": "5a2342bb69a928b5c09b72327c4825e6", "score": "0.638516", "text": "def dependency(name, version_requirement = nil, repository = nil)\n @metadata.dependencies << Dependency.new(name, version_requirement, repository)\n end", "title": "" }, { "docid": "77eead788b1faa12e4b90db144824e09", "score": "0.63517106", "text": "def requires(requirement, version = nil)\n @project.requires << OpenStruct.new(:requirement => requirement, :version => version)\n end", "title": "" }, { "docid": "642da63901e5903daa0ded91dbc64ce5", "score": "0.63261503", "text": "def add_dependency(gemname, options={})\n # Touch.\n fname = File.join(self.class.source_root, 'dependencies')\n create_file 'dependencies' unless File.exists?(fname)\n\n # Construct the dependencies line.\n dep = []\n dep << gemname\n dep << options[:version] unless options[:version].nil?\n dep << options[:git] unless options[:git].nil?\n dep = dep.join(' ')\n\n skip = false\n gsub_file 'dependencies', /^\\s*#{gemname}.*$/, :verbose => false do\n skip = true; dep\n end\n\n append_file 'dependencies', \"#{dep}\\n\", :verbose => false unless skip\n say_status(:update, \"dependencies (#{gemname})\")\n end", "title": "" }, { "docid": "7efa6fc3ffae65a93feee41f04551050", "score": "0.62469053", "text": "def add_dependency(name, constraint)\n @dependencies[name.to_s] = constraint.to_s\n end", "title": "" }, { "docid": "b22dca95dea1dc197303b872a55ab5a0", "score": "0.62176704", "text": "def dependency(*args)\n name, *version_requirements = args\n platform_name = platform.to_s\n platform_hash = spec.attributes_hash[platform_name] || {}\n platform_hash['dependencies'] ||= {}\n platform_hash['dependencies'][name] = version_requirements\n spec.attributes_hash[platform_name] = platform_hash\n end", "title": "" }, { "docid": "5495a9309621e59129e9d7f36e7e56b7", "score": "0.62004423", "text": "def dependency(name, version = '>=0')\n @dependencies << Dependency.new(name, version)\n yield self if block_given?\n end", "title": "" }, { "docid": "fa60b181b283ec49693a79efbc5ab9f0", "score": "0.61975783", "text": "def dependencies_for(spec)\n possible_dependencies = if configuration.development\n spec.dependencies\n else\n spec.runtime_dependencies\n end\n\n dependencies = filter_dependencies(possible_dependencies)\n\n assign_gem_versions(dependencies)\n end", "title": "" }, { "docid": "7205e6a58c288f4a34a7bab6099def26", "score": "0.6178235", "text": "def install_dependencies(spec)\n di = Gem::DependencyInstaller.new\n\n spec.development_dependencies.each do |dep|\n unless source_index.search(dep).last\n if config[\"install_development_dependencies\"]\n say \"Installing test dependency #{dep.name} (#{dep.requirement})\"\n di.install(dep) \n else\n if ask_yes_no(\"Install development dependency #{dep.name} (#{dep.requirement})?\", true)\n say \"Installing test dependency #{dep.name} (#{dep.requirement})\"\n di.install(dep) \n else\n alert_error \"Failed to install dependencies required to run tests. Aborting.\"\n raise Gem::TestError\n end\n end\n end\n end\n end", "title": "" }, { "docid": "0c946f678f819128e8cf41bf4a7ebf46", "score": "0.61732066", "text": "def deps_for(name_spec)\n name, version = name_spec.split(':')\n version ||= Gem.latest_version_for(name)\n dependent = Gem::Dependency.new name, version\n deps = Array(Gem.latest_spec_for(name.to_s).dependencies)\n # Eliminate dependencies' development-mode Gems\n deps = [dependent] + deps.reject { |gem| gem.type == :development }\n deps.flatten # .sort\nend", "title": "" }, { "docid": "42ba72f21dc787238e49c7b532d51994", "score": "0.61236477", "text": "def add_dependency(type,req_name,dep_opts={})\n require req_name\n dep_opts[:installed] = true\n rescue LoadError => ex\n self.disable! unless dep_opts[:disable] === false\n dep_opts[:installed] = false \n ensure\n @dependent_libs ||= {:core => [], :gem => []}\n\n #if an alternate name isn't specified refer to it by the req_name\n dep_opts[:name] ||= req_name\n @dependent_libs[type].push dep_opts\n end", "title": "" }, { "docid": "34a6d3a1866321c0b85560653bf450e9", "score": "0.61003196", "text": "def simple_ruby_dep name, *other_deps\n debug __LINE__, \"other_deps\", other_deps\n other_deps_string = other_deps.inject(\"\") do | a, e |\n debug __LINE__, \"a\", a\n debug __LINE__, \"e\", e\n a + \" \" + e\n end\n new_entry \"../public/#{name}: #{name}.rb#{other_deps_string}\"\n tab \"ruby $(RUBYOPT) #{name}.rb >[email protected]\"\n commit\n end", "title": "" }, { "docid": "ae5113d0d4f6f6e70cbaae6a940c050e", "score": "0.6090556", "text": "def requires(requirement, version = nil)\n @component.requires << OpenStruct.new(:requirement => requirement, :version => version)\n end", "title": "" }, { "docid": "7a10a29f8a9eabe7ce7c7fa6f28c4106", "score": "0.60558254", "text": "def add_dependencies groups, dependencies # :nodoc:\n return unless (groups & @without_groups).empty?\n\n dependencies.each do |dep|\n @set.gem dep.name, *dep.requirement\n end\n end", "title": "" }, { "docid": "08cb4f154833e33899edb252908686ee", "score": "0.60510284", "text": "def gem(name, *version_requirements)\n dependency = Gem::Dependency.new(name, *version_requirements)\n if Gem.source_index.search(dependency).empty?\n puts \"Installing #{dependency}\"\n installer.install(dependency)\n else\n puts \"#{dependency} is already installed\"\n end\n end", "title": "" }, { "docid": "e4f9cf476d64284cd9958686dc54b35b", "score": "0.60499674", "text": "def add_dependency(name, optional: false, modes: [])\n dependencies << Dependency.new(name, optional, modes)\n end", "title": "" }, { "docid": "46dd0e6bcfb58274b08f15f22a5020d4", "score": "0.60349435", "text": "def gem(name, *version_requirements)\n dependency = Gem::Dependency.new(name, *version_requirements)\n if Gem.source_index.search(dependency).empty?\n puts \"Installing #{dependency}\"\n `gem install #{name} --version \\\"#{version_requirements.first}\\\"`\n else\n puts \"#{dependency} is already installed\"\n end\n end", "title": "" }, { "docid": "66ab8f470d9120e71b2c974160b37920", "score": "0.6008198", "text": "def test_add_dependency_adds_dependency_to_list\n spec = minimal_spec do |s|\n s.add_runtime_dependency 'jiraSOAP'\n s.add_dependency 'nokogiri'\n s.add_dependency 'mail', '2.3.0'\n s.add_dependency 'activesupport', ['3.0.10']\n s.add_dependency 'meme_generator', '~> 1.9.0'\n s.add_dependency 'Salut', '>= 0', '< 2.0.0'\n end\n\n assert spec.gems.all? { |s| s.kind_of? Gem::Dependency }\n\n assert_includes spec.gems,\n Gem::Dependency.new('jiraSOAP', Gem::Requirement.default, :runtime)\n\n assert_includes spec.gems,\n Gem::Dependency.new('nokogiri', Gem::Requirement.default, :runtime)\n\n assert_includes spec.gems,\n Gem::Dependency.new('mail', '2.3.0', :runtime)\n\n assert_includes spec.gems,\n Gem::Dependency.new('activesupport', '3.0.10', :runtime)\n\n assert_includes spec.gems,\n Gem::Dependency.new('meme_generator', '~> 1.9.0', :runtime)\n\n assert_includes spec.gems,\n Gem::Dependency.new('Salut', '>= 0', '< 2.0.0', :runtime)\n end", "title": "" }, { "docid": "e9c960c21a5f6be9628fac634d021bf7", "score": "0.599876", "text": "def dep name, *params, &block\n Base.sources.current_load_source.deps.add_dep(name, params, block)\n end", "title": "" }, { "docid": "374fcebc56983d3de522c7d5cfec3cee", "score": "0.5975531", "text": "def add_dependency(name, constraint = nil, options = {})\n if has_dependency?(name)\n # Only raise an exception if the dependency is a true duplicate\n groups = (options[:group].nil? || options[:group].empty?) ? [:default] : options[:group]\n if !(@dependencies[name].groups & groups).empty?\n raise DuplicateDependencyDefined,\n \"Berksfile contains multiple entries named '#{name}'. Use only one, or put them in different groups.\"\n end\n end\n\n if options[:path]\n metadata_file = File.join(options[:path], 'metadata.rb')\n end\n\n options[:constraint] = constraint\n\n @dependencies[name] = Berkshelf::Dependency.new(self, name, options)\n end", "title": "" }, { "docid": "440253daa7b7501077e7ebe3b4f4200a", "score": "0.5969198", "text": "def build_dependency_attributes\n gemfile = File.join(Dir.pwd, 'Gemfile')\n return unless File.file? gemfile\n\n bundler = Bundler::Dsl.new\n bundler.eval_gemfile gemfile\n\n # loop through the required gems and find default and development gems\n bundler.dependencies.each do |gem|\n if gem.groups.include? :default\n @dependencies[:runtime][gem.name] = gem.requirements_list.first\n else\n @dependencies[:development][gem.name] = gem.requirements_list.first\n end\n end\n end", "title": "" }, { "docid": "d55b3bd595f16870f8546fa65f5f4544", "score": "0.59652615", "text": "def depends(name, constraint = '>= 0.0.0')\n unless dependency?(name, constraint)\n set_dependency(name, constraint)\n end\n\n self\n end", "title": "" }, { "docid": "c344ee527a12725385d29d9508e14612", "score": "0.59544426", "text": "def gemspec options = {}\n name = options.delete(:name) || '{,*}'\n path = options.delete(:path) || '.'\n development_group = options.delete(:development_group) || :development\n\n spec = find_gemspec name, path\n\n groups = gem_group spec.name, {}\n\n add_dependencies groups, spec.runtime_dependencies\n\n groups << development_group\n\n add_dependencies groups, spec.development_dependencies\n\n gem_requires spec.name, options\n end", "title": "" }, { "docid": "26051b3b95de1a4051c036df0f8856ce", "score": "0.59507877", "text": "def meet(dep_name, options = {})\n @deps << Dep.new(dep_name, options)\n end", "title": "" }, { "docid": "20fc6b0c7dd0182562155cb97d4464fb", "score": "0.5938961", "text": "def dependency(dep_name, op=nil, dep_version=nil)\n if dep_version\n op ||= '>='\n else\n dep_version = op\n op = nil\n end\n\n raise InvalidDependencyOpError.new(op.inspect) if op && \\\n ! (VALID_DEP_OPS.include? op)\n\n dependencies << { :name => dep_name, :op => op, :version => dep_version }\n end", "title": "" }, { "docid": "706c08e312ab260b2c052681d8c7bb47", "score": "0.59151906", "text": "def getDeps(name,version)\n #If it's just a bare version number assume it should be explicit requirement\n if !(version.include? ' ') then\n version = \"= \" + version\n end\n\n #Returns an array of hashes one for each possible version for that name\n gem_versions = Gems.dependencies [name]\n\n #If no explicit version is set or a beta version, find a better version\n if version == \">= 0\" or version == \"= 0\" or version =~ /[[:alpha:]]/ then\n gem_versions.each do |gem_version|\n if gem_version[:number] !~ /[[:alpha:]]/ then\n if (Gem::Version.new(gem_version[:number]) < Gem::Version.new(version.split(' ')[1])) or version.split(' ')[1] == \"0\" then\n version = \">= \" + gem_version[:number]\n end\n end\n end\n end\n\n #Add the current gem if the hash key has no value\n if $dependencies[name] == nil then\n $dependencies[name] = Array.new [version]\n else #Otherwise append\n $dependencies[name].push(version)\n end\n \n #Loop through hash array looking for right version\n gem_versions.each do |gem_version|\n\n if gem_version[:number] == version.split(' ')[1] then\n #Loop through the depenencies for a given version\n gem_version[:dependencies].each do |dep|\n dep_name = dep[0]\n dep_version = dep[1]\n exists = false\n\n #If a value exists append to existing key otherwise make a new array\n if $dependencies[dep_name] != nil then\n #Check if that version is already in the hash\n #Only check on versions that haven't been checked yet\n #Should fix endless recursion on circular dependencies\n $dependencies[dep_name].each do |other_version|\n if dep_version == other_version then\n exists = true\n end\n end\n #else\n # $dependencies[dep_name] = Array.new\n end\n\n if exists == false then\n\t #If it's a comma separated list of deps check one at a time\n if dep_version.include? ',' then\n dep_version.split(',').each do |comma_dep|\n getDeps(dep_name,comma_dep)\n end\n\t else #Look for subdependencies\n getDeps(dep_name,dep_version)\n\t end \n end\n end\n end\n end\nend", "title": "" }, { "docid": "801cf49ecb1ff9c722e53e6a4dd19f36", "score": "0.59141344", "text": "def depends(*names, **options)\n\t\t\t\tnames.each do |name|\n\t\t\t\t\tdependencies << Depends.new(name, **options)\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "4071cb88e4205146f45dd91cba1c9fb5", "score": "0.5909476", "text": "def requirements(name, number)\n number = Version::Number.parse(number) #unless Version::Number === number\n @libraries[name][number]\n end", "title": "" }, { "docid": "faf62df4b403f1f9894b2c05ed35f6ea", "score": "0.58960134", "text": "def dependencies\n\n end", "title": "" }, { "docid": "d36b2dad3b97ec9aa865d6ec5d3ebb91", "score": "0.58835816", "text": "def inject_dependencies(dependencies={}); end", "title": "" }, { "docid": "35c93a76651170a3a809ea569e477765", "score": "0.5856962", "text": "def vendored\n deps + dev_deps\n end", "title": "" }, { "docid": "8bc15584cfd8b639adfcae598469a5b2", "score": "0.58427095", "text": "def add(dependency, list)\n dependency.require!\n list << dependency\n @registered[dependency.name] = dependency\n @errors[dependency.name] = dependency.error if dependency.error\n if dependency.satisfied? then\n @available[dependency.name] = dependency\n else\n @available[dependency.name] = nil\n @missing[dependency.name] = dependency\n end\n end", "title": "" }, { "docid": "935b256f99153f96d57ebe5b5642766a", "score": "0.58382577", "text": "def dependencies\n @dependencies ||= self.class.requires.map { |k|\n k.new(fix: @fix, context: @context, shell: @shell, **@options)\n }\n end", "title": "" }, { "docid": "254df578c3f22f1d821ed7544cc2c60a", "score": "0.5832179", "text": "def insert_runtime_dependencies(dd, g)\n\tdd_f = []\n\tdd.each do |dependency|\n\t\tdd_f << {\n\t\t\t'name' => dependency['name'],\n\t\t\t'requirements' => dependency['requirements'],\n\t\t\t'category' => \"runtime\"\n\t\t}\n\tend\n\n\tg.depends.create(dd_f)\nend", "title": "" }, { "docid": "659621d722e9cc462b8ea45bf69604de", "score": "0.58264333", "text": "def install dep_or_name, version = LibGems::Requirement.default\n LibGems.with_rubygems_compat do\n if String === dep_or_name then\n find_spec_by_name_and_version dep_or_name, version, @prerelease\n else\n dep_or_name.prerelease = @prerelease\n @specs_and_sources = [find_gems_with_sources(dep_or_name).last]\n end\n\n @installed_gems = []\n\n gather_dependencies\n\n @gems_to_install.each do |spec|\n last = spec == @gems_to_install.last\n # HACK is this test for full_name acceptable?\n next if @source_index.any? { |n,_| n == spec.full_name } and not last\n\n # TODO: make this sorta_verbose so other users can benefit from it\n say \"Installing bpkg #{spec.full_name}\" if LibGems.configuration.really_verbose\n\n _, source_uri = @specs_and_sources.assoc spec\n begin\n local_gem_path = LibGems::RemoteFetcher.fetcher.download spec, source_uri,\n @cache_dir\n rescue LibGems::RemoteFetcher::FetchError\n next if @force\n raise\n end\n\n inst = LibGems::Installer.new local_gem_path,\n :bin_dir => @bin_dir,\n :development => @development,\n :env_shebang => @env_shebang,\n :force => @force,\n :format_executable => @format_executable,\n :ignore_dependencies => @ignore_dependencies,\n :install_dir => @install_dir,\n :security_policy => @security_policy,\n :source_index => @source_index,\n :user_install => @user_install,\n :wrappers => @wrappers\n\n spec = inst.install\n\n @installed_gems << spec\n end\n\n @installed_gems\n end\n end", "title": "" }, { "docid": "1313b733996d003b4815a2898ec1fdcb", "score": "0.5814733", "text": "def dependencies\n @lockfile.specs.each_with_object({}) do |gem, h|\n h[gem.name] = [gem.name, gem.version]\n end\n end", "title": "" }, { "docid": "915488fab53c115b02c6aacf4cda4330", "score": "0.5812057", "text": "def depends *syms\n syms.each { |sym| raise ArgumentError, \"unknown option '#{sym}'\" unless @specs[sym] }\n @constraints << [:depends, syms]\n end", "title": "" }, { "docid": "8de3eb4bca04d605180dd6a2150b318a", "score": "0.58098084", "text": "def dependencies\n if Gem::Version.new(version) <= Gem::Version.new('1.50.0')\n [\"biz.aQute:bnd:jar:#{version}\"]\n elsif Gem::Version.new(version) <= Gem::Version.new('2.4.0')\n [\"biz.aQute.bnd:bnd:jar:#{version}\"]\n else\n [\"biz.aQute.bnd:biz.aQute.bnd:jar:#{version}\"]\n end\n end", "title": "" }, { "docid": "a44b9a904f28931ded5542fafc927a15", "score": "0.58053684", "text": "def install dep_or_name, version = Gem::Requirement.default\n if String === dep_or_name then\n find_spec_by_name_and_version dep_or_name, version, @prerelease\n else\n dep_or_name.prerelease = @prerelease\n @specs_and_sources = [find_gems_with_sources(dep_or_name).last]\n end\n\n @installed_gems = []\n\n gather_dependencies\n\n @gems_to_install.each do |spec|\n last = spec == @gems_to_install.last\n # HACK is this test for full_name acceptable?\n next if @source_index.any? { |n,_| n == spec.full_name } and not last\n\n # TODO: make this sorta_verbose so other users can benefit from it\n say \"Installing spd #{spec.full_name}\" if Gem.configuration.really_verbose\n\n _, source_uri = @specs_and_sources.assoc spec\n begin\n local_gem_path = Gem::RemoteFetcher.fetcher.download spec, source_uri,\n @cache_dir\n rescue Gem::RemoteFetcher::FetchError\n next if @force\n raise\n end\n\n inst = Spade::Installer.new local_gem_path,\n :bin_dir => @bin_dir,\n :development => @development,\n :env_shebang => @env_shebang,\n :force => @force,\n :format_executable => @format_executable,\n :ignore_dependencies => @ignore_dependencies,\n :install_dir => @install_dir,\n :security_policy => @security_policy,\n :source_index => @source_index,\n :user_install => @user_install,\n :wrappers => @wrappers\n\n spec = inst.install\n\n @installed_gems << spec\n end\n\n @installed_gems\n end", "title": "" }, { "docid": "6f1444bf83eff08973669b4906ab74d8", "score": "0.58039397", "text": "def install_dependencies(spec)\n di = nil\n\n if options[:dep_user_install]\n di = Gem::DependencyInstaller.new(:install_dir => Gem.user_dir)\n else\n di = Gem::DependencyInstaller.new\n end\n\n $RG_T_INSTALLING_DEPENDENCIES = true\n spec.development_dependencies.each do |dep|\n unless Gem.source_index.search(dep).last\n if config[\"install_development_dependencies\"] || Gem.configuration.verbose == false\n say \"Installing test dependency #{dep.name} (#{dep.requirement})\"\n di.install(dep) \n else\n if ask_yes_no(\"Install development dependency #{dep.name} (#{dep.requirement})?\", true)\n say \"Installing test dependency #{dep.name} (#{dep.requirement})\"\n di.install(dep) \n else\n alert_error \"Failed to install dependencies required to run tests. Aborting.\"\n raise Gem::TestError, \"dependencies not installed\"\n end\n end\n end\n end\n $RG_T_INSTALLING_DEPENDENCIES = false\n true\n end", "title": "" }, { "docid": "2d8a3e44e8119b11d4ed372da3054224", "score": "0.5801836", "text": "def setDependency(preReq)\n @depList << preReq\n end", "title": "" }, { "docid": "ea0ca82f20263782fed2bcf1199419ae", "score": "0.57948506", "text": "def initialize(name, version, dependencies = {})\n @name = name.to_s\n @version = version.to_s\n @dependencies = dependencies\n end", "title": "" }, { "docid": "95627edd26059882118ffe37cc076ac3", "score": "0.57872057", "text": "def requirements(reqs)\n error \"python.requirements parameter is a string\" unless\n reqs.kind_of?(String)\n puts \"Checking Python requirements...\"\n installed = installed_dependencies()\n content = File.read(reqs).strip\n dependencies = {}\n for line in content\n if line =~ /.+==.+/\n name, version = line.scan(/[^=]+/).map{|e| e.strip}\n dependencies[name] = version\n elsif line.strip.length > 0\n dependencies[line.strip] = nil\n end\n end\n check_dependencies(dependencies, installed)\n end", "title": "" }, { "docid": "52746e9e310094fcf1e6f9736bc8e4c3", "score": "0.5777756", "text": "def add_versions(package, versions)\n versions.each do |version, dependencies|\n add_version package, version, dependencies\n end\n end", "title": "" }, { "docid": "7573bb7ed8b4baa2039acdf0d7a82812", "score": "0.5771476", "text": "def add_dependency(opts)\n opts = check_params(opts,[:dependencies])\n super(opts)\n end", "title": "" }, { "docid": "7573bb7ed8b4baa2039acdf0d7a82812", "score": "0.5771476", "text": "def add_dependency(opts)\n opts = check_params(opts,[:dependencies])\n super(opts)\n end", "title": "" }, { "docid": "2f4ab933166c395fc094ccf476783166", "score": "0.57671183", "text": "def dependency(name, required: false, default: NO_DEFAULT, type: NO_TYPE)\n dependencies[name] = DependencyDefinition.new(\n name: name,\n required: required,\n default: default,\n type: type,\n klass: self\n )\n end", "title": "" }, { "docid": "3929ad10a14f0532441a5028d8b00704", "score": "0.5765816", "text": "def depends(*syms)\n syms.each { |sym| raise ArgumentError, \"unknown option '#{sym}'\" unless @specs[sym] }\n @constraints << [:depends, syms]\n end", "title": "" }, { "docid": "8396c5e935a46647d9a4b96efb50ae57", "score": "0.5748376", "text": "def depends_on_mob(name, options={})\n @dependencies << [name, options]\n end", "title": "" }, { "docid": "2de72877aa65c055ff0713d716fbc4a8", "score": "0.5741913", "text": "def local_ruby_dep name, *other_deps\n other_deps_string = other_deps.inject(\"\") do | a, e |\n a + \" \" + e\n end\n new_entry \"#{name}: #{name}.rb#{other_deps_string}\"\n tab \"ruby $(RUBYOPT) #{name}.rb >[email protected]\"\n commit\n end", "title": "" }, { "docid": "4077de18968ca0f6c8e8c4beff676c20", "score": "0.57414234", "text": "def add_dependency(args)\n gem_dependencies << args\n end", "title": "" }, { "docid": "e389d023fccfe0078b60810180adf234", "score": "0.57273716", "text": "def dependency(dependency, version = nil)\n dependency = Juicer::Install.get(dependency) if [String, Symbol].include?(dependency.class)\n\n @dependencies[dependency.to_s + (version || \"\")] = [dependency, version]\n end", "title": "" }, { "docid": "a93d77ac6b3f6aaeac045ec33307eef4", "score": "0.57198656", "text": "def add_dependency(name, constraint = nil, options = {})\n if @dependencies[name]\n # Only raise an exception if the dependency is a true duplicate\n groups = (options[:group].nil? || options[:group].empty?) ? [:default] : options[:group]\n unless (@dependencies[name].groups & groups).empty?\n raise DuplicateDependencyDefined.new(name)\n end\n end\n\n # this appears to be dead code\n # if options[:path]\n # metadata_file = File.join(options[:path], \"metadata.rb\")\n # end\n\n options[:constraint] = constraint\n\n @dependencies[name] = Dependency.new(self, name, options)\n end", "title": "" }, { "docid": "136dd2f863ed2e66dcdf8ed803fa8dd9", "score": "0.57141584", "text": "def dependency(package, version, constraint)\n ensure_package version\n @cache[package][version] << constraint\n end", "title": "" }, { "docid": "1aba307930bf21779b41021336c24f26", "score": "0.5708471", "text": "def dependency(dep, ver = nil)\n @dep_loader.add_dependency dep, ver\n end", "title": "" }, { "docid": "ff932e0b34b22f7a5e60e575b4685455", "score": "0.5691965", "text": "def depends_on(*dependencies)\n update_context(:dependencies => dependencies)\n end", "title": "" }, { "docid": "b8bfd0aa718d2ba62352bad6d670a663", "score": "0.56890124", "text": "def dependencies; end", "title": "" }, { "docid": "b8bfd0aa718d2ba62352bad6d670a663", "score": "0.56890124", "text": "def dependencies; end", "title": "" }, { "docid": "b8bfd0aa718d2ba62352bad6d670a663", "score": "0.56890124", "text": "def dependencies; end", "title": "" }, { "docid": "b8bfd0aa718d2ba62352bad6d670a663", "score": "0.56890124", "text": "def dependencies; end", "title": "" }, { "docid": "b8bfd0aa718d2ba62352bad6d670a663", "score": "0.56890124", "text": "def dependencies; end", "title": "" }, { "docid": "b8bfd0aa718d2ba62352bad6d670a663", "score": "0.56890124", "text": "def dependencies; end", "title": "" }, { "docid": "a876d460a7d929f69bcab04afb779734", "score": "0.56826216", "text": "def depends_on(dep)\n @dependencies << dep\n end", "title": "" }, { "docid": "ff2b60ba53e403f9b1c2a8ab9028257f", "score": "0.56790763", "text": "def requirements\n # if this cookbook has it's location specified, we instead return it's\n # dependencies as we don't need to resolve them elsewhere\n\n if load_dependencies?\n explicit_location? ? cookbook.dependencies : { name => version_requirement }\n else\n explicit_location? ? {} : { name => version_requirement }\n end\n end", "title": "" }, { "docid": "5fb14353ef7a4e73624fce5b2f549770", "score": "0.56670034", "text": "def gem(name, options = {})\n @gems << Rails::GemDependency.new(name, options)\n end", "title": "" }, { "docid": "7afd1fa293bd9739925a1feba401d37e", "score": "0.56624824", "text": "def add_runtime_dependency dependency, *requirements\n requirements = if requirements.empty? then\n Gem::Requirement.default\n else\n requirements.flatten\n end\n\n unless dependency.respond_to?(:name) &&\n dependency.respond_to?(:version_requirements)\n\n dependency = Gem::Dependency.new(dependency, requirements, :runtime)\n end\n\n gems << dependency\n end", "title": "" }, { "docid": "19af502a24b31cb8345ac7badc023702", "score": "0.56597894", "text": "def gem_requires name, options # :nodoc:\n if options.include? :require then\n if requires = options.delete(:require) then\n @requires[name].concat Array requires\n end\n else\n @requires[name] << name\n end\n end", "title": "" }, { "docid": "7cd09dcfa0b0b56314f68def6459bf20", "score": "0.5653131", "text": "def create_dependencies\n FPM::Program.new.run dep_params\n end", "title": "" }, { "docid": "bc38adefe30496462a894bbe6842d070", "score": "0.56426966", "text": "def parse_dependency name, op # :nodoc:\n return Gem::Dependency.new name unless peek[0] == :text\n\n _, version, = get :text\n\n requirements = [\"#{op} #{version}\"]\n\n while peek[0] == :comma do\n get :comma\n _, op, = get :requirement\n _, version, = get :text\n\n requirements << \"#{op} #{version}\"\n end\n\n Gem::Dependency.new name, requirements\n end", "title": "" }, { "docid": "59282e091e84906abc6dec6657633dd8", "score": "0.56375873", "text": "def add_dependencies(gem_name, gem_meta)\n gem_meta.dependencies.each do |dep|\n @nodes[gem_name].dependencies << @nodes[dep.name] if @nodes[dep.name]\n @nodes[dep.name].references << @nodes[gem_name] if @nodes[dep.name]\n end\n end", "title": "" }, { "docid": "37aa9f9a64199a4dd7b60255b5773c7e", "score": "0.5629659", "text": "def add_dependency(param_str, args={})\n params = param_str.split(\",\")\n version_id = params.delete_at(0)\n dep_hash = {\"version_id\" => version_id}.merge(params.separate_to_hash(\"=\")).merge(args)\n if dep_hash[\"internal\"]\n dep_hash[\"internal\"]=true\n end\n dep_hash.extend(DependencyMethods)\n dependencies << dep_hash\n dep_hash\n end", "title": "" }, { "docid": "bbeea209e1c0ffb710381aae8aebcbbe", "score": "0.5628227", "text": "def make_gemspec( name, version, strelka_dep=true )\n\t\tspec = Gem::Specification.new( name, version )\n\t\tspec.add_runtime_dependency( 'strelka', '~> 0.0' ) if strelka_dep\n\t\treturn spec\n\tend", "title": "" }, { "docid": "bbeea209e1c0ffb710381aae8aebcbbe", "score": "0.5628227", "text": "def make_gemspec( name, version, strelka_dep=true )\n\t\tspec = Gem::Specification.new( name, version )\n\t\tspec.add_runtime_dependency( 'strelka', '~> 0.0' ) if strelka_dep\n\t\treturn spec\n\tend", "title": "" }, { "docid": "7912849a64ee155948faf21125fbde47", "score": "0.56175584", "text": "def add_dependency( notation, scope = nil )\n @project.addDependency( notation, scope )\n end", "title": "" }, { "docid": "156cdc9d606665fa6a421e4322613035", "score": "0.5603717", "text": "def add_dependency(name, source)\n @dependencies[name] = source\n end", "title": "" }, { "docid": "cc5f5213db9296182707d576f83ce167", "score": "0.5598091", "text": "def depends(dep)\n @dependencies << dep\n end", "title": "" }, { "docid": "dc01e73f687f650f0c21fe4fb870edc5", "score": "0.5589644", "text": "def add(resource, depends_on=[], generators={})\n @dep[resource['name']] = [ resource, depends_on, generators ]\n end", "title": "" }, { "docid": "cfab649cfdff17c8d5c334d83e713605", "score": "0.5568351", "text": "def depends(name)\n puts \"depends(#{name})\" if ENV['DEBUG']\n fileinfo = @data_loader_files[name.to_sym]\n raise RuntimeError, \"Unsatisfied dependency '#{name}'\" unless fileinfo\n raise RuntimeError, \"Circular Data Dependency in '#{name}'\" if fileinfo[:state] == :requested\n \n fileinfo[:state] = :requested unless fileinfo[:state] == :loaded\n @data_loader_files.load_file(name.to_sym)\n end", "title": "" }, { "docid": "1ebfb0379a805abd450119da5d1207c2", "score": "0.55607957", "text": "def dependencies(*list)\n @dependencies ||= []\n @dependencies += list\n list.each do |dep|\n if dep =~ /^gem:\\s*(.*)\\s*$/\n dep = $1.split(/\\s+/)\n raise(ArgumentError, 'Invalid gem specification') if dep.length < 1\n name = dep[0]\n version = dep.length > 1 ? dep[1..-1].join(' ') : '>= 0'\n gem name, version\n else\n raise(RuntimeError, \"Could not load dependency #{dep} for #{name}\") if !Plugin.load(dep)\n end\n end\n @dependencies\n end", "title": "" }, { "docid": "a228c966c3bf08deb5339098a4e8dc99", "score": "0.55569005", "text": "def depends_on(plugin_name, version)\n dependencies[plugin_name] = version\n end", "title": "" }, { "docid": "a228c966c3bf08deb5339098a4e8dc99", "score": "0.55569005", "text": "def depends_on(plugin_name, version)\n dependencies[plugin_name] = version\n end", "title": "" }, { "docid": "9a80536aeade43b4a78b053a6d50d1a5", "score": "0.5535684", "text": "def add_gem_dependency(name, options = {})\n Rails.configuration.gem(name, options)\n end", "title": "" }, { "docid": "af64467455234f6503946fdb02619f9b", "score": "0.5521067", "text": "def add_version(package, version, dependencies)\n artifact = @graph.artifact(package, version)\n\n dependencies.each do |dependency|\n add_dependency artifact, *dependency\n end\n rescue\n if @options[:verbose]\n puts \"WARNING: Could not add version #{version} to #{package}.\"\n end\n end", "title": "" }, { "docid": "7ade2375c94a110292edc8a854d26537", "score": "0.5510217", "text": "def add_dependency(artifact, package, version)\n artifact.depends package, version\n rescue\n if @options[:verbose]\n puts \"\n WARNING: Could not add dependency #{package}-#{version} to #{artifact}\n \".strip\n end\n end", "title": "" }, { "docid": "662a11fd625d3afa8dd7ae1d7314e2bd", "score": "0.55018824", "text": "def update_dependencies()\n\t\"cd #{self.config_dir} ; #{self.binary} vendor #{(@debug ? '-d' : '-q')} #{Dir.pwd}/cookbooks\"\n end", "title": "" }, { "docid": "728499506fa91eaf71c71621a3547f6d", "score": "0.54925686", "text": "def define_deps_tasks\n namespace :deps do\n desc \"List all the dependent gems of this gem\"\n task :list do\n deps_list_task\n end\n\n desc \"Print a contact list for gems dependent on this gem\"\n task :email do\n deps_email_task\n end\n\n desc \"Fetch all the dependent gems of this gem into tarballs\"\n task :fetch do\n deps_fetch_task\n end\n end\n\n desc \"Install missing dependencies.\"\n task :check_extra_deps do\n check_extra_deps_task\n end\n\n desc \"Install missing plugins.\"\n task :install_plugins do\n install_missing_plugins\n end\n end", "title": "" }, { "docid": "d34c2d917bc6af14b3dbbe1be72ea0e2", "score": "0.54855776", "text": "def gem(name, options = {})\n @gems << Divinity::GemDependency.new(name, options)\n end", "title": "" }, { "docid": "0def3373daa615248310b5cf7956b7a2", "score": "0.54841304", "text": "def check(name_or_spec, version=nil)\n gem_deps = {}\n spec = name_or_spec.is_a?(String) ? Gem::Specification.find_all_by_name(name_or_spec, version) : [name_or_spec]\n spec.each do |s|\n spec_deps = {}\n walk_deps(s).each do |k,v|\n spec_deps[k] = v[:not_found] unless v[:not_found].empty?\n end\n gem_deps[s.full_name] = spec_deps unless spec_deps.empty?\n end\n gem_deps\n end", "title": "" } ]
27a4ca981c779747c8c7113208e97ccb
PATCH/PUT /damages/1 or /damages/1.json
[ { "docid": "4e9b977e52da7aa3944f30dea89368e8", "score": "0.7497913", "text": "def update\n respond_to do |format|\n if @damage.update(damage_params)\n format.html { redirect_to @damage, notice: \"Damage was successfully updated.\" }\n format.json { render :show, status: :ok, location: @damage }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @damage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "ad113299eefa97bcfeae63a097e687df", "score": "0.7629979", "text": "def update\n @damage = Damage.find(params[:id])\n\n respond_to do |format|\n if @damage.update_attributes(params[:damage])\n format.html { redirect_to @damage, notice: 'Damage was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @damage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0fa576b2f8396449279d01e9f4b054a4", "score": "0.6831835", "text": "def update\n respond_to do |format|\n if @damage_type.update(damage_type_params)\n format.html { redirect_to @damage_type, notice: 'Damage type was successfully updated.' }\n format.json { render :show, status: :ok, location: @damage_type }\n else\n format.html { render :edit }\n format.json { render json: @damage_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d78a49b137ee467cfe598517143a11f", "score": "0.68317443", "text": "def update\n respond_to do |format|\n if @damage_vulnerability.update(damage_vulnerability_params)\n format.html { redirect_to @damage_vulnerability, notice: 'Damage vulnerability was successfully updated.' }\n format.json { render :show, status: :ok, location: @damage_vulnerability }\n else\n format.html { render :edit }\n format.json { render json: @damage_vulnerability.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc4e4786ab02cb4d7f4da3d00c633a39", "score": "0.66521263", "text": "def set_damage\n @damage = Damage.find(params[:id])\n end", "title": "" }, { "docid": "ab2a0646171d02ee7b8a00e80968a631", "score": "0.62657195", "text": "def update\n respond_to do |format|\n if @damagebook.update(damagebook_params)\n format.html { redirect_to @damagebook, notice: '损坏图书信息更新成功!' }\n format.json { render :show, status: :ok, location: @damagebook }\n else\n format.html { render :edit }\n format.json { render json: @damagebook.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eba447a013b5940316bc4a5ad303fd07", "score": "0.6224825", "text": "def show\n @damage = Damage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @damage }\n end\n end", "title": "" }, { "docid": "cfede53bbcd7056cf252c5b919cbea2d", "score": "0.6089945", "text": "def set_damage_vulnerability\n @damage_vulnerability = DamageVulnerability.find(params[:id])\n end", "title": "" }, { "docid": "4a75a67ae63eda1b6bff79fc94085a20", "score": "0.60256535", "text": "def set_damage_type\n @damage_type = DamageType.find(params[:id])\n end", "title": "" }, { "docid": "4e97a65c8271539a6dccf2681c5932bb", "score": "0.5963452", "text": "def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9f92ec8451bf88efca2fa39b3c00f10", "score": "0.5900505", "text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3554989c7770a8fe94945611ab31734b", "score": "0.58790475", "text": "def create\n @damage = Damage.new(params[:damage])\n\n respond_to do |format|\n if @damage.save\n format.html { redirect_to @damage, notice: 'Damage was successfully created.' }\n format.json { render json: @damage, status: :created, location: @damage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @damage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bad621cfea696eddc8871cf58b32fc46", "score": "0.5876101", "text": "def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "466ba8cc9af02ea4eef1b1296c549101", "score": "0.58458537", "text": "def update\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n if @gauge.update_attributes(params[:gauge])\n format.html { redirect_to @gauge, notice: 'Gauge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cac8123bbc84bb7533e8476a0ed977e6", "score": "0.5823845", "text": "def update\n @weapon = Weapon.find(params[:id])\n\n if @weapon.update(weapon_params)\n head :no_content\n else\n render json: @weapon.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a1c88d4707537daf942721cd6c36c3ed", "score": "0.58048826", "text": "def update\n @mugshot = Mugshot.find(params[:id])\n\n respond_to do |format|\n if @mugshot.update_attributes(params[:mugshot])\n format.html { redirect_to @mugshot, notice: 'Mugshot was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mugshot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ea26e989e8560e07de1d1af9745d9c0", "score": "0.5797603", "text": "def create\n @damage = Damage.new(damage_params)\n\n respond_to do |format|\n if @damage.save\n format.html { redirect_to @damage, notice: \"Damage was successfully created.\" }\n format.json { render :show, status: :created, location: @damage }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @damage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3f2c52c8909ce5d8ff606d5ba6ed9e5", "score": "0.57865053", "text": "def destroy\n @damage = Damage.find(params[:id])\n @damage.destroy\n\n respond_to do |format|\n format.html { redirect_to damages_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "40dd154ccba0b74ea4b4a300ebfa95f6", "score": "0.57762074", "text": "def new\n @damage = Damage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @damage }\n end\n end", "title": "" }, { "docid": "2be5836efb83a8511fe7b9aba0cc8589", "score": "0.5758703", "text": "def update\n if @gift.user == @current_user\n if @gift.update(gift_params)\n render json: @gift, include: :ages\n else\n render json: @gift.errors, status: :unprocessable_entity\n end\n else\n render json: { errors: \"not authorized\" }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "a2a4578592cb81f64cd81ddcc6357ec5", "score": "0.5756996", "text": "def update\n @shot = Shot.find(params[:id])\n @shot.update_attributes(shot_params)\n respond_with @shot\n end", "title": "" }, { "docid": "041d99b9f4a5c0160f36e9bc144a3677", "score": "0.5741277", "text": "def update\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n if @genotype.update_attributes(params[:genotype])\n format.html { redirect_to @genotype, notice: 'Genotype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @genotype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0ffbf1d4addcefe73d0d5a37e1828d7e", "score": "0.5733013", "text": "def update\n @gage = Gage.find(params[:id])\n\n respond_to do |format|\n if @gage.update_attributes(params[:gage])\n format.html { redirect_to @gage, notice: 'Gage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e7663d0348b74542ff1d2f4fd96156fe", "score": "0.5729722", "text": "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "title": "" }, { "docid": "24b44eaf14be08433e930b5dd486def8", "score": "0.57207483", "text": "def update\n @affectation = Affectation.find(params[:id])\n\n respond_to do |format|\n if @affectation.update_attributes(params[:affectation])\n format.html { redirect_to affectations_path, notice: 'Affectation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @affectation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44f20ec2b407329ceff9bd5745ae05fe", "score": "0.57153326", "text": "def damage_params\n params.require(:damage).permit(:state, :primary, :secondary, :value, :details, :vehicle_id, :user_id)\n end", "title": "" }, { "docid": "8d6a61f3186174209e44862cb0ae05d7", "score": "0.5708713", "text": "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "title": "" }, { "docid": "3e64108a8d865e497fd60b47677799e3", "score": "0.57066005", "text": "def update\n respond_to do |format|\n if @manage_glow.update(manage_glow_params)\n format.html { redirect_to @manage_glow, notice: 'Manage glow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @manage_glow.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a58668820553a17d31e2cc77feeda8ea", "score": "0.57015926", "text": "def update\n @hit = Hit.find(params[:id])\n\n respond_to do |format|\n if @hit.update_attributes(params[:hit])\n format.html { redirect_to @hit, notice: 'Hit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d160e65cea172e1c9af8d3ea398007d", "score": "0.5680332", "text": "def update\n @gift = Gift.find(params[:id])\n\n respond_to do |format|\n if @gift.update_attributes(params[:gift])\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f3aae216844d7a4639dd36a1ffe70b3", "score": "0.56509006", "text": "def update\n @garbage = Garbage.find(params[:id])\n\n respond_to do |format|\n if @garbage.update_attributes(params[:garbage])\n format.html { redirect_to @garbage, notice: 'Garbage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @garbage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b34086964210a6d650664567b2d2625", "score": "0.5643726", "text": "def update\n respond_to do |format|\n if @mile.update(mile_params)\n format.html { redirect_to @mile, notice: 'Mile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ebac67e6be91551202e6a6efc8841463", "score": "0.5638963", "text": "def setDamage _obj, _args\n \"_obj setDamage _args;\" \n end", "title": "" }, { "docid": "b6d684353ff76566c0bd53501d608515", "score": "0.5637207", "text": "def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end", "title": "" }, { "docid": "20a9724e9a0c0268ea51c924f6b618d8", "score": "0.5629524", "text": "def update\n @weapon_kind = WeaponKind.find(params[:id])\n\n respond_to do |format|\n if @weapon_kind.update_attributes(params[:weapon_kind])\n format.html { redirect_to @weapon_kind, notice: 'Weapon kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weapon_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15348a78a33fe50390d4f796a93407f3", "score": "0.562831", "text": "def update\n respond_to do |format|\n if @growth.update(growth_params)\n format.html { redirect_to @growth, notice: 'Growth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @growth.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63cd9307b3dd7ca5e6b8dd37755ee2ca", "score": "0.5627363", "text": "def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbd2d5ffacc265bcf60973cd2df1e286", "score": "0.56208247", "text": "def update\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n if @infographic.update_attributes(params[:infographic])\n format.html { redirect_to :back, notice: 'Infographic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @infographic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d74796ad5d443ddafdce5ae03ac8033", "score": "0.56143355", "text": "def update\n respond_to do |format|\n if @attack_height.update(attack_height_params)\n format.html { redirect_to @attack_height, notice: 'Attack height was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attack_height.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f584321792709ff70fd4d4fc6de881e", "score": "0.56102663", "text": "def update\n respond_to do |format|\n if @badge.update(badge_params)\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { render :show, status: :ok, location: @badge }\n else\n format.html { render :edit }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6470048dd52b16b50fd23c03c0d2ef96", "score": "0.56067115", "text": "def update\n authorize! :update, @impact_level\n respond_to do |format|\n if @impact_level.update(impact_level_params)\n format.html { redirect_to @impact_level, notice: 'Impact level was successfully updated.' }\n format.json { render :show, status: :ok, location: @impact_level }\n else\n format.html { render :edit }\n format.json { render json: @impact_level.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62e661f6c620ab4bcd79123c765a490c", "score": "0.55984056", "text": "def update\n @weapon_type = WeaponType.find(params[:id])\n\n if @weapon_type.update(weapon_type_params)\n head :no_content\n else\n render json: @weapon_type.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e569e52c5a6b7220719cfda7484a24c0", "score": "0.5597661", "text": "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to root_path, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0db3fe7213621df07964bc159d4a4f0e", "score": "0.5591985", "text": "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97c424d873111c1c8d3ced40db82bb63", "score": "0.55836236", "text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to(@shot, :notice => 'Shot was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shot.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2666b4d3c2b1f928f59e9501d2f97bc9", "score": "0.5566275", "text": "def update\n @weapon = Weapon.find(params[:id])\n\n respond_to do |format|\n if @weapon.update_attributes(params[:weapon])\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42514be4028ad61f160d602e14c447c5", "score": "0.55593264", "text": "def update\n @dice = Dice.find(params[:id])\n\n if @dice.update(dice_params)\n head :no_content\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c0fdcca7f0bd33ee62ff453d8c4a484b", "score": "0.5555302", "text": "def update\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n if @golfer.update_attributes(params[:golfer])\n format.html { redirect_to @golfer, notice: 'Golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golfer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3aff817772b3f403c10a69b4ea048140", "score": "0.5541942", "text": "def set_damagebook\n @damagebook = Damagebook.find(params[:id])\n end", "title": "" }, { "docid": "f06d836c2604bd79c91c7d4293062c9d", "score": "0.55395335", "text": "def update\n respond_to do |format|\n if @health.update(health_params)\n format.html { redirect_to @health, notice: 'Health was successfully updated.' }\n format.json { render :show, status: :ok, location: @health }\n else\n format.html { render :edit }\n format.json { render json: @health.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a6d1e76ee52a173e787efd902928134", "score": "0.55234677", "text": "def update\n respond_to do |format|\n if @asset_loss.update(asset_loss_params)\n format.html { redirect_to @asset_loss, notice: 'Asset loss was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_loss }\n else\n format.html { render :edit }\n format.json { render json: @asset_loss.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6cae80ca04e9002d4a7f0e6398d4b5fc", "score": "0.55196035", "text": "def update\n \n respond_to do |format|\n if @shot.update(shot_params)\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { render :show, status: :ok, location: @shot }\n else\n format.html { render :edit }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a432009de156939775bd87afa85f69d6", "score": "0.55152786", "text": "def update\n @experience = Experience.find(params[:id])\n respond_to do |format|\n if @experience.update_attributes(params[:experience])\n format.html { redirect_to @experience, notice: 'Experience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7af15e0d8655eb734b72c4a4dff60d1d", "score": "0.55152214", "text": "def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7af15e0d8655eb734b72c4a4dff60d1d", "score": "0.55152214", "text": "def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: 'Weapon was successfully updated.' }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e06d1b231b5b6f93bb3ed7d3f6f8f3e7", "score": "0.5513103", "text": "def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c7fef891505b51a25fccaf556ac890d", "score": "0.5512351", "text": "def update\n respond_to do |format|\n if @graveyard.update(graveyard_params)\n format.html { redirect_to @graveyard, notice: 'Graveyard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @graveyard.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4ed8564772889642e0616884980724c", "score": "0.5509148", "text": "def update\n @rpm = Rpm.find(params[:id])\n @rpm.save\n respond_to do |format|\n if @rpm.update_attributes(params[:rpm])\n format.html { redirect_to imprimir_rpm_path(@rpm) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rpm.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5011c7a2ff1c412fa7f30949cf2fce1f", "score": "0.54985845", "text": "def update\n @lost_pet = LostPet.find(params[:id])\n\n respond_to do |format|\n if @lost_pet.update_attributes(params[:lost_pet])\n format.html { redirect_to @lost_pet, notice: 'Lost pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lost_pet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33c46a8f2ff72b2f2e9c3d1cf290bb9c", "score": "0.54976255", "text": "def update\n respond_to do |format|\n if @weapon.update(weapon_params)\n format.html { redirect_to @weapon, notice: \"Weapon was successfully updated.\" }\n format.json { render :show, status: :ok, location: @weapon }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @weapon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea6344c9a8f057d2c9917ba91a42e502", "score": "0.54965305", "text": "def gets_damage(damages)\n @life_points -= damages\n if life_points > 0\n puts \"#{name} a perdu #{damages}, il lui reste #{life_points} points de vie\"\n else\n puts \"#{name} a perdu #{damages}, #{name} a été tué\"\n end\n end", "title": "" }, { "docid": "22bc5a3b12518c8cf4009309454aa258", "score": "0.54953295", "text": "def update\n respond_to do |format|\n if @voxel.update(voxel_params)\n format.html { redirect_to @voxel, notice: '更新されました!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @voxel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d4ef989d8743bdf8c57e55d4d894dddc", "score": "0.54930097", "text": "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "title": "" }, { "docid": "a13ad5ed16cb395bd31f1165b3ab3d7a", "score": "0.54921305", "text": "def update\n @regulation = Regulation.find(params[:id])\n\n respond_to do |format|\n if @regulation.update_attributes(params[:regulation])\n format.html { redirect_to @regulation, notice: 'Regulation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @regulation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c0116e532480bccbccdf20b1f2e4cde7", "score": "0.54903585", "text": "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a53c36becde87694e36b10d69ce32c74", "score": "0.54871625", "text": "def modify(name: nil, avatar: nil, channel_id: nil)\n RestClient.patch(@url, { name: name, avatar: avatarise(avatar), channel_id: channel_id }.compact.to_json, content_type: :json)\n end", "title": "" }, { "docid": "f65a318aa6d70c322b8cb73db2de1c15", "score": "0.5478982", "text": "def update\n @voxel = Voxel.find(params[:id])\n \n respond_to do |format|\n if @voxel.update_attributes(params[:voxel])\n format.html { redirect_to @voxel, notice: 'Voxel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voxel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aac0d29f953a151adda9a6df35059f46", "score": "0.54761237", "text": "def update\n respond_to do |format|\n if @badge.update(badge_params)\n format.html { redirect_to([:admin, @badge], notice: 'Badge was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated badge: #{@badge.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @badge.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43f7dda1c3f1ac195fd3986227cb2934", "score": "0.5470013", "text": "def set_damage_buffer\n @damage_buffer = DamageBuffer.find(params[:id])\n end", "title": "" }, { "docid": "9bbce8edacfc51023e7dec8c2d4b6c06", "score": "0.5469856", "text": "def update\n @shoot = Shoot.find(params[:id])\n\n respond_to do |format|\n if @shoot.update_attributes(params[:shoot])\n format.html { redirect_to @shoot, notice: 'Shoot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shoot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f083c487f09a4f7eb97f0c9dada8eb11", "score": "0.54666716", "text": "def update\n respond_to do |format|\n if @sausage.update(sausage_params)\n format.html { redirect_to @sausage, notice: 'Sausage was successfully updated.' }\n format.json { render :show, status: :ok, location: @sausage }\n else\n format.html { render :edit }\n format.json { render json: @sausage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6eddf15605851198cb1f19714d1003f9", "score": "0.54613686", "text": "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "title": "" }, { "docid": "3b5b0a1c8a1adf2d2f7a5a1f93a60b0f", "score": "0.5450423", "text": "def update\n @mostsmalleffect = Mostsmalleffect.find(params[:id])\n\n respond_to do |format|\n if @mostsmalleffect.update_attributes(params[:mostsmalleffect])\n format.html { redirect_to @mostsmalleffect, notice: 'Mostsmalleffect was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmalleffect.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8faccd3564b3955c59a229532f90061b", "score": "0.5450332", "text": "def update\n respond_to do |format|\n if @in_game_gift.update(in_game_gift_params)\n format.html { redirect_to @in_game_gift, notice: 'In game gift was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @in_game_gift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6f97138a75aaa44158635afe10903c5a", "score": "0.5446778", "text": "def update\n @texture = Texture.find(params[:id])\n\n respond_to do |format|\n if @texture.update_attributes(params[:texture])\n format.html { redirect_to @texture, :notice => 'Texture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @texture.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed2403080f09af79d5a9702a8554d0c7", "score": "0.54359734", "text": "def update\n authorize! :manage, Pupil\n respond_to do |format|\n if @pupil.update(pupil_attrs)\n format.html { redirect_to @pupil, notice: t('action.update.succeed', entity: Pupil.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd8fe5dd8044a29e57e6bc95c7a05f05", "score": "0.543184", "text": "def update\n respond_to do |format|\n if @inventory_need.update(inventory_need_params)\n format.html { redirect_to @inventory_need }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory_need.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8504f3aff7619cbe607c027305e8f53b", "score": "0.54280996", "text": "def update\n respond_to do |format|\n if @miss.update(miss_params)\n format.html { redirect_to @miss, notice: 'Miss was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @miss.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c6522822a4ad478780c196dc400ec64", "score": "0.5420812", "text": "def update\n respond_to do |format|\n if @gift.update(gift_params)\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { render :show, status: :ok, location: @gift }\n else\n format.html { render :edit }\n format.json { render json: @gift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c6522822a4ad478780c196dc400ec64", "score": "0.5420812", "text": "def update\n respond_to do |format|\n if @gift.update(gift_params)\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { render :show, status: :ok, location: @gift }\n else\n format.html { render :edit }\n format.json { render json: @gift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa9d0b0ca6116043535673470427a2fe", "score": "0.5420036", "text": "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "title": "" }, { "docid": "90738f7bd2a4feb26e429fbdb8b1f9e3", "score": "0.5415873", "text": "def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40c9ffe1584b3a5491b119c514e39699", "score": "0.54135925", "text": "def update\n respond_to do |format|\n if @usage.update(usage_params)\n format.html { redirect_to @usage, notice: 'Usage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @usage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6289f6635f5eab74459a1edb784f017", "score": "0.5412702", "text": "def update\n respond_to do |format|\n if @achievement.update_attributes(achievement_params)\n format.html { redirect_to @achievement, notice: 'Achievement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @achievement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85d5a7f709d5008ca7b3929043c6a86b", "score": "0.54073364", "text": "def update\n respond_to do |format|\n if @health_level.update_attributes(params[:health_level])\n format.html { redirect_to @health_level, notice: 'Health level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @health_level.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "90b5d54e58f5745b342369cff6eadd6b", "score": "0.5406591", "text": "def update\n @person = Person.find(params[:id])\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to people_url,\n notice: \"Cast member #{@person.full_name} was successfully updated.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors,\n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cde4b71908619094d03bc7ee0883a408", "score": "0.54064035", "text": "def update\n @pix = Pix.find(params[:id])\n\n respond_to do |format|\n if @pix.update_attributes(params[:pix])\n format.html { redirect_to @pix, notice: 'Pix was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pix.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1512d572f5b15928a0579bda0a9ab031", "score": "0.5400164", "text": "def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: I18n.t('Pet card was successfully updated') }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff76791513a2fe4fcf32e8cd694de83a", "score": "0.53988683", "text": "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render json: {\"message\" => \"Pet was successfully updated\", \"success\" => true, \"data\" => @pet}, status: :created, location: @pet }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f8b4d0bd4cecc760681d7d699c9f17b", "score": "0.53964627", "text": "def update\n @good = Good.find(params[:id])\n\n respond_to do |format|\n if @good.update_attributes(params[:good])\n format.html { redirect_to :action => \"index\" }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @good.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "27b6049a2c8ac506896df71a109df238", "score": "0.53946304", "text": "def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "09438b387fc841f14ff350c02bb09196", "score": "0.53941226", "text": "def update\n @badge = Badge.find(params[:id])\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n flash[:notice] = 'Badge was successfully updated.'\n format.html { redirect_to organization_segment_badge_url(@organization,@segment, @badge) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef3f9f6faea7e47016c3989eb76e3374", "score": "0.5393733", "text": "def update\n @admissive_volume = AdmissiveVolume.find(params[:id])\n\n respond_to do |format|\n if @admissive_volume.update_attributes(params[:admissive_volume])\n format.html { redirect_to @admissive_volume, notice: 'Admissive volume was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admissive_volume.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af860fde01e47983b0ae30c0c05ac4ee", "score": "0.5392737", "text": "def update\n respond_to do |format|\n if @api_v1_reward.update(api_v1_reward_params)\n format.html { redirect_to @api_v1_reward, notice: 'Reward was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_reward }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_reward.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1a2b0c8adab51fdf2530fe385658f37", "score": "0.53922284", "text": "def update\n respond_to do |format|\n if @manage_heal.update(manage_heal_params)\n format.html { redirect_to @manage_heal, notice: 'Manage heal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @manage_heal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b15d89dc4848bb25d1e91cd3d804e6c9", "score": "0.53884846", "text": "def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15c01fc46236b8283c9c7d3016b7f61c", "score": "0.53878397", "text": "def update\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n if @glass.update_attributes(params[:glass])\n format.html { redirect_to @glass, notice: 'Glass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glass.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70749958c5779b9df1199a7f0beee5c9", "score": "0.53865606", "text": "def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0fe3edb392568a207187798c99936dbc", "score": "0.538501", "text": "def update\n @open_shoot = OpenShoot.find(params[:id])\n\n respond_to do |format|\n if @open_shoot.update_attributes(params[:open_shoot])\n format.html { redirect_to @open_shoot, notice: 'Open shoot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @open_shoot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd6986ceed413c0930de8fa36e6d45d0", "score": "0.53842074", "text": "def update\n @effect_experience_effect = Effect::ExperienceEffect.find(params[:id])\n\n respond_to do |format|\n if @effect_experience_effect.update_attributes(params[:effect_experience_effect])\n format.html { redirect_to @effect_experience_effect, notice: 'Experience effect was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @effect_experience_effect.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09aa3d59f34cde799c7c9ca26535ec14", "score": "0.5381548", "text": "def update\n respond_to do |format|\n if @gift.update(gift_params)\n if params[:gift][:img] !=nil\n @gift.update(:img => params[:gift][:img].read) # <= バイナリをセット\n @gift.update(:img_content_type => params[:gift][:img].content_type) # <= ファイルタイプをセット\n else\n # @gift.update(:img => Gift.find(1).img) # <= バイナリをセット\n # @gift.update(:img_content_type => Gift.find(1).img_content_type) # <= ファイルタイプをセット\n end\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { render :show, status: :ok, location: @gift }\n else\n format.html { render :edit }\n format.json { render json: @gift.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
88809ff84b3b2c7f22ad841e5dd895e2
POST /feeds POST /feeds.json
[ { "docid": "69b7a461290970374d45fe30eae32d62", "score": "0.64976615", "text": "def create\n @feed = Feed.new(feed_params)\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feed }\n else\n format.html { render action: 'new' }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "2e8a15707e9607497708ec6dca35a57a", "score": "0.7148137", "text": "def create\n @user = User.find(params[:user_id])\n @feed = Feed.new(feed_params)\n @user.feeds << @feed\n\n if @feed.save\n render json: @feed, status: :created\n else\n render json: @feed.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "14922dd8514c87d3f0acc64f3e4dfb8e", "score": "0.71030927", "text": "def update_feeds\n JSON.parse(params[:feeds]).each{|options|\n options.symbolize_keys!\n create_item options, @member\n }\n render json: {result: true}\n end", "title": "" }, { "docid": "3c18e51c06c90c226e161ff3ce83ffe6", "score": "0.67441565", "text": "def create\n @feed = Feed.create_from_rss(params[:feed][:url])\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render json: @feed, status: :created, location: @feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4bf2a8cc5def0866d7c809086ef83117", "score": "0.6712073", "text": "def save\n self.client.api_post(\"/feed\", self.create_params)\n end", "title": "" }, { "docid": "e286a993516034831e727c151cccbb2e", "score": "0.66617566", "text": "def create\n @feed = Feed.new(params[:feed])\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render json: @feed, status: :created, location: @feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "231f094700d39e16bb46edfb34e8e35a", "score": "0.66606206", "text": "def create\n @feed = Feed.new(params[:feed])\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render json: @feed, status: :created, location: @feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4207c17a93e0d727877a2714d7b35863", "score": "0.6642456", "text": "def create\n @feed = Feed.new(feed_params)\n respond_to do |format|\n if @feed.save\n format.html { redirect_to feeds_path, notice: \"Feed created.\" }\n format.json { render action: 'show', status: :created, location: @feed }\n else\n format.html { render action: 'new' }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b18e44f261eea500978c9b07d848c25", "score": "0.65670896", "text": "def create\n @feed = Feed.new(feed_params)\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "450de849bcbd03f826308a23e52c8071", "score": "0.6555643", "text": "def create\n @feed = Feed.new(feed_params)\n if @feed.save\n respond_to do |format|\n format.html { redirect_to @feed, notice: 'Successfully created.' }\n format.json { render json: @feed, status: :created, location: @feed }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a578ec0dcc0d5a87cf5624fd7a6da8f9", "score": "0.65539134", "text": "def create\n @feed = Feed.new(feed_params)\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a578ec0dcc0d5a87cf5624fd7a6da8f9", "score": "0.65539134", "text": "def create\n @feed = Feed.new(feed_params)\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a578ec0dcc0d5a87cf5624fd7a6da8f9", "score": "0.65539134", "text": "def create\n @feed = Feed.new(feed_params)\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a578ec0dcc0d5a87cf5624fd7a6da8f9", "score": "0.65539134", "text": "def create\n @feed = Feed.new(feed_params)\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df3a667a80fb1e51dbc74c213b91d586", "score": "0.6483605", "text": "def create\n @feed = Feed.new(params[:feed])\n\n # TODO: refactor this ish\n feed = Feedzirra::Feed.fetch_and_parse(@feed[:link])\n\n @feed[:title] = feed.title\n @feed[:description] = feed.description\n @feed[:user_id] = current_user.id\n \n success = @feed.save\n\n feed.entries.reverse_each do |item|\n @feed.items.create(description: item.summary,\n title: item.title,\n link: item.url,\n published: item.published,\n read: false)\n end\n\n respond_to do |format|\n format.html{\n if success\n flash[:success] = \"Feed created!\"\n redirect_to @feed \n else\n flash.now[:error] = \"Something wrong!\"\n render new\n end\n }\n format.js\n end\n\n end", "title": "" }, { "docid": "b6347be7c4d4c4be6cf0fac5d899f667", "score": "0.64396745", "text": "def create\n @rss_feed = RssFeed.new(rss_feed_params)\n\n if @rss_feed.wrong_raw_items\n\n render json: @rss_feed.errors, status: :unprocessable_entity\n else\n rss_items = @rss_feed.raw_items\n rss_items.each { |r|\n @rss_feed.rss_feed_items.build(title: r.title, url: r.link, summary: r.description, read: false, date: r.date, rss_feed_id: RssFeed.count + 1)\n }\n respond_to do |format|\n if @rss_feed.save\n rss_items = @rss_feed.rss_feed_items\n format.json { render json: [@rss_feed,rss_items], status: :created}\n else\n format.json { render json: @rss_feed.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "63f27971520f6c495e919270e86795f4", "score": "0.64235187", "text": "def create\n @feed = Feed.new(params[:feed])\n\n respond_to do |format|\n if @feed.valid? && is_valid_feed_url?(@feed.feed_url)\n @feed.save\n format.html { redirect_to feeds_path, notice: 'Feed was successfully created.' }\n format.json { render json: @feed, status: :created, location: @feed }\n else\n flash.now[:error] = \"Invalid Feed URL\"\n format.html { render action: \"new\" }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "02434edbe843751c0783300f61725483", "score": "0.64119613", "text": "def create\n @feed = Feed.new(params[:feed])\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to(feeds_url, :notice => 'Feed was successfully created.') }\n format.xml { render :xml => @feed, :status => :created, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97fc814b70c2a90186e431440ca4c63a", "score": "0.64069396", "text": "def create\n @feed = Feed.new(\n :url => feed_params[:url],\n :title => UrlHelper.normalize(feed_params[:url])\n )\n\n if @feed.save\n @feed.update_from_remote\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Mmmm more feeds.' }\n format.json { render :show, status: :created, location: @feed }\n end\n else\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed48c03e30c7abdcee72619e9ef5f3ef", "score": "0.6405946", "text": "def create\n @newsfeeds = Newsfeed.new(params[:id])\n\n respond_to do |format|\n if @newsfeeds.save\n format.html { redirect_to @newsfeeds, notice: 'Newsfeed was successfully created.' }\n format.json { render json: @newsfeeds, status: :created, location: @newsfeeds }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newsfeeds.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "54a91ae403a14a3e291364fa9f878244", "score": "0.6404154", "text": "def create\n @feed = Feed.new(params[:feed])\n @feed.user_id = current_user.id\n\n respond_to do |format|\n if @feed.save\n if params[:feed][:filters]\n params[:feed][:filters].keys.each do |f|\n filter = Filter.find_or_create_by_key_and_value(f.to_s, params[:feed][:filters][f.to_sym].to_s)\n @feed.filters << filter\n end\n end\n if ! params[:feed][:keywords].nil?\n params[:feed][:keywords].split(' ').each do |k|\n keyword = Keyword.find_or_create_by_value(k)\n @feed.keywords << keyword\n end\n end\n @feed.load_items\n \n format.html { redirect_to(@feed, :notice => 'Feed was successfully created.') }\n format.json { render :json => @feed, :status => :ok, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => { :errors => @feed.errors.full_messages }, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9cf73dd2a369c080550562ec1dbbfd80", "score": "0.6353495", "text": "def create\n @feed = Feed.new(params[:feed])\n\n respond_to do |format|\n if rss_validator && @feed.save\n format.html { redirect_to @feed, notice: 'Rss reader was successfully created.' }\n format.json { render json: @feed, status: :created, location: @feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ea1a5eb4e802fb4f391cba738220fdc", "score": "0.63347965", "text": "def add_to_many(activity_data, feeds)\n data = {\n feeds: feeds,\n activity: activity_data\n }\n signature = Stream::Signer.create_jwt_token('feed', '*', @api_secret, '*')\n make_request(:post, '/feed/add_to_many/', signature, {}, data)\n end", "title": "" }, { "docid": "85e9a4168f9d36cf0d3809aa2a74d850", "score": "0.6315812", "text": "def create\n @feed = Feed.new(feed_params)\n\n respond_to do |format|\n if @feed.save\n check_feed(@feed)\n format.html { redirect_to feeds_url, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2572d1126d17a13d9115fbb65b75e94", "score": "0.6311886", "text": "def create_feed\n end", "title": "" }, { "docid": "c2572d1126d17a13d9115fbb65b75e94", "score": "0.6311886", "text": "def create_feed\n end", "title": "" }, { "docid": "c2572d1126d17a13d9115fbb65b75e94", "score": "0.6311886", "text": "def create_feed\n end", "title": "" }, { "docid": "e70b09e615246d1d59228d9e757d57d7", "score": "0.6261223", "text": "def create\n @rssfeed = Rssfeed.new(params[:rssfeed])\n \n respond_to do |format|\n if @rssfeed.save\n format.html { redirect_to @rssfeed, notice: 'Rssfeed was successfully created.' }\n format.json { render json: @rssfeed, status: :created, location: @rssfeed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rssfeed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5299430f3e2aa0cd8450f130752d8286", "score": "0.62014544", "text": "def create\n @feed = Feed.new(params[:feed])\n\n respond_to do |format|\n if @feed.save\n flash[:notice] = 'Feed was successfully created.'\n format.html { redirect_to(@feed) }\n format.xml { render :xml => @feed, :status => :created, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e62fcf1a89bba51dace2698b3849bc72", "score": "0.61877143", "text": "def create\n @rss_feed = RssFeed.new(rss_feed_params)\n\n respond_to do |format|\n if @rss_feed.save\n format.html { redirect_to @rss_feed, notice: 'Rss feed was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rss_feed }\n else\n format.html { render action: 'new' }\n format.json { render json: @rss_feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2090fa443126d733f157484f490cf902", "score": "0.618317", "text": "def create\n @feed = Feed.new(params[:feed])\n @feed.user = current_user\n\n respond_to do |format|\n if @feed.save\n flash[:notice] = 'Feed was successfully created.'\n format.html { redirect_to(user_feeds_path(current_user)) }\n format.xml { render :xml => @feed, :status => :created, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85fefabcec1e259406fb5ae2206ad9d2", "score": "0.6154396", "text": "def create \n item = FeedItem.new(feed_params.merge({ user_id: @user.id }))\n if item.save\n render json: item\n else\n render json: { errors: item.errors.full_messages }\n end\n end", "title": "" }, { "docid": "2909d45748293e9245ff44af104628f2", "score": "0.61382836", "text": "def create\n @news_feed = NewsFeed.new(params[:news_feed])\n\n respond_to do |format|\n if @news_feed.save\n format.html { redirect_to @news_feed, notice: 'News feed was successfully created.' }\n format.json { render json: @news_feed, status: :created, location: @news_feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @news_feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "02c675607098a6bc340fd23a3ae539d6", "score": "0.61142796", "text": "def feed\n client = Feedlr::Client.new(oauth_access_token: ENV[\"FEEDLR_SECRET_KEY\"])\n\n @entries = client.search_feeds('economist')\n render json: @entries\n end", "title": "" }, { "docid": "f8af7c1d15e54cbbe135910919f4d27d", "score": "0.60864526", "text": "def create\n @feed = Feed.new(feed_params)\n @feed.user = current_user\n @feed.last_retrived = Time.now\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cce060d842c73be2c7ff6411dca58e2a", "score": "0.6064706", "text": "def create\n @feed = Feed.new(params[:feed])\n @feed.user_id = current_user.id\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to(url_for(:controller=>'feed_items', :action=>'refresh', :feed_id=>@feed.id)) }\n # format.html { redirect_to(@feed, :notice => 'Feed was successfully created.') }\n format.xml { render :xml => @feed, :status => :created, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c04b6e1ba0dc3a19dd449942c811bab3", "score": "0.6046561", "text": "def create\n user = current_user_or_guest\n @feed = Feed.create params[:feed]\n # URLs uniquely identify feeds, so we may have clashed with an existing one.\n # If so, simply adopt that one.\n # NB If so, we merrily ignore the other attributes being provided as parameters--if any\n if @feed.errors.any?\n @feed = (Feed.where url: @feed.url)[0] || @feed\n end\n if @feed.errors.any?\n resource_errors_to_flash_now @feed # Move resource errors into the flash\n respond_to do |format|\n format.html { render action: \"new\", status: :unprocessable_entity }\n format.json { \n @area = \"floating\"\n dialog_boilerplate \"new\", \"modal\", status: :unprocessable_entity \n }\n end\n else\n redirect_to collect_feed_path(@feed)\n end\n end", "title": "" }, { "docid": "a3e9fcf07d948edc3e07c09a61010ec5", "score": "0.6031787", "text": "def create\n user = current_user\n valid_feed_ids = Rails.application.message_verifier(:valid_feed_ids).verify(params[:valid_feed_ids])\n @subscriptions = Subscription.create_multiple(params[:feeds].to_unsafe_h, user, valid_feed_ids)\n if @subscriptions.present?\n @click_feed = @subscriptions.first.feed_id\n end\n @mark_selected = true\n get_feeds_list\n end", "title": "" }, { "docid": "a3e9fcf07d948edc3e07c09a61010ec5", "score": "0.6031787", "text": "def create\n user = current_user\n valid_feed_ids = Rails.application.message_verifier(:valid_feed_ids).verify(params[:valid_feed_ids])\n @subscriptions = Subscription.create_multiple(params[:feeds].to_unsafe_h, user, valid_feed_ids)\n if @subscriptions.present?\n @click_feed = @subscriptions.first.feed_id\n end\n @mark_selected = true\n get_feeds_list\n end", "title": "" }, { "docid": "ad4f4109469352654821e24a23664f32", "score": "0.6001806", "text": "def create\n @feed_subscription = FeedSubscription.create_from_button(params[:user_id], params[:feed_id])\n x = Feed.find(params[:feed_id])\n respond_to do |format|\n format.html { redirect_to \"/feeds/#{x.id}\" }\n format.json { render json: @feed_subscription, status: :created, location: @feed_subscription }\n end\n end", "title": "" }, { "docid": "3765ea9cdee5de9e31ae2f51ed844100", "score": "0.5997556", "text": "def create\n @feed = Feed.new(feed_params)\n @feed.user_id = current_user.id \t\t\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feed }\n else\n format.html { render action: 'new' }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ada69acafccc3568d1628677c84cd295", "score": "0.5974836", "text": "def create\n @rss_feed = RssFeed.new(rss_feed_params)\n @rss_feed.user = @current_user\n \n respond_to do |format|\n if @rss_feed.save\n format.html { redirect_to rss_feeds_url, notice: 'Rss feed was successfully created.' }\n format.json { render :show, status: :created, location: @rss_feed }\n else\n format.html { render :new }\n format.json { render json: @rss_feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "300579c01c44afc7ba164b1bd4143f67", "score": "0.5963634", "text": "def post_data\n rss = RSS::Parser.parse(@news_url, false)\n rss.items.each do |item|\n response = HTTParty.post(\"#{@@base_uri}channels/#{@channel_id}/posts\",\n headers: {\n \"Authorization\" => @@api_key,\n \"Content-Type\" => \"application/json\"\n }, \n body:{\n \"contents\": {\n \"en_US\": {\n \"content\": \"#{item.description}\",\n \"teaser\": \"New Article!!!\",\n \"title\": \"#{item.title}\", \n \"image\": \"#{item.enclosure.url}\"\n }\n }\n }.to_json \n ) \n end\n end", "title": "" }, { "docid": "87cfe8a63eaaef2c7ce9da33bed2503c", "score": "0.5953471", "text": "def feed_params\n params.require(:feed).permit(:url, :name)\n end", "title": "" }, { "docid": "eaa72fb8cf50fee3cf84f5aeff0393e7", "score": "0.59377754", "text": "def create\n @feed = Feed.new(params[:feed])\n @feed.feed_body = fetch(@feed.link).body\n\n respond_to do |format|\n if @feed.save\n flash[:notice] = 'Feed was successfully created.'\n format.html { redirect_to(@feed) }\n format.xml { render :xml => @feed, :status => :created, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db7f7cd6ee2a5bdaf17a33fa0d02791f", "score": "0.5932259", "text": "def create_feed(client, customer_id)\n # Creates the feed operation.\n operation = client.operation.create_resource.feed do |feed|\n feed.name = \"Real Estate Feed ##{(Time.new.to_f * 1000).to_i}\"\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :STRING\n fa.name = \"Listing ID\"\n end\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :STRING\n fa.name = \"Listing Name\"\n end\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :URL_LIST\n fa.name = \"Final URLs\"\n end\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :URL\n fa.name = \"Image URL\"\n end\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :STRING_LIST\n fa.name = \"Contextual Keywords\"\n end\n end\n\n # Issues a mutate request to add the feed and print some information.\n response = client.service.feed.mutate_feeds(\n customer_id: customer_id,\n operations: [operation],\n )\n feed_resource_name = response.results.first.resource_name\n puts \"Feed with resource name #{feed_resource_name} was created.\"\n\n feed_resource_name\nend", "title": "" }, { "docid": "630a1f5434606f9c896720f530b4098f", "score": "0.59286404", "text": "def create\n @feed = @app.feeds.new(feed_params)\n begin\n require \"rss\"\n items = RSS::Parser.parse(open(@feed.url).read, false).items\n if @feed.save\n flash[:success] = 'Le flux a bien été créé'\n else\n flash[:alert] = 'Impossible de créer le flux'\n end\n rescue\n flash[:alert] = 'Ce flux est invalide'\n end\n \n redirect_to @app\n \n end", "title": "" }, { "docid": "6bc50ef9e2eec15333f04c045228f3d6", "score": "0.5917075", "text": "def create\n @twitterfeed = Twitterfeed.new(twitterfeed_params)\n\n respond_to do |format|\n if @twitterfeed.save\n format.html { redirect_to @twitterfeed, notice: 'Twitterfeed was successfully created.' }\n format.json { render :show, status: :created, location: @twitterfeed }\n else\n format.html { render :new }\n format.json { render json: @twitterfeed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad0440d8e56ce33ae1de5f558abb0510", "score": "0.59133714", "text": "def create\n creation = FeedManager.create(current_user, params[:feed][:url], collection_job_results_url(current_user))\n\n creation.success do |feed, notice|\n respond_to do |format|\n format.html do\n flash[:notice] = notice\n redirect_to feeds_path\n end\n format.js { @feed = feed }\n end\n end\n\n creation.failed do |feed, error|\n @feed = feed\n flash.now[:error] = error\n render :action => 'index'\n end\n end", "title": "" }, { "docid": "e42cd91b633d356a95c0e8ecc26ea3a9", "score": "0.5901976", "text": "def create\n @feed = Feed.new(feed_params)\n\n respond_to do |format|\n if @feed.save\n @feed.refresh_cache!\n format.html { redirect_to feeds_path, notice: 'Feed was successfully created.' }\n format.json { render json: @feed, status: :created, location: @feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2d8a282191ff05e89c16aaff0db08df", "score": "0.58945644", "text": "def create_feed(client, customer_id)\n # Creates the feed operation.\n operation = client.operation.create_resource.feed do |feed|\n feed.name = \"Flights Feed ##{(Time.new.to_f * 1000).to_i}\"\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :STRING\n fa.name = \"Flight Description\"\n end\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :STRING\n fa.name = \"Destination ID\"\n end\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :STRING\n fa.name = \"Flight Price\"\n end\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :STRING\n fa.name = \"Flight Sale Price\"\n end\n feed.attributes << client.resource.feed_attribute do |fa|\n fa.type = :URL_LIST\n fa.name = \"Final URLs\"\n end\n end\n\n # Issues a mutate request to add the feed and print some information.\n response = client.service.feed.mutate_feeds(\n customer_id: customer_id,\n operations: [operation],\n )\n feed_resource_name = response.results.first.resource_name\n puts \"Feed with resource name #{feed_resource_name} was created.\"\n\n feed_resource_name\nend", "title": "" }, { "docid": "43541a4c6da4eaf5af743be908a8c0b8", "score": "0.5886186", "text": "def feed_params\n params.require(:feed).permit(:user_id, :feed_name, :feed_url, :feed_entries, :tag_list)\n end", "title": "" }, { "docid": "43541a4c6da4eaf5af743be908a8c0b8", "score": "0.5886186", "text": "def feed_params\n params.require(:feed).permit(:user_id, :feed_name, :feed_url, :feed_entries, :tag_list)\n end", "title": "" }, { "docid": "660eb0a749387b1f4ea145be179f2485", "score": "0.58814824", "text": "def create\n @notag_list = true\n @dl_feed = DlFeed.new(params[:dl_feed])\n\n respond_to do |format|\n if @dl_feed.save\n flash[:notice] = 'DlFeed was successfully created.'\n format.html { redirect_to(@dl_feed) }\n format.xml { render :xml => @dl_feed, :status => :created, :location => @dl_feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dl_feed.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "83b4bfd0c2c2a4ff187862415be5814c", "score": "0.58781666", "text": "def create_new\n http = Net::HTTP.new('docs.google.com', 443)\n http.use_ssl = true\n path = '/feeds/default/private/full'\n headers = {\n 'Content-Type' => 'application/x-www-form-urlencoded',\n 'Host' => 'docs.google.com',\n 'GData-Version' => '3.0',\n 'Content-Length' => '287',\n 'Content-Type' => 'application/atom+xml',\n 'Authorization' => \"GoogleLogin auth=#{self.auth_token}\"\n }\n\ndata =<<END\n<?xml version='1.0' encoding='UTF-8'?>\n<entry xmlns=\"http://www.w3.org/2005/Atom\">\n <category scheme=\"http://schemas.google.com/g/2005#kind\"\n term=\"http://schemas.google.com/docs/2007#document\"/>\n <title>new document</title>\n</entry>\nEND\n\n resp, data = http.post(path, data, headers)\n\n puts data\n end", "title": "" }, { "docid": "6c370555b6b4a6f75fe58f2a91601907", "score": "0.5877893", "text": "def create\n @feed_entry = FeedEntry.new(feed_entry_params)\n\n respond_to do |format|\n if @feed_entry.save\n format.html { redirect_to feed_entries_path, notice: 'Feed entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feed_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @feed_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f361d9fa529d7886700e7dc4e4e2166", "score": "0.58777463", "text": "def feed_params\n params.require(:feed).permit(:name, :url, :interval, :description, :last_retrived, :list_id)\n end", "title": "" }, { "docid": "28dc769ab98151085a1d47d863789aae", "score": "0.58747756", "text": "def create\n @feed_item = FeedItem.new(params[:feed_item])\n\n respond_to do |format|\n if @feed_item.save\n format.html { redirect_to @feed_item, notice: 'Feed item was successfully created.' }\n format.json { render json: @feed_item, status: :created, location: @feed_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c36b7274f6cc8fe916ce45c11d74c886", "score": "0.5874482", "text": "def readers\n @posts = fetch_feeds(Feed.all.collect { |f| f.feed_url })\n respond_to do |format|\n format.html # readers.html.erb\n format.json { render json: @posts }\n end\n end", "title": "" }, { "docid": "10b1163a511daf2b35da51aae10b78be", "score": "0.5870806", "text": "def create\n @feed_news = FeedNew.new(params[:feed_news])\n\n respond_to do |format|\n if @feed_news.save\n format.html { redirect_to @feed_news, notice: 'Feed new was successfully created.' }\n format.json { render json: @feed_news, status: :created, location: @feed_news }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed_news.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5da842126ec18b1bd273fafd7897e3de", "score": "0.5864654", "text": "def index\n @feeds = Feed.all\n\n render json: @feeds\n end", "title": "" }, { "docid": "53551347c56894299eeb7335b872c8e3", "score": "0.58573204", "text": "def feed_params\n params.require(:feed).permit(:title, :feed_url, :favicon_url)\n end", "title": "" }, { "docid": "97711d1f92698cec24466b2cc1b5bdd0", "score": "0.58540976", "text": "def create\n @feed = Feed.new(params[:feed])\n if request.xhr?\n @feed_for = params[:message].scan(/@([A-Za-z0-9_]+)/).last.first if params[:message].scan(/@([A-Za-z0-9_]+)/).last\n @feed.message = params[:message]\n @feed.user_id = params[:id].to_i\n @feed.feed_for = @feed_for\n if @feed.save\n render :text => @feed.id\n return\n else\n render :text => \"failure\"\n end\n end\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, :notice => 'Feed was successfully created.' }\n format.json { render :json => @feed, :status => :created, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @feed.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e81b2477dd77a201141a9f9b8111c6cb", "score": "0.5849821", "text": "def feed_params\n params.require(:feed).permit(:name, :url)\n end", "title": "" }, { "docid": "863d5c00ec2c5bca70a3c720f52fe719", "score": "0.5836344", "text": "def feed_params\n params.require(:feed).permit(:feed_text, :date)\n end", "title": "" }, { "docid": "78c96ffb49f9095fd05c7a4f1fc5bd63", "score": "0.5836089", "text": "def feed_docs_with_references\n feed(:file => @data_dir + \"feed-0.json\")\n end", "title": "" }, { "docid": "55a336ede037fec06aab654af74a9744", "score": "0.5824768", "text": "def feed_params\n params.require(:feed).permit(:url, :name)\n end", "title": "" }, { "docid": "50c4b2a68f4d9f14a8249d0b909fc7c3", "score": "0.58232784", "text": "def feed_params\n params.require(:feed).permit(:url)\n end", "title": "" }, { "docid": "27535f7288c01516d81e980b669fad7d", "score": "0.5819443", "text": "def create\n @newsfeed = Newsfeed.new(params[:newsfeed])\n\n respond_to do |format|\n if @newsfeed.save\n format.html { redirect_to @newsfeed, notice: 'Newsfeednachricht wurde erfolgreich erstellt.' }\n format.json { render action: 'show', status: :created, location: @newsfeed }\n else\n format.html { render action: 'new' }\n format.json { render json: @newsfeed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6d7a0338ecfdedcb8165c336f21711a", "score": "0.5802568", "text": "def create\n @feed_url = FeedUrl.new(params[:feed_url])\n\n respond_to do |format|\n if @feed_url.save\n format.html { redirect_to @feed_url, notice: 'Feed url was successfully created.' }\n format.json { render json: @feed_url, status: :created, location: @feed_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed_url.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3f27df40735c07210ccebc70c7e0c6c", "score": "0.5799692", "text": "def index\n @feeds = Feed.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feeds }\n end\n end", "title": "" }, { "docid": "b176bc6071de6573d51f9360f86d106e", "score": "0.579712", "text": "def feed_params\n params.require(:feed).permit!\n end", "title": "" }, { "docid": "fd9e9fd0b5a3b9e6764e432b9496971d", "score": "0.5796275", "text": "def create\n @feed_item = FeedItem.new(feed_item_params)\n\n respond_to do |format|\n if @feed_item.save\n format.html { redirect_to @feed_item, notice: 'Feed item was successfully created.' }\n format.json { render :show, status: :created, location: @feed_item }\n else\n format.html { render :new }\n format.json { render json: @feed_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66330dacdba2fc63721ff10a9c0bc896", "score": "0.57921165", "text": "def feed(*args)\n username, arguments = extract_username(args)\n feed_key = get_key_from_arguments(arguments)\n\n get api_url(username, 'feeds', feed_key)\n end", "title": "" }, { "docid": "1b095cc3687b18860949dc08cc41c964", "score": "0.57900393", "text": "def feed_params\n params.require(:feed).permit(:name, :url, :description)\n end", "title": "" }, { "docid": "7ab9f6cadfc3cc528089b10bc8482be4", "score": "0.5786449", "text": "def feed_params\n params.fetch(:feed, {}).permit(:name, :url, :cover, :offset, :is_finished, :total_ep_count, :auto_finish)\n end", "title": "" }, { "docid": "cceb9582cd4b5bf0554ad4f2da519a17", "score": "0.5783652", "text": "def create\n @hosted_feed = HostedFeed.new(hosted_feed_params)\n @hosted_feed.user = current_user\n\n respond_to do |format|\n if @hosted_feed.save\n format.html { redirect_to @hosted_feed, notice: 'Hosted feed was successfully created.' }\n format.json { render :show, status: :created, location: @hosted_feed }\n else\n format.html { render :new }\n format.json { render json: @hosted_feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4770a1d17bc918841c4436d0011b48b3", "score": "0.5782268", "text": "def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end", "title": "" }, { "docid": "4770a1d17bc918841c4436d0011b48b3", "score": "0.5782268", "text": "def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end", "title": "" }, { "docid": "4770a1d17bc918841c4436d0011b48b3", "score": "0.5782268", "text": "def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end", "title": "" }, { "docid": "4770a1d17bc918841c4436d0011b48b3", "score": "0.5782268", "text": "def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end", "title": "" }, { "docid": "4770a1d17bc918841c4436d0011b48b3", "score": "0.5782268", "text": "def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end", "title": "" }, { "docid": "4770a1d17bc918841c4436d0011b48b3", "score": "0.5782268", "text": "def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end", "title": "" }, { "docid": "44ab90ef879034449a28f0dda85f77a6", "score": "0.57740957", "text": "def create\n @pinnacle_feed = PinnacleFeed.new(params[:pinnacle_feed])\n\n respond_to do |format|\n if @pinnacle_feed.save\n format.html { redirect_to @pinnacle_feed, notice: 'Pinnacle feed was successfully created.' }\n format.json { render json: @pinnacle_feed, status: :created, location: @pinnacle_feed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pinnacle_feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bb7d7d911b6d1574e9f3f1fa33513ed", "score": "0.5770849", "text": "def data_feeds\n @data_feeds = \"Coming soon!\"\n\n respond_to do |format|\n format.html\n format.xml { render xml: @data_feeds }\n format.json { render json: @data_feeds, callback: params['callback'] }\n end\n end", "title": "" }, { "docid": "f0da4dec79a280488a4513fb4ebe7117", "score": "0.5758511", "text": "def create\n jid = CreateSubscription.perform_async current_user.id,\n params[:feed][:url],\n params[:category][:name].presence\n may_respond_with html: { info: I18n.t('feed.created'), redirect_to: '/' },\n json: { watch: \"create-#{jid}\" }\n end", "title": "" }, { "docid": "23ec7a6780e581488f3c0c1f939a50ac", "score": "0.57568854", "text": "def new\n @title = \"Create New Feed\"\n @feed = Feed.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end", "title": "" }, { "docid": "e0f9cc81a9d658e4739764df7b83a46d", "score": "0.57493734", "text": "def list_feeds(_environment = 'test')\n ret = http_get('feeds')\n val = []\n ret.each { |f| val.push(f['id']) }\n val\n end", "title": "" }, { "docid": "a8776f9deb1186a91911ad0f0494f308", "score": "0.574538", "text": "def feed_params\n params.require(:feed).permit(:feed_url)\n end", "title": "" }, { "docid": "55fb9ba4899d0d049ff61a42daf1fb09", "score": "0.57392853", "text": "def feed(start_date, end_date)\n perform_get('/feed', Neows::Models::Feed, start_date: start_date, end_date: end_date)\n end", "title": "" }, { "docid": "7ef4251bb6b6c2fa3d97d72ecd69ae58", "score": "0.573882", "text": "def feed_fetch_success url, feed\n unless feed\n # not modified\n return\n end\n begin\n f = Feed.filter(:feed_uri => url).first\n f.last_fetch = DateTime.now\n\n # the uri changed (redirection)\n if f.feed_uri != feed.feed_url\n f.feed_uri = feed.feed_url\n end\n\n now = DateTime.now\n # the date of the last post\n if feed.entries.first\n d = feed.entries.first.published ? parse_date(feed.entries.first.published) : now\n if (!f.last_post) || (d > f.last_post)\n f.last_post = d\n end\n end\n f.save\n\n # create the entries\n feed.entries.each do |entry|\n begin\n create_post(entry, f)\n rescue Exception => e\n p \"#{url} #{e}\"\n STDOUT << \"#{e.backtrace.join(\"\\n\")}\\n\"\n end\n end\n\n rescue Exception => e\n p \"#{url} #{e}\"\n STDOUT << \"#{e.backtrace.join(\"\\n\")}\\n\"\n end\n end", "title": "" }, { "docid": "e2b140e18edb683c988dfb374e4bc5cf", "score": "0.5737768", "text": "def create\n @rss_feed = RssFeed.new(params[:rss_feed])\n\n respond_to do |format|\n if @rss_feed.save\n flash[:notice] = 'RssFeed was successfully created.'\n format.html { redirect_to(@rss_feed) }\n format.xml { render :xml => @rss_feed, :status => :created, :location => @rss_feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rss_feed.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a93dfabc7ea4eb115e2e8e545bed5862", "score": "0.5735419", "text": "def create\n @feed_entry = FeedEntry.new(feed_entry_params)\n\n respond_to do |format|\n if @feed_entry.save\n format.html { redirect_to @feed_entry, notice: 'Feed entry was successfully created.' }\n format.json { render :show, status: :created, location: @feed_entry }\n else\n format.html { render :new }\n format.json { render json: @feed_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2db480b50d15b61ed8cb8ee2dbd872ea", "score": "0.5731932", "text": "def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @feed }\n end\n end", "title": "" }, { "docid": "b3d510a24aa62a476241e4f58d6b786d", "score": "0.57294124", "text": "def index\n feed_urls = Feed.all.collect(&:feed_url)\n @feeds = fetch_all_feeds(feed_urls)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feeds }\n end\n end", "title": "" }, { "docid": "46199bb3989abffe5c0400895073f1d7", "score": "0.57260025", "text": "def feed_params\n params.require(:feed).permit(:title, :fetch_url, :homepage_url)\n end", "title": "" }, { "docid": "be601f5baf202ae518abf9ed53714c1f", "score": "0.5722492", "text": "def create\n @circle_feed = CircleFeed.new(circle_feed_params)\n\n respond_to do |format|\n if @circle_feed.save\n format.html { redirect_to @circle_feed, notice: 'Circle feed was successfully created.' }\n format.json { render :show, status: :created, location: @circle_feed }\n else\n format.html { render :new }\n format.json { render json: @circle_feed.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cfaec72f89c2cb699748626ae39e035f", "score": "0.57185835", "text": "def create\n @feed_api = FeedApi.new(params[:feed_api])\n\n respond_to do |format|\n if @feed_api.save\n format.html { redirect_to(@feed_api, :notice => 'FeedApi was successfully created.') }\n format.xml { render :xml => @feed_api, :status => :created, :location => @feed_api }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed_api.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0bafdb5761c639bec14141f197a843cf", "score": "0.57165354", "text": "def activity_feed\n user = params[:id] && params[:id] != \"0\" ? User.find_by_slug_id(params[:id]) : current_user\n not_found(\"User not found\") unless user\n page = params[:p] ? params[:p].to_i : 1\n topic = params[:topic_id] && params[:topic_id] != \"0\" ? Topic.where(:slug_pretty => params[:topic_id].parameterize).first : nil\n posts = Post.activity_feed(user.id, page, topic)\n render :json => posts.map {|p| p.as_json(:properties => :short)}\n end", "title": "" }, { "docid": "b3e7313c4112d813e076195526770c7f", "score": "0.5709237", "text": "def feed\n GET base_url \"/feed\"\n end", "title": "" }, { "docid": "055da04e62cf9358c25c26d4e9488f29", "score": "0.57090294", "text": "def create\n @rss = Rss.new(params[:rss])\n\n respond_to do |format|\n if @rss.save\n format.html { redirect_to @rss, notice: 'Rss was successfully created.' }\n format.json { render json: @rss, status: :created, location: @rss }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rss.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
8d0b8457ddbc6baf6049df84097df1ef
Returns the INode object for the requested path
[ { "docid": "7e94c9b6caabea9c303719f878eab608", "score": "0.6186379", "text": "def node_for_path(path)\n path = path.gsub(%r{^/+|/+$}, '')\n return cache[path] if cache.key? path\n\n # Is it the root node?\n return root_node if path.size == 0\n\n # Attempting to fetch its parent\n (parent_name, base_name) = Tilia::Http::UrlUtil.split_path(path)\n\n # If there was no parent, we must simply ask it from the root node.\n if parent_name == ''\n node = root_node.child(base_name)\n else\n # Otherwise, we recursively grab the parent and ask him/her.\n parent = node_for_path(parent_name)\n\n unless parent.is_a?(ICollection)\n fail Exception::NotFound, \"Could not find node at path: #{path}\"\n end\n\n node = parent.child(base_name)\n end\n\n cache[path] = node\n end", "title": "" } ]
[ { "docid": "8d9f6e62ee73f469a6adec6bb4b48f7b", "score": "0.6687154", "text": "def node(path)\n path_components = scan_path(path)\n\n #not actually injecting anything here, we're just following the hash of hashes...\n path_components.inject(@root) { |dir,file|\n break unless dir[file]\n dir[file]\n }\n end", "title": "" }, { "docid": "144cc7ed581b48f492748448c2cd75c4", "score": "0.65844893", "text": "def path_to_object(path)\n # Note: this algorithm is re-implemented from Grit::Index#add\n arr = path.split('/')\n fname = arr.pop\n curr = self.tree\n arr.each do |dir|\n curr = curr[dir] if curr\n end\n\n #TODO: it would be nice to return a Grit::Blob or Grit::Tree here.\n (curr && fname && curr[fname]) ? curr[fname] : nil\n end", "title": "" }, { "docid": "846f65f4fb62baeafa2534935048a7ae", "score": "0.6363608", "text": "def node(path)\n path_components = scan_path(path)\n\n #not actually injecting anything here, we're just following the hash of hashes...\n path_components.inject(@root) { |dir,file|\n break unless dir.files[file]\n dir.files[file]\n }\n end", "title": "" }, { "docid": "b4c141cb3a989414000feb6cc1bd713b", "score": "0.63199437", "text": "def get_node(path)\n\t\tarray = path.split('/')\n\t\t@cur_branch = @tree\n\t\tarray.each {|arr| @cur_branch = @cur_branch[arr]}\n\n\t\t@cur_branch\n\tend", "title": "" }, { "docid": "686f00647ed255948d67f5a811eb96c3", "score": "0.6244004", "text": "def dirnode(path)\n start, *elements = path_to_elements path\n node elements[0..-2], start\n end", "title": "" }, { "docid": "e3dbf6ce35dbd5d12ce80b4a65b49342", "score": "0.61272365", "text": "def get_node(path, create = false)\n n = @root\n path.sub(/^\\//, \"\").split(\"/\").each do |elem|\n if not n[elem]\n if not create\n return nil\n else\n n[elem] = Node.new(elem)\n end\n end\n n = n[elem]\n end\n if n.nil?\n puts \"Warning, unknown object #{path}\"\n end\n n\n end", "title": "" }, { "docid": "5f780b12426aa4ebb97bc9ba4aff1bdf", "score": "0.60536486", "text": "def get_node(path)\n\t nodes = get_nodes(path)\n\t nodes[0] if nodes\n\t end", "title": "" }, { "docid": "5227b5c55c45fdc41aef3d090a51262b", "score": "0.6017639", "text": "def item_for_path(path)\n node = node_from_path(path)\n\n if node\n item_from_node(node) \n else\n nil\n end\n end", "title": "" }, { "docid": "26d989fda888c77d25fc2d8d6271df03", "score": "0.5917519", "text": "def _find_node(path)\n components = path.split(\"/\")\n return if components.empty?\n result = @entries_by_path.dig(*components)\n return result[:dir] if result.is_a?(Hash)\n return result unless path.end_with?(\"/\")\n end", "title": "" }, { "docid": "e71d36b2a89166c0e57cab458c6ade3a", "score": "0.58346677", "text": "def node(path, from_root: false)\n p = clean(path)\n root = nil\n\n traverse_preorder do |level, node|\n q = from_root ? node.pathname : node.pathname.relative_path_from(pathname)\n if q == p\n root = node\n break\n end\n end\n root\n end", "title": "" }, { "docid": "8badc1bf2374841777b06b9495554c58", "score": "0.5826612", "text": "def node(path, rev = nil)\n if self.class::Node == ::Repository::Abstract::Node\n require_or_load \"#{self.class.name}::Node\".underscore\n end\n self.class::Node.new(self, path, rev)\n end", "title": "" }, { "docid": "5ace8844718cac8c25a52869dd208b77", "score": "0.58054996", "text": "def getInodeType(path)\n\treturn File.directory?(path) ? \"Directory\" : \"File\"\nend", "title": "" }, { "docid": "e97ff9079d7ae1dc9815c9ad040c7d45", "score": "0.56686056", "text": "def [](path)\n _find_node(path)&.data&._relative(@root)\n end", "title": "" }, { "docid": "48f2d17ee9a95a0069f0da80322bbd40", "score": "0.56539047", "text": "def node_or_dir_factory(cls, path, doc_path)\n if cls and cls.valid?(doc_path)\n obj = cls.new(path, doc_path)\n return obj if (File.exist? obj.doc_path)\n end\n dir_node_factory(path, doc_path)\n end", "title": "" }, { "docid": "b789066fe01bc581e07912c27744bb8b", "score": "0.56486744", "text": "def find_object_at_path(path)\n # Get directory names for path in a nice array\n # like ['A1', 'src', 'core'] for '/A1/src/core'\n path = path.split('/')\n\n # Account for the files in the root directory with an extra '/' on end\n path.reject!(&:empty?)\n\n # current_tree is the current directory object we are going through\n # Look at rugged documentation for more info on tree objects\n current_object = @commit.tree\n # While there are still directories to go through to get to path,\n # find the dirname\n path.each do |level|\n # This loop finds the object we're currently looking\n # for in `level` and then looks it up to return\n # a Rugged object (either a tree or a blob)\n current_object = @repo.lookup(\n current_object.detect do |obj|\n obj[:name] == level\n end[:oid])\n end\n # This returns the actual object.\n current_object\n end", "title": "" }, { "docid": "f96e97e89cceff74c48283f1ec4ec517", "score": "0.56102", "text": "def item_at(path:)\n @tree.item_at(path: path)\n end", "title": "" }, { "docid": "f915db39d3a41c100b172dfef9f39f99", "score": "0.5604583", "text": "def path\n @path ||= parse_path\n end", "title": "" }, { "docid": "dfb47aa169473bff65265f4932fd4135", "score": "0.5601803", "text": "def object(path)\n node = get_node(path, true)\n if node.object.nil?\n node.object = ProxyObject.new(@bus, @name, path)\n end\n node.object\n end", "title": "" }, { "docid": "bc8e272c475a4b891bbd038cd19bf741", "score": "0.55764747", "text": "def node_for_path(path, subtree=self, index=0)\n if index == path.length\n subtree\n else\n node_for_path(path, subtree[path[index]], index + 1)\n end\n end", "title": "" }, { "docid": "b290b0515885521054d4bb64c33e90cb", "score": "0.5575577", "text": "def get_node_for_path(user_path)\n case user_path\n when String\n user_path = user_path.split \"/\"\n when Array\n else\n raise ArgumentError, \"Should be Array or String delimited with /\"\n end\n $log.debug \"TREE #{user_path} \" if $log.debug? \n root = @treemodel.root\n found = nil\n user_path.each { |e| \n success = false\n root.children.each { |c| \n if c.user_object == e\n found = c\n success = true\n root = c\n break\n end\n }\n return false unless success\n\n }\n return found\n end", "title": "" }, { "docid": "61a94ed76418089cfe420f68e17c2dc3", "score": "0.5575121", "text": "def walk path\n fid = @fid_pool.obtain\n walk_fid fid, path\n fid\n end", "title": "" }, { "docid": "eec50aad8e7da3e3306f07debed481b4", "score": "0.55651754", "text": "def tree_path\n self[path_tree_opts[:path_column]] || \"\"\n end", "title": "" }, { "docid": "022f34deee35fc987ec129af47274244", "score": "0.55564404", "text": "def path\n raise NotImplementedError\n end", "title": "" }, { "docid": "ebc1aad08cd4108b03649a34299bea1d", "score": "0.5532962", "text": "def get(path)\r\n identifiers = path.split(\".\")\r\n room = self\r\n\r\n identifiers.each do |identifier|\r\n break if room.children[identifier].nil?\r\n room = room.children[identifier]\r\n end\r\n\r\n room\r\n end", "title": "" }, { "docid": "92fb9790abbfe2d9dbbc8ace3cade21d", "score": "0.5531107", "text": "def get_node\n node = nil\n node = $1 if self.current_file.to_s =~ /\\/(\\we\\d)\\//\n node = 'unknown' if node.nil? or node.empty?\n node\n end", "title": "" }, { "docid": "97f615bad1e806fb70f35d06a13414ef", "score": "0.55293924", "text": "def path_to_object\n return @path_to_object unless @path_to_object.nil?\n\n path = nil\n root_dir.each do |root_dir|\n new_path = druid_tree_path(root_dir)\n old_path = old_druid_tree_path(root_dir)\n if File.directory? new_path\n path = new_path\n @folder_style = :new\n break\n elsif File.directory? old_path\n path = old_path\n @folder_style = :old\n break\n end\n end\n @path_to_object = path\n end", "title": "" }, { "docid": "395f17fe52838f98880b09d7adf27dda", "score": "0.5527694", "text": "def node_for_path(path)\n force_public = path[-4..-1] == '.pub'\n path = path[0..-5] if force_public\n parts = path.split('/')\n nodes = []\n parts.each_with_index do |part, depth|\n if part =~ /m/i\n nodes << self\n else\n i = parse_index(part)\n node = nodes.last || self\n nodes << node.subnode(i)\n end\n end\n if force_public or parts.first == 'M'\n node = nodes.last\n node.strip_private_info!\n node\n else\n nodes.last\n end\n end", "title": "" }, { "docid": "a785cc27906fa35398aa4c2c49ff61b0", "score": "0.5524661", "text": "def path\n raise NotImplementedError\n end", "title": "" }, { "docid": "a785cc27906fa35398aa4c2c49ff61b0", "score": "0.5524661", "text": "def path\n raise NotImplementedError\n end", "title": "" }, { "docid": "53d668d1047952bb0dcaa5d867b5bf7c", "score": "0.55144644", "text": "def render_node(path, type)\n case type\n when :absent\n nil\n when :file\n path\n when :directory\n \"#{path}/\"\n else\n \"#{path} (#{type})\"\n end\nend", "title": "" }, { "docid": "796cbb7c262a521f9ca0c0d5d06f921f", "score": "0.55059016", "text": "def walk_path(path)\n object = self\n path.split('/').each do |segment|\n next if segment.empty?\n entry = object.entries.where(name: segment).first\n return nil unless entry\n object = entry.child\n end\n object\n end", "title": "" }, { "docid": "da53c2c26f3731263154a09d749bd43c", "score": "0.549525", "text": "def abs_path\n repo.abs_path path, node_type\n end", "title": "" }, { "docid": "c710cfba6cb4c35e7cd8968bdf1d190a", "score": "0.54937506", "text": "def id\n [node_type.to_s, path].join ':'\n end", "title": "" }, { "docid": "231252bcccbc0c53977ecdc11573051f", "score": "0.54904884", "text": "def path\n @path ||= Path.new parser.extensions\n end", "title": "" }, { "docid": "231252bcccbc0c53977ecdc11573051f", "score": "0.54904884", "text": "def path\n @path ||= Path.new parser.extensions\n end", "title": "" }, { "docid": "6b76c8a97ae0182212bdc70b46e03913", "score": "0.5487946", "text": "def path\n raise NotImplementedError.new('path is not implemented')\n end", "title": "" }, { "docid": "edf83cfef6ce89621dc8bfd3799aca04", "score": "0.5479153", "text": "def object\n @object ||= if directory?\n repo.instantiate_object(@sha1, \"tree\")\n else\n repo.instantiate_object(@sha1, \"blob\")\n end\n end", "title": "" }, { "docid": "8901902007b002c6bdf2ed37d9763f62", "score": "0.5477235", "text": "def set_inode\n @inode = Inode.find(params[:id])\n end", "title": "" }, { "docid": "08ed8751cae2161324084cc6025dac92", "score": "0.546258", "text": "def path\n raise NotImplementedError.new\n end", "title": "" }, { "docid": "7cf2dd78220cd1994f3086f7fd494055", "score": "0.54453176", "text": "def path\n @path\n end", "title": "" }, { "docid": "7cf2dd78220cd1994f3086f7fd494055", "score": "0.54453176", "text": "def path\n @path\n end", "title": "" }, { "docid": "7cf2dd78220cd1994f3086f7fd494055", "score": "0.54453176", "text": "def path\n @path\n end", "title": "" }, { "docid": "7cf2dd78220cd1994f3086f7fd494055", "score": "0.54453176", "text": "def path\n @path\n end", "title": "" }, { "docid": "7cf2dd78220cd1994f3086f7fd494055", "score": "0.54453176", "text": "def path\n @path\n end", "title": "" }, { "docid": "7cf2dd78220cd1994f3086f7fd494055", "score": "0.5444324", "text": "def path\n @path\n end", "title": "" }, { "docid": "7cf2dd78220cd1994f3086f7fd494055", "score": "0.5444234", "text": "def path\n @path\n end", "title": "" }, { "docid": "cd4fd55193b9991afb907aa62fe99a3f", "score": "0.54425013", "text": "def path\n @path\n end", "title": "" }, { "docid": "cd4fd55193b9991afb907aa62fe99a3f", "score": "0.54425013", "text": "def path\n @path\n end", "title": "" }, { "docid": "cd4fd55193b9991afb907aa62fe99a3f", "score": "0.54425013", "text": "def path\n @path\n end", "title": "" }, { "docid": "cd4fd55193b9991afb907aa62fe99a3f", "score": "0.54425013", "text": "def path\n @path\n end", "title": "" }, { "docid": "5c1ac41f11f3259d2744be0e79ae1f25", "score": "0.5439896", "text": "def path\n require 'pathname'\n Pathname.new self\n end", "title": "" }, { "docid": "b002656fd0f67ad00f28f3a7eadd7f1c", "score": "0.5432024", "text": "def get_inode(inode, _ignore_alloc = false)\n return @inode_cache[inode] if @inode_cache.key?(inode)\n group, offset = inode_num_to_group_num(inode)\n gde = gdt[group]\n # raise \"Inode #{inode} is not allocated\" if (not gde.inode_alloc_bmp[offset] and not ignore_alloc)\n @stream.seek(block_to_address(gde.inode_table) + offset * inode_size)\n @inode_cache[inode] = Inode.new(@stream.read(inode_size))\n end", "title": "" }, { "docid": "81b8ff7c51c1428d4322171ac0331aaa", "score": "0.5430638", "text": "def node_for_path(path)\n force_public = path[-4..-1] == \".pub\"\n path = path[0..-5] if force_public\n parts = path.split(\"/\")\n nodes = []\n parts.each_with_index do |part, depth|\n if part =~ /m/i\n nodes << self\n else\n i = parse_index(part)\n node = nodes.last || self\n nodes << node.subnode(i)\n end\n end\n if force_public or parts.first == \"M\"\n node = nodes.last\n node.strip_private_info!\n node\n else\n nodes.last\n end\n end", "title": "" }, { "docid": "b5add8c27f11ec4e85463dbee9ba40de", "score": "0.5430572", "text": "def rugged_tree_entry(path)\n rugged_commit.tree.path(path)\n rescue Rugged::TreeError\n nil\n end", "title": "" }, { "docid": "065c5b9bd915d379045c2318b07582b3", "score": "0.5418633", "text": "def read_from_path path\n if is_new?\n return nil\n end\n\n nodes = path.eval_xpath(@doc)\n if nodes.length == 0\n return nil\n end\n nodes[0].text\n end", "title": "" }, { "docid": "b72a224b41de673e436ebed347b3579d", "score": "0.54005337", "text": "def object(path)\n container.object path\n end", "title": "" }, { "docid": "c4e3fa36d1ebfd1860bde2c2a5caa7d0", "score": "0.5399051", "text": "def dir_node_factory(path, doc_path)\n return nil if (! File.exist? doc_path) and (! File.directory? doc_path)\n ContentRepo::DirNode.new(path, doc_path)\n end", "title": "" }, { "docid": "68ce86ae34b136d1ca43658453ec60f3", "score": "0.5378639", "text": "def get_node_by_path_statement(path)\n return \"hash[\\\"#{path.join('\"][\"')}\\\"]\"\n end", "title": "" }, { "docid": "30bb1bcdd0642e7deb3d07d07d3376e3", "score": "0.53594923", "text": "def path\n return @path\n end", "title": "" }, { "docid": "30bb1bcdd0642e7deb3d07d07d3376e3", "score": "0.53594923", "text": "def path\n return @path\n end", "title": "" }, { "docid": "30bb1bcdd0642e7deb3d07d07d3376e3", "score": "0.53594923", "text": "def path\n return @path\n end", "title": "" }, { "docid": "affab96d873f42417c8c8b50c56bfc42", "score": "0.53546125", "text": "def path; @path; end", "title": "" }, { "docid": "c20ad8060ed0b7548dd1c6ac52844149", "score": "0.5350138", "text": "def path\n @path\n end", "title": "" }, { "docid": "c5f73fb4671130604c5c68c4245b6be7", "score": "0.53500134", "text": "def path\n @path\n end", "title": "" }, { "docid": "bf1869dd9aad9a7f54685fd0f83dac62", "score": "0.5345847", "text": "def path\n @path ||= self.class.path\n end", "title": "" }, { "docid": "0d4d0c6038f7aa83080387ec543d61f4", "score": "0.5345841", "text": "def inode\n File.lstat(self.to_s).ino\n end", "title": "" }, { "docid": "3ba42c27dfb94a25351f0900fac30f35", "score": "0.53391516", "text": "def component_dir() = nodes.first", "title": "" }, { "docid": "416b8a9bdb4088a29a3284985daf5f1a", "score": "0.53348655", "text": "def get(path='.')\n\t NokogiriNode.get(@node, path)\n\t end", "title": "" }, { "docid": "288fee3ad084f7bc9a288ba5c464194a", "score": "0.5334462", "text": "def path\n Pathname(@path.respond_to?(:to_path) ? @path.to_path : @path.to_s).expand_path\n end", "title": "" }, { "docid": "ca091ef0823d0aa88464410727087dcd", "score": "0.53328717", "text": "def path\n object.path\n end", "title": "" }, { "docid": "f72439524cd838265fa76d6a04c20ad2", "score": "0.53277695", "text": "def path\n a = self.addr\n a[1]\n end", "title": "" }, { "docid": "8285305034797d405b23b1fa32953fec", "score": "0.53263235", "text": "def node_factory(path, doc_path, ctype=nil)\n raise 'abstract method!'\n ContentRepo::Node.new(path, doc_path)\n end", "title": "" }, { "docid": "99c3610edf7dc01529250b28bf97c3ba", "score": "0.53255975", "text": "def get_object_for_path(path)\n # TODO Add different file types: processable, resource, etc.\n\n if path.file?\n WebsiteFile.new(path, self)\n\n elsif path.folder?\n WebsiteFolder.new(path, self)\n\n else\n # ignore\n nil\n end\n end", "title": "" }, { "docid": "d6d721b2c08ac4f735efee0679874559", "score": "0.5324081", "text": "def get_path\n Log.add_info(request, params.inspect)\n\n if params[:tree_node_id].blank?\n @folder_path = '/' + t('paren.unknown')\n render(:partial => 'ajax_folder_path', :layout => false)\n return\n end\n\n @selected_id = params[:tree_node_id]\n SqlHelper.validate_token([@selected_id])\n\n @folder_path = Folder.get_path(@selected_id)\n\n render(:partial => 'ajax_folder_path', :layout => false)\n end", "title": "" }, { "docid": "d37c6b17aaa5db4f8a9377757a48782b", "score": "0.5322405", "text": "def path\n name\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "eedef77e0e57dbed8507118ee6298496", "score": "0.53135777", "text": "def path\n @path\n end", "title": "" }, { "docid": "4ee3d98526e04614cc42d0e63420a5fc", "score": "0.5311957", "text": "def _node(dir, type)\n r = _rel(dir, type)\n r && r._other_node(self._java_node)\n end", "title": "" }, { "docid": "ff649ff84781bb23bd2e0f506c746241", "score": "0.5296059", "text": "def path\n @path && Pathname(@path.respond_to?(:to_path) ? @path.to_path : @path.to_s).expand_path\n end", "title": "" }, { "docid": "c96c48a68eab27e9c3c68b7608db6d79", "score": "0.5293108", "text": "def enroot(path)\n branching_class.new(path, self).tap { |e| e.relative! }\n end", "title": "" }, { "docid": "f3dd6f1de09646fdaecae30e66f70a7a", "score": "0.5292361", "text": "def path\n @require_path ||= identifier.gsub(separator, PATH_SEPARATOR).yield_self { |path|\n if namespace\n namespace_path = namespace.to_s.gsub(separator, PATH_SEPARATOR)\n \"#{namespace_path}#{PATH_SEPARATOR}#{path}\"\n else\n path\n end\n }\n end", "title": "" }, { "docid": "90f934f35456d9e5959770d18f4d2b59", "score": "0.528744", "text": "def node_from_path(path)\n path = escape_path(path).downcase\n\n nodes do |node|\n node_path = escape_path(node['href']).downcase\n return node if node_path == path\n end\n\n nil\n\n # raise(\"can't find node for path #{path}\")\n end", "title": "" }, { "docid": "2fb27cba5b65e3f0c0a9fb9f6a4f6c0e", "score": "0.52810043", "text": "def path\n name\n end", "title": "" }, { "docid": "d0be7de0ce8459dbc03f3b24c40631a6", "score": "0.5274623", "text": "def item_at_obj_path(objpath)\n root.instantiate_child(objpath, false, true)\n end", "title": "" }, { "docid": "831d5837759de773f8ab3644a775e509", "score": "0.52644235", "text": "def path\n # returns a string\n throw NotImplementedError\n end", "title": "" }, { "docid": "016c37bdba257260379c852ce4e0998c", "score": "0.52575785", "text": "def get_node_for_path(path, root=nil)\n case root\n when Regexp\n path = path.sub(root,'') \n when String\n re = %r{^#{root}}\n path = path.sub(re,'') \n when nil\n #ok\n else\n raise ArgumentError, \"can only understand string or regexps as roots\" \n end\n db.get_route_silent(path)\n end", "title": "" }, { "docid": "5b290d61f3293fdbf727c4765278800e", "score": "0.5247981", "text": "def path\n return @path\n end", "title": "" }, { "docid": "5b290d61f3293fdbf727c4765278800e", "score": "0.5247981", "text": "def path\n return @path\n end", "title": "" }, { "docid": "fe62fa5c90ad5386933c2235e7000103", "score": "0.524773", "text": "def getPath\n @path\n end", "title": "" }, { "docid": "61e215b6bcccd3695338b9f140de0b7b", "score": "0.5244604", "text": "def path(node = nil)\n if expandable?\n return expand(@path, node)\n else\n return @path\n end\n end", "title": "" }, { "docid": "e30800253c069ed8e085e405d2b5dd34", "score": "0.52384216", "text": "def path\n [@node_name, name].compact.join(\"/\")\n end", "title": "" }, { "docid": "af307b3d19ae249c373fd4d8ac957400", "score": "0.52239966", "text": "def tree_entry(commit, path)\n pathname = Pathname.new(path)\n tmp_entry = nil\n\n pathname.each_filename do |dir|\n tmp_entry = tmp_entry ? @repo.lookup(tmp_entry[:oid])[dir] : commit.tree[dir]\n return nil unless tmp_entry\n end\n tmp_entry\n end", "title": "" }, { "docid": "4dd947c4a1e16607e028da1f1bf07e64", "score": "0.5222049", "text": "def _path\n raise NotImplementedError\n end", "title": "" } ]
cccb28d35d9034be02459a0a8678f362
POST /match_forms POST /match_forms.json
[ { "docid": "62ec6e2b0840fce1cccfaa6519eb20bd", "score": "0.66616917", "text": "def create\n @match_form = MatchForm.new(match_form_params)\n\n respond_to do |format|\n if @match_form.save\n format.html { redirect_to @match_form, notice: 'Match form was successfully created.' }\n format.json { render :show, status: :created, location: @match_form }\n else\n format.html { render :new }\n format.json { render json: @match_form.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "45c5b00fd1fe5f5579e02430faaaa220", "score": "0.6444493", "text": "def index\n @match_forms = MatchForm.all\n end", "title": "" }, { "docid": "df62446c5c8baea57fbe1a743af5e0df", "score": "0.60018903", "text": "def set_match_form\n @match_form = MatchForm.find(params[:id])\n end", "title": "" }, { "docid": "cda529ec3a9d005d0baf4c4262c98417", "score": "0.5788161", "text": "def test_allow_dynamic_form_fields()\n # Parameters for the API call\n name = 'farhan'\n\n # dictionary for optional form parameters\n optional_form_parameters = {}\n optional_form_parameters['field'] = 'QA'\n\n # Perform the API call through the SDK function\n result = @controller.allow_dynamic_form_fields(name, _field_parameters: optional_form_parameters)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "title": "" }, { "docid": "20f872b8cfa395a75c3bc58aee27a7ef", "score": "0.5735068", "text": "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "title": "" }, { "docid": "20f872b8cfa395a75c3bc58aee27a7ef", "score": "0.5735068", "text": "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "title": "" }, { "docid": "20f872b8cfa395a75c3bc58aee27a7ef", "score": "0.5735068", "text": "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "title": "" }, { "docid": "20f872b8cfa395a75c3bc58aee27a7ef", "score": "0.5735068", "text": "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "title": "" }, { "docid": "7b508e1f6b76f0566f57911dd5f085b0", "score": "0.5734934", "text": "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @match }\n end\n end", "title": "" }, { "docid": "610f62219554a61dea199a2b760677e4", "score": "0.5726798", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to matches_url, notice: 'Match créé avec succès' }\n format.json { render :index, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8bc4e6fd37e6d28cb96dd65c46463630", "score": "0.57218015", "text": "def update\n respond_to do |format|\n if @match_form.update(match_form_params)\n format.html { redirect_to @match_form, notice: 'Match form was successfully updated.' }\n format.json { render :show, status: :ok, location: @match_form }\n else\n format.html { render :edit }\n format.json { render json: @match_form.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc4f13a2f8292442638dcf691ffc86ca", "score": "0.57094574", "text": "def form_json\n render template: 'utils/form_json'\n end", "title": "" }, { "docid": "5773e088a0ef9d80c2f4d35cbfcd41ef", "score": "0.5692082", "text": "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "title": "" }, { "docid": "d040beea193db172647cca89a9d4f0a0", "score": "0.56857914", "text": "def form_matches_schema\n return unless form_is_string\n\n JSON::Validator.fully_validate(VetsJsonSchema::SCHEMAS['VRRAP'], parsed_form).each do |v|\n errors.add(:form, v.to_s)\n end\n end", "title": "" }, { "docid": "396c5909afa291e9911636af781d357d", "score": "0.56592", "text": "def next_form\n json_form.next_form(parsed_json['id'])\n end", "title": "" }, { "docid": "6bf31c4f587eb2d5697b768a6e68b46d", "score": "0.56559557", "text": "def test_post_multival\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'post_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = @agent.submit(form)\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "title": "" }, { "docid": "8d03088854e50d6cb9f20e920434b7e8", "score": "0.5655208", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to admin_matches_path, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n #this will invoke create.js.erb (formmat.js)\n format.js \n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33c1f7a9fcba939e72cd7c6d465405f5", "score": "0.56353056", "text": "def test_submit_on_form\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'post_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = form.submit\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "title": "" }, { "docid": "6c1cf702cdf4ac3f7df947f69e3720cf", "score": "0.56093186", "text": "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, :notice => 'Match was successfully created.' }\n format.json { render :json => @match, :status => :created, :location => @match }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @match.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4de7104cedf2075e24676bc6c13c06b", "score": "0.55955046", "text": "def test_get_multival\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'get_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = @agent.submit(form)\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "title": "" }, { "docid": "f8dd7902dc7c982153a433f130427ef0", "score": "0.55832213", "text": "def match_form_params\n params.require(:match_form).permit(:name, match_categories_attributes: [:id, :name,:_destroy, match_form_lineitems_attributes: [:name, :data_type, :column_name, :_destroy]])\n end", "title": "" }, { "docid": "ffda8359351e8a5d989f2465ba2f946e", "score": "0.5566366", "text": "def forms\n get(:forms)['Forms'].map do |details|\n Form.new(details['Url'], party: self, details: details)\n end\n end", "title": "" }, { "docid": "5d220bc4117742d03a618457d8ca805f", "score": "0.55396694", "text": "def create\n @match = Match.new(match_params)\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d220bc4117742d03a618457d8ca805f", "score": "0.55396694", "text": "def create\n @match = Match.new(match_params)\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab1a5335ede78b9caf5a6ea7e47863cf", "score": "0.5530554", "text": "def match_params\n if request.format.json?\n params.permit(:competition_id, :number, :team_number, :time_defending, :time_dead, :start, :human_player_notes, :general_notes, :scout, :device_id,\n events: [:objective_id, :position_x, :position_y, :start_time, :duration, :success, :match_id] ,\n autonomies: [:objective_id, :start_x, :start_y, :end_x, :end_y, :duration, :success, :match_id])\n # params.require(:match).permit( :number, :time_defending, :time_dead, :start, :human_player_notes, :general_notes, :scout, :device_id,\n # events_attributes: [:id, :objective_id, :position_x, :position_y] ,\n # autonomies_attributes: [])\n else\n params.require(:match).permit(:competition_id, :number, :team_number, :time_defending, :time_dead, :start, :human_player_notes, :general_notes, :scout, :device_id, team: [:number])\n end\n end", "title": "" }, { "docid": "616329195e156a5af3ae450975b29f81", "score": "0.55294186", "text": "def create\n @match = Match.new(match_params)\n respond_to do |format|\n if @match.save\n format.html { redirect_to $redirect, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70f57eb8f921c48560cc7670f9c2a6b3", "score": "0.55250573", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70f57eb8f921c48560cc7670f9c2a6b3", "score": "0.55250573", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70f57eb8f921c48560cc7670f9c2a6b3", "score": "0.55250573", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70f57eb8f921c48560cc7670f9c2a6b3", "score": "0.55250573", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70f57eb8f921c48560cc7670f9c2a6b3", "score": "0.55250573", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70f57eb8f921c48560cc7670f9c2a6b3", "score": "0.55250573", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f56afea829bc8bdf60df36c6835e5259", "score": "0.55249196", "text": "def create\n # @match = Match.new(match_params)\n @fes = Fes.where(:id => params[:fes_id]).first\n @match = @fes.matches.build(match_params)\n\n respond_to do |format|\n if @match.save\n # format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.html { redirect_to [@fes, @match], notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d737d9ec57162686bbdd72973a57fe94", "score": "0.5522759", "text": "def form_search(url, html)\n\n forms = []\n html.css('form').each do |form|\n\n action = form.attr('action')\n\n action = url if action.nil?\n\n # prefix relative base url if no protocol\n unless action =~ /^https?:\\/\\//i\n uri = URI.parse(action)\n\n if action =~ /^\\//\n # absolute path\n src = \"#{uri.scheme}://#{uri.host}#{action}\"\n else\n # relative path\n src = \"#{url}/#{action}\"\n end \n\n end\n\n\n data = { \n method: (form.attr('method') || 'post').downcase, \n action: action,\n params: form.css('*[name]').map do |i| \n { \n name: i.attr('name'), \n value: i.attr('value')\n }\n end\n }\n\n forms << data\n\n # case data[:method]\n # when 'get'\n # puts RestClient.get(form[:action])\n # when 'post'\n # puts RestClient.post(form[:action], form[:params])\n # when 'put'\n # else \n # # do nothing\n # end\n\n # end\n\n end\n\n forms\n\n end", "title": "" }, { "docid": "ed928469b9fe31a2d11f8c83a4b76040", "score": "0.55187905", "text": "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render json: @match, status: :created, location: @match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed928469b9fe31a2d11f8c83a4b76040", "score": "0.55187905", "text": "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render json: @match, status: :created, location: @match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed928469b9fe31a2d11f8c83a4b76040", "score": "0.55187905", "text": "def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render json: @match, status: :created, location: @match }\n else\n format.html { render action: \"new\" }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dffb5f7a99bb9813b500a4ab38a8c217", "score": "0.5501471", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: \"Match was successfully created.\" }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed80fd23bc50e115eaf3684844e2f451", "score": "0.55000514", "text": "def forms; end", "title": "" }, { "docid": "6f8ed136ec51f14cbc322c5867b3ae6a", "score": "0.54615134", "text": "def new\n\t\t@form = @client.forms.new\n\n \n 3.times do\n procedure = @form.procedures.build\n end\n 3.times do\n authemp = @form.authemps.build\n end\n\n\t\trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t\tend\n\tend", "title": "" }, { "docid": "9af7d8ffd06bab6a3b3f638da4c7f760", "score": "0.54590476", "text": "def update\n respond_to do |format|\n if @match.update(match_params)\n\n format.html { redirect_to admin_matches_path, notice: 'Match was successfully updated.' }\n format.json { render :show, status: :ok, location: @match }\n else\n #this will invoke create.js.erb (formmat.js)\n format.js \n format.html { render :edit }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4066afa23b0f24bd0b8465f198b866e7", "score": "0.54559326", "text": "def create\n @match = Match.new(match_params)\n @match.user_id = @current_user.id\n if @match.save\n options = {include: [:user]}\n render json: serializer.new(@match, options), include: ['user']\n else\n render json: @match.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "77dfe70fe7a786ee038f9587735c721a", "score": "0.5449322", "text": "def create\n @match_form_lineitem = MatchFormLineitem.new(match_form_lineitem_params)\n\n respond_to do |format|\n if @match_form_lineitem.save\n format.html { redirect_to @match_form_lineitem, notice: 'Match form lineitem was successfully created.' }\n format.json { render :show, status: :created, location: @match_form_lineitem }\n else\n format.html { render :new }\n format.json { render json: @match_form_lineitem.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e5fc8d0d32b905d11834dbaf72239a9", "score": "0.5443268", "text": "def format_forms(page)\n ret = {}\n page.forms.each do |form|\n ret[form.name] = []\n form.fields.each do |n|\n ret[form.name] << n.name\n end\n end\n return ret\nend", "title": "" }, { "docid": "5cebd9384115ea9663bbaca1a379a346", "score": "0.5441191", "text": "def index\n\t\t@forms = @client.forms.all\n\n\t\trespond_to do |format|\n \t\tformat.html # index.html.erb\n \t\tformat.json { render json: @forms }\n \tend\n\tend", "title": "" }, { "docid": "bdea25edf5c85dd91c73ab571548c2be", "score": "0.5415463", "text": "def socio_economico_submit\n\n # responding for the first time\n if not session[:current_response_id]\n current_response = nil\n # preparing the object to store the surveys and requests data\n json_response = { 'surveys' => [], 'requests' => [] }\n else\n current_response = FormResponse.find(session[:current_response_id])\n json_response = JSON.parse current_response.json_response\n end\n\n # appending the new response to the array of surveys\n surveys_number = json_response['surveys'].size\n json_response['surveys'] = [] if surveys_number == 0\n json_response['surveys'].push(\n params.merge({\n :attempt => (surveys_number + 1),\n :sent_at => Time.zone.now\n })\n )\n\n if current_response\n current_response.update({\n json_response: json_response.to_json\n })\n else\n # the response must be created only in this form\n # and not in the request form!\n current_response = FormResponse.create({\n form_id: Form.where(reference_model: 'FormVagasRemanescentes').first.id,\n user: current_user.email,\n json_response: json_response.to_json\n })\n\n # storing the response id in session to access it\n # from the other form, the request form\n session[:current_response_id] = current_response.id\n end\n\n redirect_to action: 'pedido'\n end", "title": "" }, { "docid": "041e26b807b873fddb0ffab235a73039", "score": "0.5413154", "text": "def index\n @filled_forms = FilledForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filled_forms }\n end\n end", "title": "" }, { "docid": "1fa4c541af6bc5419881dd7262888a76", "score": "0.5409024", "text": "def emit_form(formdata: {})\n if formdata[JIRA] || formdata[CONFLUENCE]\n title = 'Update your JIRA and Confluence IDs (previously submitted)'\n submit_title = 'Update Your ID Mapping'\n else\n title = 'Enter your JIRA and Confluence IDs'\n submit_title = 'Submit Your ID Mapping'\n end\n _whimsy_panel(title, style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n _div.form_group do\n _label.control_label.col_sm_3 'Do you have an Apache JIRA ID?', for: JIRAHAS\n _div.col_sm_9 do\n _select.form_control name: JIRAHAS, id: JIRAHAS, required: true do\n _option value: ''\n _option \"Yes - I have one JIRA ID\", value: 'y', selected: \"#{formdata[JIRAHAS] == 'y' ? 'selected': ''}\"\n _option \"No - I do not have a JIRA ID\", value: 'n', selected: \"#{formdata[JIRAHAS] == 'n' ? 'selected': ''}\"\n _option \"I use multiple JIRA IDs\", value: 'm', selected: \"#{formdata[JIRAHAS] == 'm' ? 'selected': ''}\"\n end\n end\n end\n emit_input(label: 'Enter your Apache JIRA ID (if you have one)', name: JIRA, required: false,\n value: \"#{formdata[JIRA]}\", \n helptext: \"The JIRA ID used on issues.apache.org (usually same as committer ID)\")\n emit_input(label: 'List any other JIRA IDs you personally use, one per line', name: JIRAOTHER, required: false,\n value: \"#{formdata[JIRAOTHER]}\",\n rows: 3, helptext: \"Remember: these should only be personal IDs you use, not project ones.\")\n \n _div.form_group do\n _label.control_label.col_sm_3 'Do you have an Apache Confluence ID?', for: CONFLUENCEHAS\n _div.col_sm_9 do\n _select.form_control name: CONFLUENCEHAS, id: CONFLUENCEHAS, required: true do\n _option value: ''\n _option \"Yes - I have one Confluence ID\", value: 'y', selected: \"#{formdata[CONFLUENCEHAS] == 'y' ? 'selected': ''}\"\n _option \"No - I do not have a Confluence ID\", value: 'n', selected: \"#{formdata[CONFLUENCEHAS] == 'n' ? 'selected': ''}\"\n _option \"I use multiple Confluence IDs\", value: 'm', selected: \"#{formdata[CONFLUENCEHAS] == 'm' ? 'selected': ''}\"\n end\n end\n end\n emit_input(label: 'Enter your Apache Confluence ID (if you have one)', name: CONFLUENCE, required: false,\n value: \"#{formdata[CONFLUENCE]}\", \n helptext: \"The Confluence ID used on cwiki.apache.org (usually same as committer ID)\")\n emit_input(label: 'List any other Confluence IDs you personally use, one per line', name: CONFLUENCEOTHER, required: false,\n value: \"#{formdata[CONFLUENCEOTHER]}\",\n rows: 3, helptext: \"Remember: these should only be personal IDs you use, not project ones.\")\n \n emit_input(label: 'Your Apache Committer ID', name: COMMITTERID, readonly: true,\n value: formdata[COMMITTERID], icon: 'glyphicon-user', iconlabel: 'Committer ID')\n _div.col_sm_offset_3.col_sm_9 do\n _input.btn.btn_default type: 'submit', value: submit_title\n end\n end\n end\nend", "title": "" }, { "docid": "d389a6fa9c9209b2151290a4a92db78c", "score": "0.5407429", "text": "def validate_responses(params)\n @responses = params['responses'] \n # Retrieve the smerf form record, rails will raise error if not found\n @smerfform = SmerfForm.find(params[:smerf_form_id])\n # Validate user responses\n @errors = Hash.new() \n @smerfform.validate_responses(@responses, @errors) \n end", "title": "" }, { "docid": "fa6f6b30e879f5f8a30a801d83f27187", "score": "0.54033846", "text": "def index\n @match_form_lineitems = MatchFormLineitem.all\n end", "title": "" }, { "docid": "9dfdd6381e5fd1d399a66a484a651bb1", "score": "0.53993565", "text": "def form\n\tform = Windmill.all\n\t#form = Windmill.where(windformid: params[:id])\n\t#if form.present?\n render json: form.as_json(only: [:no])\n\t#else\n\t\t#render json: {massage: 'No windfrom available in this id'}\n\t#\n #end\nend", "title": "" }, { "docid": "5a7186cebca1e7e4e2eea84c641dc014", "score": "0.5387485", "text": "def create\n @form = Form.new(params[:form])\n\n respond_to do |format|\n if @form.save\n params[:id] = @form.id\n flash[:notice] = 'Form was successfully created.'\n\n format.html { redirect_to(@form) }\n format.json {\n form = render_to_string(:partial => \"form_basic.html.erb\", :locals => {:is_edit => true})\n coll = render_to_string(:partial => \"shared/collision_detection.html.erb\")\n render :json => {\n :collision => coll,\n :preview => preview_form_path(@form),\n :form => form\n },\n :status => :created,\n :location => @form\n }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @form.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29fc1b3bdc18fa5544f69d389bd5900c", "score": "0.5380948", "text": "def onSubmit(request, response, form, errors) \n return form\n end", "title": "" }, { "docid": "18338f13cf409953c292dbf65e180223", "score": "0.5353978", "text": "def create\n @match_detail = MatchDetail.new(match_detail_params)\n\n respond_to do |format|\n if @match_detail.save\n format.html { redirect_to @match_detail, notice: 'Match detail was successfully created.' }\n format.json { render :show, status: :created, location: @match_detail }\n else\n format.html { render :new }\n format.json { render json: @match_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "354298003924c4de06bf320a6e998c6f", "score": "0.53501964", "text": "def create\n @match_requirement = MatchRequirement.new(match_requirement_params)\n\n respond_to do |format|\n if @match_requirement.save\n format.html { redirect_to @match_requirement, notice: 'Match requirement was successfully created.' }\n format.json { render :show, status: :created, location: @match_requirement }\n else\n format.html { render :new }\n format.json { render json: @match_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "10623833909a8c1ce3aa8394b5ca188c", "score": "0.5346247", "text": "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "title": "" }, { "docid": "631ccc725611e11f3c2f28983a5753bb", "score": "0.5342522", "text": "def onSubmit(request, response, form, errors)\r\n return form\r\n end", "title": "" }, { "docid": "631ccc725611e11f3c2f28983a5753bb", "score": "0.5342522", "text": "def onSubmit(request, response, form, errors)\r\n return form\r\n end", "title": "" }, { "docid": "fa927f3b87e62bc0ec9340db857927e1", "score": "0.5340775", "text": "def match_params\n params.require(:match).permit!\n end", "title": "" }, { "docid": "365125eb2ff4f03caad8d0be959b05b6", "score": "0.53391004", "text": "def new\n @filled_form = FilledForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filled_form }\n end\n end", "title": "" }, { "docid": "edb46b4296cda02feac632f735c67ad0", "score": "0.53390837", "text": "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "title": "" }, { "docid": "edb46b4296cda02feac632f735c67ad0", "score": "0.53390837", "text": "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "title": "" }, { "docid": "edb46b4296cda02feac632f735c67ad0", "score": "0.53390837", "text": "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "title": "" }, { "docid": "edb46b4296cda02feac632f735c67ad0", "score": "0.53390837", "text": "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "title": "" }, { "docid": "842d5e96992a7c3b11d6170711c53b6d", "score": "0.5333723", "text": "def form_fragment\n parsed_json\n end", "title": "" }, { "docid": "090936375a81a7f78c2ed13567f255af", "score": "0.5325617", "text": "def parseForm(form)\n # I'm using the format \"name value\" to be able to use the set_options method\n url = Array[\"\", \"url\", form[\"action\"]]\n method = Array[\"\", \"method\", form[\"method\"]]\n hidden_inputs = form.css(\"input[type='hidden']\")\n password_input = form.xpath(\"//input[@type='password']/@name\")\n\n # get the login input\n visible_inputs = form.css(\"input[type!='hidden']\")\n login_input = \"\"\n visible_inputs.each do |el|\n if el.to_s =~ /(login)|(email)|(username)|(user)/i\n login_input = el\n puts \"the login input est : #{el}\"\n break\n end\n end\n\n # create the string with all the hidden parameters\n body = \"\"\n hidden_inputs.each do |el|\n body = body + el[\"name\"] + \"=\" + el[\"value\"] + \"&\"\n end\n\n body = \"#{body}\" + \"#{login_input[\"name\"]}\" + \"=FILE0&\" + \"#{password_input}\" + \"=FILE1\"\n\n # add the question mark if get request\n if method == \"get\"\n body = \"?#{body}\"\n end\n body = Array[\"\", \"body\", body]\n\n\n # write the values in the json object \n options = JSON.parse(get_options(\"http_module\"))\n\n set_options(options, url)\n set_options(options, method)\n set_options(options, body)\nend", "title": "" }, { "docid": "ce3d82bbc381a8c650dc8407d342546a", "score": "0.5322483", "text": "def create\n @user = current_user\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: 'Match was successfully created.' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "666f4056e57cbd84172352a3993fa710", "score": "0.53191674", "text": "def onSubmit(request, response, form, errors)\r\n\treturn form\r\n end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.5306177", "text": "def POST; end", "title": "" }, { "docid": "5263ed87651851b93535cc46e9cb4c3c", "score": "0.52897567", "text": "def create\n \t\t@form = @client.forms.new(params[:form])\n\n \trespond_to do |format|\n \t\tif @form.save\n \t\tformat.html { redirect_to @client, notice: 'Lockout Tagout Form successfully added.' }\n \t\tformat.json { render json: @client, status: :created, location: @form }\n \t\telse\n \t\tformat.html { render action: \"new\" }\n \t\tformat.json { render json: @form.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n \tend", "title": "" }, { "docid": "6fb72f5ac44285955e540fa9d3558568", "score": "0.5279792", "text": "def post_match\n end", "title": "" }, { "docid": "108efb9274edade848c705012af02c81", "score": "0.52741313", "text": "def parseTarget(url)\n response = Nokogiri::HTML(RestClient.get(url))\n\n forms = response.css('form')\n puts \"there are #{forms.length} forms\"\n forms_attributes = []\n forms.each_with_index do |el, index|\n puts\n forms_attributes[index] = el.to_s.split('>')[0]\n puts \" #{index.to_s.ljust(5)}#{forms_attributes[index]}\"\n end\n puts \" \"\n choice = ask(\"Which form do you want to bruteforce ?\")\n \n return forms[choice.to_i]\nend", "title": "" }, { "docid": "259cebf9cd8e8cc39fc2eab8f1373d92", "score": "0.5273338", "text": "def create\n @team_match = TeamMatch.new(team_match_params)\n\n respond_to do |format|\n if @team_match.save\n format.html { redirect_to @team_match, notice: 'Team match was successfully created.' }\n format.json { render :show, status: :created, location: @team_match }\n else\n format.html { render :new }\n format.json { render json: @team_match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19d35e5bdd5489867b1420ed63c14fa0", "score": "0.5267973", "text": "def match_params\n params.require(:match).permit(:member1, :member2, :result)\n end", "title": "" }, { "docid": "12c4f9756d09c87309edcd721b3db777", "score": "0.5267321", "text": "def get_surface_forms(*args)\n http_method = :get\n path = '/words/surfaceForms'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end", "title": "" }, { "docid": "0e77e023ba6f8353f3ced2442c06365a", "score": "0.52664566", "text": "def create\n @submitted_exam_regis_form = SubmittedExamRegisForm.new(submitted_exam_regis_form_params)\n\n respond_to do |format|\n if @submitted_exam_regis_form.save\n format.html { redirect_to @submitted_exam_regis_form, notice: 'Submitted exam regis form was successfully created.' }\n format.json { render :show, status: :created, location: @submitted_exam_regis_form }\n else\n format.html { render :new }\n format.json { render json: @submitted_exam_regis_form.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "69aec3ab6d15830c25ae3d32ec8bb31e", "score": "0.52586097", "text": "def match_params\n params.require(:match).permit(:hteam, :ateam, :htscore, :atscore, :mdate)\n end", "title": "" }, { "docid": "7b2ab2a9287a11f359e9ef9f7629cc47", "score": "0.5256305", "text": "def match_params\n params.require(:match).permit(:date, :salle, :ville, :orga, :metro, :comment)\n end", "title": "" }, { "docid": "d52df3554d242fc0a11106b27ed990ac", "score": "0.5245951", "text": "def match_params\n params.fetch(:match, {})\n end", "title": "" }, { "docid": "d52df3554d242fc0a11106b27ed990ac", "score": "0.5245951", "text": "def match_params\n params.fetch(:match, {})\n end", "title": "" }, { "docid": "d52df3554d242fc0a11106b27ed990ac", "score": "0.5245951", "text": "def match_params\n params.fetch(:match, {})\n end", "title": "" }, { "docid": "3a5e0c9ccfe7b75360f8460ab93d08d0", "score": "0.5244226", "text": "def destroy\n @match_form.destroy\n respond_to do |format|\n format.html { redirect_to match_forms_url, notice: 'Match form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9e61d6d68bee4f867b9ed1587bd1730f", "score": "0.5241828", "text": "def new\n @interpro_match = InterproMatch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interpro_match }\n end\n end", "title": "" }, { "docid": "1675bbbcfe18003bebe6e16779274f8f", "score": "0.52411324", "text": "def new\n @match = @contest.matches.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @match }\n end\n end", "title": "" }, { "docid": "7946d68362c6bc2000a21fb3bef50090", "score": "0.5240034", "text": "def match_params\n params.require(:match).permit(:start, :duration_hours, :duration_days, :court, :desc, :match_type, :pid, :country, :postcode, :after)\n end", "title": "" }, { "docid": "8425c848e47c56ca82f4d4f52c3dba09", "score": "0.5218107", "text": "def create\n @match = Match.new(match_params)\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, notice: '比赛创建成功' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8787c2ced45d912b2ddeeb3bc507aa07", "score": "0.5212432", "text": "def match(req)\n end", "title": "" }, { "docid": "bb65c7858ce3a6976152ec500228405f", "score": "0.5207436", "text": "def create\n @match = Match.new(match_params)\n @match.users << current_user\n @match.users << Match.criaBOT(@match.difficulty)\n respond_to do |format|\n if @match.save\n format.html { redirect_to matches_path, notice: 'Partida criada com sucesso' }\n format.json { render :show, status: :created, location: @match }\n else\n format.html { render :new }\n format.json { render json: @match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd412f6b0b3d22b080fb1b57ed005b7d", "score": "0.5206826", "text": "def create\n @match_set = MatchSet.new(match_set_params)\n\n respond_to do |format|\n if @match_set.save\n format.html { redirect_to @match_set, notice: 'Match set was successfully created.' }\n format.json { render :show, status: :created, location: @match_set }\n else\n format.html { render :new }\n format.json { render json: @match_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3db678449cf411eacd3512b21df6f2e4", "score": "0.5200179", "text": "def index\n \tif params[:term]\n \t @v1_forms = V1::Form.search(params[:term]).order(\"visits_count ASC\")\n \telse\n \t @v1_forms = V1::Form.all.order(\"created_at DESC\")\n \tend\n render json: @v1_forms, include: :category\n end", "title": "" }, { "docid": "8b80944dc48152bb176adf7b35177ff7", "score": "0.5189372", "text": "def match_params\n params.require(:match).permit(:meatcut_id, :technique_id, :good_idea, :notes)\n end", "title": "" }, { "docid": "3115e7e487cdca190302dd698b7e0dda", "score": "0.51787335", "text": "def create\n # Read the Matches from the JSON Object\n data = params[:matches]\n matches = data.to_a\n\n MatchCreatorJob.perform_later(matches: matches)\n\n render json: {}, status: :ok\n\n end", "title": "" }, { "docid": "58dd3fa698762b4dca31997fa7edf5e2", "score": "0.5169071", "text": "def create\n @empire_master_match = EmpireMasterMatch.new(empire_master_match_params)\n\n respond_to do |format|\n if @empire_master_match.save\n format.html { redirect_to @empire_master_match, notice: 'Empire master match was successfully created.' }\n format.json { render :show, status: :created, location: @empire_master_match }\n else\n format.html { render :new }\n format.json { render json: @empire_master_match.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99ef56332ab2f586b738abb77c84b7e5", "score": "0.51672244", "text": "def new\n @sectioneight_form = SectioneightForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sectioneight_form }\n end\n end", "title": "" }, { "docid": "57e8d85f9cf7ec7661400079425a68e9", "score": "0.51408094", "text": "def form_data\n\n [\n {\n title: 'Enter your flashcard informations',\n footer: 'Set up your flashcard information with the question and the answer to be able schedule it as a riminder',\n #options: [:insert, :delete, :reorder],\n cells: [\n {\n title: 'Question Label',\n name: :subjects,\n type: :selector_push,\n view_controller_class: FlashcardQuestionLabelTable,\n appearance: appearance_style\n \n # options: Hash[load_data.map do |subject|\n # [subject[:id], subject[:name]]\n # end]\n # on_change: -> (old_value, new_value) {\n # mp old_value: old_value,\n # new_value: new_value\n # }\n },\n {\n title: 'Question Object',\n name: :only_one,\n type: :text,\n #required: true,\n appearance: appearance_style({\n alignment: :right\n })\n },\n {\n # title: \"Question answer\",\n name: :description,\n type: :textview,\n placeholder: 'Enter your question answer'\n #required: true\n }\n ]\n },\n\n # Set the image cell to add image\n {\n title: '',\n name: 'Media',\n #options: [:insert, :delete, :reorder],\n cells: [\n {\n title: 'An image',\n name: :picture,\n type: :image,\n appearance: appearance_style,\n value: UIImage.imageNamed('[email protected]')\n },\n {\n title: 'Audio record',\n name: :audio_record,\n type: :image,\n appearance: appearance_style,\n value: UIImage.imageNamed('[email protected]')\n }\n ]\n },\n\n # Schedule section\n\n {\n title: 'Remind Schedule',\n footer: 'Some help text',\n #options: [:insert, :delete, :reorder],\n cells: [\n {\n title: 'Daily Frequency',\n name: :note_frequency,\n type: :selector_picker_view_inline,\n appearance: appearance_style,\n value: 'Once a day',\n options: {\n :one => \"Once a day\",\n :two => \"Twice a day\",\n :three => \"Three times a day\",\n :four => \"Four times a day\",\n }\n\n },\n {\n title: 'Remind me',\n name: :repeat_frequency,\n type: :multiple_selector,\n appearance: appearance_style,\n #value: \"Never\",\n options: {\n :sunday => \"Every Day\",\n :monday => \"Every Week\",\n :tuesday => \"Every 2 Weeks\",\n :wednesday => \"Every Month\",\n :wednesday => \"Every Year\"\n }\n\n },\n {\n title: 'Stop Remind',\n name: :stop_remind,\n type: :selector_push,\n appearance: appearance_style,\n cells: [\n {\n title: 'Repeat Forever',\n name: :reapet_forever,\n type: :check,\n value: true,\n appearance: appearance_style\n },\n {\n title: 'Stop date',\n name: :stop_remind_date,\n type: :date_inline,\n appearance: appearance_style\n }\n ]\n },\n {\n title: 'Turn off?',\n name: 'rimind_on',\n type: :switch,\n value: true, \n appearance: appearance_style\n }\n\n ]\n }\n\n ]\n\n end", "title": "" }, { "docid": "f6559a23829d35b145119158897678ed", "score": "0.5128299", "text": "def match_params\n # params[:match]\n params.require(:match).permit(:name,\n :introduce,\n :start_time,\n :end_time)\n end", "title": "" }, { "docid": "d73f5af664412476de612aabd6dd3ec1", "score": "0.5116677", "text": "def validate\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Started')\n add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Completed')\n render json: validation_success\n end", "title": "" }, { "docid": "8175b00f82b80109824c2e0894cc0a3d", "score": "0.5104066", "text": "def create\n\t\t@match = Match.new(match_params)\n\tend", "title": "" }, { "docid": "0dd037bc5886e901ae2bc6a4f36fcb2c", "score": "0.51029867", "text": "def test_form_echo()\n # Parameters for the API call\n input = JSON.parse('{\"uid\": \"1123213\", \"name\": \"Shahid\"}')\n\n # Perform the API call through the SDK function\n result = self.class.controller.form_echo(input)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"body\":{\"input\":{\"uid\":\"1123213\",\"name\":\"Shahid\"}}}')\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "title": "" }, { "docid": "4240c771da846968421b9aedbd8a3ac6", "score": "0.5101062", "text": "def create\n @verb = Verb.new(:infinitive => verb_params[:infinitive], :translation => verb_params[:translation], :group => verb_params[:group])\n if @verb.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb_params[tense][form].strip != '')\n @form = Form.new(:content => verb_params[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => @verb)\n @form.save\n end\n end\n end\n end\n\n respond_to do |format|\n if @verb.save\n format.html { redirect_to @verb, notice: 'Verb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @verb }\n else\n format.html { render action: 'new' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b50ec1fe81650c896acf8bdf8a83eb41", "score": "0.5098379", "text": "def test_get_form_fields\n filename = 'FormFilled.docx'\n remote_name = 'TestGetFormFields.docx'\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read \n @storage_api.put_create st_request\n\n request = GetFormFieldsRequest.new remote_name, remote_test_folder + test_folder, :node_path => 'sections/0'\n result = @words_api.get_form_fields request\n assert_equal 200, result.code\n end", "title": "" } ]
af5e6ad39078e2c7a7776d1dc7f7470f
returns an Array of this follower's cults
[ { "docid": "31828e861006ac671444edea152434c3", "score": "0.78390193", "text": "def cults\n # ran the method on self (f1.cults)\n # self = follower instance\n # get this follower's info (self)\n # iterate through all BloodOath instances\n # select matching BloodOath instances -> have same follower as self\n # access through blood_oath_instance.follower == self \n # return array of matching BloodOath instances\n follower_cults = BloodOath.all.select do |blood_oath_instance|\n blood_oath_instance.follower == self \n end\n follower_cults.map do |blood_oath_instance|\n blood_oath_instance.cult\n end\n end", "title": "" } ]
[ { "docid": "08bd5b6514f1955858f4987d3d270495", "score": "0.8044876", "text": "def cults\n follower_bos = BloodOath.all.select {|b_o_instance| b_o_instance.follower == self}\n follower_cults = follower_bos.map {|b_o_instance| b_o_instance.cult}\n follower_cults.uniq\n end", "title": "" }, { "docid": "06a729a598adb7aa4adb94daa42cb4af", "score": "0.80221474", "text": "def fellow_cult_members\n self.cults.map{|follower_cults|\n self.class.all.select {|followers| followers.cults.include?(follower_cults)}}.flatten.uniq\n end", "title": "" }, { "docid": "f8a50a6af6edf5525ee48623b220b58d", "score": "0.80183786", "text": "def cults\n self.initiations.map do |each| \n each.cult if each.follower.name == self.name\n end\n end", "title": "" }, { "docid": "71b5d62918bd8aa327c977f5669ca984", "score": "0.78491026", "text": "def my_cults\n follower_cults = BloodOath.all.select do |blood_oath_instance|\n blood_oath_instance.follower == self \n end\n follower_cults.map do |blood_oath_instance|\n blood_oath_instance.cult \n end\n end", "title": "" }, { "docid": "a8766dba327279b4bee420ceae4b767b", "score": "0.7802195", "text": "def cults\n BloodOath.all.select {|groups| groups.follower == self}.map {|cult_info| cult_info.cult_name.name}\n end", "title": "" }, { "docid": "40b61f1f6579e1f6ee17b285172a1ba2", "score": "0.77685064", "text": "def cults\n # First, get all of this follower's blood oaths and then for each one, return the cult that blood oath belongs to\n self.blood_oaths.map { |blood_oath| blood_oath.cult }\n end", "title": "" }, { "docid": "a683f0ab4a8e79e802d9eee7e60758bc", "score": "0.7628915", "text": "def fellow_cult_members\n Follower.all.select do |follower|\n follower.cults & self.cults != [] && follower != self\n end\n end", "title": "" }, { "docid": "08fb86735155e6883aff9cf0119c17a1", "score": "0.7579064", "text": "def cults\n #go through bloodoath to SELECT the follower == to self.\n #map through to grab the follower's cults\n follower = Bloodoath.all.select{|bo| bo.follower == self}\n follower.map{|follower| follower.cult}\n end", "title": "" }, { "docid": "bcd10d115ab50595744f1b55763ea1b1", "score": "0.7505801", "text": "def cults\n my_blood_oaths = BloodOath.all.select do |blood_oath| \n blood_oath.follower == self\n end\n my_blood_oaths.map do |my_blood_oath|\n my_blood_oath.cult\n end\n end", "title": "" }, { "docid": "5f4194a743b26ba7cd53f33fcb1af91a", "score": "0.7395611", "text": "def cults\n blood_oaths = BloodOath.all.select do |blood_oath|\n blood_oath.follower == self\n end\n blood_oaths.map do |blood_oath|\n blood_oath.cult\n end\n end", "title": "" }, { "docid": "312f1a6df7e3923e4510d102535458b0", "score": "0.7266957", "text": "def fellow_cult_members\n Follower.all.select do |follower|\n follower.cults.sort_by {|cult| cult.object_id} == self.cults.sort_by {|cult| cult.object_id} if follower != self\n end\n end", "title": "" }, { "docid": "0e40eb1a85d4a6e571c646082425e3d6", "score": "0.7172065", "text": "def fellow_cult_members\n BloodOath.all.select {|groups| groups.follower == self}.map{|cults| cults.cult_name}.map{|cults| cults.followers}.flatten.reject{|follower| follower.name == self.name}\n end", "title": "" }, { "docid": "0ea08289c28675adf770ad2ea0ad4ce9", "score": "0.7164039", "text": "def cults\na = BloodOath.all.select{|folooo| folooo.follower == self}\na.map{|cul|cul.cult}\nend", "title": "" }, { "docid": "ab4428549838e09d344850ca6a220915", "score": "0.71007186", "text": "def cults\n BloodOath.all.select{|bo| bo.follower == self}\n end", "title": "" }, { "docid": "d3775f6ed69dcb77d0e65d060c722b6b", "score": "0.7019481", "text": "def fellow_cult_members_inclusive\n fellows = []\n Cult.all.each do |cult|\n if cult.get_followers.include?(self)\n cult.get_followers.each { |follower| fellows << follower if follower != self }\n end\n end\n fellows.uniq\n end", "title": "" }, { "docid": "4bb2694c68c12359ae28908e1ce97e97", "score": "0.6993106", "text": "def followers\n BloodOath.all.select{|cult| cult.cult_name == self}.map{|members| members.follower}\n end", "title": "" }, { "docid": "7b5b5f31eb868f2b281bc7fea24310f7", "score": "0.6959686", "text": "def cults\n BloodOath.all.select { |oath| oath.follower == self }\n end", "title": "" }, { "docid": "72adb22562c09c1b4fc586190be3dd65", "score": "0.6943978", "text": "def fellow_cult_members\n BloodOath.all.select{|blood_oath| self.cults.include?(blood_oath.cult)}.\n map{|my_cults_blood_oath| my_cults_blood_oath.follower}.\n uniq. # all followers that are in my cults (including me)\n reject{|follower| follower == self} # remove myself\n end", "title": "" }, { "docid": "7d3cd94c636a64663ad4ccbcf31ac001", "score": "0.68348545", "text": "def my_cults\n Bloodoath.all.select {|bloodoath| bloodoath.follower == self}\n end", "title": "" }, { "docid": "180e38a89eb22af9e649fd3fa0629d4a", "score": "0.6774438", "text": "def followers\n cult_bloodoaths = BloodOath.all.select {|bloodoath| bloodoath.cult == self}\n cult_bloodoaths.map {|bloodoath| bloodoath.follower}\n end", "title": "" }, { "docid": "d3147a8db0b949f7f2411ac3b8dc8657", "score": "0.66847914", "text": "def followers\n result = BloodOath.all.select {|bo| bo.cult == self}\n result.map {|bo| bo.follower}\n end", "title": "" }, { "docid": "d1c6323c2878935fd32fda4a6bfd5637", "score": "0.66141015", "text": "def followers\n BloodOath.all.select {|bo| bo.cult == self}.map {|bo| bo.follower}\n end", "title": "" }, { "docid": "852b62a5839f9928d95f5c3528a18a12", "score": "0.6596818", "text": "def cults\n BloodOath.all.select do |oath|\n #binding.pry\n oath.follower == self\n end\n end", "title": "" }, { "docid": "bae2a6ff8313c3e137090c91a53ade8c", "score": "0.6583538", "text": "def initialize (name, age, life_motto)\n @name = name\n @age = age\n @life_motto = life_motto\n \n @@all << self #returns an Array of this follower's cults\n end", "title": "" }, { "docid": "8e01297c85637779452277ca71ece086", "score": "0.6550016", "text": "def followers\n BloodOath.all.select do |bloodoath|\n bloodoath.cult == self\n end\n end", "title": "" }, { "docid": "55a97df74211264d7bf1817c07871ea5", "score": "0.65482867", "text": "def my_followers_mottos\n # BloodOath.all.select{|cult| cult.cult_name == self}.map{|members| p members.follower.life_motto}\n self.followers.map{|follower_info| p follower_info.life_motto}\n end", "title": "" }, { "docid": "739d5ace31ac7fc380cf7593ee81011d", "score": "0.6470946", "text": "def followers\n oaths = BloodOath.all.select { |oath| oath.cult == self }\n oaths.map { |oath| oath.follower }\n end", "title": "" }, { "docid": "e14f460b4b928cf019d89146adf96aae", "score": "0.6388083", "text": "def cults\n self.bloodoaths.collect do |bloodoath|\n bloodoath.cult\n end.uniq\n end", "title": "" }, { "docid": "c11f419114fa58cda73ead46acbbc4a9", "score": "0.63718605", "text": "def my_followers\n my_blood_oaths = BloodOath.all.select do |blood_oath|\n blood_oath.cult == self\n end\n my_blood_oaths.map do |blood_oath|\n blood_oath.follower\n end\n end", "title": "" }, { "docid": "c1ae9750d0672e43db2fe179ae19353c", "score": "0.6362695", "text": "def cult_population\n # First, get all of the followers that belong to this cult, then count how many there are\n self.followers.count\n end", "title": "" }, { "docid": "c4bf7e46d70f1f78c6fad04b26ee0077", "score": "0.635499", "text": "def my_followers_mottos\n self.followers.map do |follower|\n follower.life_motto\n end\n end", "title": "" }, { "docid": "57218420f34245e52c65bdd5b54926fa", "score": "0.63505", "text": "def cults_following \n recruited = BloodOath.all.select{|bloodoath| bloodoath.follower == self}.count \n joined = BloodOath.all.select{|bloodoath| bloodoath.cult == self}.count\n total = joined + recruited\n total\n end", "title": "" }, { "docid": "7318d1c5469b95f36d1f0d8517f11361", "score": "0.63477415", "text": "def cult_population\n @followers.count\n # follower.all.select {|followers| followers.cults.name == self.name }.count\n end", "title": "" }, { "docid": "5b200ac34fc163448c1a936b9d35b2f6", "score": "0.6324092", "text": "def my_followers_mottos\n # self = cult instante / this cult\n # find this cult's (self) followers\n # iterate through all Blood Oaths\n # select matching self == blood_oath_instance.cult\n # iterate again to select mottos via blood_oath_instance.follower.life_motto\n # puts results\n cult_followers = BloodOath.all.select do |blood_oath_instance|\n blood_oath_instance.cult == self\n end\n cult_followers.select do |blood_oath_instance|\n puts blood_oath_instance.follower.life_motto\n end\n end", "title": "" }, { "docid": "6c45eeb354a1981c14f95190d615662a", "score": "0.6314864", "text": "def my_cults_slogans\n #need to get all the cults for this follower. use the cults method:\n #this goes through bloodoath.\n #grab the slogans from them.\n get_slogans = cults.map{|cult| cult.slogan}\n get_slogans.map { |slogan| \"'\" + slogan.to_s + \"'\" }.join(\",\")\n end", "title": "" }, { "docid": "3ccdf72f1d45f80d7832a9789bf7e522", "score": "0.6268708", "text": "def my_followers_mottos\n self.my_followers.map do |follower|\n follower.life_motto\n end\n end", "title": "" }, { "docid": "de5b91ae8ba81990d3c46fbc1f7e9b41", "score": "0.6238323", "text": "def my_followers_mottos\n puts \"These are the mottos: \"\n puts self.cult_members.map { |followers| puts followers.life_motto}\n end", "title": "" }, { "docid": "22ad75e442d6db934ec4673a192cec2a", "score": "0.622444", "text": "def my_cults_slogans\n BloodOath.all.select {|groups| groups.follower == self}.map {|cult_info| cult_info.cult_name.slogan}\n end", "title": "" }, { "docid": "9bc5bec75be5b441e13f2ddb637b8869", "score": "0.622268", "text": "def my_followers_mottos\n self.bloodoaths.map do |oath|\n oath.follower.life_motto\n end\n end", "title": "" }, { "docid": "f3748c90e356aeec9b1de97b3a4155ec", "score": "0.61945957", "text": "def followers_instances\n Bloodoath.all.select { |bloodoath| bloodoath.cult == self}\n end", "title": "" }, { "docid": "30e6ca139646054dc29598cb02e61b6d", "score": "0.6175574", "text": "def followers\n # First, get all of this cult's blood oaths and then for each one, return the follower that blood oath belongs to\n self.blood_oaths.map { |blood_oath| blood_oath.follower }\n end", "title": "" }, { "docid": "992c054604a1ed55c65e168b7600fe1e", "score": "0.616976", "text": "def my_followers_mottos\n self.blood_oaths.map do |blood_oath|\n blood_oath.follower.life_motto\n end\n end", "title": "" }, { "docid": "c10f6c029363e428df18cef3a347c15b", "score": "0.5999825", "text": "def cults\n bloodoaths.select do |bloodoath|\n bloodoath.cult\n end\n end", "title": "" }, { "docid": "a725b638149108a5575ac66db965173d", "score": "0.59978706", "text": "def get_followers\n followers_list = []\n self.followers.collect{|follower| followers_list << follower.following_user}\n followers_list = followers_list - self.friends\n end", "title": "" }, { "docid": "5a45ce5b6c1f363928a4fc2ce8763464", "score": "0.59568244", "text": "def followers\n users = Subscription.all(:conditions => ['conversation_id = ?',self.personal_conversation_id], :include => :user).map {|s| s.user}\n return users - [self]\n end", "title": "" }, { "docid": "208f3350df027bdab0c9495b8c66f72d", "score": "0.5940941", "text": "def my_followers_mottos\n x = self.members.map do |bo|\n bo.follower.life_motto\n end\n x.each do |motto|\n puts motto\n end\n return nil\n end", "title": "" }, { "docid": "eb61b8c7eb9dd55a7e5412ec52b91d18", "score": "0.5885429", "text": "def cult_population\n cult_population_array = []\n BloodOath.all.each do |bloodoath|\n if bloodoath.cult == self\n cult_population_array << bloodoath.follower\n end\n end\n # With Select Method \n # BloodOath.all.select {|bloodoath| bloodoath.cult == self}.length\n cult_population_array.length\n end", "title": "" }, { "docid": "ef0069c1ca79570b6d26ddf365e60580", "score": "0.5856252", "text": "def followers \n self.bloodoaths.collect {|bloodoath| bloodoath.follower}\n end", "title": "" }, { "docid": "801807cc5b7d377a93711ccafa14fd1f", "score": "0.58506876", "text": "def followers\n passive_relationships.includes(:follower).where(confirmed: true).map(&:follower)\n end", "title": "" }, { "docid": "a7fd3b647d99883dbb677f209dd6bda6", "score": "0.5835696", "text": "def my_cults_slogans\n follower_cults = BloodOath.all.select do |blood_oath_instance|\n blood_oath_instance.follower == self\n end\n follower_cults.select do |blood_oath_instance|\n puts blood_oath_instance.cult.slogan\n end\n end", "title": "" }, { "docid": "96f5b5a7f9ba6e43cd07794675a4c976", "score": "0.58245367", "text": "def adult_memberships\n am = circle.memberships.collect {|m| m if m.roles.include?(Family::ADULT_ROLE)} \n am.compact\n end", "title": "" }, { "docid": "9650911333726d3e12a9a760ef1c686e", "score": "0.5824376", "text": "def investors\n fundings.map{|funding| funding.venture_capitalist}.uniq\n end", "title": "" }, { "docid": "7a9666a7212aeb81e2c59d9048090bb1", "score": "0.5823149", "text": "def my_folllowers_mottos\n a = BloodOath.all.select{|follo|follo.cult == self}\n a.map{|ag|ag.follower.life_motto}\nend", "title": "" }, { "docid": "bbcf7f80e4aef556be32dafeca25dd65", "score": "0.58049697", "text": "def outstanding_creditors\n creditors = []\n members.each do |member|\n credit = amount_owed_to(member)\n creditors << {:member => member, :credit => credit} if credit > 0\n end\n creditors\n end", "title": "" }, { "docid": "56037ca19ee03ed0621aae7dcc608567", "score": "0.57965326", "text": "def all_followees\n get_followees_of(self)\n end", "title": "" }, { "docid": "89e0a077635ecdbe529bc682d86037c5", "score": "0.5794612", "text": "def my_cults_slogans\n self.cults.map{|cult| cult.slogan}\n end", "title": "" }, { "docid": "89e0a077635ecdbe529bc682d86037c5", "score": "0.5794612", "text": "def my_cults_slogans\n self.cults.map{|cult| cult.slogan}\n end", "title": "" }, { "docid": "94fec4746c4b06abee319c2bb21646cc", "score": "0.5783538", "text": "def followers\n bloodoaths.map do |bloodoath|\n bloodoath.follower\n end\n end", "title": "" }, { "docid": "b8daaa12c1b1ab937ca5c11ca274ec6f", "score": "0.5781366", "text": "def cult_population\n @@cult_followers.size\n end", "title": "" }, { "docid": "26bf7ecff4aed327e1a323378b04c940", "score": "0.57700807", "text": "def couriers\n @couriers ||= []\n end", "title": "" }, { "docid": "fe30d514b641044f4f8d1e5d71e61f8b", "score": "0.5765836", "text": "def my_followers_mottos\n self.followers.each do |follower|\n puts follower.life_motto\n end\n end", "title": "" }, { "docid": "fe30d514b641044f4f8d1e5d71e61f8b", "score": "0.5765836", "text": "def my_followers_mottos\n self.followers.each do |follower|\n puts follower.life_motto\n end\n end", "title": "" }, { "docid": "5dc36ba1d4f4172fe0e1167e6e733bda", "score": "0.5736998", "text": "def followees\n followees = []\n User.all.each do |user|\n followees << user if user.followers.include? User.find(self.id)\n end\n followees\n end", "title": "" }, { "docid": "040ec0b8b94daad742c682eda95a4bee", "score": "0.57342136", "text": "def join_cult(cult)\n cult.followers << self\n\n end", "title": "" }, { "docid": "c14a575583a72745e4eb3e84c82c09ce", "score": "0.57121056", "text": "def crew\n a = []\n crew_members.crew.each {|x| a << x.user}\n a\n end", "title": "" }, { "docid": "6115dc9920f08f0b5df484c883aa52f1", "score": "0.56723064", "text": "def followers\n all_followers = self.blood_oaths.map do |blood_oath|\n blood_oath.follower\n end\n # if we wanted to make sure this returns a UNIQUE array of followers, we could do:\n all_followers.uniq\n end", "title": "" }, { "docid": "ce94c72c4383899a04e1383df8bea81e", "score": "0.5645066", "text": "def participants\n raters = RatingGroup.where(contribution_id: contribution_ids).collect{|rating_group| rating_group.person }.uniq\n persons = [self.person]\n persons += self.contributors\n persons += raters\n persons.flatten.uniq.reject(&:blank?)\n end", "title": "" }, { "docid": "346a06844e04fa515d9ec5f5b7489f53", "score": "0.5635169", "text": "def join_cult(cult)\n cult.recruit_follower(self)\n \n end", "title": "" }, { "docid": "5c818b615874a41e6d587f10f10233b5", "score": "0.5628617", "text": "def incoming_followers\n User.where(domain: timeline_entries.from_others.includes(:post).pluck('distinct domain'))\n end", "title": "" }, { "docid": "48413e9f962f1e6e4f3fbe1f0e7ea160", "score": "0.5628252", "text": "def my_followers_mottos\n followers.each { |follower| puts follower.life_motto }\n end", "title": "" }, { "docid": "757dc24cf2fba53326857e01d34438df", "score": "0.56268424", "text": "def tournaments\n response = get request_url('tournaments')\n if response.success?\n Sportradar::Api::SoccerV3::Tournaments.new indifferent_access(response)\n else\n response\n end\n end", "title": "" }, { "docid": "596abaa73a9e1e787f6af1a0202cfc4a", "score": "0.56202924", "text": "def followers\n followed_me\n end", "title": "" }, { "docid": "3f25de7d053b221b6a62542915e23c34", "score": "0.56196684", "text": "def traveler_array\n # Parse the other_travelers field\n # return [self.member.id] unless self.other_travelers # if nil, just return member\n if !self.other_travelers.blank?\n others = self.other_travelers.split(/;|,/).map {|n| n.strip}.compact.map do |n|\n n.sub(/^(\\w*) +(&|and|) +(.*) +(.*)/,'\\1 \\4; \\3 \\4').gsub(/\\s+/,' ').split(/ & | and |; /)\n end.flatten\n else\n others = []\n end \n # Add the member & spouse if any\n return (\n [(self.member.id if self.member), \n (self.member.spouse.id if self.member && self.member.spouse && self.with_spouse)] + \n others).compact\n end", "title": "" }, { "docid": "9c848a599ea8d77e93f056ae19fd4128", "score": "0.56096584", "text": "def followings\n @followings = current_user.followings\n end", "title": "" }, { "docid": "7b547f55aed862552234b523ad5df761", "score": "0.5609457", "text": "def followers\n BloodOath.all.select do |bloodoath|\n # bindbling.pry\n bloodoath.cult.name == self.name\n end\n end", "title": "" }, { "docid": "b875a75a460f79b9b13a93a3f1c34fce", "score": "0.5600198", "text": "def followers_age \n self.followers.map do |follower|\n follower.age\n end\n end", "title": "" }, { "docid": "0cc824413dc1bda077e46e88fdb18bfd", "score": "0.5599444", "text": "def active_followers\n followers_friendships.where(status: :accepted).map(&:requester)\n end", "title": "" }, { "docid": "5b402e4fdbae2a9d0b9b33cf425ae642", "score": "0.55948746", "text": "def accompanists\n self.appearances.with_role('accompanist').map(&:participant)\n end", "title": "" }, { "docid": "dc7f614a77cf990c2a03aa31a67a4b69", "score": "0.55819523", "text": "def followers\n\t\tRelationship.where(followed_id: _id).pluck(:follower)\n\tend", "title": "" }, { "docid": "e2b2d8dddedb3c807076afb2f1b2dcaa", "score": "0.5575599", "text": "def get_course_followers\n User.find_by_sql([\"select * from users where id in (select distinct(user_id) from activities where course_id = ?)\", self.id])\n end", "title": "" }, { "docid": "a2c1c2191488398b94e9aa704a57faed", "score": "0.5574026", "text": "def collect_teachers_leaders\n TeacherLeader.all.collect do |t|\n [ \"#{t.teacher.teacher_last_name} #{t.teacher.teacher_first_name} #{t.teacher.teacher_middle_name}\", t.id ]\n end\n end", "title": "" }, { "docid": "c6b11e6b8f0ca48e324604328af8da95", "score": "0.55708694", "text": "def seminar_teachers\r\n seminar_member__teachers.map(&:user)\r\n end", "title": "" }, { "docid": "08e7adca4e445ad4f96102c9c52ae814", "score": "0.5567634", "text": "def investors\n arr = []\n FundingRound.all.map do |s|\n arr << s.venture_capitalist.name \n end\n arr.uniq\n end", "title": "" }, { "docid": "9d9e950aa15afd2ede5c9e3400ce200a", "score": "0.5540477", "text": "def followerUsers\n User.find(self.followers.pluck(:follower_id))\n end", "title": "" }, { "docid": "17f8f104b364b40961dbf30341ee5b81", "score": "0.5540246", "text": "def participants #igger loudin\n participating_users.includes(:user).map(&:user)\n end", "title": "" }, { "docid": "da2d44b465558dd6a18d78986b258f8c", "score": "0.55371505", "text": "def find_all_followers\n self.find_all_bloodoaths.map do |bloodoath|\n bloodoath.follower\n end.uniq\n end", "title": "" }, { "docid": "7aa2a2c1b570f9386cdc55b74028d1f9", "score": "0.55317676", "text": "def cult_population\n # * returns a `Fixnum` that is the number of followers in this cult\n cult_oaths = BloodOath.all.select do |blood_oath|\n blood_oath.cult == self\n end\n cult_oaths.length\n end", "title": "" }, { "docid": "694780555c680a6f9af8b8db1fa6982d", "score": "0.5525943", "text": "def cult_population\n self.followers.count\n end", "title": "" }, { "docid": "67deccd71a262deb587858c5e21850b3", "score": "0.55199194", "text": "def followers\n @followers ||= client.followers\n @followers.attrs[:users].map{|f| f[:name]}\n end", "title": "" }, { "docid": "49507f50f8ee277a64d9fa1860b2df69", "score": "0.55072725", "text": "def credits\n character_credits.reduce([]) do |memo, character|\n memo.push(character.get_roles)\n end.flatten\n end", "title": "" }, { "docid": "0ec4e711adbb0aa5c4686368399ef7aa", "score": "0.5503851", "text": "def follows\n\t\tfollowings.map(&:followee)\n\tend", "title": "" }, { "docid": "2f8710a341aad3cec66f587d307aeea5", "score": "0.5486109", "text": "def participants\n return @participants\n end", "title": "" }, { "docid": "25054c6b9e27b982ddd8bb0b92419bc8", "score": "0.54828155", "text": "def participants\n users = messages.includes(:sender).map(&:sender).uniq.select { |u| u.is_a?(User) }\n\n users.map do |user|\n community.memberships.where(user: user).first\n end\n end", "title": "" }, { "docid": "728dcd6b534d822601ebec05ec97e9d5", "score": "0.54800195", "text": "def add_merged_contestants_as_values\n @tribes.each {|tribe_member| @merged_tribe_array << tribe_member.members}\n @merged_tribe_array.flatten!\n end", "title": "" }, { "docid": "4614e1aa96c092672afe2555c433d949", "score": "0.54798794", "text": "def participants\n return @participants\n end", "title": "" }, { "docid": "8f8c6420155b45d309ad56fdc5f5eb88", "score": "0.54734313", "text": "def subscribed_to_followers\n @roster.select {|c| c.subscribed_to? }\n end", "title": "" }, { "docid": "00ea3b19c98c147a62a6fad9c87389c3", "score": "0.54723483", "text": "def donnerContributeurs()\n\t\tcontributeurs = Array.new()\n\t\[email protected] do |utilisateur| \n\t\t\tif utilisateur.estContributeur?() or utilisateur.estAuteur?() \n\t\t\t\tcontributeurs.push(utilisateur.nom())\n\t\t\tend\n\t\tend\n\t\treturn contributeurs.sort()\n\tend", "title": "" }, { "docid": "a70e22d0c73d1d144df37e6d0c52f850", "score": "0.5468859", "text": "def data_collectors\n return [] unless scheduled_activities\n\n scheduled_activities.map(&:responsible_user).uniq\n end", "title": "" }, { "docid": "4ef83d2dea7713226de30e6ede43d2ad", "score": "0.5467576", "text": "def following_user_names\n return following.pluck(:user_name)\n end", "title": "" }, { "docid": "fdf29c1fde0aac039a5f00fe8514a837", "score": "0.5466147", "text": "def relationships_follower_private\n followed_users = Relationship.where(followed_id: @current_user.id)\n @my_users = Array.new\n for user in followed_users do\n @my_users.push(User.find_by(id: user.follower_id))\n end\n end", "title": "" } ]
54c39db5f7958a8d3bbf1591ca11bfc9
Build a method, `big_shoe_rebounds`, that will return the number of rebounds associated with the player that has the largest shoe size. Break this one down into steps: First, find the player with the largest shoe size Then, return that player's number of rebounds Remember to think about return values here.
[ { "docid": "a37ce7e893a7293969318ad17a5c5d29", "score": "0.7756258", "text": "def big_shoe_rebounds\n rebounds = 0\n big_shoe = 0\n game_hash.each do |loc, data|\n data[:players].each do |player_stats|\n if player_stats[:shoe] > big_shoe\n big_shoe = player_stats[:shoe]\n rebounds = player_stats[:rebounds] \n end\n end\n end\n return rebounds\n end", "title": "" } ]
[ { "docid": "ce08cfcda2b529b15e4332215748e8e5", "score": "0.8049876", "text": "def big_shoe_rebounds\n #Find player with biggest shoe\n find_number_rebounds(find_max_shoe)\nend", "title": "" }, { "docid": "29d0c0ae5779654162c92f0b86e192fc", "score": "0.795801", "text": "def rebounds_for_largest_shoe_size(game)\n max_player = nil\n game.each do |team, team_hash|\n team_hash[:players].each do |player, player_hash|\n max_player ||= player_hash\n max_player = player_hash if player_hash[:shoe_size] > max_player[:shoe_size]\n end\n end\n\n max_player[:stats][:rebounds]\nend", "title": "" }, { "docid": "e0c1ab113189f24422344c03897cdd56", "score": "0.795696", "text": "def big_shoe_rebounds()\n all_players_array = get_all_players()\n max_shoe_size = 0\n max_shoe_player_hash = Hash.new\n len = all_players_array.length()\n i = 0\n while i < len\n player = all_players_array[i]\n shoe_size = player[:shoe]\n if(shoe_size > max_shoe_size)\n max_shoe_size = shoe_size\n max_shoe_player_hash = player\n end\n i += 1\n end\n rebounds = max_shoe_player_hash[:rebounds]\n return rebounds\n\nend", "title": "" }, { "docid": "2dbd8355554fc792d0a23c3babd854ea", "score": "0.7874455", "text": "def big_shoe_rebounds\n \n big_shoe = max_stat(:shoe)\n \n rebounds = stat_search(big_shoe[:max_player], :rebounds)\n \n return rebounds\n \nend", "title": "" }, { "docid": "b2a4140c6f0850ce70d401726c6769c9", "score": "0.78698075", "text": "def big_shoe_rebounds \n game_hash \n home_counter = 0\n away_counter = 0\n home_counter2 = 0\n away_counter2 = 0 \n shoe_sizes = []\n largest_shoe = 0\n #Adds shoe size of all the home players \n while home_counter < game_hash[:home][:players].length\n shoe_sizes << game_hash[:home][:players][home_counter][:shoe]\n home_counter += 1\n end \n #Adds shoe size of all the away players \n while away_counter < game_hash[:away][:players].length\n shoe_sizes << game_hash[:away][:players][away_counter][:shoe]\n away_counter += 1\n end \n #Find largest shoe in array and set it to variable \n largest_shoe = shoe_sizes.max \n #Checks to see if the largest shoe belongs to a player on the away team, if so, returns his rebounds \n while away_counter2 < game_hash[:away][:players].length do\n if game_hash[:away][:players][away_counter2][:shoe] == largest_shoe\n return game_hash[:away][:players][away_counter2][:rebounds]\n else \n end \n away_counter2 += 1\n end \n #Checks to see if the largest shoe belongs to a player on the home team, if so, returns his rebounds \n while home_counter2 < game_hash[:home][:players].length do\n if game_hash[:home][:players][home_counter2][:shoe] == largest_shoe\n return game_hash[:home][:players][home_counter2][:rebounds]\n else \n end \n home_counter2 += 1\n end \nend", "title": "" }, { "docid": "76bd80467d07966e562314113e4ff90a", "score": "0.7859423", "text": "def big_shoe_rebounds\n return player_with_biggest(:shoe)[:rebounds]\nend", "title": "" }, { "docid": "76bd80467d07966e562314113e4ff90a", "score": "0.7859423", "text": "def big_shoe_rebounds\n return player_with_biggest(:shoe)[:rebounds]\nend", "title": "" }, { "docid": "b1399ad5612d489d7c04890cde4c4a63", "score": "0.780406", "text": "def big_shoe_rebounds\n hash = game_hash()\n \n # Find biggest shoe\n shoe_size = []\n hash.each do |team, attributes|\n i = 0\n players = hash[team][:players]\n while i < players.length\n shoe_size << players[i][:shoe]\n i += 1\n end\n end\n max = shoe_size.max\n \n # Find big shoe rebounds\n hash.each do |team, attributes|\n i = 0\n players = hash[team][:players]\n while i < players.length\n if players[i][:shoe] == max\n return players[i][:rebounds]\n end\n i += 1\n end\n end\nend", "title": "" }, { "docid": "d4aee834b38266fee657111def627383", "score": "0.77956355", "text": "def big_shoe_rebounds\n #determine the player with the biggest shoe\n biggest_player = nil\n biggest_size = 0\n game_hash.each do |location, team_data|\n team_data[:players].each do |player, stats|\n if biggest_player == nil\n biggest_player = player\n biggest_size = stats[:shoe]\n end\n if stats[:shoe] > biggest_size\n biggest_player = player\n biggest_size = stats[:shoe]\n end\n end\n end\n # return the rebounds for the player\n game_hash.each do |location, team_data|\n if team_data[:players][biggest_player]\n return team_data[:players][biggest_player][:rebounds]\n end\n end\nend", "title": "" }, { "docid": "403574173d13bfb8b56c581a49316d6b", "score": "0.77752376", "text": "def big_shoe_rebounds\n # Start with initial value assignments to be able to later update them and capture actual values\n big_shoe_player = nil\n big_shoe_player_rebounds = nil\n player_shoe_sizes = {}\n num_rebound = nil\n \n # Visit each player in the hash to populate the hash of player_shoe_sizes\n game_hash.each do |location, team_data|\n team_data[:players].each do |person_name, data|\n player_shoe_sizes = player_shoe_sizes.merge({person_name => data[:shoe]})\n end\n end\n \n # Once the player_shoe_sizes hash has been populated, find out the name of the player with the biggest shoe size\n big_shoe_player = player_shoe_sizes.max_by { |player, shoe_size| shoe_size }[0]\n\n # Once the name of that player has been established, find out the associated number of rebounds\n game_hash.each_key do |location|\n if (game_hash[location][:players]).include?(big_shoe_player)\n num_rebound = game_hash[location][:players][big_shoe_player][:rebounds]\n end\n end\n num_rebound\nend", "title": "" }, { "docid": "b2526949f45579ccaa53b9d4f470242c", "score": "0.7704409", "text": "def big_shoe_rebounds\n max_shoe_stats = nil # statistic hash\n max_shoe = nil # integer of maximum shoe size\n \n game_hash.each do |location, team|\n team[:players].each do |player_name, stats|\n if max_shoe_stats == nil || stats[:shoe] > max_shoe\n max_shoe_stats = stats\n max_shoe = stats[:shoe]\n end\n end\n end\n \n binding.pry\n return max_shoe_stats[:rebounds]\nend", "title": "" }, { "docid": "cb95ddaa79158eaa2023206e2efc8c21", "score": "0.7697831", "text": "def big_shoe_rebounds\n# Identify player's name with largest shoe size\n big_foot = find_player_name(home_shoe_max)\n# Return that player's number of rebounds\n hash = player_stats(big_foot)\n hash[:rebounds]\nend", "title": "" }, { "docid": "13e2e08b9edab00322b3968d17d0624e", "score": "0.7685586", "text": "def big_shoe_rebounds\n biggest_shoe_size = 0\n all_players.each do |player, values|\n # binding.pry\n if values[:shoe] > biggest_shoe_size\n biggest_shoe_size = values[:shoe]\n return values[:rebounds]\n end\n end\nend", "title": "" }, { "docid": "4202e675982a51bd07f6236b980c4465", "score": "0.76720315", "text": "def big_shoe_rebounds\n largestShoe = 0\n rebounds = 0\n game_hash.each do |team, team_info|\n team_info[:players].each do |player|\n if player[:shoe] > largestShoe\n largestShoe = player[:shoe]\n rebounds = player[:rebounds]\n end\n end\n end\n return rebounds\nend", "title": "" }, { "docid": "02606e911a6cb6f0bb6eff947fbae301", "score": "0.7628742", "text": "def big_shoe_rebounds\n largest_shoe_size = 0\n number_rebounds = 0\n \n game_hash.each do |place, team|\n team[:players].each do |player_data|\n if player_data[:shoe] > largest_shoe_size\n largest_shoe_size = player_data[:shoe]\n number_rebounds = player_data[:rebounds]\n end\n end\n end\n number_rebounds\nend", "title": "" }, { "docid": "32ee9b3d7574ae75d8d640fc6f638a85", "score": "0.7617065", "text": "def big_shoe_rebounds \n biggestshoe = 0\n player_biggest_shoe = 0\n \n game_hash.each do |team_position, team_data|\n team_data[:players].each do |player_name, player_stats|\n if player_stats[:shoe] > biggestshoe\n biggestshoe = player_stats[:shoe]\n player_biggest_shoe = player_stats[:rebounds]\n end\n end\n end\n\n biggestshoe #test to see if the shoe size is 19\n player_biggest_shoe #returns the solution\nend", "title": "" }, { "docid": "04516a80465e8545f8c3d3b46bef58e6", "score": "0.7601801", "text": "def big_shoe_rebounds\n new_hash = {}\n size_arr = []\n biggest_shoe_size = 0\n game_hash.each do |place, team|\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n size_arr << player[:shoe]\n end\n end\n end\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n if player[:shoe] == size_arr.max\n return player[:rebounds]\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "dfaaf7a397329c1646f694a653ede031", "score": "0.7584615", "text": "def big_shoe_rebounds\n biggest_shoe_rebounds = nil\n biggest_shoe_size = nil\n\n game_hash.each do |location, team_data|\n team_data[:players].each do |player_hash|\n if !biggest_shoe_rebounds || (player_hash[:shoe] > biggest_shoe_size)\n biggest_shoe_rebounds = player_hash[:rebounds]\n biggest_shoe_size = player_hash[:shoe]\n end\n end\n end\n\n biggest_shoe_rebounds\nend", "title": "" }, { "docid": "d53daf0520c7db0c8c8b95b46605c32a", "score": "0.7584146", "text": "def big_shoe_rebounds\n shoe_size = 0\n rebound = 0\n game_hash.each do |location, team_data|\n team_data[:players].each do |player_name, value|\n if value[:shoe] > shoe_size\n shoe_size = value[:shoe]\n rebound = value[:rebounds]\n end\n end\n end\n rebound\n end", "title": "" }, { "docid": "d4f69c3ab4b25a6436e292155f0cdaf3", "score": "0.75821555", "text": "def big_shoe_rebounds\n biggest_shoe = all_players.collect { |player, player_data| player_data[:shoe]}.max\n biggest_shoe_person = all_players.find { |player, player_data| player_data[:shoe] == biggest_shoe }\n biggest_shoe_person[1][:rebounds]\nend", "title": "" }, { "docid": "88bd5e91b925b003b3f9d6e1fcff4660", "score": "0.7581357", "text": "def big_shoe_rebounds\n size = 0\n game_hash.each do |team, team_details|\n team_details[:players].each do |player_name, player_details|\n if player_details[:shoe] > size\n size = player_details[:shoe]\n return player_details[:rebounds]\n end\n end\n end\nend", "title": "" }, { "docid": "0d55fe1440b2e9dbf3e55a464556ea70", "score": "0.7580068", "text": "def big_shoe_rebounds\n big_shoe = 0\n rebounds = 0\n game_hash.each do |team, team_info|\n team_info[:players].each do |player|\n if player[:shoe] > big_shoe\n big_shoe = player[:shoe]\n rebounds = player[:rebounds]\n end\n end\n end\n return rebounds\nend", "title": "" }, { "docid": "ef8d87e7a5413332bcaff4e9bd7fe89a", "score": "0.7562959", "text": "def big_shoe_rebounds\n size = 0\n rebounds = ''\n game_hash.each do |location, team_info |\n team_info[:players].each do | key, data |\n if data[:shoe] > size\n size = data[:shoe]\n rebounds = data[:rebounds]\n end\n\n end\n end\n return rebounds\nend", "title": "" }, { "docid": "1ab8879e7224181ac3518adab4b28ca2", "score": "0.7562482", "text": "def big_shoe_rebounds\n shoe_size = 0 #set to 0, number value\n rebounds = 0 #set to 0, number value\n \n game_hash.map do |location, team_data|\n team_data[:players].map do |player_hash|\n if player_hash[:shoe] > shoe_size #go through every player, track data. check if their size is bigger than one before?\n shoe_size = player_hash[:shoe] # shoe size value = that player who met the condition\n rebounds = player_hash[:rebounds] #rebounds now rep rebounds for that player\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "ed77d3b76dec358fc5784e1063e2b1e7", "score": "0.7561397", "text": "def big_shoe_rebounds\n big_shoe = 0\n #big shoe is set to 0\n rebounds = 0\n #rebounds is set to 0\n game_hash.each do |team, team_info|\n #in the game hash we iterate through the team hashes\n team_info[:players].each do |player|\n #iterate through each player\n if player[:shoe] > big_shoe\n #if the players shoe size if more than big_shoe\n big_shoe = player[:shoe]\n #the players shoe is set to big_shoe\n rebounds = player[:rebounds]\n #the players rebounds are set in rebounds\n end\n end\n end\n return rebounds\nend", "title": "" }, { "docid": "9aea62a73e92499437e27d55ebec77e7", "score": "0.753912", "text": "def big_shoe_rebounds\n #First, find the player with the largest shoe size\n largest_size = 0\n player_with_largest_shoes = \"\"\n big_shoe_rebounds = 0\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player_data|\n player_data.each do |name, stats|\n if stats[:shoe] > largest_size\n largest_size = stats[:shoe]\n player_with_largest_shoes = name\n big_shoe_rebounds = stats[:rebounds]\n end\n end\n end\n end\n end\n end\n #Then, return that player's number of rebounds\n big_shoe_rebounds\nend", "title": "" }, { "docid": "13825fa13936a6e337855fb0f1d92f4c", "score": "0.74723864", "text": "def big_shoe_rebounds\n shoe = 0\n rebounds = 0\n game_hash.each do |location, data|\n data[:players].each do |player|\n if player[:shoe] > shoe\n shoe = player[:shoe]\n rebounds = player[:rebounds]\n end\n end\n end\n return rebounds\nend", "title": "" }, { "docid": "b40d1d4f0e0098941342d8e54fce704c", "score": "0.7468142", "text": "def big_shoe_rebounds\n # Find the player with the biggest shoe\n hash = find_highest_value(:shoe)\n # return their rebounds\n hash[:rebounds]\nend", "title": "" }, { "docid": "1f2e6cce8fb45a1d1089d469ed3b970d", "score": "0.7463966", "text": "def big_shoe_rebounds\n biggest_shoe = 0\n rebounds = 0\n game_hash.each do |team,data|\n data[:players].each do |player, player_stats|\n if player_stats[:stats][:shoe] > biggest_shoe\n biggest_shoe = player_stats[:stats][:shoe]\n rebounds = player_stats[:stats][:rebounds]\n end\n end\n end\n return rebounds\nend", "title": "" }, { "docid": "a7828eda0979913e1de37083fb9541ec", "score": "0.7446073", "text": "def big_shoe_rebounds\n max_shoe = -1\n rebounds = -1\n game_hash.each{|home_or_away,team_properties|\n game_hash[home_or_away][:players].each{|player|\n if max_shoe < player[:shoe]\n max_shoe = player[:shoe]\n rebounds = player[:rebounds]\n end\n}\n}\nrebounds\nend", "title": "" }, { "docid": "e0e8b939d472c4c80241342ef875473c", "score": "0.74378145", "text": "def big_shoe_rebounds\n shoe_size = 0\n rebounds = 0\n game_hash.each do |location, team_data|\n team_data[:players].each do |name, stats| \n if stats[:shoe] > shoe_size\n shoe_size = stats[:shoe]\n rebounds = stats[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "98e7e7f0fdc48a523454898b1fa50704", "score": "0.74288297", "text": "def big_shoe_rebounds\nteam_info.max_by {|h| h[:shoe]}[:rebounds]#h[:shoe] returns a hash of stats with the biggest shoe size\nend", "title": "" }, { "docid": "59de251ea1c0969f475879fadc85860a", "score": "0.74242467", "text": "def big_shoe_rebounds\r\nbiggest_shoe = 0\r\nplayer_rebounds = 0\r\ngame_hash.values.each do |team_info|\r\nteam_info[:players].each do |player|\r\n\r\n shoe = player[:shoe]\r\n \r\n if shoe > biggest_shoe\r\n biggest_shoe = shoe\r\n player_rebounds = player[:rebounds]\r\n end\r\nend\r\nend\r\nreturn player_rebounds\r\nend", "title": "" }, { "docid": "2dfd353cf31e6ab8e9eb61a48759f4a1", "score": "0.7369983", "text": "def big_shoe_rebounds\n max = 0\n rebounds = 0\n game_hash.each do |ho_away, info|\n i = 0 \n while i < info[:players].length do \n if info[:players][i][:shoe] > max\n max = info[:players][i][:shoe]\n rebounds = info[:players][i][:rebounds]\n end\n i += 1\n end\n end\n rebounds\nend", "title": "" }, { "docid": "562b471c55fdad01940f8ab0cd5d675b", "score": "0.73583585", "text": "def big_shoe_rebounds \n \n biggest_shoes_rebound_count = 0\n player_with_the_biggest_shoes = who_has_biggest_shoes\n \n game_hash.each do |side, data|\n data[:players].each do |players, stats|\n if players == who_has_biggest_shoes\n \n stats.each do |specific_stat, specific_stat_value|\n if specific_stat == :rebounds\n biggest_shoes_rebound_count = specific_stat_value\n end #end if\n end #end stat_list each\n \n end #end if players has biggest shoes\n end #end data each\n end #end game hash\n biggest_shoes_rebound_count\nend", "title": "" }, { "docid": "71ce8e58cbcb61674463e79baa4e32ed", "score": "0.73199624", "text": "def big_shoe_rebounds\n biggest_shoe_player = []\n biggest_shoe_size = 0\n game_hash.each do |location, info|\n info.each do |info, data|\n if info == :players\n #binding.pry\n data.each do |name, stats|\n stats.each do |stat, num|\n if stat == :shoe\n if num > biggest_shoe_size\n biggest_shoe_size = num\n biggest_shoe_player = name\n #binding.pry\n end\n end\n end\n\n end\n end\n end\n return game_hash[location][:players][biggest_shoe_player][:rebounds]\n end \nend", "title": "" }, { "docid": "0c63272fafa0533699eeda9f22f5f127", "score": "0.7312952", "text": "def big_shoe_rebounds\n biggest_shoe = 0 \n rebounds = 0\n \n all_players_stats_rebounds.each do |stat_hash| \n\n current_shoe_size = stat_hash.keys.first\n current_rebounds = stat_hash.values.first\n if current_shoe_size >= biggest_shoe\n biggest_shoe = current_shoe_size\n rebounds = current_rebounds\n end \n \n end \n rebounds\nend", "title": "" }, { "docid": "e5d4eafcd56fcf2a3c905d6180a59682", "score": "0.7302207", "text": "def big_shoe_rebounds\n \n big_shoe = 0\n rebounds = 0\n \n game_hash.each do |key, value|\n \n value[:players].each do |player|\n \n if big_shoe < player[:shoe]\n rebounds = player[:rebounds]\n big_shoe = player[:shoe]\n \n end\n end\n end\n return rebounds\nend", "title": "" }, { "docid": "ac56d26c2ea5541558036009774ea40e", "score": "0.7287295", "text": "def big_shoe_rebounds\n \n #Initialize two variables to compare shoe sizes and retain player name later on\n biggest_shoe = 0\n player = ''\n \n \n #Step 1: find player with biggest shoe\n game_hash.each do |location, team_data|\n team_data[:players].each do |name, stats|\n if biggest_shoe == 0\n biggest_shoe = stats[:shoe]\n player = name\n elsif stats[:shoe] > biggest_shoe\n biggest_shoe = stats[:shoe]\n player = name\n end\n end\n end\n \n \n #Step 2: return player's rebounds\n game_hash.each do |location, team_data|\n team_data[:players].each do |name, stats|\n if name == player\n return stats[:rebounds]\n end\n end\n end\nend", "title": "" }, { "docid": "d80fd8ecb5f193c1c99ad414f28c401a", "score": "0.7279626", "text": "def big_shoe_rebounds\n shoe_size_array = []\n\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player_name, stats|\n shoe_size_array << game_hash[location][attribute][player_name][:shoe]\n end\n end\n end\n end\n big_shoe_size = shoe_size_array.sort.last\n\n big_shoe_rebounds = 0\n\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player_name, stats|\n if game_hash[location][attribute][player_name][:shoe] == big_shoe_size\n big_shoe_rebounds = game_hash[location][attribute][player_name][:rebounds]\n end\n end\n end\n end\n end\n big_shoe_rebounds\nend", "title": "" }, { "docid": "f8f07dd23f0d559f738816b103b0bbdc", "score": "0.72723836", "text": "def big_shoe_rebounds\n constant_shoe = 0\n highest_rebounds = 0\n game_hash.each do |location, team_data|\n team_data[:players].each do |key, info|\n if info[:shoe] > constant_shoe\n constant_shoe = info[:shoe]\n highest_rebounds = info[:rebounds]\n end\n end\n end\n highest_rebounds\nend", "title": "" }, { "docid": "234dbe61132c408b0fe72fd84b26fd11", "score": "0.7266604", "text": "def big_shoe_rebounds\n big_shoe = nil\n rebounds = nil\n all_players.each { |player_hash|\n player_hash.each { |field, data|\n if field == :shoe\n if big_shoe.nil?\n big_shoe = data\n elsif data > big_shoe\n big_shoe = data\n end\n end\n }\n }\n\n all_players.each { |player_hash|\n if player_hash[:shoe] == big_shoe\n rebounds = player_hash[:rebounds]\n end\n }\n\n rebounds\nend", "title": "" }, { "docid": "1c4ddb942eeeb4b98a8b1f93a82c11c0", "score": "0.72651094", "text": "def big_shoe_rebounds\n return biggest_shoe[:rebounds]\nend", "title": "" }, { "docid": "3384b106c3e19bb3dbb3a63cb230c814", "score": "0.7249651", "text": "def big_shoe_rebounds\n max = nil\n rebounds = nil\n game_hash.each do |team, team_values|\n team_values[:players].each do |player|\n if max == nil || player[:shoe] > max\n max = player[:shoe]\n rebounds = player[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "15155f18598f28980a5bcef71bd8b1c2", "score": "0.72473705", "text": "def big_shoe_rebounds\n feet = []\n game_hash.each do |place, team|\n team.each do |attributes, data|\n if attributes == :players\n data.each do |player|\n feet.push(shoe_size(player[:player_name]))\n end\n end\n end\nend\n game_hash.each do |place, team|\n team.each do |attributes, data|\n if attributes == :players\n data.each do |player|\n if shoe_size(player[:player_name]) == feet.max\n return player[:rebounds]\n end\n end\n end\n end\n end\n\nend", "title": "" }, { "docid": "3bd0c07f3c5e6f6bd323df9d0771dd36", "score": "0.72390556", "text": "def big_shoe_rebounds\n big_shoe_rbnds = 0\n big_shoe = 0\n game_hash.each do |a,b|\n b[:players].each do |c,d|\n if d[:shoe] > big_shoe\n big_shoe_rbnds = d[:rebounds]\n end\n end\n end\n big_shoe_rbnds\nend", "title": "" }, { "docid": "cf25cacee8c92aef5f43a398ff9f6f36", "score": "0.72356737", "text": "def big_shoe_rebounds\n largest_shoe = nil\n rebounds = nil\n game_hash.each do |home_or_away, team|\n team[:players].each do |key, player|\n if largest_shoe == nil or player[:shoe] > largest_shoe\n largest_shoe = player[:shoe]\n rebounds = player[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "a9b5ba9b9d890584a0d03da5cee15b77", "score": "0.72269046", "text": "def big_shoe_rebounds\n shoe_size = 0\n rebounds = nil\n game_hash.each_pair do |key1, values1|\n values1.each_pair do |key2, values2|\n if key2 == :players\n values2.each do |key_value_pair| \n if key_value_pair[:shoe] > shoe_size\n rebounds = key_value_pair[:rebounds]\n shoe_size = key_value_pair[:shoe]\n end\n end\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "de69882794d10ade9cdd3896c4aef3c4", "score": "0.7202677", "text": "def big_foot_rebounds(game)\n biggest_shoe_name = \"\"\n biggest_shoe_size = 0\n #figure out who has the biggest shoe\n game[:home][:players].each do |player_hash|\n if player_hash[:shoe_size] > biggest_shoe_size\n biggest_shoe_size = player_hash[:shoe_size]\n biggest_shoe_name = player_hash[:player_name]\n end\n end\n game[:away][:players].each do |player_hash|\n if player_hash[:shoe_size] > biggest_shoe_size\n biggest_shoe_size = player_hash[:shoe_size]\n biggest_shoe_name = player_hash[:player_name]\n end\n end\n \n # get that player's rebounds\n rebounds_arr = []\n rebounds_arr << biggest_shoe_name\n game[:home][:players].each do |player_hash|\n rebounds_arr << player_hash[:stats][:rebounds] if player_hash[:player_name] == biggest_shoe_name\n end\n \n game[:away][:players].each do |player_hash|\n rebounds_arr << player_hash[:stats][:rebounds] if player_hash[:player_name] == biggest_shoe_name\n end\n rebounds_arr\nend", "title": "" }, { "docid": "31ba2cbd1253b666e9546622e6acfc45", "score": "0.7188581", "text": "def big_shoe_rebounds\nrebound = 0 \nshoe = 0 \n game_hash.each do |team_position, team_data|\n team_data[:players].each do |key,value|\n value.each do |k,v|\n if k == :shoe #when key matches the loop below will trigger. \n if v > shoe #checks the value of each shoe\n shoe = v #max value of the shoe is assigned\n rebound = team_data[:players][key][:rebounds]\n #rebound is corresponding with the value of the shoe and it is assigned with the player with highest shoe size and rebounds.\n \n\n end\n end\n end\n end\n end\n rebound\n end", "title": "" }, { "docid": "05b91a496e147b584b7cc877c3963c67", "score": "0.7184061", "text": "def big_shoe_rebounds\n name = \"\"\n largest_shoe = nil\n rebounds = nil\n\n game_hash.values.each do |team|\n team[:players].each do |key, value|\n if largest_shoe == nil\n name = key[:player_name]\n largest_shoe = key[:shoe]\n rebounds = key[:rebounds]\n elsif key[:shoe] > largest_shoe\n name = key[:player_name]\n largest_shoe = key[:shoe]\n rebounds = key[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "a19f017f0c703d764870fe764300b3c8", "score": "0.7180453", "text": "def big_shoe_rebounds\n big_shoe = 0\n rebounds = 0\n game_hash.each do |location, team_data|\n team_data[:players].each do |player|\n if player[:shoe] > big_shoe\n big_shoe = player[:shoe]\n rebounds = player[:rebounds]\nend \nend \nend\nrebounds \nend", "title": "" }, { "docid": "efc27aa3659647b0e603bbbf6a0d84cc", "score": "0.716849", "text": "def big_shoe_rebounds\n largest = nil\n\n for player in PLAYERS.values do\n shoe = player[:shoe]\n\n if largest == nil\n largest = player\n elsif shoe > largest[:shoe]\n largest = player\n end\n end\n\n largest[:rebounds]\nend", "title": "" }, { "docid": "94cfc228bb1e5b5b6d0edd61f805e57e", "score": "0.7164551", "text": "def big_shoe_rebounds\n shoes = {}\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n next unless attribute == :players\n data.each do |player_data|\n shoes[player_data[:player]] = player_data[:shoe]\n end \n end\n end\n name = shoes.max_by{|k,v| v}\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n next unless attribute == :players\n data.each do |player_data|\n if name == player_data[:player_name]\n big_rebounds = player_data[:rebounds]\n return big_rebounds\n end\n end \n end\n end\nend", "title": "" }, { "docid": "5bb5e5ea4a1b3bfe9ee1b003c064f40d", "score": "0.71565473", "text": "def big_shoe_rebounds\n players = []\n shoe_sizes = []\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |x, y|\n players.push(x)\n shoe_sizes.push(data[x][:shoe])\n end\n end\n end\n end\n #this gives you the index of the max value\n max = shoe_sizes.each_with_index.max[1]\n f = players[max]\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n data.each do |x, y|\n if x == f\n return y[:rebounds]\n end\n end\n end\n end\nend", "title": "" }, { "docid": "b0c20837a500d5f97e1e382da3487ebf", "score": "0.7149638", "text": "def big_shoe_rebounds\n arr = []\n game_hash.each do |location, team_data|\n team_data[:players].each do |player, data|\n arr << data[:shoe]\n\n end\n end\n biggest_shoe = arr.sort[-1]\n game_hash.each do |location, team_data|\n team_data[:players].each do |player, data|\n if data[:shoe] == biggest_shoe\n return data[:rebounds]\n end\n end\n end\n end", "title": "" }, { "docid": "b8d8f98f20f0602fd92691f716a163cf", "score": "0.70928943", "text": "def big_shoe_rebounds\n shoe_size = 0 \n player_found = 0\n\n game_hash[:home][:players].each {|player|\n if shoe_size < player[:shoe]\n shoe_size = player[:shoe]\n player_found = player[:rebounds]\n end \n }\n\n game_hash[:away][:players].each {|player|\n if shoe_size < player[:shoe]\n shoe_size = player[:shoe]\n player_found = player[:rebounds]\n end \n }\n player_found\nend", "title": "" }, { "docid": "5be5d1fb0707947858c11987701aa18a", "score": "0.70826095", "text": "def big_shoe_rebounds\n biggest_shoe = 0\n rebound_count = 0\n\n game_hash.each do |location, team_data|\n team_data.each do |attribute, attribute_value|\n if attribute == :players\n attribute_value.each do |player_name, player_data|\n if player_data[:shoe] > biggest_shoe\n biggest_shoe = player_data[:shoe]\n rebound_count = player_data[:rebounds]\n end\n end\n end\n end\n end\n\n rebound_count\nend", "title": "" }, { "docid": "6978c244bdcb183b87b58fa44203b204", "score": "0.703429", "text": "def big_shoe_rebounds\n game_hash.each do |team_location, values|\n players = values[:players]\n big_foot = players.max_by{|k| k[:shoe]}[:player_name]\n players.each do |key, value|\n if key[:player_name] == big_foot\n return key[:rebounds]\n end\n end\n end\nend", "title": "" }, { "docid": "f6b28143dcb64514b6e143a00ab31b71", "score": "0.70026684", "text": "def big_shoe_rebounds\nmax_shoe_player = 0\nrebounds = 0\n game_hash.each do |location, attributes|\n attributes[:players].each do |category|\n if category[:shoe] > max_shoe_player\n max_shoe_player = category[:shoe]\n rebounds = category[:rebounds]\n end\n end\n end\n rebounds\nend", "title": "" }, { "docid": "f9cf83aaa0c020149785b7da2f5995b0", "score": "0.69594777", "text": "def big_shoe_rebounds\n all_shoes = []\n game_hash.each do |team, team_info_hash|\n if team == :home || :away\n team_info_hash.each do |attribute, data|\n if attribute == :players\n data.each do |index|\n all_shoes << index[:shoe]\n all_shoes.max\n end \n end\n if attribute == :players\n data.each do |index|\n if index[:shoe] == all_shoes.max\n return index[:rebounds]\n end\n end\n end\n end\n end\nend\nend", "title": "" }, { "docid": "7d89f4da8492f65f295272d4635ac2f8", "score": "0.69353896", "text": "def big_shoe_rebounds\n shoe_hash = Hash.new(0) # setting the default hash at 0\n\n game_hash.each do |location, attributes|\n attributes.each do |key, values|\n if key == :players\n values.each do |name, status|\n status.each do |key, value|\n if key == :shoe\n shoe_hash[name] = value\n end\n end\n end\n end\n end\n end\n sorted = shoe_hash.sort_by { |k, v| v} # sorting in numerical order, smallest first\n biggest_shoe = sorted[-1][0] # going to index -1 and pulling the value set at 0 \"Mason Plumlee\"\n # binding.pry\n \n game_hash.each do |location, attributes|\n attributes.each do |key, values|\n if key == :players\n values.each do |k, v|\n if k == biggest_shoe # pulled from code above\n v.each do |rebound, rebound_value|\n if rebound == :rebounds\n return rebound_value\n end\n end\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "5f6dc91eca4316e17e856ea6cc225ac9", "score": "0.6934534", "text": "def big_shoe_rebounds\n bs_rebound, big_shoe = 0, 0\n\n game_hash.each do |team, team_stats|\n team_stats.each do |stat, data|\n if stat == :players\n data.each do |player, pstats|\n if pstats[:shoe] > big_shoe\n big_shoe = pstats[:shoe]\n bs_rebound = pstats[:rebounds]\n end\n end\n end\n end\n end\n bs_rebound\nend", "title": "" }, { "docid": "5223adce54d1640149cd35039f5c31ba", "score": "0.69268537", "text": "def big_shoe_rebounds\n \n big_shoe = 0\n rebound_num = 0\n \n #loop key(:home, :away) and get value(hash)\n game_hash.each do |key, value|\n #loop value[:players](array) player(hash)\n value[:players].each do |player| \n if big_shoe < player[:shoe] \n big_shoe = player[:shoe] \n rebound_num = player[:rebounds]\n end\n end\n \n end\n rebound_num\nend", "title": "" }, { "docid": "9069ba57dc88fb0dee70fc39f45e96b8", "score": "0.6795615", "text": "def big_shoe_rebounds\n hash = game_hash\n x = 0\n rebounds = 0\n\n hash.each { |key, value|\n value[:players].each { |k, v|\n if x < k[:shoe]\n x = k[:shoe]\n rebounds = k[:rebounds]\n end\n }\n } \n rebounds\nend", "title": "" }, { "docid": "b814fe9e64d92ee90a935400538d3cd5", "score": "0.66378635", "text": "def rebounds_for_big_foot(game_data)\n big_foot = { shoe_size: 0 }\n game_data.each do |team|\n team[:players].each do |player|\n if player[:shoe_size] > big_foot[:shoe_size]\n big_foot = player\n end\n end\n end\n big_foot[:stats][:rebounds] \nend", "title": "" }, { "docid": "f84f368db3b52383499015ce3729297b", "score": "0.658485", "text": "def big_shoe_rebounds\n shoe = 0\n rebound = 0\n all_players.select do |player|\n if player[:shoe] > shoe\n shoe = player[:shoe]\n rebound = player[:rebounds]\n # binding.pry\n end\n end\n rebound\nend", "title": "" }, { "docid": "7e0007cc9fba1d5b9dd5456d00c266b1", "score": "0.6514895", "text": "def who_wears_biggest_shoe(shoe_size)\n name = \"\"\n players_info_hash = return_players_info\n players_info_hash.each do |player, stats|\n hold_player = player\n stats.each do |type, value|\n if type.to_s == \"shoe\" && value == shoe_size\n name = hold_player\n end\n end\n end\n name\nend", "title": "" }, { "docid": "e3e3484292a845d2c48e38c8f0807fd0", "score": "0.64561903", "text": "def big_shoe_rebounds\n #iterate home\n home_player = find_biggest_player(:home)\n #iterate away\n away_player = find_biggest_player(:away)\n #compare values\n #binding.pry\n if home_player[1] > away_player[1]\n return find_player_stat(:home, home_player[0], :rebounds)\n else\n return find_player_stat(:away, away_player[0], :rebounds)\n end \n #fetch that players rebound stat and return it\n \nend", "title": "" }, { "docid": "9474b1b94ff2cb28f6a57c532e767d84", "score": "0.63882333", "text": "def shoe_size (player_name)\n game_hash.each do |loc, data|\n data[:players].each do |player_stats|\n if player_stats[:player_name] == player_name\n return player_stats[:shoe]\n end\n end\n end\n end", "title": "" }, { "docid": "30d411a43e87438bb8f8c70e20846f78", "score": "0.62795824", "text": "def biggest_shoe\n biggest_shoe = {:shoe => 0}\n #iterate through teams\n game_hash.each do |teams, info|\n #iterate through team info\n info.each do |team_info, value|\n if team_info == :players\n #iterate through players and update biggest_shoe if shoe size larger\n value.each do |player|\n if player[:shoe] > biggest_shoe[:shoe]\n biggest_shoe = player\n end\n end\n end\n end\n end\n return biggest_shoe\nend", "title": "" }, { "docid": "d1fabdf32809766a602754acbdb1cf28", "score": "0.62295157", "text": "def shoe_size(player)\n game_hash.each do |location, team_data|\n if team_data[:players][player]\n return team_data[:players][player][:shoe]\n end\n end\nend", "title": "" }, { "docid": "94ad058943c4fed9492a9194bba5f778", "score": "0.6196185", "text": "def shoe_size(player)\n game_hash.each do |home_or_away, team|\n if team[:players].include?(player)\n return team[:players][player][:shoe]\n end\n end\n return 0\nend", "title": "" }, { "docid": "626f919faf76409bfa1a1f048a1ef297", "score": "0.61437255", "text": "def shoe_size(player)\n game_hash.each do |ho_aw,info| \n info.each do |team_id,stats| \n if team_id == :players\n stats.each do |baller|\n if baller[:player_name] == player\n return baller[:shoe]\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "9e19b7cc13004e6303b3c5e4505e0ce8", "score": "0.61283386", "text": "def shoe_size(player_name)\n return get_player(player_name)[:shoe]\nend", "title": "" }, { "docid": "5edfede516d08375992b8bc00551374a", "score": "0.610954", "text": "def shoe_size(player)\n game_hash.each do |location, team_data|\n team_data[:players].each do |player_hash|\n if player_hash[:player_name] == player\n return player_hash[:shoe]\n end\n end\n end\nend", "title": "" }, { "docid": "0d1caee4b1837385bde655cf8d33cbcc", "score": "0.60973173", "text": "def rebounds_for_bigfoot(game)\n biggest_foot = [\"Default Name\", 0, 0] # [Player, Shoe, Rebounds]\n\n game.each_value do |team|\n team[:players].each do |name, player_hash|\n\n if player_hash[:shoe] > biggest_foot[1]\n biggest_foot[0] = name\n biggest_foot[1] = player_hash[:shoe]\n biggest_foot[2] = player_hash[:stats][:rebounds]\n end\n\n end \n end\n\n bigfoot_name = biggest_foot[0]\n bigfoot_shoe = biggest_foot[1]\n bigfoot_rebounds = biggest_foot[2]\n\n puts \"#{bigfoot_name} has the biggest foot (size #{bigfoot_shoe}!) and has made #{bigfoot_rebounds} rebounds. Yowzahz! Mad rigorous.\"\n\nend", "title": "" }, { "docid": "fd85449d45f666bbeae3c0fe110f4643", "score": "0.60949373", "text": "def shoe_size(players_name)\n game_hash\n home_counter = 0\n away_counter = 0\n #Checks to see if the player exists on the away team, if so returns player's shoe\n while away_counter < game_hash[:away][:players].length do\n if game_hash[:away][:players][away_counter][:player_name] == players_name\n return game_hash[:away][:players][away_counter][:shoe]\n else \n end \n away_counter += 1\n end \n #Checks to see if the player exists on the home team, if so returns player's shoe\n while home_counter < game_hash[:home][:players].length do\n if game_hash[:home][:players][home_counter][:player_name] == players_name\n return game_hash[:home][:players][home_counter][:shoe]\n else \n end \n home_counter += 1\n end \nend", "title": "" }, { "docid": "400519dfcdb7f4ac9c7f28026bebf07b", "score": "0.6089881", "text": "def shoe_size(name)\n game_hash.each do |location, team_data|\n team_data[:players].each do |player_name, data|\n if player_name == name\n return data[:shoe]\n end\n end\n end\n \n end", "title": "" }, { "docid": "1915881eaf790b04aae51028f6a51454", "score": "0.6075326", "text": "def shoe_size(player)\n hash = game_hash()\n hash.each do |team, attributes|\n i = 0\n players = hash[team][:players]\n while i < players.length\n if players[i][:player_name] == player\n return players[i][:shoe]\n end\n i += 1\n end\n end\nend", "title": "" }, { "docid": "c1e02f7c229f6c95195dcbd7e92d0620", "score": "0.60594654", "text": "def shoe_size(player)\n player_stats(player)[:shoe]\nend", "title": "" }, { "docid": "41e03989bfb4c887558908e0a7f1d64a", "score": "0.6047548", "text": "def largest_foot(hash)\n arr = []\n hash.each do |team_loc, team_hash|\n team_hash[:players].each do |player_id|\n arr << player_id[:shoe_size]\n end\n team_hash[:players].each do |player_id|\n #p player_id[:player_name] if player_id[:shoe_size]== arr.max # returns player with largest shoe size\n p player_id[:stats][:rebounds] if player_id[:shoe_size]== arr.max #rebounds \n end\n end\n\nend", "title": "" }, { "docid": "e2bc69561010574d07d503c303b481c1", "score": "0.6041751", "text": "def find_max_shoe\n #Set max_shoe equal to negative infinity\n max_shoe = -1.0/0\n max_shoe_player = nil\n game_hash.each do |location, attributes|\n game_hash[location][:players].each do|pname, stats|\n if game_hash[location][:players][pname][:shoe] > max_shoe\n max_shoe = game_hash[location][:players][pname][:shoe]\n max_shoe_player = pname\n end\n end\n end\n max_shoe_player\nend", "title": "" }, { "docid": "0b4db8741c8edae13fced39dee13200c", "score": "0.6038409", "text": "def shoe_size(player)\n game_hash.each do |location, team_data|\n team_data[:players].each do |name, stats|\n if name.to_s == player\n return stats[:shoe]\n end\n end\n end\nend", "title": "" }, { "docid": "ebf4ef9234b683efd1f76886cb02f526", "score": "0.60277927", "text": "def shoe_size(size)\n players[size][:shoe]\nend", "title": "" }, { "docid": "947a9c9e09e1da26e87f9aeb4a144491", "score": "0.6015577", "text": "def shoe_size(player_name)\n game_hash.each do |place, team|\n team.each do |info, data|\n next unless info == :players\n\n data.each do |player|\n return player[:shoe] if player[:player_name] == player_name\n end\n end\n end\nend", "title": "" }, { "docid": "028e004d7fec88889d8ada96b0c59358", "score": "0.60148835", "text": "def shoe_size(player)\n game_hash.each do |location, team_data|\n team_data[:players].each { |name, stats| return stats[:shoe] if name == player }\n end\nend", "title": "" }, { "docid": "b28efcef4584450545c4e233af4e9d5f", "score": "0.60081637", "text": "def shoe_size(player_name)\n find_player(player_name)[:shoe]\nend", "title": "" }, { "docid": "803d4bca9522b1ceeed55480682096f7", "score": "0.60075104", "text": "def shoe_size(name)\n shoe_size = 0\n all_players_array = get_all_players()\n single_player_hash = get_player(all_players_array, name)\n shoe_size = single_player_hash[:shoe]\n return shoe_size\nend", "title": "" }, { "docid": "97714049986e39821cf6dff24fc70440", "score": "0.6001749", "text": "def shoe_size(player_name)\n player_stats(player_name)[:shoe]\nend", "title": "" }, { "docid": "ac1f93dad1c4884fa074b3509a72d153", "score": "0.5998188", "text": "def shoe_size(specific_player)\n game_hash.each do |location, team_data|\n team_data[:players].each do |player|\n if player[:player_name] == specific_player\n return player[:shoe]\n end\n end\n end\nend", "title": "" }, { "docid": "aa11ac4192e7621c14f365a94d0dab35", "score": "0.59768474", "text": "def shoe_size(name)\n\tall_players = players_array(game_hash)\n\tplayer = all_players.find do |player_hash|\n\t\tplayer_hash[:player_name] == name\n\tend\n\tplayer[:shoe]\nend", "title": "" }, { "docid": "73e2a6321a1e4ef45f8ef2317b269f91", "score": "0.5970582", "text": "def shoe_size_of_player(player_name, game)\n game.each do |team, team_hash|\n team_hash[:players].each do |player, player_hash|\n if player_hash[:name] == player_name\n return player_hash[:shoe_size]\n end\n end\n end\nend", "title": "" }, { "docid": "57cf3e431bf69ca87047f9adf9a727f1", "score": "0.596666", "text": "def shoe_size (player_name)\n game_hash.each do |location, data|\n data[:players].each do |player|\n if player[:player_name] == player_name\n return player[:shoe]\n end\n end\nend\nend", "title": "" }, { "docid": "b59d3f0dc3b8f6d1ddac18da2777a959", "score": "0.5944958", "text": "def shoe_size(player_name)\n game_hash.each do |team_location, values|\n players = values[:players]\n players.each do |key, value|\n if key[:player_name] == player_name\n return key[:shoe]\n end\n end\n end\nend", "title": "" }, { "docid": "b995bea33b9b32a26d5113e72f6886b8", "score": "0.5938046", "text": "def shoe_size(player_name)\n game_hash.each do |team, data|\n data[:players].each do |player, player_stats|\n if player_stats[:name] == player_name\n return player_stats[:stats][:shoe].to_i\n end\n end\n end\nend", "title": "" }, { "docid": "dcbc9d7c4aa75aae8acef2fa6b1f3789", "score": "0.59358263", "text": "def shoe_size(player_name)\n game_hash.each do |location, team_data| \n players = team_data[:players]\n players.each do |details|\n return details[:shoe] if details[:player_name] == player_name\n end\n end\nend", "title": "" }, { "docid": "f807d2281bd35e22c8368c886c655923", "score": "0.59047294", "text": "def shoe_size(name)\n find_shoe = players.find {|player| player.fetch(:player_name) == name }\n find_shoe.fetch(:shoe).to_i\nend", "title": "" }, { "docid": "0ec24e9e95d8911a381d6cab0763ec32", "score": "0.5901618", "text": "def shoe_size(player_name)\n game_hash.each{|team, properties|\n game_hash[team][:players].each{|player|\n if player[:player_name] === player_name\n return player[:shoe]\n end\n } \n}\nend", "title": "" }, { "docid": "3163e4f9134e1c62902b5d39525fdd15", "score": "0.58875406", "text": "def all_players_stats_rebounds\n \n all_players = game_hash[:home][:players] + game_hash[:away][:players]\n shoe_size = all_players[0..9].map { |i| {i[:shoe] => i[:rebounds]}}\n \nend", "title": "" } ]
32ced74f467da3c2cbc7f61a2a5d4c0c
Implements the serialized path of a code object.
[ { "docid": "4ded075cb6eb4344b9a06f121abd1eb7", "score": "0.6188686", "text": "def serialized_path(object)\n return object if object.is_a?(String)\n return File.join(object.path.split('::')) + (@extension.empty? ? '' : \".#{@extension}\")\n end", "title": "" } ]
[ { "docid": "1e2f4df7f324d7748863fdbf1eb4ad8a", "score": "0.7474669", "text": "def serialized_path(object); end", "title": "" }, { "docid": "1e2f4df7f324d7748863fdbf1eb4ad8a", "score": "0.7474669", "text": "def serialized_path(object); end", "title": "" }, { "docid": "54233dcb5fbcfb86d0d3dab6849fa591", "score": "0.73608387", "text": "def path\n @path ||= (code_object.nil? ? label : code_object.path)\n end", "title": "" }, { "docid": "2e1223ec4058062226fe8396a000520b", "score": "0.73397034", "text": "def serialized_path(object) end", "title": "" }, { "docid": "b9e6a1fb008d805727c467558d5d5193", "score": "0.7265601", "text": "def serialized_path(object)\n return object if object.is_a?(String)\n\n if object.is_a?(CodeObjects::ExtraFileObject)\n fspath = ['file.' + object.name + (extension.empty? ? '' : \".#{extension}\")]\n else\n objname = object != YARD::Registry.root ? mapped_name(object) : \"top-level-namespace\"\n objname += '_' + object.scope.to_s[0, 1] if object.is_a?(CodeObjects::MethodObject)\n fspath = [objname + (extension.empty? ? '' : \".#{extension}\")]\n if object.namespace && object.namespace.path != \"\"\n fspath.unshift(*object.namespace.path.split(CodeObjects::NSEP))\n end\n end\n\n File.join(encode_path_components(*fspath))\n end", "title": "" }, { "docid": "89b570d6f20e3461da3f61f0a3bfbc06", "score": "0.67923295", "text": "def code\n path\n end", "title": "" }, { "docid": "89b570d6f20e3461da3f61f0a3bfbc06", "score": "0.67923295", "text": "def code\n path\n end", "title": "" }, { "docid": "bcaab75e817f8083782c45508646c91f", "score": "0.644338", "text": "def objdump_path(path)\n objdump_output(path)\n end", "title": "" }, { "docid": "1f237f36db74cb81e9b8078231bb5326", "score": "0.6128329", "text": "def simple_path\n \"#{serialize_path} | text\"\n end", "title": "" }, { "docid": "ca091ef0823d0aa88464410727087dcd", "score": "0.6057784", "text": "def path\n object.path\n end", "title": "" }, { "docid": "0abc64881d08dd03e58d48456c0e9b2f", "score": "0.5839886", "text": "def path\n data[:path]\n end", "title": "" }, { "docid": "92e7e5d2ed3349ad43e2b6d6c5265f86", "score": "0.582797", "text": "def marshal_dump\n [@code]\n end", "title": "" }, { "docid": "79b0e06999993837dfa493fa0bc78e20", "score": "0.57874554", "text": "def path\n @object.path.to_s\n end", "title": "" }, { "docid": "affab96d873f42417c8c8b50c56bfc42", "score": "0.57852054", "text": "def path; @path; end", "title": "" }, { "docid": "cc134d5f947d09140b0dbd8316464e69", "score": "0.5754764", "text": "def marshal_dump\n {\n name: name,\n path: path.realpath\n }\n end", "title": "" }, { "docid": "417d449cc50bf0d5220c1bad539b5320", "score": "0.5724634", "text": "def path\n data.path\n end", "title": "" }, { "docid": "417d449cc50bf0d5220c1bad539b5320", "score": "0.5724634", "text": "def path\n data.path\n end", "title": "" }, { "docid": "8176012deda6d8714cd7c5f9dcf6dd2b", "score": "0.57180357", "text": "def path; self[:path] end", "title": "" }, { "docid": "f4b4562621dc8814679e25f83cc827a6", "score": "0.5715474", "text": "def serialize_path\n keys = index(/\\s/) || end_with?('.') || start_with?('.') ? [self] : split('.')\n keys.map do |part|\n '[\"%s\"]' % part\n end.join.insert(0, '.')\n end", "title": "" }, { "docid": "e2d90629e74edbd26e0b55a0b11c7356", "score": "0.5708424", "text": "def objdump_disasm_path(path, start_addr, size)\n range = \"--start-address=0x%X --stop-address=0x%X\" % [start_addr, \n start_addr + size]\n #arch = 'unknown'\n insns = {}\n\n lines = `objdump -D #{range} '#{path}'`\n lines.split(\"\\n\").each do |line|\n insns[:arch] = arch_from_file_format(line) if line =~ /file format/\n next if line !~ /^\\s*([[:xdigit:]]+):\\s*(.*)$/\n insns[$1.hex] = $2\n end\n\n insns\n end", "title": "" }, { "docid": "0e3efc4b4f72f02e9b5a49656aaa9ce1", "score": "0.5696089", "text": "def path(src)\n h.store_path(store.handle,:src => src)\n end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "5005dbbdce255b8ebe9266a7288728ea", "score": "0.56707966", "text": "def path; end", "title": "" }, { "docid": "7a01d81ae0b212820bd3185b0f9dc083", "score": "0.56529206", "text": "def inspect\n \"<#{self.class} @path=#{@path}>\"\n end", "title": "" }, { "docid": "dc23a81c30261d0ef5532e03837d6538", "score": "0.5639262", "text": "def to_s ; path ; end", "title": "" }, { "docid": "035ec9bd729964f5010cd1853a896cf4", "score": "0.56371063", "text": "def object_path(id)\n \"#{path}/objects/#{id[0...2]}/#{id[2..39]}\"\n end", "title": "" }, { "docid": "144cc7ed581b48f492748448c2cd75c4", "score": "0.56199396", "text": "def path_to_object(path)\n # Note: this algorithm is re-implemented from Grit::Index#add\n arr = path.split('/')\n fname = arr.pop\n curr = self.tree\n arr.each do |dir|\n curr = curr[dir] if curr\n end\n\n #TODO: it would be nice to return a Grit::Blob or Grit::Tree here.\n (curr && fname && curr[fname]) ? curr[fname] : nil\n end", "title": "" }, { "docid": "e73d1a5490083bbe46fa1c15ccd6ef48", "score": "0.56149685", "text": "def file_and_line_for(code_object); end", "title": "" }, { "docid": "e73d1a5490083bbe46fa1c15ccd6ef48", "score": "0.56149685", "text": "def file_and_line_for(code_object); end", "title": "" }, { "docid": "b40d760267ccce2a5c46a28b0021e969", "score": "0.56096244", "text": "def object_to_path\n execute(\"object-to-path\")\n end", "title": "" }, { "docid": "66468490beeb2db338f874666b3e1ab8", "score": "0.5591702", "text": "def path\n to_s\n end", "title": "" }, { "docid": "1e07bb9b0319c9a35472005a492d7843", "score": "0.558462", "text": "def inspect\n to_obj ? to_obj.inspect : \"P(#{path})\"\n end", "title": "" }, { "docid": "cd4fd55193b9991afb907aa62fe99a3f", "score": "0.5575075", "text": "def path\n @path\n end", "title": "" }, { "docid": "cd4fd55193b9991afb907aa62fe99a3f", "score": "0.5575075", "text": "def path\n @path\n end", "title": "" }, { "docid": "cd4fd55193b9991afb907aa62fe99a3f", "score": "0.5575075", "text": "def path\n @path\n end", "title": "" }, { "docid": "cd4fd55193b9991afb907aa62fe99a3f", "score": "0.5575075", "text": "def path\n @path\n end", "title": "" } ]
c2cc5c7f617e18962a2f6c74a600579b
Funcion para log in del user
[ { "docid": "4ad2ec6bc5cadfe7a9784a7cbf479d24", "score": "0.0", "text": "def create\n user = User.authenticate(params[:email], params[:password])\n\tif user\n\t session[:user_id] = user.id\n\t redirect_to root_url, :notice => \"Logged in!\"\n\telse\n\t flash.now.alert = \"Invalid email or password\"\n\t render \"new\"\n\tend\n end", "title": "" } ]
[ { "docid": "73f6b28de0c53d6be61244ad27047cb4", "score": "0.7394692", "text": "def login_user(user = User.create!(email: '[email protected]', password: '123456'))\n \tlogin_as user, scope: :user\n user\n end", "title": "" }, { "docid": "be761afec1401bf4c1fd22c2e77ce61b", "score": "0.73175853", "text": "def login(user=:joerg)\r\n login_as(user)\r\n end", "title": "" }, { "docid": "831ed4b039df3587792542bc641b50b0", "score": "0.72453034", "text": "def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end", "title": "" }, { "docid": "3d53aee7f14bfb04e7cb1c51b04be042", "score": "0.7220793", "text": "def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = self.find_user(name)\n if check_password(user)\n CLI.active_user = user\n # fall through to CLI.start\n else\n CLI.start\n end\n\n else\n puts \"Sorry, User not found!\"\n if CLI.yes_no(\"Sign Up\")\n self.signup_user(name)\n else\n CLI.start\n end\n end\n end", "title": "" }, { "docid": "2055c90579efb5c8d06901077dda71a6", "score": "0.71894014", "text": "def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: 'Por favor, faça login' }\n end\n end", "title": "" }, { "docid": "05d1926ee716fbb6c800515bae250f84", "score": "0.7175271", "text": "def login\n end", "title": "" }, { "docid": "e259d1d9385472eafc39dd73da9e747b", "score": "0.7147803", "text": "def login\n valid = true\n \n if username.blank?\n self.errors.add_to_base(\"Please enter a user name\")\n valid = false\n end\t\n \n if password.blank?\n self.errors.add_to_base(\"Please enter a password\")\n valid = false\n end\n \t\t\n if valid\n user = User.find(:first, :conditions => [\"username = ? AND password = ?\", username, password])\n \n if user\n self.id = user.id\n self.reload\n else\n self.errors.add_to_base(\"The user name/password was incorrect.\")\n valid = false\n end\n end\n \n valid\n end", "title": "" }, { "docid": "cf56424101cf2cdc579dc619401521a6", "score": "0.71463096", "text": "def loggin\n @user = User.find_by(username: params[:username])\n end", "title": "" }, { "docid": "fd943fc40e8c2f95613ecb7e2f5fcb04", "score": "0.7130505", "text": "def login_as(user)\n login(users(user).email, users(user).password)\n end", "title": "" }, { "docid": "5b33a53e327fe455ee788744c54d15ad", "score": "0.71152776", "text": "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Você não está logado no sistema.\"\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "f6a25d98a4ac00116892df6798ad3bd6", "score": "0.7109425", "text": "def login_admin_anna\n user = User.find_by(name: \"Anna\")\n log_in(user)\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "eb01d5f2fb0aafec8f12c8340a787208", "score": "0.71044505", "text": "def login\n end", "title": "" }, { "docid": "6b1cef3ab4f1e2fadfe8980325f2a557", "score": "0.7091367", "text": "def login\n session[:user_id] = nil\n if request.post?\n user = User.authenticate(params[:user][:username], params[:user][:password])\n if user\n session[:user_id] = user.id\n redirect_to :action => \"index\"\n else\n flash[:notice] = \"Nome de usuário/senha inválidos\"\n render :action => \"login\"\n return\n end\n else\n @user = User.new\n render :action => \"login\"\n end\n end", "title": "" }, { "docid": "9f83c1db35d2f864a5bacccd41d53317", "score": "0.70723665", "text": "def login(user)\n\tif $users_profil.include?(user)\n\t\tputs \"Username: #{user}\"\n\t\tputs \"Profil: #{$users_profil[user]}\" \n\telse \n\t\tputs \"Numele de utilizator este gresit.\"\n\t\tprima # daca a scris usernamul gresit sau daca acel username nu exista atunci scriptul practic se reinitializeaza\n\tend\nend", "title": "" }, { "docid": "7dab0aa568fb825fe601499dae51aecb", "score": "0.70608765", "text": "def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend", "title": "" }, { "docid": "7ba9b16d23a3e9aad20bfc9a167b93d9", "score": "0.70576394", "text": "def login\n\n end", "title": "" }, { "docid": "7ba9b16d23a3e9aad20bfc9a167b93d9", "score": "0.70576394", "text": "def login\n\n end", "title": "" }, { "docid": "500a8d0eb23c48515255d41ef6484cab", "score": "0.70526624", "text": "def logar(usuario, senha)\n login.set usuario\n password.set senha\n click_button 'acessarcti'\n end", "title": "" }, { "docid": "5af5d127cfdca21b673e0ff04c67e44f", "score": "0.70477957", "text": "def user_log_in(user)\n if user && user.authenticate(params[:user][:password])\n session[:user_id] = user.id\n redirect \"/users/#{user.id}\"\n\n else\n flash[:message] = \"Account could not be authenticated. Please enter username and password.\"\n redirect '/login'\n end\n end", "title": "" }, { "docid": "c90774e5d3e9756be3ef40222e7474c3", "score": "0.7044579", "text": "def log_in_as(user)\n puts 'logging in!!'\n session[:name] = user.name\n end", "title": "" }, { "docid": "24d140f3fc54bf6e5640fddbc8170a2b", "score": "0.7041788", "text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Veuillez svp vous connecter\"\n redirect_to connexion_url\n end\n end", "title": "" }, { "docid": "9a2f5541283b38374edcd129e4060a53", "score": "0.70286703", "text": "def login\n @current_user = nil\n system 'clear'\n puts \"--------LOGIN--------\"\n username = @prompt.ask(\"Username: \", required: true)\n if User.all.map(&:name).include?(username)\n @current_user = User.all.find{|user_instance| user_instance.name == username}\n if password\n main_menu\n end\n else\n if @prompt.yes?(\"There is no user by this name. Would you like to create an account?\")\n create_account\n end\n end\n end", "title": "" }, { "docid": "9eabe06f7fef70fd340b6093d932c150", "score": "0.70164543", "text": "def login\n\tend", "title": "" }, { "docid": "39967c44416d0091d373cfacb3c8f974", "score": "0.7011952", "text": "def log_in (user)\n\t\t#Session is a rails method which saves something called as userid in a cookie\n\t\tsession[:user_name]=user.username\n\n\tend", "title": "" }, { "docid": "eaccc565583f50a4de0abfbedef1b1c2", "score": "0.70024014", "text": "def log_in\n end", "title": "" }, { "docid": "b230a70357252035fc9f205163872047", "score": "0.6998629", "text": "def userlogin(req)\n\tbasica = request.env[\"HTTP_AUTHORIZATION\"].to_s.split(\"Basic \")\n\tbasicas = basica[1].to_s\n\tauthdata = (Base64.decode64(basica.to_s)).split(':')\n\tusername = authdata[0].to_s\n\tpass = authdata[1].to_s\n\tputs \"Usuario: #{username}\"\n\tputs \"Password: #{pass}\"\n\tu = User.where(email:username,password:pass).take\n\tsession[:username] = username\n\treturn u\nend", "title": "" }, { "docid": "67a65d91d4fa77d5c7456fafbd26e9ab", "score": "0.69713134", "text": "def comprobar_usuario_login\n @usuario_actual=nil\n return unless session[:user_id]\n @usuario_actual = Usuario.find_by_id(session[:user_id])\n end", "title": "" }, { "docid": "4e2774b4b86094c3f26187c47fa6fadc", "score": "0.6966272", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "7a83b00e562e5dd0f9daff26d7b63219", "score": "0.696571", "text": "def fazer_login\n self.input_email.set $dados['user']['user_submarino']\n self.input_senha.set $dados['user']['password_submarino']\n self.button_continuar.click\n end", "title": "" }, { "docid": "096656013ed38b7b1dbeeac711e44c18", "score": "0.69642997", "text": "def login; end", "title": "" }, { "docid": "58eaa0eae453371970040ed9796eee80", "score": "0.6953528", "text": "def log_in_user(user)\n session[:user_id] = user.id\n session[:admin_open] = false\n redirect_to admin_path(:page => 'index')\n end", "title": "" }, { "docid": "c8c4a6ffd44dd8429735ba7d4d8a0cf8", "score": "0.6952004", "text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Per compiere quest'azione è necessario effettuare login\"\n redirect_to login_path\n end\n end", "title": "" }, { "docid": "1e538542f439e8c0490f397dde56d024", "score": "0.6945508", "text": "def user_log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "fbcacaf8b83cced270acc46644c86cd3", "score": "0.6940371", "text": "def logar(usuario, senha)\n login.set usuario\n password.set senha\n click_button 'kc-login'\n end", "title": "" }, { "docid": "fbcacaf8b83cced270acc46644c86cd3", "score": "0.6940371", "text": "def logar(usuario, senha)\n login.set usuario\n password.set senha\n click_button 'kc-login'\n end", "title": "" }, { "docid": "a9b8783bf00bf30542319394568db95a", "score": "0.6936573", "text": "def logged_in_user\n \t\tunless logged_in?\n \t\t\tflash[:error] = \"You must be logged in\"\n \t\tredirect_to login_path\n \t\tend\n \tend", "title": "" }, { "docid": "b64f086c5a57767a3635f7f27a43a500", "score": "0.6925554", "text": "def login(user)\n \tsession[:user_id] = user.id\n end", "title": "" }, { "docid": "3d290f8d4aa28ffb3649936e8e0dceb2", "score": "0.6924624", "text": "def log_in(user)\n session[:user_id] \t = user.id\n session[:user_name] = user.name\n session[:user_email] = user.email\n end", "title": "" }, { "docid": "56db9910f8213d505b3b0e85338ac212", "score": "0.6924346", "text": "def login\n user = User.find_by_email(params[:username])\n if user.nil? || (user && user.authenticate(params[:password]) == false) || user.deleted\n render status: 400, json: nil \n else\n session[:user_id] = user.id\n session[:username] = user.username\n session[:email] = user.email\n session[:verified] = user.verified\n user.last_ip_login = request.remote_ip\n user.save\n render status: 200, json: session\n end\n end", "title": "" }, { "docid": "cdb7f8b8e51d770df746b3adeb676c8b", "score": "0.69150645", "text": "def login_user(user = gen_user)\n session[:user_id] = user.id\n return user\n end", "title": "" }, { "docid": "5240b158e129b4c41f2b3069ced0f87a", "score": "0.69130635", "text": "def log_in\n @user = User.new\n end", "title": "" }, { "docid": "8a012024e21cc13d7bf03dc39af777d4", "score": "0.6909021", "text": "def logged_in_user\n unless logged_in?\n flash[:danger] = \"请先登录\"\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "616e711d73e2fd15000cd0d6cb65e1b7", "score": "0.69047505", "text": "def create\n @user = User.where(username: params[:session][:username]).first\n if @user.password == params[:session][:password]\n session[:user_id][email protected]\n log_in @user\n puts \"my sess = #{session[:user_id]}\"\n redirect_to @user\n else\n flash[:alert] = \"Invalid Username/Password. Please try again\"\n redirect_to login_path\n end\n end", "title": "" }, { "docid": "507bd37ec09963ba474cc855e38abf53", "score": "0.6897952", "text": "def log_in(user)\n email = $credentials[user]['email']\n password = $credentials[user]['password']\n case user\n when 'User A'\n transporter.go_to_url(USER_A_HOST)\n set_field('identifier', email)\n click_btn('Next')\n set_field('password', password)\n click_btn('Next')\n when 'User B'\n transporter.go_to_url(USER_B_HOST)\n end\n end", "title": "" }, { "docid": "22db77a2fa14b434621fed28f0d9ffcc", "score": "0.689793", "text": "def login user\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "d8f1ed4ed7a51d9ac7d37c63af549934", "score": "0.68976367", "text": "def login\n @user = User.find_by nickname: params[:nickname]\n if @user\n if (@user.is_password?(params[:password]))\n session[:id] = @user.id\n redirect_to url_for(:controller => :users, :action => :show, id: @user.id)\n else\n redirect_to action: \"index\", :notice => \"Login failed. Invalid password.\"\n end\n else\n redirect_to action: \"index\", :notice => \"Login failed. Invalid username.\"\n end\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6889857", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "91b64c2c86fae9175c719b4c9b87b418", "score": "0.6889531", "text": "def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end", "title": "" }, { "docid": "16761cd17419e8464a912981ae9be573", "score": "0.6886233", "text": "def login!\n session[:user_id] = @user.id\n end", "title": "" }, { "docid": "855131b5959afa6b559d21bcc9c55a53", "score": "0.6884659", "text": "def login(user, pwd)\n touch(\"* id:'#{edit_email}'\")\n enter_text(\"* id:'#{edit_email}'\", user)\n touch(\"* id:'#{edit_password}'\")\n enter_text(\"* id:'#{edit_password}'\", pwd)\n end", "title": "" }, { "docid": "5aca309b940043aab6d552ff848d4f6e", "score": "0.68805313", "text": "def log_user_in(user)\n note \"Welcome, #{user.contact.con_name}\"\n\n user.log(\"Logged in\")\n user.user_last_logged_in = Time.now\n user.save\n\n sm = SessionManager.new($store)\n sm.fork_session(@session, @context)\n @session.user = user\n @session.news = DailyPlanet.top_news_for_user(user)\n if user.contact.mail.empty?\n @data.user = user\n collect_user_info(false, true)\n else\n @session.pop\n end\n end", "title": "" }, { "docid": "d81e09c843be5426185a45ff4d1a654a", "score": "0.6877038", "text": "def sign_in(user)\n login_as user\n end", "title": "" }, { "docid": "96e31785e34466d7a7edcf255107e228", "score": "0.6864447", "text": "def login\n# **********\n user_name = params[:user][:user_name]\n\n if user_name and @user = User.find_by(user_name: user_name)\n session[:user_id] = @user.id\n flash[:result_text] = \"Successfully logged in as exsisting user #{@user.user_name}\"\n else\n @user = User.new(user_name: user_name)\n if @user.save\n session[:user_name] = @user.user_name\n flash[:result_text] = \"Successfully created new user #{@user.user_name} with ID #{@user.id}.\"\n else\n flash.now[:status] = :failure\n flash.now[:message] = @user.errors.messages\n render \"new\", status: :bad_request\n return\n end\n end\n redirect_to root_path\n end", "title": "" }, { "docid": "a3269d7b41080da76e83ab1eefe9e919", "score": "0.6858139", "text": "def logged_in_user\n unless logged_in?\n # store current location to automatically redirect user after login\n store_location\n # show a flash message on the page\n flash[:danger] = \"Per favore effettua il login\"\n # redirect user to login page\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "75dd17329ec791d8074a5235dff5f95c", "score": "0.6857995", "text": "def login( user )\n session[:user_id] = user ? user.id : nil\n end", "title": "" }, { "docid": "9bbb73be198b21f103edfb9133db0966", "score": "0.68521416", "text": "def login\n message =\"Please, enter user name, password\"\n if(params[:user][:user_name]!=\"\" && params[:user][:user_password]!=\"\")\n password = Digest::MD5.hexdigest(params[:user][:user_password])\n user = User.authenticate(params[:user][:user_name])\n if (user)\n if (user.deleted ==0)\n if(user.user_password == password)\n session[:user_name] = user.user_name\n redirect_to vietnameses_path\n return\n else\n message=\"Password incorrect\"\n end\n else\n message=\"Not active\"\n end\n else\n message=\"User name incorrect\"\n end\n end\n redirect_to sign_in_path, alert: message\n end", "title": "" }, { "docid": "5cbc4b48554418ae29c638c34ca62f85", "score": "0.6844648", "text": "def login(user, nick, real_name, flags=8)\n sendmsg \"USER #{user} #{flags} * :#{real_name}\"\n sendmsg \"NICK #{nick}\"\n end", "title": "" }, { "docid": "774c2cea5ba2c04fe8451177d0c272c2", "score": "0.6837151", "text": "def log_in(user_id)\n session[:user_id] = user_id\n end", "title": "" }, { "docid": "3ac0bbb4d8736180d0a53e15caaaa071", "score": "0.6830401", "text": "def login\n session[:user_id] = nil\n session[:is_admin] = nil\n session[:is_editor] = nil\n if request.post?\n user = User.authenticate(params[:name], params[:password])\n puts user\n if user\n session[:user_id] = user.id\n session[:is_admin] = (user.is_admin == 1)\n session[:is_editor] = (user.is_editor == 1)\n redirect_to :controller => 'home'\n else\n flash[:notice] = \"Invalid user/password combination\"\n end\n end\n end", "title": "" }, { "docid": "8665aa99463eee8d097a4d986fba289f", "score": "0.68222713", "text": "def call(params)\n user=ToDoApp::Repositories::UserRepository.find_by_email_and_password( params[:email], params[:password])\n if user.nil?\n #usernotfound\n redirect_to '/users/signin'\n else \n session[:user] = user.id# ajoute le 27.01.2015\n redirect_to \"/\"#pour renvoyer directement vers le home`page quand il y un signin LE USER DOIT ETRE REGISER\n # AU PREABLE SINON CA NE VA PAS FONCTIONNER \n\n end\n end", "title": "" }, { "docid": "fa041a879e149603a0e34244f50391ba", "score": "0.6819735", "text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Вы не вошли на сайт. Пожалуйста выполните вход.\"\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "75874a01770e99a6f27fc96f8285db32", "score": "0.68158436", "text": "def login_user(user_name)\n user = Goldberg::User.find_by_name(user_name)\n @request.session[:goldberg] = {:user_id => (user ? user.id : nil)}\n Goldberg::AuthController.set_user(@request.session)\n @request.session[:last_time] = Time.now\n end", "title": "" }, { "docid": "596adcf2f1dc2010c325c794ac12f20a", "score": "0.68116105", "text": "def login(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "78c0b38735f23204af65ac3e348d9023", "score": "0.6810283", "text": "def login\n\t\tif @current_user != nil\n\t\t\tredirect_to user_path(@current_user.id)\n\t\tend\n\tend", "title": "" }, { "docid": "d97a508e2c64887818675e34d31bef97", "score": "0.6806403", "text": "def login\n @table_title = '使用者登入'\n @title = ['main1'=>'登入', 'LOGIN'=>'Users','sub1'=>'首頁' , 'sub2'=>'登入']\n @user = User.new\n end", "title": "" }, { "docid": "4aa0943be7bf097519b6f99242298262", "score": "0.68000805", "text": "def login\n username = params[:user][:username]\n found_user = User.find_by(username: username)\n if found_user\n session[:user_id] = found_user.id\n flash[:success] = \"Successfully logged in as existing user #{found_user.username}\"\n else\n @user = User.new(username: username)\n if @user.save\n session[:user_id] = @user.id\n flash[:success] = \"Successfully created new user #{@user.username} with ID #{@user.id}\"\n else\n flash.now[:error] = \"A problem occurred: Could not log in\"\n # render \"users/login_form\"\n render \"users/login_form\"\n return\n end\n end\n \n return redirect_to root_path\n end", "title": "" }, { "docid": "adc9b922c9ad4ba2de7036f33345041e", "score": "0.67921484", "text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Влез в профила си.\"\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "adc9b922c9ad4ba2de7036f33345041e", "score": "0.67921484", "text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Влез в профила си.\"\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "24dbc3f6315a409c28f10190ce441e6a", "score": "0.67880213", "text": "def login_as(id)\n session['email'] = User.find(id).email\n build_user\n end", "title": "" }, { "docid": "2e91dc48c842227f45d388646f1b9560", "score": "0.6779038", "text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = t(\"users.edit.danger\")\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "bae559cf12f9958a854a885c583d4543", "score": "0.6778568", "text": "def realizar_login\n input_login.set \"juzi\"\n input_senha.set \"jose\"\n btn_login.click\n end", "title": "" }, { "docid": "15efe0a103a6a025ebca3605fabf4094", "score": "0.6774534", "text": "def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end", "title": "" }, { "docid": "fac9e8ef6bf48e3f0c96bd43f6f55f38", "score": "0.6773451", "text": "def login_as(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "36b95acdc0d88b88df07db776011f1d8", "score": "0.67678374", "text": "def log_in_as(user)\n session[:user_id]=user.id\n end", "title": "" }, { "docid": "6eb2103be46757b71b00eac42ee481d9", "score": "0.67604434", "text": "def sign_in\n\t\t user = User.find_by_username(params[:username])\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n flash[:notice]=\"hello #{user.name}\"\n case user.role\n when \"s\"\n redirect_to supervisor_index_path and return\n when \"a\"\n redirect_to receptionnist_index_path and return\n end \n else\n flash[:error]= \"Invalid username or password\"\n redirect_to root_url and return\n end\n\tend", "title": "" }, { "docid": "4d70004acadf0d25380db35532530312", "score": "0.6757", "text": "def login_user(user)\n session[:current_user_id] = user.id\n end", "title": "" }, { "docid": "adef79c8189e4895bfc5094a9f3a3161", "score": "0.6755468", "text": "def login(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "30e2965aa8ff178f9db0804641a864cf", "score": "0.67538476", "text": "def login\n\t\t@user = User.new\n\tend", "title": "" }, { "docid": "95c4a1b552733fe92ed170fde29b9f25", "score": "0.6752025", "text": "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = \"Primero has Log In\"\n redirect_to login_url\n end\n end", "title": "" }, { "docid": "bb802b2e024e90aac0f63a69f83175f9", "score": "0.67474926", "text": "def login_as(user)\n session[:user_id] = users(user).id\n end", "title": "" } ]
3888bd485dc65dfb08ab60afcebc211e
POST /presets POST /presets.json
[ { "docid": "6a4d65c9542fd07174d0b2e154ab87e1", "score": "0.6599655", "text": "def create\n @preset = Preset.new(params[:preset])\n @preset.user_id = current_user.id\n respond_to do |format|\n if @preset.save\n format.html { redirect_to @preset, notice: 'Preset was successfully created.' }\n format.json { render json: @preset, status: :created, location: @preset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "da2d4d4edc9c2a4bfcc47eec85c51c67", "score": "0.6124885", "text": "def create\n @preset = Preset.new(params[:preset])\n\n respond_to do |format|\n if @preset.save\n flash[:notice] = 'Preset was successfully created.'\n format.html { redirect_to(@preset) }\n format.xml { render :xml => @preset, :status => :created, :location => @preset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @preset.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82bef3a34d14394068e23efdc45198bc", "score": "0.6061591", "text": "def create\n @preset = Preset.new(preset_params)\n @preset.user_id = current_user.id\n @preset.channel_id = @channel.id\n \n respond_to do |format|\n if @preset.save\n format.html { redirect_to @preset, notice: 'Preset was successfully created.' }\n format.json { render :show, status: :created, location: @preset }\n else\n format.html { render :new }\n format.json { render json: @preset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3cd8b69620eec12f0bde4a1daa093a50", "score": "0.58692527", "text": "def reference_presets\n set_reference_presets(@encoding_job, true)\n redirect_to play_encoding_job_path(@encoding_job)\n end", "title": "" }, { "docid": "6eef3a0ad588f55f1a39118d0da49aa5", "score": "0.58348656", "text": "def new\n @preset = Preset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preset }\n end\n end", "title": "" }, { "docid": "f73eaae1da707b4565edc253093b2ed3", "score": "0.57439417", "text": "def index\n @presets = @channel.presets\n end", "title": "" }, { "docid": "e301aacd33359e66f67723d96ab85ac7", "score": "0.55681777", "text": "def preset\n \n @goal = Goal.new\n\n respond_to do |format|\n format.html # preset.html.erb\n format.json { render json: @goal }\n end\n end", "title": "" }, { "docid": "e7bb96a61c7e98442e4fdeb4a21d3be9", "score": "0.54483527", "text": "def create\n # JSONファイルから文字列を抽出する\n file = params['stage']['file']# Upされたファイルにアクセス\n \n p(\"file params:\")\n\n @jsonstring = file.read\n p(@jsonstring)\n @stage = Stage.new(:scene_data => @jsonstring, :title => params[:stage][:title])\n p(\"stage.scene_data:\")\n p(@stage.scene_data)\n #p(@stage.nothing)\n \n if params[:stage][:texture] != nil\n @textures = Texture.new(:data => params[:stage][:texture]['data'])\n @stage.textures << @textures\n end\n\n respond_to do |format|\n if @stage.save!\n format.html { redirect_to @stage, notice: 'Stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stage }\n else\n format.html { render action: 'new' }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8923ad2fcaefc581211803e2ab03c0d5", "score": "0.5420613", "text": "def create\n @preset_color = PresetColor.create(hue: params[:hue], saturation: params[:saturation], brightness: params[:brightness])\n @preset_colors = PresetColor.all\n render :preset_colors\n end", "title": "" }, { "docid": "bcc11c4aaf8d507390c44067043fe235", "score": "0.533133", "text": "def update\n respond_to do |format|\n if @preset.update(preset_params)\n format.html { redirect_to @preset, notice: 'Preset was successfully updated.' }\n format.json { render :show, status: :ok, location: @preset }\n else\n format.html { render :edit }\n format.json { render json: @preset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4af61eae1c19c0d6ef8efb8ebfa25fb", "score": "0.5305577", "text": "def media_presets\n site.data.dig('picture', 'media_presets') || {}\n end", "title": "" }, { "docid": "ab7659e7fca93aabf55c7fb2f90f66ce", "score": "0.53054535", "text": "def create\n @coin_set = CoinSet.new(params[:coin_set])\n\n respond_to do |format|\n if @coin_set.save\n format.html { redirect_to root_path, notice: 'Coin set was successfully created.' }\n format.json { render json: @coin_set, status: :created, location: @coin_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coin_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "942f7bec5f008917f90862f0e792f4d3", "score": "0.52872837", "text": "def create\n @stage = Stage.new(stage_params)\n\n if @stage.save\n render json: @stage, status: :created\n else\n render json: @stage.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b6a8751d3a90adaae9f13ca82152c798", "score": "0.5220212", "text": "def destroy\n @preset.destroy\n respond_to do |format|\n format.html { redirect_to presets_url, notice: 'Preset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "93d2465dbf7656e417ec5df09b5b0cb9", "score": "0.51995546", "text": "def index\n \tlogger.debug \"presets/index called\"\n @presets = Preset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @presets }\n end\n end", "title": "" }, { "docid": "0a3055bbf150c64a05234385fa5a2456", "score": "0.51914316", "text": "def create\n @palette = current_user.palettes.build(palette_params)\n\n respond_to do |format|\n if @palette.save\n format.html { redirect_to '/palettes', notice: 'Palette was successfully created.' }\n format.json { render :show, status: :created, location: @palette }\n else\n format.html { render :new }\n format.json { render json: @palette.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d1124ffd344858fffb6c75216b46473", "score": "0.5182339", "text": "def destroy\n @preset = Preset.find(params[:id])\n @preset.destroy\n\n respond_to do |format|\n format.html { redirect_to presets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ee5d392ea8e0f0d6b9cca925f1e14dc9", "score": "0.5134818", "text": "def create\n @plate = Plate.new(params[:plate])\n\n if @plate.save\n render json: @plate, status: :created, location: @plate\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3beb09223ae780c6826cc7a6cbe27903", "score": "0.51248676", "text": "def create\n @flat_stage = Flat::Stage.new(flat_stage_params)\n\n respond_to do |format|\n if @flat_stage.save\n format.html { redirect_to @flat_stage, notice: 'Stage was successfully created.' }\n format.json { render :show, status: :created, location: @flat_stage }\n else\n format.html { render :new }\n format.json { render json: @flat_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f36a60c4244c038d8db4d76253dc96da", "score": "0.5074777", "text": "def catalog_presets ; @catalog_presets ||= Array(qs_get_all('QSPresetAdditions', CatalogPreset, self, Array)) ; end", "title": "" }, { "docid": "19bee4828d930d1149d765cfdd70c9ac", "score": "0.5074109", "text": "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "title": "" }, { "docid": "0fcb09ece3d80a810541736ac447d498", "score": "0.5013946", "text": "def create\n @setum = Setum.new(setum_params)\n\n respond_to do |format|\n if @setum.save\n format.html { redirect_to @setum, notice: 'Setum was successfully created.' }\n format.json { render :show, status: :created, location: @setum }\n else\n format.html { render :new }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46881b35af1f7b0f21928ea01e3915a5", "score": "0.4985947", "text": "def update\n @preset = Preset.find(params[:id])\n @preset.user_id = current_user.id\n respond_to do |format|\n if @preset.update_attributes(params[:preset])\n format.html { redirect_to @preset, notice: 'Preset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc1765f7b71dc81c3e0d0dd9f7574864", "score": "0.49854726", "text": "def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "224cd412a0c1124f5f1499ffa3e432b8", "score": "0.49735665", "text": "def create\n @pres = Pre.all\n @pre = Pre.new(params[:pre])\n\n respond_to do |format|\n if @pre.save\n format.html { redirect_to @pre, notice: 'Pre was successfully created.' }\n format.json { render json: @pre, status: :created, location: @pre }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pre.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "title": "" }, { "docid": "34822ad4f503cb85240bc589bdf19def", "score": "0.4954607", "text": "def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend", "title": "" }, { "docid": "4223312446f91222936a5713afdc5c03", "score": "0.4941836", "text": "def create\n @choice_set = ChoiceSet.new(choice_set_params)\n\n respond_to do |format|\n if @choice_set.save\n format.html { redirect_to @choice_set, notice: 'Choice set was successfully created.' }\n format.json { render :show, status: :created, location: @choice_set }\n else\n format.html { render :new }\n format.json { render json: @choice_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f471044fe5e78c2b782be7735a93e51d", "score": "0.49280137", "text": "def create\n @prevision = Prevision.new(prevision_params)\n\n respond_to do |format|\n if @prevision.save\n format.html { redirect_to @prevision, notice: 'Previsión guardada correctamente.' }\n format.json { render :show, status: :created, location: @prevision }\n else\n format.html { render :new }\n format.json { render json: @prevision.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bc84b2edb384bc5bf6e3fbbed881233", "score": "0.49244803", "text": "def create\n @poset = Poset.new(poset_params)\n\n respond_to do |format|\n if @poset.save\n format.html { redirect_to @poset, notice: 'Poset was successfully created.' }\n format.json { render :show, status: :created, location: @poset }\n else\n format.html { render :new }\n format.json { render json: @poset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d1ef1d9f323ee1f54e4d453363688d12", "score": "0.4913191", "text": "def apply_for(presets)\n apply(presets, Expense.blank)\n end", "title": "" }, { "docid": "23b1aa65f2102f19d4bcbdf7fab27544", "score": "0.4891645", "text": "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4d66ab14a1b34e9c8701ddc7f588dbd", "score": "0.48696482", "text": "def create\n @palette = Palette.new(palette_params)\n\n respond_to do |format|\n if @palette.save\n params[:palette][:colors].each do |value|\n @palette.colors.create(hex_value: value)\n end\n\n format.html { redirect_to @palette, notice: 'Palette was successfully created.' }\n format.json { render :show, status: :created, location: @palette }\n else\n default_palette_colors\n\n format.html { render :new }\n format.json { render json: @palette.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3add65b171f512c9d051e6b04eac970", "score": "0.48590174", "text": "def create\n @uset = Uset.new(params[:uset])\n\n respond_to do |format|\n if @uset.save\n format.html { redirect_to @uset, notice: 'Uset was successfully created.' }\n format.json { render json: @uset, status: :created, location: @uset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba20eb11a7ee1027ef4f405a409641c3", "score": "0.48498982", "text": "def create\n @favorite_template = FavoriteTemplate.new(favorite_template_params)\n @favorite_template.save\n render json: @favorite_template\n end", "title": "" }, { "docid": "bf256668e7e7ff56cf3ff29c2096a3b9", "score": "0.48475808", "text": "def create\n @pre_test_answer = PreTestAnswer.new(pre_test_answer_params)\n\n respond_to do |format|\n if @pre_test_answer.save\n format.html { redirect_to @pre_test_answer, notice: 'Pre test answer was successfully created.' }\n format.json { render :show, status: :created, location: @pre_test_answer }\n else\n format.html { render :new }\n format.json { render json: @pre_test_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "219bd6ef8e9605efce98f07158a64b8d", "score": "0.4846072", "text": "def create\n deck_name = params[:name]\n @deck = Deck.create(:name => deck_name)\n\n SUITS.each do |suit| \n VALUES.each do |value| \n Card.create(:deck_id => @deck.id, :suit => suit, :value => value)\n end\n end\n\n render json: [@deck, @deck.cards] \n end", "title": "" }, { "docid": "2d53a293026d447ac4053e889d6fd1a5", "score": "0.48398975", "text": "def create\n # {\"vcpus\": 1, \"disk\": 1, \"name\": \"test\", \"rxtx_factor\": 1, \"OS-FLV-EXT-DATA:ephemeral\": 1, \"ram\": 512, \"id\": 6, \"swap\": 1}}'\n @flavor = compute.create_flavor(\"rxtx_factor\"=>1,\"OS-FLV-EXT-DATA:ephemeral\"=>params[:ephemeral],:vcpus=>params[:vcpus],:disk=>params[:disk],:name=>params[:name],:ram=>params[:ram],:id=>params[:id],:swap=>params[:swap])\n\n respond_to do |format|\n format.html { redirect_to flavors_path, :notice => 'Flavor was successfully created.' }\n format.json { render :json => @flavor, :status => :created, :location => @flavor }\n end\n end", "title": "" }, { "docid": "91151eabb57784f981e664c3090024f5", "score": "0.48369434", "text": "def create\r\n @stage = Stage.new(params.required(:stage).permit!)\r\n\r\n respond_to do |format|\r\n if @stage.save\r\n format.html {redirect_to @stage, :notice => 'Stage was successfully created.'}\r\n format.json {render :json => @stage, :status => :created, :location => @stage}\r\n else\r\n format.html {render :action => \"new\"}\r\n format.json {render :json => @stage.errors, :status => :unprocessable_entity}\r\n end\r\n end\r\n end", "title": "" }, { "docid": "23c9cb075ab965bb72279dce82e6a5a0", "score": "0.48331016", "text": "def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end", "title": "" }, { "docid": "53247107363fbab706862a57c9089afd", "score": "0.48305127", "text": "def create\n @tune = Tune.new(parse_tune)\n\n respond_to do |format|\n if @tune.save\n format.html { redirect_to @tune, notice: 'Tune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tune }\n else\n format.html { render action: 'new' }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1534e8a3a64656a844ea08c00d83641c", "score": "0.48302352", "text": "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd4053c9f0cee259fbae03b483be9cd9", "score": "0.47983965", "text": "def create\n @materia = Materia.new(params[:materia])\n\n if @materia.save\n render json: @materia, status: :created, location: @materia\n else\n render json: @materia.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a8c036982963eb701f91918604966809", "score": "0.47818238", "text": "def create\n @stage = Stage.new(stage_params)\n\n respond_to do |format|\n if @stage.save\n format.html { redirect_to @stage, notice: 'Stage was successfully created.' }\n format.json { render :show, status: :created, location: @stage }\n else\n format.html { render :new }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc2e9fba3bb35c8b52c4a461e62bdd4d", "score": "0.47635496", "text": "def create\n @gig_set = GigSet.new(gig_set_params)\n @gig_set.number = (@gig_set.gig.gig_sets.map(&:number).compact.max || 0) + 1\n\n respond_to do |format|\n if @gig_set.save\n format.html { redirect_to edit_gig_path(@gig_set.gig) }\n format.json { redirect_to edit_gig_path(@gig_set.gig) }\n else\n format.html { redirect_to edit_gig_path(@gig_set.gig), error: \"Couldn't add a new set\" }\n format.json { redirect_to edit_gig_path(@gig_set.gig), status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6e74f047aacca049f4276c692e4f23e", "score": "0.47526443", "text": "def create\n # @bonu = Bonus.new(bonus_params)\n #\n # if @bonus.save\n # render :show, status: :created, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end", "title": "" }, { "docid": "7f89df9dcefb6e38e12a00cb792c4a7c", "score": "0.47496304", "text": "def create\n mix = BreedMix.new(mix_params)\n\n if mix.save\n render json: mix\n else\n render json: mix.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "281dd6aa9170ef9b9d92e86be51763e9", "score": "0.47476307", "text": "def create\n @tune = Tune.new(params[:tune])\n\n respond_to do |format|\n if @tune.save\n format.html { redirect_to root_path notice: 'Tune was successfully created.' }\n format.json { render json: @tune, status: :created, location: @tune }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "16c3197b12ed9e16606d467de7b2eb09", "score": "0.4736574", "text": "def create\n @colorizer = Colorizer.new(colorizer_params)\n if @colorizer.save\n render json: @colorizer, status: :created, location: api_v1_colorizer_url(@colorizer)\n else\n render json: @colorizer.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "7f2ddfea7975ccf32f5030b6ee300f5e", "score": "0.4736449", "text": "def eq_presets\n IITEQPresetCollection.new(@ole.EQPresets)\n end", "title": "" }, { "docid": "b6c670decb403ed7b1592dd12bba5207", "score": "0.47252834", "text": "def destroy\n @preset = Preset.find(params[:id])\n @preset.destroy\n\n respond_to do |format|\n format.html { redirect_to(presets_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b5cd4178b0075a15e1efc1a95cd5616d", "score": "0.47213238", "text": "def create\n @label_set = LabelSet.new(label_set_params)\n\n respond_to do |format|\n if @label_set.save\n format.html { redirect_to @label_set, notice: 'Label set was successfully created.' }\n format.json { render :show, status: :created, location: @label_set }\n else\n format.html { render :new }\n format.json { render json: @label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "56bccac5b92d2944b3f399b56f597aea", "score": "0.47194436", "text": "def new\n @preset = Preset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @preset }\n end\n end", "title": "" }, { "docid": "e08b201b4335181fe94d84282270862f", "score": "0.47138685", "text": "def create\n @precious_metal = PreciousMetal.new(params[:precious_metal])\n\n respond_to do |format|\n if @precious_metal.save\n format.html { redirect_to @precious_metal, :notice => 'Precious metal was successfully created.' }\n format.json { render :json => @precious_metal, :status => :created, :location => @precious_metal }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @precious_metal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13d32e6af80a204e6f27c87dcc1bba1b", "score": "0.46886948", "text": "def create\n @pokemon = Pokemon.new(pokemon_info)\n \n #check if the pokemon was saved\n #everything went fine\n if @pokemon.save\n render json:{\n status: \"success\",\n message: \"Pokemon was saved, and sent to the PC Storage\",\n data: @pokemon \n }\n else\n render json:{\n status: \"error\",\n message: \"Pokemon ran away...\",\n data: @pokemon.errors\n } \n\n \n end \n end", "title": "" }, { "docid": "bd3d69c4e3fb870b0f34943a072522e7", "score": "0.466922", "text": "def create\n @floor_stage = Floor::Stage.new(floor_stage_params)\n\n respond_to do |format|\n if @floor_stage.save\n format.html { redirect_to @floor_stage, notice: 'Stage was successfully created.' }\n format.json { render :show, status: :created, location: @floor_stage }\n else\n format.html { render :new }\n format.json { render json: @floor_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0c910242f334c0e76c7b40894ff9070", "score": "0.4662914", "text": "def create\n @choice = Choice.new(choice_params)\n\n if @choice.save\n render json: @choice, status: :created, location: @choice\n else\n render json: @choice.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "1bfa7a4cdc6edf06147c7866fbb6eb7e", "score": "0.46581444", "text": "def create\r\n @main_stage = MainStage.new(params[:main_stage])\r\n\r\n respond_to do |format|\r\n if @main_stage.save\r\n format.html { redirect_to @main_stage, notice: 'Main stage was successfully created.' }\r\n format.json { render json: @main_stage, status: :created, location: @main_stage }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @main_stage.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "d154addf907fb9f71036a26be17c1870", "score": "0.46468207", "text": "def create\n @bg_setup = BgSetup.new(params[:bg_setup])\n\n respond_to do |format|\n if @bg_setup.save\n format.html { redirect_to @bg_setup, notice: 'Bg setup was successfully created.' }\n format.json { render json: @bg_setup, status: :created, location: @bg_setup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bg_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "408524992489241a262db12545e862de", "score": "0.46447748", "text": "def create\n #raise \"breakpoint\"\n \n @initiary = Initiary.new(params[:initiary])\n @initiary.save\n\n params[:country].each do |c|\n country = Country.find c\n \n r = Initiarization.new :country_id => country.id, :initiary_id => @initiary.id\n r.save\n\n monetizations = Monetization.where :country_id => country.id\n\n monetizations.each do |m|\n m.update_attribute :collected, true\n end\n end\n\n respond_to do |format|\n if @initiary.save\n format.html { redirect_to(@initiary, :notice => 'Initiary was successfully created.') }\n format.xml { render :xml => @initiary, :status => :created, :location => @initiary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @initiary.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a70bcda513d6952052bf038ddf162bcf", "score": "0.46443042", "text": "def create\n @rock = Rock.new(rock_params)\n\n if @rock.save\n render json: @rock, status: :created\n else\n render json: @rock.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "39dde70cb8b45e5f2a229e8328d23451", "score": "0.46426624", "text": "def update\n @preset = Preset.find(params[:id])\n\n respond_to do |format|\n if @preset.update_attributes(params[:preset])\n flash[:notice] = 'Preset was successfully updated.'\n format.html { redirect_to(@preset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @preset.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eca5914678c1be590905a71c70561802", "score": "0.4622431", "text": "def create\n @plate = Plate.new(plate_params)\n\n respond_to do |format|\n if @plate.save\n format.html { redirect_to @plate, notice: 'Plate was successfully created.' }\n format.json { render :show, status: :created, location: @plate }\n else\n format.html { render :new }\n format.json { render json: @plate.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c708f9773b6ebefa05e83f41a570a2a", "score": "0.4619127", "text": "def create\n @controlpreat = Controlpreat.new(controlpreat_params)\n\n respond_to do |format|\n if @controlpreat.save\n format.html { redirect_to @controlpreat, notice: 'Controlpreat was successfully created.' }\n format.json { render :show, status: :created, location: @controlpreat }\n else\n format.html { render :new }\n format.json { render json: @controlpreat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1af70a5d78bc26556c638619f8b8bfd1", "score": "0.46170038", "text": "def create\n if json_path = params[:file]\n json = JSON.parse(json_path.read)\n raise StandardError, 'Must be Array' unless json.is_a? Array\n\n ActiveRecord::Base.transaction do\n form = Form.create! name: json_path.original_filename\n json.each do |qa|\n raise StandardError, 'Must be Hash.' unless qa.is_a? Hash\n question = Question.create! text: qa['question'], form_id: form.id\n %w(1 2 3 4).each do |nr|\n Answer.create! text: qa[nr], question_id: question.id\n end\n end\n end\n # there's probably a much better way to to nested model saving than this\n render :json => json\n return\n end\n end", "title": "" }, { "docid": "5ed42a04707e8ce9e0063abbaad48a75", "score": "0.46148947", "text": "def create\n @api_v1_reward = Api::V1::Reward.new(api_v1_reward_params)\n\n respond_to do |format|\n if @api_v1_reward.save\n format.html { redirect_to @api_v1_reward, notice: 'Reward was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_reward }\n else\n format.html { render :new }\n format.json { render json: @api_v1_reward.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5001069bb0bf2174da6d1e982e9d7e1", "score": "0.4613458", "text": "def create\n @prestamo = Prestamo.new(prestamo_params)\n\n respond_to do |format|\n if @prestamo.save\n format.html { redirect_to @prestamo, notice: \"Prestamo was successfully created.\" }\n format.json { render :show, status: :created, location: @prestamo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @prestamo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "586815bd1b23785179d3fd66221d4820", "score": "0.46120375", "text": "def create\n @pautum = Pautum.new(pautum_params)\n\n respond_to do |format|\n if @pautum.save\n format.html { redirect_to @pautum, notice: 'Pautum was successfully created.' }\n format.json { render :show, status: :created, location: @pautum }\n else\n format.html { render :new }\n format.json { render json: @pautum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0d5340b9d35c888709194e567d2c797", "score": "0.46098346", "text": "def create\n @project_stage = Project::Stage.new(project_stage_params)\n\n respond_to do |format|\n if @project_stage.save\n format.html { redirect_to @project_stage, notice: 'Stage was successfully created.' }\n format.json { render :show, status: :created, location: @project_stage }\n else\n format.html { render :new }\n format.json { render json: @project_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d54c9a49a803b6d62db068e5aa550769", "score": "0.4609082", "text": "def create\n @editor_pick = EditorPick.new(editor_pick_params)\n\n respond_to do |format|\n if @editor_pick.save\n format.html { redirect_to @editor_pick, notice: 'Editor pick was successfully created.' }\n format.json { render :show, status: :created, location: @editor_pick }\n else\n format.html { render :new }\n format.json { render json: @editor_pick.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95fa270073d6ac32e258601dbac6febe", "score": "0.46043652", "text": "def create\n @deck = Deck.new_from_api\n\n respond_to do |format|\n if @deck.save\n format.html { redirect_to @deck, notice: 'Deck was successfully created.' }\n format.json { render :show, status: :created, location: @deck }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6fec549c7b88d0adf4617c373012987", "score": "0.46015334", "text": "def create\n @press_kit_entry = @press_kit.press_kit_entries.new(press_kit_entry_params)\n\n respond_to do |format|\n if @press_kit_entry.save\n format.html { redirect_to backstage_press_kit_entries_url, notice: 'press_kit_entry was successfully created.' }\n # format.json { render :show, status: :created, location: @press_kit_entry }\n else\n format.html { render :new }\n # format.json { render json: @press_kit_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c91fe15a3704a9dd4ca56cfc9c7600c", "score": "0.4598365", "text": "def create\n @pick = Pick.new(pick_params)\n\n respond_to do |format|\n if @pick.save\n format.html { redirect_to @pick, notice: 'Pick was successfully created.' }\n format.json { render :show, status: :created, location: @pick }\n else\n format.html { render :new }\n format.json { render json: @pick.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "31dec4510fbab127099584e9d3a0a9d1", "score": "0.45968655", "text": "def palette_params\n params.require(:palette).permit(:image)\n end", "title": "" }, { "docid": "b02f82b2084c4e8199ebe0d275c94c09", "score": "0.45950186", "text": "def create \n render json: Tuning.create(tuning_params)\n end", "title": "" }, { "docid": "178a120a2d1d289231ff80bdfc05de10", "score": "0.4594552", "text": "def create\n @sets_and_rep = SetsAndRep.new(sets_and_rep_params)\n\n respond_to do |format|\n if @sets_and_rep.save\n format.html { redirect_to @sets_and_rep, notice: 'Sets and rep was successfully created.' }\n format.json { render :show, status: :created, location: @sets_and_rep }\n else\n format.html { render :new }\n format.json { render json: @sets_and_rep.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1539e1ec2bc5d2498f798192414c798", "score": "0.45894545", "text": "def create\n @deck = Deck.find_or_create_by_quizlet_id params[:deck][:quizlet_id]\n @deck.handle_id = params[:deck][:handle_id]\n\n require \"net/https\"\n require \"uri\"\n uri = URI.parse(\"https://api.quizlet.com/2.0/sets/#{@deck.quizlet_id}?client_id=ABPPhBBUAN&whitespace=1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n @qdeck = JSON.parse response.body\n\n @deck.save\n\n @group = Group.find_or_create_by_deck_id_and_default @deck.id, true\n @group.update_attributes :name => \"Default\"\n\n @deck.title = @qdeck['title']\n @qdeck['terms'].each do |t|\n card = Card.find_or_create_by_quizlet_id t['id']\n card.front = t['term']\n card.back = t['definition']\n @deck.cards << card\n @group.cards << card\n card.save\n end\n\n respond_to do |format|\n if @deck.save\n format.html { redirect_to edit_deck_path(@deck), notice: 'Deck was successfully created.' }\n format.json { render json: @deck, status: :created, location: @deck }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f96fd2202a717d1ab81a447f2cead526", "score": "0.45871562", "text": "def create\n @card_set = CardSet.new(params[:card_set])\n\n respond_to do |format|\n if @card_set.save\n format.html { redirect_to @card_set, notice: 'Card set was successfully created.' }\n format.json { render json: @card_set, status: :created, location: @card_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "22b52a166134fef623475194ed3fc150", "score": "0.45867923", "text": "def unreference_presets\n set_reference_presets(@encoding_job, false)\n redirect_to play_encoding_job_path(@encoding_job)\n end", "title": "" }, { "docid": "47f99c3049bde987b65f35238e3ff220", "score": "0.4585276", "text": "def build\n @buttons = Hash.new\n create_palettes\n end", "title": "" }, { "docid": "1c0ab5462e4b25160e64b732e444ab37", "score": "0.45847818", "text": "def create\n @premise = Premise.new(premise_params)\n\n respond_to do |format|\n if @premise.save\n format.html { redirect_to @premise, notice: 'Premise was successfully created.' }\n format.json { render :show, status: :created, location: @premise }\n else\n format.html { render :new }\n format.json { render json: @premise.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b8101f0451227b316f19260070e44ec", "score": "0.4582289", "text": "def get_presets(has_wmv, has_flash)\n presets = {}\n languages = []\n preset_languages = @stream_preset.preset_languages\n language_ids = preset_languages.map(&:language_id).uniq\n wmv_id = Technology.find_by_name('WMV').id\n flash_id = Technology.find_by_name('Flash').id\n\n # for each language create list of technologies\n language_ids.each { |language_id|\n languages << \"<option #{\"selected='selected'\".html_safe if language_id == @language.id} value='#{language_id}'>#{Language.find(language_id).language}</option>\"\n options_list = []\n image = ''\n presets[language_id] ||= {}\n technologies = {}\n preset_languages.select { |pl| pl.language_id == language_id }.collect { |l| l.stream_items }.flatten.reject { |si| si.stream_url.empty? }.each { |item|\n tech_id = item.technology.id\n next if (!has_wmv && tech_id == wmv_id) || (!has_flash && tech_id == flash_id)\n presets[language_id][tech_id] ||= ''\n is_default = item.is_default\n if technologies[tech_id].nil?\n options_list << \"<input type='radio' name='technology_id' #{\"checked='checked'\".html_safe if is_default} value='#{tech_id}'/><span>#{item.technology.name}</span><br/>\"\n technologies[tech_id] = 1\n elsif is_default\n # reset technology to ensure it is default\n options_list.delete_if { |x| /#{item.technology.name}/.match x }\n options_list << \"<input type='radio' name='technology_id' #{\"checked='checked'\".html_safe if is_default} value='#{tech_id}'/><span>#{item.technology.name}</span><br/>\"\n end\n image_path = item.preset_language.stream_preset.stream_state.inactive_image(language_id)\n image = \"<img src='#{image_path.try(:filename)}' alt='#{I18n.t 'kabtv.kabtv.no_broadcast'}' />\" if image_path\n presets[language_id][tech_id] += \"<option #{\"selected='selected'\".html_safe if is_default} value='#{item.stream_url}'>#{item.quality.name}</option>\"\n }\n presets[language_id][:options] = options_list.uniq.compact.join\n presets[language_id][:image] = image\n }\n\n [presets, languages.join(',')]\n end", "title": "" }, { "docid": "5d4022de970da3d55e428645684e8582", "score": "0.45798177", "text": "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "title": "" }, { "docid": "68dba9e7d21bfe36d493da59ae2d63ee", "score": "0.45667413", "text": "def palette_params\n params.require(:palette).permit(:name)\n end", "title": "" }, { "docid": "68dba9e7d21bfe36d493da59ae2d63ee", "score": "0.45667413", "text": "def palette_params\n params.require(:palette).permit(:name)\n end", "title": "" }, { "docid": "2b9aae524d844b497e351eaef4e26fc4", "score": "0.45651993", "text": "def create\n @karutum = Karutum.new(karutum_params)\n\n respond_to do |format|\n if @karutum.save\n format.html { redirect_to @karutum, notice: 'Karutum was successfully created.' }\n format.json { render :show, status: :created, location: @karutum }\n else\n format.html { render :new }\n format.json { render json: @karutum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "545c185b5b4a8240a08b1b29a9d12316", "score": "0.45607558", "text": "def create\n @pug = Pug.new(pug_params)\n\n if @pug.save\n render json: @pug, status: :created, location: @pug\n else\n render json: @pug.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "24274787fb4211562dbcb78b92f3fb9c", "score": "0.45607477", "text": "def create\n @card_set = CardSet.new(card_set_params)\n\n respond_to do |format|\n if @card_set.save\n format.html { redirect_to @card_set, notice: 'Card set was successfully created.' }\n format.json { render :show, status: :created, location: @card_set }\n else\n format.html { render :new }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f09882aa955b973bb43b92e35019749", "score": "0.45605218", "text": "def create\n @pre_step = PreStep.new(params[:pre_step])\n\n respond_to do |format|\n if @pre_step.save\n format.html { redirect_to @pre_step, notice: 'Pre step was successfully created.' }\n format.json { render json: @pre_step, status: :created, location: @pre_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pre_step.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df07bf6e1838f04f77210d2079156d4c", "score": "0.4559157", "text": "def create\n @teaser = Teaser.new(params[:teaser])\n\n respond_to do |format|\n if @teaser.save\n format.html { redirect_to @teaser, notice: 'Teaser was successfully created.' }\n format.json { render json: @teaser, status: :created, location: @teaser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teaser.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50efe43b16e2ace0ba145e31ae7ef303", "score": "0.45578638", "text": "def create\n @tinymap = Tinymap.new(params[:tinymap])\n\n respond_to do |format|\n if @tinymap.save\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully created.' }\n format.json { render json: @tinymap, status: :created, location: @tinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03569d63d0d170fe8a10c1b4c733ad9d", "score": "0.45569927", "text": "def create\n @project_stage = ProjectStage.new(project_stage_params)\n\n respond_to do |format|\n if @project_stage.save\n format.html { redirect_to @project_stage, notice: 'Project stage was successfully created.' }\n format.json { render :show, status: :created, location: @project_stage }\n else\n format.html { render :new }\n format.json { render json: @project_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00b116f5bf4817b832c71c6e3ef6c0e1", "score": "0.45559075", "text": "def set_palette\n @palette = Palette.find_by_id(params[:id])\n\n if !@palette\n respond_to do |format|\n format.html { redirect_to palettes_url, notice: 'Palette could not be found.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "1696d5d4d22767f1a79db670670b4d3b", "score": "0.45471686", "text": "def create\n render json: Post.create(params[\"post\"])\n end", "title": "" }, { "docid": "8ec7caf4de69d497414813b1effea9ef", "score": "0.45466694", "text": "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", "title": "" }, { "docid": "c8c02fe0b8290ffbb52675d01370f5b8", "score": "0.45433226", "text": "def stage_params\n #params[:stage]\n params.require(:stage).permit(:scene_data, :textures)\n end", "title": "" }, { "docid": "023ed9493d4e4134b451741895e0b543", "score": "0.45416662", "text": "def create\n @predict = Predict.new(params[:predict])\n\n respond_to do |format|\n if @predict.save\n format.html { redirect_to @predict, notice: 'Predict was successfully created.' }\n format.json { render json: @predict, status: :created, location: @predict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @predict.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "49b5051c9276ac1ad35319e9852f020c", "score": "0.45394897", "text": "def latstraps1_params\n params.require(:latstraps1).permit(:exercise, :reps, :sets)\n end", "title": "" }, { "docid": "ea928a36cd00aa10d62da3ec7ce63ec3", "score": "0.45393664", "text": "def create\n @admin_stage = Clapme::Stage.new(admin_stage_params)\n\n respond_to do |format|\n if @admin_stage.save\n format.html { redirect_to admin_stage_url(@admin_stage.id), notice: 'Stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_stage }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a436fbb8bbb2becd5f2442a265459ef9", "score": "0.45354193", "text": "def create\n @setor = Setor.new(params[:setor])\n\n respond_to do |format|\n if @setor.save\n format.html { redirect_to @setor, notice: 'Setor was successfully created.' }\n format.json { render json: @setor, status: :created, location: @setor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @setor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ab85b9da1b1fc62362911f6132f8c78", "score": "0.4531086", "text": "def create\n @asset = Asset.new(params[:asset])\n @countries = Country.find(:all)\n \n respond_to do |format|\n if @asset.save\n format.html { redirect_to(asset_manager_asset_path(@asset), :notice => 'Asset was successfully created.') }\n format.xml { render :xml => @asset, :status => :created, :location => @asset }\n else\n format.html { render :action => :new, :notice => 'Asset was not created.' }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e612dc22d03604adeeb3e3bfeae1144", "score": "0.45238447", "text": "def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end", "title": "" } ]
76076ff0f703d1b8fcd007d5c883a239
The core message of the notification
[ { "docid": "5e874e770a9b3a7dfda1f23542106ebf", "score": "0.6082643", "text": "def message\n \"#{event.kind}\"\n end", "title": "" } ]
[ { "docid": "a02fbf56549d15fb47c1ac8d02c1ae7f", "score": "0.7095066", "text": "def message\n \"You have a new notification!\"\n end", "title": "" }, { "docid": "db581639a67ebe3dfedf7215c17c2401", "score": "0.700564", "text": "def message\n \n end", "title": "" }, { "docid": "9f0e1671b8fb1de3ceb40647c541cc15", "score": "0.70022476", "text": "def message\n __getobj__\n end", "title": "" }, { "docid": "9f0e1671b8fb1de3ceb40647c541cc15", "score": "0.70022476", "text": "def message\n __getobj__\n end", "title": "" }, { "docid": "9f0e1671b8fb1de3ceb40647c541cc15", "score": "0.70022476", "text": "def message\n __getobj__\n end", "title": "" }, { "docid": "e4421a5a7295a49902abf25773243fb8", "score": "0.69678134", "text": "def message\n MESSAGE\n end", "title": "" }, { "docid": "e4421a5a7295a49902abf25773243fb8", "score": "0.69678134", "text": "def message\n MESSAGE\n end", "title": "" }, { "docid": "e4421a5a7295a49902abf25773243fb8", "score": "0.69678134", "text": "def message\n MESSAGE\n end", "title": "" }, { "docid": "e4421a5a7295a49902abf25773243fb8", "score": "0.69678134", "text": "def message\n MESSAGE\n end", "title": "" }, { "docid": "d7486b3e94def91e452c16718ca2ca93", "score": "0.6917092", "text": "def message\n @_message\n end", "title": "" }, { "docid": "d7486b3e94def91e452c16718ca2ca93", "score": "0.6917092", "text": "def message\n @_message\n end", "title": "" }, { "docid": "d9ced90420638936bc8ef5415849079b", "score": "0.68934184", "text": "def message\n info['Message']\n end", "title": "" }, { "docid": "5a06c658a0a867f98141588ab0ddc0a3", "score": "0.6890864", "text": "def message\n call_once\n @message\n end", "title": "" }, { "docid": "9e339ca91e106a1dfc8d17b78b80278e", "score": "0.6800601", "text": "def text\n Notification.generate(self, self.class.level)\n end", "title": "" }, { "docid": "5018895cbe2760926d48348500ea6737", "score": "0.6792123", "text": "def message\n @message\n end", "title": "" }, { "docid": "16887fdb94e1fdae8531c1fbe6f344c0", "score": "0.6785256", "text": "def message\n end", "title": "" }, { "docid": "390e283749098492e2050521dbffffe5", "score": "0.67757785", "text": "def message() end", "title": "" }, { "docid": "6453506aa42ee078b36fc8d82bb88aaf", "score": "0.67622715", "text": "def message\n @values['message']\n end", "title": "" }, { "docid": "59f105e280284238b2e969bbed3262a9", "score": "0.67574185", "text": "def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end", "title": "" }, { "docid": "b1dfc97b05fe671f09b9bd147d00664a", "score": "0.6735383", "text": "def get_message\n get_status[:message]\n end", "title": "" }, { "docid": "1b0eb402e400c02ad0ea1125eff11d7a", "score": "0.6716326", "text": "def message\n attributes.fetch(:message)\n end", "title": "" }, { "docid": "6e60eaa60b891784c73859fe63c1ce5f", "score": "0.67138493", "text": "def message\n data.message\n end", "title": "" }, { "docid": "5c709b2bbbef6bced33e5304a62b6a0c", "score": "0.6702284", "text": "def message\n\t\tself.object[:message]\n\tend", "title": "" }, { "docid": "c9383448dd5b0577d5deaa858a1ccffd", "score": "0.66964424", "text": "def message\n\t\tself.object[\"message\"]\n\tend", "title": "" }, { "docid": "e645915e946fed44d3b1bec04579e9d3", "score": "0.66902626", "text": "def message; end", "title": "" }, { "docid": "e645915e946fed44d3b1bec04579e9d3", "score": "0.66902626", "text": "def message; end", "title": "" }, { "docid": "e645915e946fed44d3b1bec04579e9d3", "score": "0.66902626", "text": "def message; end", "title": "" }, { "docid": "e645915e946fed44d3b1bec04579e9d3", "score": "0.66902626", "text": "def message; end", "title": "" }, { "docid": "e645915e946fed44d3b1bec04579e9d3", "score": "0.66902626", "text": "def message; end", "title": "" }, { "docid": "e645915e946fed44d3b1bec04579e9d3", "score": "0.66902626", "text": "def message; end", "title": "" }, { "docid": "3d2c86c5dc20c7cc59dd2b15bb936504", "score": "0.666991", "text": "def message\n\t\t@message \n\tend", "title": "" }, { "docid": "a8852e4f586bd0b1ad7e8827ec6cab0e", "score": "0.66695726", "text": "def message\n @data['message']\n end", "title": "" }, { "docid": "a0f96f2353b75beb3c1f8b48af397d64", "score": "0.6654862", "text": "def msg(message)\n end", "title": "" }, { "docid": "596f47984f5af73b7d903ebaf1a78840", "score": "0.66259927", "text": "def message\n @message\n end", "title": "" }, { "docid": "7d2f2165dbe76034f2ad07103c10969c", "score": "0.66115534", "text": "def message\n @message || super\n end", "title": "" }, { "docid": "481b3648f107eedc7d1ac66896ad94c4", "score": "0.66031146", "text": "def message\n status.last\n end", "title": "" }, { "docid": "9a8c3fa85a65c2c26f25d396f305fdce", "score": "0.6571046", "text": "def message_version\r\n\t\t\tCURRENT_VERSION\r\n\t\tend", "title": "" }, { "docid": "22a909f89a9a3cddaf7dd4c15337db0d", "score": "0.6566734", "text": "def message( message )\n\tend", "title": "" }, { "docid": "9cfa78f5ef428c74f52b6f3f43b4257a", "score": "0.65524685", "text": "def message\n @attributes[:message]\n end", "title": "" }, { "docid": "f1467245470fe44624f795e6f47f602f", "score": "0.6533641", "text": "def message_id; @message_impl.getMessageId; end", "title": "" }, { "docid": "690840b19965f0b8636b5295554e4469", "score": "0.649981", "text": "def flag_message\n event = flag_events.last\n event.message if event\n end", "title": "" }, { "docid": "0fd84167d9fc2acdc9234c1fafd707d4", "score": "0.64882636", "text": "def message\n attributes[:message]\n end", "title": "" }, { "docid": "b5a80b45c44c2e4d7e31d81ab078712a", "score": "0.64765316", "text": "def message\n @messages.first\n end", "title": "" }, { "docid": "d4e226cb3bccf3c456bd26fb60a8d782", "score": "0.64718086", "text": "def priority; @message_impl.getPriority; end", "title": "" }, { "docid": "593945c994368aafe4896dce3332567e", "score": "0.647131", "text": "def status_message\n @data[:status_message]\n end", "title": "" }, { "docid": "c5d3e9fa049e264c818fd117f6650409", "score": "0.6464873", "text": "def message\n raise \"Override #message in the service class\"\n end", "title": "" }, { "docid": "650b0c7458e98a01e37d40bcf070a894", "score": "0.64572257", "text": "def notify(message)\n puts message['data']\n end", "title": "" }, { "docid": "30a2ede5c172ea4115470110815bf796", "score": "0.64253163", "text": "def message(message) end", "title": "" }, { "docid": "25459e493a6ef647d2e539720025818b", "score": "0.642018", "text": "def getMessage()\n return @message\n end", "title": "" }, { "docid": "9464422215cd9e136bca3023c2557493", "score": "0.64090264", "text": "def msg\n self['msg']||{}\n end", "title": "" }, { "docid": "0415b00f6d17e4d8997f1aca0fb8ad46", "score": "0.6398563", "text": "def message\n @_event.data\n end", "title": "" }, { "docid": "c57bcc9786bd4d8b7af417c61408a5ec", "score": "0.63668954", "text": "def message\n @message ||= Interface::Message.new(self)\n end", "title": "" }, { "docid": "a276b4c39d40d7d3db21aa6b0063bf98", "score": "0.63638335", "text": "def message\n to_s\n end", "title": "" }, { "docid": "a276b4c39d40d7d3db21aa6b0063bf98", "score": "0.63638335", "text": "def message\n to_s\n end", "title": "" }, { "docid": "e8dec9040473a1b739fd468819f8c54e", "score": "0.63502437", "text": "def message\n @_args.first\n end", "title": "" }, { "docid": "403088a6f3e07ff2d1ec478d2019a5f1", "score": "0.63459486", "text": "def parent_message\n end", "title": "" }, { "docid": "c389ecf5541ddeb284ebd25511ec770f", "score": "0.6338316", "text": "def message_notification\n fetch(:hipchat_announce, false)\n end", "title": "" }, { "docid": "d33b7ffeb7c5592292bd35433e7bb5c9", "score": "0.6331888", "text": "def message text\n $status_message.value = text # trying out 2011-10-9 \n end", "title": "" }, { "docid": "a20813f59de989e680390bd618d98f90", "score": "0.6284153", "text": "def name\n\t\t\t\t\"notify\"\n\t\t\tend", "title": "" }, { "docid": "a20813f59de989e680390bd618d98f90", "score": "0.6284153", "text": "def name\n\t\t\t\t\"notify\"\n\t\t\tend", "title": "" }, { "docid": "c802e9023cca18e16f478303921a0973", "score": "0.62769854", "text": "def raw_message\n @raw_message\n end", "title": "" }, { "docid": "6cfb746c8ad123e3bf8f955becf48025", "score": "0.6273971", "text": "def message\n t(\".message\")\n end", "title": "" }, { "docid": "17eff9e5128c3e2651373f67e7a1ec13", "score": "0.625437", "text": "def getNotify\r\n\t\t\t\t\treturn @notify\r\n\t\t\t\tend", "title": "" }, { "docid": "17eff9e5128c3e2651373f67e7a1ec13", "score": "0.625437", "text": "def getNotify\r\n\t\t\t\t\treturn @notify\r\n\t\t\t\tend", "title": "" }, { "docid": "ddd9cfaa9fa99f0c77e4beceacafa19f", "score": "0.62482274", "text": "def foorth_message\r\n \"#{self.foorth_code} #{self.message}\"\r\n end", "title": "" }, { "docid": "7a315e9b85fb3ae1b7a522f1075748fd", "score": "0.6213367", "text": "def message=(_); end", "title": "" }, { "docid": "7569f20059bbe79d4f2ee91be6ec1fac", "score": "0.61952144", "text": "def name\n\t\t\t\"notify\"\n\t\tend", "title": "" }, { "docid": "7569f20059bbe79d4f2ee91be6ec1fac", "score": "0.61952144", "text": "def name\n\t\t\t\"notify\"\n\t\tend", "title": "" }, { "docid": "330268ce1d86e1a3dc6a4dafd51cd46b", "score": "0.61890155", "text": "def message\n read_content :status\n end", "title": "" }, { "docid": "f0f7bedd908ea4e64de73b7fcd12afa3", "score": "0.61860746", "text": "def status\n @message\n end", "title": "" }, { "docid": "fb118901402b78522ff7f33f6921b092", "score": "0.6183228", "text": "def get_message\n @reply['message']\n end", "title": "" }, { "docid": "be01e0af1ff3e5dd242d2400c125b8c8", "score": "0.6161267", "text": "def msg(message)\n \"#{@current_host_name}: #{message}\"\n end", "title": "" }, { "docid": "cc3b62ad5857e65b9bf6021f7dc8d8af", "score": "0.61594576", "text": "def message\n (operands.detect {|op| op.is_a?(Array) && op[0] == :message} || [:message])[1..-1]\n end", "title": "" }, { "docid": "522bc7528c3db3469bb4812e901f88dc", "score": "0.6147687", "text": "def message\n t(\".message\")\n end", "title": "" }, { "docid": "522bc7528c3db3469bb4812e901f88dc", "score": "0.6147687", "text": "def message\n t(\".message\")\n end", "title": "" }, { "docid": "4670d73726c29b8564c076762051b5e3", "score": "0.61425245", "text": "def message\n @name\n end", "title": "" }, { "docid": "482300437fe90cae3cc84084990f1f8e", "score": "0.61295193", "text": "def computer_message\n computer_msg.text\n end", "title": "" }, { "docid": "482300437fe90cae3cc84084990f1f8e", "score": "0.61295193", "text": "def computer_message\n computer_msg.text\n end", "title": "" }, { "docid": "279ba385deced2da523ea817a627ef4f", "score": "0.6108363", "text": "def messaging\n end", "title": "" }, { "docid": "bdde4c54853b31d0dcdaf1c7d28c5514", "score": "0.61076933", "text": "def new_message\n end", "title": "" }, { "docid": "30b1e2a2df1181af296065fac78e5da3", "score": "0.6098988", "text": "def message(msg)\n\t\[email protected](msg)\n\tend", "title": "" }, { "docid": "09b3bb4129f666d1e4a9e13e08994b4f", "score": "0.60979736", "text": "def notification_id\n @id\n end", "title": "" }, { "docid": "a9570b3db8e56cda0d313493838518e7", "score": "0.6090003", "text": "def message\n process_mess\n end", "title": "" }, { "docid": "695602c42f3fc56cdb9bd7e231f55b77", "score": "0.6086041", "text": "def message=(_arg0); end", "title": "" }, { "docid": "695602c42f3fc56cdb9bd7e231f55b77", "score": "0.6086041", "text": "def message=(_arg0); end", "title": "" }, { "docid": "58cc0b3c338926ce8c9603c6c10c4729", "score": "0.60788274", "text": "def msg\n\treturn @msg_buf.dup()\n end", "title": "" }, { "docid": "5d5859d1d34da2686cd013281e107b35", "score": "0.60782343", "text": "def force_message m; send_message format_message(nil, Time.now, m) end", "title": "" }, { "docid": "b193223d7eeb8d5742ec6581a4ac68f0", "score": "0.6075619", "text": "def status_message\n data.status_message\n end", "title": "" }, { "docid": "559f276f94c6575743ea83702a251275", "score": "0.60733616", "text": "def get_message\n raise NotImplementedError.new(\"#{self.class.name}#get_message() is not implemented.\")\n end", "title": "" }, { "docid": "559f276f94c6575743ea83702a251275", "score": "0.60733616", "text": "def get_message\n raise NotImplementedError.new(\"#{self.class.name}#get_message() is not implemented.\")\n end", "title": "" }, { "docid": "a2e8bd6ad0e5ecbc7a22e5ebeba9c62c", "score": "0.6056964", "text": "def description\n self[:message]\n end", "title": "" }, { "docid": "d8cbc19e3cf381e163b0ed05e54b1d86", "score": "0.6049767", "text": "def message\n @commit.message\n end", "title": "" }, { "docid": "a4f3d84c592eed7c21bfed3190000378", "score": "0.60489637", "text": "def message\n @_message ||= @response['message']\n end", "title": "" }, { "docid": "a593d1381fa92265456cfe1865585c33", "score": "0.604538", "text": "def manager_action_message\n return @manager_action_message\n end", "title": "" }, { "docid": "9f30725716b3f055ec6551d6f7060954", "score": "0.60433036", "text": "def message_text\n clear_default_fields\n result = self.message\n reset_default_fields\n result\n end", "title": "" }, { "docid": "afa1da995d1a5e1757058130c9682224", "score": "0.6040928", "text": "def raw_message\n @raw_message ||= @md[FIELDS.index('raw_message') + 1].strip\n end", "title": "" }, { "docid": "47b8fb6c6a086e9bc5e5b7bbd89fcece", "score": "0.6037308", "text": "def update_message(data); end", "title": "" }, { "docid": "47b8fb6c6a086e9bc5e5b7bbd89fcece", "score": "0.6037308", "text": "def update_message(data); end", "title": "" }, { "docid": "e3e0126abb7ae18aae4e9678b193ddfc", "score": "0.60351485", "text": "def message\n\t\t\[email protected]\n\t\tend", "title": "" }, { "docid": "0307a36c31aa016f72f90df5b1c6d8e6", "score": "0.6028747", "text": "def get_msg\n return \"#{@msg} for #{@settings.application}. (#{@settings.stage})\n \\n Branch: #{@settings.branch} \n \\n Deployed by: #{@settings.deployer}\"\n end", "title": "" } ]
d912eeffbf6ea99e0f8227ed9eae0573
searchable do integer :id do id end text :track_name end recording_start_time is input as hh:mm:ss but stored as seconds
[ { "docid": "95ca35fa4c884a117f83e73c063310dc", "score": "0.566805", "text": "def recording_start_time=(time)\n if time.blank?\n super(nil)\n else\n super(time.split(':').map { |a| a.to_i }.inject(0) { |a, b| a * 60 + b})\n end\n end", "title": "" } ]
[ { "docid": "5302ae4ca1062e8b250591c37cfdb48d", "score": "0.6157433", "text": "def track_params\n params.require(:track).permit(:start_time, :end_time, :total_time, :tag, :work_type, :user_id)\n end", "title": "" }, { "docid": "5affc6c2f9bd758a0b04755766886094", "score": "0.61281693", "text": "def track_params\n params.require(:track).permit(:start, :end, :comment, :label_id)\n end", "title": "" }, { "docid": "132f72f42c5893d76df06b998ecab662", "score": "0.60662776", "text": "def time_track_params\n params.require(:time_track).permit(:description, :start_at, :end_at)\n end", "title": "" }, { "docid": "203f28391722a1140a616224b990bde2", "score": "0.59480965", "text": "def track_params\n params.require(:track).permit(:recording)\n end", "title": "" }, { "docid": "15c56914626dfb6901cf9983118ac0de", "score": "0.58909744", "text": "def set_time_track\n @time_track = TimeTrack.find(params[:id] || params[:time_track_id])\n end", "title": "" }, { "docid": "fa2ddee6b9b491465762dcb035b46a07", "score": "0.58837765", "text": "def recording_schedule\n MythTV::RecordingSchedule.find(:first, :conditions => { :recordid => mythtv_recordid }) if mythtv_recordid\n end", "title": "" }, { "docid": "f9b3e0b30550bd4feadab158902e3562", "score": "0.5875078", "text": "def start; Time.at(recstartts.to_i); end", "title": "" }, { "docid": "0546887ad68f43bca87717245c9d97f4", "score": "0.58180964", "text": "def timing_params\n params.require(:timing).permit(:day, :start_time, :end_time, :place_id, :search)\n end", "title": "" }, { "docid": "32d8a4ea5500cbb11bc039461644ced9", "score": "0.58095276", "text": "def index\n\n if params[:search].present?\n @search = params[:search]\n @timetracks = Timetrack.where(\"id = :search OR user_id = :search\", search: \"#{@search}\")\n \n else \n @timetracks = Timetrack.all\n end\n \n end", "title": "" }, { "docid": "b56056e134d3257bc21b38cb2e7e1082", "score": "0.5805025", "text": "def track_params\n params.require(:track).permit(:name, :duration)\n end", "title": "" }, { "docid": "26c051f5365f40e1c8017d911e9e7524", "score": "0.5779121", "text": "def set_time_track\n @time_track = TimeTrack.find(params[:id])\n end", "title": "" }, { "docid": "27e0b88e570e88b2479f0b28e30cdd69", "score": "0.5695282", "text": "def find_by\n @recording = Recording.find_by(id: params[:id]) \n end", "title": "" }, { "docid": "0e1da0a06e127319da58f9b4a616150c", "score": "0.5695131", "text": "def set_timetrack\n @timetrack = Timetrack.find(params[:id])\n end", "title": "" }, { "docid": "dd302a5351d3f6df2634597dbc7bd77d", "score": "0.5662527", "text": "def set_audio_recording_track\n @audio_recording_track = AudioRecordingTrack.find(params[:id])\n end", "title": "" }, { "docid": "359899435297b8fbba8b87c0be820fb7", "score": "0.55937827", "text": "def set_recorded_time\n @recorded_time = RecordedTime.find(params[:id])\n end", "title": "" }, { "docid": "6103da91854c6e234e908f985d35572f", "score": "0.55597687", "text": "def start_time_for_solr\n self.start_time.ergo{utc.strftime(SOLR_TIME_FORMAT).to_i} || \"\"\n end", "title": "" }, { "docid": "71e097f657c9c15ecc2e68fe1e1a58d1", "score": "0.55537695", "text": "def recording_start\n #This is a stub, used for indexing\nend", "title": "" }, { "docid": "8bb58baf571c3157c0a20561d7bb348a", "score": "0.55426323", "text": "def search_in_time(term, begin_time, end_time, options={})\n search(term, options.merge(begin_time:begin_time.strftime('%Y.%m.%dT%H:%M'), end_time:end_time.strftime('%Y.%m.%dT%H:%M'), tz:'Asia/Seoul',time:'custom'))\n end", "title": "" }, { "docid": "5e9507bad1786f41ca2fcd255a364b65", "score": "0.55399144", "text": "def time_record_params\n params.require(:time_record).permit(:start_time,\n :end_time, :name, :notes, :event_id, :volunteer_id, :category_id);\n end", "title": "" }, { "docid": "295bac5037da47ca650d3102bcbf9c88", "score": "0.5533256", "text": "def track_params\n params.require(:track).permit(:happening_id, :name, :longitude, :latitude, :description, :polyline, :location, :length, :group_id)\n end", "title": "" }, { "docid": "5f29989ff726e59a6929d44f4251d5c2", "score": "0.5521756", "text": "def time_record_params\n params.require(:time_record).permit(:comment, :time_type, :started_time, :finished_time, :user_id)\n end", "title": "" }, { "docid": "9d928986c0cca74dfefe6b63c95b458a", "score": "0.5506646", "text": "def track_params\n params[:track]\n end", "title": "" }, { "docid": "9a0ae4394c93b77f08460fb112da25b7", "score": "0.54974055", "text": "def time_record_params\n params.require(:time_record).permit(:start_time,\n :end_time, :name, :category, :notes, :event_id, :volunteer_id);\n end", "title": "" }, { "docid": "fc7218cd122f63293e044b155901ca8c", "score": "0.54770064", "text": "def tracks_collection_start\n end", "title": "" }, { "docid": "fc7218cd122f63293e044b155901ca8c", "score": "0.54770064", "text": "def tracks_collection_start\n end", "title": "" }, { "docid": "fd3e5e6d570f060b0dbb42b0bf63e059", "score": "0.547629", "text": "def track_params\n params.require(:track).permit(:title, :track_number, :cd_id)\n end", "title": "" }, { "docid": "64ab803dc72ab1b05158d5c637902565", "score": "0.5458577", "text": "def record_params\n params.require(:record).permit(:car_id, :user_id, :start, :end)\n end", "title": "" }, { "docid": "732fe39e71eb207a71c3480d1999ee66", "score": "0.5457698", "text": "def tracking_time_params\n params.require(:tracking_time).permit(:task_id, :start_at, :end_at)\n end", "title": "" }, { "docid": "e2113699758ed7a11e37daab6fd82409", "score": "0.5456414", "text": "def recorded_time_params\n params.require(:recorded_time).permit(:number)\n end", "title": "" }, { "docid": "1b45764a2abc26c9a4f8d10d08aea62f", "score": "0.54311115", "text": "def session_params\n params.require(:session).permit(:start_time, :end_time, :name, :track_id)\n end", "title": "" }, { "docid": "3fdfa856df7e7983b30ce79fa0daadfc", "score": "0.53777796", "text": "def track(event_name, ids, time = Time.now.utc)\n event_time = time.kind_of?(Time) ? time : Time.parse(time.to_s)\n time_events = TimeEvents.start(@time_spans, event_name, event_time)\n\n track_events(time_events, Array(ids))\n end", "title": "" }, { "docid": "08e089f416b61d4c243e3248fb9e9edc", "score": "0.53721476", "text": "def time_track_params\n params.require(:time_track).permit(:project_id, :user_id, :number_of_hours, :description, :work_date)\n end", "title": "" }, { "docid": "996ffd9870c02a5202823bfdbd1329f6", "score": "0.53692865", "text": "def find stime, etime\n @records.where(time: stime..etime)\n end", "title": "" }, { "docid": "5c6ff79bea7014df371b409f6a5335e6", "score": "0.5368824", "text": "def song_history_params\n params.permit(:media_id, :track_source, :duration, :genre, :album, :album_art_uri, :track_number, :num_tracks, :recorded_at, :latitude, :longitude, :accuracy, :altitude, :record_type, {:device => [:model, :os]}, :artist, :title)\n end", "title": "" }, { "docid": "648a7447a6fbe586c929fb277f462161", "score": "0.53666", "text": "def track_params\n params.require(:track).permit(:name, :location, :track_id, :layout_id, :strategy_id)\n end", "title": "" }, { "docid": "d1e7a4e6676e05c42489bec8b5b1842b", "score": "0.53558004", "text": "def by_time\n \t\tstr = \"\"\n\t \tunless !@search_params[:time_part] || @search_params[:time_part].empty?\n\t \t\tx = @search_params[:time_part].split(':')\n \t\t\t\ttime = x[0].to_i * 60 + x[1].to_i\n\n\t \t\t# Query logic: time needs to between start and end time unless end time is < \n\t \t\t# start time which indicates the availability extends past midnight. \t\t\t\n\t \t\tstr = \"(end_time > start_time AND start_time <= #{time} AND end_time >= #{time})\"\n\t \tend\n \t\treturn str\n\t end", "title": "" }, { "docid": "6920e647f50d3e6c32749bd65d269a77", "score": "0.53481895", "text": "def track_params\n params.require(:track).permit(:title, :rating, :date, :location, :bitrate, :lyrics, :track_id, :disc_id, :format)\n end", "title": "" }, { "docid": "5a2809d86d4126a10682dc9aadf0b70d", "score": "0.53398", "text": "def track_params\n params.require(:track).permit(:title, :time, :youtubeurl, :album_id)\n end", "title": "" }, { "docid": "a33dabbaad2fded9451ce6db8c695cb2", "score": "0.53397655", "text": "def data_track_params\n params.require(:data_track).permit(:name, :description, :format, :take_id, :tag_list, :technician, :recorded_on, :public, :user_id, :sensor_type_ids => [], :mover_ids => [])\n end", "title": "" }, { "docid": "992675dc635e4ab8e6b9e22be32ef9c9", "score": "0.53397375", "text": "def set_time_tracking\n @time_tracking = TimeTracking.find(params[:id])\n end", "title": "" }, { "docid": "5f268a3a957173d607fb759ac11a359e", "score": "0.5333534", "text": "def audio_recording_track_params\n params.require(:audio_recording_track).permit(:name, :audio_file, :audio_recording_id)\n end", "title": "" }, { "docid": "850e09e8f65244823ab2231983d6e056", "score": "0.5333494", "text": "def show\n @recording = Recording.find(params[:id])\n\n ### TODO if params send in a specific topic - start from the first segment with that name\n if params.include? \"topic\"\n @start_time = get_start_time_from_segments(@recording, params[:topic])\n end\n \n ### Also fix segments with nil value for name. \n unless @recording.segments.empty?\n #Fix this - currently only gets length from last start time to beginning\n @segments = Recording.find(params[:id]).segments.sort_by(&:start_time)\n gon.interview_segments = @segments.to_json\n gon.interview_length = @segments.sort_by{|s| s.end_time.to_i}.last.end_time\n end\n \n end", "title": "" }, { "docid": "6ee5a6d042068c552c527b69eb73a71b", "score": "0.53204954", "text": "def timetrack_params\n @user = current_user.id\n params.require(:timetrack).permit(:longitude, :latitude, :comment , :user_id)\n end", "title": "" }, { "docid": "4aaa9b4ac60ad7b259e20ae4c0edc00a", "score": "0.53071326", "text": "def to_solr\n solr_hash = super\n solr_hash[:end_time_fsi] = end_time\n solr_hash\n end", "title": "" }, { "docid": "059efa0fcd669efd35b68c1613096852", "score": "0.5296754", "text": "def start_track\n @track = Track.new\n @track.name = params[:name] || \"Track from #{Time.now}\"\n @track.user = current_user\n @track.is_public = false\n @track.save!\n end", "title": "" }, { "docid": "2c5c1af78a6bd58fd950af2f415c5232", "score": "0.52912235", "text": "def set_track\n @track = Track.find(params[:id])\n \n end", "title": "" }, { "docid": "08eb947ab135754d9647bc86673e1cdf", "score": "0.5288585", "text": "def get_trackings_by_id(id)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/trackings/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::Tracking.new(r)\n end", "title": "" }, { "docid": "08eb947ab135754d9647bc86673e1cdf", "score": "0.5288585", "text": "def get_trackings_by_id(id)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/trackings/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::Tracking.new(r)\n end", "title": "" }, { "docid": "1f23730237fdc8b203cb987e183f8d9a", "score": "0.5288114", "text": "def search(params = {})\n if params[:track].blank?\n raise ArgumentError, \"Missing required argument\"\n end\n\n query = {\n track: params[:track]\n }\n\n query[:limit] = params[:limit] if params[:limit]\n query[:page] = params[:page] if params[:page]\n query[:track] = params[:track] if params[:track]\n query[:artist] = params[:artist] if params[:artist]\n\n get_instance('track.search', :search, :track, query, false)\n end", "title": "" }, { "docid": "50914c6de95f988614fdbdcb839f1651", "score": "0.5280479", "text": "def track_params\n params.require(:track).permit(:title, :competition_id, :track_data)\n end", "title": "" }, { "docid": "2f16f7c701793002fb8341847c626031", "score": "0.5277046", "text": "def calculate_start_times\n time = tracks.first.start_time || 0\n tracks.each do |track|\n break if track.duration.nil?\n\n time = (track.start_time ||= time)\n time += track.duration\n end\n end", "title": "" }, { "docid": "17caef56f42a0743a98a6244f1f9c5db", "score": "0.5267204", "text": "def song_params\n params.require(:song).permit(:title, :ordinal).tap do |p|\n p[:record_id] = params[:record_id].to_i\n end\n end", "title": "" }, { "docid": "2ebce591db16fac1d755ebf198409cdd", "score": "0.52625656", "text": "def track_params\n params.require(:track).permit(:guid, :url, :created)\n end", "title": "" }, { "docid": "77824b3400892c1544b59b8de10310ff", "score": "0.5257337", "text": "def set_recording\n @recording = Recording.find(params[:id])\n end", "title": "" }, { "docid": "77824b3400892c1544b59b8de10310ff", "score": "0.5257337", "text": "def set_recording\n @recording = Recording.find(params[:id])\n end", "title": "" }, { "docid": "77824b3400892c1544b59b8de10310ff", "score": "0.5257337", "text": "def set_recording\n @recording = Recording.find(params[:id])\n end", "title": "" }, { "docid": "336da7511f0a5e65bb2d9464f725e5c2", "score": "0.5247952", "text": "def track_params\n params.require(:track).permit(:name, :artist_id)\n end", "title": "" }, { "docid": "bb36c9abf7198437e108ccdba51c296f", "score": "0.52430016", "text": "def start_time; @start_time/1000.0 end", "title": "" }, { "docid": "9641146940e7001de9b17982627598dc", "score": "0.52415603", "text": "def set_track\n @track = Track.find(params[:id])\n end", "title": "" }, { "docid": "9641146940e7001de9b17982627598dc", "score": "0.52415603", "text": "def set_track\n @track = Track.find(params[:id])\n end", "title": "" }, { "docid": "9641146940e7001de9b17982627598dc", "score": "0.52415603", "text": "def set_track\n @track = Track.find(params[:id])\n end", "title": "" }, { "docid": "e2e5592b299c21bf8e9988ac2a93c575", "score": "0.52402484", "text": "def set_tracking_time\n @tracking_time = TrackingTime.find(params[:id])\n end", "title": "" }, { "docid": "aeb9d138f3753922e9216580e248ff3a", "score": "0.5238897", "text": "def track_params\n params.require(:track).permit(:title, :number)\n end", "title": "" }, { "docid": "bf6583f5ab9862db854ce82ed75dad81", "score": "0.5219541", "text": "def track_params\n params.require(:track).permit(:timestamp, :username, :hostname, :location, :ssid, :rssi, :noise, :max_rate, :rate, :inet_speed, :inet_ping, :lan_speed, :lan_ping)\n end", "title": "" }, { "docid": "f7c979615670d4a786869349faeae7d8", "score": "0.5201625", "text": "def set_recording\n @recording = Recording.find_by(:id => params[:id])\n end", "title": "" }, { "docid": "b07b64740fa06e4022df85afae1f2c74", "score": "0.5187086", "text": "def search\n if store_id = params[:store_id] \n @stocks = Stock.where storeId: store_id\n else\n @stocks = Stock.all\n end\n\n oden_id = params[:oden_id]\n if oden_id \n oden_ids = oden_id.split \",\"\n @stocks = @stocks.where odenId: oden_ids if oden_ids\n end\n\n simi_type = params[:simi_type]\n start_time = @stocks.simi_start_time(simi_type)\n end_time = @stocks.simi_end_time(simi_type)\n\n if end_time\n @stocks = @stocks.where(entryTime: end_time.to_datetime..start_time.to_datetime)\n else\n @stocks = @stocks.where \"entryTime <= ?\", start_time.to_datetime\n end\n end", "title": "" }, { "docid": "c31f4fada64fb956824f24f9bfc10daf", "score": "0.5184085", "text": "def track_params\n params.require(:track).permit(:title, :length)\n end", "title": "" }, { "docid": "5205850f3daf0fe16b99d084c2623982", "score": "0.51751876", "text": "def record_params\n params.require(:record).permit(:tracked_value_id, :value, :date)\n end", "title": "" }, { "docid": "1a2e21c31ffb27d7108ca00e9e5e11ac", "score": "0.51726484", "text": "def searchdata\n @device = get_device_by_any_id(params[:id])\n @d = @device.data.order(params[:order]==\"ASC\"?'id ASC':'id DESC')\n .limit(params[:limit]||100)\n if params[:start]\n @d = @d.where(\"created_at > :stime\", \n :stime => Time.zone.at(params[:start].to_f))\n end\n if params[:end]\n @d = @d.where(\"created_at < :etime\", \n :etime => Time.zone.at(params[:end].to_f))\n end\n \n respond_to do |format|\n format.html {render \"data/index\"}\n format.json {render json: @d}\n end\n\n end", "title": "" }, { "docid": "6b5942971af652d9b520bd232ae1749e", "score": "0.5172566", "text": "def record_start_time\n param_args = params[:submission_viewing_event]\n # check if this link is already opened and timed\n submission_viewing_event_records = SubmissionViewingEvent.where(map_id: param_args[:map_id], round: param_args[:round], link: param_args[:link])\n # if opened, end these records with current time\n if submission_viewing_event_records\n submission_viewing_event_records.each do |time_record|\n if time_record.end_at.nil?\n # time_record.update_attribute('end_at', start_at)\n time_record.destroy\n end\n end\n end\n # create new response time record for current link\n submission_viewing_event = SubmissionViewingEvent.new(submission_viewing_event_params)\n submission_viewing_event.save\n \n #if creating start time for expertiza update end times for all other links.\n if param_args[:link]=='Expertiza Review' \n params[:submission_viewing_event][:link] = nil\n params[:submission_viewing_event][:end_at] = params[:submission_viewing_event][:start_at]\n record_end_time()\n end\n render nothing: true\n end", "title": "" }, { "docid": "7f8e98af615c69d0c54d4ed839ed69ca", "score": "0.516679", "text": "def create\n client = Soundcloud.new(:client_id => '44eb1fb2fd831aed03620d757489bdd6')\n params[:track][:user_id] = current_user.id\n track_url = params[:track][:url]\n track = client.get('/resolve', :url => track_url)\n params[:track][:duration] = track.duration\n # params[:track][:duration] = \n @track = Track.new(params[:track])\n # authorize! :create, @track\n\n respond_to do |format|\n if @track.save\n format.html { redirect_to @track, notice: 'Track was successfully created.' }\n format.json { render json: @track, status: :created, location: @track }\n else\n format.html { render action: \"new\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "49c649f80a80f36155bc866b9431814f", "score": "0.5165161", "text": "def timestamp_params\n params.require(:timestamp).permit(:start, :comment, :episode_id, :segment_id, :hours, :minutes, :seconds)\n end", "title": "" }, { "docid": "382a39db7fc78989b1dc3a4ee4712388", "score": "0.5162724", "text": "def mock_track_params\n params.require(:mock_track).permit(:name, :track_id)\n end", "title": "" }, { "docid": "e844ecfb5736c2c1311730df0e64b192", "score": "0.516145", "text": "def track(id, opts = {})\n res = api.get(\"/tracks/#{id}\")\n return process_track(res)\n end", "title": "" }, { "docid": "eebb00a09f7fe741427dbb432bafe955", "score": "0.5159835", "text": "def service_time_params\n params.require(:service_time).permit(:service_start_time, :duration_of_recording, :minutes_of_prelude, :go_live_date)\n end", "title": "" }, { "docid": "109142bc437a3af4ae34d35526788f3e", "score": "0.5157139", "text": "def occurrence_params\n params.require(:occurrence).permit(:started_at, :ended_at, :skipped_at)\n end", "title": "" }, { "docid": "57e77b628a2d9380a57ac8d369668b72", "score": "0.5156292", "text": "def track_params\n params.require(:track).permit(:name, :user_id, :description)\n end", "title": "" }, { "docid": "ab0101714f6ed162661b48f7c3889cac", "score": "0.5144022", "text": "def track_params\n params.require(:track).permit(:title, :status, :genre, :artist_id, :source_id,\n :source_link, :views, :library_id,\n playlist_ids: [])\n end", "title": "" }, { "docid": "808aa461a1b3a31b1a9f4d70cc77614b", "score": "0.5143671", "text": "def voice_keyword_params\n params.require(:voice_keyword).permit(:time, :keyword)\n end", "title": "" }, { "docid": "5f9a68d203aeb5745b65e714b098c336", "score": "0.5141614", "text": "def create\n print \"--------------------------------------------------------\\n\"\n print \"--------------------------------------------------------\\n\"\n print \"--------------------------------------------------------\\n\"\n print \"--------------------------------------------------------\\n\"\n print \"--------------------------------------------------------\\n\"\n puts params[\"initial_time\"]\n \n initial_time = params[:initial_time]\n m=initial_time.split(\":\")\n year = m[0].to_i\n month = m[1].to_i\n day = m[2].to_i\n hour = m[3].to_i\n minute = m[4].to_i\n second = m[5].to_i\n mil = m[6].to_i\n\n initial = Time.local(year,month,day,hour,minute,second,mil)\n\n\n final_time = params[:final_time]\n m1=final_time.split(\":\")\n year = m1[0].to_i\n month = m1[1].to_i\n day = m1[2].to_i\n hour = m1[3].to_i\n minute = m1[4].to_i\n second = m1[5].to_i\n mil = m1[6].to_i\n \n final = Time.local(year,month,day,hour,minute,second,mil)\n\n delta = final-initial\n\n c = Time.at(delta).gmtime.strftime('%R:%S:%L')\n\n @track = Track.new(name:params[\"name\"], city:params[\"city\"], \n country: params[\"country\"], user_id:params[\"user_id\"],\n private: params[\"private\"], approved: params[\"approved\"])\n @user = User.find(params[\"user_id\"])\n\n @track.points.build(params[\"points\"])\n @track.timings.build(initial_time:initial,final_time:final, global_time:\n c)\n\n respond_to do |format|\n if @track.save\n format.html { redirect_to @user, notice: 'Track was successfully created.' }\n format.json { render json: @track, status: :created, location: @track }\n else\n format.html { render action: \"new\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2fa5cb6ab4cbc3a457f21feb4fc127d6", "score": "0.51369107", "text": "def get_track\n max_delay_time = params[:max_track_delay_time].to_i\n max_delay_time = 300 if max_delay_time<=0\n\n lease_time = max_delay_time.minutes.ago\n\n position = current_user.positions.order(\"created_at desc\").first\n\n if !position or position.created_at < lease_time\n track= current_user.tracks.new\n vehicle_id = params[:vehicle_id].to_i\n track.vehicle = Vehicle.find_by_id vehicle_id if Vehicle.exists? vehicle_id\n track\n else\n position.track\n end\n end", "title": "" }, { "docid": "1f1221b045b8f67c668f8d4fbcc81007", "score": "0.5134048", "text": "def occurrence_params\n params.require(:occurrence).permit(:name, :start_time)\n end", "title": "" }, { "docid": "2673a0b451c4ddc4c18119a55903ed07", "score": "0.5130802", "text": "def set_time_record\n @time_record = TimeRecord.find(params[:id])\n end", "title": "" }, { "docid": "2673a0b451c4ddc4c18119a55903ed07", "score": "0.5130802", "text": "def set_time_record\n @time_record = TimeRecord.find(params[:id])\n end", "title": "" }, { "docid": "2673a0b451c4ddc4c18119a55903ed07", "score": "0.5130802", "text": "def set_time_record\n @time_record = TimeRecord.find(params[:id])\n end", "title": "" }, { "docid": "2673a0b451c4ddc4c18119a55903ed07", "score": "0.5130802", "text": "def set_time_record\n @time_record = TimeRecord.find(params[:id])\n end", "title": "" }, { "docid": "07f192554fabc9ed6c70176e7951e7e9", "score": "0.51294065", "text": "def track_params\n params.require(:track).permit(:name)\n end", "title": "" }, { "docid": "0925bc61133552b1411f12319a57e9c6", "score": "0.5125524", "text": "def keyword_params\n permited_params = params.require(:keyword).permit(:content, :s_content, :starttime, :endtime, :day_count)\n permited_params[\"starttime\"] = Time.parse(permited_params[\"starttime\"]).to_i\n permited_params[\"crdtime\"] = permited_params[\"starttime\"]\n permited_params[\"endtime\"] = Time.parse(permited_params[\"endtime\"]).to_i\n permited_params\n end", "title": "" }, { "docid": "394e135428a3d16a3c80fe5eb6c9f0c3", "score": "0.5121858", "text": "def index\n search_start_time = (DateTime.now - 1).utc\n @alrams = Alram.where(\"user_id = ? and created_at > ?\", params[:id], search_start_time).order(\"updated_at desc\")\n @time_word = Hash.new\n @alrams.each do |alram|\n @time_word[alram.id] = time_ago_in_words(alram.created_at)\n end\n \n# @alrams = Alram.where(\"user_id: params[:id] and \"user_id: params[:id], \"created_at > '#{search_start_time - 1}'\").order(\"updated_at desc\")\n end", "title": "" }, { "docid": "9219833caf446f3f5a9b303ea8428d02", "score": "0.5115886", "text": "def track_params\n params.require(:track).permit(:player_id, :x, :z, :xMax, :zMax, :xMin, :zMin, :xP, :zP, :xN, :zN, :zMaxN, :xMaxN, :xMinN, :zMinN,:xDistanceN, :xNarrowN, :xDirectionN, :zDistanceN, :zNarrowN, :zDirectionN, :xPN, :zPN, :raided, :notes)\n end", "title": "" }, { "docid": "49e3a63da6d37b6359f46b8f09e7c137", "score": "0.5103303", "text": "def time_record_params\n params.require(:time_record).permit(:user_id, :date, :entrance, :output)\n end", "title": "" }, { "docid": "a3fd41da8e0747e558fdb203a336b6ab", "score": "0.5099608", "text": "def track_params\n params.require(:track).permit(:title, :notes)\n end", "title": "" }, { "docid": "3ffc10bad4cfb34713798b4950a84f59", "score": "0.509914", "text": "def start_time=(time)\n self.starts_at = to_database_time time\n end", "title": "" }, { "docid": "666d9c041564703f016c9f0975ed5c6e", "score": "0.5090664", "text": "def track_params\n params.require(:track).permit(:title, :user_id, :track_file)\n end", "title": "" }, { "docid": "673579583c8b9ef738f9b4e36efc207f", "score": "0.5086554", "text": "def myth_delimited_recstart; MythTV::Utils.format_time(recstartts, :delimited); end", "title": "" }, { "docid": "a6ca4921c3a6dcea207d3ec02b6f5e72", "score": "0.50844765", "text": "def timestamp\n @timestamp ||= solr_record.timestamp\n end", "title": "" }, { "docid": "9a868c322def55de59662c537632fdae", "score": "0.50830036", "text": "def record_params\n params.require(:record).permit(:event, :event_type, :athlete, :time, :competition)\n end", "title": "" }, { "docid": "5b1b858a6e5821a5e8b45e948dc3901a", "score": "0.50818175", "text": "def set_track\n @track = Track.find(params[:id])\n end", "title": "" }, { "docid": "5b1b858a6e5821a5e8b45e948dc3901a", "score": "0.50818175", "text": "def set_track\n @track = Track.find(params[:id])\n end", "title": "" }, { "docid": "5b1b858a6e5821a5e8b45e948dc3901a", "score": "0.50818175", "text": "def set_track\n @track = Track.find(params[:id])\n end", "title": "" } ]
501cb026c691d0578d1c8576202e47eb
Returns Array of String (without evaluating dataset objects).
[ { "docid": "99bfa374ebf40aae3941587f3c9bc287", "score": "0.0", "text": "def dataset_names\n metadata[:datasets]\n end", "title": "" } ]
[ { "docid": "4147f1677b7db96152243e5f317dcff3", "score": "0.6397315", "text": "def dc_eval_to_array(expression)\n expression.split(/\\ |\\,|\\(|\\)/).delete_if {|e| e.blank? }.map {|e| e.gsub(/\\'|\\\"/,'').strip }\nend", "title": "" }, { "docid": "e29bc43814d7dbc715c97c571a850821", "score": "0.6276626", "text": "def to_array() \n viewable_array = Array.new\n @results.each do |tuple|\n results = tuple.join(\", \")\n viewable_array.push(results)\n end\n return viewable_array\n end", "title": "" }, { "docid": "754d61a5c9674954529fb853ebea4d84", "score": "0.6258709", "text": "def string_to_array\n\nend", "title": "" }, { "docid": "f66508a2f28837146000d6b904b8a4ab", "score": "0.6151984", "text": "def get_array\n get.split(@separator)\n end", "title": "" }, { "docid": "9f41bac0f681b8bf2756cd0c6a4221bb", "score": "0.6121445", "text": "def return_string_array array\n ret_arr=[]\n array.each {|i| ret_arr.push(i.to_s)}\n ret_arr\nend", "title": "" }, { "docid": "ee8c0df9561cad2a60e14095de16a62e", "score": "0.61127865", "text": "def sigles_array()\n return string_to_array(@sigles)\n end", "title": "" }, { "docid": "32459b29d682c4a02a0c5d166f830b93", "score": "0.6082825", "text": "def generate_array\n array = @string.scan(/.../) \n array.join.scan(/........./)\n end", "title": "" }, { "docid": "b58e52683ef393f12098eced8cadc0c7", "score": "0.6072929", "text": "def arrays; @arrays; end", "title": "" }, { "docid": "54d8b42b8d6ba8e5b0c267c27bdd7c1b", "score": "0.5992012", "text": "def set_dataset_array(labels)\n arr = []\n @dataset_array.each_with_index do |data_set, index|\n arr << prettify_data_set(data_set, index, labels)\n end\n arr\n end", "title": "" }, { "docid": "65905a6f2703806c92d27536bb4d0cc5", "score": "0.59742963", "text": "def expected_as_array; end", "title": "" }, { "docid": "c934d7b7722718e3daa2dc57172744d6", "score": "0.5972312", "text": "def to_sexp_array; end", "title": "" }, { "docid": "0d270d25651b7ead930f9988ddeba8f4", "score": "0.59585106", "text": "def to_a\n map(&:data)\n end", "title": "" }, { "docid": "56d30f4896a3d15dda5ecb8b4349e3c9", "score": "0.59235775", "text": "def populate_array(parsed_node_set)\n str_array = []\n\n parsed_node_set.each do |element|\n str_array << element.to_s\n end\n\n str_array\n end", "title": "" }, { "docid": "b7ed95520f85b2aec21651a16a2379e4", "score": "0.5896564", "text": "def convert_array_to_string_array to_convert \n return \"[\"+\"\\\"#{to_convert.join('\",\"')}\\\"\"+\"]\"\nend", "title": "" }, { "docid": "f88e28e44ec37f50c0528e374dd37da3", "score": "0.58768034", "text": "def to_a\n split // # comparison with `scan /./` shows that `split //` is faster over large datasets\n end", "title": "" }, { "docid": "0ae5dd0f934e285dea201a71493645c2", "score": "0.58767575", "text": "def to_a\n array = []\n (0..@dataset_size - 1).each do |i|\n row = []\n row << label_column(i)\n dataset_names.each do |dataset_name|\n row << @datasets[dataset_name][i]\n end\n array << row\n end\n array\n end", "title": "" }, { "docid": "9d0963223f1cf2f0de1ab4595db33194", "score": "0.5861129", "text": "def to_array\n chart.to_array\n end", "title": "" }, { "docid": "527e54a0da0d76379a5521176fac72d6", "score": "0.5859823", "text": "def list\n ret = []\n each_data{|data|\n ret << data.to_s\n }\n ret\n end", "title": "" }, { "docid": "4b88015b2698f09a8f98a4b76d620b34", "score": "0.58556604", "text": "def strip_string_array(arr); end", "title": "" }, { "docid": "662ce26319dafacd9088c7108606b2de", "score": "0.5843894", "text": "def array_elements_text\n function(:array_elements_text)\n end", "title": "" }, { "docid": "c875ac6509d4fc29340c115b53b33bb2", "score": "0.5828819", "text": "def array; end", "title": "" }, { "docid": "c875ac6509d4fc29340c115b53b33bb2", "score": "0.5828819", "text": "def array; end", "title": "" }, { "docid": "c875ac6509d4fc29340c115b53b33bb2", "score": "0.5828819", "text": "def array; end", "title": "" }, { "docid": "c875ac6509d4fc29340c115b53b33bb2", "score": "0.5828819", "text": "def array; end", "title": "" }, { "docid": "598cf5ee9d991c56e2bc98728820ea67", "score": "0.58067596", "text": "def coerce_to_array\n @data.coerce_to_array\n end", "title": "" }, { "docid": "c9c8fd5745dda48768e55f7e17ab8ce9", "score": "0.57917285", "text": "def awesome_sequel_dataset(dataset)\n [awesome_array(dataset.to_a), amazing_print(dataset.sql)].join(\"\\n\")\n end", "title": "" }, { "docid": "1cd9f90d78101d237601bc564e71a413", "score": "0.57857347", "text": "def data_set\n \t (1..cvs).to_a\n \tend", "title": "" }, { "docid": "7f16dbea8569f615c7ac5ad6b7a739b3", "score": "0.5757843", "text": "def prepare_dataset(ds)\n ds = [ds] unless ds.first.is_a?(Array)\n ds\n end", "title": "" }, { "docid": "be6b25ff3d1852646e4623b9053cc6a1", "score": "0.5755806", "text": "def array_data\r\n self\r\n end", "title": "" }, { "docid": "5a921b7bdd43c4707d68fc39b63b8ef1", "score": "0.574262", "text": "def converted_arrays; end", "title": "" }, { "docid": "ed59c1f1940c2323ae72ace0b5442f5e", "score": "0.572975", "text": "def string_to_array(names_to_string)\n \tnames_to_string.split(\"\")\nend", "title": "" }, { "docid": "ed59c1f1940c2323ae72ace0b5442f5e", "score": "0.572975", "text": "def string_to_array(names_to_string)\n \tnames_to_string.split(\"\")\nend", "title": "" }, { "docid": "7bc388dc6f9ab7049c3539433f3653dc", "score": "0.5721858", "text": "def process_array(value)\n value.split(\"\\n\").map { |s| s.to_s.strip }.compact.select { |s| !s.empty? }\n end", "title": "" }, { "docid": "a40a288a9269c9f1cd131eed0a101550", "score": "0.57045287", "text": "def string_only_array(arr)\n string_only_club = []\n arr.each { |i| string_only_club << i if i.class == String } \n string_only_club\nend", "title": "" }, { "docid": "54be35b4d55040e7842051b4f487e2d2", "score": "0.5697538", "text": "def getStringArray(message)\n @array = []\n splitArr = getString(message).strip.split(\",\")\n splitArr.each do |item|\n #puts \"Item: #{allCaps(item)}\"\n @array.push(allCaps(item))\n end\n \n return @array\n end", "title": "" }, { "docid": "0bacf29ee3fe27d58a1a9df083772f4f", "score": "0.56941074", "text": "def usageToArray()\n return Q::AdrType.getArray(@type.get());\n end", "title": "" }, { "docid": "d1e36fe1d1c328128e7f6ce117a36265", "score": "0.5691922", "text": "def to_array\n transform(name: 'to_array') do |x|\n result = x.to_a.take_while { |y| y != StopIteration }\n result.empty? ? StopIteration : result\n end\n end", "title": "" }, { "docid": "eae6977fbc8257e841b71a13e108ee20", "score": "0.5685007", "text": "def to_a\n values = []\n @variables.each_value { |value| values << value.data }\n values\n end", "title": "" }, { "docid": "2170e14166cac082dc0eb702669b23d2", "score": "0.568394", "text": "def values\n [[]]\n end", "title": "" }, { "docid": "c9c4b4d5964decd34fcfe6f5f0badfca", "score": "0.56618094", "text": "def strings\n wait_for_exists\n\n rows.inject [] do |res, row|\n res << row.cells.map(&:text)\n end\n end", "title": "" }, { "docid": "e12d18e3333019585dd16d8e585eb044", "score": "0.56507045", "text": "def inline\n @raw_data.split\n end", "title": "" }, { "docid": "0545f683216efb536cca6e7659869b0b", "score": "0.5642265", "text": "def json_string_array\n \"CREATE or REPLACE FUNCTION\n json_string_array(data json, key text) RETURNS TEXT[] AS $$\n\n var ret = data;\n var keys = key.split('.')\n var len = keys.length;\n\n for (var i=0; i<len; ++i) {\n if (ret != undefined) ret = ret[keys[i]];\n }\n\n if (! (ret instanceof Array)) {\n ret = [ret];\n }\n\n return ret;\n\n $$ LANGUAGE plv8 IMMUTABLE STRICT;\"\n end", "title": "" }, { "docid": "3ff8edeafaef98f2a0232996956cccf4", "score": "0.5641503", "text": "def strings\r\n assert_exists\r\n\r\n rows.inject [] do |res, row|\r\n res << row.cells.map { |cell| cell.text }\r\n end\r\n end", "title": "" }, { "docid": "05cee9fdc8ac683a91b5b5700d600a1d", "score": "0.5640417", "text": "def to_a\n map { |data| data }\n end", "title": "" }, { "docid": "948781d10041c278cb0ba4f49a87d843", "score": "0.564009", "text": "def to_array\n [id, name, illness, cured]\n end", "title": "" }, { "docid": "cba975b0ca6fbf3aca5608f6fc2245d4", "score": "0.5631654", "text": "def all_cells_array\n vals = []\n arrays = DataArray.where(study_id: self.id, linear_data_type: 'Study', linear_data_id: self.id, name: 'All Cells').order_by(&:array_index)\n if arrays.any?\n arrays.each do |array|\n vals += array.values\n end\n else\n vals = self.all_expression_matrix_cells\n end\n vals\n end", "title": "" }, { "docid": "2fa0ade3d5858abdd9dcfb7ab6df0920", "score": "0.5621679", "text": "def strings\n values = []\n if self.atype == Atype_String\n attribute_ranges.each do |v|\n values[v.priority - 1] = v.string_val\n end\n end\n values\n end", "title": "" }, { "docid": "03a1abbc3391c4fc9aa10eff57ecaa43", "score": "0.56162626", "text": "def to_a\n to_ds_a.collect do |train_test_for_run|\n train_test_for_run.collect &:to_a\n end\n end", "title": "" }, { "docid": "c4748a9dfa34bc587c3a2a315fd969f9", "score": "0.56100136", "text": "def string_elements(array)\n\tcounter = 0\n\tstrings = []\n\twhile counter < array.length\n\t\tif array[counter].class == String\n strings << array[counter]\n end\n counter = counter + 1\n end\n strings\nend", "title": "" }, { "docid": "e3fe999269938280584184c74dc37e09", "score": "0.5609835", "text": "def array\n @array\n end", "title": "" }, { "docid": "55469345b75131616669e25f128281ff", "score": "0.5608781", "text": "def to_ary\n [ to_s ]\n end", "title": "" }, { "docid": "2b33e44d7d464f7c0bec55f85eb83763", "score": "0.5608667", "text": "def data\n all.to_a\n end", "title": "" }, { "docid": "f29c4b82e1cf301b414d802e401663e2", "score": "0.56085646", "text": "def my_array_splitting_method(source)\n split_source = []\n split_source << source.select {|value| value.class == Fixnum }\n split_source << source.select {|value| value.class == String }\n return split_source\nend", "title": "" }, { "docid": "cf67e937cec4f7419764edda71c61c20", "score": "0.5605041", "text": "def get_string_array(readstring, header)\n if readstring =~ category_regexp(header)\n return string_array($1)\n end\n end", "title": "" }, { "docid": "5267fcbea0db8436e445097d5010bdac", "score": "0.56007785", "text": "def eval_array_literal(ss, context)\n x = peek(ss, 1) == ']' ? [] : eval_csv(ss, context)\n expect(ss, ']')\n x\n end", "title": "" }, { "docid": "51a1fefb77dba75e5d5ff14d9a3e1f12", "score": "0.5598627", "text": "def turn_into_array(value)\n value_arr = []\n if value.is_a?(Array)\n value_arr = value\n elsif value.is_a?(String)\n if value.length>0\n value_arr.push(value)\n end\n else\n value_arr.push value.to_s\n end\n return value_arr\n end", "title": "" }, { "docid": "fb5cfb3bf4251114d89c304d7ef82c21", "score": "0.5592482", "text": "def values\n index = 0\n result = []\n report.inputs.each {|input|\n result |= input.values_for_data(data_part[index, input.length])\n index = index + input.length\n }\n return result\n end", "title": "" }, { "docid": "0240eddffea2bf31b7f8ac8975273e1a", "score": "0.5586965", "text": "def to_array_from_story\n self.split(/,? and |, /).map do |value|\n ToFooFromStory::fix_value(value)\n end\n end", "title": "" }, { "docid": "9a31ee968472babd15c7ec3cb7cda524", "score": "0.5581402", "text": "def to_s\n read unless arrays\n arrays.map(&:join).join(\"\\n\")\n end", "title": "" }, { "docid": "37e7afb043c3944abb8863a7d2a5071c", "score": "0.55806845", "text": "def content_as_array\n [content].flatten\n end", "title": "" }, { "docid": "0bbb4494cd7228c3c2eec3974af1ebc6", "score": "0.5579476", "text": "def inspect # HACK finish\n return \"[]\" if self.length == 0\n str = \"[\" + self.join(\", \") + \"]\"\n return str\n end", "title": "" }, { "docid": "7306e5f936e9a04b251fe26957d75bae", "score": "0.5572738", "text": "def to_arr(value)\n if value.is_a?(Array)\n value\n else\n # Split by commas, but don't use commas inside double quotes\n # https://stackoverflow.com/questions/21105360/regex-find-comma-not-inside-quotes\n value.to_s.split(/(?!\\B\"[^\"]*),(?![^\"]*\"\\B)/)\n end\n end", "title": "" }, { "docid": "9d97d7df71b44b399effff4694313984", "score": "0.55697", "text": "def to_ary; []; end", "title": "" }, { "docid": "a189414a6f34cbf3ab467c49726aac09", "score": "0.55685735", "text": "def test_array\n\t\t%w(It works)\n\tend", "title": "" }, { "docid": "1031e514e4859a747604bcba798ed1e6", "score": "0.55641633", "text": "def to_array\n word.chars\n end", "title": "" }, { "docid": "b791882027483105fc151f8d610644ae", "score": "0.5562715", "text": "def return_string_array(array)\n j=0\n string_array = []\n while j<array.length do\n string_array.push(array[j].to_s)\n j+=1\n end\n string_array\nend", "title": "" }, { "docid": "3412553944aafb1322a5d715a3d92d93", "score": "0.5555703", "text": "def create_an_array\n [\"wow\", \"two\", \"am\", \"arrays!\"]\nend", "title": "" }, { "docid": "85dc8f5003757b6d05ec40fe54b5c80c", "score": "0.55552936", "text": "def return_string_array(array)\n counter = 0 \n new_array = []\n while counter < array.length do\n new_array.push(array[counter].to_s)\n \n counter += 1 \n end\n new_array\nend", "title": "" }, { "docid": "63e195aeadf0fa5b88c05e3ba4dcd1fe", "score": "0.55509764", "text": "def entry_to_array\n [q1, q2, q3, q4, q5]\n end", "title": "" }, { "docid": "3420a8a649359141742ae52b40b989c7", "score": "0.55492395", "text": "def to_array\n array = []\n node = @first\n until (node == nil)\n array << node.get_data\n node = node.get_next\n end\n array\n end", "title": "" }, { "docid": "e3bb9ce9d50a7daa513784f6ff5bd33a", "score": "0.5534613", "text": "def generate_arrays_str()\n return Array(10..20).map{|n| generate_letters(n)}\n end", "title": "" }, { "docid": "3e86cc730ff8965950a0123e9399ea21", "score": "0.553062", "text": "def get_array_from_text unparsed\n return unparsed.split(\"\\n\").map{|s| s.chomp}\nend", "title": "" }, { "docid": "d36a7a18d0054d04c2ac1a7843afc6a4", "score": "0.55232656", "text": "def __clean_array(*args)\n args.flatten.compact.map(&:to_s)\n end", "title": "" }, { "docid": "d103ad2d4c2079f782d299f3642ea4bb", "score": "0.5520873", "text": "def coverage_str_to_a\r\n\t\t\treturn coverage_str.nil? ? [] : [coverage_str]\r\n\t\tend", "title": "" }, { "docid": "2f7a37ac7bf17d30c8d56dcdf7683c5c", "score": "0.55204153", "text": "def get_array\r\n if (src = @options[:array_src]).is_a?(Proc)\r\n src.call\r\n else\r\n src || []\r\n end\r\n end", "title": "" }, { "docid": "d13c1bfd47db05e8cc79d55372da4128", "score": "0.551513", "text": "def return_string_array(array)\n index = 0 \n string_array = []\n while index < array.length do\n string_array.push(array[index].to_s)\n index +=1\n end\n string_array\nend", "title": "" }, { "docid": "b75ca6dc9a031a621340297e0bab3161", "score": "0.55087477", "text": "def to_array_of_arrays(dataset)\n cols = dataset.columns\n ret = []\n dataset.all do |row_hash|\n row_array = []\n cols.map { |col| row_array << row_hash[col] }\n ret << row_array\n end\n return ret\nend", "title": "" }, { "docid": "c5a67769665ffc79d448a0dbe9d20d46", "score": "0.55029786", "text": "def to_a\n data\n end", "title": "" }, { "docid": "5524b5a48a15719971e694bf3ce0dbef", "score": "0.5498167", "text": "def to_a\n return @data.flatten\n end", "title": "" }, { "docid": "6fa3f7e65772e7a2b13deb355d5b302e", "score": "0.54962087", "text": "def to_array\n temp = []\n ingredients.each do |ingredient|\n temp.push(ingredient.name)\n end\n temp.insert(0, 'r')\n temp.insert(0, name)\n temp\n end", "title": "" }, { "docid": "e39013dd1cacc5d949edf7f6ea32a74f", "score": "0.5486442", "text": "def create_an_array\n [\"apple\", \"blueberry\", \"potpie\", \"mango\"]\nend", "title": "" }, { "docid": "7b4262654fadc2c71ec8202d81f78044", "score": "0.5485557", "text": "def to_array( format_everything_to_string = false )\n [\n get_formatted_part_order(),\n get_training_step_type_short(),\n get_formatted_total_seconds(),\n get_formatted_distance(),\n get_row_description()\n ]\n end", "title": "" }, { "docid": "ccec12f9367ac98aa9d3e556e847ea07", "score": "0.54831314", "text": "def string_to_parragraph_arr\n str = self\n str = str.strip\n str = str.gsub(',', ' ')\n str = str.gsub('.', ' ')\n str = str.gsub(/ +/, ' ')\n str = str.strip\n str = str.gsub(\"\\r\", \"\\n\")\n arr = str.split(\"\\n\")\n \n arr.map do |part|\n part.strip if part.strip.present?\n end.compact\n end", "title": "" }, { "docid": "a284a5f5e43a51951d5f13db2523dcd4", "score": "0.5481183", "text": "def lint_to_a\n return if dataset.to_a == data\n\n complain \"#{dataset.class}#to_a must cast dataset to an array\"\n end", "title": "" }, { "docid": "1d7a29a81f8859527956167740911eb3", "score": "0.5478253", "text": "def temp_char_array_2d; end", "title": "" }, { "docid": "61035c5ef5a3222513d79f37c45d0c66", "score": "0.5475512", "text": "def to_arr_s(clans = false, sep = ';')\n ( self.domains.collect { |d|\n did = d.did\n did = d.cid if (clans && (not d.cid.nil?))\n did\n }\n ).join(sep)\n end", "title": "" }, { "docid": "bab42a4e547f69caa14997e1f2e6fb88", "score": "0.5472841", "text": "def as_array()\n return self.values()\n end", "title": "" }, { "docid": "fd59106077244d063d9ef2543744fcb8", "score": "0.5472623", "text": "def all_array\r\n all_results(true)\r\n end", "title": "" }, { "docid": "fb61aa93df55182a8a4fbc87ee6ae1f9", "score": "0.5472355", "text": "def to_a\n each.map(&:datum)\n end", "title": "" }, { "docid": "731cb01339a7443a05b7efcbb49883da", "score": "0.5467165", "text": "def to_searchable arr\n convert_value_to_text(arr).join\n end", "title": "" }, { "docid": "d33aed3aeb48ab1ad1d09f86e0d91a71", "score": "0.54649705", "text": "def to_a\n []\n end", "title": "" }, { "docid": "382ac5d21a1fc922370d452ea26eae3b", "score": "0.54597586", "text": "def to_a\n @lines.map(&:to_a)\n end", "title": "" }, { "docid": "04567eacd311bd6299e10ba9eb93d0b4", "score": "0.54594904", "text": "def to_s\n @array.join\n end", "title": "" }, { "docid": "18d138238724a14503cd4812642c30e8", "score": "0.545692", "text": "def _get_one_line_array(array)\n s = \"[\"\n array.each {|e| s += \"#{e}, \"}\n if s.length > 2 \n s[-2] = \"]\"\n s[-1] = \"\"\n else\n s += \"]\"\n end\n return s\nend", "title": "" }, { "docid": "5013c9dc028604d97e2d55b403ffc9cb", "score": "0.5456308", "text": "def clean_array(*args)\n args.flatten.compact.map(&:to_s)\n end", "title": "" }, { "docid": "67be0d2a4d5f553df6829e16298617f4", "score": "0.5452585", "text": "def __to_array\n [name.to_s, type.to_s, options[:default].to_s]\n end", "title": "" }, { "docid": "8ff677b3e91ef8d80b836793716ac166", "score": "0.54492384", "text": "def as_text exprs\n return exprs.map{|e| as_text(e)} if Array === exprs\n\n Expression.new(\"#{exprs}::text\", MM::DataType::TYPE_String, exprs.is_mandatory)\n end", "title": "" }, { "docid": "2bff0c4c653791baf3446bc02a5c6987", "score": "0.5448708", "text": "def _arrayify\n Array(self)\n end", "title": "" }, { "docid": "b1209a598890a2e9f4ab256760dc275a", "score": "0.5447849", "text": "def field_to_array(value)\n value_arr = []\n if value.is_a?(Array)\n value_arr = value\n elsif value.is_a?(String)\n if value.length>0\n value_arr.push(value)\n end\n else\n value_arr = value.to_a\n end\n return value_arr\n end", "title": "" }, { "docid": "bfd3f7573cbe52144d55839f8a6bcf91", "score": "0.54453295", "text": "def violation_data\n [ [ :set, set.to_a.join(', ') ] ]\n end", "title": "" }, { "docid": "dc71e63d4b0e31b36322e8f23e864678", "score": "0.54328907", "text": "def force_array(result)\n [result].flatten.compact\n end", "title": "" } ]
bfc265c354865f52a285020379f61a38
Create an instance variable that stores a single coupon object Use AR method find & params to find the specific object Render to show.html.erb in views/coupons
[ { "docid": "0dd8e30d5034ea88b16f759136c697fc", "score": "0.82615715", "text": "def show\n @coupon = Coupon.find(params[:id])\n end", "title": "" } ]
[ { "docid": "32a96354899f77e49ff21115ce1b2bfd", "score": "0.83485824", "text": "def show\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "66e216bdf48401cfe2e0a0f1c85667fb", "score": "0.8220395", "text": "def show\n @o_single = UserCoupon.find(params[:id])\n end", "title": "" }, { "docid": "3a36894e9cf716fef607ae3aa17e6dd7", "score": "0.8200623", "text": "def show\n @coupon=Coupon.find(params[:id])\nend", "title": "" }, { "docid": "60c0b44d0b36ca02d18d37888fe6a02b", "score": "0.8188679", "text": "def coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "b6d8e94d7a45bf87ea623e4146a3c9f5", "score": "0.78960913", "text": "def show\n #@coupon = Coupon.find(params[:id])\n @coupon = @user.coupons.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coupon }\n end\n end", "title": "" }, { "docid": "5a2ae67bb85ebb60e7cc6e07365b1025", "score": "0.77729434", "text": "def show\n render :partial => 'show', :object => @coupon\n end", "title": "" }, { "docid": "bea7f61821274e46c33a193c4c4b5a6e", "score": "0.7591184", "text": "def show\n @coupon = Coupon.find(params[:id]) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon }\n end\n end", "title": "" }, { "docid": "1e4a115ae74d610b68f1631e91cc3519", "score": "0.75833887", "text": "def show\n @coupon = Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @coupon }\n end\n end", "title": "" }, { "docid": "19722858736d58b0fd5c39cbe7e63193", "score": "0.7581053", "text": "def set_coupon_instance\n @coupon_instance = CouponInstance.find(params[:id])\n end", "title": "" }, { "docid": "19722858736d58b0fd5c39cbe7e63193", "score": "0.7581053", "text": "def set_coupon_instance\n @coupon_instance = CouponInstance.find(params[:id])\n end", "title": "" }, { "docid": "d17248159277c31446cc221e49e37df1", "score": "0.7576793", "text": "def show\n @coupon = Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon }\n end\n end", "title": "" }, { "docid": "d17248159277c31446cc221e49e37df1", "score": "0.7576793", "text": "def show\n @coupon = Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon }\n end\n end", "title": "" }, { "docid": "d17248159277c31446cc221e49e37df1", "score": "0.7576793", "text": "def show\n @coupon = Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon }\n end\n end", "title": "" }, { "docid": "923623f3b08d23ed97a172e2b249434e", "score": "0.7536462", "text": "def set_coupon\n @coupon = ProductCoupon.where({:product => @product, :id => params[:id]}).first\n end", "title": "" }, { "docid": "ca7aca154b2d54849fccfd510eeff4e2", "score": "0.74956733", "text": "def show\n @coupon_coupontypes = CouponCoupontype.find_by_sql [\"SELECT cct.id, cct.coupon_id, cct.coupon_type_id, cct.status, cct.created_at, cct.updated_at, cp.coupon_name, ct.coupon_type_name FROM coupon_coupontypes cct, coupons cp, coupon_types ct WHERE cct.coupon_id = cp.id AND cct.coupon_type_id = ct.id AND cct.id = ?\", params[:id]]\n end", "title": "" }, { "docid": "a11025118c0f24a374fca09687aa8919", "score": "0.7476881", "text": "def show\n @coupon = Coupon.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coupon }\n end\n end", "title": "" }, { "docid": "5d063b8bc007c7d8690784e4ba074e0a", "score": "0.74675727", "text": "def show\n @coupon = Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coupon }\n end\n end", "title": "" }, { "docid": "5d063b8bc007c7d8690784e4ba074e0a", "score": "0.74675727", "text": "def show\n @coupon = Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coupon }\n end\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "15e2f206d62bbf972c37be3326ad50dc", "score": "0.74633884", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "f0063821c55a4d838ea1ac21fce81b35", "score": "0.74268734", "text": "def set_coupon\n @coupon = Coupon.find_by(uid: params[:id])\n end", "title": "" }, { "docid": "91a3d5055d8630da91b1fa2e94fb3e8e", "score": "0.73899984", "text": "def show\n\tbegin\n\t\t@coupon = Coupon.find(params[:id])\n\n\trescue Mongoid::Errors::DocumentNotFound\n\t\treturn\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\t#format.xml { render :xml => @coupon }\n\t\t\tformat.json { render :json => @coupon.to_a.to_json }\n\t\tend\n\tend\n end", "title": "" }, { "docid": "285ec7ea89c522e32a9450eaa09cd525", "score": "0.73807216", "text": "def show\n @admin_coupon = Admin::Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @admin_coupon }\n end\n end", "title": "" }, { "docid": "913848049ff9045ffb30056f081bc000", "score": "0.7356949", "text": "def set_coupon\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "1e8e02fa61a500bbc581cbec4776c55c", "score": "0.7333174", "text": "def set_coupons\n @coupon = Coupon.find(params[:id])\n end", "title": "" }, { "docid": "17016ab9bb185de1ac8473195c1b4a97", "score": "0.733125", "text": "def show\n @coupon_category = CouponCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon_category }\n end\n end", "title": "" }, { "docid": "a81577494562d3acd257f6fdcedc3f7c", "score": "0.7314817", "text": "def show\n @coupon_product = CouponProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon_product }\n end\n end", "title": "" }, { "docid": "8e308980ac4f5d54a941a0956e4d1b38", "score": "0.72325796", "text": "def show\n @coupons = Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coupons }\n end\n end", "title": "" }, { "docid": "36b1ac12a5eb1ab266206aa13d565ed2", "score": "0.7228289", "text": "def show\n @clipped_coupon = current_user.clipped_coupons.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clipped_coupon }\n end\n end", "title": "" }, { "docid": "3ab2179751eeca076f8a0f2a5e9fd816", "score": "0.7184425", "text": "def show\n @cupon = Cupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cupon }\n end\n end", "title": "" }, { "docid": "1edcec9444be422c6738d8ea70545083", "score": "0.7180268", "text": "def show\n @coupon_usage = CouponUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon_usage }\n end\n end", "title": "" }, { "docid": "1a1b65d4ca6fb126f44c2e79efc3c8f8", "score": "0.7160587", "text": "def find(coupon_id, options = nil)\n request = Request.new(@client)\n path = \"/coupons/\" + CGI.escape(coupon_id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"coupon\"]\n \n \n obj = Coupon.new(@client)\n return_values.push(obj.fill_with_data(body))\n \n\n \n return_values[0]\n end", "title": "" }, { "docid": "1a805fd7c38e35f4dfdcd4879b1f99bc", "score": "0.7127906", "text": "def show\n @complaint = Complaint.find(params[:id], :include => :coupon)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @complaint.to_json }\n end\n end", "title": "" }, { "docid": "c8bf094a9543864f9e2573f80ddad070", "score": "0.7089364", "text": "def show_by_code\r\n obj = Coupon.find_by_coupon_code(params[:code])\r\n \r\n if obj.nil?\r\n render :json => { result: \"fail\", reason: \"no match coupon object\" }, :status => 400 \r\n else\r\n render :json => { result: \"success\", coupon: obj }, :status => 200\r\n end \r\n end", "title": "" }, { "docid": "48a734f7b61dac845446c362623147be", "score": "0.70764136", "text": "def show\n @coupon_design = CouponDesign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon_design }\n end\n end", "title": "" }, { "docid": "141d14666c08cd6f80198420d252c547", "score": "0.7076348", "text": "def find(coupon_id)\n response = client.get_with_retry(\"sites/#{client.site_id}/store/coupons/#{coupon_id}\", 3)\n if response.success?\n Coupon.new(response.body, client: client)\n end\n end", "title": "" }, { "docid": "cf497d1856ba98615cfcadcf2f86057d", "score": "0.70551825", "text": "def show\n @coupon_template = CouponTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coupon_template }\n end\n end", "title": "" }, { "docid": "adf6918b3bf8ead80b0e04c8963fcdb2", "score": "0.7035614", "text": "def show\n @mcoupon = Mcoupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mcoupon }\n end\n end", "title": "" }, { "docid": "7388980b2a3ff5ad809b3ea3dd83ff97", "score": "0.7029373", "text": "def new\n @coupon = Coupon.new\n\n render :partial => 'new', :object => @coupon\n end", "title": "" }, { "docid": "767845fc2efe3c3f35a55a8e25013d51", "score": "0.7015211", "text": "def set_coupon\n @restaurant = Restaurant.friendly.find(params[:restaurant_id])\n @coupon = @restaurant.coupons.find(params[:id])\n end", "title": "" }, { "docid": "aa77ad94021a675032605c62e62bc854", "score": "0.7010542", "text": "def coupons\n company_id = params[:company_id]\n @coupons = Coupon.where(:company_id => company_id)\n end", "title": "" }, { "docid": "84cd8a91d69c8917d236f04ca7725474", "score": "0.69999963", "text": "def show\n @on_my_account = true\n session[:force_full_site] = false\n \n @coupon = Coupon.find(params[:id])\n \n if @coupon.shippable?\n flash.now[:error] = \"Sorry, but this is a physical coupon that we have mailed to you, So you can't view or print it.\"\n redirect_to my_deals_path\n elsif [email protected]?(current_user)\n flash.now[:notice] = \"Remember, You can only use each coupon one time.\" if @coupon.printed?\n @coupon.printed! unless @coupon.printed?\n render :action => 'show'\n else\n redirect_to my_deals_path\n end\n end", "title": "" }, { "docid": "75666b812b6ff49d68b0bc5a742bf30a", "score": "0.6998344", "text": "def show\n @deal = Deal.find(params[:id], include: [:advertiser, :coupons, :users, :image])\n session[:referred] = true if params[:referred]\n session[:deal_id] = @deal.id unless current_authorized_user\n @coupon = @deal.coupons.for_user(current_authorized_user).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deal }\n end\n end", "title": "" }, { "docid": "badf142ff1ca8b2b766b700d375d6ae9", "score": "0.69917345", "text": "def set_auction_coupon\n @auction_coupon = Auction::Coupon.find(params[:id])\n end", "title": "" }, { "docid": "e92b18037616092a5264682a4b802ce7", "score": "0.698674", "text": "def edit\n @title = \"Edit coupon\"\n @coupon = Coupon.find_by_id(params[:id])\n end", "title": "" }, { "docid": "5feea36fe412fe126cc2b39df5b65d28", "score": "0.6971212", "text": "def show\n @coupon_cities = CouponCity.find_by_sql [\"SELECT cc.id, cc.coupon_id, cc.city_id, cc.status, cc.created_at, cc.updated_at, ct.city_name, cp.coupon_name FROM coupon_cities cc, cities ct, coupons cp WHERE cc.coupon_id = cp.id AND cc.city_id = ct.id AND cc.id = ?\", params[:id]]\n end", "title": "" }, { "docid": "bee076261ab17142d42b6a6a8edbae9e", "score": "0.6968184", "text": "def show\n @coupon = params[:sample_for_deal].to_i > 0 ? Coupon.sample(params[:sample_for_deal].to_i, params[:redeemed], params[:gift]) : Coupon.find(params[:id])\n \n respond_to do |format|\n format.html { }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "77f2342553970f46c123dcfbe4101fb4", "score": "0.6958343", "text": "def set_payment_coupon\n @payment_coupon = PaymentCoupon.find(params[:id])\n end", "title": "" }, { "docid": "3416a860926f674b3e34e4eb7f650e32", "score": "0.6906685", "text": "def show\n if @coupon_instance.user_id != current_user.id\n redirect_to phone_homepages_path\n end\n end", "title": "" }, { "docid": "9d36bf6e993b6bfd4c47714d09434d69", "score": "0.68983465", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon }\n end\n end", "title": "" }, { "docid": "432bf670d3b61b574d7b1dc3555bfb81", "score": "0.683423", "text": "def index\n @coupons = Coupon.all\n \n\n end", "title": "" }, { "docid": "44a7419fc0c91020d8db50389fac4516", "score": "0.6828832", "text": "def set_cupon\n @cupon = Cupon.find(params[:id])\n end", "title": "" }, { "docid": "44a7419fc0c91020d8db50389fac4516", "score": "0.6828832", "text": "def set_cupon\n @cupon = Cupon.find(params[:id])\n end", "title": "" }, { "docid": "4c56c3bc301c21d68b9dd9eba8d33355", "score": "0.6827465", "text": "def show\n @coupon = Coupon.find_by_id(params[:id])\n if current_user.days_until_available(@coupon) > 0\n @coupon = nil\n else\n current_user.use_coupon!(@coupon)\n end\n end", "title": "" }, { "docid": "cfd5caca4ed08eb43ac5d279db90ab34", "score": "0.6812349", "text": "def with_coupon(coupon)\n @coupon = coupon\n\n self\n end", "title": "" }, { "docid": "3463122c4d14e66d9bc30d768cb799c1", "score": "0.67942876", "text": "def set_coupon\n @coupon = Coupon.find_by_id(params[:id])\n redirect_to admin_coupons_path if @coupon.blank?\n end", "title": "" }, { "docid": "797cacd02709262ebc19b83dd8350487", "score": "0.6788664", "text": "def show\n @coupon = Coupon.find(params[:id])\n if(params[:grab].present?)\n @coupon.status = Coupon::COUPON_INACTIVE\n @coupon.save\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon }\n end\n end", "title": "" }, { "docid": "290f941e32c229f55601ef4694d3f401", "score": "0.6785212", "text": "def set_coupon_list\n @coupon_list = CouponList.find(params[:id])\n end", "title": "" }, { "docid": "d058bd6c8bc60510c826c6672ebd631c", "score": "0.6761873", "text": "def new\n # @coupon=Coupon.new\nend", "title": "" }, { "docid": "0016a860686dbea3138a184814393070", "score": "0.673177", "text": "def show\n return if handle_coupon!\n return if valid_for_checkout?\n end", "title": "" }, { "docid": "e02e2287ab08bb80fdddd061e89d0bfa", "score": "0.67235875", "text": "def set_user_coupon\n @user_coupon = UserCoupon.find(params[:id])\n end", "title": "" }, { "docid": "e02e2287ab08bb80fdddd061e89d0bfa", "score": "0.67235875", "text": "def set_user_coupon\n @user_coupon = UserCoupon.find(params[:id])\n end", "title": "" }, { "docid": "e3651d0606fe283bd0db0d6f8d450a34", "score": "0.6720507", "text": "def set_claimcoupon\n @claimcoupon = Claimcoupon.find(params[:id])\n end", "title": "" }, { "docid": "55099125fcf00a8949de66ac4217733f", "score": "0.66934973", "text": "def index\n @coupons = Coupon.all\n end", "title": "" }, { "docid": "8d1bb238da9bb03f0a9fde2a467ba71d", "score": "0.6682851", "text": "def new \n \n @coupon = Coupon.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupon }\n end\n\t\t\n end", "title": "" }, { "docid": "418b66fd757a1da80a6d56ae70433778", "score": "0.6677611", "text": "def set_coupon_code\n @coupon_code = CouponCode.find(params[:id])\n end", "title": "" }, { "docid": "cdd4d8109892925e690aa57736209534", "score": "0.66492915", "text": "def set_claim_coupon\n @claim_coupon = ClaimCoupon.find(params[:id])\n end", "title": "" }, { "docid": "460f1cff0944606ece2b133e7365e0f5", "score": "0.6632855", "text": "def show\n @customer = Customer.find(params[:id])\n @user = @customer.user\n @active_coupons = @customer.user.coupons.active\n @inactive_coupons = @customer.user.coupons.inactive\n @printed_coupons = @customer.user.coupons.printed\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer }\n end\n end", "title": "" }, { "docid": "4656241b13da990ba09414fca0ff0d67", "score": "0.6631393", "text": "def new\n @complaint = Complaint.new\n coupon = Coupon.find(params[:coupon_id]) if params[:coupon_id]\n if coupon\n @complaint.coupon_id = coupon.id\n @complaint.coupon_code = coupon.code\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @complaint }\n end\n end", "title": "" }, { "docid": "b93545496ace7c5c2c9a11d36e0baa97", "score": "0.6601961", "text": "def show\n if [email protected]?\n @coupon.enabled = true\n @coupon.save!\n notice = \"Congratulations, you've got new coupon\"\n else\n notice = nil\n end\n end", "title": "" }, { "docid": "c904ddc80a70f65a314c2057f2df184d", "score": "0.65984774", "text": "def show\n render json: @user_coupon\n end", "title": "" }, { "docid": "5286abc07111a33402b829c636c3c19b", "score": "0.65892625", "text": "def index\n @page_title = \"View Cart\"\n find_cart\n \n #hack to auto-apply a coupon\n # if Time.now >= Time.parse(\"06/30/2010 9:00 AM\")\n # @coupon = Coupon.find_by_coupon_number \"ship4free\"\n # if @cart.coupon.blank?\n # @cart.coupon = @coupon \n # @cart.save\n # end\n # end\n \n end", "title": "" }, { "docid": "5db59bbc9b42781926cb403df43154b1", "score": "0.6588841", "text": "def edit\n @coupon = Coupon.find(params[:id])\n \n respond_to do |format|\n format.html { }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "17e00a8fe57ed9666882e7e335a0098f", "score": "0.65682954", "text": "def new\n @title = \"Create a new coupon\"\n @coupon = Coupon.new\n end", "title": "" }, { "docid": "e77dd6b88996d977ad53878a6b34186a", "score": "0.6537584", "text": "def set_coupon_coupontype\n @coupon_coupontype = CouponCoupontype.find(params[:id])\n end", "title": "" }, { "docid": "a965479f525f0e31fbec13b934fa9acc", "score": "0.6531802", "text": "def index\n @user_coupons = UserCoupon.all\n end", "title": "" }, { "docid": "71cc5ca658b1fbe76ee10bf94577e2f9", "score": "0.6489714", "text": "def show\n @coupon = Coupon.find(params[:id])\n @time = params[:time].blank? ? Time.zone.now : Time.zone.parse(params[:time])\n @products = Product.where(:item_num.in => @coupon.products) if @coupon.product?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coupon }\n end\n end", "title": "" }, { "docid": "a8e839e6b63bade3fe4a7c6f8c23c101", "score": "0.64868146", "text": "def new\n @coupon = Coupon.new(:company_id => @company.id)\n @companies = Company.order('name ASC')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @coupon }\n end\n end", "title": "" }, { "docid": "6e4ade5ca2b3b17b1c22cfcf960a6d28", "score": "0.6479375", "text": "def create\n @coupon = Coupon.new(@editable_params)\n\n if @coupon.save\n flash[:notice] = 'Coupon was successfully created.'\n render :partial => 'element_container', :object => @coupon\n else\n render :partial => 'new', :object => @coupon, :status => 409\n end\n end", "title": "" }, { "docid": "80c0dc822caa616977867403b5c5e326", "score": "0.6476952", "text": "def get_user_coupon\n render json: UserCoupon.find_by_userid_couponid(params[:user_id], params[:coupon_id])\n end", "title": "" }, { "docid": "e1a0af6f7d688a8ec1d19a3f8f3ca5f8", "score": "0.6469143", "text": "def show\n\t respond_to do |format|\n\t\tformat.any(:json, :xml) {\n\t\t begin\n\t\t # something which might raise an exception\n\t\t\tcoupon = Coupon.find(params[:id])\n\t\t rescue ActiveRecord::RecordNotFound\n\t\t head :not_found\n\t\t\treturn\n\t\t\t#puts \"Prosao sam dalje\"\n\t\t end\n\n\n\t\t respond_with coupon, status: :ok\n\t\t}\n\t end\n\tend", "title": "" }, { "docid": "f1804d61659ce5cdf1d134ac4db38ffd", "score": "0.64500254", "text": "def index\n @claim_coupons = ClaimCoupon.all\n end", "title": "" }, { "docid": "fcc594aab9c6ed105d270be5cd927b3b", "score": "0.64497167", "text": "def set_coupen\n @coupen = Coupen.find(params[:id])\n end", "title": "" }, { "docid": "fcc594aab9c6ed105d270be5cd927b3b", "score": "0.64497167", "text": "def set_coupen\n @coupen = Coupen.find(params[:id])\n end", "title": "" }, { "docid": "254cd7c86900099c5b74d7796ee09f1e", "score": "0.644402", "text": "def add_coupon\n @page_title = \"Add Coupon\"\n find_cart\n @coupon = Coupon.find_by_coupon_number(params[:coupon_number])\n \n unless @coupon\n @coupon_error = \"Not found\"\n render :action => 'index' and return\n end\n \n if @coupon.used == true && @coupon.reusable == false\n @coupon_error = \"Already used\"\n render :action => 'index' and return\n end\n \n if @cart.subtotal < @coupon.min_purchase\n @coupon_error = \"#{@coupon.min_purchase} minimum required\"\n render :action => 'index' and return\n end\n \n if @coupon.is_expired?\n @coupon_error = \"Coupon is expired\"\n render :action => 'index' and return\n end\n \n if @cart.coupon\n flash[:notice] = \"Only 1 coupon per order. Coupon: #{@coupon.coupon_number} added, Coupon: #{@cart.coupon.coupon_number} removed\"\n @cart.coupon = @coupon\n else\n @cart.coupon = @coupon\n end\n \n \n @cart.save\n redirect_to cart_path\n \n end", "title": "" }, { "docid": "55e64d9cead1bf1af4234688058cf04f", "score": "0.64436096", "text": "def index\n @payment_coupons = PaymentCoupon.all\n end", "title": "" }, { "docid": "ecc0a40d178a5950206692ae32c3e1ec", "score": "0.6443466", "text": "def create\n @coupon = Coupon.new(params[:coupon])\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to :controller => 'coupons', :action => 'show', :id => @coupon.id, :company_id => @coupon.company_id, :notice => 'Coupon was successfully created.' }\n format.json { render :json => @coupon, :status => :created, :location => @coupon }\n else\n format.html { \n @companies = Company.order('name ASC')\n render :action => \"new\"\n }\n format.json { render :json => @coupon.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76b13e54e9ff3782bc86721bf52f16a2", "score": "0.64375615", "text": "def new\n @coupon = current_user.coupons.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end", "title": "" }, { "docid": "e9e9562247b9f8f03091d69eef039d5a", "score": "0.64322656", "text": "def new_coupon()\n Coupon.new(self)\n end", "title": "" }, { "docid": "443b12a267ac7605e047ae8e6ddc5e27", "score": "0.6431076", "text": "def set_coupon\n @coupon = @current_site.coupons.find(params[:id])\n @program = @coupon.program\n end", "title": "" }, { "docid": "c270cba908c9c42ce23f58171ffccc9f", "score": "0.6395173", "text": "def create\n\t@coupon = Coupon.new(params[:coupon])\n\tif @coupon.save\n\t flash[:success] = \"Coupon saved to database\"\n redirect_to coupons_path\n\telse\n\t\t@title = \"Create a new coupon\"\n\t\trender 'new'\n\tend\n end", "title": "" } ]
99bb296ca41dd8606b4a69d2096e861c
Saving customer info and displaying tour info entry page.
[ { "docid": "518981c0dde18ced3a1e0bdd276b32bc", "score": "0.78106207", "text": "def tour_info\n @page_title = 'Tour Info'\n\n @customer = retrieve_customer\n if @customer != nil\n @customer.ip_address = request.remote_ip\n if [email protected]_attributes(params[:customer])\n flash.now[:errors] = @customer.errors\n render :action => 'start_tour_request'\n end\n\n @tour_request = TourRequest.new\n @amenities = Amenity.all\n end\n end", "title": "" } ]
[ { "docid": "4ae5130c13262cca9a86e5217eb4ec25", "score": "0.62919295", "text": "def customer\n @phys = Physician.find(:all) #gets all physicians\n if request.post?\n \n if params[:commit] == \"save\" #save from physician modal page\n @phys = Physician.new(:address => params[:address], :pname => params[:pname1], :degree => params[:pdegree], :pgroup => params[:pgroup1], :plicnum => params[:plicnum1], :licexpdate => params[:licexpdate1])\n @phys.save\n @physid = @phys.id\n session[:physid] = @physid\n \t flash[:customerpage] = \"Added Physician\" \n \t @phys = Physician.find(:all) \n end\n \n if params[:commit] == \"Add Member Information\" #Add member information\n@cust = Customer.new(:firstname => params[:firstname], :lastname => params[:lastname], :dob => params[:dob], :dln => params[:dln], :sex => params[:sex], :referral => params[:referral], :reffredby => params[:reffredby], :notes => params[:notes], :statemmp => params[:statemmp], :recom => params[:recom], :countyid => params[:countyid], :suffix => params[:suffix], :dlnstate => params[:dlnstate], :dlnexpiry => params[:dlnexp])\[email protected]\t\t \n\n \n\n \t\t @addy = @cust.create_address(:line1 => params[:line1], :line2 => params[:line2], :city => params[:city], :state => params[:state], :zip => params[:zip], :county => params[:county])\n @addy.save\n puts @addy.id.to_s + \"THIS IS ADDRESS IDDDDDDDDDDD\"\n\t\t @@sides = params[:firstName]\n\t\t @id1 = @cust.id\n\t\t session[:customer_id] = @id1\n\t\t @id2 = @addy.id\n\n \tif (params[:sms].nil? or params[:sms] == 0)\n \t @varsms = \"no\"\n \telse\n \t@varsms = \"yes\"\n \tend\n if (params[:mail].nil? or params[:mail] == 0)\n \t @varmail = \"no\"\n \telse\n \t@varmail = \"yes\"\n \tend\n if (params[:email].nil? or params[:email] == 0)\n \t @varemail = \"no\"\n \telse\n \t@varemail = \"yes\"\n \tend\n if (params[:phone].nil? or params[:phone] == 0)\n \t @varphone = \"no\"\n \telse\n \t@varphone = \"yes\"\n \tend\t\n\n @cont = Contact.new(:id => @id1, :cid => @id1, :hphone => params[:hphone], :mphone => params[:mphone], :provider => params[:provider], :cemail => params[:cemail], :email => @varemail, :sms => @varsms, :mail => @varmail, :phone => @varphone)\n @cont.save\n\n @contlink = Contactlink.new(:contactid => @id1, :addressid => @id2)\n @contlink.save\n\n \t\t@id3 = @cont.id\n \t\t@id3 = @contlink.id\n @pres = Prescription.new(:physver => params[:physver], :recver => params[:recver], :recexp => params[:recexp])\n @pres.save\t \n \t\t@id4 = @pres.id\n\n @custphylink = Custphyslink.new(:customid => session[:customer_id], :physid => params[:pname], :prescid => @id4) \t\n @custphylink.save\n\n\t\t@id6 = @custphylink.id\n\n# Make Session to Nil after transactions\n\t\tsession[:customer_id] = nil\n\t\tsession[:physid] = nil\n\t\tflash[:edit_customer] = \"Member has been successfully added.\"\n\t\tredirect_to :controller => 'pages', :action => 'search'\n\tend # end Add member information\n end\nend", "title": "" }, { "docid": "1a7b76460f704fe681295596b71aecf6", "score": "0.61208254", "text": "def createWO\n $page = \"create\"\n @customers = Customer.find(:all,:select => [\"C_Name\"]) #Retrieve the Customer Name from Customer Local DB.\n render :action => :createWO #Navigating to create workorder page.\n end", "title": "" }, { "docid": "5f7784f43eef150ba47d1506ec73886a", "score": "0.6110264", "text": "def start_tour_request\n @page_title = 'Personal Info'\n\n @customer = retrieve_customer\n if @customer != nil && @customer.tour_requests.count > 0\n redirect_to :controller => 'tour_rating', :action => 'tour_rating'\n end\n end", "title": "" }, { "docid": "aaa1beaab261664a095dd4f7f73d245d", "score": "0.61100805", "text": "def display_details()\n puts \"Customer id #@cust_id\"\n puts \"Customer name #@cust_name\"\n puts \"Customer address #@cust_addr\"\n end", "title": "" }, { "docid": "9f5f6fca6254aff4d8853ebf34f22a32", "score": "0.60274047", "text": "def create\n @info_customer = Info::Customer.new(info_customer_params)\n\n respond_to do |format|\n if @info_customer.save\n format.html { redirect_to @info_customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @info_customer }\n else\n format.html { render :new }\n format.json { render json: @info_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f8e2f7d5c1c61dfb98372b9c92dc534", "score": "0.60268396", "text": "def create_new_customer(firstname, lastname, country, email, loginname)\n customer_nav_lnk.click\n wait_for_ajax\n cus_create_form.firstname_input.set firstname\n cus_create_form.lastname_input.set lastname\n cus_create_form.country_opt.select(country)\n cus_create_form.email_input.set email\n cus_create_form.login_input.set loginname\n cus_create_form.create_account_chk.set true\n cus_create_form.save_btn.click\n wait_for_ajax\n end", "title": "" }, { "docid": "7ae3fdc640a09f382274899250de634d", "score": "0.59966815", "text": "def display_details()\n puts \"Customer id #@cust_id\"\n puts \"Customer name #@cust_name\"\n end", "title": "" }, { "docid": "bd7ee4ae3a3d23b76de5c9c0ea7885a1", "score": "0.5989064", "text": "def display_details()\n\t\tputs \"Customer id #@cust_id\"\n\t\tputs \"Customer name #@cust_name\"\n\t\tputs \"Customer address #@cust_address\"\n\tend", "title": "" }, { "docid": "0529e9fd882e8eb2b26d858b1b848a7c", "score": "0.5950879", "text": "def add\n customer_name = @view.ask_name\n customer_address = @view.ask_address\n new_customer = Customer.new({name: customer_name, address: customer_address})\n @customers_repository.add(new_customer)\n end", "title": "" }, { "docid": "c761d3c3b307cba1a9f3052d58421c0c", "score": "0.59478873", "text": "def create\r\n\r\n redirect_to(:action => :index) and return unless request.post?\r\n redirect_to(:action => :index) and return if params[:customer].blank? || !params[:customer].is_a?(Hash)\r\n @customer_attributes = params[:customer] ? params[:customer]['0'].clone : {}\r\n\r\n @customer = Customer.load_from_params(@customer_attributes)\r\n if @customer.errors.empty? && @customer.save\r\n flash[:notice] = _(\"%{page} was successfully created.\") % {:page => _(\"Customer\")}\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => {:id => @customer.id}.merge(@customer.attributes).to_json)\r\n return\r\n end\r\n else\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => ({:errors => @customer.errors.full_messages}.merge(@customer.attributes)).to_json)\r\n else\r\n render(:action => :new)\r\n end\r\n return\r\n end\r\n if params[:go_to].blank?\r\n redirect_to :action => (params[:commit_and_new] ? :new : :index)\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end", "title": "" }, { "docid": "c4b84ef9dda65a23cecc45aab078810a", "score": "0.5934411", "text": "def set_customer_info\n @customer_info = CustomerInfo.find(params[:id])\n end", "title": "" }, { "docid": "9294a7b1279eb83a410f88031c47b660", "score": "0.5932984", "text": "def create\n @customer = Customer.new(customer_params)\n @customer.deleted = false # nieuwe klanten expliciet op niet-verwijderd zetten\n\n if @customer.save\n # aanmaken gelukt, schrijft logentry en toon overzicht\n log self.class.name, LogEntry::INFORMATIONAL, \"Klant #{@customer.name}, id #{@customer.id}, is aangemaakt door #{current_admin_user.username}\"\n redirect_to admin_customers_path\n else\n # aanmaken niet gelukt, toon formulier opniew (met foutmelding)\n render :new\n end\n end", "title": "" }, { "docid": "421bef6cf8a5261005c59e1bc19a9e13", "score": "0.5897379", "text": "def show\n disable_editing!\n track @customer\n end", "title": "" }, { "docid": "0003ddf882ad9372f941ccd1a183f96f", "score": "0.5879345", "text": "def create\n @customer = Customer.new(customer_params)\n\n # write customer to database\n if @customer.save\n redirect_to customers_path, :notice => 'Kunde erfolgreich erstellt.'\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "cdcc06a4d352aba354715ea9d66686eb", "score": "0.5864579", "text": "def display_details()\n puts \"Customer id #@cust_id\" # puts \"Customer id #cust_id\"\n puts \"Customer name #@cust_name\" # puts \"Customer name #cust_name\"\n puts \"Customer address #@cust_addr\" # puts \"Customer address @cust_addr\"\n end", "title": "" }, { "docid": "92169e7c85f9b7dd972ef933c925231c", "score": "0.5844197", "text": "def run\n SoopaStore.customers.add(@customer)\n SoopaStore.checkout.serve_customer(@customer)\n puts \"Time #{SoopaStore.current_time} : Customer #{@customer.customer_id} \"\\\n \"arrives (#{@customer.num_groceries} items)\"\n end", "title": "" }, { "docid": "5de121e9221c7b7996417f9f317388db", "score": "0.5832232", "text": "def create\n @customer = current_user.customers.build(params[:customer])\n location = set_location\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to location, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07ab8ce4eb2408fb700f7268c0856e75", "score": "0.5815601", "text": "def set_customer_information\n @customer_information = CustomerInformation.find(params[:id])\n end", "title": "" }, { "docid": "805094b9b5c6ee8253e88d2db8c3aa4e", "score": "0.5809724", "text": "def show\n @info_customer = @info_customer_fin_dtl.finance.customer\n end", "title": "" }, { "docid": "b74548c59c893165a9fc763962021588", "score": "0.5794196", "text": "def personal_details\n @page_title = _('Personal_details')\n @page_icon = \"edit.png\"\n\n @address = @user.address\n @countries = Direction.order(:name)\n @total_recordings_size = Recording.select(\"SUM(size) AS 'total_size'\").where(:user_id => @user.id).first[\"total_size\"].to_d\n @i = @user.get_invoices_status\n\n @disallow_email_editing = Confline.get_value(\"Disallow_Email_Editing\", current_user.owner.id) == \"1\"\n\n unless @user.address\n address = Address.new\n address.email = nil if saddress.email.to_s.blank?\n address.save\n @user.address_id = address.id\n @user.save\n end\n\n if current_user.usertype == 'user' or current_user.usertype == 'accountant'\n @devices = current_user.devices(:conditions => \"device_type != 'FAX'\")\n else\n @devices = Device.find_all_for_select(corrected_user_id)\n end\n end", "title": "" }, { "docid": "31fa587a5f8bf516137fb0921c77f9d6", "score": "0.577492", "text": "def display_detail()\n puts \"Shop id: #$shop_id\"\n puts \"Customer id: #@cust_id\"\n puts \"Customer name: #@cust_name\"\n puts \"Customer address: #@cust_address\"\n puts \"\\n\"\n end", "title": "" }, { "docid": "75df425797e3fdbc575f051b5dfa0f85", "score": "0.57620007", "text": "def setCustomer(customer)\n @customerInfo = customer;\n end", "title": "" }, { "docid": "002700f89fb3a72f6d1af637720732fb", "score": "0.57612306", "text": "def create\r\n @customer = Customer.new(params[:customer])\r\n if @customer.save\r\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\r\n else\r\n format.html { render :action => \"new\"}\r\n end\r\n end", "title": "" }, { "docid": "9b48b2855e88a8043e95c754ab08f2e9", "score": "0.5759175", "text": "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n flash[:success] = \"Customer was successfully created\"\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Customer created \\n\")\n render'show'\n else\n render'new'\n end\n end", "title": "" }, { "docid": "01bd4c200619a194f693c4c0508b3b82", "score": "0.5731188", "text": "def add_new_customer\n begin\n puts \"*************************************************\"\n puts \"ADD A NEW CUSTOMER\"\n puts \"Enter Customer First Name\"\n puts \">\"\n user_input = gets.chomp\n @first_name = user_input\n\n puts \"Enter Customer Last Name\"\n puts \">\"\n user_input = gets.chomp\n @last_name = user_input\n\n puts \"Enter Street Address\"\n puts \">\"\n user_input = gets.chomp\n @street_address = user_input\n\n puts \"Enter City\"\n puts \">\"\n user_input = gets.chomp\n @city = user_input\n\n puts \"Enter State (use state abbreviation)\"\n puts \">\"\n user_input = gets.chomp\n @state = user_input\n\n puts \"Enter Postal Code\"\n puts \">\"\n user_input = Integer(gets.chomp)\n @postal_code = user_input\n\n puts \"Enter Phone Number\"\n puts \">\"\n user_input = Integer(gets.chomp)\n @phone_number = user_input\n\n puts \"Press any key if this Customer Info is Correct. Type n if this Customer Info needs corrections\"\n user_input = gets.chomp\n case user_input\n when \"n\"\n edit_customer\n else\n @customer = Customer.new\n @customer.info(@first_name, @last_name, @street_address, @city,@state, @postal_code, @phone_number)\n @customer.save\n\n end\n rescue ArgumentError => e\n puts \"ZIP code must not contain letters. (#{e})\"\n end\n end", "title": "" }, { "docid": "22cc4c87bad684fea6f491dcf1c6b83d", "score": "0.57265544", "text": "def create\n @pagetitle = \"New customer\"\n \n @customer = Customer.new(params[:customer])\n \n @company = Company.find(params[:customer][:company_id])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a1551ee5182370c33d403898d5eab04", "score": "0.57213926", "text": "def edit_customer\n begin\n puts \"*************************************************\"\n puts \"EDIT NEW CUSTOMER\"\n puts \"Edit Customer First Name\"\n puts \"#{@first_name}\"\n puts \">\"\n user_input = gets.chomp\n @first_name = user_input\n\n puts \"Edit Customer Last Name\"\n puts \"#{@last_name}\"\n puts \">\"\n user_input = gets.chomp\n @last_name = user_input\n\n puts \"Edit Street Address\"\n puts \"#{@street_address}\"\n puts \">\"\n user_input = gets.chomp\n @street_address = user_input\n\n puts \"Edit City\"\n puts \"#{@city}\"\n puts \">\"\n user_input = gets.chomp\n @city = user_input\n\n puts \"Edit State (use state abbreviation)\"\n puts \"#{@state}\"\n puts \">\"\n user_input = gets.chomp\n @state = user_input\n\n puts \"Edit Postal Code\"\n puts \"#{@postal_code}\"\n puts \">\"\n user_input = Integer(gets.chomp)\n @postal_code = user_input\n\n puts \"Edit Phone Number\"\n puts \"#{@phone_number}\"\n puts \">\"\n user_input = Integer(gets.chomp)\n @phone_number = user_input\n\n puts \"Press any key if this Customer Info is Correct. Type N if this Customer Info needs corrections\"\n user_input = gets.chomp\n case user_input\n when \"n\"\n edit_customer\n else\n @customer = Customer.new\n @customer.info(@first_name, @last_name, @street_address, @city,@state, @postal_code, @phone_number)\n @customer.save\n end\n rescue ArgumentError => e\n puts \"ZIP code must not contain letters. (#{e})\"\n end\n end", "title": "" }, { "docid": "d0eb2e44ba9f5301a68cb49fedb1bb5a", "score": "0.572105", "text": "def account\n @title = \"Your Account Details\"\n # Update account details\n if request.post?\n if @customer.update_attributes(params[:customer])\n flash.now[:notice] = \"Account details saved.\"\n else\n flash.now[:notice] = \"There was a problem saving your account.\"\n end\n end\n end", "title": "" }, { "docid": "05592a3c735138c0d9887223fbd59fbd", "score": "0.5716628", "text": "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n begin\n @customer.save!\n\n if @customer.visit_stores.blank?\n visit_store = @customer.visit_stores.build(store_id: view_context.current_store.id)\n visit_store.save\n end\n\n # rubocopに従うとネストが深くなりすぎるため、無効化\n # rubocop:disable Layout/IndentationWidth, Layout/ElseAlignment, Layout/EndAlignment\n result = if @customer.square_customer_exists?\n '新規作成、Square連携に成功しました。'\n else\n 'square連携に失敗しました。入力内容が誤っている可能性があります。お手数ですが、修正後にもう一度、更新してください。'\n end\n # rubocop:enable Layout/IndentationWidth, Layout/ElseAlignment, Layout/EndAlignment\n\n format.html { redirect_to @customer, notice: result }\n format.json { render :show, status: :created, location: @customer }\n rescue StandardError => exception\n # square連携のエラーをログに表示するため\n logger.debug(exception)\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd835873e775cefd232c4e082b4143f6", "score": "0.57155126", "text": "def create_request\n @page_title = 'Created Tour Request'\n\n @customer = retrieve_customer\n if @customer != nil\n\n # Handling back button or refresh\n if @customer.tour_requests != nil && @customer.tour_requests.count > 0\n render 'duplicate_request', :layout => true\n # Wish there was a way to return out of this instead of using if blocks.\n else\n @tour_request = TourRequest.new(params[:tour_request])\n @tour_request.customer = @customer\n if params[:amenity_ids] != nil # User is not required to select an amenity\n @tour_request.amenities = Amenity.find(params[:amenity_ids])\n end\n\n # Saving and error handling\n if !@tour_request.save\n flash.now[:errors] = @tour_request.errors\n @amenities = Amenity.all\n render :action => 'tour_info'\n else\n begin\n CustomerMailer.confirm_email(@tour_request).deliver\n SupportMailer.new_tour_request_email(@tour_request).deliver\n rescue => exception\n email_error(exception, @tour_request.customer.email)\n end\n end\n end\n end\n\n end", "title": "" }, { "docid": "86d28c9cb060751d8ed922e253e5fe51", "score": "0.5713076", "text": "def set_edit_form_information\n @information[:form_url] = purchase_path(@order)\n @information[:subtitle] = t('view.purchases.edit_title', order_number: @order.number)\n @information[:button_text] = t('view.purchases.save')\n @information[:back_path] = back_path\n end", "title": "" }, { "docid": "175b005cc348f658fe6efdd6eccd952e", "score": "0.56991744", "text": "def grab_new_customer\n unless params[:customer][:name].blank?\n c = Customer.create(params[:customer]) \n @treatment.customer_id = c.id\n end\n end", "title": "" }, { "docid": "45aa30dd50ca591bb625f0ba5c619b41", "score": "0.56982887", "text": "def update_customer\n @customer.details.merge(@customer_details)\n @customer.save!\n\n success\n end", "title": "" }, { "docid": "f52c42adab4a31b5e6126ae21f09581e", "score": "0.5690056", "text": "def create\n @custom_tour = CustomTour.new(custom_tour_params)\n \n if @custom_tour.save\n #@customer = Customer.new(email: @custom_tour.user_email, name: @custom_tour.user_name )\n #@customer.save!\n flash[:SendCustomTour] = 'کاربر گرامی پیشنهاد شما ثبت شد.'\n redirect_to :back \n end\n \n end", "title": "" }, { "docid": "e90b0570395db147f5c398c7cb5c0b81", "score": "0.5686144", "text": "def create\n @title = t('view.customers.new_title')\n @customer = Customer.new(\n params[:customer], {as: (current_user.try(:admin) ? :admin : :default)}\n )\n\n respond_to do |format|\n if @customer.save\n url = current_user ? customer_url(@customer) : new_customer_session_url\n notice = current_user ? t('view.customers.correctly_created') : t('view.customers.correctly_registered')\n \n format.html { redirect_to(url, notice: notice) }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: current_user ? 'new' : 'new_public' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1461308bb679ade48389cada88b6629", "score": "0.56852436", "text": "def set_info_customer\n @info_customer = Info::Customer.find(params[:id])\n end", "title": "" }, { "docid": "073bfa610dfe7c918edcc53107ef6f83", "score": "0.56828386", "text": "def create\n @customer = Customer.new(params.require(:customer).permit(:can_text_home_phone, :can_text_mobile_phone, \n :can_text_other_phone, :can_text_work_phone, :cid, \n :city, :date_of_birth, :driver_lic_image_id, \n :driver_lic_num, :driver_lic_state_id, :gender, \n :home_phone, :is_aaa_member, :is_web_registered, \n :joined_date, :mobile_phone, :other_phone,\n :referral_credits_earned, :referral_credits_used,\n :referredBy_customer_id, :referredBy_id,\n :referredBy_other_text, :signup_store_id,\n #:spouse_id, :spouse_name,\n\t\t :ssn, :state_id,\n :street_addr1, :street_addr2, :user_id,\n :video_testimony_url, :work_phone,\n :written_testimony_id, :zip,\n :first_name, :middle_name, :last_name, :email, \n :contact_method))\n ok = validateCustomer?(@customer)\n okUrl, errAction = setSaveAction('new', customers_url)\n\n respond_to do |format|\n if ok and @customer.save\n unzeroCid(@customer)\n format.html { redirect_to okUrl,\n notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created,\n location: @customer }\n else\n prepFormVariables(@customer)\n format.html { render action: errAction }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b405f4e5adfb2a7b8a3077b57af00c01", "score": "0.5679641", "text": "def save\n order = Order.create(user_id: user_id, country_id: country_id, plane_id: plane_id, plane_go_id: plane_go_id,\n plane_back_id: plane_back_id, hotel_id: hotel_id, tour_id: tour_id)\n Info.create(passport_number: passport_number, first_name: first_name, last_name: last_name, order_id: order.id)\n end", "title": "" }, { "docid": "5bb12f83d9b81f3bc8617fc1fa35e702", "score": "0.56789386", "text": "def update\n @customer = User.find(params[:id])\n @customer.update_attributes!(sane_user_params)\n flash[:success] = \"Successfully updated your details\"\n logger.debug \"Updated customer. params[:current_tab]: #{params[:current_tab]}\"\n #redirect_to customer_addresses_path(@customer)\n end", "title": "" }, { "docid": "7b32fc9c012b2fa3670e962ca9b04bec", "score": "0.56649846", "text": "def save_my_details\n save_user_details(params)\n \n render :partial => \"my_details\", :locals => { :staff_user => User.find(current_user.id) }\n return\n end", "title": "" }, { "docid": "64d71e7707de82f093e34a4013b182ea", "score": "0.5663012", "text": "def index \n if logged_in?\n if @order.customer_id.nil?\n @order.customer_id = logged_in_user.id\n @order.save\n end\n redirect_to '/checkout/addresses'\n return \n end\n end", "title": "" }, { "docid": "e5c1999daf57431b3485283d8bee280b", "score": "0.5661265", "text": "def create\n @customer_detail = CustomerDetail.new(params[:customer_detail])\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to(@customer_detail, :notice => 'Customer detail was successfully created.') }\n format.xml { render :xml => @customer_detail, :status => :created, :location => @customer_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5c1999daf57431b3485283d8bee280b", "score": "0.5661265", "text": "def create\n @customer_detail = CustomerDetail.new(params[:customer_detail])\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to(@customer_detail, :notice => 'Customer detail was successfully created.') }\n format.xml { render :xml => @customer_detail, :status => :created, :location => @customer_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba22d2a05ed630657c70ace60e2b25a9", "score": "0.5659358", "text": "def set_new_form_information\n @information[:form_url] = purchases_path(@order)\n @information[:subtitle] = t('view.purchases.new_title')\n @information[:button_text] = t('view.purchases.save')\n @information[:back_path] = back_path\n end", "title": "" }, { "docid": "e50d4c4e2c9e8d2c62667e30654bc663", "score": "0.5657888", "text": "def account_info\n if (request.post?)\n if (@customer.update_attributes(params[:customer]))\n flash[:message] = 'Your account information has successfully been changed!'\n else\n flash.now[:message] = 'Error changing account information'\n end\n end\n end", "title": "" }, { "docid": "bf7316c2525c1113da6f10752cfc4200", "score": "0.5654455", "text": "def create\n @customer = @store.customers.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to [@store,@customer], notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "457541df7de8c24d03b2a73cea3e645f", "score": "0.56450385", "text": "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n session[:user_id] = @customer.id\n redirect_to edit_customer_path(@customer.id), notice: 'Thank you for signing up!'\n else\n render :new\n end\n end", "title": "" }, { "docid": "79f471e1d1ee9b83ff2ca8d20406e3dd", "score": "0.5641084", "text": "def new\n if request.get?\n @customer = @current_account.customers.build\n else\n @customer = @current_account.customers.build(params[:customer])\n @customer.build_address(params[:address])\n redirect_to :action => 'list' if @customer.save\n end\n end", "title": "" }, { "docid": "c06ff8ef671f35e49c103a46913ee02e", "score": "0.56378806", "text": "def create\n @instant_customer = InstantCustomer.new(params[:instant_customer])\n\n respond_to do |format|\n if @instant_customer.save\n format.html { redirect_to @instant_customer, notice: 'Instant customer was successfully created.' }\n format.json { render json: @instant_customer, status: :created, location: @instant_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instant_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef1126db9b91b7b2cb6097fc3626d676", "score": "0.56337786", "text": "def create\n @customer_information = CustomerInformation.new(customer_information_params)\n\n respond_to do |format|\n if @customer_information.save\n format.html { redirect_to @customer_information, notice: 'Customer information was successfully created.' }\n format.json { render :show, status: :created, location: @customer_information }\n else\n format.html { render :new }\n format.json { render json: @customer_information.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "429a8170e0ea7da6f272b3670c36eb2d", "score": "0.56290346", "text": "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to @customer_detail, notice: 'Customer detail was successfully created.' }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "beed7a67bf086795f5e89a61190446fa", "score": "0.562203", "text": "def new\n @booking = Booking.new(params[:booking])\n @themes = Theme.all\n @coaches = Coach.all\n @studios = Studio.all\n @salespeople = SalesPerson.all\n @cities = City.all :order => \"latitude DESC\"\n @pricing_structures = PricingStructure.where(\"expiry_date >= ?\", Date.today)\n\t\t\n #Create new customer & guest no. records which will appear in the view\n @booking.customer = Customer.new\n @booking.guest = Guest.new\n @booking.guest.number = 0 # default is 0, which we treat as meaning \"unspecified\". Invoicing etc is disabled when it is 0\n \n @booking.city = City.find_all_by_name(:Unspecified).last\n\t\t\n session[:return_to] ||= request.referer # record where the user came from so we can return them there after the save\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @booking }\n end\n end", "title": "" }, { "docid": "74ca398006fdb69e6468704029105bc0", "score": "0.5620098", "text": "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n session[:type]=\"Customer\"\n session[:user_id][email protected]\n format.html { redirect_to customers_path }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b7261bb1c4a371cf16099f5223c067b", "score": "0.56190336", "text": "def update\n @customer = User.find(params[:id])\n @customer.update_attributes!(sane_user_params)\n flash[:success] = \"Successfully updated customer details\"\n logger.debug \"Updated customer. params[:current_tab]: #{params[:current_tab]}\"\n #redirect_to customer_addresses_path(@customer)\n end", "title": "" }, { "docid": "f2e7d4933dd33b2282418ae76efe5b0a", "score": "0.5603709", "text": "def set_customer_edit_tr_data\n @year = DateTime.now().strftime('%Y')\n # if updating credit card along with customer use token of credit\n # card to update in TR data, else Braintree will create new credit\n # card instead of an updating existing one\n @tr_data = Braintree::TransparentRedirect.\n update_customer_data(:redirect_url => confirm_customer_url,\n :customer_id => current_algofast_user.braintree_customer_id,\n :customer => {\n :credit_card => {\n :options => {\n :update_existing_token => current_algofast_user.default_credit_card.token \n },\n #uncomment following block when supporting billing address\n #:billing_address => {\n # :options => {\n # :update_existing => true\n # }\n #}\n }\n })\n end", "title": "" }, { "docid": "38ae2653b408afbd5ed57b9b6b2823fc", "score": "0.5600653", "text": "def update\n @customer = Customer.find(params[:id])\n if @customer.update(customer_params)\n # wijzigen gelukt, schrijft logentry en toon overzicht\n log self.class.name, LogEntry::INFORMATIONAL, \"Klantnaam voor klant id #{@customer.id} is gewijzigd door #{current_admin_user.username}\"\n redirect_to admin_customers_path\n else\n # wijzigen niet gelukt, toon formulier opnieuw (met foutmelding)\n render :edit\n end\n end", "title": "" }, { "docid": "827c6ccd5308656df0434af41e86aab1", "score": "0.55963045", "text": "def new\n\n\t\tif current_customer_user\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\t@customer = Customer.new\n\t\t\trender :new\n\t\tend\n\tend", "title": "" }, { "docid": "5958cdb1748d3f691b44656f7b6b0de4", "score": "0.5592029", "text": "def create\n @customer = @person.customers.at(current_unit).build(customer_params)\n\n respond_to do |format|\n if @customer.save\n track @customer\n format.html { redirect_to @customer, notice: t('.notice', customer: @customer) }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "724ec88bcfea2d94bd6bae99cfb53f1d", "score": "0.5590892", "text": "def edit_customer\r\n\t\t@current_area = \"customers\"\r\n\t\t@current_menu = \"users\"\r\n\r\n\t\t@customer = User.find(params[:id])\r\n\r\n\t\tif @customer && @customer.permissions == :user\r\n\t\t\tif request.post?\r\n\t\t\t\tif params[:save] && !params[:save].empty?\r\n\t\t\t\t\t@customer[:first_name] = params[:customer][:first_name]\r\n\t\t\t\t\t@customer[:last_name] = params[:customer][:last_name]\r\n\t\t\t\t\t@customer[:email] = params[:customer][:email]\r\n\t\t\t\t\t@customer[:active] = (params[:customer][:active].to_i == 1)\r\n\t\t\t\t\t@customer[:sees_wholesale] = (params[:customer][:sees_wholesale].to_i == 1)\r\n\t\t\t\tend\r\n\r\n\t\t\t\tif params[:approve] && !params[:approve].empty?\r\n\t\t\t\t\t# Application successful, send the appropriate emails\r\n\t\t\t\t\tgenerated_password = gen_pass()\r\n\t\t\t\t\[email protected] = generated_password\r\n\t\t\t\t\[email protected]_confirmation = generated_password\r\n\r\n\t\t\t\t\t@customer[:sees_wholesale] = true\r\n\t\t\t\t\t@customer[:wholesale_application] = \"y\"\r\n\r\n\t\t\t\t\tPostman.deliver_wholesale_approved(@configurator, @customer)\r\n\t\t\t\telsif params[:deny] && !params[:deny].empty?\r\n\t\t\t\t\t@customer[:sees_wholesale] = false\r\n\t\t\t\t\t@customer[:wholesale_application] = \"n\"\r\n\t\t\t\tend\r\n\r\n\t\t\t\tif params[:password] && !params[:password].empty?\r\n\t\t\t\t\tif params[:customer][:password].empty? && params[:customer][:password_confirmation].empty?\r\n\t\t\t\t\t\t# generate a password\r\n\t\t\t\t\t\tgenerated_password = gen_pass()\r\n\t\t\t\t\t\[email protected] = generated_password\r\n\t\t\t\t\t\[email protected]_confirmation = generated_password\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\[email protected] = params[:customer][:password]\r\n\t\t\t\t\t\[email protected]_confirmation = params[:customer][:password_confirmation]\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\r\n\t\t\t\tif @customer.save\r\n\t\t\t\t\tflash[:notice] = \"Changes successfully saved\"\r\n\t\t\t\t\tif generated_password\r\n\t\t\t\t\t\tflash[:notice] += \"; password set to: #{generated_password}\"\r\n\t\t\t\t\tend\r\n\t\t\t\t\tredirect_to :action => :customers\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tflash[:notice] = \"Bad Customer ID #\"\r\n\t\t\tredirect_to :action => :customers\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "4fcc7aed476bae4f4a5400e51e28bd72", "score": "0.55775833", "text": "def new\n @pagetitle = \"New customer\"\n \n @customer = Customer.new\n @customer[:taxable] = true\n @customer[:account] = \"C_#{generate_guid()}\"\n \n @company = Company.find(params[:company_id])\n @customer.company_id = @company.id\n \n if(params[:ajax])\n @ajax = true\n render :layout => false\n end\n end", "title": "" }, { "docid": "4ee649a8bc95717294507f5c27d82122", "score": "0.55769604", "text": "def serve_customer(customer)\n if @occupied\n @line.add(customer)\n else\n @occupied = true\n customer.time_to_checkout = @cashier.time_for_items(customer.num_groceries)\n event = CustomerDepartureEvent.new(SoopaStore.current_time+customer.time_to_checkout, customer)\n SoopaStore.events.add(event)\n @cashier.serve(customer)\n end\n end", "title": "" }, { "docid": "eac340f64df617c7d46dca45b56c3dbd", "score": "0.5574535", "text": "def update\n if @customer.update(customer_params)\n flash[:success] = \"Customer was successfully updated\"\n\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Customer was updated \\n\")\n render 'show'\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "4839389954efb10ce9532f0bfee819a2", "score": "0.55586636", "text": "def create\n @customer = CustomerManagement.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n @customer_info = Customer.new\n @customer_info.save\n @customer.update_columns(customer_id: @customer_info.id)\n format.html { redirect_to admin_customers_customers_url, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: admin_customers_customers_url.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e937ba0f0562cd6391ef0e78326f1a5", "score": "0.5554816", "text": "def edit\n # set the @traveler variable\n get_traveler\n # set the @trip variable\n get_trip\n\n # make sure we can find the trip we are supposed to be updating and that it belongs to us. \n if @trip.nil? \n redirect_to(user_planned_trips_url, :flash => { :alert => t(:error_404) })\n return \n end\n # make sure that the trip can be modified \n unless @trip.can_modify\n redirect_to(user_planned_trips_url, :flash => { :alert => t(:error_404) })\n return \n end\n\n # create a new trip_proxy from the current trip\n @trip_proxy = create_trip_proxy(@trip)\n # set the flag so we know what to do when the user submits the form\n @trip_proxy.mode = MODE_EDIT\n # Set the trip proxy Id to the PK of the trip so we can update it\n @trip_proxy.id = @trip.id\n\n # Create markers for the map control\n @markers = create_markers(@trip_proxy)\n @places = create_place_markers(@traveler.places)\n \n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "c33e5885ee3779172f96d4793903dd05", "score": "0.55453944", "text": "def new_customer_address\n @customer = Customer.find(params[:customer_id])\n @address = Address.new(params[:address])\n @address.customer_id = @customer.id\n @address.save\n render :update => true, :layout => false do |page|\n page[\"address_option\"].update render(:partial => 'address_option')\n end\n #render :nothing => true\n\tend", "title": "" }, { "docid": "09da54bd10153cb67f48045a5ae6889f", "score": "0.55417776", "text": "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to \"#{@customer}#profile\", notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c541f359dbcc1d39d660dffd4206f79d", "score": "0.55414546", "text": "def show\n # decoreted the user name by using the decorate pattern\n @customer = Customer.find(params[:id]).decorate\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Customer viewed by user and admin \\n\")\n #@user = User.find(params[:id]).decorate\n # @cinemas = Cinema.near(@customer.address, 10, :order => :distance, :units => :km)\n end", "title": "" }, { "docid": "f7ed91f3978b864904d20d98ad80f803", "score": "0.5537635", "text": "def create_customer_entry\n\t\[email protected]_customer(:customer_id=>@customer_key,:subscription_id=>@subscription_id,:plan_id=>@plan.id).save!\n\tend", "title": "" }, { "docid": "73f66c030d48cd718c1575ccc60089c6", "score": "0.5536631", "text": "def new_customer\r\n\t\t@current_area = \"customers\"\r\n\t\t@current_menu = \"users\"\r\n\r\n\t\tif request.post? && params[:customer]\r\n\t\t\t@customer = User.new(params[:customer])\r\n\r\n\t\t\tif params[:customer][:password].empty? && params[:customer][:password_confirmation].empty?\r\n\t\t\t\t# generate a password\r\n\t\t\t\tgenerated_password = gen_pass()\r\n\t\t\t\[email protected] = generated_password\r\n\t\t\t\[email protected]_confirmation = generated_password\r\n\t\t\tend\r\n\r\n\t\t\tif @customer.save\r\n\t\t\t\tflash[:notice] = \"Customer successfully created\"\r\n\t\t\t\tif generated_password\r\n\t\t\t\t\tflash[:notice] += \" with password: #{generated_password}\"\r\n\t\t\t\tend\r\n\t\t\t\tredirect_to :action => :customers\r\n\t\t\telse\r\n\t\t\t\[email protected] = nil\r\n\t\t\t\[email protected]_confirmation = nil\r\n\t\t\tend\r\n\t\telse\r\n\t\t\t@customer = User.new\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "b0a5786123b047949e1838129708255b", "score": "0.55360645", "text": "def new_customer\n get_name\n\n username = customer_info\n\n if Customer.all.find_by(name: username)\n puts \"\n\n Hi, #{username}, welcome back.\n\n\n \"\n Customer.all.find_by(name: username)\n else\n get_age\n userage = customer_info.to_i\n\n age_check(userage)\n\n get_wallet\n userwallet = customer_info.to_f\n\n wallet_check(userwallet)\n\n customer = Customer.create(name: username, age: userage, bank_account: userwallet)\n end\nend", "title": "" }, { "docid": "c76ca9ddf4a97683ac0e9dc58162f916", "score": "0.5536058", "text": "def show\n @customer = Customer.find(params[:id])\n prepFormVariables(@customer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "title": "" }, { "docid": "81b4183c3ed6264fe08acf6568425780", "score": "0.5531549", "text": "def create\n @customer = Customer.new(params[:customer])\n @customer.first_name = @customer.first_name.humanize\n @customer.last_name = @customer.last_name.humanize\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea9d1d6eb106c81015b6b95fa51dd898", "score": "0.5526781", "text": "def customer=(value)\n @customer = value\n end", "title": "" }, { "docid": "014decf4c9588e0341b31b640e51c77a", "score": "0.55243623", "text": "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n session[:customer_id] = @customer.id\n\n format.html { redirect_to store_path }\n format.json { render json: @customer, status: :created,\n location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d680def7e7ff611606c5b1e012df4edc", "score": "0.55168015", "text": "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n # SQL: INSERT INTO customers (name, email, account_type, created_at, updated_at) VALUES (?, ?, ?, ?, ?)\n flash[:notice] = \"Created #{@customer.name}\"\n redirect_to customer_path(@customer), id: @customer.id\n else\n flash[:alert] = \"Failed to create customer: #{@customer.errors.full_messages.to_sentence}\"\n render :new\n end\n end", "title": "" }, { "docid": "5ed4835859fcc50c0e0e487945a9ae67", "score": "0.5512344", "text": "def set_customer_detail\n @customer_detail = Customer.find(params[:customer_id]).customer_detail\n end", "title": "" }, { "docid": "7d309b97e3e0fa14a022fd5cbd8650a3", "score": "0.55078846", "text": "def show\n @cadastral_offices = CadastralOffice.all\n @townships = Township.all\n @order_ways = OrderWay.all\n @order_types = OrderType.all\n @handover_ways = HandoverWay.all\n @price_creations = PriceCreation.all\n @customers = Customer.all\n @employees = Employee.all\n @acceptance_date = @contract.acceptance_date\n @submit_value = \"Show\"\n @hidden_submit = \"hidden\"\n end", "title": "" }, { "docid": "383655ea94adf790a82940614708eab8", "score": "0.5506304", "text": "def set_customer\n if request.env['PATH_INFO'] != \"/customers/summary\" || request.env['PATH_INFO'] != \"/customers/qrcode\" \n @customer = Customer.find(params[:id])\n end\n end", "title": "" }, { "docid": "49e49e09c04d45d3093ab8ab8e9d46b0", "score": "0.55054593", "text": "def create\n #puts customer_params\n if customer_params[\"birth(1i)\"] == \"\"\n date = Date.new(2,4,19)\n else\n date = Date.new customer_params[\"birth(1i)\"].to_i, customer_params[\"birth(2i)\"].to_i, customer_params[\"birth(3i)\"].to_i\n end\n @customer = Customer.new({\n name: customer_params[:name],\n birth: date,\n city: customer_params[:city],\n mobile: customer_params[:mobile],\n email: customer_params[:email],\n interest: customer_params[:interest]})\n\n respond_to do |format|\n if @customer.save\n en = @customer.create_entry!(\n event_id: current_collector.event_id, \n collector_id: current_collector.id,\n taste: customer_params[:taste],\n glass: customer_params[:glass],\n cocktail: customer_params[:cocktail]\n )\n if en\n logger.debug \"Entrada #{session[:customer_id]} creada\"\n @customer.update_attribute :entry_id, en.id\n end\n session[:customer_id] = @customer.id\n format.html { redirect_to end_path, notice: 'Sus datos fueron registrados exitosamente.' }\n format.json { render :show, status: :created, location: @customer }\n\n else\n format.html { redirect_to club_path, alert: 'Este email ya esta registrado.' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34e59a18dc93d3f576e055cb75da3f23", "score": "0.5504118", "text": "def add\n # ask user for name and price\n attributes = {\n name: @view.ask_for_string(:name),\n address: @view.ask_for_string(:address)\n }\n # make new customer object\n # pass that to the repository\n @customers_repository.add(Customer.new(attributes))\n end", "title": "" }, { "docid": "5a158c5ba2cfa74b60e069de3f19ecae", "score": "0.55037266", "text": "def create\n @customer = Customer.new(cust_params)\n \n if @customer.save\n redirect_to \"/contracts/new?customerID=\" + String(@customer.CustomerID)\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "be3ec5b7404a68c6d842b3003e6de69e", "score": "0.5503242", "text": "def create_for_invoice\n @customer = @current_account.customers.build(params[:customer])\n @customer.build_address(params[:address])\n if @customer.save\n # To display this customer on the left header reusing partials.\n @invoice = Invoice.new\n @invoice.customer = @customer\n end\n end", "title": "" }, { "docid": "7dfc13f41ad1ddd32bc2966d05ce1f76", "score": "0.55012184", "text": "def set_edit_form_information\n @information[:form_url] = order_path(@order)\n @information[:subtitle] = t('view.orders.edit_title', order_number: @order.number)\n @information[:button_text] = t('view.orders.save')\n @information[:back_path] = orders_path\n end", "title": "" }, { "docid": "e456d3b86d9d4719d9a76adc491b3ed1", "score": "0.5498508", "text": "def create\n @title = t('view.customers.new_title')\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n url = current_user ? customer_url(@customer) : new_customer_session_url\n notice = current_user ? t('view.customers.correctly_created') : t('view.customers.correctly_registered')\n\n format.html { redirect_to(url, notice: notice) }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n if @customer.errors && ([:password, :password_confirmation] - @customer.errors.keys).empty?\n report_validation_error(@customer)\n end\n format.html { render action: current_user ? 'new' : 'new_public' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a61343c2b8663bcb84dda81d5944919c", "score": "0.54919463", "text": "def complete_info_form(data)\n enter_reference_number data\n enter_normal_location data\n enter_current_location data\n enter_location_date data\n end", "title": "" }, { "docid": "ad845ca887ad922e566447eae55b314e", "score": "0.54914093", "text": "def on_customer_created customer_created\n @name = customer_created.name\n @credit = customer_created.credit\n end", "title": "" }, { "docid": "94cac2fd55c693e8ce4fba85357924e2", "score": "0.54887146", "text": "def done\n\t\t# @customer = Customer.find_by_id(params[:id])\n\t\[email protected]_attributes(:id => params[:id], :first_name => params[:fname], :last_name => params[:lname], :msisdn => params[:number], :id_type => params[:idtype],\n\t\t\t:id_number => params[:idnumber], :address => params[:address], :user_id => params[:user_id], :status => params[:status])\n\n\t\tredirect_to (:back)\n\n\tend", "title": "" }, { "docid": "2db67cc8e6cb354a79446dead64fe3fa", "score": "0.548858", "text": "def sign_up(name, location)\n\tif name == \"\" && location == \"\"\n\t\tprint \"What's your name? \"\n\t\tname = gets.chomp\n\t\tprint \"What's your location? \"\n\t\tlocation = gets.chomp\n\tend\n\n\t@current_customer = Customer.new(name, location)\n\n\[email protected](@current_customer)\n\n\tputs \"Registration successful!\"\n\taccount_menu\n\nend", "title": "" }, { "docid": "0213ada37db503c3a97ee44472c28abd", "score": "0.5481122", "text": "def show\n authorize @customer\n @customer_characteristic = Constant::CUSTOMER_CUSTOMER_CHARACTERISTIC.values_at(*@customer.customer_characteristic)\n @customer_notes = @customer.notes\n end", "title": "" }, { "docid": "514814bd18fc9136ee5ef607ed470c2c", "score": "0.5476581", "text": "def new\n @customer = Customer.new\n# run_custnumber\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n format.json { render :json => @customer }\n end\n end", "title": "" }, { "docid": "7d5d52e868e5cf711c2de44e2624a88f", "score": "0.5476101", "text": "def sign_up(name, location)\n if name ==\"\" && location == \"\"\n print \"whats your name?\"\n name =gets.chomp\n print \"whats your location?\"\n location = gets.chomp\n \n end\n @current_customer = Customer.new(name, location)\n \n @customer.push(@current_customer)\n \n puts \"Registration successful!\"\n account_menu\nend", "title": "" }, { "docid": "1d51892ff19cfeb4e2adb7b3484ec0bd", "score": "0.54754865", "text": "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html {\n session[:customer_id] = @customer.id\n redirect_to customer_path(@customer), notice: \"Account was successfully created\"\n }\n format.json {\n session[:customer_id] = @customer.id\n render :show, status: :create, location: @customer\n }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unproccessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9331b5c836e4ab390c0f0078f70c95b2", "score": "0.54667413", "text": "def index\n @customers = Customer.all\n @customer_form = NewCustomerForm.new\n end", "title": "" }, { "docid": "c8f81d90f7259b775a08cfb63fc33945", "score": "0.54632896", "text": "def sign_up(name, location)\n if name == \"\" && location == \"\"\n print \"What's your name? \"\n name = gets.chomp\n print \"What's your location? \"\n location = gets.chomp\n end\n @current_customer = Customer.new(name, location)\n @customers.push(@current_customer)\n puts \"Registration successfull!\"\n account_menu\nend", "title": "" }, { "docid": "c0552542e882fb19b201f8fd395f92be", "score": "0.54593503", "text": "def prepare_customer_form\n if current_user && @customer.profile\n @customer.profile.referal_id = current_user.code \n @customer.profile.referal = current_user.referral_category.name if current_user.referral_category\n end\n @referral = ReferralCategory.order(\"id ASC\")\n prepare_price\n end", "title": "" }, { "docid": "70f268bd4b3dae3bdf8ebd22b68091cf", "score": "0.54570246", "text": "def handle_billing_information #case 2\n @person = Ansuz::NFine::Person.find_or_create_by_cart_id(@cart.id)\n @person.user_id = @cart.user_id\n @person.save\n @address = Ansuz::NFine::Address.new\n render :action => 'checkout_billing_information'\n end", "title": "" }, { "docid": "ad7b61e1d049ef561d9d86b5a1b681fb", "score": "0.5454784", "text": "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to admin_customers_url, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c95a7ea2bd4a4d479406e8e002885d7d", "score": "0.54544353", "text": "def create\n @s_customer = SCustomer.new(s_customer_params)\n\n respond_to do |format|\n if @s_customer.save\n format.html { redirect_to @s_customer, notice: 'S customer was successfully created.' }\n format.json { render :show, status: :created, location: @s_customer }\n else\n format.html { render :new }\n format.json { render json: @s_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97422b6e49b8616ae6afa3fdc6f2789c", "score": "0.544339", "text": "def copy_customer_data\n\n if self.invoice_status != :invoice\n if self.customer\n self.customer_type = self.customer.customer_type\n if self.customer.customer_type == :individual\n self.customer_full_name = self.customer.full_name\n self.customer_document_id = self.customer.document_id\n elsif self.customer.customer_type == :legal_entity\n self.customer_full_name = self.customer.company_name\n self.customer_document_id = self.customer.company_document_id\n end\n if self.customer.invoice_address\n self.customer_address = LocationDataSystem::Address.new if self.customer_address.nil?\n self.customer_address.street = self.customer.invoice_address.street\n self.customer_address.number = self.customer.invoice_address.number\n self.customer_address.complement = self.customer.invoice_address.complement\n self.customer_address.city = self.customer.invoice_address.city\n self.customer_address.state = self.customer.invoice_address.state\n self.customer_address.zip = self.customer.invoice_address.zip\n self.customer_address.country = self.customer.invoice_address.country\n self.customer_address.save\n end \n end \n end\n\n end", "title": "" }, { "docid": "4e9d7d43ed7dc3073ee7a83aed5bfc81", "score": "0.54400617", "text": "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to customer_details_path, notice: 'Customer detail was successfully created.' }\n format.json { render :new, status: :created }\n else\n format.html { render :new }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
84c77a7e23ba6ab75ea7cf1249f26773
Renders a crud form for the current entry with default_crud_attrs or the given attribute array. An options hash may be given as the last argument. If a block is given, a custom form may be rendered and attrs is ignored.
[ { "docid": "f175958ca7abfa66af5bbe1a1d289c59", "score": "0.8066111", "text": "def crud_form(*attrs, &block)\n options = attrs.extract_options!\n attrs = default_crud_attrs - %i[created_at updated_at] if attrs.blank?\n attrs << options\n standard_form(path_args(entry), *attrs, &block)\n end", "title": "" } ]
[ { "docid": "6a9601012f4cdc1523d4acdd921c10e8", "score": "0.7194307", "text": "def crud_form(object, *attrs, &block)\n options = attrs.extract_options!\n cancel_url = get_cancel_url(object, options)\n \n standard_form(object, options) do |form|\n content = if block_given?\n capture(form, &block)\n else\n form.labeled_input_fields(*attrs)\n end\n\n content << form.standard_actions(cancel_url)\n content.html_safe\n end\n end", "title": "" }, { "docid": "b65e3e79098e50dc7903135bfd481efb", "score": "0.6066985", "text": "def custom_form(record, options = {}, &block)\n options.update(builder: CustomFormBuilder)\n form_for(record, options, &block)\n end", "title": "" }, { "docid": "ba9e9512d1868653042b3c8ccab293dc", "score": "0.5893794", "text": "def f_form_for(record, options = {}, &block)\n options[:builder] = FormattedFormBuilder\n form_for(record, options, &block)\n end", "title": "" }, { "docid": "63e2a50226c7b84039842fa445b14b4a", "score": "0.5846484", "text": "def table_form_for(record_or_name_or_array, *args, &proc)\n raise ArgumentError, \"Missing block\" unless block_given?\n\n options = args.extract_options!\n\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!([object], options)\n args.unshift object\n end\n\n concat(form_tag(options.delete(:url) || {}, options.delete(:html) || {}), proc.binding)\n corkd_form_start( &proc)\n fields_for(object_name, *(args << options), &proc)\n corkd_form_end( &proc)\n concat('</form>', proc.binding)\n end", "title": "" }, { "docid": "b25d361a648bc904b60cbeb3bd0d2c9e", "score": "0.5702266", "text": "def bootstrap_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n options[:html] ||= {}\n\n # :horizontal\n if horizontal = options.delete(:horizontal)\n # set the form html class for horizontal bootstrap forms\n options[:html][:class] ||= ''\n options[:html][:class] = (options[:html][:class].split(' ') << 'form-horizontal').uniq.join(' ')\n end\n\n # We switch autocomplete off by default\n raise 'autocomplete should be defined an html option' if options[:autocomplete]\n options[:html][:autocomplete] ||= 'off'\n\n form_for(record_or_name_or_array, *(args << options.merge(builder: NdrUi::BootstrapBuilder))) do |form|\n # Put the form builder into horizontal mode (if necessary)\n form.horizontal_mode = horizontal if horizontal\n\n # yield to the provided form block\n yield(form)\n end\n end", "title": "" }, { "docid": "a9a63421e7f43dc93808ca31d750a393", "score": "0.55682355", "text": "def pythy_form_for(*args, &block)\n options = {}\n\n if args.length >= 2 && !args[1].is_a?(Hash)\n parent = args[0]\n child = args[1]\n form_args = child.try(:new_record?) ? [parent, child] : child\n\n options = args[2] if args.length > 2 && args[2].is_a?(Hash)\n else\n parent = nil\n child = args[0]\n form_args = child\n\n options = args[1] if args.length > 1 && args[1].is_a?(Hash)\n end\n\n if options[:html]\n if options[:html][:class]\n options[:html][:class] += ' form-horizontal'\n else\n options[:html][:class] = 'form-horizontal'\n end\n else\n options[:html] = { class: 'form-horizontal' }\n end\n\n capture do\n twitter_bootstrap_form_for(form_args, options) do |f|\n concat form_errors child\n yield f\n end\n end\n end", "title": "" }, { "docid": "03b4d99a029fe61b85e1ef7465ec51e9", "score": "0.55307364", "text": "def standard_form(object, *attrs, &block)\n plain_form(object, attrs.extract_options!) do |form|\n content = [form.error_messages]\n\n content << if block_given?\n capture(form, &block)\n else\n form.labeled_input_fields(*attrs)\n end\n\n content << form.standard_actions\n safe_join(content)\n end\n end", "title": "" }, { "docid": "87d8502ba24772294433c494726bcdc1", "score": "0.5493761", "text": "def render_field_block(f, klass, attribute, field_method, field_options)\n render :partial => 'shared/form_field',\n :locals => {f: f, klass: klass, attr: attribute, type: field_method, opts: field_options}\n end", "title": "" }, { "docid": "2c19914ff7e69a85b50f481df096693f", "score": "0.54677534", "text": "def crud_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n first = attrs.shift\n plain_table_or_message(entries, options) do |t|\n t.attr_with_show_link(first) if first\n t.sortable_attrs(*attrs)\n yield t if block_given?\n standard_table_actions(t)\n end\n end", "title": "" }, { "docid": "077d02cc9343925a1dacceff58235abd", "score": "0.54625577", "text": "def crud_table(*attrs, &block)\n options = attrs.extract_options!\n attributes = (block_given? || attrs.present?) ? attrs : default_attrs\n first = attributes.shift\n table(entries, options) do |t|\n col_show(t, first) if first\n t.sortable_attrs(*attributes)\n yield t if block_given?\n add_table_actions(t)\n end\n end", "title": "" }, { "docid": "88b96c349f1a02b49c377c5aada4cc79", "score": "0.5437721", "text": "def call(form, opts, &block)\n attr = opts[:attr] ? opts[:attr].dup : { :class=>'table table-bordered'}\n form.tag(:table, attr) do\n if legend = opts[:legend]\n form.tag(:caption, opts[:legend_attr], legend)\n end\n\n if (labels = opts[:labels]) && !labels.empty?\n form.tag(:tr, {}, labels.map{|l| form._tag(:th, {}, l)})\n end\n\n yield\n end\n end", "title": "" }, { "docid": "70a9fcbef1fb6ec6a8f51608244c2c8b", "score": "0.5403677", "text": "def with_fields_for_options( direct_callers_proc, record_or_name_or_array, args, original_callers_proc)\n options = args.detect { |argument| argument.is_a?(Hash) }\n if options.nil? # if caller didn't send options, append our own Hash\n options = {}\n args << options\n end\n options.reverse_merge! :controls => true, :scaffold => true # defaults\n controls = options.delete(:controls)\n scaffold = options.delete(:scaffold)\n builder = ( controls ? AirBlade::AirBudd::FormBuilder : AirBlade::AirBudd::DivBuilder)\n builder = ( returning( Class.new( builder ) ) { |c| \n c.wrapper_class = AirBlade::AirBudd::EmptyWrapper } ) unless scaffold\n options[:builder] = builder\n direct_callers_proc.call builder, controls, scaffold, record_or_name_or_array, args, original_callers_proc\n end", "title": "" }, { "docid": "41f58283d3b259b6ffbfe690a98dba1e", "score": "0.5400361", "text": "def field *args, &block\n type, name, options = _extract_field_args(args)\n out = ''.html_safe\n\n input_options = {}\n input_args = []\n\n unless options[:autocomplete].nil?\n options.delete(:autocomplete)\n input_options[:autocomplete] = 'off'\n end\n\n unless options[:placeholder].nil?\n input_options[:placeholder] = if (placeholder = options.delete(:placeholder)) == true then name.to_s.humanize else placeholder end\n end\n\n unless options[:hidden].nil?\n input_options[:class] = 'hidden' if options[:hidden] == true\n end\n\n unless options[:required].nil?\n input_options[:required] = 'required' if options[:required] == true\n end\n\n unless options[:choices].nil?\n input_args << options[:choices]\n end\n\n out.concat options[:prepend] if options[:prepend]\n\n\n label_html = label(name, options[:label], class: 'control-label')\n\n out.concat label_html if options[:label] && options[:label_first]\n\n if options[:help_text]\n help_text = send(\"#{name}_help_text\")\n help_html = %Q(<a class=\"tipsy\" title=\"#{help_text}\" href=\"#\">learn more</a>).html_safe\n out.concat help_html\n end\n\n out.concat(@template.content_tag(:div, class: \"controls #{type}\") do\n merged_input_args = input_args << input_options\n controls = send(_field_types(type), name, *merged_input_args)\n controls.concat @template.content_tag(:div, options[:help_block], class: 'help-block') if options[:help_block].present?\n controls\n end)\n\n out.concat label_html if options[:label] && !options[:label_first]\n\n out.concat options[:append] if options[:append]\n out.concat yield if block_given?\n\n if options[:wrap_field]\n field_wrapper(type, name) { out }\n else\n out\n end\n end", "title": "" }, { "docid": "e333f81fe3439bb1b6ffda0dc4a68d82", "score": "0.5396643", "text": "def template_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n form_for(record_or_name_or_array,\n *(args << options.merge(:builder => TemplateFormBuilder)), &proc)\n end", "title": "" }, { "docid": "44ff614c879fe456e0695e746b320460", "score": "0.5385943", "text": "def remote_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n \n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(record_or_name_or_array)\n apply_form_for_options!(object, options)\n args.unshift object\n end\n \n result = ''\n result << form_remote_tag(options)\n result << fields_for(object_name, *(args << options), &proc)\n result << '</form>'.html_safe\n \n if block_called_from_erb?(proc)\n concat result\n else\n result\n end\n \n end", "title": "" }, { "docid": "1583ef42d5fa125001f7aa4fdf5b0d94", "score": "0.538304", "text": "def inputs_for_nested_attributes(*args, &block) #:nodoc:\n options = args.extract_options!\n args << options.merge!(:parent => { :builder => self, :for => options[:for] })\n\n fields_for_block = if block_given?\n raise ArgumentError, 'You gave :for option with a block to inputs method, ' <<\n 'but the block does not accept any argument.' if block.arity <= 0\n lambda do |f|\n contents = f.inputs(*args){ block.call(f) }\n template.concat(contents)\n end\n else\n lambda do |f|\n contents = f.inputs(*args)\n template.concat(contents)\n end\n end\n\n fields_for_args = [options.delete(:for), options.delete(:for_options) || {}].flatten\n semantic_fields_for(*fields_for_args, &fields_for_block)\n end", "title": "" }, { "docid": "7c61bdf7598bb2502c58297582d68c2c", "score": "0.5368971", "text": "def fields_for(name, attrs = {}, &blk)\n attrs ||= {}\n with_form_context(name, attrs.delete(:builder)) do\n capture(&blk)\n end\n end", "title": "" }, { "docid": "07b985837600b049ff51ba5404907a5b", "score": "0.5340786", "text": "def form(attr={}, &block)\n tag(:form, attr, method(:hidden_form_tags), &block)\n end", "title": "" }, { "docid": "d92c98b326c4696920e21e7c7a6dffc7", "score": "0.53404707", "text": "def manageable_attributes(record, options = {}, &block)\n options[:html] ||= {}\n\n html_class = [ \"attrtastic\", record.class.to_s.underscore, options[:html][:class] ].compact.join(\" \")\n\n output = tag(:div, { :class => html_class}, true)\n if block_given?\n output << capture(Helpers::AttributesBuilder.new(record, self), &block)\n else\n output << capture(Helpers::AttributesBuilder.new(record, self)) do |attr|\n attr.attributes\n end\n end\n output.safe_concat(\"</div>\")\n end", "title": "" }, { "docid": "e5569ef71460acf981a5a3dfeed32a65", "score": "0.53374714", "text": "def lm_fields_for(name, *args, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.last.is_a?(Hash) ? args.pop : {}\n options = options.merge(:builder => LMFormBuilder)\n object = args.first\n yield((options[:builder] || FormBuilder).new(name, object, self, options, block))\n end", "title": "" }, { "docid": "d033df4b013ee142f489337875239ccc", "score": "0.53315943", "text": "def standard_form name, object, &block\n url = { :action => object.new_record? ? \"index\" : \"show\" }\n html = { :class => \"standard\",\n :style => (@edit_on ? '' : \"display: none;\"),\n :multipart => true }\n concat form_tag(url, html) + \"<fieldset>\", block.binding\n concat '<input name=\"_method\" type=\"hidden\" value=\"put\" />', block.binding unless object.new_record?\n yield LabelingFormBuilder.new(name, object, self, {}, block)\n concat \"</fieldset>\" + end_form_tag, block.binding\n end", "title": "" }, { "docid": "f4b6b1e1568c7f5cce1b25d021993085", "score": "0.5321738", "text": "def fields_for(record_or_name_or_array, *args, &block) #:nodoc:\n opts = args.extract_options!\n opts.merge!(:builder => Transit::Builders::FormBuilder)\n args.push(opts)\n super(record_or_name_or_array, *args, &block)\n end", "title": "" }, { "docid": "877a0687f75e94809c62d02f864332e3", "score": "0.52812445", "text": "def form(*args, &block)\n options = args.extract_options!.to_options!\n\n model = args.first\n\n if model.respond_to?(:persisted)\n model = args.first\n\n options[:html] = (options[:html] || {}).merge!(form_attrs!(options))\n\n if options[:url].blank?\n options[:url] = url_for(:action => (model.persisted? ? :update : :create))\n end\n\n if model.respond_to?(:form_builder)\n options[:builder] = model.form_builder\n end\n\n form_for(model, options, &block)\n else\n if args.empty?\n action = options.delete(:action) || request.fullpath\n args.unshift(action)\n end\n\n options.merge!(form_attrs(options))\n\n args.push(options)\n\n form_tag(*args, &block)\n end\n end", "title": "" }, { "docid": "7c6c3382d0dfcd99713f31c8e61c1fe7", "score": "0.5267581", "text": "def crud_table(*attrs, &block)\n if block_given?\n list_table(*attrs, &block)\n else\n attrs = attrs_or_default(attrs) { default_attrs }\n list_table(*attrs) do |t|\n add_table_actions(t)\n end\n end\n end", "title": "" }, { "docid": "27a418b1aa2357a8bff2c4e811fe1052", "score": "0.5251031", "text": "def f_form_with(**options, &block)\n options[:builder] = FormattedFormBuilder\n form_with(**options, &block)\n end", "title": "" }, { "docid": "b354dc50704434fa7a45bf962c4a03eb", "score": "0.5238862", "text": "def facebook_form_for( record_or_name_or_array,*args, &proc)\n\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.last.is_a?(Hash) ? args.pop : {}\n\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!([object], options)\n args.unshift object\n end\n method = (options[:html]||{})[:method]\n options[:builder] ||= Facebooker::Rails::FacebookFormBuilder\n editor_options={}\n \n action=options.delete(:url)\n editor_options[:action]= action unless action.blank?\n width=options.delete(:width)\n editor_options[:width]=width unless width.blank?\n width=options.delete(:labelwidth)\n editor_options[:labelwidth]=width unless width.blank?\n\n concat(tag(\"fb:editor\",editor_options,true) , proc.binding)\n concat(tag(:input,{:type=>\"hidden\",:name=>:_method, :value=>method},false), proc.binding) unless method.blank?\n fields_for( object_name,*(args << options), &proc)\n concat(\"</fb:editor>\",proc.binding)\n end", "title": "" }, { "docid": "d96cead983904c06feda72a3ef849f48", "score": "0.5232525", "text": "def form_assistant_for(record_or_name_or_array, *args, &proc)\n form_for_with_builder(record_or_name_or_array, RPH::FormAssistant::FormBuilder, *args, &proc)\n end", "title": "" }, { "docid": "91f095b838cc6227c5096ef46159f920", "score": "0.5225088", "text": "def fields_for_with_form_assistant(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n # hand control over to the original #fields_for()\n fields_for_without_form_assistant(record_or_name_or_array, *(args << options.merge!(:builder => self.class)), &proc)\n end", "title": "" }, { "docid": "0a351a16102a8816d6e015577843339d", "score": "0.5222483", "text": "def render_crud_form_field(column, item, locals)\n locals = locals.merge({:item => item, :column => column})\n\n if param(column,:grouped_select)\n return content_tag(\n \"select\",\n tag(\"option\", :value => \"\") + grouped_options_for_select(param(column,:grouped_select), @item.send(column[:name])),\n :id => \"#{@singular.underscore}_#{column[:name]}\",\n :name => \"#{@singular.underscore}[#{column[:name]}]\"\n )\n elsif param(column,:select)\n locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n else\n type = param(column, :type, (item.attributes.include?(column[:name].to_s) ? item.column_for_attribute(column[:name]).type : \"other\")).to_s\n type = 'other_record' if param(column, :type, '') == '' && item.respond_to?(column[:name].to_s+\"_id\") && (attribute_class(column).respond_to?(:find) || column.include?(:find_class))\n locals = locals.merge({:type => type})\n\n if class_exists?('Lico::AutoCrud::Types::' + type.classify)\n return get_class('Lico::AutoCrud::Types::' + type.classify).to_input(item, column[:name], locals[:f], locals[:params])\n end\n \n return case type.to_sym\n when :boolean then locals[:f].check_box(column[:name], :class => 'in_boolean')\n when :country_select then locals[:f].localized_country_select(\n column[:name].to_s,\n [:NL, :BE, :LU, :FR, :DE],\n { :include_blank => '' },\n param(column, :params, { }).merge({ :class => 'in_country_select' })\n )\n when :currency then number_to_currency(0, :format => \"%u\") + \"&nbsp;\".html_safe + locals[:f].text_field(column[:name], :class => 'in_currency', :style => 'text-align: right', :value => number_to_currency(@item.send(column[:name]).to_f, :separator => \".\", :delimiter => \"\", :format => \"%n\"))\n when :custom then send(\"input_for_#{@singular.underscore}_#{column[:name].to_s}\", locals[:f], item)\n when :date then locals[:f].date_select(column[:name], param(column, :options, {}),{ :class => 'in_date' })\n when :time then locals[:f].time_select(column[:name], param(column, :options, {}),{ :class => 'in_time' })\n when :datetime then locals[:f].datetime_select(column[:name], :minute_step => 15, :class => 'in_datetime')\n when :file then locals[:f].file_field(column[:name], :class => 'in_file')\n when :hidden then locals[:f].hidden_field(column[:name], param(column, :params, { }).merge({:class => 'in_hidden'}))\n when :no_input then @item.send(column[:name])\n when :other_record then\n find_class = column.include?(:find_class) ? column[:find_class] : attribute_class(column)\n find_conditions = column[:conditions]\n find_items = find_class.find(:all, :select => param(column, :select, nil), :joins => param(column, :joins, []), :include => param(column, :include, []), :conditions => find_conditions).collect do |element| \n [ element.to_s, element.id ]\n end\n locals[:f].select(\"#{column[:name].to_s}_id\", find_items, { :include_blank => true }.merge(param(column, :options, {})))\n when :paperclip then\n item.send(column[:name].to_s).nil? ? \n # no image\n locals[:f].file_field(column[:name], :class => 'in_paperclip') :\n\n # with image\n image_tag(item.send(column[:name].to_s, param(column, :size))) +\n content_tag(\n \"div\", \n t('paperclip.upload_new') + \" \" + locals[:f].file_field(column[:name], :class => 'in_paperclip') +\n content_tag(\n \"div\",\n locals[:f].check_box(\"#{column[:name]}_delete\") +\n locals[:f].label(\"#{column[:name]}_delete\", t('paperclip.select_unlink'))\n )\n )\n when :password then locals[:f].password_field(column[:name], :class => 'in_password')\n when :select then locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n when :textarea then locals[:f].text_area(column[:name], {:class => 'in_textarea'}.merge(param(column, :params, { })))\n else\n locals[:f].text_field(column[:name], param(column, :params, { }).merge({:class => 'in_' + type}))\n end\n end\n end", "title": "" }, { "docid": "861e3c3078be9352a7319409021fb0f5", "score": "0.5194768", "text": "def facebook_form_for( record_or_name_or_array,*args, &proc)\n\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.last.is_a?(Hash) ? args.pop : {}\n\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!([object], options)\n args.unshift object\n end\n method = (options[:html]||{})[:method]\n options[:builder] ||= Facebooker::Rails::FacebookFormBuilder\n editor_options={}\n \n action=options.delete(:url)\n editor_options[:action]= action unless action.blank?\n width=options.delete(:width)\n editor_options[:width]=width unless width.blank?\n width=options.delete(:labelwidth)\n editor_options[:labelwidth]=width unless width.blank?\n\n concat(tag(\"fb:editor\",editor_options,true) , proc.binding)\n concat(tag(:input,{:type=>\"hidden\",:name=>:_method, :value=>method},false), proc.binding) unless method.blank?\n concat(token_tag, proc.binding)\n fields_for( object_name,*(args << options), &proc)\n concat(\"</fb:editor>\",proc.binding)\n end", "title": "" }, { "docid": "6e04b258263ce49c4cbac1e59da9d6c0", "score": "0.5188512", "text": "def formula_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n options[:builder] ||= @@builder\n form_for(record_or_name_or_array, *(args << options), &proc)\n end", "title": "" }, { "docid": "b7b8a6dc572ca5b104e54bb2c5fb27aa", "score": "0.5172324", "text": "def form_assistant_for(record_or_name_or_array, *args, &proc)\n form_for_with_builder(record_or_name_or_array, RPH::FormAssistant::FormBuilder, *args, &proc)\n end", "title": "" }, { "docid": "876e917d22d6c52c11e5c3b2c90211c7", "score": "0.5164735", "text": "def form_element(*args, &block)\n content, options = filter_tag_args(*args)\n options[:class] = if dom_class = options.delete(:class)\n \"fieldRow #{dom_class}\"\n else \n \"fieldRow\"\n end\n if block_given? && !content\n concat content_tag(:dl, capture(&block), options)\n else\n content_tag(:dl, content, options)\n end\n end", "title": "" }, { "docid": "15069de2ee7bb125c0d43e99f1f3eb19", "score": "0.51635057", "text": "def form_for(name, attrs = {}, &blk)\n with_form_context(name, attrs.delete(:builder)) do\n current_form_context.form(attrs, &blk)\n end\n end", "title": "" }, { "docid": "262197ea2750c1034893a3691cc7e741", "score": "0.51395386", "text": "def form_tag( *args)\n options = args.extract_options!\n record_or_name_or_array = self.object\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n template.apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n template.apply_form_for_options!([object], options)\n args.unshift object\n end\n options[:html] ||= {}\n options[:html][:novalidate] = :novalidate\n begin_form = template.form_tag(options.delete(:url) || {}, options.delete(:html) || {})\n template.content_for(:begin_form) { begin_form }\n template.content_for( :end_form) { template.raw('</form>') }\n end", "title": "" }, { "docid": "494499b0607bbc7c0a6810166a00f083", "score": "0.5136701", "text": "def render\n return '' if values.blank? && !options[:include_empty]\n\n markup = %(<tr><th>#{label}</th>\\n<td><ul class='tabular'>\\n)\n\n attributes = microdata_object_attributes(field).merge(class: \"attribute attribute-#{field}\")\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"field=#{field}\",\n \"values=#{values}\",\n \"options=#{options}\",\n \"attributes=#{attributes}\",\n \"\" ] if creator_attribute_renderer_debug_verbose\n attributes.delete(:itemscope) # remove :itemscope\n attributes.delete(:itemtype) # remove :itemtype\n if values.count <= 5\n markup += Array(values).map do |value|\n %(<li#{html_attributes(attributes)}>#{attribute_value_to_html(value.to_s)}</span></li>)\n end.join(\"\\n\")\n else\n markup += %(<li#{html_attributes(attributes)}>#{creators_compact}</li>)\n end\n\n markup += %(\\n</ul></td></tr>)\n\n markup.html_safe\n end", "title": "" }, { "docid": "3743c6419584667b1554cdc7bcd293a1", "score": "0.512661", "text": "def ar_form_for new_or_edit, builder\n result= \"\\n\"\n \n if new_or_edit != :new && @resource.has_attribute?(:lock_version)\n result << content_tag(:dd, builder.hidden_field(:lock_version)) << \"\\n\"\n end\n\n controller.ardata.hidden_fields.each do |hidden_attr|\n result << content_tag(:dd, builder.hidden_field(hidden_attr)) << \"\\n\"\n end\n\n collection= controller.ardata.fields.send(\"for_#{new_or_edit}\")\n \n collection.each do |column, title|\n # This skips the selection of a parent on create if the parent is present (because if the resource\n # is child of a known parent the value for the parent_id is already known.\n next if new_or_edit == :new && controller.ardata.is_column_for_current_parent(column, @parent_resource)\n\n label= ar_get_index_label(title)\n\n # Only display the field if it's not empty. This is usefull when the label\n # is built from a proc: you can decide wheter to show the field or not by \n # returning and empty label for the attribute based on certain condition.\n if label && !label.strip.empty?\n field= ar_form_method(builder, @resource, column, controller.ardata)\n result << \"#{content_tag(:dt, label)}\\n #{content_tag(:dd, field)}\\n\"\n end\n end\n\n label_key_for_submit= new_or_edit == :new ? :create : :update\n result << content_tag(:dt, submit_tag(controller.ardata.labels[label_key_for_submit])) << \"\\n\"\n \n content_tag :dl, result\n end", "title": "" }, { "docid": "d4489dfd70eb4f6eb42931b16c320ab1", "score": "0.5117705", "text": "def inputs(*args, &block)\n title = field_set_title_from_args(*args)\n html_options = args.extract_options!\n html_options[:class] ||= \"inputs\"\n html_options[:name] = title\n \n if html_options[:for] # Nested form\n inputs_for_nested_attributes(*(args << html_options), &block)\n elsif block_given?\n field_set_and_list_wrapping(*(args << html_options), &block)\n else\n if @object && args.empty?\n args = self.association_columns(:belongs_to)\n args += self.content_columns\n args -= RESERVED_COLUMNS\n args.compact!\n end\n legend = args.shift if args.first.is_a?(::String)\n contents = args.collect { |method| input(method.to_sym) }\n args.unshift(legend) if legend.present?\n \n field_set_and_list_wrapping(*((args << html_options) << contents))\n end\n end", "title": "" }, { "docid": "216c14ffa45975e6ace4a5cb3e4b3485", "score": "0.5098053", "text": "def remote_formfu_for(record_or_name_or_array, *args, &block) \n raise ArgumentError, \"Missing block\" unless block_given?\n \n options = args.extract_options!\n args << options.merge(:builder => FormFu::FormBuilder)\n remote_form_for(record_or_name_or_array, *args, &block)\n \n end", "title": "" }, { "docid": "35f155ed1aebfc3d684dbd8af5f08d34", "score": "0.50960004", "text": "def object( controls, scaffold, is_remote, record_or_name_or_array, *args, &proc)\n raise ArgumentError, \"Missing block\" unless block_given?\n\n options = args.extract_options!\n\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n @template.apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n @template.apply_form_for_options!([object], options)\n args.unshift object\n end\n\n wrapper_start( controls, scaffold, is_remote, options, object_name, &proc)\n @template.fields_for(object_name, *(args << options), &proc)\n wrapper_end( controls, scaffold, &proc)\n end", "title": "" }, { "docid": "f4cbc60324253252aab41271b3976d4c", "score": "0.50884247", "text": "def daisy_form_with(**args, &block)\n form_with(**args.merge(builder: FormBuilder), &block)\n end", "title": "" }, { "docid": "29dc5d1d9f5a0bdb53b3cbeb34d7ab04", "score": "0.5017967", "text": "def scaffold_field_tag(field_type, options, object=nil, field=nil, record_name=nil, field_id=nil)\n options[:name] ||= options[:id] if options[:id]\n value = options[:value] || object.scaffold_value(field)\n case field_type\n when :text\n \"<textarea #{scaffold_options_to_html(options)}>#{h value.to_s}</textarea>\"\n when :boolean\n s = {value=>\"selected='selected'\"}\n \"<select #{scaffold_options_to_html(options)}><option></option><option value='f' #{s[false]}>False</option><option value='t' #{s[true]}>True</option></select>\"\n when :association\n klass = object.class\n if klass.scaffold_association_use_auto_complete(field)\n assocated_object = klass.scaffold_associated_objects(field, object, :session=>scaffold_session)\n options[:value] = assocated_object ? assocated_object.scaffold_name_with_id : ''\n scaffold_text_field_tag_with_auto_complete(options[:id], record_name, field, options)\n else\n s = {object.scaffold_value(field_id).to_i=>\"selected='selected'\"}\n associated_objects = klass.scaffold_association_find_objects(field, :session=>scaffold_session, :object=>object)\n \"<select #{scaffold_options_to_html(options)}><option></option>#{associated_objects.collect{|ao| \"<option value='#{i = ao.scaffold_id}' #{s[i]}>#{h ao.scaffold_name}</option>\"}.join}</select>\"\n end\n else\n options[:type] = :text\n case field_type\n when :submit, :password, :hidden, :file\n options[:size] ||= 30 if field_type == :password \n options[:type] = field_type\n when :date, :integer, :float\n options[:size] ||= 10\n else\n options[:size] ||= 30\n end\n options[:value] ||= value\n \"<input #{scaffold_options_to_html(options)} />\"\n end\n end", "title": "" }, { "docid": "0e4825dd5745d293d8489c98ee1dd6d3", "score": "0.50010437", "text": "def scaffold_model_form(action, fields, &block)\n content = ''\n options = {}\n options[:id] = @scaffold_object.scaffold_id if action=='update'\n <<-END\n #{scaffold_model_error_messages}\n #{scaffold_form(scaffold_url(\"#{action}#{@scaffold_suffix}\", options), :attributes=>scaffold_form_enctype(fields))}\n #{scaffold_model_field_tags(fields)}\n #{(yield content; content) if block_given?}\n <input type='submit' value=\"#{@scaffold_submit_value || \"#{action.capitalize} #{@scaffold_options[:singular_lc_human_name]}\"}\" />\n </form>\n END\n end", "title": "" }, { "docid": "3203c64708ec33dfc5a828aa51e4d613", "score": "0.4978415", "text": "def field_for(attribute, options = {})\n is_view_mode = options.include?(:view_mode) ? options[:view_mode] :\n (self.options[:view_mode] == true)\n input_tag = input_tag_for(options[:as_type] ||\n options[:real_attribute] ||\n attribute)\n is_checkbox = input_tag == :check_box\n input_class = ''\n input_class << 'form-control' unless is_checkbox\n input_class << ' view-mode' if is_view_mode\n readonly = options.include?(:readonly) ? options[:readonly] : false\n label_text = options.include?(:label) ? options[:label] : nil\n include_blank = options.include?(:include_blank) ? options[:include_blank]\n : false\n prompt = options.include?(:prompt) ? options[:prompt] : false\n value = options.include?(:value) ? options[:value]\n : object.try(attribute)\n hint_text = options.get(:hint, :text) || options[:hint]\n hint_hidden = options.get(:hint, :hidden).to_b\n\n if @object\n label_text ||= @object.class.human_attribute_name(attribute)\n t_key_base_placeholder = \"activerecord.placeholders.#{object.class.name.downcase}\"\n else\n t_key_base = \"controllers.#{@template.controller_name}\" +\n \".#{@template.action_name}\"\n label_text ||= I18n.t(\"#{t_key_base}.attributes.#{attribute}\")\n t_key_base_placeholder = \"#{t_key_base}.placeholders\"\n end\n\n unless is_checkbox\n unless placeholder = options[:placeholder].not_blank\n t_key_placeholder = (options[:placeholder_t_key] || attribute)\n placeholder = I18n.t(\"#{t_key_base_placeholder}\" +\n \".#{t_key_placeholder}\")\n end\n end\n\n\n if is_checkbox\n # NOTE: HTML structure of a checkbox in bootstrap:\n # <div class=\"checkbox\">\n # <label>\n # <input type=\"checkbox\"> Check me out\n # </label>\n # </div>\n\n @template.content_tag :div, class: 'checkbox' do\n @template.concat( label(attribute, disabled: is_view_mode) do\n @template.concat check_box(attribute,\n class: input_class,\n disabled: is_view_mode || readonly,\n checked: value)\n @template.concat label_text\n end)\n end\n\n else\n # SOURCE: https://robots.thoughtbot.com/nesting-content-tag-in-rails-3\n @template.content_tag :div, class: 'form-group' do\n @template.concat( label(attribute, class: 'control-label') do\n @template.concat label_text\n if !is_view_mode && @object.try(:required_attribute?, attribute)\n @template.concat REQUIRED_ATTRIBUTE_MARK\n end\n end)\n if input_tag == :select\n if is_view_mode\n # NOTE: In a :select the value is a html string with the <option>\n # tags. We have to extract the selected one with a regexp.\n # SOURCE: http://stackoverflow.com/a/519593\n # DOC: http://ruby-doc.org/core-2.5.1/String.html#method-i-5B-5D-3D\n selected_value = value[SELECTED_OPTION_VALUE_REGEXP, \"selected\"]\n @template.concat text_field(attribute,\n value: selected_value,\n class: input_class,\n readonly: readonly,\n disabled: true)\n else\n @template.concat select(attribute,\n value,\n class: input_class,\n readonly: readonly,\n include_blank: include_blank,\n prompt: prompt,\n autofocus: options[:autofocus],\n disabled: is_view_mode)\n end\n else\n @template.concat send(input_tag, attribute,\n class: input_class,\n placeholder: placeholder,\n readonly: readonly,\n value: value,\n type: options[:input_type],\n autofocus: options[:autofocus],\n disabled: is_view_mode)\n end\n unless hint_text.blank?\n classes = 'help-block'\n classes << ' hidden' if hint_hidden\n @template.concat(@template.content_tag(:span, class: classes,\n id: \"hint-for-#{attribute.to_s}\") do\n hint_text\n end)\n end\n end\n end\n end", "title": "" }, { "docid": "e0aefabe4a1a42dcdc11560eb94acac0", "score": "0.49605674", "text": "def form_wow_row *args, &block\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n content = block_given? ? capture(&block) : args.shift\n label = args.shift\n\n ## label\n\n if label\n req_symbol = nil\n if options[:required]\n req_symbol = options[:required_symbol] || FormWow.required_symbol\n req_symbol = content_tag('span', req_symbol, :class => 'required_symbol')\n end\n label = [req_symbol, label].join.html_safe\n label = content_tag('label', label, :class => 'row_label', :for => options[:label_for])\n end\n\n ## hint\n \n if hint = options[:hint]\n hint = content_tag('label', hint, :class => 'hint', :for => options[:label_for])\n end\n\n ## error message\n\n if error = options[:error]\n error = content_tag('p', error, :class => 'error')\n end\n\n ## form row div\n\n css = []\n css << 'invalid' if options[:error] \n css << 'required' if options[:required] \n css << options[:class] if options[:class] \n css << FormWow.default_form_row_class\n\n parts = [label, content, error, hint]\n row = content_tag('div', parts.join.html_safe, :id => options[:id], :class => css.join(' '))\n\n # return / output the form row div\n\n if block_given?\n concat(row)\n else\n row\n end\n end", "title": "" }, { "docid": "837ac458d744234f420d862948d8d415", "score": "0.49517453", "text": "def fields_for(record_or_name_or_array, *args, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.extract_options!\n \n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n object = args.first\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n end\n \n builder = options[:builder] || ActionView::Base.default_form_builder\n # to_s is required because capture result might be buffer object (which is not necessarily a string)\n result = capture(builder.new(object_name, object, self, options, block), &block).to_s\n \n if block_called_from_erb?(block)\n concat result\n else\n result\n end\n \n end", "title": "" }, { "docid": "8e1e5f0e82f9a2ead8b78b0878a034c5", "score": "0.49279603", "text": "def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end", "title": "" }, { "docid": "2faae7eb0a0d2a739ddc8c74dd2e2071", "score": "0.4918699", "text": "def semantic_fields_for(record_or_name_or_array, *args, &block)\n opts = args.extract_options!\n opts[:builder] ||= Formtastic::SemanticFormHelper.builder\n args.push(opts)\n fields_for(record_or_name_or_array, *args, &block)\n end", "title": "" }, { "docid": "9d43f48a5f9cb80c1b48abeeb30d972a", "score": "0.49131826", "text": "def active_scaffold_input_options(column, scope = nil, options = {})\n name = scope ? \"record#{scope}[#{column.name}]\" : \"record[#{column.name}]\"\n record = options[:object]\n\n # Add some HTML5 attributes for in-browser validation and better user experience\n if column.required?(action_for_validation?(record)) && (!@disable_required_for_new || scope.nil? || record&.persisted?)\n options[:required] = true\n end\n options[:placeholder] = column.placeholder if column.placeholder.present?\n\n # Fix for keeping unique IDs in subform\n id_control = \"record_#{column.name}_#{[params[:eid], params[:parent_id] || params[:id]].compact.join '_'}\"\n id_control += scope_id(scope) if scope\n\n classes = \"#{column.name}-input\"\n classes += ' numeric-input' if column.number?\n\n {:name => name, :class => classes, :id => id_control}.merge(options)\n end", "title": "" }, { "docid": "7b35032518378677744dd79afaa4fab2", "score": "0.49109277", "text": "def inputs_for_nested_attributes(*args, &block) #:nodoc:\n options = args.extract_options!\n args << options.merge!(:parent => { :builder => self, :for => options[:for] })\n\n fields_for_block = if block_given?\n raise ArgumentError, 'You gave :for option with a block to inputs method, ' <<\n 'but the block does not accept any argument.' if block.arity <= 0\n\n proc { |f| f.inputs(*args){ block.call(f) } }\n else\n proc { |f| f.inputs(*args) }\n end\n\n fields_for_args = [options.delete(:for), options.delete(:for_options) || {}].flatten\n semantic_fields_for(*fields_for_args, &fields_for_block)\n end", "title": "" }, { "docid": "a6d8101afd1000f86d3d62a903f56b6b", "score": "0.48952514", "text": "def input_field_wrapper(attr, options = {}, html_options = nil, &block)\n label_text = options.delete :label\n @label_html = label_html_for attr, label_text, class: 'text-right middle'\n @input_html = input_html_for attr, options, html_options, &block\n @help_html = help_html_for attr, options\n @errors_html = errors_html_for attr\n\n if @inside_input_group\n @input_html\n elsif @label_html\n labeled_input = columnize @label_html, input_with_errors\n @inside_row ? labeled_input : row { labeled_input }\n else\n input_with_errors\n end\n end", "title": "" }, { "docid": "830f957b09688ab0621e678eeeed680c", "score": "0.48929837", "text": "def form_for_with_builder(record_or_name_or_array, builder, *args, &proc)\n options = args.extract_options!\n # hand control over to the original #form_for()\n form_for(record_or_name_or_array, *(args << options.merge!(:builder => builder)), &proc)\n end", "title": "" }, { "docid": "f6c5242cdd6d91311dbb81c39bca66da", "score": "0.48883194", "text": "def show_attribute_outside_form(resource, attribute, options=nil, &block)\n if is_date?(resource, attribute)\n resource.send(attribute) # TODO: add the controversial abbr method here, or just use title\n elsif is_document?(resource, attribute)\n if is_document_empty?(resource, attribute)\n t(:no_document)\n else\n if is_image?(resource, attribute)\n image_style = (options.nil? || options[:image_style].nil?)? :thumb : options[:image_style]\n image_tag(resource.send(attribute).url(image_style))\n else\n link_to(resource.send(\"#{attribute}_file_name\"), resource.send(attribute).url)\n end\n end\n else\n yield\n end\n end", "title": "" }, { "docid": "6f773965ea15bff032a66ce566100398", "score": "0.4882133", "text": "def ar_standard_form_method form, resource, attribute\n # I use instance_variable_get to avoid deprecation of \"type\" warning\n case resource.column_for_attribute(attribute).instance_variable_get(\"@type\")\n when :text\n form.text_area(attribute) \n when :binary, :boolean\n form.check_box(attribute)\n else\n #when :string, :integer, :float, :decimal\n #when :datetime, :timestamp, :time, :date\n form.text_field(attribute)\n end\n end", "title": "" }, { "docid": "b14b0ada43258c2b46df489790375208", "score": "0.48785666", "text": "def rails_form_for(object, options = {}, &block)\n options = { builder: RailsFormBuilder }.merge(options)\n form_for(object, options, &block)\n end", "title": "" }, { "docid": "d5ee3cdfec277ca9904f6590016d826c", "score": "0.4869801", "text": "def element_form(context={}, aspect_model)\n \n app = context[:app]\n\n if resource.can_write?(app.user) and (not app.user.belongs_to?(Users::Group.get('anonymous')))\n renderer = ::UI::FieldSetRender.new('resourceaccesscontrol', app) \n renderer.render('form', 'em') \n else \n ''\n end\n\n end", "title": "" }, { "docid": "7de4a59996c2654a356c3ba655aec6e1", "score": "0.48649272", "text": "def ar_form_method form, resource, attribute, controller_ardata\n # Check if attribute is indeed a model relation foreign key\n case attribute\n when String, Symbol\n attr= attribute.to_s\n if controller_ardata.foreing_models.include? attr\n model= controller_ardata.foreing_models[attr]\n # because the attribute is a foreing key, build a select tag + options \n # by looking in the related model\n ar_model_foreign_key_select resource, model, attr\n else\n # Attribute is not a fk, use a simple input field.\n ar_standard_form_method form, resource, attribute\n end\n else\n ar_retrieve_field_value attribute, resource, {:form => form}\n end\n end", "title": "" }, { "docid": "86731489b6ba923b92d36ab2b289a319", "score": "0.48608044", "text": "def form_for_with_builder(record_or_name_or_array, builder, *args, &proc)\n options = args.extract_options!\n # hand control over to the original #form_for()\n form_for(record_or_name_or_array, *(args << options.merge!(:builder => builder)), &proc)\n end", "title": "" }, { "docid": "31bc7726cb96ab79f19f3bdf40657498", "score": "0.48606607", "text": "def scaffold_form(url, options={})\n meth = options.delete(:method) || :post\n \"<form action='#{url}' method='#{meth}' #{options[:attributes]}>#{scaffold_token_tag if meth.to_s == 'post'}\"\n end", "title": "" }, { "docid": "4198901b549aaf50e32a13b51ac843e9", "score": "0.48451623", "text": "def table_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n\n content_tag :table,\n form_for(record_or_name_or_array,\n *(args << options.merge(:builder => TableFormBuilder)), &proc)\n end", "title": "" }, { "docid": "5ee9fb263fb098af3e7f1a5b397d7fbb", "score": "0.48429677", "text": "def wrap_block(method, options = {}, &block)\n # content = capture(&block)\n concat(tag('div', {:class => 'irow', :id => \"irow_#{@object_name}_#{method}\"}), block.binding)\n concat(label_for_field(method, options), block.binding)\n concat(tag('div', {:class => 'input'}), block.binding)\n yield self\n concat(cr, block.binding)\n concat('</div>', block.binding)\n concat('</div>', block.binding)\n end", "title": "" }, { "docid": "2cee1c4034a4ecc76f50d6a5b924ef49", "score": "0.48369417", "text": "def add_form_element(obj = nil, method = 'attribute', options = {}, html_options = {})\n type = options[:type] || 'text'\n type = nil unless %w(file text hidden textarea password select checkbox).include?(type)\n label = options[:label] || method.humanize.titleize\n\n description = options[:description]\n\n html_options[:class] = \"#{type} form_elem #{html_options[:class]}\"\n label_for = if html_options.key?(:id)\n html_options[:id]\n else\n \"#{obj}_#{method}\"\n end\n\n element = case type\n when 'text'\n text_field(obj, method, html_options)\n when 'hidden'\n hidden_field(obj, method, html_options)\n when 'textarea'\n text_area(obj, method, html_options)\n when 'password'\n password_field(obj, method, html_options)\n when 'select'\n select_options = options[:select_options]\n selected = options[:selected]\n include_blank = options[:include_blank]\n\n select(obj, method, select_options, { selected: selected, include_blank: include_blank }, html_options)\n when 'checkbox'\n if [true, 'true', 1, '1'].include?(html_options[:value])\n html_options[:checked] = 'checked'\n else\n ''\n end\n check_box(obj, method, html_options)\n when 'file'\n file_field(obj, method, html_options)\n else\n ''\n end\n\n case type\n when 'hidden'\n element\n else\n <<-EOS.html_safe\n<div class=\"group clearfix\">\n <div class=\"row\">\n <div class=\"column grid2of5\">\n <div class=\"spacer\">\n <label for=\"#{label_for}\">#{label}<span>#{description}</span></label>\n </div>\n </div>\n\n <div class=\"column grid3of5\">\n <div class=\"#{'boxed ' unless type == 'checkbox'}spacer\">\n #{element}\n </div>\n </div>\n </div>\n</div>\n EOS\n end\n end", "title": "" }, { "docid": "0e0c10b8c29aff010ba527db816a66ca", "score": "0.48188752", "text": "def patient_form_for(record, *args, &proc)\n options = args.extract_options!\n update = { :success => options[:update], :failure => nil }\n remote_form_for(record, *(args << options.merge(:builder => PatientFormBuilder, :update => update)), &proc)\n end", "title": "" }, { "docid": "d160819538beab79be3226428eabf2da", "score": "0.48129243", "text": "def tabular_fields(form, attr, options = {})\n obj = form.object\n title = I18n.t(\"formtastic.titles.#{attr}\", :default => '')\n hint = I18n.t(\"formtastic.hints.#{obj.class.name.underscore}.#{attr}\",\n :default => '')\n outer_options = {\n :class => (obj.is_repeatable?(attr) ? 'repeatable ' : '') + 'with-table'\n }\n outer_options[:name] = title unless title.blank?\n outer_options[:name] = options[:name] if options.has_key?(:name)\n if obj.subfields(attr).blank?\n options[:label] = outer_options[:name] unless options.has_key? :label\n outer_options.delete(:name)\n end\n \n form.inputs outer_options do\n concat(content_tag('li') do\n concat(content_tag('table') do\n concat(table_header(form, attr, options))\n concat(content_tag('tbody') do\n concat(form.fields_for(\"#{attr}_items\".to_sym) do |f|\n concat(content_tag('tr') do\n form.object.subfields_for_nesting(attr).each do |field|\n as = get_option(options, field, :as) ||\n form.send(:default_input_type, field)\n concat(content_tag('td', :class => as) do\n input_options = field_options(form, attr, field, options)\n concat f.input(field, input_options)\n end)\n end\n end)\n end)\n end)\n end)\n unless hint.blank?\n concat(content_tag('p', hint, :class => 'inline-hints'))\n end\n concat(content_tag('li', form.errors_on(attr)))\n end)\n end\n end", "title": "" }, { "docid": "03e7220cd4b82b2bac0ae72ac9f2d544", "score": "0.4804454", "text": "def as_widget(widget=nil, attrs=nil, only_initial=false)\n widget ||= @field.widget\n attrs ||= {}\n auto_id = self.auto_id\n attrs[:id] ||= auto_id if auto_id && !widget.attrs.key?(:id)\n\n if [email protected]?\n data = @form.initial.fetch(@name, @field.initial)\n data = data.call if data.respond_to?(:call)\n else\n if @field.is_a?(Fields::FileField) && @data.nil?\n data = @form.initial.fetch(@name, @field.initial)\n else\n data = self.data\n end\n end\n\n name = only_initial ? @html_initial_name : @html_name\n widget.render(name.to_s, data, attrs)\n end", "title": "" }, { "docid": "9ac11c37f016da7c660f9c3d057d9318", "score": "0.4803457", "text": "def submit(value = nil, options = {}, &block)\n if value.is_a?(Hash)\n options = value\n value = nil\n end\n\n bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))\n return super if bootstrap.disabled\n\n add_css_class!(options, \"btn\")\n\n form_group_class = \"form-group\"\n form_group_class += \" row\" if bootstrap.horizontal?\n\n content_tag(:div, class: form_group_class) do\n draw_control_column(bootstrap, offset: true) do\n out = super(value, options)\n out << capture(&block) if block_given?\n out\n end\n end\n end", "title": "" }, { "docid": "5f26c0c09e943ed45fc538b896eb7fad", "score": "0.47999164", "text": "def model_form(params={})\n # {{{\n method = params[:action]\n instance = params[:instance]\n klass = params[:model]\n klass ||= @klass\n\n custom_elements = {}\n log { \"Custom Form Elements: #{custom_form_elements.inspect}\" }\n custom_form_elements.each_pair { |clause, value|\n clause_parts = clause.to_s.split('.')\n table = clause_parts[0..1].join('.')\n attrib = clause_parts[2]\n custom_elements[table] = Hash.new unless custom_elements[table]\n custom_elements[table][attrib.to_sym] = value\n }\n view = @@form_generator.new(klass)\n view.labels = Lang[plugin_name]\n view.custom_elements = custom_elements\n form = view.form\n\n form.add(GUI::Hidden_Field.new(:name => :action, :value => method.to_s, :required => true)) if method\n form.add(GUI::Hidden_Field.new(:name => :controller, :value => klass.model_name.to_s, :required => true))\n\n form_values = {}\n default_form_values.each_pair { |attrib, value|\n form_values[attrib.to_s] = value\n }\n \n if instance then\n instance.attribute_values.each { |table, args| \n args.each { |name, value|\n form_values[\"#{table}.#{name}\"] = value\n }\n }\n klass.get_primary_keys.each { |table, keys|\n keys.each { |key|\n pkey_field_name = \"#{table}.#{key}\"\n form.add(GUI::Hidden_Field.new(:name => pkey_field_name, \n :value => instance.attribute_values[table][key], \n :required => true))\n }\n }\n end\n \n if(defined? form_groups) then\n form.fields = form_groups\n end\n if(defined? form_hints) then\n form.hints = form_hints\n end\n\n form.set_values(form_values)\n\n title_key = (klass.table_name).gsub('.','--')+'--add'\n form.title = (Lang[plugin_name][title_key]) unless Lang[plugin_name][title_key] == title_key\n klassname = @klass.to_s.gsub('Aurita::','').gsub('Main::','').gsub('Plugins::','').gsub('::','__').downcase\n form.name = klassname + '_' << method.to_s + '_form'\n form.id = klassname + '_' << method.to_s + '_form'\n\n log('Update form fields: ' << form.fields.inspect)\n log('Update form elements: ' << form.element_map.keys.inspect)\n return form\n end", "title": "" }, { "docid": "5bc7ba512d18cc5875b6f04223a25459", "score": "0.47897673", "text": "def input(attribute_name, options = {}, &block)\n @attribute_name = attribute_name\n @reflection = options[:reflection]\n options[:input_html] ||= {}\n options[:input_html][:data] ||= {}\n parsley_validations = validations_for(attribute_name)\n\n options[:input_html][:data].merge!(parsley_validations)\n super\n end", "title": "" }, { "docid": "d65f3c236c4102a47283a55ef579af5f", "score": "0.47873902", "text": "def apply_form_for_options!(object_or_array, options)\n options.merge! :builder => WebSgFormBuilder\n super\n end", "title": "" }, { "docid": "11a969e45e933311bc44244c71cd8f96", "score": "0.4765084", "text": "def render\n return '' if values.blank? && !options[:include_empty]\n\n markup = []\n markup << %(<tr><th>#{label}</th>\\n<td><ul class='tabular_list'>)\n attributes = microdata_object_attributes(field).merge(class: \"attribute attribute-#{field}\")\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"attributes=#{attributes}\",\n \"\" ] if fundedby_other_attribute_renderer_debug_verbose\n\n values.each_with_index do |value, index|\n markup << %(<li#{html_attributes(attributes)}>)\n attribute_value_index_to_html(markup, value.to_s, index, values.size)\n end\n markup << %(\\n</ul></td></tr>)\n markup.join(\"\\n\").html_safe\n end", "title": "" }, { "docid": "871ca851e99ddfe3ef5344270d82e36f", "score": "0.47546473", "text": "def crud *args\n @crud = args.first if args.size > 0\n end", "title": "" }, { "docid": "3fac6350927905c5077f809d26de4c85", "score": "0.47465834", "text": "def semantic_fields_for(name, *args, &block)\n use_semantic_builder(:fields_for, name, *args, &block)\n end", "title": "" }, { "docid": "0171533356c0df8d865de0ab0898997f", "score": "0.47180688", "text": "def field_set_and_list_wrapping(*args, &block) #:nodoc:\n contents = args.last.is_a?(::Hash) ? '' : args.pop.flatten\n html_options = args.extract_options!\n\n legend = html_options.delete(:name).to_s\n legend %= parent_child_index(html_options[:parent]) if html_options[:parent]\n legend = template.content_tag(:legend, template.content_tag(:span, legend)) unless legend.blank?\n\n if block_given?\n contents = if template.respond_to?(:is_haml?) && template.is_haml?\n template.capture_haml(&block)\n else\n template.capture(&block)\n end\n end\n\n # Ruby 1.9: String#to_s behavior changed, need to make an explicit join.\n contents = contents.join if contents.respond_to?(:join)\n fieldset = template.content_tag(:fieldset,\n legend << template.content_tag(:ol, contents),\n html_options.except(:builder, :parent)\n )\n\n template.concat(fieldset) if block_given?\n fieldset\n end", "title": "" }, { "docid": "39460b2d7d2a6960b8fbbf9719a63799", "score": "0.47072127", "text": "def bp_submit(*args, &block)\n if block_given?\n \"No admite &block\"\n else\n label = args.first\n options = args.second || {}\n #options_hash = options # Para que reciba cualquier atributo (sin filtrar)\n options_hash = {}\n\n options_hash[:class] = options[:class].blank? ? \"btn\" : bp_class(\"btn #{options[:class]}\")\n\n if !options[:id].blank?\n options_hash[:id] = options[:id]\n end\n\n if options[:input_id].blank?\n input_id = options_hash[:id].blank? ? \"\" : \"input_#{options_hash[:id]}\"\n else\n input_id = options[:input_id]\n end\n\n input_hash = {}\n input_hash[:id] = input_id\n\n content_tag :div, options_hash do\n submit_tag label, input_hash\n end\n end\n end", "title": "" }, { "docid": "19b416b794caa15967ab20d2f63323e8", "score": "0.4701432", "text": "def on_html_attrs(*attrs)\n if attrs.any? { |attr| splat?(attr) }\n builder, block = make_builder(attrs)\n [:multi,\n block,\n [:dynamic, \"#{builder}.build_attrs\"]]\n else\n super\n end\n end", "title": "" }, { "docid": "310ede20f621fbdd1f16da74af3a8609", "score": "0.46831748", "text": "def generate_attribute_input(attr_label)\r\n input_html = ''.html_safe\r\n\r\n # Get the attribute hash corresponding to the given attribute\r\n attr = @metadata.select{ |attr_hash| attr_hash[\"attribute\"].to_s.eql?(attr_label) }.first\r\n\r\n if attr[\"enforce\"].include?(\"integer\")\r\n number_field :submission, attr[\"attribute\"].to_s.to_sym, value: @submission.send(attr[\"attribute\"])\r\n\r\n elsif attr[\"enforce\"].include?(\"date_time\")\r\n if @submission.send(attr[\"attribute\"]).nil?\r\n date_value = nil\r\n else\r\n date_value = DateTime.parse(@submission.send(attr[\"attribute\"])).to_date.to_s\r\n end\r\n text_field(:submission, attr[\"attribute\"].to_s.to_sym, :class => \"datepicker\", value: \"#{date_value}\")\r\n\r\n elsif attr[\"enforce\"].include?(\"textarea\")\r\n text_area(:submission, attr[\"attribute\"].to_s.to_sym, rows: 3, value: @submission.send(attr[\"attribute\"]))\r\n\r\n # Create select dropdown when there are enforcedValues for the attr. But also let the user enter its own value if Other selected\r\n elsif !attr[\"enforcedValues\"].nil?\r\n metadata_values = @submission.send(attr[\"attribute\"])\r\n select_values = attr[\"enforcedValues\"].collect{ |k, v| [v,k]}\r\n # Add in the select ontologies that are not in the portal but are in the values\r\n if metadata_values.kind_of?(Array)\r\n metadata_values.map do |metadata|\r\n if !select_values.flatten.include?(metadata)\r\n select_values << metadata\r\n end\r\n end\r\n else\r\n if (!select_values.flatten.include?(metadata_values) && !metadata_values.to_s.empty?)\r\n select_values << metadata_values\r\n end\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << select_tag(\"submission[#{attr_label}][]\", options_for_select(select_values, metadata_values), :multiple => 'true',\r\n \"data-placeholder\".to_sym => \"Select ontologies\", :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\")\r\n\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"].to_s}\", nil, :style => \"margin-left: 1em; margin-right: 1em;width: 16em;\", :placeholder => \"Or provide the value\",\r\n :onkeydown => \"if (event.keyCode == 13) { addOntoToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new value\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;vertical-align: baseline;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addOntoToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n else\r\n\r\n select_values << [\"None\", \"\"]\r\n select_values << [\"Other\", \"other\"]\r\n\r\n if metadata_values.nil?\r\n metadata_values = \"\"\r\n end\r\n\r\n input_html << select(\"submission\", attr[\"attribute\"], select_values, { :selected => metadata_values}, {:class => \"form-control\", :id => \"select_#{attr[\"attribute\"]}\", :style=> \"margin-bottom: 1em;\"})\r\n\r\n # Button and field to add new value (that are not in the select). Show when other is selected\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"].to_s}\", nil, :style => \"margin-left: 1em; margin-right: 1em;width: 16em;display: none;\", :placeholder => \"Or provide the value\",\r\n :onkeydown => \"if (event.keyCode == 13) { addValueToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new value\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;display: none;vertical-align: baseline;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addValueToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n # To show/hide textbox when other option is selected or not\r\n input_html << javascript_tag(\"$(function() {\r\n $('#select_#{attr[\"attribute\"]}').change(function() {\r\n if ($('#select_#{attr[\"attribute\"]}').val() == 'other') {\r\n $('#add_#{attr[\"attribute\"].to_s}').val(\"\");\r\n $('#btnAdd#{attr[\"attribute\"]}').show();\r\n $('#add_#{attr[\"attribute\"].to_s}').show();\r\n } else {\r\n $('#btnAdd#{attr[\"attribute\"]}').hide();\r\n $('#add_#{attr[\"attribute\"].to_s}').hide();\r\n }\r\n });\r\n })\")\r\n\r\n end\r\n\r\n\r\n return input_html\r\n\r\n\r\n elsif attr[\"enforce\"].include?(\"isOntology\")\r\n metadata_values = @submission.send(attr[\"attribute\"])\r\n select_values = @ontologies_for_select.dup\r\n # Add in the select ontologies that are not in the portal but are in the values\r\n if metadata_values.kind_of?(Array)\r\n metadata_values.map do |metadata|\r\n if !select_values.flatten.include?(metadata)\r\n select_values << metadata\r\n end\r\n end\r\n else\r\n\r\n if !select_values.flatten.include?(metadata_values)\r\n select_values << metadata_values\r\n end\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << select_tag(\"submission[#{attr_label}][]\", options_for_select(select_values, metadata_values), :multiple => 'true',\r\n \"data-placeholder\".to_sym => \"Select ontologies\", :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\")\r\n\r\n else\r\n input_html << select_tag(\"submission[#{attr_label}]\", options_for_select(select_values, metadata_values), \"data-placeholder\".to_sym => \"Select ontology\",\r\n :style => \"margin-bottom: 15px; width: 100%;\", :id => \"select_#{attr[\"attribute\"]}\", :class => \"selectOntology\", :include_blank => true)\r\n end\r\n # Button and field to add new value (not in the select)\r\n input_html << tag(:br)\r\n\r\n input_html << text_field_tag(\"add_#{attr[\"attribute\"]}\", nil, :style => \"margin-left: 1em; margin-right: 1em;vertical-align: super;width: 16em;\",\r\n :placeholder => \"Ontology outside of the Portal\", :onkeydown => \"if (event.keyCode == 13) { addOntoToSelect('#{attr[\"attribute\"]}'); return false;}\")\r\n\r\n input_html << button_tag(\"Add new ontology\", :id => \"btnAdd#{attr[\"attribute\"]}\", :style => \"margin-bottom: 2em;margin-top: 1em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addOntoToSelect('#{attr[\"attribute\"]}')\")\r\n\r\n return input_html\r\n\r\n elsif attr[\"enforce\"].include?(\"uri\")\r\n if @submission.send(attr[\"attribute\"]).nil?\r\n uri_value = \"\"\r\n else\r\n uri_value = @submission.send(attr[\"attribute\"])\r\n end\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << button_tag(\"Add new value\", :id => \"add#{attr[\"attribute\"]}\", :style => \"margin-bottom: 0.5em;margin-top: 0.5em;margin-left: 0.5em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addInput('#{attr[\"attribute\"]}', 'url')\")\r\n input_html << url_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", uri_value[0], :id => attr[\"attribute\"].to_s, class: \"metadataInput\")\r\n # Add field if list of URI\r\n if [email protected](attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n @submission.send(attr[\"attribute\"]).each_with_index do |metadata_val, index|\r\n if index != 0\r\n input_html << url_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", metadata_val, :id => \"submission_#{attr[\"attribute\"].to_s}\", class: \"metadataInput\")\r\n end\r\n end\r\n end\r\n input_html << content_tag(:div, \"\", id: \"#{attr[\"attribute\"]}Div\")\r\n\r\n else\r\n # if single value\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: uri_value, class: \"metadataInput\")\r\n end\r\n return input_html\r\n\r\n elsif attr[\"enforce\"].include?(\"boolean\")\r\n select(\"submission\", attr[\"attribute\"].to_s, [\"none\", \"true\", \"false\"], { :selected => @submission.send(attr[\"attribute\"])},\r\n {:class => \"form-control\", :style => \"margin-top: 0.5em; margin-bottom: 0.5em;\"})\r\n\r\n else\r\n # If input a simple text\r\n\r\n if attr[\"enforce\"].include?(\"list\")\r\n input_html << button_tag(\"Add new value\", :id => \"add#{attr[\"attribute\"]}\", :style => \"margin-bottom: 0.5em;margin-top: 0.5em;\",\r\n :type => \"button\", :class => \"btn btn-info btn-sm\", :onclick => \"addInput('#{attr[\"attribute\"]}', 'text')\")\r\n firstVal = \"\"\r\n if [email protected](attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n firstVal = @submission.send(attr[\"attribute\"])[0]\r\n end\r\n input_html << text_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", firstVal, :id => attr[\"attribute\"].to_s, class: \"metadataInput\")\r\n\r\n # Add field if list of metadata\r\n if [email protected](attr[\"attribute\"]).nil? && @submission.send(attr[\"attribute\"]).any?\r\n @submission.send(attr[\"attribute\"]).each_with_index do |metadata_val, index|\r\n if index != 0\r\n input_html << text_field_tag(\"submission[#{attr[\"attribute\"].to_s}][]\", metadata_val, :id => \"submission_#{attr[\"attribute\"].to_s}\", class: \"metadataInput\")\r\n end\r\n end\r\n end\r\n\r\n input_html << content_tag(:div, \"\", id: \"#{attr[\"attribute\"]}Div\")\r\n\r\n else\r\n # if single value text\r\n # TODO: For some reason @submission.send(\"URI\") FAILS... I don't know why... so I need to call it manually\r\n if attr[\"attribute\"].to_s.eql?(\"URI\")\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: @submission.URI,class: \"metadataInput\")\r\n else\r\n input_html << text_field(:submission, attr[\"attribute\"].to_s.to_sym, value: @submission.send(attr[\"attribute\"]), class: \"metadataInput\")\r\n end\r\n end\r\n return input_html\r\n end\r\n end", "title": "" }, { "docid": "d888abd7545b4a00bc8df59f140c5cc1", "score": "0.46784076", "text": "def render(context)\n view = context.registers[:view]\n case @form_name\n when 'activate_customer_password'\n # {% form 'activate_customer_password' %}\n when 'create_customer'\n view.form_for(:customer, url: view.new_customer_registration_path) do |_f|\n safe_join[super]\n end\n when 'customer_address'\n # {% form 'customer_address', customer.new_address %}\n # {% form 'customer_address', address %}\n when 'customer_login'\n view.form_for(:customer, url: view.new_customer_session_path) do |_f|\n safe_join[super]\n end\n when 'guest_login'\n when 'new_comment'\n # {% form \"new_comment\", article %}\n when 'recover_customer_password'\n when 'reset_customer_password'\n end\n end", "title": "" }, { "docid": "de288e1f6fd9f26c3729d06631f5f3ef", "score": "0.46745726", "text": "def input(attribute_name, options = {}, &block)\n if input_class = options.delete(:class)\n append_class!(options, :input_html, input_class)\n end\n\n if col = options.delete(:col)\n append_class!(options, :wrapper_html, \"count-#{col}\")\n end\n\n if wrapper_class = options.delete(:wrapper_class)\n append_class!(options, :wrapper_html, wrapper_class)\n end\n\n if options.delete(:first_inline)\n append_class!(options, :wrapper_html, 'first-inline')\n end\n\n if options.delete(:inline)\n append_class!(options, :wrapper_html, 'inline')\n end\n super(attribute_name, options, &block)\n end", "title": "" }, { "docid": "e631b920b96c58c5e2589bfa6e014e05", "score": "0.464316", "text": "def render_form(form, params={})\n element = GUI::Async_Form_Decorator.new(form, params)\n # Should be avoided if possible: \n # @response[:html] << element\n element\n end", "title": "" }, { "docid": "258a6c133f243cde56eb5beff7537fbf", "score": "0.46336114", "text": "def group(options ={}, &block)\n @template.form_group(options, &block)\n end", "title": "" }, { "docid": "26ebbce4dfd6d6143ca85f657b3cefb7", "score": "0.46286982", "text": "def inline(label = nil, &block)\n template.content_tag(:div) do\n template.concat template.content_tag(:label, label) if label.present?\n template.concat template.content_tag(:div, :class => 'input') {\n template.content_tag(:div, :class => 'inline-inputs') do\n template.fields_for(\n self.object_name,\n self.object,\n self.options.merge(:builder => ActionView::Helpers::FormBuilder),\n &block\n )\n end\n }\n end\n end", "title": "" }, { "docid": "8915ed223700df3fe6c9d8148493766a", "score": "0.46250424", "text": "def content_element_form(context={})\n \n app = context[:app]\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end", "title": "" }, { "docid": "d71cc30740fc98c8a9bb25eed8728b85", "score": "0.46182722", "text": "def form(path = nil, &block)\n raise \"You need to provide block to form representation\" unless block_given?\n content = @template.capture(self, &block)\n @value.new_record? ? options = {:method => :post} : options = {:method => :put}\n if path\n path = path\n elsif @namespace \n path = @namespace.to_s\n else\n path = @template.polymorphic_path(@value)\n end\n @template.concat(@template.form_tag(path, options))\n @template.concat(content)\n @template.concat(@template.submit_tag(\"ok\"))\n @template.concat(\"</form>\")\n self\n end", "title": "" }, { "docid": "dd0029b5399a8fb37129b1b239b4f38e", "score": "0.4615351", "text": "def form(*a, &block)\n if block\n capture(block){super}\n else\n super\n end\n end", "title": "" }, { "docid": "32d7f10617699314a8ef005d625dd8d3", "score": "0.4609516", "text": "def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end", "title": "" }, { "docid": "b9c534ed1a5dd6f4175bdc104bbf1d94", "score": "0.4609017", "text": "def crud_links(model, instance_name, actions, args={})\n _html = \"\"\n _options = args.keys.empty? ? '' : \", #{args.map{|k,v| \":#{k} => #{v}\"}}\"\n \n if use_crud_icons\n if actions.include?(:show)\n _html << eval(\"link_to image_tag('/images/icons/view.png', :class => 'crud_icon'), model, :title => 'View'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to image_tag('/images/icons/edit.png', :class => 'crud_icon'), edit_#{instance_name}_path(model), :title => 'Edit'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to image_tag('/images/icons/delete.png', :class => 'crud_icon'), model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete'#{_options}\")\n end\n else\n if actions.include?(:show)\n _html << eval(\"link_to 'View', model, :title => 'View', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to 'Edit', edit_#{instance_name}_path(model), :title => 'Edit', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to 'Delete', model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete', :class => 'crud_link'#{_options}\")\n end\n end\n _html\n end", "title": "" }, { "docid": "64166e513149e4a903382ba1da723699", "score": "0.4605641", "text": "def fields_for(object_name, *args, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.last.is_a?(Hash) ? args.pop : {}\n object = args.first\n\n builder = options[:builder] || ActionView::Base.default_form_builder\n yield builder.new(object_name, object, self, options, block)\n end", "title": "" }, { "docid": "c56cb0c114fc55c662c7e40a64996145", "score": "0.46054956", "text": "def nice_form_for(obj, options = {})\n options[:html] ||= {}\n options[:html][:class] = \"#{obj.class.model_name.singular}_form\"\n form = form_for(obj, options) do |f|\n \n # set form mode\n f.mode = form_mode\n yield(f)\n end\n \n # add required * def'n\n if form =~ /\"reqd_sym\"/\n form = (content_tag(:div, t(\"layout.reqd_sym_definition\", :reqd_sym => reqd_sym).html_safe, :class => \"tip\") + form).html_safe\n end\n \n form\n end", "title": "" }, { "docid": "bc16a230a3e3195cae2ff85f7d5b5ec1", "score": "0.4603942", "text": "def form_from_options(opts)\n\t\tform_html = ''\n\t\topts.select {|e| e.has_key?(:method) && e[:method].match(/POST|PUT/)}.each do |opt|\n\t\t\tform_html += %Q{<h3>#{opt[:description]}</h3>}\n\t\t\tform_html += %Q{<form method=\"POST\" action=\"#{opt[:href]}\">\\n}\n\t\t\tif opt[:method] != \"POST\"\n\t\t\t\tform_html += %Q{<input type=\"hidden\" name=\"_method\" value=\"#{opt[:method]}\">}\n\t\t\tend\n\n\t\t\tif opt.has_key?(:parameters)\n\t\t\t\topt[:parameters].each do |k, v|\n\t\t\t\t\tform_html += %Q{#{v[:description]} <input type=\"text\" name=\"#{k}\"><br>\\n}\n\t\t\t\tend\n\t\t\tend\n\t\t\tform_html += '<input type=\"submit\" value=\"Do\"></form><br>'\n\t\tend\n\t\treturn form_html\n\tend", "title": "" }, { "docid": "47bd9f46ef76a7714f1dc2c5fcaeed1c", "score": "0.45995328", "text": "def attributes_tag(f, object, attribute, fckeditor = false)\n type = object.class.columns_hash[attribute.to_s]\n return f.password_field attribute.to_s if attribute.to_s.ends_with? \"password\"\n return f.select(attribute.to_s, MyAdmin.get_related_select_options(attribute.to_s, object), {}, :class => \"relation\" ) if attribute.to_s.ends_with? \"id\"\n return file_column_field(f.object_name.to_s, attribute.to_s) if attribute.to_s.ends_with?(\"file_column\")\n return f.file_field attribute.to_s if attribute.to_s.ends_with?(\"file\") \n case type.type\n when :string\n f.text_field type.name\n when :text\n f.text_area type.name\n when :integer\n f.text_field type.name\n when :datetime\n f.datetime_select type.name\n when :date\n f.date_select type.name \n when :boolean\n f.check_box type.name\n else\n f.text_field attribute\n end \n end", "title": "" }, { "docid": "0900c97827e164030cdea74474e33445", "score": "0.4587877", "text": "def element\n c = content()\n c = [ c + HTML.div.form_button_bar { @buttons } ] if @buttons\n HTML.form(@attrib) { c }\n end", "title": "" }, { "docid": "2259d73e1dead173052d467428e3e9e1", "score": "0.45872158", "text": "def call(input)\n @input = input\n @form = input.form\n attr = input.opts[:attr]\n @attr = attr ? attr.dup : {}\n @opts = input.opts\n normalize_options\n tag = if html = input.opts[:html]\n html = html.call(input) if html.respond_to?(:call)\n form.raw(html)\n else\n convert_to_tag(input.type)\n end\n tag = wrap_tag_with_label(tag) if @opts[:label]\n tag = wrap_tag_with_error(tag) if @opts[:error]\n tag = wrap(:helper, tag) if input.opts[:help]\n wrap_tag(tag)\n end", "title": "" }, { "docid": "fc99b7aa323f1d0f07514d0d383e5f44", "score": "0.45805562", "text": "def fields_for(record_or_name_or_array, *args, &block)\n options = args.extract_options!.merge(:builder => self.class)\n super(record_or_name_or_array, *(args + [options]), &block)\n end", "title": "" }, { "docid": "453ba58d58f6e5ce106d8c387e4721c8", "score": "0.45760745", "text": "def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend", "title": "" }, { "docid": "453ba58d58f6e5ce106d8c387e4721c8", "score": "0.45760745", "text": "def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend", "title": "" }, { "docid": "bad53eb64ef2f4d21b5e0957c4802737", "score": "0.4573268", "text": "def scaffold_default_form_wrapper\n Proc.new{|rows|\"<table class='#{@scaffold_class.scaffold_table_class(:form)}'><tbody>\\n#{rows.join}</tbody></table>\\n\"}\n end", "title": "" }, { "docid": "9cb9a3bad92e9b7c5842cab60d250f4c", "score": "0.45723447", "text": "def html_form(url_or_path, *args)\n options = args.last.is_a?(Hash) ? args.pop.dup : {}\n # noinspection RubyMismatchedArgumentType\n separator = options.delete(:separator) || \"\\n\"\n content = args.flatten\n content += Array.wrap(yield) if block_given?\n content = content.compact_blank\n form_tag(url_or_path, options) do\n safe_join(content, separator)\n end\n end", "title": "" }, { "docid": "ee151ff7dbbf4aac49489a792c0463a9", "score": "0.45703533", "text": "def render_crud_view(options = nil, locals = {}, &block)\n c = case self.class.to_s\n when \"ActionView::Base\" then controller\n else self\n end\n \n #\n # Try view paths of controller\n #\n c.view_paths.each do |view_path|\n crud_views_in(File.join(view_path, c.controller_path), options).each do |view|\n return render_crud_view_in(view, options, locals, &block)\n end\n end\n \n #\n # Try custom view paths\n #\n @custom_view_paths.each do |view_path|\n crud_views_in(view_path, options).each do |view|\n return render_crud_view_in(view, options, locals, &block)\n end\n end\n \n #\n # Try the applications global override (app/views/autocrud)\n #\n crud_views_in(@app_view_path, options).each do |view|\n return render_crud_view_in(view, options, locals, &block)\n end\n \n #\n # Try plugin built in (app/views/autocrud) view path\n #\n crud_views_in(@view_path, options).each do |view|\n return render_crud_view_in(view, options, locals, &block)\n end\n \n #\n # Rescue using Rails's built in render method\n #\n return render(options, locals, &block)\n end", "title": "" }, { "docid": "faf8136f37c090b46f137b9f240e303c", "score": "0.45612097", "text": "def form_for(resource, action, options = {}, &block) \n @resource = resource \n @resource_name = @resource.class.to_s.snake_case\n @resource_class = Object.const_get(@resource.class.to_s)\n\n options = {:method => :post, :name => @resource_name, :action => action}.merge(options)\n @_out_buf ||= ''\n @_out_buf << open_tag(:form, options)\n yield if block_given?\n @_out_buf << close_tag(:form)\n end", "title": "" }, { "docid": "0cd0da37b60003f0bfc9c0767ec0d08e", "score": "0.45584965", "text": "def form_tag_in_block(html_options, &block)\n content = capture(&block)\n form_tag_with_body(html_options, content)\n end", "title": "" } ]
16679b00e2152e487f23a234b5cc1d92
Show Charge Show details of a specific Charge using a given &x60;:id&x60;.
[ { "docid": "a40cb8e7fcea20dcf95c06900dc15e0b", "score": "0.6612362", "text": "def show_charge_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChargesApi.show_charge ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ChargesApi.show_charge\"\n end\n # resource path\n local_var_path = '/charges/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'SingleCharge'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth', 'oAuth2ClientCredentials']\n\n new_options = opts.merge(\n :operation => :\"ChargesApi.show_charge\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ChargesApi#show_charge\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "87257214ae09c569a8f57fbfec84d721", "score": "0.7433968", "text": "def show_charge(id, opts = {})\n data, _status_code, _headers = show_charge_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "59f8fa2d6ee08c11ec97b4c1abed8b0b", "score": "0.7297008", "text": "def show\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charge }\n end\n end", "title": "" }, { "docid": "2a6aa326acb8074a767d7e526e6eb8fc", "score": "0.7166643", "text": "def show\n @charge_cpm = ChargeCpm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charge_cpm }\n end\n end", "title": "" }, { "docid": "0bec1faef1b9c127af1dbeabee15054f", "score": "0.7045131", "text": "def show\n @charge_cpt = ChargeCpt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charge_cpt }\n end\n end", "title": "" }, { "docid": "50a9f1e6b4629090ac7cca18d3de6f72", "score": "0.68251234", "text": "def show\n @curpg = :discharges\n @discharge = Discharge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discharge }\n end\n end", "title": "" }, { "docid": "59d2d53a185e8521dd0dc566cc65ee3a", "score": "0.6815799", "text": "def find(id)\n response = JSON.parse(@client.get(\"charges/#{id}\").body)\n Promisepay::Charge.new(@client, response['charges'])\n end", "title": "" }, { "docid": "bad07b0578aac4b7c4e394844dd734e0", "score": "0.6797742", "text": "def show\n @charge_master = ChargeMaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charge_master }\n end\n end", "title": "" }, { "docid": "c5d04a3c3ba2e6933822a94a90a65fa2", "score": "0.6769447", "text": "def show\n @facture = Charge.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @facture }\n end\n end", "title": "" }, { "docid": "d69ad05f61bad0c7e29a78f8378a9b42", "score": "0.6747415", "text": "def show\n @doctor_charge = DoctorCharge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doctor_charge }\n end\n end", "title": "" }, { "docid": "8ae5c0b66e8c5412e70c8407fcd1ed76", "score": "0.6731526", "text": "def get_charge(customer_id, charge_id)\n get(\"#{customer_id}/charges/#{charge_id}\")\n end", "title": "" }, { "docid": "8ae5c0b66e8c5412e70c8407fcd1ed76", "score": "0.6729394", "text": "def get_charge(customer_id, charge_id)\n get(\"#{customer_id}/charges/#{charge_id}\")\n end", "title": "" }, { "docid": "c3dc92327966e4e9befbfadd2ef1aa61", "score": "0.67189515", "text": "def show\n @charge = @group.charges.find(params[:id])\n\n authorize! :read, @charge\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge }\n end\n end", "title": "" }, { "docid": "ac9fd61b56fdfd59c725450d59bcfd32", "score": "0.6680589", "text": "def show\n @charge_master_child = ChargeMasterChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @charge_master_child }\n end\n end", "title": "" }, { "docid": "ed3c90775a22a94030d3ca3ab4bfcb7f", "score": "0.6509661", "text": "def show\n @breadcrumb = 'read'\n @charge_group = ChargeGroup.find(params[:id])\n @charge_accounts = charge_accounts_by_group(@charge_group)\n #@charge_accounts = @charge_group.charge_accounts.paginate(:page => params[:page], :per_page => per_page).order(:account_code)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge_group }\n end\n end", "title": "" }, { "docid": "636d50e888105baea9f8cdb07ad8cfef", "score": "0.6486514", "text": "def show\n @item_charge = ItemCharge.find(params[:id])\n\n render json: @item_charge\n end", "title": "" }, { "docid": "75b1d58cfee05cf9f014a39eb1d2cc0e", "score": "0.6464187", "text": "def show\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => 'customer' }\n format.json { render json: @charge }\n end\n end", "title": "" }, { "docid": "bec0def7dde074a1701d033d1dbeaf1d", "score": "0.64546496", "text": "def show\n @id_card = IdCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @id_card }\n end\n end", "title": "" }, { "docid": "8936d2f2d668f57d75d74e87ae2ae78e", "score": "0.64440995", "text": "def show\n @cotton_billing = CottonBilling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cotton_billing }\n end\n end", "title": "" }, { "docid": "761704330b55cd5cc8160c677f5c901a", "score": "0.64217144", "text": "def set_charge\n # routes.rb中get :print_form => 'charges#print_form'传入的是:charge_id而不是:id\n @charge = params[:id].nil? ? Charge.find(params[:charge_id]) : Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "44595956d2f34fa1e7761809a71648ed", "score": "0.6324209", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "d10a0758adc0fd513662b3c340caeae3", "score": "0.6323261", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "d10a0758adc0fd513662b3c340caeae3", "score": "0.6323261", "text": "def set_charge\n @charge = Charge.find(params[:id])\n end", "title": "" }, { "docid": "1c934a6cdbc2a8a9bab92b7439412d03", "score": "0.6274264", "text": "def find_charge_by_id\n if @project and @project.shopify_session\n case @project.sub_type\n when 'monthly'\n @charge = ShopifyAPI::ApplicationCharge.find(params[:charge_id])\n when 'yearly'\n @charge = ShopifyAPI::RecurringApplicationCharge.find(params[:charge_id])\n end\n end\n end", "title": "" }, { "docid": "e784632d94290cf0d1ef9637c5b5abb5", "score": "0.6248406", "text": "def show\n @cash_detail = CashDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cash_detail }\n end\n end", "title": "" }, { "docid": "53963cb47543afdc2f0a3c9d2cfaa50b", "score": "0.6233409", "text": "def show\n @collection_centers_charge = CollectionCentersCharge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection_centers_charge }\n end\n end", "title": "" }, { "docid": "e1bddf4e4184ecb27f5e8e108dc7402d", "score": "0.62305206", "text": "def show\n @credit = @transaction.credits.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @credit }\n end\n end", "title": "" }, { "docid": "3b94a6b8b3f79ba9ffb9b12d2b8cbe87", "score": "0.6211832", "text": "def show\n @cc_detail = CcDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cc_detail }\n end\n end", "title": "" }, { "docid": "37598a15d81333d956a92819c7dbedc0", "score": "0.62018776", "text": "def show\n @user_credit_card = UserCreditCard.find(params[:id])\n end", "title": "" }, { "docid": "2b62ad71676a52123663923caaaff3e2", "score": "0.6198093", "text": "def show\n @card = Card.find(params[:card_id])\n end", "title": "" }, { "docid": "e3e80a14f8763f73fc9f2299aa512f26", "score": "0.6197501", "text": "def show\n @transfer_cash = @company.transfer_cashes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transfer_cash }\n end\n end", "title": "" }, { "docid": "272070925252d0e1582ca59f463f7306", "score": "0.6192832", "text": "def show\n #iptal edildi\n @credit = Credit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @credit }\n end\n end", "title": "" }, { "docid": "c5c4bdbc8c38bf40d4f838b6142fff3e", "score": "0.61872894", "text": "def charge_detail(opts={})\n \n merchant_id = opts[:merchant_id]\n charge_id = opts[:charge_id]\n\n if charge_id and charge = Payments::Charge.get(charge_id)\n result = []\n result << \"M978#{format_amount(charge.amount)}\"\n result << charge.detail.size\n charge.detail.each do |charge_detail|\n result << charge_detail[:item_reference]\n result << charge_detail[:item_description]\n result << charge_detail[:item_units]\n result << format_amount(charge_detail[:item_price])\n end\n result.join('\\r\\n')\n else\n nil\n end\n\n end", "title": "" }, { "docid": "d10af3ada1230a12a6c714dee248b01c", "score": "0.61851615", "text": "def show_charge_status(id, opts = {})\n data, _status_code, _headers = show_charge_status_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "ad5f78a7b61800fc090da01c296a8a16", "score": "0.6184745", "text": "def show\n @card = Card.find(params[:id])\n end", "title": "" }, { "docid": "ad5f78a7b61800fc090da01c296a8a16", "score": "0.6184745", "text": "def show\n @card = Card.find(params[:id])\n end", "title": "" }, { "docid": "340c920775313b377c23304adb66cc42", "score": "0.6184295", "text": "def show\n @contract = Contract.find(params[:id])\n end", "title": "" }, { "docid": "340c920775313b377c23304adb66cc42", "score": "0.6184295", "text": "def show\n @contract = Contract.find(params[:id])\n end", "title": "" }, { "docid": "12d5a08f6c3c104bfaa9a2c33151f320", "score": "0.6162554", "text": "def show\n @contract = Contract.find(params[:id])\n \n end", "title": "" }, { "docid": "6f3ea7771dac7d07d02109c7bef6b468", "score": "0.6162173", "text": "def show\n @surcharge = Surcharge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @surcharge }\n end\n end", "title": "" }, { "docid": "a659dfa7ebab71ed90ee63fecd6db206", "score": "0.6147649", "text": "def retrieve(opts)\n requires!(opts, :id)\n \n r = req({\n :id => opts[:id],\n :method => 'retrieve_charge'\n })\n\n Response.new(r)\n end", "title": "" }, { "docid": "88c732c9c219b3cb2739ebb4c00053ea", "score": "0.6141916", "text": "def set_basic_charge\n @basic_charge = BasicCharge.find(params[:id])\n end", "title": "" }, { "docid": "c046df57b74e9097988404374e076185", "score": "0.6140296", "text": "def show\n # @method = Stripe::Charge(current_user.stripe_id).method\n end", "title": "" }, { "docid": "b2ac365283983c91cb86fe9c5fc1aecb", "score": "0.61396444", "text": "def show\n @payment_cc = PaymentCc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @payment_cc }\n end\n end", "title": "" }, { "docid": "213396cc785abb8f6f63be61be67021e", "score": "0.61232984", "text": "def show\n @card_datum = CardDatum.find(params[\"id\"])\n end", "title": "" }, { "docid": "f9998558e3fda0e5d2541052c0884e18", "score": "0.61220753", "text": "def show\n @cost_center = CostCenter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cost_center }\n end\n end", "title": "" }, { "docid": "5bfd64ac874fcbc6f086cbd7fd23fc38", "score": "0.61194485", "text": "def show\n @ip_discharge = IpDischarge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ip_discharge }\n end\n end", "title": "" }, { "docid": "b95280db5056145efe0f0ba925ff2f67", "score": "0.611426", "text": "def show\n @circule = Circule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @circule }\n end\n end", "title": "" }, { "docid": "bdec3a36be5e25b4e7eb8588c35fb1bf", "score": "0.61029756", "text": "def show\n @dialplan_route = DialplanRoute.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dialplan_route }\n end\n end", "title": "" }, { "docid": "c5b9f1db630082a13b577dae3229c39e", "score": "0.6102975", "text": "def show\n @card = Card.find(params[:id])\n @period_prices = PeriodPrice.search_order\n @goods = Good.where(:status => 1)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @card }\n end\n end", "title": "" }, { "docid": "2acaced0715eabbe530d5999c7c0aec4", "score": "0.6069261", "text": "def show\n @invoice = Credit.find(params[:id])\n @customer = @invoice.customer\n \n end", "title": "" }, { "docid": "f4b1632c8a580491c03260ba5f2e9146", "score": "0.60645026", "text": "def show\n @ccdisclosure = Ccdisclosure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccdisclosure }\n end\n end", "title": "" }, { "docid": "7ee164049d7273dadfbdc332cfcd700d", "score": "0.606411", "text": "def show\n @comic = Comic.find(params[:comic_id])\n end", "title": "" }, { "docid": "51ea5ca449feb83d3f1ca529796212b4", "score": "0.6064045", "text": "def show\n @receivable_billing = ReceivableBilling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "3ef85db22d68e1272368294336849764", "score": "0.60616255", "text": "def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "8bc369d819e1dcc281c02380dc149b83", "score": "0.60606617", "text": "def show\n @credit = Credit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @credit }\n end\n end", "title": "" }, { "docid": "716d060fb23dd6c1b49256fb27c77de3", "score": "0.6049689", "text": "def show\n @customer = Customer.find(@credit_card.customer_id)\n end", "title": "" }, { "docid": "394897f0f3d13bb396c40c0ac612636e", "score": "0.60490215", "text": "def show\n @cim_payment = CimPayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cim_payment }\n end\n end", "title": "" }, { "docid": "0bcfbdb4bee35ee9ddb9b04e2dda54c0", "score": "0.6045389", "text": "def view_a_contact(id)\n\n @rolodex.each{|contact|\n\n if contact.id == id\n\n puts \"ID: #{contact.id}\\nFirst Name: #{contact.first_name}\\nLast Name: #{contact.last_name}\\nEmail: #{contact.email}\\nNotes: #{contact.notes}\"\n puts \"--------------------------------\"\n end\n }\n end", "title": "" }, { "docid": "bc815cc98eeadd9afa31959846724859", "score": "0.60448223", "text": "def show\n @cash_register = CashRegister.scopied.find(params[:id])\n @orders = @cash_register.orders.order(AppConfig.orders.order).scopied.page(params[:page]).per(GlobalData.conf.pagination)\n add_breadcrumb @cash_register.name,'cash_register_path(@cash_register,:vendor_id => params[:vendor_id])'\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cash_register }\n end\n end", "title": "" }, { "docid": "bc815cc98eeadd9afa31959846724859", "score": "0.60448223", "text": "def show\n @cash_register = CashRegister.scopied.find(params[:id])\n @orders = @cash_register.orders.order(AppConfig.orders.order).scopied.page(params[:page]).per(GlobalData.conf.pagination)\n add_breadcrumb @cash_register.name,'cash_register_path(@cash_register,:vendor_id => params[:vendor_id])'\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cash_register }\n end\n end", "title": "" }, { "docid": "b8827573bc7ea9c1eeb317371342fec0", "score": "0.6034", "text": "def show\n @batterycharge = Batterycharge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batterycharge }\n end\n end", "title": "" }, { "docid": "d6ec5a172cfc94599cd25489c17e184a", "score": "0.60290384", "text": "def show\n @cost_centre = CostCentre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cost_centre }\n end\n end", "title": "" }, { "docid": "596c7a5629d6445d15e5c2e4e9991eca", "score": "0.60236746", "text": "def show(id)\n all_contacts = self.list\n all_contacts[id-1] if id.between?(1, all_contacts.length)\n end", "title": "" }, { "docid": "24ccde79c328ba228030c9310138d8f8", "score": "0.6017546", "text": "def charge\n Stripe::Charge.retrieve(self.charge_id) if self.charge_id\n end", "title": "" }, { "docid": "ceb50e14d8de417139488aa9bd10fd60", "score": "0.60140055", "text": "def show\n @vcard = Vcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vcard }\n end\n end", "title": "" }, { "docid": "0e14866d66ee41a4d7ecf3fb6d1ffda5", "score": "0.6011392", "text": "def show\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cost }\n end\n end", "title": "" }, { "docid": "0e14866d66ee41a4d7ecf3fb6d1ffda5", "score": "0.6011392", "text": "def show\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cost }\n end\n end", "title": "" }, { "docid": "2dd0cc57a8f2e2509b666bbd7d7220ad", "score": "0.6002563", "text": "def show\n @get_id = params[:id]\n @compra = Purchase.where(id: @trip.purchase)\n end", "title": "" }, { "docid": "5f3a0f3ae0d0a1e88638101a0aeb5c87", "score": "0.59957945", "text": "def show_record(id)\n get_response(\"/#{id}\")\n end", "title": "" }, { "docid": "55132ae3c2c895cd164b307ed829ea91", "score": "0.59942883", "text": "def set_card_charge\n @card_charge = CardCharge.find(params[:id])\n end", "title": "" }, { "docid": "8274c194073516e4cab96a9ce2f6ebff", "score": "0.5987946", "text": "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comic }\n end\n end", "title": "" }, { "docid": "3cb89da409fd956274a534d1d391f3e7", "score": "0.598717", "text": "def show\n # @card = Card.find(params[:id])\n\n user = current_user\n if user.card.stripe_card_id.nil?\n @display = \"none\"\n else\n\n customer = Stripe::Customer.retrieve(user.stripe_customer_id)\n\n card = customer.cards.retrieve(user.card.stripe_card_id)\n\n @card_type = card[\"type\"]\n \n @card_name = card[\"name\"]\n\n last4 = card[\"last4\"]\n @card_number = \"****\"+last4\n \n @card_exp = card[\"exp_month\"].to_s + \" / \"+ card[\"exp_year\"].to_s[2,3]\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "5944ea0762df86dd3e66950f1e10b17b", "score": "0.59869725", "text": "def show\n @cels = Cel.where(\"uniqueid like ?\",@cdr.uniqueid)\n end", "title": "" }, { "docid": "9eba9ac1c892e6fbe975d87023cc874b", "score": "0.59686613", "text": "def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contract }\n end\n end", "title": "" }, { "docid": "9eba9ac1c892e6fbe975d87023cc874b", "score": "0.59686613", "text": "def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contract }\n end\n end", "title": "" }, { "docid": "e6d29ea3b511596483de1f3fac0b7b67", "score": "0.59658444", "text": "def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @climb }\n end\n end", "title": "" }, { "docid": "3c414f7e4991941c44670b98c36bb96d", "score": "0.5963622", "text": "def show\n @overriding_charge = OverridingCharge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @overriding_charge }\n end\n end", "title": "" }, { "docid": "d63f6e92fe827f47944fc84805e3bb24", "score": "0.5960458", "text": "def show\n @publicCard = PublicCard.find(params[:id])\n end", "title": "" }, { "docid": "48a79bf4a5efa24f7d75697787ef09a0", "score": "0.59600806", "text": "def detail\n @display_type = DISPLAY_TYPE_SIMPLE\n @garbage = Garbage.find(params[:id])\n end", "title": "" }, { "docid": "c0ebe5f0b362a4f0e3b94bc234bfceb5", "score": "0.595668", "text": "def show\n @card_transaction = CardTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @card_transaction }\n end\n end", "title": "" }, { "docid": "34d71bd456c2dc3bbc66029ee70609d2", "score": "0.59542114", "text": "def show\n @credito = Credito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @credito }\n end\n end", "title": "" }, { "docid": "2e7b84561fb52a173c1d9a55cf08b35e", "score": "0.5952296", "text": "def show\n @credit_card = CreditCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit_card }\n end\n end", "title": "" }, { "docid": "c9caa02120ef46190c2f66b8c5b2430e", "score": "0.5948062", "text": "def show\n @sla_contract = SlaContract.find(params[:id])\n end", "title": "" }, { "docid": "7dd493ebb79e8a77d0f9877eefc3ae07", "score": "0.59477025", "text": "def set_api_charge\n @api_charge = Api::Charge.find_by_id(params[:id])\n end", "title": "" }, { "docid": "bf09d9d27d0bbe44b32b5126aff88f54", "score": "0.5938931", "text": "def show\n @peripheral = Peripheral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peripheral }\n end\n end", "title": "" }, { "docid": "4ab04550143d8c114298fc8df82d387f", "score": "0.59371483", "text": "def show\n @user = Card.new.lookup(params[:id])\n \n if @card\n respond_with(@card)\n else\n respond_with({error: \"Ingen kort funnet\", status: 404})\n end\n\n end", "title": "" }, { "docid": "d35552e78c216d14019a221e96738b08", "score": "0.59367734", "text": "def show\n @clan = Clan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clan }\n end\n end", "title": "" }, { "docid": "d35552e78c216d14019a221e96738b08", "score": "0.59367734", "text": "def show\n @clan = Clan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clan }\n end\n end", "title": "" }, { "docid": "59855de14e1aedcfb9b3e2a06a2cd499", "score": "0.59277594", "text": "def show\n \t@courier = Courier.find(params[:courier_id])\n @delivery = @courier.deliveries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @delivery }\n end\n end", "title": "" }, { "docid": "244f7a10bafbf258f1673d5513203bb5", "score": "0.5927676", "text": "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "0af344057d8195ad7e48cd9b029b7934", "score": "0.5927158", "text": "def show\n @council_member = CouncilMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @council_member }\n end\n end", "title": "" }, { "docid": "d4f7d88f312eaa4a0935ffe9d8a7fb2f", "score": "0.5925841", "text": "def show\n @car_domicile_type = CarDomicileType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @car_domicile_type }\n end\n end", "title": "" } ]
32b5d954b5e2a01f9d674875fc441d02
update true subscriber nonbillable
[ { "docid": "4917fdbebf84a90fe370bab38021df9c", "score": "0.65270984", "text": "def non_billable_button\n @subscriber = Subscriber.find(params[:id])\n if @subscriber.non_billable == false\n @subscriber.update_attributes(non_billable: true)\n end\n @json_data = { \"non_billable\" => @subscriber.non_billable }\n render json: @json_data\n end", "title": "" } ]
[ { "docid": "e0f18245262ae63f848ec22ab38e900e", "score": "0.6969208", "text": "def toggle_subscription!\n self.unsubscribed = !unsubscribed\n save\n end", "title": "" }, { "docid": "f2ec73ea2e0c9a0c3fc99b4f28a81f8d", "score": "0.6469776", "text": "def subscribe_to_updates\n if @subscription = @requestor.find_or_create_subscriptions(@target.id)\n @subscription.update_attributes(blocked: false) if @subscription.blocked?\n render json: { success: true }\n else\n render json: {message: @subscription.errors&.full_messages || 'Unable to subscriber updates, please try again'}, status: 202\n end\n end", "title": "" }, { "docid": "6936562c63d9c9e003e737891a7b84dd", "score": "0.63886327", "text": "def deactivate_unsubscribers\n active_subscribers = Subscriber.active\n active_subscribers.each do |active_subscriber|\n mc_sub_infos = self.fetch_subscriber_mc_infos(active_subscriber)\n if !mc_sub_infos[0] || mc_sub_infos[1][\"data\"][\"status\"] == \"unsubscribed\"\n puts \"\\nSuccessful update to is_active: false for : #{active_subscriber.firstname} - ID: #{active_subscriber.id}\\n\\n\"\n active_subscriber.update(is_active: false)\n end\n end\n end", "title": "" }, { "docid": "ddcc0a241ed25e5b4c2d548f481000b8", "score": "0.63857424", "text": "def update\n \n if params[:reactivate] == \"true\"\n @subscriber.active = \"true\"\n @subscriber.save\n \n @subscriber.subscribers_books.each do |sb|\n sb.quantity = 1\n sb.save\n end\n \n\n redirect_to session[:request_page], notice: 'Subscriber has been reactivated.'\n return\n end\n \n if params[:commit]\n respond_to do |format|\n if @subscriber.update(subscriber_params)\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscriber }\n else\n format.html { render :edit }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to subscriber_path(@subscriber), notice: 'Edit canceled.'\n end\n end", "title": "" }, { "docid": "4c69e409e47af68d2955fe0fa5b8ea45", "score": "0.63807595", "text": "def billable_button\n @subscriber = Subscriber.find(params[:id])\n if @subscriber.non_billable == true\n @subscriber.update_attributes(non_billable: false)\n end\n @json_data = { \"billable\" => @subscriber.non_billable }\n render json: @json_data\n end", "title": "" }, { "docid": "b521fc1093b04b083f37f546520d350b", "score": "0.61293024", "text": "def update_subscriber_list\n @mandrill = Mandrill::API.new 'nDSi_tYPhOy6QpG8Kn_lqg'\n @subscriber_list = User.where(isSubscribed: true)\n end", "title": "" }, { "docid": "97aa04b42a581d9e380785957bf527ff", "score": "0.61130387", "text": "def unsubscribe\n user = Subscriber.find_by_unique_identifier(params[:id])\n user.update_attribute(:is_subscribed, false)\n user.save!\n render\n end", "title": "" }, { "docid": "8c43db6c189d9e34a88e65677daf0b26", "score": "0.61073905", "text": "def toggle_comment_subscription user\n subscription = find_or_build_comment_subscription user\n subscription.subscribed = !subscription.subscribed \n subscription.save!\n end", "title": "" }, { "docid": "6b3ae4877fea49491ea60e82c938bcb1", "score": "0.6105594", "text": "def toggle_subscriber(user) \n if subscribers.include?(user)\n subscribers.delete(user) \n elsif not user.public? and user.permitted?(:tickets, :watch, :project => project)\n subscribers << user\n end\n subscribers.include?(user)\n end", "title": "" }, { "docid": "fb7961d157065373e4c72bbd2922f96f", "score": "0.6099411", "text": "def unsubscribe!\n self.unsubscribed = true\n save\n end", "title": "" }, { "docid": "e0e45b62508591a9d39c52c3108d0e01", "score": "0.60905164", "text": "def update \n puts \"-----------------------------------------------------------------------------------------\"\n puts \"Would you like to change you subscription payments from monthly to annual, or vice versa?\"\n puts \"-----------------------------------------------------------------------------------------\"\n ans = gets.chomp \n up_sub = Subscription.find(@new_customer.id) \n if ans == \"Yes\" && up_sub.annual == false \n up_sub.update(annual: true)\n else ans == \"Yes\" && up_sub.annual == true \n up_sub.update(annual: false)\n end \n puts \"----------------------------------------\"\n puts \"Your subscription has been been updated!\" \n puts \"----------------------------------------\"\n end", "title": "" }, { "docid": "909e0291fc89a2e91988eaf8b7e67f6f", "score": "0.603641", "text": "def update_subscription\n # Only change the subscription if the models email\n # address has been changed.\n self.class.list_manager.update_subscription(self.email_was, self.email, campaignable_additional_fields) if self.email_changed?\n end", "title": "" }, { "docid": "c2a06821203d7dff532f2f880aa3c71d", "score": "0.59915197", "text": "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "title": "" }, { "docid": "c2a06821203d7dff532f2f880aa3c71d", "score": "0.5990793", "text": "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "title": "" }, { "docid": "c2a06821203d7dff532f2f880aa3c71d", "score": "0.5990793", "text": "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "title": "" }, { "docid": "9f1d51ba04ef4d01596deefbef45071d", "score": "0.59464514", "text": "def update\n\n @subscription.subscribe(current_user.account, subscription_params[:stripe_plan_id], coupon: subscription_params[:coupon_code])\n\n if @subscription.save\n redirect_to @subscription, notice: 'Subscription was successfully updated.'\n else\n @verrors = @subscription.errors.full_messages\n render 'edit'\n end\n end", "title": "" }, { "docid": "df52899ea01d5bd6bf3255ab5f06e906", "score": "0.59290695", "text": "def subscription=(new_subscription)\n if !new_subscription.nil?\n case new_subscription\n when true\n unless subscribed?\n @attributes << :Subscribed\n subscription_changed!\n end\n when false\n if subscribed?\n @attributes.delete(:Subscribed)\n subscription_changed!\n end\n end\n end\n end", "title": "" }, { "docid": "eef24b1ea11b2772d88e4f9f0a3800cf", "score": "0.59125745", "text": "def set_active_subscriptions_paid!\r\n self.subscriptions.all { |sub| sub.pay! }\r\n end", "title": "" }, { "docid": "c27a6fe153cb4bf2981c138a9c1faf01", "score": "0.5820113", "text": "def update_invoice_status\n invoices = self.invoices\n invoices.each do |invoice|\n invoice.received = true\n invoice.save\n end\n end", "title": "" }, { "docid": "f240081f104cd9e2e2c4d035c812e4ed", "score": "0.579661", "text": "def pending\n !as_stripe_subscription.pending_update.nil?\n end", "title": "" }, { "docid": "1831b9044691c9ffcf06748a69debcf1", "score": "0.5765018", "text": "def subscribe(user)\n return false if user == self\n if subscription = find_any_subscription_with(user)\n subscription.update_attributes(status: Subscription.statuses[:allowed])\n else\n Subscription.new(subscriber_id: user.id, user_id: self.id).save\n end\n end", "title": "" }, { "docid": "0fe3764a3a8bc95f5657b57257263925", "score": "0.5755051", "text": "def mark_subscribed!\n return unless with_states?\n\n unless user.subscribed?\n user.skip_mailchimp_callbacks = true\n user.subscribe!\n end\n end", "title": "" }, { "docid": "9f2306c1bec09c58deccb6064b5fb87b", "score": "0.5740616", "text": "def block_updates\n @subscription = @requestor.find_or_create_subscriptions(@target.id)\n if @subscription.update_attributes(blocked: true)\n render json: { success: true }\n else\n render json: {message: @subscription.errors&.full_messages || 'Unable to block subscriptions, please try again'}, status: 202\n end\n end", "title": "" }, { "docid": "b4a7a2e79610b5f63505d5446d8c445f", "score": "0.57250696", "text": "def update_invoice\n if invoice.registrations.any?\n invoice.update_paid\n else\n invoice.destroy\n end\n end", "title": "" }, { "docid": "0c1f1e7d5bddee65daf72840204b53e5", "score": "0.57005376", "text": "def updatable_subscription_plans\n subscription_plans = SubscriptionPlan.where(disabled: false).order(:name)\n\n if current_subscription_plan.present?\n subscription_plans.where('id != ?', current_subscription_plan.id)\n else\n subscription_plans\n end\n end", "title": "" }, { "docid": "0cedf9be1052584866f8fc1bdcede84b", "score": "0.5684317", "text": "def update\n redirect_nonadmin(root_url)\n @item = Item.find(params[:id])\n orig_inventory = @item.inventory\n if @item.update(item_params)\n if orig_inventory <= 0 && @item.inventory > 0 && [email protected]\n @item.subscriber_list.users.each do |user|\n UserMailer.with(user: user, item: @item).subscribe_email.deliver_now\n end\n @item.subscriber_list.users.clear\n end\n redirect_to @item\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "239d73e16da11fcb8c2101483ace9237", "score": "0.5662831", "text": "def update_newsletter_subscription!\n return unless self.user.present?\n\n if self.receives_newsletter?\n NewsletterSubscriptionsWorker.perform_async(:subscribe, self.user.email)\n else\n NewsletterSubscriptionsWorker.perform_async(:unsubscribe, self.user.email)\n end\n end", "title": "" }, { "docid": "79d8206b1d34a71b91fae7088fa59072", "score": "0.56613374", "text": "def update\n @subscriber = Helpdesk::Subscriber.find(params[:id])\n\n if @subscriber.update_attributes(subscriber_params)\n redirect_to admin_subscribers_path, notice: 'Subscriber was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "title": "" }, { "docid": "fedc4af2f9074d8e021d6438da8d7819", "score": "0.5654226", "text": "def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: t( 'activerecord.attributes.subscriber.successfully') }\n format.json { head :no_content }\n else\n @countries = Country.order(:name)\n # @bank = banks_dropdown\n # @bank_offices = bank_offices_dropdown\n format.html { render action: \"edit\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ecd52642cc7eda43a58d6df0f5f03997", "score": "0.56515914", "text": "def update\n @user = User.find(current_user.id)\n\n if params[:cancel]\n flash[:notice] = 'Update cancelado'\n redirect_to account_path\n else\n if @user.update_attributes(user_params)\n if params[:subscription_attributes].eql?('1')\n flash[:notice] = t('bulletin_subscriptions.subscription_done')\n else\n flash[:notice] = t('account.datos_guardados')\n end\n redirect_to account_path\n else\n render :action => 'edit'\n end\n end\n end", "title": "" }, { "docid": "d8f6409e4c22cadbe9b9f840d3842222", "score": "0.5644499", "text": "def update_subscription(subscription, should_subscribe:, event_time:, operation_reason: nil, subscribable: nil, unsub_mailing_id: nil, permanent: false)\n retried = false\n begin\n ms = self.member_subscriptions.find_or_initialize_by(subscription: subscription) do |member_sub|\n # Ensure new records have the time of this event\n member_sub.created_at = event_time\n member_sub.updated_at = event_time\n end\n\n # Ensure record has attributes against subscribable and operation_reason\n ms.subscribable = subscribable\n ms.operation_reason = operation_reason\n\n # Only process this event if it's newer than the previous sub/unsub event or it's a new subscription\n if event_time > ms.updated_at || ms.new_record?\n if unsubscribed_permanently?\n return ms.update!(\n subscribed_at: nil,\n subscribe_reason: nil,\n unsubscribed_at: event_time,\n unsubscribe_reason: 'Deferred as permanently unsubscribed from email',\n updated_at: event_time,\n permanent: true\n )\n elsif ms.unsubscribed_permanently?\n return ms.update!(\n subscribed_at: nil,\n subscribe_reason: nil,\n unsubscribed_at: event_time,\n unsubscribe_reason: 'Deferred as permanently unsubscribed',\n updated_at: event_time,\n permanent: true\n )\n elsif should_subscribe\n return ms.update!(\n subscribed_at: event_time,\n subscribe_reason: (operation_reason || 'not specified'),\n unsubscribed_at: nil,\n unsubscribe_reason: nil,\n updated_at: event_time\n )\n elsif !should_subscribe\n return ms.update!(\n subscribed_at: nil,\n subscribe_reason: nil,\n unsubscribed_at: event_time,\n unsubscribe_reason: (operation_reason || 'not specified'),\n unsubscribe_mailing_id: unsub_mailing_id,\n updated_at: event_time,\n permanent: permanent\n )\n end\n end\n\n return false\n rescue ActiveRecord::RecordNotUnique\n # Safe to always retry because there must be a DB-level unique constraint,\n # meaning there cannot be any duplicates at the moment, so next try will\n # find the existing record in find_or_initialize_by\n retry\n rescue ActiveRecord::RecordInvalid => e\n # Retry AR uniquness validation errors once, could be race condition...\n if !retried && e.record.errors.details.dig(:member, 0, :error) == :taken\n retried = true\n retry\n else\n # Already retried, likely to be duplicate data already in the db, abort\n raise e\n end\n end\n end", "title": "" }, { "docid": "ec29bab5d68b168838226d516686a4c5", "score": "0.56423825", "text": "def update_subscription(old_email, new_email, merge_vars={})\n # Update the existing member details.\n api.lists(@campaignable_list_id).members(subscriber_hash(old_email)).update(body: {\n :email_address => new_email,\n :status => \"subscribed\",\n :merge_fields => prep_merge_fields(merge_vars) # Include additional variables to be stored.\n })\n end", "title": "" }, { "docid": "e5bbfbe7033e06ad96767740e094f744", "score": "0.5625844", "text": "def update!(**args)\n @enable_improved_email_privacy = args[:enable_improved_email_privacy] if args.key?(:enable_improved_email_privacy)\n end", "title": "" }, { "docid": "88ad0c179f7e1b0fee5db5ed792ed029", "score": "0.5603505", "text": "def use_subscribed(survey)\r\n # find subscription to increment, must be same as is journal_entry\r\n subscription = self.subscriptions.by_survey(survey) \r\n return false unless Subscription\r\n subscription.copy_used! # if sub.nil? => no abbo\r\n end", "title": "" }, { "docid": "88ad0c179f7e1b0fee5db5ed792ed029", "score": "0.5603505", "text": "def use_subscribed(survey)\r\n # find subscription to increment, must be same as is journal_entry\r\n subscription = self.subscriptions.by_survey(survey) \r\n return false unless Subscription\r\n subscription.copy_used! # if sub.nil? => no abbo\r\n end", "title": "" }, { "docid": "0bc99cca52b60c35af572cffae125174", "score": "0.5603037", "text": "def update_suspended_subscription\n user.forbid_card_access\n if user.current_deferred_invoice.present?\n user.current_deferred_invoice.update_attributes(next_payment_at: Date.today, end_at: Date.today)\n end\n update_attribute(:suspended_at, Date.today)\n end", "title": "" }, { "docid": "a2bab11e6e6558d795d5aa9be31b02da", "score": "0.5596691", "text": "def IsSubscribed=(arg0)", "title": "" }, { "docid": "a2bab11e6e6558d795d5aa9be31b02da", "score": "0.5596691", "text": "def IsSubscribed=(arg0)", "title": "" }, { "docid": "36d4a21c9efe2d5ec50404d23d98eed8", "score": "0.55951357", "text": "def save\n self.approved = true\n super\n end", "title": "" }, { "docid": "f61f1adb75d8a055a97b146685b3452a", "score": "0.55929804", "text": "def update\n @subscriber.update_attributes!(subscriber_params)\n render_success_format('Suscriptor actualizada',@subscriber,true)\n rescue Exception => e\n render_default_error e, 401\n\n end", "title": "" }, { "docid": "851ebdd87b0102b3a8da908dbb699828", "score": "0.55913866", "text": "def create / update_subscriptions\n end", "title": "" }, { "docid": "c35fb8b774bfb21088dd5c7564f5c24f", "score": "0.5584527", "text": "def set_is_billable\n data=params\n ActiveRecord::Base.transaction do\n @time_entry = TneInvoiceTimeEntry.find(data[:id])\n @previous_final_billed_amount = @time_entry.final_billed_amount\n @time_entry.update_attributes({:is_billable => data[:billing_type], :is_internal => data[:is_internal]})\n @expense_entries = @time_entry.expense_entries\n if data[:is_internal].to_s.eql?(\"true\")\n @time_entry.update_attributes({:contact_id => '', :matter_id => ''})\n for expense_entry in @expense_entries\n expense_entry.update_attributes({:is_internal => data[:is_internal], :is_billable => false, :contact_id => '', :matter_id => ''})\n @billed_amount = expense_entry.calculate_final_expense_amount\n end\n end\n end\n # This line is commented By -- Hitesh Rawal\n # It gave problem when we give discount or override amount - check-out billable and then check-in\n # It clear discount and override amount and always shows full bill amount.\n #@time_entry.update_attributes({:billing_percent => ''})\n @billed_amount = @time_entry.calculate_final_billed_amt\n flash[:notice] = \"#{t(:text_time_entry)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_updated)}\"\n end", "title": "" }, { "docid": "3f2f6a656b164291aa5fedc970cee72d", "score": "0.5584386", "text": "def update\n @email = Email.find(params[:id])\n if @email.read === true\n @email.update(read: false)\n else \n @email.update(read: true)\n end\n \n end", "title": "" }, { "docid": "6c69582b836a3f408e3f918c2eaadeda", "score": "0.55778515", "text": "def update_subscription(old_email, new_email)\n # Mailchimp have a handy helper for updating an existing subscription.\n api.update_member({\n :id => @campaignable_list_id,\n :email => {\n :email => old_email\n }, \n :merge_vars => {\n :'new-email' => new_email\n }\n })\n end", "title": "" }, { "docid": "4dec76a3904cefd94d544d3b634717fa", "score": "0.55763483", "text": "def update_with_paypal_payment(subscribe) \n response = paypal.make_recurring \n op = subscribe.price\n on = subscribe.name\n user_id = subscribe.user_id\n email = subscribe.email\n subscribe.update_attributes(:name => self.name,:plan_id => self.plan_id,:price => self.price, :user_id => self.user_id, :email => self.email, :paypal_customer_token => self.paypal_customer_token, :paypal_recurring_profile_token => response.profile_id,:paypal_payment_token => self.token)\n end", "title": "" }, { "docid": "4636fd7db2f4668adf6d172dc1f435f4", "score": "0.55642074", "text": "def subscribe\n self.subscribed = true\n end", "title": "" }, { "docid": "fbbe1ab83fc8f9345b23338138024380", "score": "0.55544585", "text": "def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to account_subscriber_path(@account, @subscriber), notice: 'Subscriber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d2a6e420200ca56d92d402f4e38d260", "score": "0.5543095", "text": "def destroy\n @subscriber.update(active: :false)\n respond_to do |format|\n format.html { redirect_to session[:request_page], notice: 'Subscriber is now inactive.' }\n format.json { head :no_content }\n end\n @subscriber.subscribers_books.each do |subscription|\n subscription.quantity = 0\n subscription.save\n end\n relations = Relationship.where(\"name_index = ?\", @subscriber.index)\n relations.each do |relation|\n relation.quantity = 0\n relation.save\n end\n end", "title": "" }, { "docid": "b1c22eea2909cc0bce272c29d4eb4041", "score": "0.5535782", "text": "def update\n @subscription = Subscription.find(params[:id])\n set_current_system list_to_system(@subscription.list)\n get_list_and_segments\n params[:subscription][:segments] ||= []\n @subscription.write_attributes(params[:subscription])\n @lyris = Lyris.new :update_member_demographics, :simple_member_struct_in => {:email_address => @subscription.email, :list_name => @subscription.list}, :demographics_array => @segments.keys.map {|e| {:name => e, :value => @subscription.segments.include?(e.to_s) ? 1 : 0}} if @segments.present?\n @subscription.save\n flash[:notice] = \"Newsletter Subscription settings have been updated.\"\n redirect_to(admin_subscriptions_url)\n end", "title": "" }, { "docid": "1cb76e4ba1ea3b8722fd986b6741af37", "score": "0.55350596", "text": "def update_subscription\n success = stripe_call do\n customer = Stripe::Customer.retrieve(@user.stripe_id)\n subscription = customer.subscriptions.retrieve(@user.stripe_subscription_id)\n subscription.source = @params[:stripeToken] if @params[:stripeToken]\n # Update plan if one is provided, otherwise use user's existing plan\n # TODO providing plan_id is untested\n plan_stripe_id = @params[:plan_id] ? Plan.find(@params[:plan_id]).stripe_id : @user.plan.stripe_id\n subscription.items = [{\n id: subscription.items.data[0].id,\n plan: plan_stripe_id\n }]\n subscription.save\n end\n return false unless success\n user_attributes_to_update = {}\n # This is updated by the stripe webhook customer.updated\n # But we can update it here for a faster optimistic 'response'\n assign_card_details(user_attributes_to_update, @params)\n user_attributes_to_update[:plan_id] = @params[:plan_id].to_i if @params[:plan_id]\n @user.update(user_attributes_to_update) if user_attributes_to_update.any?\n return true if success\n end", "title": "" }, { "docid": "1830a269ff18387cd3d57b932c50fb61", "score": "0.5530947", "text": "def invoice_status_changed(data)\n @subscription = ::Subscription.find_by(iugu_id: data[:subscription_id])\n @subscription.update(iugu_payment_status: data[:status])\n end", "title": "" }, { "docid": "ad766baac6057306c25025f32949ec4f", "score": "0.5526756", "text": "def update!(**args)\n @do_not_publish = args[:do_not_publish] if args.key?(:do_not_publish)\n end", "title": "" }, { "docid": "c1fb099223ba0535178bb04fd253886c", "score": "0.5519879", "text": "def set_expense_is_billable\n data=params\n @tne_invoice_expense_entry = TneInvoiceExpenseEntry.find(data[:id])\n @previous_final_billed_amount = @tne_invoice_expense_entry.final_expense_amount\n if @tne_invoice_expense_entry.billing_method_type.to_i == 1\n @tne_invoice_expense_entry.update_attributes({:is_billable => data[:billing_type], :is_internal => data[:is_internal], :billing_percent => ''})\n else\n @tne_invoice_expense_entry.update_attributes({:is_billable => data[:billing_type], :is_internal => data[:is_internal]})\n end\n\n if data[:is_internal].to_s.eql?(\"true\")\n @tne_invoice_expense_entry.update_attributes({:contact_id => '', :matter_id => ''})\n end\n @billed_amount = @tne_invoice_expense_entry.calculate_final_expense_amount\n# flash[:error]= t(:flash_enter_valid_expense_amt)\n end", "title": "" }, { "docid": "0b896a5a64a54c7dcc790b98200c4f05", "score": "0.5518005", "text": "def change_subscription\n @user = User.find(params[:id])\n @user.notify = [email protected]\n @user.save\n respond_with(@user) do\n redirect_to \"/users/successful_unsubscribe\"\n end\n end", "title": "" }, { "docid": "dd96044edcc7a2e13db0427b6a27c0fa", "score": "0.551214", "text": "def subscribe(subscriber, subscription_level = Subscription::Levels[:reader])\n\n if sub = subscription_to(subscriber)\n # no need for equine abuse post-mortem\n return if sub.level == subscription_level\n else\n # Build a subscription\n sub = self.subscriptions_to.build(Sable.subscriber_relation_name.to_sym => subscriber)\n\n # Manually assigning +subscribable+ ensures the current instance will\n # carry forward (useful in combination with +suppress_notifiables+)\n sub.subscribable = self\n end\n\n sub.level = subscription_level\n sub.save! unless new_record?\n end", "title": "" }, { "docid": "961349c00cc5bb972502f65c0269aadd", "score": "0.5510847", "text": "def update!(**args)\n @skip_billing_check = args[:skip_billing_check] if args.key?(:skip_billing_check)\n end", "title": "" }, { "docid": "0efb7b17bfb4147941a44b6aa7da6c4e", "score": "0.5505316", "text": "def update!(**args)\n @approved = args[:approved] if args.key?(:approved)\n end", "title": "" }, { "docid": "d37ebccac345389aa47d74db0634a1be", "score": "0.54884076", "text": "def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b992c58d4370bf1c1881f07ebcad278", "score": "0.5483937", "text": "def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b992c58d4370bf1c1881f07ebcad278", "score": "0.5483937", "text": "def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "310c9aa4f21d3262ed5daaad8adf8042", "score": "0.548125", "text": "def set_scheduled_flag(value)\n self.scheduled = value\n self.save!\n end", "title": "" }, { "docid": "a01f793b6677745d93fbed10dba85e0d", "score": "0.54759777", "text": "def update!(**args)\n @recording_allowed = args[:recording_allowed] if args.key?(:recording_allowed)\n @written_ugc_allowed = args[:written_ugc_allowed] if args.key?(:written_ugc_allowed)\n end", "title": "" }, { "docid": "857a3ac0a7ba8ab0287f58940497b90c", "score": "0.5463561", "text": "def touch_subscribe_job_states\n user.update subscribe_jobs_updated_at: Time.zone.now if user.present?\n end", "title": "" }, { "docid": "c4e68c4f0a9684ab797a8a5b41d68587", "score": "0.54608524", "text": "def toggle\n # put user_id business_id in params\n user = User.where(:unique_id => params[:device_id])\n if user.empty?\n user = User.new(:unique_id => params[:device_id])\n user.save\n else\n user = user.first #WHERE RETURNS AN ARRAY\n end\n user_id = user.id\n @subscription = Subscription.where(:business_id => params[:business_id], :user_id => user_id)\n if @subscription.empty?\n @subscription = Subscription.new(:business_id => params[:business_id], :user_id => user_id)\n @subscription.save\n render :json => \"subscribed\"\n else\n @subscription.first.destroy\n render :json => \"unsubscribed\"\n end\n end", "title": "" }, { "docid": "0198c9660cda084aca89760d651f9312", "score": "0.5459209", "text": "def set_postpaid\n postpaid = 1\n end", "title": "" }, { "docid": "753190d29a83610cc01efde477d130ba", "score": "0.54573095", "text": "def set_invoice_paid\n @invoice.status == 'paid'\n end", "title": "" }, { "docid": "5006f2cb245c1cb1c31e2f2b28058437", "score": "0.5452339", "text": "def change_subscription\n\tbounce_free_account\n\n\t@subs = current_user.subscriptions \n\tif @subs && [email protected]?\n\t@s = @subs.active.first\n\t@s_year = @s.created_at + 365.days\n\t#@c = Stripe::Customer.retrieve(@s.customer_id)\n\telse #this should not happen - be careful to make sure every customer has a subscription; or at least if they have a \n\t\t# cancel subsciption link, there is an active subscription to be canceled. \n\tredirect_to current_user, notice: 'You have no active subscriptions.'\n\t # return false is this line needed to end the action?\n\tend \n\n\t# users first (oldest) subscription, for displaying free trial information\n\t@firstsub = @subs.first\n\t@firstsub_end = @firstsub.created_at + 14.days\n\n\t#@plan = Plan.find_by_name(@s.plan_id) #this would be better for easily retrieving other associated plan info; but could have just used @s.plan_id for the plan name\n\tif [email protected]_plan_id.nil? # so that @plan isn't nil, which would cause problems in the view \n\t@plan = Plan.find_by_my_plan_id(@s.my_plan_id) # NOTE THAT @PLAN IS THE PLANOBJECT\n\t\t\t\t#see if active subscription has a coupon associated with it\n\t\t\t\tif [email protected]? && Coupon.find_by_name(@s.coupon)\n\t\t\t\t\t@coupon = Coupon.find_by_name(@s.coupon)\n\t\t\t\t\t@code = @coupon.name\n\t\t\t\t\t@new_price = @plan.monthly_cost_cents * (100 - @coupon.percent_off)/100\n\t\t\t\telse\n\t\t\t\t\t@coupon = nil \n\t\t\t\t\t@code = nil\n\t\t\t\t\t@new_price = nil \n\t\t\t\tend \n\telse\n\t\t@plan = nil\n\t\t@coupon = nil \n\t\t@code = nil \n\t @new_price = nil \n\tend \n\nend", "title": "" }, { "docid": "7525471e871db9d83d91b7357f1a2885", "score": "0.5441362", "text": "def stripe_customer_subscription_updated(event, req)\n subscription = event['data']['object']\n subs = Lynr::Model::Subscription.new({\n canceled_at: subscription['canceled_at'],\n plan: subscription['plan']['id'],\n status: subscription['status'],\n })\n dealership = dealer_dao.get_by_customer_id(subscription['customer']).set('subscription' => subs)\n dealer_dao.save(dealership)\n end", "title": "" }, { "docid": "bf40fecc422639122b736d03b428f31d", "score": "0.5432878", "text": "def subscribe(subscriber)\n if @id != subscriber.getId\n @subscriptions[subscriber.getId] = subscriber\n return true\n end\n return false\n end", "title": "" }, { "docid": "8563218d4e9c78cae6416653ed3320c3", "score": "0.54310894", "text": "def subscriber?\n self.subscription.plan_id != nil && self.subscription.plan_id >= 1\n end", "title": "" }, { "docid": "5a6b39c6f3ff6829e760e29c10abb55c", "score": "0.5428415", "text": "def before_save\n self.available = true if self.available.nil?\n super\n end", "title": "" }, { "docid": "5a6b39c6f3ff6829e760e29c10abb55c", "score": "0.5428415", "text": "def before_save\n self.available = true if self.available.nil?\n super\n end", "title": "" }, { "docid": "5da078602c176293a02fc6f1e621d946", "score": "0.5420739", "text": "def subscriber_params\n params.require(:subscriber).permit(:name, :email, :active, :created_at, :updated_at)\n end", "title": "" }, { "docid": "f687d2820acd31bc2b2e149799941315", "score": "0.5410752", "text": "def bread_subscriptions_params\n params.require(:subscriptions).permit(allowed_subscriber_params)\n end", "title": "" }, { "docid": "8b743d4c6f09b4ce534866e501684bb2", "score": "0.5403375", "text": "def subscribe_student student\n mysub = Subscription.find(:first, :conditions => {:event_id => id, :owner_id => student.id})\n unless mysub \n if student.credit >= self.price\n student.credit -= self.price\n student.save\n Subscription.create(:event_id => id, :owner_id => student.id, :rating => 0, :score => 0)\n else\n flash[:error] = \"The student does not have enough credit to buy this session.\"\n end\n end\n end", "title": "" }, { "docid": "a11d37638c78b4be1ea5f100fbd52f6f", "score": "0.539691", "text": "def update_paid\n self.check_paid\n # Use update_columns to skip more callbacks\n self.update_columns(paid: self.paid, paid_amount: self.paid_amount)\n end", "title": "" }, { "docid": "abcafc3ae55dfca9aa8910ee01e3137a", "score": "0.53936636", "text": "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "title": "" }, { "docid": "abcafc3ae55dfca9aa8910ee01e3137a", "score": "0.53936636", "text": "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "title": "" }, { "docid": "abcafc3ae55dfca9aa8910ee01e3137a", "score": "0.53936636", "text": "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "title": "" }, { "docid": "abcafc3ae55dfca9aa8910ee01e3137a", "score": "0.53936636", "text": "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "title": "" }, { "docid": "abcafc3ae55dfca9aa8910ee01e3137a", "score": "0.53936636", "text": "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "title": "" }, { "docid": "abcafc3ae55dfca9aa8910ee01e3137a", "score": "0.53936636", "text": "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "title": "" }, { "docid": "7bc0087e4735137ed580f40ac3bf873b", "score": "0.539076", "text": "def update_book_copy_status_to_assigned\n book_copy = self.book.book_copies.unassigned_copies.where(is_active: true).first\n book_copy.update_attributes(is_assigned: true)\n end", "title": "" }, { "docid": "d5f3b25a3c1563d702d00ba3e267274f", "score": "0.5388196", "text": "def update_book_copy_status_to_unassigned\n book_copy = self.book.book_copies.where(is_assigned: true).last\n book_copy.update_attributes(is_assigned: false)\n end", "title": "" }, { "docid": "7aee6c753d94c262ef441644fb3113b8", "score": "0.5383018", "text": "def can_update_all_recipients_emails? = !prod? && draft_or_planned? && communes.any?", "title": "" }, { "docid": "5a5937948b4eeb7692ea249d1c3307aa", "score": "0.5380676", "text": "def update_status\n\t\tIFeeSchedule.where(feeActive: true).where.not(id: self.id).update_all(feeActive: false)\n\tend", "title": "" }, { "docid": "c7c7c18c7c2c167c753cfa935535c1f9", "score": "0.53806615", "text": "def upemail(params)\n old_email = params[\"old_email\"]\n new_email = params[\"new_email\"]\n\n subscriber = nil\n enabled_models.each { |model| subscriber ||= model.constantize.find_by_email(old_email) }\n\n unless over_the_limit(subscriber.updated_at)\n subscriber.email = new_email\n subscriber.save_without_update_list_member(:validate => false)\n end\n end", "title": "" }, { "docid": "ac7730b82d4349f28e4fca17cd9d91db", "score": "0.5379287", "text": "def update!(**args)\n @enabled = args[:enabled] if args.key?(:enabled)\n @test_phone_numbers = args[:test_phone_numbers] if args.key?(:test_phone_numbers)\n end", "title": "" }, { "docid": "2217d5c41c710d84e005f3a811700d3d", "score": "0.5374825", "text": "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n end", "title": "" }, { "docid": "0211cd09c2d61c2914a17a720da749ed", "score": "0.5372827", "text": "def pending!\n self.update_attribute(:status, PENDING)\n self.registration.update_attribute(:status, PENDING) if self.registration\n end", "title": "" }, { "docid": "2045819fe377a3354d9f9a0ff469f452", "score": "0.53666574", "text": "def after_save\n unless destroyed_by_association\n touch_subscriptions if saved_change_to_unread_entries?\n end\n end", "title": "" }, { "docid": "40fda6c0169d46d2fb42b3038cdcbb71", "score": "0.53555465", "text": "def update!(**args)\n @read_receipts_enabled = args[:read_receipts_enabled] if args.key?(:read_receipts_enabled)\n end", "title": "" }, { "docid": "43d781c1162adc8cad5e88c0e6751cfe", "score": "0.535443", "text": "def subscribe_to_comments_if_unset user\n subscription = subscription_on_comments user\n unless subscription\n subscription = build_comment_subscription user\n subscription.subscribed = true\n subscription.save!\n end\n end", "title": "" }, { "docid": "a310d2c12562f4a675e1207e355edfa9", "score": "0.53543097", "text": "def update!(**args)\n @add_attendee_emails = args[:add_attendee_emails] if args.key?(:add_attendee_emails)\n end", "title": "" }, { "docid": "7dc2417a04759668029ee43cd0d7b8e9", "score": "0.5353222", "text": "def inactive_students\n self.students.each{|s| s.active = false}\n end", "title": "" }, { "docid": "4a74caeacee67b14387a3616ecf964af", "score": "0.5350483", "text": "def set_approval\n self.sanctuary? ? self.approved = false : self.approved = true\n end", "title": "" }, { "docid": "2c6d0d4e409074092049ee5eeced5a42", "score": "0.53479636", "text": "def update_autopays\r\n self.auto_pays.each{|autopay|\r\n if autopay.is_active\r\n autopay.update_attributes({:property_id => self.property_id})\r\n end\r\n }\r\n end", "title": "" }, { "docid": "19dff047082ae5b11266d542235e1a70", "score": "0.5339533", "text": "def set_subscribe\n pa = params[:subscribe]\n @subscribe = params[:id].to_i.zero? ? Subscribe.where(user_id: pa[:user_id], target_id: pa[:target_id]).take : Subscribe.find(params[:id])\n end", "title": "" }, { "docid": "e48706a39474de9409fd603c832f3d4f", "score": "0.53359216", "text": "def update\n @catalogs_ubication = Catalogs::Ubication.find(params[:id])\n #@catalogs_ubication.attributes = params[:catalogs_ubication]\n #if @catalogs_ubication.available == \"1\"\n # @catalogs_ubication.available = \"1\"\n #else\n # @catalogs_ubication.available = nil\n #end\n \n respond_to do |format|\n if @catalogs_ubication.update_attributes(params[:catalogs_ubication])\n format.html { redirect_to(@catalogs_ubication, :notice => 'La ubicación fue actualizada.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalogs_ubication.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d27056af80f4211f134209712b61e33d", "score": "0.53303814", "text": "def invoice_created(data)\n subscription = ::Subscription.find_by(iugu_id: data[:subscription_id])\n\n unless subscription.nil?\n subscription.update(iugu_payment_status: data[:status])\n end\n end", "title": "" } ]
f5bf23f3a2ba4cee82c978dc1569b30f
remove seek data by inode (when source file deleted)
[ { "docid": "43446485ac5b58d625d7d017a50d2078", "score": "0.5922907", "text": "def delete_key(inode)\r\n @db_mon.synchronize {\r\n @seek_db.delete(inode) rescue nil\r\n }\r\n end", "title": "" } ]
[ { "docid": "751c73611628453f518274b0dcbf150d", "score": "0.6027966", "text": "def delete_from_disk; end", "title": "" }, { "docid": "b43e8accb0ea181d45ed94d1e8eea60f", "score": "0.59977597", "text": "def copy(io, context)\n super\n if io.respond_to?(:path) && io.path && delete_raw? && context[:delete] != false\n begin\n File.delete(io.path)\n rescue Errno::ENOENT\n # file might already be deleted by the moving plugin\n end\n end\n end", "title": "" }, { "docid": "2ce96a67d344d9d28808b3f367450fe3", "score": "0.5990046", "text": "def ftruncate(ctx,path,offset,ffi)\n\n return wrap_context(ctx,__method__,path,offset,ffi) if ctx\n\n fh = ffi.fh\n\n if fh.raw\n @root.raw_truncate(path,offset,fh.raw)\n if (offset <= 0)\n fh.contents = \"\"\n else\n fh.contents = fh.contents[0..offset]\n end\n end\n end", "title": "" }, { "docid": "768effcaf1ee175bbdd8a438a0ad9ffa", "score": "0.5941509", "text": "def wipe_snapshots_data; end", "title": "" }, { "docid": "768effcaf1ee175bbdd8a438a0ad9ffa", "score": "0.5941509", "text": "def wipe_snapshots_data; end", "title": "" }, { "docid": "74bd4f013c63372d2e98884d4fdd8f44", "score": "0.58910906", "text": "def delete\n Mutagen::Util::delete_bytes(@fileobj, @size, @offset)\n @parent_chunk.resize(@parent_chunk.data_size - @size) unless @parent_chunk.nil?\n end", "title": "" }, { "docid": "8cde419de8b9347a22288204d6b8f2c3", "score": "0.58531314", "text": "def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end", "title": "" }, { "docid": "a2e327797f0d8bc12aa7480ea0eb7db1", "score": "0.57470095", "text": "def remove_file src\n src = src.src if src.respond_to? :src # if passed an OpenStruct e.g.\n trace { \"remove_file: removing file '#{src}' [nuget model: package]\" }\n @files = @files.reject { |f| f.src == src }\n end", "title": "" }, { "docid": "5493239b06dfdc31b8b238c7e21c7d0f", "score": "0.5700808", "text": "def remove_mount_point\n FileFoo.call!(api_base_file_name) { |content| remove_from_base(content) }\n end", "title": "" }, { "docid": "df7f266ab9a53b41fa263284c414fcb9", "score": "0.56474215", "text": "def remove(filename); end", "title": "" }, { "docid": "f9442f3e0fd6fa0cd0991345f0d89ef7", "score": "0.56412214", "text": "def unlink_from_work\n work = file_set.parent\n # monkey patch\n work.total_file_size_subtract_file_set! file_set\n # monkey patch\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end", "title": "" }, { "docid": "42a90e857405a0bd5580329d00bb2e63", "score": "0.56398207", "text": "def clear\n @mutex.synchronize {\n @pos = 0\n @sio.seek 0\n @sio.truncate 0\n }\n end", "title": "" }, { "docid": "f8e94255d4780402b914868bc21e268e", "score": "0.562061", "text": "def delete_at(p0) end", "title": "" }, { "docid": "ede3669b36fb0f68099fd64db15566ee", "score": "0.5617001", "text": "def truncate(ctx,path,offset)\n return wrap_context(ctx,__method__,path,offset) if ctx\n\n unless @root.can_write?(path)\n raise Errno::EACESS.new(path)\n end\n\n current_size = size(path)\n unless @root.raw_truncate(path,offset)\n contents = @root.read_file(path)\n if (offset <= 0)\n @root.write_to(path,\"\")\n elsif offset < contents.length\n @root.write_to(path,contents[0..offset] )\n end\n end\n @adj_size = @adj_size - current_size + (offset <= 0 ? 0 : offset)\n end", "title": "" }, { "docid": "ab50beaf2f45ce4aea2bf1046079e8e4", "score": "0.5543845", "text": "def removetag1\n if hastag1?\n newsize = @file.stat.size(filename) - TAGSIZE\n @file.truncate(newsize)\n @tag1.clear\n end\n self\n end", "title": "" }, { "docid": "790e0f2ece5a71ff112e44b4f7b696d2", "score": "0.5543612", "text": "def rm_part\n FileUtils.rm part if File.exist?(part)\n end", "title": "" }, { "docid": "a4ddd785810b92b6c933387fe2c717fe", "score": "0.5529254", "text": "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "title": "" }, { "docid": "0df0299d59e3769e4136978a36185162", "score": "0.55201703", "text": "def remove_from_base(file)\n file.sub!(mount_point, '')\n end", "title": "" }, { "docid": "4f7ffc7cf920ca091ed4dccdd0fb8a85", "score": "0.54967093", "text": "def remove_photo_from_filesystem\n member_photo = nil\n end", "title": "" }, { "docid": "c1bab43e536d69484675610601ce56c6", "score": "0.5487263", "text": "def delete\n @file = nil\n # file.delete\n end", "title": "" }, { "docid": "c801a6c1dea52836984e4e55c8ef3700", "score": "0.5468912", "text": "def del\n File.delete(@file)\n end", "title": "" }, { "docid": "eb85cd4ca760376354f5092f8c826be6", "score": "0.5464189", "text": "def delete_after\r\n result = @buffer.delete_at(@cursor)\r\n @buffer.compact! #needed?\r\n result\r\n end", "title": "" }, { "docid": "b8d0127b6fe1c0e639069ba8ebd3601e", "score": "0.5463918", "text": "def delete_file\n @file = []\n end", "title": "" }, { "docid": "24e74b2100ef9251246b7ee6ae993931", "score": "0.5459291", "text": "def uncache file \n refresh = nil\n begin\n is_a_file = F === file\n path = (is_a_file ? file.path : file.to_s) \n stat = (is_a_file ? file.stat : F.stat(file.to_s)) \n refresh = tmpnam(F.dirname(path))\n ignoring_errors do\n F.link(path, refresh) rescue F.symlink(path, refresh)\n end\n ignoring_errors do\n F.chmod(stat.mode, path)\n end\n ignoring_errors do\n F.utime(stat.atime, stat.mtime, path)\n end\n ignoring_errors do\n open(F.dirname(path)){|d| d.fsync}\n end\n ensure \n ignoring_errors do\n F.unlink(refresh) if refresh\n end\n end\n end", "title": "" }, { "docid": "1ae0d93bb1f445d929f0417c4703c9be", "score": "0.5453963", "text": "def clean(&block)\n @target.files.each do |object|\n unless @source.files.include? object.key\n block.call(object)\n object.destroy\n end\n end\n end", "title": "" }, { "docid": "32f71960a9000d7b91cada0b2c853e15", "score": "0.54458445", "text": "def smb_file_rm(file)\n fd = smb_open(file, 'ro')\n fd.delete\nend", "title": "" }, { "docid": "69f3ba85dfc021b564f68588d7889cac", "score": "0.54432106", "text": "def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end", "title": "" }, { "docid": "7125db89e205d26b9b6bfe84ddb2c08a", "score": "0.5435673", "text": "def delete(table, id)\n file = $tables[table]\n raw_row = binary_search(file, id)\n row_id = raw_row[0...10].to_i\n\n # Read the data after the current row\n cur_size = file.size()\n file_offset = row_id * ROW_LENGTH\n file.seek(file_offset, File::SEEK_SET)\n file_end = file.read(file.size() - file_offset)\n\n # Overwrite file starting at current row\n file.seek((row_id - 1) * ROW_LENGTH, File::SEEK_SET)\n file.write(file_end)\n\n file.truncate(cur_size - ROW_LENGTH) # Shrink size of file by one row\n\n true\nend", "title": "" }, { "docid": "1210a09854d7164cecb2b02441763939", "score": "0.5433012", "text": "def prune_index\n# missing_files=index_time_dbm_file.reject{|filename,itime| File.exists?(filename) && Picolena::IndexedDirectories.any?{|dir,alias_path| filename.starts_with?(dir)}}\n# missing_files.each{|filename, itime|\n# index.writer.delete(:complete_path, filename)\n# index_time_dbm_file.delete(filename)\n# logger.debug \"Removed : #{filename}\"\n# }\n# index.optimize\n end", "title": "" }, { "docid": "2193c06624b3459464cbbe03f5993338", "score": "0.54122967", "text": "def cleanup_old_files\n # make a local copy of to_delete while simultaneously clearing the original (atomicity)\n # local_to_delete = $to_delete.slice!(0..-1).to_a\n local_to_delete = []\n $to_delete.delete_if { |v| local_to_delete << v; true }\n\n $files.each_pair do |uuid, file|\n if file.nil?\n $files.delete uuid\n elsif local_to_delete.include?(uuid) || (Time.now - 60*60) > file.ctime\n file.close # Close it\n file.unlink if file.respond_to? :unlink # Unlink it if we can\n $files.delete uuid\n end\n end\n GC.start\nend", "title": "" }, { "docid": "9d9d03f8b7f56429508b3740b8e085c1", "score": "0.5407198", "text": "def delete_before\r\n return nil if @cursor == 0\r\n result = @buffer.delete_at(@cursor - 1)\r\n @buffer.compact! #needed?\r\n @cursor = @cursor - 1 if result != nil\r\n result\r\n end", "title": "" }, { "docid": "1ab2bc765fec69434d82fdbe5c8f7bb8", "score": "0.5385551", "text": "def unshare_file_in_db(file_id, user_id)\n $db.execute(\"DELETE FROM shared_files WHERE file_id = ? AND user_id = ?\", file_id, user_id)\nend", "title": "" }, { "docid": "35f11f307ddf4e7c534f7a53444f7cdc", "score": "0.5385453", "text": "def delete(offset)\n iterator = self.iterator\n iterator.delete(offset)\n end", "title": "" }, { "docid": "4bc2f4f671407fb2d9499e60819dbc91", "score": "0.53733253", "text": "def unmap_file(path)\n path = path.to_s\n @files.delete path\n end", "title": "" }, { "docid": "4bc2f4f671407fb2d9499e60819dbc91", "score": "0.53733253", "text": "def unmap_file(path)\n path = path.to_s\n @files.delete path\n end", "title": "" }, { "docid": "94b92475a5a2caad0ea85175faca2c1b", "score": "0.53636044", "text": "def delete_file_parts\n #TODO implementation\n end", "title": "" }, { "docid": "fce41d09c966d862fb7c39cb9ef93446", "score": "0.5361522", "text": "def read_and_delete(file_tmp_id)\n return read(file_tmp_id) do |this,content|\n yield(this,content)\n delete(file_tmp_id)\n end\n end", "title": "" }, { "docid": "a5e548de113e249c6ad8d0c486a5a1c3", "score": "0.5351626", "text": "def __remove_cluster_data\n FileUtils.rm_rf arguments[:path_data]\n end", "title": "" }, { "docid": "4703da2c7162d8f90c4503345b228139", "score": "0.5349524", "text": "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "title": "" }, { "docid": "4703da2c7162d8f90c4503345b228139", "score": "0.5349524", "text": "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "title": "" }, { "docid": "202bb86d7a0115d4b1326cbc0f5d9dbc", "score": "0.53351694", "text": "def m_delete\n a = source \"a\"\n sink a.delete(\"b\") # $ hasTaintFlow=a\n sink a.delete_prefix(\"b\") # $ hasTaintFlow=a\n sink a.delete_suffix(\"b\") # $ hasTaintFlow=a\nend", "title": "" }, { "docid": "612247afd29716690e5f3a69c70c65c0", "score": "0.5329828", "text": "def rewind(f)\n# Seek method is used to move the file pointer to particular location. Here it moves to beginning of the file\n f.seek(0)\nend", "title": "" }, { "docid": "53eec837673b3670f29e82505f43e7a2", "score": "0.5314914", "text": "def seek(p0) end", "title": "" }, { "docid": "1c3921dc83d15a01057e167ffbef51f7", "score": "0.53084624", "text": "def remove_lines(f)\n open(f, 'r') do |f1|\n open(\"#{f}.tmp\", 'w') do |f2|\n f.each_line do |line|\n f2.write(line) unless line.start_with? \"centos-7\"\n end\n end\n end\nend", "title": "" }, { "docid": "fa8eaf6333e2121784c710499454d354", "score": "0.5307085", "text": "def rewind(hank)\n# this utilizes the seek method attached to our file to do somethingIll get back to you on that \n hank.seek(0 , IO::SEEK_SET)\n#Ends the function \nend", "title": "" }, { "docid": "3c5c0a8dbea0a5f2766212c9bc0824ed", "score": "0.5301587", "text": "def close\n if @src.data.respond_to? :unmap\n @src.data.unmap\n end\n end", "title": "" }, { "docid": "23544df21212e562cf30db442e0eb85d", "score": "0.52990985", "text": "def clear\n io.truncate(0)\n io_index.clear\n self\n end", "title": "" }, { "docid": "fd706500d048669f42815553d367ba30", "score": "0.5294292", "text": "def remove file\n file.delete\n @files -= [file]\n end", "title": "" }, { "docid": "99fac3ced0da2743b5c49d7cc5f5c9c2", "score": "0.52863866", "text": "def fsremovem(name, sname)\n if fremoved name, sname\n s = fslistf name\n s.each do |i|\n fremovem i, sname\n end\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "4a10d35956fbfa5bafc8ad3062de55d4", "score": "0.5283489", "text": "def remove!\n MiGA.DEBUG \"Metadata.remove! #{path}\"\n File.unlink(path)\n nil\n end", "title": "" }, { "docid": "b4289eb38bb4b5993bb6f8fc887a4d05", "score": "0.5280475", "text": "def remove_superfluous_destination_files\n # join mirror_file and dest_file and delete everything from dest_file which isn't in mirror_file\n # because mirror_file should represent the current state of the source mogile files\n Log.instance.info('Joining destination and mirror tables to determine files that have been deleted from source repo.')\n DestFile.where('mirror_file.dkey IS NULL').joins('LEFT OUTER JOIN mirror_file ON mirror_file.dkey = file.dkey').find_in_batches(batch_size: 1000) do |batch|\n batch.each do |file|\n # Quit if program exit has been requested.\n break if SignalHandler.instance.should_quit\n\n # Delete all files from our destination domain which no longer exist in the source domain.\n begin\n Log.instance.debug(\"key [ #{file.dkey} ] should not exist. Deleting.\")\n @dest_mogile.delete(file.dkey)\n @removed += 1\n @freed_bytes += file.length\n rescue => e\n @failed += 1\n Log.instance.error(\"Error deleting [ #{file.dkey} ]: #{e.message}\\n#{e.backtrace}\")\n end\n end\n\n # Print a summary to the user.\n summarize\n\n # Quit if program exit has been requested.\n return true if SignalHandler.instance.should_quit\n end\n end", "title": "" }, { "docid": "a1c90bcdf759e15c51bab4723f06d4d2", "score": "0.5278654", "text": "def rewind(f)\r\n f.seek(0)\r\nend", "title": "" }, { "docid": "a1c90bcdf759e15c51bab4723f06d4d2", "score": "0.5278654", "text": "def rewind(f)\r\n f.seek(0)\r\nend", "title": "" }, { "docid": "1380fed4d92d119ff3c785d9fee3b967", "score": "0.5277779", "text": "def remove_data_line(which = 1)\n remove_line(\"data_line_#{which}\")\n end", "title": "" }, { "docid": "f517ff8530a59b36bc2bfd96ca50250c", "score": "0.527267", "text": "def clear\n @pages.clear\n @page_counter = 0\n begin\n @f.truncate(0)\n rescue IOError => e\n raise RuntimeError, \"Cannote truncate cache file #{@file_name}: \" +\n e.message\n end\n end", "title": "" }, { "docid": "c5f4c9ca4a017b4071b3c864853faada", "score": "0.52676886", "text": "def destroy_dirty_file!(file)\n system(\"trashtrash #{file}\")\n end", "title": "" }, { "docid": "575f47730c0508c12bb4387d0d151928", "score": "0.5266804", "text": "def update_metadata\n @generic_file.destroy_existing_nested_nodes(params[:generic_file])\n super\n end", "title": "" }, { "docid": "534460ea3ccb22a134574d8358f6b909", "score": "0.5266183", "text": "def cleanup(name)\n override_data(name, File.size(name)) unless @is_pipe\n File.unlink name\n end", "title": "" }, { "docid": "8e9e445f67abe05cbe975d0e3ede4ac3", "score": "0.52452755", "text": "def rm path\n end", "title": "" }, { "docid": "6bba6f4489f2b8d0bd72f6ff4a835298", "score": "0.52443415", "text": "def test_remove_a_file\n a.rm(\"one\").commit(\"a removed one\")\n \n assert_equal nil, a['one']\n assert_equal \"one content\", b['one']\n \n b.pull\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n assert_log_equal [\n \"a added one\",\n \"a removed one\"\n ], b\n end", "title": "" }, { "docid": "b8fcf424a6e9f2f193fc4fcdfa30fea5", "score": "0.52413493", "text": "def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end", "title": "" }, { "docid": "15af8bc75e88145a0ad8bc672dd12dbb", "score": "0.52341545", "text": "def rewind(f)\n # Replaces reading 'cursor' for read file to start of file/ Restarts\n # the progression through the file contents to beginning (0).\n f.seek(0)\n# Closes method.\nend", "title": "" }, { "docid": "96aab37436c482f83a7f433f2fc7f03c", "score": "0.5225754", "text": "def rewind(f)\n f.seek(0)\n end", "title": "" }, { "docid": "b9038f94b3fb601cfeccd3dc054fece1", "score": "0.5223341", "text": "def removed_unmarked_paths\n #remove dirs\n dirs_enum = @dirs.each_value\n loop do\n dir_stat = dirs_enum.next rescue break\n if dir_stat.marked\n dir_stat.marked = false # unset flag for next monitoring\\index\\remove phase\n #recursive call\n dir_stat.removed_unmarked_paths\n else\n # directory is not marked. Remove it, since it does not exist.\n write_to_log(\"NON_EXISTING dir: \" + dir_stat.path)\n # remove file with changed checksum\n $local_content_data_lock.synchronize{\n $local_content_data.remove_directory(dir_stat.path, Params['local_server_name'])\n }\n rm_dir(dir_stat)\n end\n end\n\n #remove files\n files_enum = @files.each_value\n loop do\n file_stat = files_enum.next rescue break\n if file_stat.marked\n file_stat.marked = false # unset flag for next monitoring\\index\\remove phase\n else\n # file not marked meaning it is no longer exist. Remove.\n write_to_log(\"NON_EXISTING file: \" + file_stat.path)\n # remove file with changed checksum\n $local_content_data_lock.synchronize{\n $local_content_data.remove_instance(Params['local_server_name'], file_stat.path)\n }\n # remove from tree\n @files.delete(file_stat.path)\n end\n end\n end", "title": "" }, { "docid": "88f769a04a6e5ec22b5a3779b3c2ccf7", "score": "0.5220811", "text": "def rewind (f)\n f.seek(0)\nend", "title": "" }, { "docid": "4f37c543bd450229780e4e918bd1743f", "score": "0.52078104", "text": "def remove_content\n File.unlink(filename) if File.exist?(filename)\n end", "title": "" }, { "docid": "8a8da5128e93750c0e85f4aa0a6084a4", "score": "0.5204555", "text": "def delete_from_provider( file_info = {} )\n\t\traise NotImplementedError.new\n\tend", "title": "" }, { "docid": "cd92a7fc4a256ba0622142ae010f629a", "score": "0.5203804", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "cd92a7fc4a256ba0622142ae010f629a", "score": "0.5203804", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "cd92a7fc4a256ba0622142ae010f629a", "score": "0.5203804", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "cd92a7fc4a256ba0622142ae010f629a", "score": "0.5203804", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "cd92a7fc4a256ba0622142ae010f629a", "score": "0.5203804", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "cd92a7fc4a256ba0622142ae010f629a", "score": "0.5203804", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "cd92a7fc4a256ba0622142ae010f629a", "score": "0.5203804", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "b9dcf924a3ca76a6eff406638850df21", "score": "0.52028835", "text": "def delete\n \ttemp = @cbuf.delete_at(@s)\n \t@s += 1\n \ttemp\n end", "title": "" }, { "docid": "4972cc1e6b4111935ec81add29a36fd7", "score": "0.520251", "text": "def remove(filename)\n not_implemented('remove')\n end", "title": "" }, { "docid": "54f72b6c6a9980a0ac2f5fe805ed9e3e", "score": "0.51871675", "text": "def rewind(f)\n # will call the .seek method on 'f'\n f.seek(0)\nend", "title": "" }, { "docid": "2d8f2a77a43439bc4d883d524b4e2d2d", "score": "0.5186854", "text": "def seek(offset)\n @file.seek offset\n end", "title": "" }, { "docid": "36482ce88b526ef7b840c07704c2145b", "score": "0.51805115", "text": "def test_del_a_lot_of_content\n @buffer.ins 'abcde'\n assert_eq @buffer.del('abcde'), 'abcde'\n assert_eq @buffer.to_s, ''\n end", "title": "" }, { "docid": "69a95712b09626c5591359c3a01d8fff", "score": "0.51795447", "text": "def rewind(f)\n # '.seek()' command moves to the start of the file\n f.seek(0)\nend", "title": "" }, { "docid": "dcd0fed2d4e145e731dfaabf9bb8b948", "score": "0.51774955", "text": "def revert_pos(data); end", "title": "" }, { "docid": "6c8c5da2e08b4285b77d4dbe0f0c7759", "score": "0.5174038", "text": "def delete(filename); end", "title": "" }, { "docid": "0e49a2847c1939968de8ee2dca870c91", "score": "0.51722175", "text": "def reset\n FileUtils.remove_file(@path)\n end", "title": "" }, { "docid": "7dfcaa7d45f2c0cca5810c8d346fb4c6", "score": "0.516973", "text": "def rewind(f)\n f.seek(0) # .seek looks for an indexed part of the file, could use any number to place within a file.\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" }, { "docid": "23f37d01fae2903ff8143ceaec17ae9c", "score": "0.5169132", "text": "def rewind(f)\n f.seek(0)\nend", "title": "" } ]
7a1bc359bc31b08d99d3334007dc2ce2
DELETE /upload_files/1 DELETE /upload_files/1.xml
[ { "docid": "a135493943c7db3f92af212d0110c7b5", "score": "0.7353133", "text": "def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "7bc85308b4f9bbf4903fb2066cc5642b", "score": "0.75603354", "text": "def destroy\n @file_upload = FileUpload.find(params[:id])\n @file_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to(file_uploads_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e26874fa17ba5fe448a0738fbce034bc", "score": "0.75361454", "text": "def destroy\n @upload_file = UploadFile.find(params[:id])\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(upload_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8cfc5cde3f6f89af1a434d151abf40bf", "score": "0.74193674", "text": "def destroy\n @file_upload = FileUpload.find(params[:id])\n @file_upload.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(file_uploads_url) }\n wants.xml { head :ok }\n end\n end", "title": "" }, { "docid": "813fbf8b06bde57802551098b1001b35", "score": "0.72723246", "text": "def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to(uploads_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "813fbf8b06bde57802551098b1001b35", "score": "0.72723246", "text": "def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to(uploads_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "91da64dfff14ad2f870d7513ebe3f860", "score": "0.7233502", "text": "def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_uploads_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5e4e097a17f9b7c23e6ae1a1f30afa6c", "score": "0.72157437", "text": "def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5f7fdb2b6d0d0acb9b1d6fb54545ee8e", "score": "0.71484685", "text": "def destroy\n @upload_file = UploadFile.find(params[:id])\n\t\tauthorize! :destroy, @upload_file\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(upload_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2340ecc7564a94f2b3194d92c7606dea", "score": "0.6991678", "text": "def file_delete(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/delete\", params)\n parse_response(response)\n end", "title": "" }, { "docid": "6218faaff2cfa275bec3cc711307bbff", "score": "0.69332945", "text": "def destroy\n @upload = Upload.find(params[:id])\n\tif File.exists?(Rails.root.join('..', 'uploads', @upload.file_name))\n\t\tFile.delete(Rails.root.join('..', 'uploads', @upload.file_name))\t\n\tend\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "991f37c2185bcd1ffe4dea6d611608a4", "score": "0.69154435", "text": "def destroy\n @up_file = UpFile.find(params[:id])\n @up_file.destroy\n\n respond_to do |format|\n format.html { redirect_to up_files_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c2daca4c58ca45703085925299ed67ce", "score": "0.68985736", "text": "def delete(path = '/files/', params = {})\n request :delete, path, params\n end", "title": "" }, { "docid": "c23e03ee696a0f0f34c6131ec4f533d8", "score": "0.68895024", "text": "def delete_upload_request(upload_id)\n call(:delete, upload_path(\"#{upload_id}/\"))\n end", "title": "" }, { "docid": "ef129bc8d7d64823860a34ded0c5ce18", "score": "0.68755096", "text": "def destroy\n @uploaded_file = UploadedFile.find(params[:id])\n upload = @uploaded_file.upload\n if upload.status == 1\n @uploaded_file.destroy\n else\n flash[:alert] = \"Deleting a file in an upload with status '#{upload.status_string}' is not allowed.\"\n end\n\n respond_to do |format|\n format.html { redirect_to upload_path(upload) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "24981557698b7cd78b759e5fb16b715f", "score": "0.68616736", "text": "def destroy\n #FIXME: Double check auth is working for deletion. Also, maybe should only delete if not associated with any experiments.\n @data_file.destroy\n \n respond_to do |format|\n format.html { redirect_to(data_files_path) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "28dc785cac54f308e9058ad8af52f4cc", "score": "0.6855539", "text": "def destroy\n @data_file = DataFile.find(params[:id])\n @data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "41addfb0d8722eaf90da45ee27e38b72", "score": "0.68497235", "text": "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "title": "" }, { "docid": "e89ee4054a559fcbaf96e536cfa399ca", "score": "0.68125314", "text": "def deleteUploadFile\n\n filepath = Rails.root.join(path, file_name)\n\n if File.exist? filepath \n File.delete filepath\n end\n\n end", "title": "" }, { "docid": "9c946c8504bc427fdb924b8878a952cb", "score": "0.68016183", "text": "def destroy\n # Actually removing it from amazon if left as an exercise for the reader...\n # HINT: Amazon has many libs you can use to do this.\n @upload.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ba32cdbcff14d7195d860ff2a33f2242", "score": "0.67831254", "text": "def delete_file(uid, info = {})\n if info[\"multipart_id\"]\n multipart_upload = object(uid).multipart_upload(info[\"multipart_id\"])\n abort_multipart_upload(multipart_upload)\n\n delete [object(\"#{uid}.info\")]\n else\n delete [object(uid), object(\"#{uid}.info\")]\n end\n end", "title": "" }, { "docid": "c264fff3033d88a38d6f3ef5bb244d6c", "score": "0.6782478", "text": "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "title": "" }, { "docid": "5d2026243544b39ba85bc49b372cee2e", "score": "0.67791694", "text": "def destroy\n @file_upload.destroy\n respond_to do |format|\n format.html { redirect_to file_uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "044651fc8cf731a7b6d818acaecd8f90", "score": "0.67724323", "text": "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "788f67befc99d4974f559b9a680d1a43", "score": "0.675934", "text": "def destroy\n @file = UserUpload.find(params[:id])\n if @file\n \[email protected]\n end\n # Render nothing to denote success\n render :text => \"\" and return\n end", "title": "" }, { "docid": "f40a13fd3988b827af65201da99d98db", "score": "0.6758017", "text": "def delete_files(uuids)\n Uploadcare::FileList.batch_delete(uuids)\n end", "title": "" }, { "docid": "cbe118f7ca202c521df8c27febc01048", "score": "0.67275184", "text": "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "title": "" }, { "docid": "e73919f7f907befdc3b9c12a3a2b6a8b", "score": "0.6722231", "text": "def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6961915bc2e0178b7a8913ded73d1d27", "score": "0.671011", "text": "def delete_file(file)\n delete_attachment(file)\n end", "title": "" }, { "docid": "8a6b57608f94fd8534ba6071d3c45ae7", "score": "0.6710041", "text": "def destroy\n @raw_data_file = RawDataFile.find(params[:id])\n @raw_data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(raw_data_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9173a7e43b358134d131e1c40083b04b", "score": "0.6707721", "text": "def destroy\n @[email protected]_uploads.find(params[:id])\n @file_upload.destroy\n respond_to do |format|\n format.html { redirect_to user_file_uploads_path, notice: 'File was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f16604da19c3d84055366a7c2ca7556c", "score": "0.6703331", "text": "def delete_file_from_database(file_id)\n $db.execute(\"DELETE FROM files WHERE id = ?\", file_id)\n $db.execute(\"DELETE FROM file_share_table WHERE file_id = ?\", file_id)\nend", "title": "" }, { "docid": "6c8c5da2e08b4285b77d4dbe0f0c7759", "score": "0.6697037", "text": "def delete(filename); end", "title": "" }, { "docid": "bddc9ebd679a24ef630fe953af0ef74c", "score": "0.6682035", "text": "def delete(cloud_file)\n\n payload = {\n root: \"auto\",\n path: cloud_file.path\n }\n\n connexion = Dropbox.start(:delete, access_token)\n response = connexion.post do |req|\n req.url \"fileops/delete\"\n req.body = payload\n end\n response = format_response(response)\n Filetree.new('dropbox').update([response[:path], nil])\n\n end", "title": "" }, { "docid": "2ae8cb2c473b0b518b087a250ada58fd", "score": "0.66707915", "text": "def destroy\n @action_file = ActionFile.find(params[:id])\n @action_file.destroy\n\n respond_to do |format|\n format.html { redirect_to action_files_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "55e9b3cfaeb826cc3a9763a96f8cadf1", "score": "0.66654027", "text": "def destroy\n @upload_file.destroy\n respond_to do |format|\n format.html { redirect_to upload_files_url, notice: 'Upload file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "55e9b3cfaeb826cc3a9763a96f8cadf1", "score": "0.66654027", "text": "def destroy\n @upload_file.destroy\n respond_to do |format|\n format.html { redirect_to upload_files_url, notice: 'Upload file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9ee94d52bfc0f259f68aad22c33e75da", "score": "0.66626227", "text": "def destroy\n @related_content = RelatedContent.find(params[:id])\n @related_content.destroy\n dirname = \"#{RelatedContent::UPLOAD_DIR}/#{@related_content.id}\"\n FileUtils.rm_rf dirname\t\n redirect_to @related_content.node\t \n\nend", "title": "" }, { "docid": "fdf9202c7dabca221da546d6805b5d83", "score": "0.66625935", "text": "def destroy\n @userfile = Userfile.find(params[:id])\n @userfile.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3964da8a8c11f702ee970da295ae88af", "score": "0.66507393", "text": "def destroy\n @upload_picture = UploadPicture.find(params[:id])\n @upload_picture.destroy\n\n respond_to do |format|\n format.html { redirect_to(upload_pictures_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "1a99dc38eef39051cd1341c980ef5436", "score": "0.6648188", "text": "def destroy\n @upload = @upload = Upload.find_by(id: params[:id], user_id: current_or_guest_user.id)\n @file = ActiveStorage::Attachment.find(params[:file])\n @file&.purge\n @upload.destroy unless @upload.files.present?\n flash[:success] = 'File Deleted Successful!'\n redirect_to root_path\n rescue StandardError => error\n flash[:danger] = 'File Does Not Exist!'\n flash[:error] = error.message\n redirect_to root_path\n end", "title": "" }, { "docid": "e1d6f603cb5ea1e475ea71422432aeae", "score": "0.66393507", "text": "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "title": "" }, { "docid": "e188c2380eae13f13a6e6eae598ea1f0", "score": "0.66368073", "text": "def delete_file_from_db(file_id)\n $db.execute(\"DELETE FROM files WHERE file_id = ?\", file_id)\nend", "title": "" }, { "docid": "ceadf0d320a193ed65518fc18f511a29", "score": "0.6631799", "text": "def _delete(uploaded_file, context)\n remove(uploaded_file, context)\n end", "title": "" }, { "docid": "636436bd467f92485b7890df92424d5a", "score": "0.6629014", "text": "def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "636436bd467f92485b7890df92424d5a", "score": "0.6629014", "text": "def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3558b8cc26dbab58a9557aa046eede6a", "score": "0.66258186", "text": "def destroy\n @file_version.destroy\n head :no_content\n end", "title": "" }, { "docid": "ac777ddb90ffea4eb48a667257b87dfa", "score": "0.6624568", "text": "def test_delete_file()\n\n path = 'folder/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n request = DeleteFileRequest.new(path, versionId, storage)\n\n result = @storage_api.delete_file(request)\n assert result.code == 200,'Error while deleting document'\n\n end", "title": "" }, { "docid": "114d55bfc17016ed74ee3f1d77b876dc", "score": "0.66222084", "text": "def destroy\n @uploaded_image = UpdatedImage.find(params[:id])\n @uploaded_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "627fb6f4873c2b726ecf92af026f345c", "score": "0.66185147", "text": "def destroy\n @document = Document.find(params[:id])\n collection = Collection.find(@document.collection_id)\n upload_remove(@document) #Removes upload record if file is deleted\n @document.destroy\n\n respond_to do |format|\n #format.html { redirect_to collections_path }\n format.html { redirect_to collection }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "fd346b43379615f625399a81da176a61", "score": "0.66115946", "text": "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "34810817c994457c2beb11f6a724ff07", "score": "0.66102964", "text": "def destroy\n mytemplate = Mytemplate.get(params[:id])\n close_document(mytemplate)\n \n begin\n if mytemplate != nil\n if File.exist?(mytemplate.path) \n FileUtils.rm_rf mytemplate.path\n end\n \n if File.exist?(mytemplate.file_path+mytemplate.id.to_s) \n FileUtils.rm_rf mytemplate.file_path+mytemplate.id.to_s\n end\n\n end\n rescue\n puts_message \"Error! in progress of mytemplate file deletion.\"\n end\n\n mytemplate.destroy\n \n respond_to do |format|\n format.html { redirect_to(mytemplates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "770901f44ad341887244d590ce3dfde3", "score": "0.6607931", "text": "def destroy\n \n @user_file = UserFile.find(params[:id])\n authorize! :destroy, @user_file\n name=@user_file.uploaded_file_file_name\n @user_file.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice=>\"Deleted file: \"+name }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "24beaf1bbbd1d2be6e1aabe14315b8e5", "score": "0.65975225", "text": "def destroy\n @super_file = SuperFile.find(params[:id])\n @super_file.destroy\n\n respond_to do |format|\n format.html { redirect_to super_files_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "91aabee26c2b0615b54d7f28f86bc211", "score": "0.6587517", "text": "def test_delete_file\n remote_file_name = 'TestDeleteFile.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = DeleteFileRequest.new(path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.delete_file(request)\n end", "title": "" }, { "docid": "2944d176b80fda4046d16046a613ddf0", "score": "0.6586154", "text": "def destroy\n sf = @site.site_files.find params[:id]\n sf.destroy\n\n flash[:notice] = \"#{sf.path} has been deleted.\"\n respond_to do |format|\n format.html { redirect_to(site_site_files_path(@site)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "1aedca7a9dfed4104f17093b1402a0ab", "score": "0.65820706", "text": "def destroy\n @parsefile = Parsefile.find(params[:id])\n @parsefile.destroy\n\n respond_to do |format|\n format.html { redirect_to(parsefiles_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ce970101e6c71e27d4e14eada710c9d0", "score": "0.65818", "text": "def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to user_uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8a2bd4d6de437ce381d2df8e32a6605f", "score": "0.657683", "text": "def destroy\n @document.destroy\n save_log({ :action => 'DELETE', :document => { :before => @old_document }})\n #TODO delete the file from disk\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9fff49695a2f566c08ba409d5bd22110", "score": "0.6576454", "text": "def delete_file(file_name)\n fail 'No Structure ID defined for structure. Can\\'t delete file' if @structure.id.nil?\n\n data = Hashie::Mash.new\n data.structure_id = @structure.id\n data.file_name = file_name\n\n push_file('api/remove_file', MultiJson.dump(data))\n end", "title": "" }, { "docid": "db714267f1e35c1d0fc2a23866a22e93", "score": "0.65718734", "text": "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "title": "" }, { "docid": "a4ddd785810b92b6c933387fe2c717fe", "score": "0.65717685", "text": "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "title": "" }, { "docid": "73eab930c34213e41d3ee70b5d474cab", "score": "0.65716195", "text": "def delete_all_files\n @import.delete_all_files\n head :no_content\n end", "title": "" }, { "docid": "6346bc36a5fce0b22357d5779daa4f9f", "score": "0.6567655", "text": "def destroy\n @uploaded_file.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Uploaded file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c6573087ebbec0f8fa0e0d3d0fadb4a", "score": "0.65658224", "text": "def delete_one(file)\n files_collection.find(:_id => file.id).delete_one\n chunks_collection.find(:files_id => file.id).delete_many\n end", "title": "" }, { "docid": "1dc585e437f984715503d0ca020dbc74", "score": "0.656571", "text": "def destroy\n @file_upload_attachment.destroy\n respond_to do |format|\n format.html { redirect_to file_upload_attachments_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6ecd155f47663a75ad019d9662242d43", "score": "0.65586084", "text": "def destroy\n @upload_file_to_auto_desk.destroy\n respond_to do |format|\n format.html { redirect_to upload_file_to_auto_desks_url, notice: 'Upload file to auto desk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d558c72de8b511b8871fdf493730168", "score": "0.6556324", "text": "def destroy\n @audio_file = AudioFile.find(params[:id])\n @audio_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "dd0d724f5246b16f2eef2dfebda9500c", "score": "0.6550356", "text": "def delete_uploaded_file(new_file)\n if version_name.blank? && Refinery::PhotoGallery.delete_uploaded_file\n filename_to_delete = File.join(Rails.root.to_s,Refinery::PhotoGallery.photo_gallery_dir_relative_to_root, store_dir, filename )\n File.delete(filename_to_delete)\n end\n end", "title": "" }, { "docid": "6ad8f8fc5a84100d2eae0c5d0a1d8375", "score": "0.65384877", "text": "def destroy\n begin\n File.delete( @doc_file.docOwner)\n rescue\n end\n @doc_file.destroy\n \n respond_to do |format|\n format.html { redirect_to doc_files_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9af9656f65d892aefb36bcb4bab6f1f4", "score": "0.65333307", "text": "def destroy\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "98dfbaf7242c631c7a71e6e4871fb916", "score": "0.6521518", "text": "def delete_files\n return if id.nil?\n return unless File.exist?(directory_path)\n\n FileUtils.rm_rf(directory_path)\n s3_delete_files\n end", "title": "" }, { "docid": "e3a6f7b35b51a842eb8bb1c3a678aee4", "score": "0.6517691", "text": "def delete_file\n File.unlink file\n end", "title": "" }, { "docid": "e3a6f7b35b51a842eb8bb1c3a678aee4", "score": "0.6517691", "text": "def delete_file\n File.unlink file\n end", "title": "" }, { "docid": "21cef043cd22859e793352380dd4da34", "score": "0.65121806", "text": "def delete(uploaded_file, context = {})\n _delete(uploaded_file, context)\n uploaded_file\n end", "title": "" }, { "docid": "9cc003386a7448f786a1d31dc3aa61ab", "score": "0.65095913", "text": "def destroy\n @attachfile.destroy\n respond_to do |format|\n format.html { redirect_to attachfiles_url, notice: 'Attachfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cc975485bfcd192ad7c2211ba93d7a0c", "score": "0.6507764", "text": "def delete(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/delete?file_ids=%s' % [id]).status == \"OK\"\n end", "title": "" }, { "docid": "69b205c158f7212cc750ed38fc878f1c", "score": "0.6492421", "text": "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "title": "" }, { "docid": "d008c27b4a0c3c33ea6e4a1e65d78d68", "score": "0.64921206", "text": "def destroy\n @upload_file_to_server.destroy\n respond_to do |format|\n format.html { redirect_to upload_file_to_servers_url, notice: 'Upload file to server was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "17fbc2331c0175e67e925669e730c549", "score": "0.64899224", "text": "def destroy\n @super_d_upload.destroy\n respond_to do |format|\n format.html { redirect_to super_d_uploads_url, notice: 'Super d upload was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d81aff0f20471da00473633f27e51425", "score": "0.64879817", "text": "def destroy\n @indexed_file = IndexedFile.find(params[:id])\n @indexed_file.destroy\n\n respond_to do |format|\n format.html { redirect_to indexed_files_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1c0d418a54753ff08c503b31731304af", "score": "0.64878076", "text": "def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c801a6c1dea52836984e4e55c8ef3700", "score": "0.64864665", "text": "def del\n File.delete(@file)\n end", "title": "" }, { "docid": "576d14ecdc3b8852927f3fb2ffd7d862", "score": "0.6469979", "text": "def delete\n conn.delete(escaped_path)\n true\n rescue StandardError => e\n puts \"carrierwave-upyun delete failed: #{e.inspect}\"\n nil\n end", "title": "" }, { "docid": "31b586f2e73176096c3d138eb35b73f4", "score": "0.6468466", "text": "def delete\n File.delete(file_name)\n rescue\n # ignore\n end", "title": "" }, { "docid": "29d3a4563444d1280e373cae5a38f608", "score": "0.6463987", "text": "def destroy\n @file_attachment = FileAttachment.find(params[:id])\n @test_case = @file_attachment.test_case\n @file_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(@test_case || file_attachments_path) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "62d69687cb983f79f9abc2c52b443a65", "score": "0.645148", "text": "def destroy\n @uploaded_file = @page.uploaded_files.find(params[:id])\n return error_status(true, :cannot_delete_uploaded_file) unless (@uploaded_file.can_be_deleted_by(@logged_user))\n \n @slot_id = @uploaded_file.page_slot.id\n @uploaded_file.page_slot.destroy\n @uploaded_file.updated_by = @logged_user\n @uploaded_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(uploaded_files_url) }\n format.js {}\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "fb81976ddc9258e4e04002a6a5978014", "score": "0.644298", "text": "def delete\n @uppity_file = PostedFile.get(params[:id])\n @uppity_file.destroy\n redirect_to(posts_index_url)\n end", "title": "" }, { "docid": "043997e38eba838eed73a4347dd13b51", "score": "0.6440057", "text": "def destroy\n @jpeg_folder = JpegFolder.find(params[:id])\n @jpeg_folder.destroy\n\n respond_to do |format|\n format.html { redirect_to(jpeg_folders_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "81a526a36756d97ed2b6f94ec210546c", "score": "0.64387697", "text": "def destroy\n @application_file = ApplicationFile.find(params[:id])\n @application_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(application_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "fb0aa47bd86e40184f34e8964cd2e2a5", "score": "0.6435734", "text": "def destroy\n @seo_file.destroy\n respond_to do |format|\n format.html { redirect_to seo_files_url, notice: 'Seo file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1b485f397cc0dedee590a534f76a9593", "score": "0.64352274", "text": "def destroy\n @tmxfile = Tmxfile.find(params[:id])\n @tmxfile.destroy\n\n respond_to do |format|\n format.html { redirect_to(tmxfiles_url) }\n format.tmx { head :ok }\n end\n end", "title": "" }, { "docid": "8bacbc5d86c2fd90c91ee46528a7aa7e", "score": "0.64249164", "text": "def destroy\n @score_file = ScoreFile.find(params[:id])\n @score_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(score_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "57266f6edb3750de8e5ce3ad0f480054", "score": "0.6420897", "text": "def destroy\n @csv_upload = CsvUpload.find(params[:id])\n @csv_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to csv_uploads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6144a8e0fc5a8c71f0ec0b5d1ad8fca6", "score": "0.64177746", "text": "def destroy\n @ufile = Ufile.find(params[:id])\n @ufile.destroy\n\n respond_to do |format|\n format.html { redirect_to ufiles_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "67a02d10cb6aadfe20bbd690393503a7", "score": "0.64176214", "text": "def destroy\n @userfile.destroy\n\n fileName = Rails.root.join('public','uploads', @userfile.file_name_slug)\n File.delete(fileName) if File.exist?(fileName)\n\n respond_to do |format|\n format.html { redirect_to user_mycontact_meeting_userfiles_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2d8764b1f2f25110816a17f73f497f0e", "score": "0.6412399", "text": "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "title": "" }, { "docid": "226e4c88b9c2d4db679f61281276c9fe", "score": "0.6412101", "text": "def destroy\n @excel_file = ExcelFile.find(params[:id])\n @excel_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(excel_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4703da2c7162d8f90c4503345b228139", "score": "0.6405352", "text": "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "title": "" }, { "docid": "4703da2c7162d8f90c4503345b228139", "score": "0.6405352", "text": "def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend", "title": "" }, { "docid": "aa3daabf99bee2068b7ebe1e95f81ac4", "score": "0.6404048", "text": "def destroy\n @videofile = Videofile.find(params[:id])\n @videofile.destroy\n\n respond_to do |format|\n format.html { redirect_to(videofiles_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0c7941a6812ad0a07fe146c44fd68822", "score": "0.0", "text": "def set_player\n show\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59219855", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913137", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.589884", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889191", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58780754", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5863248", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.58094144", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57375425", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57285565", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57149214", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.56900954", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.56665677", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.5651118", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5648135", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56357735", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5627078", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5608873", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5598699", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5598419", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5589822", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5558845", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55084664", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.5504379", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465574", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.5464707", "text": "def on_setup(&block); end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54471064", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54455084", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5437386", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54160327", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5397424", "text": "def post_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392518", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.5385411", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53487605", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5346655", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53448105", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5342072", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5341318", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53243506", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53025913", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.5283114", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282289", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52585614", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.52571374", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52483684", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.5244467", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.5236853", "text": "def after_setup\n end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52330637", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52300817", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.522413", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.521999", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5215832", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.5213786", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.52100146", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52085197", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5203262", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5202406", "text": "def performed(action)\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.520174", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5201504", "text": "def create_setup\n \n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.51963276", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.5191404", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5178325", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.51765746", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.5162045", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5150735", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.5143402", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51415485", "text": "def code_action_provider; end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51376045", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51318985", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.5115387", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5109771", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5107364", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.5106081", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51001656", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.50964546", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.5093199", "text": "def add_callbacks(base); end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2b73362ad7bf778f2544b81bd088251b", "score": "0.0", "text": "def set_and_authorize_due_date\n @due_date = policy_scope(base_object).find(params[:id])\n authorize @due_date\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.59229624", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59169936", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.59169936", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.5899037", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.5889287", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58890367", "text": "def actions; end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.5877498", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5862599", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5810375", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.5740072", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.57316417", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.5718692", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5700777", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.5692726", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5668117", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.56531155", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.565059", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56384724", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.5625417", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.56102014", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5596785", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5596253", "text": "def execute_callbacks; end", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.55899394", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5557985", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.5557985", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.55090857", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55058104", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.54677796", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465028", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.5448835", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.5447902", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.54402983", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.54168683", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411516", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411516", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5400121", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5395004", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5395004", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5392725", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.53884417", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53783494", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.53593004", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.53494495", "text": "def register_action(action); end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5349437", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.53471607", "text": "def setup_phase; end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.53441674", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5342784", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.53281486", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.53036916", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.528415", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.52831894", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.5258319", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5256983", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.52521855", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.52472556", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.52398384", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52376497", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52376497", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.52329665", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.5229699", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5225785", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.52239066", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.5219224", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.52147436", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.52146924", "text": "def pick_action; end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.5211636", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52089876", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.5206151", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.5204869", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.520361", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5201687", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5198511", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5198511", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.51926094", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.5181837", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.5178642", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173357", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.51642865", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5153578", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.51448536", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5142863", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.51412", "text": "def code_action_provider; end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.5139861", "text": "def setup(params)\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.5134318", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.51167125", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5115634", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.51111007", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5109693", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5106379", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.510497", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.51013684", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.5096925", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.5093146", "text": "def config(action, *args); end", "title": "" } ]
567f22951f9d768ac17afbfe69410cf8
POST for grades changes
[ { "docid": "5d59023f79bfc391c14f906db3952c5c", "score": "0.682499", "text": "def changeGrades\n print \"@1\"\n # print params[:max]\n # takes the new grades criteris.\n # goes through all enrolls. and modifies the grade according to the new grades criteria.\n grade_bounds = [\n {max: params[:max], min: params[:A_plus], letter: 'A+'},\n {max: params[:A_plus], min: params[:A], letter: 'A'},\n {max: params[:A], min: params[:A_minus], letter: 'A-'},\n {max: params[:A_minus], min: params[:B_plus], letter: 'B+'},\n {max: params[:B_plus], min: params[:B], letter: 'B'},\n {max: params[:B], min: params[:B_minus], letter: 'B-'},\n {max: params[:B_minus], min: params[:C_plus], letter: 'C+'},\n {max: params[:C_plus], min: params[:C], letter:'C'},\n {max: params[:C], min: params[:C_minus], letter: 'C-'},\n {max: params[:C_minus], min: params[:D], letter: 'D'},\n {max: params[:D], min: params[:F], letter:'F'}\n ]\n @course_id = params[:course_id]\n @course = Course.find(@course_id)\n @enrollsForClass = Enroll.where(course_id: @course.course_id)\n @enrollsForClass.each do |enroll|\n print enroll.percentage\n grade_bounds.each do |grade_bound|\n print (grade_bound)\n match_upper_bound = grade_bound[:letter] == 'A+'? enroll.percentage <= grade_bound[:max].to_f : enroll.percentage < grade_bound[:max].to_f\n match_lower_bound = enroll.percentage >= grade_bound[:min].to_f\n\n if match_upper_bound && match_lower_bound\n print (\"here\")\n enroll.lettergrade = grade_bound[:letter]\n enroll.save\n break\n end\n end\n end\n redirect_to action: \"show\", course_id: @course_id\n end", "title": "" } ]
[ { "docid": "d8f03e50904508324535259d726c927e", "score": "0.7442485", "text": "def update_grades(new_grades)\n reload! unless @input_names\n \n page = @client.get @url\n grade_form = page.form_with :action => /detail/i\n new_grades.each do |assignment_name, new_grade|\n unless input_name = @input_names[assignment_name]\n raise ArgumentError, \"Invalid assignment #{assignment_name}\"\n end\n grade_form.field_with(:name => input_name).value = new_grade.to_s\n end\n grade_form.submit grade_form.button_with(:class => /save/)\n \n reload!\n end", "title": "" }, { "docid": "ad3182c11c70da0f36726403b61948ea", "score": "0.7297167", "text": "def update_grade\n grade_entry_form = GradeEntryForm.find(params[:id])\n grade_entry_student =\n grade_entry_form.grade_entry_students.find_or_create_by(user_id: params[:student_id])\n grade =\n grade_entry_student.grades.find_or_create_by(grade_entry_item_id: params[:grade_entry_item_id])\n\n grade.update(grade: params[:updated_grade])\n grade_entry_student.save # Refresh total grade\n grade_entry_student.reload\n render plain: grade_entry_student.total_grade\n end", "title": "" }, { "docid": "f835ada6e9a48bc91b9e0d5132fe1c12", "score": "0.7291639", "text": "def update_grade_entry_students\n return unless request.post?\n\n grade_entry_form = GradeEntryForm.find_by_id(params[:id])\n errors = []\n grade_entry_students = []\n\n if params[:students].nil?\n errors.push(I18n.t('grade_entry_forms.grades.must_select_a_student'))\n else\n params[:students].each do |student_id|\n grade_entry_students.push(\n grade_entry_form.grade_entry_students\n .find_or_create_by(user_id: student_id))\n end\n end\n\n # Releasing/unreleasing marks should be logged\n log_message = ''\n if params[:release_results]\n numGradeEntryStudentsChanged = set_release_on_grade_entry_students(\n grade_entry_students,\n true,\n errors)\n log_message = \"Marks released for marks spreadsheet '\" +\n \"#{grade_entry_form.short_identifier}', ID: '#{grade_entry_form.id}' \" +\n \"(for #{numGradeEntryStudentsChanged} students).\"\n elsif !params[:unrelease_results].nil?\n numGradeEntryStudentsChanged = set_release_on_grade_entry_students(\n grade_entry_students,\n false,\n errors)\n log_message = \"Marks unreleased for marks spreadsheet '\" +\n \"#{grade_entry_form.short_identifier}', ID: '#{grade_entry_form.id}' \" +\n \"(for #{numGradeEntryStudentsChanged} students).\"\n end\n\n # Display success message\n if numGradeEntryStudentsChanged > 0\n flash[:success] = I18n.t('grade_entry_forms.grades.successfully_changed',\n {numGradeEntryStudentsChanged: numGradeEntryStudentsChanged})\n m_logger = MarkusLogger.instance\n m_logger.log(log_message)\n end\n flash[:error] = errors\n\n head :ok\n end", "title": "" }, { "docid": "f835ada6e9a48bc91b9e0d5132fe1c12", "score": "0.7291639", "text": "def update_grade_entry_students\n return unless request.post?\n\n grade_entry_form = GradeEntryForm.find_by_id(params[:id])\n errors = []\n grade_entry_students = []\n\n if params[:students].nil?\n errors.push(I18n.t('grade_entry_forms.grades.must_select_a_student'))\n else\n params[:students].each do |student_id|\n grade_entry_students.push(\n grade_entry_form.grade_entry_students\n .find_or_create_by(user_id: student_id))\n end\n end\n\n # Releasing/unreleasing marks should be logged\n log_message = ''\n if params[:release_results]\n numGradeEntryStudentsChanged = set_release_on_grade_entry_students(\n grade_entry_students,\n true,\n errors)\n log_message = \"Marks released for marks spreadsheet '\" +\n \"#{grade_entry_form.short_identifier}', ID: '#{grade_entry_form.id}' \" +\n \"(for #{numGradeEntryStudentsChanged} students).\"\n elsif !params[:unrelease_results].nil?\n numGradeEntryStudentsChanged = set_release_on_grade_entry_students(\n grade_entry_students,\n false,\n errors)\n log_message = \"Marks unreleased for marks spreadsheet '\" +\n \"#{grade_entry_form.short_identifier}', ID: '#{grade_entry_form.id}' \" +\n \"(for #{numGradeEntryStudentsChanged} students).\"\n end\n\n # Display success message\n if numGradeEntryStudentsChanged > 0\n flash[:success] = I18n.t('grade_entry_forms.grades.successfully_changed',\n {numGradeEntryStudentsChanged: numGradeEntryStudentsChanged})\n m_logger = MarkusLogger.instance\n m_logger.log(log_message)\n end\n flash[:error] = errors\n\n head :ok\n end", "title": "" }, { "docid": "676ab3ea9b4bcbe498fdde129978557d", "score": "0.7290579", "text": "def update_grade_entry_students\n return unless request.post?\n\n grade_entry_form = GradeEntryForm.find_by_id(params[:id])\n errors = []\n grade_entry_students = []\n\n if params[:students].nil?\n errors.push(I18n.t('grade_entry_forms.grades.select_a_student'))\n else\n params[:students].each do |student_id|\n grade_entry_students.push(\n grade_entry_form.grade_entry_students\n .find_or_create_by(user_id: student_id))\n end\n end\n\n num_changed = 0\n # Releasing/unreleasing marks should be logged\n log_message = ''\n if params[:release_results] == 'true'\n num_changed = set_release_on_grade_entry_students(\n grade_entry_students,\n true,\n errors)\n log_message = \"Marks released for marks spreadsheet '\" +\n \"#{grade_entry_form.short_identifier}', ID: '#{grade_entry_form.id}' \" +\n \"(for #{num_changed} students).\"\n elsif params[:release_results] == 'false'\n num_changed = set_release_on_grade_entry_students(\n grade_entry_students,\n false,\n errors)\n log_message = \"Marks unreleased for marks spreadsheet '\" +\n \"#{grade_entry_form.short_identifier}', ID: '#{grade_entry_form.id}' \" +\n \"(for #{num_changed} students).\"\n end\n\n # Display success message\n if num_changed > 0\n flash_message(:success, I18n.t('grade_entry_forms.grades.successfully_changed',\n numGradeEntryStudentsChanged: num_changed))\n m_logger = MarkusLogger.instance\n m_logger.log(log_message)\n end\n errors.each do |err|\n flash_message(:error, err)\n end\n\n head :ok\n end", "title": "" }, { "docid": "410f9d3c4b6e0d9431fec9f9f7bb46fe", "score": "0.7167501", "text": "def update_grade\n grade_entry_form = GradeEntryForm.find(params[:id])\n @student_id = params[:student_id]\n @grade_entry_item_id = params[:grade_entry_item_id]\n updated_grade = params[:updated_grade]\n\n grade_entry_student =\n grade_entry_form.grade_entry_students.find_or_create_by(user_id:\n @student_id)\n\n @grade = grade_entry_student.grades.find_or_create_by(grade_entry_item_id:\n @grade_entry_item_id)\n\n @grade.grade = updated_grade\n @grade_saved = @grade.save\n @updated_student_total = grade_entry_student.total_grade\n\n grade_entry_student.save # Save updated grade\n end", "title": "" }, { "docid": "410f9d3c4b6e0d9431fec9f9f7bb46fe", "score": "0.7167501", "text": "def update_grade\n grade_entry_form = GradeEntryForm.find(params[:id])\n @student_id = params[:student_id]\n @grade_entry_item_id = params[:grade_entry_item_id]\n updated_grade = params[:updated_grade]\n\n grade_entry_student =\n grade_entry_form.grade_entry_students.find_or_create_by(user_id:\n @student_id)\n\n @grade = grade_entry_student.grades.find_or_create_by(grade_entry_item_id:\n @grade_entry_item_id)\n\n @grade.grade = updated_grade\n @grade_saved = @grade.save\n @updated_student_total = grade_entry_student.total_grade\n\n grade_entry_student.save # Save updated grade\n end", "title": "" }, { "docid": "07fba9b522970de543b45d8ade684ca5", "score": "0.7108909", "text": "def update\n if @grade.update(grade_params)\n render :show, status: :ok, location: @grade\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d06b98d67940fd191a00d19936f72f28", "score": "0.70714724", "text": "def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @grade, notice: t(:Grade_updated) }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ff416a8ef4a3c1c1a64dcb8a6267f4b", "score": "0.7058059", "text": "def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to root_path }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "748db88260658c76c10341bccd98c97a", "score": "0.70344615", "text": "def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to edit_admin_grade_path(@grade), notice: 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2782bdba202d1bf05ca09d2551bca8ee", "score": "0.7026837", "text": "def save_all_grades\n return unless load_course( params[:course] )\n return unless ensure_course_instructor_or_ta_with_setting( @course, @user, 'ta_grade_individual', 'ta_view_student_files', 'ta_grade_individual' )\n @assignment = Assignment.find( params[:assignment] )\n return unless assignment_in_course( @course, @assignment )\n \n # load the students\n @students = @course.students\n \n ### FOR EACH STUDENT - PROCESS THE GRADE COMING IN FROM THE FORM\n @grade_item = GradeItem.find(:first, :conditions => [\"assignment_id = ?\", @assignment.id] )\n if @grade_item\n ## Load the current grade entries for each student\n ## Map these to the student's user ID\n @grades = Hash.new\n entries = GradeEntry.find(:all, :conditions => [\"grade_item_id=?\", @grade_item.id ] )\n entries.each do |e|\n @grades[e.user_id] = e\n end\n \n Assignment.transaction do\n ## go through and update the grades\n @students.each do |student|\n new_grade = params[\"grade_#{student.id}\"]\n \n unless new_grade.nil? || new_grade.eql?(\"\")\n if @grades[student.id].nil?\n # no current entry\n unless new_grade.nil?\n entry = GradeEntry.new\n entry.user = student\n entry.grade_item = @grade_item\n entry.course = @course\n entry.points = new_grade.to_f\n entry.save\n end\n\n else\n ## existing entry\n if new_grade.nil? || new_grade.to_f < 0\n @grades[student.id].destroy\n else\n @grades[student.id].points = new_grade.to_f \n @grades[student.id].save\n end\n end\n end\n\n end\n end\n \n \n flash[:notice] = \"Grades have been updated for all students.\"\n if @assignment.quiz.nil? \n redirect_to :action => 'index', :course => @course, :assignment => @assignment\n else\n redirect_to :controller => '/instructor/results', :action => 'quiz', :course => @course, :assignment => @assignment\n end\n \n else\n flash[:badnotice] = \"There is no gradebook entry associated with this assignment.\"\n redirect_to :action => 'index'\n end\n end", "title": "" }, { "docid": "da6e5533aed100284169d8f65f23b058", "score": "0.70262307", "text": "def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea782de4f224e6b34a98563e51dbdf98", "score": "0.70053506", "text": "def update\n @grading_levels ||= @batch.grading_levels\n @grading_level1.update(params_grade)\n flash[:notice] = t('grade_update')\n end", "title": "" }, { "docid": "c31e23d2ddb4a3b9d25f0f91f1a2dc1d", "score": "0.6985906", "text": "def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to [@course, @assignment, @grade], notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "954a935a60cc04861f7e97cdb929f5eb", "score": "0.69712806", "text": "def update_grade\n @employee_grade_new = EmployeeGrade.new\n flash[:notice] = t('up_grade') if @employee_grade.update(grade_params)\n emp_grade\n end", "title": "" }, { "docid": "e81fb89bbc92cf9ecc07a83fbb0f79cf", "score": "0.6947965", "text": "def update\n respond_to do |format|\n if @grade.update(grade_params)\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "89e0ea109db242e518c32ed5da16d83c", "score": "0.68742377", "text": "def update\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n if @grade.update_attributes(params[:grade])\n format.html { redirect_to @grade, :notice => 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @grade.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "89e6f438356684b392a8f8192f0b6b67", "score": "0.6861024", "text": "def update\n @final_grade = FinalGrade.find(params[:id])\n\n respond_to do |format|\n if @final_grade.update_attributes(params[:final_grade])\n format.html { redirect_to @final_grade, notice: 'Final grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @final_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "18a82a9b1202b34c9d3700a5e3b4dae5", "score": "0.6822677", "text": "def update\n respond_to do |format|\n if ActiveRecord::Base.transaction_user(@current_user) { @grade.update(grade_params) }\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade }\n else\n format.html { render :edit }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85cf6a5943f5441e95a1fa4f630a7eb8", "score": "0.6803587", "text": "def update\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n if @grade.update_attributes(params[:grade])\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85cf6a5943f5441e95a1fa4f630a7eb8", "score": "0.6802694", "text": "def update\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n if @grade.update_attributes(params[:grade])\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6921e8af2bb5c2f9b98128fd6cea47cc", "score": "0.67956585", "text": "def update\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n if @grade.update_attributes(params[:grade])\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3da98b4113490743944489d4bf74dc35", "score": "0.6773769", "text": "def update\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n if @grade.update_attributes(grade_params)\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41cca48689e5c393315ca1e78eb47b49", "score": "0.6725255", "text": "def update\n respond_to do |format|\n if @assessment_grade.update(assessment_grade_params)\n format.html { redirect_to @assessment_grade, notice: 'Assessment grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @assessment_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c930979bf4ece015a5ac0abf568ce076", "score": "0.67101645", "text": "def update\n\t\t@grade = Grade.find_by_id(params[:id])\n\t\t@problem = AssignmentProblem.find_by_id(grade_params[:problem_id])\n\t\tif grade_params[:grade].to_i > @problem.final_grade\n\t\t\tflash.keep[:notice] = \"Please enter a value less than the total grade of the problem!\"\n\t\telsif @grade.update_attributes(grade_params)\n\t\t\tflash.keep[:notice] = \"Grade Updated\"\n\t\telse\n\t\t\tflash.keep[:notice] = \"Please enter a grade!\"\n\t\tend\n\t\tredirect_to :back\n\tend", "title": "" }, { "docid": "6b177be14d0d278ded679a1c23623340", "score": "0.66938215", "text": "def update\n @grade = Grade.find(params[:id])\n respond_to do |format|\n if @grade.update_attributes(params[:grade])\n format.html { redirect_to(@grade, :notice => 'Grade was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @grade.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4c636567c946c9989e1afd8714c56715", "score": "0.6665925", "text": "def update\n respond_to do |format|\n if @letter_grade.update(letter_grade_params)\n format.html { redirect_to @letter_grade, notice: 'Letter grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @letter_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bbb37fc6cd21d77fa643fecde0c2ba50", "score": "0.6632904", "text": "def grades\n @grade_entry_form = GradeEntryForm.find(params[:id])\n end", "title": "" }, { "docid": "191e7dca9309e909d4063b7e9df07dad", "score": "0.6619836", "text": "def grade_params\n params.require(:grade).permit(:user_id, :course_id, :assessment_item_id, :exam, :score)\n end", "title": "" }, { "docid": "90e37fad6b06d51e0ceedd563fbcc8a6", "score": "0.6618613", "text": "def grading_params\n params[:grading].permit(:score)\n end", "title": "" }, { "docid": "75a175e76983014d7240631a654ec3b7", "score": "0.6614448", "text": "def create\n @grade = Grade.new(grade_params)\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to edit_admin_grade_path(@grade), notice: 'Grade was successfully created.' }\n format.json { render action: 'show', status: :created, location: @grade }\n else\n format.html { render action: 'new' }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4374e7d77d3fcf12879d54edee8c7bd5", "score": "0.66137743", "text": "def update\n respond_to do |format|\n if @study_grade.update(study_grade_params)\n format.html { redirect_to @study_grade, notice: 'El Grado de Estudio ha sido actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @study_grade }\n else\n flash[:danger] = \"No se ha podido Procesar la Operacion\"\n format.html { render :edit }\n format.json { render json: @study_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "119671b73d79be3efda432ed79cc2277", "score": "0.6608507", "text": "def grade_params\n params.require(:grade).permit(:value, :person_id, :assignment_id)\n end", "title": "" }, { "docid": "73d560d426500753615e81635bb657a9", "score": "0.66058403", "text": "def update\n respond_to do |format|\n if @subject_grade.update(subject_grade_params)\n format.html { redirect_to @subject_grade, notice: 'Subject grade was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_grade }\n else\n format.html { render :edit }\n format.json { render json: @subject_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67ed441f9199d274bba3979adfb2e150", "score": "0.6602753", "text": "def create\n if @submission.graded?\n flash[:error] = \"Submission has already been graded by \" + @submission.gradings.last.grader.name\n redirect_to course_assessment_submission_grading_path(@course, @assessment, @submission, @submission.gradings.last)\n return\n end\n\n invalid_assign = false\n @grading.grade = 0\n\n params[:ags].each do |ag|\n @ag = @grading.answer_gradings.build(ag)\n @ag.grader = current_user\n @ag.grader_course = curr_user_course\n unless validate_gradings(@ag, ag)\n invalid_assign = true\n break\n end\n\n @grading.grade += @ag.grade\n end\n\n if @grading.grade > @assessment.max_grade || @grading.exp > @assessment.exp\n invalid_assign = true\n end\n\n @grading.grader = current_user\n @grading.grader_course = curr_user_course\n @grading.student = @submission.std_course\n\n if invalid_assign\n grade_error_response\n elsif @grading.save\n @submission.set_graded\n\n respond_to do |format|\n format.html { redirect_to course_assessment_submission_path(@course, @assessment, @submission),\n notice: \"Grading has been recorded.\" }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n end\n end\n end", "title": "" }, { "docid": "04ad625f9668892cd1949cffa5a7dbe8", "score": "0.6596659", "text": "def update\n @employee_grade = EmployeeGrade.find(params[:id])\n\n respond_to do |format|\n if @employee_grade.update_attributes(params[:employee_grade])\n format.html { redirect_to @employee_grade, notice: 'Employee grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a8e2aec6627f81f9748b9bf716dd7a1b", "score": "0.6595538", "text": "def update\n @student = Student.find_by_id(@maths_grade.student_id)\n if @maths_grade.update(maths_grade_params)\n redirect_to(student_path(@student), :notice => \"Post was successfully created.\")\n else\n redirect_to(student_path(@student), :notice => \"Post was successfully created.\")\n end\n end", "title": "" }, { "docid": "2ac6ea8a5592471b85ecf6de70f02c64", "score": "0.65839267", "text": "def update_grade(student_id, grade)\n grades[student_id.to_s] = grade\n save\n end", "title": "" }, { "docid": "9ce3cddcb69a904174f8450ee060f172", "score": "0.65824145", "text": "def grade_params\n params.require(:grade).permit(:date, :grade, :description)\n end", "title": "" }, { "docid": "f11ac83e2eb3ca8f465c3472b26efd7c", "score": "0.65706617", "text": "def update\n respond_to do |format|\n if @grade_set.update(grade_set_params)\n format.html { redirect_to @grade_set, notice: 'Grade set was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade_set }\n else\n format.html { render :edit }\n format.json { render json: @grade_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1916f7aea64ea8c830bbcd1392e52437", "score": "0.6540845", "text": "def update\n @student = Student.find_by_id(@english_grade.student_id)\n if @english_grade.update(english_grade_params)\nredirect_to(student_path(@student), :notice => \"Post was successfully created.\")\n else\nredirect_to(student_path(@student), :notice => \"Post was successfully created.\")\n end\n end", "title": "" }, { "docid": "52bb5e4046b8f763e75c60ad9114aa3b", "score": "0.65400964", "text": "def update\n authenticate_teacher\n unless @assignment_grade.update(assignment_grade_params)\n format.html { render :edit}\n end\n\n @assignment_grades = AssignmentGrade.where(student_id: @assignment_grade.student_id)\n end", "title": "" }, { "docid": "766dc5652f38c084bcbe6fea68733291", "score": "0.6532464", "text": "def create\n @assignment_grade = AssignmentGrade.new(assignment_grade_params)\n unless @assignment_grade.save\n render :new\n end\n student = Student.find(@assignment_grade.student_id)\n @assignment_grades = student.assignment_grades.reload\n end", "title": "" }, { "docid": "b1a438ffd7d5bb4b68ec30d81e326e66", "score": "0.65282416", "text": "def update\n respond_to do |format|\n if @grading.update(grading_params)\n format.html { redirect_to @grading, notice: 'Grading was successfully updated.' }\n format.json { render :show, status: :ok, location: @grading }\n else\n format.html { render :edit }\n format.json { render json: @grading.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3346a92d33b934276a6e8336bea47f7", "score": "0.6520966", "text": "def update\n @grade = Grade.find(params[:id])\n\t@repositories = Repository.all\n\t\n respond_to do |format|\n if @grade.update_attributes(params[:grade])\n format.html { redirect_to @grade, notice: 'Grade was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efef830948abb44c5a643b929e4bd2b9", "score": "0.65167254", "text": "def update\n respond_to do |format|\n if @grading_level.update(grading_level_params)\n format.html { redirect_to @grading_level, notice: 'Grading level was successfully updated.' }\n format.json { render :show, status: :ok, location: @grading_level }\n else\n format.html { render :edit }\n format.json { render json: @grading_level.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7251388dcedbbbf92f2c890e5ae14f2a", "score": "0.64997447", "text": "def create\n @grade = Grade.new(params[:grade])\n\t@repositories = Repository.all\n\t\n\t@grade_info = @grade.grade_repository\n\t\n\[email protected]_pass = @grade_info[2][1].to_i - @grade_info[2][3].to_i\n\[email protected]_possible = @grade_info[2][1].to_i\n\[email protected] = (@grade_info[0] + \"\\n\\n\" + @grade_info[1]).strip\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, notice: 'Grade was successfully created.' }\n format.json { render json: @grade, status: :created, location: @grade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df1d7d64532814150fe33d85e9d296e1", "score": "0.6475639", "text": "def update\n @student = Student.find(params[:student_id])\n @gradelevel = @student.gradelevels.find(params[:id])\n\n respond_to do |format|\n if @gradelevel.update_attributes(params[:gradelevel])\n format.html { redirect_to :back, notice: 'Grade Level Detention was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gradelevel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e799f8be856a79d5765731e17c9d668", "score": "0.6469177", "text": "def create\n @grade = Grade.new(params[:grade])\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, :notice => 'Grade was successfully created.' }\n format.json { render :json => @grade, :status => :created, :location => @grade }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @grade.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3e8f12b31746db2837bc6ff253a1aee", "score": "0.64664656", "text": "def commit_grades\n return unless will_commit_grades?\n\n grades = self.grades_for_scores scores\n Analysis.transaction do\n if submission.selected_for_grading?\n grades.each(&:save)\n end\n end\n end", "title": "" }, { "docid": "15d2df3b5d4b4815e1aec6b714325288", "score": "0.64627665", "text": "def create\n @grade = Grade.new(grade_params)\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to root_path }\n format.json { render :show, status: :created, location: @grade }\n else\n format.html { render :new }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6030157be019b2228895c538bd6f6e9f", "score": "0.64622587", "text": "def update\n respond_to do |format|\n if @grade_specification.update(grade_specification_params)\n format.html { redirect_to [@grade_specification.course,@grade_specification], notice: 'Grade specification was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade_specification }\n else\n format.html { render :edit }\n format.json { render json: @grade_specification.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f11429a5a6ef3ec9b14af781a35e1eb", "score": "0.64579153", "text": "def create\n @final_grade = FinalGrade.new(params[:final_grade])\n\n respond_to do |format|\n if @final_grade.save\n format.html { redirect_to @final_grade, notice: 'Final grade was successfully created.' }\n format.json { render json: @final_grade, status: :created, location: @final_grade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @final_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "56cc47dde51cd5521b4def3c3978d1c8", "score": "0.64445305", "text": "def update\n respond_to do |format|\n if @metric_grade.update(metric_grade_params)\n format.html { redirect_to @metric_grade, notice: 'Metric grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metric_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17775d0f96fdc7b813c754ed44e37ff4", "score": "0.643945", "text": "def update\n @grade = Grade.find(params[:id])\n\n respond_to do |format|\n if params[:save_only] # normal save (expects a save_only field)\n if @grade.update_attributes(params[:grade])\n format.js {render \"shared/save_success\"}\n else\n format.js {render \"shared/save_failed\"}\n end\n else # save the student turnin form making sure they choose a staff person.\n unless params[:grade][:staff_id] == \"\"\n if @grade.update_attributes(params[:grade])\n @checker = User.find(@grade.staff_id)\n format.js \n else\n format.js { render \"shared/save_failed\"}\n end\n else\n format.js { render \"need_staff\" }\n end\n end\n end\n end", "title": "" }, { "docid": "692bbf587c10457a364224263250e390", "score": "0.6436764", "text": "def set_grade\n @grade = params[:grade].downcase\n end", "title": "" }, { "docid": "9f78436a28ce3a91786dcdad31864192", "score": "0.6436227", "text": "def grade(submission)\n grade_answers(submission)\n submission.save!\n end", "title": "" }, { "docid": "894cad842eaa56a4c6f3fb00754ef764", "score": "0.64339566", "text": "def create\n @grade = Grade.new(grade_params)\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, notice: t(:Grade_created) }\n format.json { render :show, status: :created, location: @grade }\n else\n format.html { render :new }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7a8c35867b98d562d9a2055e2c37d2c", "score": "0.6433214", "text": "def update\n @quiz_grade = QuizGrade.find(params[:id])\n\n respond_to do |format|\n if @quiz_grade.update_attributes(params[:quiz_grade])\n format.html { redirect_to @quiz_grade, notice: 'Quiz grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quiz_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efbfc21caf426f37950b7a7a8e4df9d4", "score": "0.6432931", "text": "def update\n respond_to do |format|\n if @grade_class.update(grade_class_params)\n format.html { redirect_to @grade_class, notice: 'Grade class was successfully updated.' }\n format.json { render :show, status: :ok, location: @grade_class }\n else\n format.html { render :edit }\n format.json { render json: @grade_class.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65583bb517dd6ba90142e88491b9472b", "score": "0.64327896", "text": "def update\n @employee_grade.update(employee_grade_params)\n @employee_grades = EmployeeGrade.all\n @employee_grade = EmployeeGrade.new\n end", "title": "" }, { "docid": "989867a1ed0c6bc1b3d0412a7f76b7fc", "score": "0.6426481", "text": "def add_grade\n @employee_grade_new = EmployeeGrade.new\n @employee_grade = EmployeeGrade.new(grade_params)\n flash[:notice] = t('emp_grade') if @employee_grade.save\n emp_grade\n end", "title": "" }, { "docid": "56ea5603c02b40851d5822fe74f5637f", "score": "0.64252037", "text": "def update\n @analysis_grade = AnalysisGrade.find(params[:id])\n\n respond_to do |format|\n if @analysis_grade.update_attributes(params[:analysis_grade])\n flash[:notice] = 'AnalysisGrade was successfully updated.'\n format.html { redirect_to(@analysis_grade) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @analysis_grade.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb5343bde5b2c39a8fb048002db83148", "score": "0.6417461", "text": "def create\n @grade = Grade.new(params[:grade])\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, notice: 'Grade was successfully created.' }\n format.json { render json: @grade, status: :created, location: @grade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb5343bde5b2c39a8fb048002db83148", "score": "0.6417461", "text": "def create\n @grade = Grade.new(params[:grade])\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, notice: 'Grade was successfully created.' }\n format.json { render json: @grade, status: :created, location: @grade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2589a016c6bc028c9a73629e816135f2", "score": "0.6400239", "text": "def create\n @grade = Grade.new(grade_params)\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, notice: 'Grade was successfully created.' }\n format.json { render :show, status: :created, location: @grade }\n else\n format.html { render :new }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "433588f7c48b5f31e40d17ec4f505155", "score": "0.6396989", "text": "def grades\n @sections = Section.order(:name)\n @grade_entry_form = GradeEntryForm.find(params[:id])\n end", "title": "" }, { "docid": "8229576c2b9ab008fe664d808414024a", "score": "0.6393683", "text": "def update\n @grade_scheme = GradeScheme.find(params[:id])\n @assignments = Assignment.all\n respond_to do |format|\n if @grade_scheme.update_attributes(params[:grade_scheme])\n format.html { redirect_to @grade_scheme, notice: 'Grade scheme was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grade_scheme.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a1caefe267a5c68c0bd1f0ca81ba6f2b", "score": "0.6384981", "text": "def update\n respond_to do |format|\n if @daily_grade.update(daily_grade_params)\n format.html { redirect_to @daily_grade, notice: 'Daily grade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @daily_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a807f57d0695ffc168edec8d87eefb1f", "score": "0.6377089", "text": "def update\n @interim_grade = InterimGrade.find(params[:id])\n\n respond_to do |format|\n if @interim_grade.update_attributes(params[:interim_grade])\n format.html { redirect_to @interim_grade, notice: 'Interim grade was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interim_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ea6a856da68c52c6785a9c09e05435e", "score": "0.6365082", "text": "def grades\n @grade_entry_form = GradeEntryForm.find(params[:id])\n render layout: 'assignment_content'\n end", "title": "" }, { "docid": "38855b471dc41265657af70364ee5047", "score": "0.63617635", "text": "def update\n @pay_grade = PayGrade.find(params[:id])\n\n respond_to do |format|\n if @pay_grade.update_attributes(params[:pay_grade])\n format.html { redirect_to(@pay_grade, :notice => 'Pay grade was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pay_grade.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e1e688676398c314ceb3feed6751d0d", "score": "0.6359325", "text": "def update\n @examination.user = current_user\n\n examination_authorize(@examination, \"update\", params[:category_service])\n\n respond_to do |format|\n if @examination.update(examination_params)\n\n h_grades = {}\n @examination.grades.order(:id).each do |grade|\n h_grades[\"#{grade.subject.name}\"] = grade.grade_result\n end\n \n @examination.works.create!(trackable_url: \"#{examination_path(@examination, category_service: params[:category_service])}\", action: :update, user: current_user, \n parameters: {examination: @examination.previous_changes, grades: h_grades}.to_json)\n\n flash_message :success, t('activerecord.messages.successfull.updated', data: @examination.fullname)\n format.html { redirect_to examination_path(@examination, category_service: params[:category_service], back_url: params[:back_url]) }\n format.json { render :show, status: :ok, location: @examination }\n else\n format.html { render :edit, locals: { back_url: params[:back_url]} }\n format.json { render json: @examination.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e96062f499ca86f264cc72a697e93047", "score": "0.63474214", "text": "def update_multiple\n #raise params.inspect\n submit_val = params[:applychange]\n #@exammarksid = params[:exammark_ids]\t\n @gradesid = params[:grade_ids]\n #@totalmcqs =params[:total_mcqs] \n @formatives = params[:formatives] \n @caplusmse = params[:scores]\n @examweights = params[:examweights] \n if @subjects_of_grades==1 || submit_val == t('apply_changes') #'Apply Changes'\n @summative_weightage = params[:grade][:summative_weightage] \n @scores = params[:scores_attributes]\n @scores_new_count = @scores.count \n end\n @scores1 = params[:scores] #caplusmse\n @exam1markss = params[:exam1markss]\n @summatives = params[:summatives]\n @finalscores = params[:finalscores] \n @senttobpls = params[:sent_to_BPLs] # \"sent_to_BPLs\"=>{\"2\"=>\"true\"}, \"sent_to_BPLs\"=>{\"1\"=>\"true\",\"2\"=>\"true\"}\t \n \t @eligibleexams = params[:eligible_for_exams]\n \t @carrypapers = params[:carry_papers] \n \t @resits = params[:resits]\n \t @grades = Grade.find(@gradesid)\t \t\t\t\t\t\t\t\t\t\t\t \n \n if submit_val == t('apply_changes') #'Apply Changes'\n @grades.sort_by{|x|x.studentgrade.name}.each_with_index do |grade, index| \n 0.upto(grade.scores.count-1) do |score_count|\n #Please note : use this : params[:scores_attributes][score_count.to_s][:type_id] INSTEAD OF this:params[:scores_attributes][score_count.to_s][:type_id][index]\n grade.scores[score_count].type_id = params[:scores_attributes][score_count.to_s][:type_id]\n\t grade.scores[score_count].description = params[:scores_attributes][score_count.to_s][:description]# \"AAA\"\n\t grade.scores[score_count].weightage = params[:scores_attributes][score_count.to_s][:weightage]\n\t end\n\t grade.examweight = @summative_weightage \n\t grade.save\n\t end\n\t #------------------------------------------------remove if error again!!-------------------------------------\n\t @grades.sort_by{|x|x.studentgrade.name}.each_with_index do |grade, index| \n\t (grade.scores.count).upto(@scores_new_count-1) do |c|\n\t grade.scores.build\n grade.scores[c].type_id = params[:scores_attributes][c.to_s][:type_id]#@grade_scores[2].type_id \n grade.scores[c].description = params[:scores_attributes][c.to_s][:description]#@grade_scores[2].description \n grade.scores[c].weightage = params[:scores_attributes][c.to_s][:weightage]#@grade_scores[2].weightage\n\t grade.scores[c].marks = 0\n\t grade.examweight = @summative_weightage \n\t ##grade.save\n\t end\n\t grade.save\n\t end\n\t #------------------------------------------------remove if error again!!-------------------------------------\n\t respond_to do |format|\n\t #flash[:notice] = \"Updated changes for formative score details!\"\n\t format.html {render :action => \"edit_multiple\"}\n \t flash[:notice] = \"<b>\"+t('grade.formative_scores_var')+\"</b> \"+t('and')+\" <b>\"+(t 'grade.summative_weightage').titleize+\"</b> \"+t('grade.are_updated')+\" <b>\"+t('grade.edit_marks')+\"</b>.\"\n \t format.xml { head :ok }\n \t flash.discard\n\t end\n else \n #below (add-in sort_by) in order to get data match accordingly to form values (sorted by student name)\n @grades.sort_by{|x|x.studentgrade.name}.each_with_index do |grade, index| #amended-2June2012-prev:#@exammarks.each_with_index do |exammark,index|\n \t\t #exammark.total_mcq = @totalmcqs[index]\n \t\t grade.formative = @formatives[index]\n \t\t grade.score = @caplusmse[index]\n \t\t if @examweights\n \t\t grade.examweight = @examweights[0] if @examweights.count==1 #for selected grades with different subject\n \t\t grade.examweight = @examweights[index] if @examweights.count>1\n \t\t end\n \t\t #for selected grades with same subject\n \t\t\t #0.upto(exammark.marks.count-1) do |cc|\n \t\t\t #exammark.marks[cc].student_mark = params[:marks_attributes][cc.to_s][:student_marks][index]\n \t\t\t #end\n \t\t\t #---BIG PROBLEM-SAVE SCORE TABLE SEPARATELY - RESOLVE..TEMPORARY-10JUN2013-AM-START-replace grades.score... with y.marks...\n \t\t\t scores_of_grades = Score.find(:all, :conditions => ['grade_id=?',grade.id])\n \t\t\t scores_of_grades.sort_by{|x|x.created_at}.each_with_index do |y,no| #tak boleh by created_at?\n \t\t\t #scores_of_grades.each_with_index do |y,no| #tak boleh by created_at?\n \t\t\t y.marks = params[:scores_attributes][no.to_s][:marks][index]\n \t\t\t y.save\n \t\t\t end\n \t\t\t #0.upto(grade.scores.count-1) do |score_count|\n\t #grade.scores[score_count].marks = params[:scores_attributes][score_count.to_s][:marks][index]\n\t #end\n \t\t\t #grade.score=params[:scores_attributes][\"1\"][:marks][index]#@scores1[index] \n \t\t\t #---BIG PROBLEM-SAVE SCORE TABLE SEPARATELY - RESOLVE..TEMPORARY-10JUN2013-AM-END------------------------------------------\n \t\t\t \n \t\t\t grade.exam1marks=@exam1markss[index]\n \t\t\t grade.summative=@summatives[index]\n \t\t\t grade.finalscore=@finalscores[index]\n \t\t\t if @subjects_of_grades==1 \n \t\t\t grade.examweight = @summative_weightage \n \t\t\t #--BIG PROBLEM-remove to line 331 but yet replace with direct SAVING DATA INTO SCORES table instead of grades.scores...\n \t\t\t #0.upto(grade.scores.count-1) do |score_count|\n \t\t\t #grade.scores[score_count].marks = params[:scores_attributes][score_count.to_s][:marks][index]\n \t\t\t #end\n \t\t\t #--end of BIG PROBLEM\n \t\t\t end \n \t\t\t #exammark.save\n \t\t\t #--assign checkbox value-sent_to_BPL-----\n \t\t\t if @senttobpls && @senttobpls[index.to_s]!=nil\n \t\t\t grade.sent_to_BPL = true\n \t\t\t else\n \t\t\t grade.sent_to_BPL = false\n \t\t\t end\n \t\t\t #--asign checkbox value------\n \t\t\t #--assign checkbox value-eligible_for_exam----\n \t\t\t if @eligibleexams && @eligibleexams[index.to_s]!=nil\n \t\t\t grade.eligible_for_exam = true\n \t\t\t else\n \t\t\t grade.eligible_for_exam = false\n \t\t\t end\n \t\t\t #--asign checkbox value------\n \t\t\t #--assign checkbox value-carry paper----\n \t\t\t if @carrypapers &&@carrypapers[index.to_s]!=nil\n \t\t\t grade.carry_paper = true\n \t\t\t else\n \t\t\t grade.carry_paper = false\n \t\t\t end\n \t\t\t #--asign checkbox value------\n \t\t\t #--assign checkbox value-resit----\n \t\t\t if @resits && @resits[index.to_s]!=nil\n \t\t\t grade.resit = true\n \t\t\t else\n \t\t\t grade.resit = false\n \t\t\t end\n \t\t\t #--asign checkbox value------\n \t\t\t grade.save\n \t\t end\t\t\t#--end of @grades.each_with_index do |grade,index|--\n \t\t \n \t\t flash[:notice] = t('grade.successfully_updated')\n \t #redirect_to exammarks_path\n \t redirect_to grades_path\n \t end\n \t \n end", "title": "" }, { "docid": "6484fcc7922f2a8999e12be4a6cfc3f5", "score": "0.6337889", "text": "def update\n @service_grade = ServiceGrade.find(params[:id])\n\n respond_to do |format|\n if @service_grade.update_attributes(params[:service_grade])\n format.html { redirect_to(@service_grade, :notice => 'Service grade was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_grade.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0003b8687d77b1e8a7553b944275f1f3", "score": "0.63366634", "text": "def grade_params\n params[:grade]\n params.require(:grade).permit(:students_record_id, :instructor_id, :component_id).tap do |whitelisted|\n if params[:grade][:score]\n whitelisted[:score] = params[:grade][:score]\n end\n end\n end", "title": "" }, { "docid": "4b7823f1ff59019a2278648e76fb9307", "score": "0.6336292", "text": "def create\n @grade = Grade.new(grade_params)\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, notice: 'Grade was successfully created.' }\n format.json { render json: @grade, status: :created, location: @grade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29721a5386a7256ab5e97e1bf4659abd", "score": "0.6335326", "text": "def create\n @grade = Grade.new(grade_params)\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to @grade, notice: 'Grade was successfully created.' }\n format.json { render action: 'show', status: :created, location: @grade }\n else\n format.html { render action: 'new' }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bde2a9b01826de605e1ae84ced558861", "score": "0.6328196", "text": "def grade\n @assignment = Assignment.find(params[:id])\n @user = @assignment.user\n @assignment.update_attributes(:response => params[:response])\n @assignment.save\n @assignment.grade\n if @assignment.save\n flash[:notice] = \"Your response has been saved\"\n redirect_to(:action => 'feedback', :id => @assignment.id , :user_id => @user.id)\n else\n puts @assignment.save\n puts \"could not save\"\n render(user_assignment_path(@user, @assignment) , :html => {:method => :get})\n end\n end", "title": "" }, { "docid": "56654af6b6d4ec8dbb09ffd595b50066", "score": "0.630529", "text": "def assessment_grade_params\n params.require(:assessment_grade).permit(:total, :assessment_id, :student_id)\n end", "title": "" }, { "docid": "95fc39fd928ee269127e92c0225a72f0", "score": "0.6294618", "text": "def grade_params\n params.require(:grade).permit(:name, :level_id)\n end", "title": "" }, { "docid": "7a48de0c9f05fb1afac9da6aeec9ea02", "score": "0.62923634", "text": "def create\n @grade = Grade.new(grade_params)\n\n if @grade.save\n render :show, status: :created, location: @grade\n else\n render json: @grade.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "ba696c62e4954f3f2003526b8542e041", "score": "0.6272327", "text": "def update\n respond_to do |format|\n \n students = @test.course.students\n st = students.collect do |s|\n s.id.to_s\n end\n\n params[:test][:grades_attributes].each do |g, v|\n if (!st.include? v[:student_id])\n s = Student.find(v[:student_id])\n format.html { redirect_to course_tests_url(@test.course), notice: \"No se cargaron la notas ya que el estudiante #{s.name} no está inscripto\" }\n end\n end\n\n if @test.update(test_params)\n format.html { redirect_to course_tests_url(@test.course), notice: \"Evaluación #{@test} actualizada correctamente.\" }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3246327e7055ba32e878974b64e2b90", "score": "0.6272313", "text": "def update\n @grade_span_expectation = RiGse::GradeSpanExpectation.find(params[:id])\n\n respond_to do |format|\n if @grade_span_expectation.update_attributes(params[:grade_span_expectation])\n flash[:notice] = 'RiGse::GradeSpanExpectation.was successfully updated.'\n format.html { redirect_to(@grade_span_expectation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @grade_span_expectation.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5391d76bba18ba86b7ed370c8e04c0a", "score": "0.62657666", "text": "def grade_params\n params.require(:grade).permit(:title, :dan, :kyu, :level)\n end", "title": "" }, { "docid": "d9bb5905f715c85b0cc97da3481cf3cc", "score": "0.6264801", "text": "def create\n @grade = Grade.new(grade_params)\n @grade.assignment = @assignment\n\n respond_to do |format|\n if @grade.save\n format.html { redirect_to [@course, @assignment, @grade], notice: 'Grade was successfully created.' }\n format.json { render :show, status: :created, location: @grade }\n else\n format.html { render :new }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1966853f4fb725ef88414e99cbf65b22", "score": "0.62643534", "text": "def grades\n reload! unless @grades\n @grades\n end", "title": "" }, { "docid": "1db58b15b230b8bbcc7da5ecfd026dfe", "score": "0.6258646", "text": "def update\n respond_to do |format|\n if @gradelist.update(gradelist_params)\n format.html { redirect_to @gradelist, notice: 'Gradelist was successfully updated.' }\n format.json { render :show, status: :ok, location: @gradelist }\n else\n format.html { render :edit }\n format.json { render json: @gradelist.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13d5a7ffc44e4814e5fc1680243a8184", "score": "0.6250806", "text": "def create\n j = JSON.parse(request.raw_post)\n\n\n @grade = Grade.new\n @grade[:subject_id] = j['subject_id']\n @grade[:student_id] = j['student_id']\n @grade[:mark] = j['mark']\n @grade[:exam_date] = j['exam_date']\n @grade.save\n\n\n render :json => @grade , :status => 201\n end", "title": "" }, { "docid": "c9b254930e712f6bfd6e8db798b8186f", "score": "0.6245496", "text": "def set_submission_grade\n @submission_grade = SubmissionGrade.find(params[:id])\n end", "title": "" }, { "docid": "cc8ef3f3d4044412e1cd8c16403aeedf", "score": "0.6241948", "text": "def update\n respond_to do |format|\n @gradelevel.updated_by = current_user.email\n if @gradelevel.update(gradelevel_params)\n format.html { redirect_to @gradelevel, notice: 'Gradelevel was successfully updated.' }\n format.json { render :show, status: :ok, location: @gradelevel }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @gradelevel.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "title": "" }, { "docid": "312cffa85485e6e60b024835dd8aff55", "score": "0.6238105", "text": "def change_grade(grade)\n @std_grade = grade\n end", "title": "" }, { "docid": "2fcc6909c9e82b04a2608968260ee759", "score": "0.623214", "text": "def submission_grade_params\n params.require(:submission_grade).permit(:assignment_id, :student_id, :status, :submission_file, :is_latest, :is_latest, :mentor_id, :graded_file, :point)\n end", "title": "" }, { "docid": "503131f7707d524894e0a1f4e39cc7e8", "score": "0.6229189", "text": "def grade_params\n params.require(:grade).permit(:name, :description)\n end", "title": "" }, { "docid": "230fa0a6db974f7c69f13d25cd2070e0", "score": "0.62278235", "text": "def grading_params\n params.require(:grading).permit(:grade, :point)\n end", "title": "" }, { "docid": "828b4725b13880082965ba9230e69685", "score": "0.6226021", "text": "def update\n respond_to do |format|\n if @grade_config.update(grade_config_params)\n format.html { redirect_to @grade_config, notice: 'Grade config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @grade_config.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36be4d24f13a22bf12cf8f645c7d117d", "score": "0.62213975", "text": "def params_grade\n params.require(:grading_level).permit!\n end", "title": "" }, { "docid": "b672c4de6f2a48668650421c5e315a6b", "score": "0.6203692", "text": "def create\n @grading_levels ||= @batch.grading_levels\n @grading_level1 = @batch.grading_levels.new(params_grade)\n @grading_level1.save\n flash[:notice] = t('grade_create')\n end", "title": "" }, { "docid": "4f9747daae7d054b4a56fc25879b17b4", "score": "0.6198664", "text": "def set_grade\n @grade = Grade.find(params[:id])\n end", "title": "" } ]
be86160f11f34444ed73cdb7d15ff75e
Scraping from Masterview 2.0
[ { "docid": "b7101a261cd7a245ad0ea7099dc7e347", "score": "0.0", "text": "def scrape_page(page, comment_url)\n page.at(\"table.rgMasterTable\").search(\"tr.rgRow,tr.rgAltRow\").each do |tr|\n tds = tr.search('td').map{|t| t.inner_html.gsub(\"\\r\\n\", \"\").strip}\n day, month, year = tds[2].split(\"/\").map{|s| s.to_i}\n record = {\n \"info_url\" => (page.uri + tr.search('td').at('a')[\"href\"]).to_s,\n \"council_reference\" => tds[1],\n \"date_received\" => Date.new(year, month, day).to_s,\n \"description\" => tds[3].gsub(\"&amp;\", \"&\").split(\"<br>\")[1].squeeze(\" \").strip,\n \"address\" => tds[3].gsub(\"&amp;\", \"&\").split(\"<br>\")[0].gsub(\"\\r\", \" \").squeeze(\" \").strip,\n \"date_scraped\" => Date.today.to_s,\n \"comment_url\" => comment_url\n }\n #p record\n if (ScraperWiki.select(\"* from data where `council_reference`='#{record['council_reference']}'\").empty? rescue true)\n puts \"Saving record \" + record['council_reference'] + \", \" + record['address']\n ScraperWiki.save_sqlite(['council_reference'], record)\n else\n puts \"Skipping already saved record \" + record['council_reference']\n end\n end\nend", "title": "" } ]
[ { "docid": "73df85b286aebec621fd0439445faf24", "score": "0.6634963", "text": "def scrape_show\n\n end", "title": "" }, { "docid": "17567fcee68c4d169100a5adcd8a4232", "score": "0.6486423", "text": "def scrape(url)\r\n end", "title": "" }, { "docid": "115c66bd365d61c58703ecd06d2f295f", "score": "0.6402695", "text": "def scrape\n pull_results\n end", "title": "" }, { "docid": "513a37bd37d742898165b4d477ddf9f3", "score": "0.61790407", "text": "def crawl\n end", "title": "" }, { "docid": "23829710159d0f7167f8b1e736616a17", "score": "0.6065947", "text": "def crawl\n\tend", "title": "" }, { "docid": "22f3f93bc798bb8f9d10d162f8780786", "score": "0.59774286", "text": "def get_metadata\n doc = U.parse_html_from_file_or_uri(@base_uri,@index_html,:force_fetch=>true)\n names = doc.xpath(\"//div[@id='main-content']//h5\")\n links = doc.xpath(\"//div[@id='main-content']//p//a\")\n links.size.times do |x|\n @@metadata_master << { :name => names[x].inner_text,\n :home_url => links[x][\"href\"],\n :url => links[x][\"href\"] }\n end\n @@metadata_master\n end", "title": "" }, { "docid": "5f20e10beb98493659c4cbc8d37f1b11", "score": "0.59728193", "text": "def index\n @scraping_webs = ScrapingWeb.all\n end", "title": "" }, { "docid": "127dc44c5d82824f3a75d405c50cd970", "score": "0.59663844", "text": "def fetch_base_page\t\n\t\t\t@resp = RestClient.get(@url,:user_agent => @userAgent.get_user_agent.to_s)\n\t\t\t@document = Nokogiri::HTML(@resp)\n\t\t\treturn @document\n\tend", "title": "" }, { "docid": "167b340e2a53946fce55078a88313bd1", "score": "0.5936678", "text": "def main_page\n agent.get(@url)\n end", "title": "" }, { "docid": "8ab767652906b830c65961ac64b8004b", "score": "0.5924525", "text": "def try_scrap\n url = 'https://www.lessismoreeshop.com/product-page/chaussettes-bleed'\n unparsed_page = HTTParty.get(url)\n parsed_page = Nokogiri::HTML(unparsed_page)\n main_cont = parsed_page.css('div.content-wrapper') \n\n byebug\nend", "title": "" }, { "docid": "7808a1152f83b9257c804e74ce19753c", "score": "0.5912178", "text": "def scrape\n return unless @doc\n scrape_metas\n scrape_stats\n scrape_authors\n scrape_abstract\n scrape_jelcodes\n end", "title": "" }, { "docid": "23b9b1506e7f44aa63930f1131d00ee9", "score": "0.5901029", "text": "def scrap\n agent = Mechanize.new\n\n # Execute the crawling\n url = @url + @input\n page = agent.get(url)\n\n # Extract out relevant details regarding product details\n element = agent.page.search(\"script\")[-1]\n @search_data = element.text.split('{\"offers\":{')[2 .. element.text.length-1]\n end", "title": "" }, { "docid": "dbd8ad904965c851d14610e3601f31ff", "score": "0.58320796", "text": "def show\n url = \"https://miami.craigslist.org/search/mdc/sub\"\n\n response = HTTParty.get url\n\n # puts response.headers['content-type']\n #\n # puts response.body\n\n @dom = Nokogiri::HTML(response.body)\n\n @dom.css(\"a.hdrlnk\").map do |element|\n element.content\n end\n end", "title": "" }, { "docid": "e83e2feed474a228c5145302332cc90e", "score": "0.58312887", "text": "def get_data url\n browser = Mechanize.new\n base_url = \"http://www.xssed.com/\"\n for i in (1..5)\n page = browser.get(base_url+\"#{url}=1/page=#{i}/\")\n page.links_with(text: /mirror/).each do |link|\n # puts link.href\n page2 = browser.get(base_url+link.href)\n mirror_link = page2.link_with(text: /Click here to view the mirror/).href\n site = Xsssite.new\n (page2/\".row3\").each do |f|\n tmp=f.text.split(\":\")\n \t\t\tif tmp.size > 1\n site.get_data(tmp)\n end\n end\n site.mirror = mirror_link\n site.save\n end\n end\nend", "title": "" }, { "docid": "65b99535480d70960c0528634be10519", "score": "0.57884306", "text": "def scrape\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n http.use_ssl = true if uri.scheme == 'https'\n\n # Make a GET request to the given url\n response = http.send_request('GET', uri.request_uri)\n\n # Parse the response body\n response = JSON.parse(response.body)\n data = response['response']\n article_list = data['results']\n\n article_list.each do |item|\n # Sanitize HTML\n item['title'] = CGI.unescapeHTML(item['webTitle'])\n\n @articles.push(\n title: item['title'],\n source: @source,\n url: item['webUrl'],\n pub_date: item['webPublicationDate']\n )\n end\n end", "title": "" }, { "docid": "deb5dd20a3f2b3daadc1f0fd818c9cc5", "score": "0.5787681", "text": "def index\n\t\turl = 'http://matome.naver.jp/tech'\n\n\t\tcharset = nil\n\t\thtml = open(url) do |f|\n \t\t\tcharset = f.charset # 文字種別を取得\n \t\t\tf.read # htmlを読み込んで変数htmlに渡す\n\t\tend\n\n\t\tdoc = Nokogiri::HTML.parse(html, nil, charset)\n\n\t\t@news = doc.xpath('//li[@class=\"mdTopMTMList01Item\"]').each do |node|\n\t\t # tilte\n\t\t\t p node.css('h3').inner_text\n\n\t\t\t # 記事のサムネイル画像\n\t\t\t p node.css('img').attribute('src').value\n\n\t\t\t # 記事のサムネイル画像\n\t\t\t p node.css('a').attribute('href').value\n\t\tend\n\tend", "title": "" }, { "docid": "62dce19d50c1e4abc0e6048936cad37c", "score": "0.5762172", "text": "def la_page\n page = Nokogiri::HTML(open('https://coinmarketcap.com/all/views/all/'))\n return page\nend", "title": "" }, { "docid": "12211baab795ccc979f5f79215949035", "score": "0.57209486", "text": "def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend", "title": "" }, { "docid": "12211baab795ccc979f5f79215949035", "score": "0.57209486", "text": "def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend", "title": "" }, { "docid": "12211baab795ccc979f5f79215949035", "score": "0.57209486", "text": "def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend", "title": "" }, { "docid": "12211baab795ccc979f5f79215949035", "score": "0.57209486", "text": "def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend", "title": "" }, { "docid": "2a97a273ebd4538437f45e0eb8e8fe4c", "score": "0.5703524", "text": "def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend", "title": "" }, { "docid": "2a97a273ebd4538437f45e0eb8e8fe4c", "score": "0.5703524", "text": "def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend", "title": "" }, { "docid": "2a97a273ebd4538437f45e0eb8e8fe4c", "score": "0.5703524", "text": "def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend", "title": "" }, { "docid": "2a97a273ebd4538437f45e0eb8e8fe4c", "score": "0.5703524", "text": "def scrap_all_pages\n Shop.find(:all).each {|item|\n @g_template = item.template\n @g_shopid = item.id\n\n scrap_data_from_page(item.home_page_link)\n }\nend", "title": "" }, { "docid": "1111abc994313479ca826bfced959f97", "score": "0.5693179", "text": "def scrape\n @scrape ||= PageScraper.new(self.to_s).listing\n end", "title": "" }, { "docid": "2a79c17ad121514bb3b1b4938de259cb", "score": "0.5683014", "text": "def getSvodContent(client)\n\t\tbegin\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='洋画' and @id='textView']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tif client.isElementFound(\"NATIVE\", \"text=見放題で楽しめる厳選良作!洋画編\")\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=(//*[@id='recyclerView' and ./preceding-sibling::*[./*[@text='見放題で楽しめる厳選良作!洋画編']]]/*/*/*[@id='imageView' and ./parent::*[@id='maskLayout']])[1]\", 0, 1)\n\t\t\t\tclient.sleep(2000)\n\t\t\telse\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='searchButton']\", 0, 1)\n\t\t\t\tclient.sleep(2000)\n\t\t\t\tclient.click(\"NATIVE\", \"text=邦画一覧\", 0, 1)\n\t\t\t\tclient.sleep(2000)\n\t\t\t\tclient.click(\"NATIVE\", \"text=すべての作品\", 0, 1)\n\t\t\t\tclient.sleep(2000)\n\t\t\t\tclient.click(\"NATIVE\", \"text=見放題\", 0, 1)\n\t\t\t\tclient.sleep(3000)\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=(//*[@id='recycler_view']/*/*/*[@id='thumbnail'])\", 0, 1)\n\t\t\t\tclient.sleep(2000)\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgTanwa = \"::MSG:: Exception occurrred while finding ELEMENT\" + e.message\n\t\tend\t\t\n\tend", "title": "" }, { "docid": "dfcef5333d00c78bf656c3a18efe6eb4", "score": "0.5675221", "text": "def index\n require 'open-uri'\n require 'nokogiri'\n\n # スクレイピング先のURL\n url = \"http://papimo.jp/h/00031715/hit/index_sort/213110004/1-20-77338\"\n charset = nil\n html = open(url) do |f|\n f.read # htmlを読み込んで変数htmlに渡す\n end\n # htmlをパース(解析)してオブジェクトを生成\n doc = Nokogiri::HTML.parse(html, nil, charset)\n\n ids = doc.css('#pjax-container .bottom_l .unit_no').map do |data|\n data.text.to_s\n end\n # スクレイピング先のURL\n show_url = \"http://papimo.jp/h/00031715/hit/view/\"\n charset = nil\n count = 0\n ids.each do |id|\n html = open(show_url + id) do |f|\n f.read # htmlを読み込んで変数htmlに渡す\n end\n # htmlをパース(解析)してオブジェクトを生成\n doc = Nokogiri::HTML.parse(html, nil, charset)\n\n doc.xpath('//*[@id=\"tab-data-some\"]').each do |node|\n \tdatas = node.css('.data tbody tr')\n\n \tday_data = datas[0].css('td')\n\n \tif day_data[1].text == '-'\n \t\tday_data = datas[1].css('td')\n \tend\n\n \tbig = day_data[1].text\n \treg = day_data[2].text\n \tart = day_data[3].text\n \ttotal_num = day_data[6].text.remove(',')\n\n m = MachineResult.new\n m.machine_no = id\n m.played_games = total_num\n m.counter_a = big\n m.counter_b = reg\n m.counter_c = art\n m.save\n count = count + 1\n end\n end\n raise\n @machines = Machine.all\n end", "title": "" }, { "docid": "e543437737142542a434bf419fb0e2d8", "score": "0.5659309", "text": "def index\n @scrapes = Scrape.all\n end", "title": "" }, { "docid": "2edd4832ed21c090cde6d559c276cbd9", "score": "0.564396", "text": "def scrape_page(url)\n\t\t\tNokogiri::HTML(open(url))\n\t\tend", "title": "" }, { "docid": "dc8a21fe21b0497646a5fb76a6a06fbf", "score": "0.56430966", "text": "def show\n if !@scrape\n redirect_to new_scrape_path(params)\n end\n @scrapeurl = @scrape.url.gsub(\"!\",\".\").gsub(\"_\",\"/\").gsub(\"%\",\"-\").gsub(\"xSECx\",\"https://\")\n @metatags = MetaInspector.new(@scrapeurl)\n @opengraph = OpenGraph.fetch(@scrapeurl)\n rescue\n end", "title": "" }, { "docid": "8d3886aa34b81745ab4d6e1e3e257788", "score": "0.5612682", "text": "def get_details(index_url)\n html = open(index_url)\n doc = Nokogiri::HTML(html)\n\n #role\n @role = doc.css(\".hero-detail-role-name\").text\n\n #overview\n @overview = doc.css(\"#overview .hero-detail-description\").text\n\n #abilities\n @abilities = []\n doc.css(\".hero-ability\").each do |ability|\n hero_ability = ability.css(\".hero-ability-descriptor .h5\").text\n hero_description = ability.css(\".hero-ability-descriptor p\").text\n @abilities << {ability: hero_ability, description: hero_description}\n end\n\n #biography\n @biography = {}\n doc.css(\"#story .hero-bio\").each do |info|\n hero_real_name = info.css(\".name .hero-bio-copy\").text\n hero_occupation = info.css(\".occupation .hero-bio-copy\").text\n hero_base = info.css(\".base .hero-bio-copy\").text\n hero_affiliation = info.css(\".affiliation\").text\n @biography = {real_name: hero_real_name, occupation: hero_occupation, base: hero_base, affiliation: hero_affiliation}\n end\n\n #quote\n @quote = doc.css(\"#story p.h4\").text\n end", "title": "" }, { "docid": "f520464d098aad9e7ea45edc7d44c9c7", "score": "0.5610356", "text": "def loadHandinPage; end", "title": "" }, { "docid": "e839d8fbbb6f22f20fee77765b6ade41", "score": "0.5607935", "text": "def parsePage ()\n\tbookClasses = [\"anandha-vikatan\", \"junior-vikatan\", \"aval-vikatan\", \"chutti-vikatan\", \"sakthi-vikatan\", \"nanayam-vikatan\", \"motor-vikatan\", \"pasumai-vikatan\"];\t\t\n\n\t$logger.info(\"Parsing main page to get links to books\")\n\t$mechanizer.get('http://www.vikatan.com/') do |page|\n\t\tbookClasses.each do |currentBookClass|\n\n\t\t\tcurrentAnchorElement = page.link_with(:class => currentBookClass);\n\n\t\t\tcreateCurrentBook(currentBookClass, currentAnchorElement.href);\n\t\tend\n\tend\nend", "title": "" }, { "docid": "e839d8fbbb6f22f20fee77765b6ade41", "score": "0.5607935", "text": "def parsePage ()\n\tbookClasses = [\"anandha-vikatan\", \"junior-vikatan\", \"aval-vikatan\", \"chutti-vikatan\", \"sakthi-vikatan\", \"nanayam-vikatan\", \"motor-vikatan\", \"pasumai-vikatan\"];\t\t\n\n\t$logger.info(\"Parsing main page to get links to books\")\n\t$mechanizer.get('http://www.vikatan.com/') do |page|\n\t\tbookClasses.each do |currentBookClass|\n\n\t\t\tcurrentAnchorElement = page.link_with(:class => currentBookClass);\n\n\t\t\tcreateCurrentBook(currentBookClass, currentAnchorElement.href);\n\t\tend\n\tend\nend", "title": "" }, { "docid": "69b843772869145a9bd4ae526e5dc53c", "score": "0.55924827", "text": "def scrape\n Scrapeparam::Scrapeparam.screen_scrape\n redirect_to caseinfos_url\n end", "title": "" }, { "docid": "abb17de0b10437bd12db461d0f25508c", "score": "0.55814517", "text": "def scrape(d)\n scrape_index(d)\n NewsScrapers.logger.info \" Scraping article contents\"\n while(Article.where({:queue_status=>:queued, :source=>get_source_name}).count > 0)\n Article.where({:queue_status=>:queued, :source=>get_source_name}).find(:all, :limit=>10) do |article|\n scrape_article(article) \n end\n end\n end", "title": "" }, { "docid": "cdfa4b156b741a2f88f015ff106a12ab", "score": "0.557936", "text": "def show\n @nodes = Node.visible.\n joins(:taggings).\n where(taggings: { user_id: current_account.user_id }).\n where(taggings: { tag_id: @tag.id }).\n order(@order).\n group(\"nodes.id\").\n page(params[:page])\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n @title.join(' - ').html_safe \n if current_stylesheet \n stylesheet_link_tag current_stylesheet, media: nil \n elsif current_account \n stylesheet_link_tag current_account.stylesheet_url, media: nil \n else \n stylesheet_link_tag 'application', media: nil \n end \n if @google_plus \n end \n if @author \n end \n if @dont_index \n end \n @feeds.each do |link,title| \n auto_discovery_link_tag :atom, link, { title: title } \n end \n \n (\"active\" if controller_name == \"home\") \n link_to \"Accueil\", '/', title: \"Page d'accueil du site, personnalisable\" \n (\"active\" if controller_name == \"news\" || controller_name == \"sections\") \n link_to \"Dpches\", '/news', title: \"Actualits, vnements et autres nouveauts\" \n (\"active\" if controller_name == \"forums\" || controller_name == \"posts\") \n link_to \"Forums\", '/forums', title: \"Questions/rponses, petites annonces\" \n (\"active\" if controller_name == \"polls\") \n link_to \"Sondages\", '/sondages', title: \"Sondages proposes aux visiteurs du site\" \n (\"active\" if controller_name == \"wiki_pages\" || controller_name == \"wiki_versions\") \n link_to \"Wiki\", '/wiki', title: \"Pages wiki\" \n (\"active\" if controller_name == \"trackers\") \n link_to \"Suivi\", '/suivi', title: \"Suivi des suggestions et des bugs du site\" \n form_tag '/recherche', method: :get do \n submit_tag \"Rechercher\", name: nil, id: \"search_submit\", title: \"Lancer la recherche sur le site\" \n end \n \n logo \n account_signed_in? ? link_to(current_account.login, current_account.user) : \"Se connecter\" \n link_to \"Proposer un contenu\", '/proposer-un-contenu' \n if account_signed_in? \n if current_account.has_answers? \n image_tag \"/images/icones/chat.svg\", alt: \"Nouveaux !\", title: \"Vous avez reu des rponses vos commentaires\", width: \"16px\" \n end \n link_to \"Mon tableau de bord\", '/tableau-de-bord' \n link_to \"Mes contenus taggs\", '/tags' \n link_to \"Les contenus que j'ai lus\", '/readings' \n link_to \"Modifier mes prfrences\", '/compte/modifier' \n link_to \"Changer de style\", '/stylesheet/modifier' \n button_to \"Se dconnecter\", '/compte/deconnexion', method: :post, id: \"logout\" \n else \n @account ||= Account.new \n form_for @account, url: '/compte/connexion', html: { id: \"#{dom_id @account}#{id_suffix}\" }, authenticity_token: false do |f| \n f.label \"login#{id_suffix}\", \"Identifiant\" \n f.text_field :login, id: \"account_login#{id_suffix}\", required: \"required\", placeholder: \"Identifiant\", size: 20 \n f.label \"password#{id_suffix}\", \"Mot de passe\" \n f.password_field :password, id: \"account_password#{id_suffix}\", required: \"required\", placeholder: \"Mot de passe\", size: 20 \n f.check_box :remember_me, id: \"account_remember_me#{id_suffix}\" \n f.label \"remember_me#{id_suffix}\", \"Connexion automatique\" \n f.submit \"Se connecter\", id: \"account_submit#{id_suffix}\" \n end \n \n end \n if current_account \n link_to \"Rdaction\", '/redaction' \n link_to \"Tribune de rdaction\", '/redaction' \n list_of News.draft.sorted.limit(10) do |news| \n if news.node.board_status(current_account) == :new_board \n image_tag \"/images/icones/chat.svg\", alt: \"Nouveaux !\", title: \"Il y a de l'activit sur cette dpche\", width: \"16px\" \n end \n link_to news.title, [:redaction, news] \n end \n link_to \"(...)\", \"/redaction#news\" \n \n end \n cache \"near_tags/#{@tag.name}\" do \n list_of(@tag.near_tags) do |tag| \n pluralize(tag.cnt, \"contenu commun\", \"contenus communs\") \n tag.cnt \n link_to tag.name, on_public ? public_tag_path(tag.name) : tag_path(tag.name) \n end \n end \n \n [:alert, :notice].each do |type| \n if flash[type] \n end \n end \n \n if current_account && current_account.can_update?(@tag) \n if @tag.public? \n button_to \"Cacher ce tag\", hide_tag_path(@tag), class: \"delete_button\" \n else \n button_to \"Rendre nouveau visible ce tag\", hide_tag_path(@tag), class: \"ok_button\" \n end \n end \n \n h1 \"Tous les contenus que j'ai taggs avec #{@tag.name}\" \n link = link_to(\"Afficher tous les contenus taggs avec #{@tag.name}\", public_tag_path(@tag.name)) \n paginated_section @nodes, link do \n render @nodes.map(&:content) \n end \n link_to \"Revenir en haut de page\", '#top', class: 'scroll' \n cache \"layouts/footer\", expires_in: 1.minute do \n @last_comments.each do |comment| \n link_to comment.title, path_for_content(comment.node.content) + \"#comment-#{comment.id}\" \n end \n @popular_tags.each do |tag| \n link_to tag.name, \"/tags/#{tag.name}/public\" \n end \n @friend_sites.each do |site| \n link_to site.title, site.url \n end \n link_to \"Mentions lgales\", '/mentions_legales' \n link_to \"Faire un don\", '/faire_un_don' \n link_to \"Team LinuxFr.org\", '/team' \n link_to \"Informations sur le site\", '/informations' \n link_to \"Aide / Foire aux questions\", '/aide' \n link_to \"Rgles de modration\", '/regles_de_moderation' \n link_to \"Statistiques\", '/statistiques' \n link_to \"API pour les dveloppeurs\", '/developpeur' \n link_to \"Code source du site\", '/code_source_du_site' \n link_to \"Plan du site\", '/plan' \n \n end \n javascript_include_tag \"application\" \n\nend\n\n end", "title": "" }, { "docid": "504cc7eca5768a899c0014ab8783ac7a", "score": "0.55721986", "text": "def scrape\n browser = Watir::Browser.new\n\n urls.each do |url|\n browser.goto(url)\n @items.concat(yield(browser))\n end\n\n browser.close\n\n items\n end", "title": "" }, { "docid": "eff75ee720565a9b6bb739215e825c22", "score": "0.5569923", "text": "def scrape_stocks\n StockScraper.scrape_stocks \n end", "title": "" }, { "docid": "0e6b049b2434ae97dc613cbe9c4108fe", "score": "0.5569648", "text": "def DataLoadFromSite(url)\n conn = Net::HTTP::Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_password)\n \n request = URI.parse(URI.escape(url))\n res = conn.start(request.host, request.port) {|http|\n http.get(request.path)\n }\n \n @xml_data = res.body\n self.ScrapAnalyse()\n end", "title": "" }, { "docid": "644b772cfb6bc6942dc2f99e0079838f", "score": "0.5566338", "text": "def parse\n super\n if next_page_url\n @doc = get_document(URI(\"http://tivolihifi.com\" + next_page_url))\n self.parse\n end\n self\n end", "title": "" }, { "docid": "03b72c97b1ec94668e08729afc14b6a9", "score": "0.55618644", "text": "def parse(response, url:, data: {})\n\n #select restaurant names\n response.css('a').select{|table_row| table_row['class'] == 'cbo_nn_unitNameLink'}.each do |row|\n\n puts row.text\n \n end\n\n #click the 12th ave link to reach its food and wait for response\n browser.find('//a[@tabindex=\"0\"]', text: '12th Avenue Bread Co.').trigger :click; sleep 1\n\n new_response = browser.current_response;\n\n #loop through and print all 12th ave foods\n new_response.css('td').select{|food_item| food_item['class'] == 'cbo_nn_itemHover'}.map do |food|\n\n puts food.text\n \n end\n \n end", "title": "" }, { "docid": "d037769859f1c5c6b758af79efc86004", "score": "0.55593514", "text": "def catalog(url)\n @driver.navigate.to url\n page_loaded?(@driver, 'div.threads')\n Nokogiri::HTML(@driver.page_source) # if page_loaded?(@driver, 'div.threads')\n end", "title": "" }, { "docid": "03b3b56ecaa55e6e44515ee2724356c4", "score": "0.5557845", "text": "def page_scrapper(url)\n\t\tresponse = HTTParty.get(url)\n\t\tNokogiri::HTML(response.body)\n\tend", "title": "" }, { "docid": "908cedaf97603f4612cb742c3a473444", "score": "0.5552644", "text": "def scrape\n @doc.xpath(\"//a[@class='textlink']\").each do |link|\n stuff = /http:\\/\\/ssrn\\.com\\/abstract=([0-9]+)/.match(link['href'])\n @abstractlist.push stuff[1] if stuff\n end\n # get author name information\n namestring = @doc.xpath(\"//h1\")[0].inner_text\n @lastName, @firstName = namestring.split\n @lastName.gsub!(/,$/, '')\n end", "title": "" }, { "docid": "066833bf1bc660a473f9599b4990ad29", "score": "0.5551662", "text": "def index\n @scrapers = Scraper.all\n end", "title": "" }, { "docid": "066833bf1bc660a473f9599b4990ad29", "score": "0.5551653", "text": "def index\n @scrapers = Scraper.all\n end", "title": "" }, { "docid": "e43ca2c35308a3bc312d46b8aa001c0a", "score": "0.5528545", "text": "def parse(page)\r\n #In future we will add some useful logic here\r\n #so, -- please call super(page) as a first row of your parse() method\r\n end", "title": "" }, { "docid": "ac229f2b1b8a61169799fa11548e1f07", "score": "0.5525472", "text": "def parse_page(page_content, scraper)\r\n\tresult = []\r\n\tpage_content.parser.css('.searchhitdiv').each do |item|\r\n\t\ttitle_tag = item.search('.searchhit > a')[0];\r\n\t\ttitle = title_tag.text.strip;\r\n\t\turl = title_tag.attributes['href'].value\r\n\r\n\t\tdescription = \"\"\r\n\t\tscraper.get(url) do |subpage|\r\n\t\t\tsubpage.parser.css('body').each do |subpage_body| \r\n\t\t\t\tdescription += subpage_body.search('.serc-content').text.strip.gsub(/ |\\t/, \" \")\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t# Add result to array\r\n\t\tresult << {\"url\": url, \"title\": title, \"scenario-description\": description}\r\n\tend\r\n\treturn result\r\nend", "title": "" }, { "docid": "e3585cf405a89d72bc63bbc396f5b37f", "score": "0.5523943", "text": "def index\n @page_masters = PageMaster.all\n end", "title": "" }, { "docid": "48f1571d568b44f97de47141daa6706d", "score": "0.5520877", "text": "def get_the_tourbe (url_lmdw)\n page = HTTParty.get(url_lmdw)\n parse_page = Nokogiri::HTML(page)\n tourbe = []\n xpath8 ='//span[@class=\"data tourbe\"]'\n tourbe = parse_page.xpath(xpath8)\n tourbe.text\nend", "title": "" }, { "docid": "3eb80a61e9df814bc267f0f8bbb844fc", "score": "0.5517372", "text": "def homepage_v4\n find_featured_beer_from_geolocation\n determine_discount_from_twitter_influence\n find_nearby_bars\n render :homepage\n end", "title": "" }, { "docid": "1ca64b7c840c31775f6a5e4c24754604", "score": "0.5514951", "text": "def parse_index_page url\n doc = Nokogiri::HTML(open(url))\n doc.css(\".object-grid a\").inject([]) do |memo, album_link|\n memo << parse_album_page(\"#{PITCHFORK_BASE_URL}#{album_link.attr(\"href\")}\")\n\n puts \" Scraped #{memo.last}\"\n sleep 0.2\n\n memo\n end\nend", "title": "" }, { "docid": "4cebeac8c3c2c557a867c445c5bfe03b", "score": "0.55108964", "text": "def get_data\n begin\n doc = Nokogiri::HTML(open(url))\n self.title = doc.title.to_s\n self.description = doc.xpath(\"/html/head/meta[@name='description']/@content\").to_s\n self.data_recived_on = Time.now\n rescue \n ensure\n end\n\n end", "title": "" }, { "docid": "bb7f3b6b185e91563fef16e5acb31edb", "score": "0.5508505", "text": "def get_catalog url, categories\n url ||= self.FoodURL\n page = @agent.get(url)\n #while there is table#ctl00_ContentPH_ChildDL links - we grabber children\n\n end", "title": "" }, { "docid": "803c6d0395974788b1355fc56df5bced", "score": "0.55082923", "text": "def index\n @nodes = Node.visible.\n joins(:taggings).\n where(taggings: { user_id: current_account.user_id }).\n order(@order).\n group(\"nodes.id\").\n page(params[:page])\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n @title.join(' - ').html_safe \n if current_stylesheet \n stylesheet_link_tag current_stylesheet, media: nil \n elsif current_account \n stylesheet_link_tag current_account.stylesheet_url, media: nil \n else \n stylesheet_link_tag 'application', media: nil \n end \n if @google_plus \n end \n if @author \n end \n if @dont_index \n end \n @feeds.each do |link,title| \n auto_discovery_link_tag :atom, link, { title: title } \n end \n \n (\"active\" if controller_name == \"home\") \n link_to \"Accueil\", '/', title: \"Page d'accueil du site, personnalisable\" \n (\"active\" if controller_name == \"news\" || controller_name == \"sections\") \n link_to \"Dpches\", '/news', title: \"Actualits, vnements et autres nouveauts\" \n (\"active\" if controller_name == \"forums\" || controller_name == \"posts\") \n link_to \"Forums\", '/forums', title: \"Questions/rponses, petites annonces\" \n (\"active\" if controller_name == \"polls\") \n link_to \"Sondages\", '/sondages', title: \"Sondages proposes aux visiteurs du site\" \n (\"active\" if controller_name == \"wiki_pages\" || controller_name == \"wiki_versions\") \n link_to \"Wiki\", '/wiki', title: \"Pages wiki\" \n (\"active\" if controller_name == \"trackers\") \n link_to \"Suivi\", '/suivi', title: \"Suivi des suggestions et des bugs du site\" \n form_tag '/recherche', method: :get do \n submit_tag \"Rechercher\", name: nil, id: \"search_submit\", title: \"Lancer la recherche sur le site\" \n end \n \n logo \n account_signed_in? ? link_to(current_account.login, current_account.user) : \"Se connecter\" \n link_to \"Proposer un contenu\", '/proposer-un-contenu' \n if account_signed_in? \n if current_account.has_answers? \n image_tag \"/images/icones/chat.svg\", alt: \"Nouveaux !\", title: \"Vous avez reu des rponses vos commentaires\", width: \"16px\" \n end \n link_to \"Mon tableau de bord\", '/tableau-de-bord' \n link_to \"Mes contenus taggs\", '/tags' \n link_to \"Les contenus que j'ai lus\", '/readings' \n link_to \"Modifier mes prfrences\", '/compte/modifier' \n link_to \"Changer de style\", '/stylesheet/modifier' \n button_to \"Se dconnecter\", '/compte/deconnexion', method: :post, id: \"logout\" \n else \n @account ||= Account.new \n form_for @account, url: '/compte/connexion', html: { id: \"#{dom_id @account}#{id_suffix}\" }, authenticity_token: false do |f| \n f.label \"login#{id_suffix}\", \"Identifiant\" \n f.text_field :login, id: \"account_login#{id_suffix}\", required: \"required\", placeholder: \"Identifiant\", size: 20 \n f.label \"password#{id_suffix}\", \"Mot de passe\" \n f.password_field :password, id: \"account_password#{id_suffix}\", required: \"required\", placeholder: \"Mot de passe\", size: 20 \n f.check_box :remember_me, id: \"account_remember_me#{id_suffix}\" \n f.label \"remember_me#{id_suffix}\", \"Connexion automatique\" \n f.submit \"Se connecter\", id: \"account_submit#{id_suffix}\" \n end \n \n end \n if current_account \n link_to \"Rdaction\", '/redaction' \n link_to \"Tribune de rdaction\", '/redaction' \n list_of News.draft.sorted.limit(10) do |news| \n if news.node.board_status(current_account) == :new_board \n image_tag \"/images/icones/chat.svg\", alt: \"Nouveaux !\", title: \"Il y a de l'activit sur cette dpche\", width: \"16px\" \n end \n link_to news.title, [:redaction, news] \n end \n link_to \"(...)\", \"/redaction#news\" \n \n end \n list_of(@tags) do |tag| \n link_to tag.name, tag_path(tag.name) \n end \n \n [:alert, :notice].each do |type| \n if flash[type] \n end \n end \n \n if current_account && current_account.can_update?(@tag) \n if @tag.public? \n button_to \"Cacher ce tag\", hide_tag_path(@tag), class: \"delete_button\" \n else \n button_to \"Rendre nouveau visible ce tag\", hide_tag_path(@tag), class: \"ok_button\" \n end \n end \n \n h1 \"Tous les contenus que j'ai taggs\" \n paginated_section @nodes do \n render @nodes.map(&:content) \n end \n link_to \"Revenir en haut de page\", '#top', class: 'scroll' \n cache \"layouts/footer\", expires_in: 1.minute do \n @last_comments.each do |comment| \n link_to comment.title, path_for_content(comment.node.content) + \"#comment-#{comment.id}\" \n end \n @popular_tags.each do |tag| \n link_to tag.name, \"/tags/#{tag.name}/public\" \n end \n @friend_sites.each do |site| \n link_to site.title, site.url \n end \n link_to \"Mentions lgales\", '/mentions_legales' \n link_to \"Faire un don\", '/faire_un_don' \n link_to \"Team LinuxFr.org\", '/team' \n link_to \"Informations sur le site\", '/informations' \n link_to \"Aide / Foire aux questions\", '/aide' \n link_to \"Rgles de modration\", '/regles_de_moderation' \n link_to \"Statistiques\", '/statistiques' \n link_to \"API pour les dveloppeurs\", '/developpeur' \n link_to \"Code source du site\", '/code_source_du_site' \n link_to \"Plan du site\", '/plan' \n \n end \n javascript_include_tag \"application\" \n\nend\n\n end", "title": "" }, { "docid": "ccf9a1afe602a8efeee6cb54d1a40f58", "score": "0.55078334", "text": "def get(url)\n @session.visit url\n @document = @session.document\n\n # headers and global JS variables\n @headers = @session.response_headers\n @globals = @session.evaluate_script GLOBALS_SCRIPT\n\n # metadata and text\n @title = @session.title\n @metas = @session.find_all('meta', visible: false).collect(&:native).collect(&:attributes)\n @text = @document.text 'body'\n\n # shut down driver, no need to hang around\n @session.driver.quit\n\n # return an instance of Scraper\n self\n end", "title": "" }, { "docid": "297c517dc37c41c13f02f79c6a5f3e76", "score": "0.55067897", "text": "def crawl\n collected_links = run_crawl\n process_links(collected_links)\n redirect_to(@show)\n end", "title": "" }, { "docid": "82800b6a49cb9dd8417cae7d9abd78f0", "score": "0.55046606", "text": "def visit\n remote_url = File.join(Rails.configuration.application_root_url, \"people/#{rubydora_object.pid}\")\n RestClient.get(remote_url, content_type: :html, accept: :html, verify_ssl: OpenSSL::SSL::VERIFY_NONE) do |response, request, result, &block|\n if [301, 302, 307].include? response.code\n response.follow_redirection(request, result, &block)\n else\n response.return!(request, result, &block)\n end\n end\n end", "title": "" }, { "docid": "f722941431f094db310ff22019d5cfe0", "score": "0.54998285", "text": "def parsed_page\n response = Nokogiri::HTML(open(self.page_url))\n\n response.css('a').each do |link|\n self.page_contents.create( tag: 'a', content: link.content )\n end\n\n response.css('h1').each do |header|\n self.page_contents.create( tag: 'h1', content: header.content )\n end\n\n response.css('h2').each do |header|\n self.page_contents.create( tag: 'h2', content: header.content )\n end\n\n response.css('h3').each do |header|\n self.page_contents.create( tag: 'h3', content: header.content )\n end \n\n end", "title": "" }, { "docid": "743d57e6e0f2e849a4c69e9dc9b85766", "score": "0.5494684", "text": "def public\n @order = params[:order]\n @order = \"created_at\" unless VALID_ORDERS.include?(@order)\n @nodes = @tag.nodes.where(\"nodes.public\" => true).order(\"#{@order} DESC\").page(params[:page])\n respond_with(@nodes)\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n @title.join(' - ').html_safe \n if current_stylesheet \n stylesheet_link_tag current_stylesheet, media: nil \n elsif current_account \n stylesheet_link_tag current_account.stylesheet_url, media: nil \n else \n stylesheet_link_tag 'application', media: nil \n end \n if @google_plus \n end \n if @author \n end \n if @dont_index \n end \n @feeds.each do |link,title| \n auto_discovery_link_tag :atom, link, { title: title } \n end \n \n (\"active\" if controller_name == \"home\") \n link_to \"Accueil\", '/', title: \"Page d'accueil du site, personnalisable\" \n (\"active\" if controller_name == \"news\" || controller_name == \"sections\") \n link_to \"Dpches\", '/news', title: \"Actualits, vnements et autres nouveauts\" \n (\"active\" if controller_name == \"forums\" || controller_name == \"posts\") \n link_to \"Forums\", '/forums', title: \"Questions/rponses, petites annonces\" \n (\"active\" if controller_name == \"polls\") \n link_to \"Sondages\", '/sondages', title: \"Sondages proposes aux visiteurs du site\" \n (\"active\" if controller_name == \"wiki_pages\" || controller_name == \"wiki_versions\") \n link_to \"Wiki\", '/wiki', title: \"Pages wiki\" \n (\"active\" if controller_name == \"trackers\") \n link_to \"Suivi\", '/suivi', title: \"Suivi des suggestions et des bugs du site\" \n form_tag '/recherche', method: :get do \n submit_tag \"Rechercher\", name: nil, id: \"search_submit\", title: \"Lancer la recherche sur le site\" \n end \n \n logo \n account_signed_in? ? link_to(current_account.login, current_account.user) : \"Se connecter\" \n link_to \"Proposer un contenu\", '/proposer-un-contenu' \n if account_signed_in? \n if current_account.has_answers? \n image_tag \"/images/icones/chat.svg\", alt: \"Nouveaux !\", title: \"Vous avez reu des rponses vos commentaires\", width: \"16px\" \n end \n link_to \"Mon tableau de bord\", '/tableau-de-bord' \n link_to \"Mes contenus taggs\", '/tags' \n link_to \"Les contenus que j'ai lus\", '/readings' \n link_to \"Modifier mes prfrences\", '/compte/modifier' \n link_to \"Changer de style\", '/stylesheet/modifier' \n button_to \"Se dconnecter\", '/compte/deconnexion', method: :post, id: \"logout\" \n else \n @account ||= Account.new \n form_for @account, url: '/compte/connexion', html: { id: \"#{dom_id @account}#{id_suffix}\" }, authenticity_token: false do |f| \n f.label \"login#{id_suffix}\", \"Identifiant\" \n f.text_field :login, id: \"account_login#{id_suffix}\", required: \"required\", placeholder: \"Identifiant\", size: 20 \n f.label \"password#{id_suffix}\", \"Mot de passe\" \n f.password_field :password, id: \"account_password#{id_suffix}\", required: \"required\", placeholder: \"Mot de passe\", size: 20 \n f.check_box :remember_me, id: \"account_remember_me#{id_suffix}\" \n f.label \"remember_me#{id_suffix}\", \"Connexion automatique\" \n f.submit \"Se connecter\", id: \"account_submit#{id_suffix}\" \n end \n \n end \n if current_account \n link_to \"Rdaction\", '/redaction' \n link_to \"Tribune de rdaction\", '/redaction' \n list_of News.draft.sorted.limit(10) do |news| \n if news.node.board_status(current_account) == :new_board \n image_tag \"/images/icones/chat.svg\", alt: \"Nouveaux !\", title: \"Il y a de l'activit sur cette dpche\", width: \"16px\" \n end \n link_to news.title, [:redaction, news] \n end \n link_to \"(...)\", \"/redaction#news\" \n \n end \n cache \"near_tags/#{@tag.name}\" do \n list_of(@tag.near_tags) do |tag| \n pluralize(tag.cnt, \"contenu commun\", \"contenus communs\") \n tag.cnt \n link_to tag.name, on_public ? public_tag_path(tag.name) : tag_path(tag.name) \n end \n end \n \n [:alert, :notice].each do |type| \n if flash[type] \n end \n end \n \n if current_account && current_account.can_update?(@tag) \n if @tag.public? \n button_to \"Cacher ce tag\", hide_tag_path(@tag), class: \"delete_button\" \n else \n button_to \"Rendre nouveau visible ce tag\", hide_tag_path(@tag), class: \"ok_button\" \n end \n end \n \n h1 \"Tous les contenus taggs avec #{@tag.name}\" \n feed \"Flux Atom du tag #{@tag.name}\" \n link = link_to(\"Afficher uniquement les contenus que j'ai taggs avec #{@tag.name}\", tag_path(@tag.name)) if current_account \n paginated_section @nodes, link do \n render @nodes.map(&:content) \n end \n link_to \"Revenir en haut de page\", '#top', class: 'scroll' \n cache \"layouts/footer\", expires_in: 1.minute do \n @last_comments.each do |comment| \n link_to comment.title, path_for_content(comment.node.content) + \"#comment-#{comment.id}\" \n end \n @popular_tags.each do |tag| \n link_to tag.name, \"/tags/#{tag.name}/public\" \n end \n @friend_sites.each do |site| \n link_to site.title, site.url \n end \n link_to \"Mentions lgales\", '/mentions_legales' \n link_to \"Faire un don\", '/faire_un_don' \n link_to \"Team LinuxFr.org\", '/team' \n link_to \"Informations sur le site\", '/informations' \n link_to \"Aide / Foire aux questions\", '/aide' \n link_to \"Rgles de modration\", '/regles_de_moderation' \n link_to \"Statistiques\", '/statistiques' \n link_to \"API pour les dveloppeurs\", '/developpeur' \n link_to \"Code source du site\", '/code_source_du_site' \n link_to \"Plan du site\", '/plan' \n \n end \n javascript_include_tag \"application\" \n\nend\n\n end", "title": "" }, { "docid": "af2cac072cd45e666a0d0c5a1984ada1", "score": "0.54931", "text": "def parse_one url, agent\n\t\t\t# url = 'http://royallib.com/book/Lem_Stanislaw/A_Legyzhetetlen.html'\n\t\t\t# page, agent = get_page(url, agent, @use_cache)\n\t\t\t# data = WebParser::Data.new(@host, agent)\n\t\t\t# data.store = data.store.merge(extract_data(page))\n\t\t\t# data.store[:url] = url\n\t\t\t# data.save\n\t\t\t# if extract_text(data, page, agent) \n\t\t\t# \textract_img(data, page, agent)\n\t\t\t# else\n\t\t\t# \tabort_save(data, url)\n\t\t\t# end\n\n\n\t\t\tpage, agent = get_page(url, agent, @use_cache)\n\t\t\t# page = browser.load_page(url)\n item_hash = extract_data(page)\n data << item_hash if item_hash\n\t\tend", "title": "" }, { "docid": "daa898e1494ec5832bc099a2ba765cfb", "score": "0.5488494", "text": "def index\n @screen_scrapings = ScreenScraping.all\n end", "title": "" }, { "docid": "4ab06951a7bce86fefd0a3fdf002bc42", "score": "0.54860675", "text": "def index\n @scrape_urls = ScrapeUrl.all\n end", "title": "" }, { "docid": "4db0eaf0931fe9b95d9d8b8720ed6eac", "score": "0.5483422", "text": "def scrape\n Event.scrape_with_microservice\n redirect_to events_path\n end", "title": "" }, { "docid": "1297b5c2bb91249e2962140b4cd39450", "score": "0.54794544", "text": "def scrape_into(page, product_information, product); end", "title": "" }, { "docid": "c067c61aae5cf7c036c5a1a1b8623cf6", "score": "0.5469463", "text": "def parse(data)\r\n super(data)\r\n \r\n case doc\r\n when Nokogiri::HTML::Document\r\n # Get Name\r\n self.name = doc.xpath(\"//div[@id='item-title']/h1\").first_string\r\n\r\n # Get Description\r\n self.description = doc.xpath(\"//div[@id='item-description']/div[contains(@class,'section-content')]\").first_string\r\n\r\n # Get Price\r\n parse_price(doc.xpath(\"//div[@class='item-amount']\").first_string)\r\n \r\n # Get Images\r\n self.images = doc.xpath(\"//div[@id='item-main']//div[@id='fullimage_link1']//img\").attribute_array \r\n self.image = images.first\r\n end \r\n end", "title": "" }, { "docid": "815c9cc57ab0c550c86847fa7f353d02", "score": "0.5467262", "text": "def parsons\n parsed = Nokogiri::HTML(URI(\"https://coinmarketcap.com/all/views/all/\").open)\n return parsed\nend", "title": "" }, { "docid": "45df859ca50a6587e7279d0bd2f7e8f8", "score": "0.5465259", "text": "def mini_scraper\n url = 'https://garagesalefinder.com/block/sales/Chicago-IL/1234567/'\n unparsed_page = HTTParty.get(url)\n parsed_page = Nokogiri::HTML(unparsed_page)\n event_urls = Array.new\n event_lists = parsed_page.css('div.record')\n event_lists.each do |event_lists|\n event_url = {\n url: event_lists.css('div.small-10').css('div.row.collapse').css('div.sale-actions').css('a.sale-url').attr('href').value\n }\n event_urls << event_url\n event_urls = event_urls.uniq\n end\n event_urls_v = event_urls.map{ |hash| hash.values }.flatten \n event_data = Array.new\n event_urls_v.each do |each_url|\n unparsed_page_url = HTTParty.get(each_url)\n parsed_page_url = Nokogiri::HTML(unparsed_page_url)\n\n event = {\n # # # name: parsed_page_url.css('#container > div.sale-content-wrap > section > div > div:nth-child(2) > div:nth-child(1) > div.small-9.columns > h2'),\n # # # address: parsed_page_url.css('#container > div.sale-content-wrap > section > div > div:nth-child(2) > div:nth-child(3) > div:nth-child(1) > div > div.small-12.medium-7.columns > div.sale-dates > h1'),\n address: parsed_page_url.css('#container').css('div.sale-content-wrap').css('section.row.sale-content').css('div.small-12.columns').children[3].children[3].children[3].children[3].children[1].text \n }\n event_data << event\n end\n byebug\nend", "title": "" }, { "docid": "5b8cbcde089bca6955a1fa826d234fbb", "score": "0.5462669", "text": "def run\r\n log \"Parsing...\"\r\n url = \"unknown\"\r\n if @site.url\r\n url = @site.url\r\n log \"Opening #{url} as a data page\"\r\n\r\n #get page according to URL what was setup in ats.rb\r\n @page = @agent.get(url)\r\n\r\n #parse method should be override in subclasses\r\n @data = parse(@page)\r\n else\r\n #some sites do not have \"datapage\" URL\r\n #for example after login you're already on your very own datapage\r\n #this is to be addressed in 'parse' method of subclass\r\n @data = parse(nil)\r\n end\r\n\r\n\r\n rescue Exception=>e\r\n puts \"Failed to parse URL '#{url}', exception=>\"+e.message\r\n set_site_status(\"error \"+e.message)\r\n end", "title": "" }, { "docid": "58d0e6a4a99becc3d0191767292b6f72", "score": "0.54568255", "text": "def getTargetContent(client)\n\n\t\tbegin\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=ホーム\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='searchButton']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=キッズ一覧\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=えほん\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='kind_subscription']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=(//*[@id='recycler_view' and ./following-sibling::*[@id='error_view']]/*/*/*[@id='thumbnail'])\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.swipe2(\"Down\", 300, 1500)\n\t\t client.sleep(1000)\n\t\trescue Exception => e\n\t\t\t$errMsgDwnld = \"::MSG:: Exception occurrred while finding ELEMENT \" + e.message\n\t\tend\n\t begin\n\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@id='otherView' and @class='jp.co.unext.widget.DownloadCircleIndicator']\", 0, 10000)\n\t\t\t\t#If statement\n\t\t\tend\n\t\t\t#client.click(\"NATIVE\", \"xpath=//*[@id='otherView' and @class='jp.co.unext.widget.DownloadCircleIndicator']\", 0, 1)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='download_indicator' and ./parent::*[@class='android.widget.FrameLayout']]\", 0, 1)\t\t#id changed from 2.11.0~\t\n\t\t\tclient.sleep(3000)\n\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@id='alertTitle']\")\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='button1']\", 0, 1)\n\t\t\tend\n\t\t\t#if client.isElementFound(\"NATIVE\", \"xpath=//*[@id='download_progress']\")\n\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@id='progress_text']\")\t\t#id changed from 2.11.0~\n\t\t\t\t@@comment = \"::MSG:: ダウンロードを開始しました「Download has started」\"\n\t\t\t\t$obj_rtnrs.returnOK\n\t\t\t\t$obj_rtnrs.printResult\t\n\t\t\telse\n\t\t\t\t$errMsgDwnld = \"::MSG:: ダウンロードを失敗しました!!!「Downloading failed, Check status」\"\n\t\t\t\t$obj_rtnrs.returnNG\n\t\t\t\t$obj_rtnrs.printResult\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgDwnld = \"::MSG:: Exception occurrred during Download operation..: \" + e.message\n\t\t\t$obj_rtnrs.returnNG\n\t\tend\t\t\t\n\tend", "title": "" }, { "docid": "4ae870ac5e807c9ae07324740f539d4b", "score": "0.5441969", "text": "def scrape\n $order = Face.count == 0 ? 0 : Face.order('_index DESC').first._index + 1 # set the initial grid position\n scrape_page \"Academic\" # scrape the CS academic staff web page\n scrape_page \"Administrative\" # scrape the CS admin staff web page\n scrape_page \"Technical\" # scrape the CS technical staff web page\n update_rooms # scrape the rooms of all staff members\n redirect_to faces_path # reload the page\n end", "title": "" }, { "docid": "d60fa82de5123a59c76e4ca82e50d10a", "score": "0.5432896", "text": "def getsearchresults\n query=params['q'].gsub(' ','+')\n query=query.gsub('/','%2F')\n if params[:site]=='metacritic'\n doc=Nokogiri::HTML(open(\"http://metacritic.com/search/game/#{query}/results\"))\n doc.encoding='utf-8'\n @results=doc.css(\"li.result\").inner_html\n elsif params[:site]=='gamerankings'\n doc=Nokogiri::HTML(open(\"http://www.gamerankings.com/browse.html?search=#{query}&numrev=3\"))\n @results=doc.at_css(\"div#main_col > div.pod\").inner_html\n end\n respond_to do |format|\n format.js {render :layout => false}\n end\n end", "title": "" }, { "docid": "bbc32355eb547b00f9490806ef8c514d", "score": "0.54305714", "text": "def spider\n @keyword = Keyword.find(params[:id])\n\n uastr = \"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.7\"\n\n require 'mechanize'\n agent = Mechanize.new\n agent.user_agent = uastr \n #agent.user_agent_alias = 'Mac OS X Mozilla'\n\n discogs_base = \"http://www.discogs.com\"\n #url = \"#{discogs_base}/search/?q=Beatles+Sgt+Peppers+LP\" \n url = \"#{discogs_base}/search/?q=#{CGI.escape @keyword.keys}\" \n\n #logger.info( \"url=(#{url})\" )\n #return\n\n page = agent.get url\n\n # Check for short-circuit condition with no results\n if ( /find anything in the Discogs database for/.match( page.body ) )\n flash.now[:error] = 'No matches found at Discogs'\n return\n end\n\n\n @card_ids = Array.new \n @card_titles = Array.new\n @card_urls = {}\n @card_details = {}\n @card = {}\n\n cards = page.body.split( /\"card card_normal float_fix/ )\n\n cards.each do |card| \n card2 = card.gsub( /[\\r\\n]/m, '' )\n ndoc = Nokogiri::HTML( card2 )\n h4 = ndoc.css('h4').first\n\n if ( !h4.nil? )\n ptitle = h4.inner_html\n ptitle.sub!( /<\\/?h4>/, '' )\n ptitle.strip!\n ptitle.gsub!( /href=\"/, \"href=\\\"http://www.discogs.com\" )\n @card_titles.push( ptitle )\n\n #root_dir = Rails.root.to_s\n #file = File.open( \"#{root_dir}/dump/card2_dump.txt\", 'wb' )\n #file.write ( ptitle )\n #file.close \n end\n\n\n if ( /data\\-object\\-id=\"(\\d+)\"/.match( card ) ) \n cid = $1\n if ( /href=\"(\\S+\\/release\\/#{$1})\"/.match( card ) )\n curl = $1\n #logger.info( \"curl=(#{curl})\" )\n\n @card_ids.push( cid )\n @card_urls[cid] = \"#{discogs_base}#{curl}\"\n end\n end \n end\n\n (0 .. 4).each do |i|\n cid = @card_ids[i]\n ctitle = @card_titles[i]\n curl = @card_urls[cid]\n page = agent.get curl\n cdet = page.body\n #@card_details[cid] = cdet\n\n heads = page.search( \".head\" ) \n contents = page.search( \".content\" ) \n\n #logger.info( \"heads=(#{heads.inspect})\" )\n #logger.info( \"conts=(#{contents.inspect})\" )\n\n ok_fields = ['label', 'format', 'country', 'released', 'genre', 'style']\n\n @card['title'] = ctitle\n\n (0..5).each do |i|\n h = heads[i].inner_html.downcase.slice(0 .. -2)\n next unless ok_fields.include?( h )\n\n c = contents[i].text\n c.delete!( \"\\n\" )\n c.strip!\n @card[h] = c \n #file.write (\"[#{i}] (#{h}) cont=(#{c})\\n\" )\n end\n\n\n @card_details[cid] = <<\"CARD\"\n<table>\n<tr>\n<td width=80>Label:</td>\n<td>#{@card['label']}</td>\n</tr><tr>\n<td>Format:</td>\n<td>#{@card['format']}</td>\n</tr><tr>\n<td>Country:</td>\n<td>#{@card['country']}</td>\n</tr><tr>\n<td>Released:</td>\n<td>#{@card['released']}</td>\n</tr><tr>\n<td>Genre:</td>\n<td>#{@card['genre']}</td>\n</tr><tr>\n<td>Style:</td>\n<td>#{@card['style']}</td>\n</tr>\n</table>\nCARD\n\n @release = @keyword.releases.build( @card )\n\n if @release.save\n flash.now[:success] = 'Saved release info'\n else\n flash.now[:error] = 'Error saving release info'\n end\n\n #root_dir = Rails.root.to_s\n #file = File.open( \"#{root_dir}/dump/#{cid}.txt\", 'wb' )\n #file.write ( @card.inspect )\n #file.close \n\n end\n\n show_releases\n render action: 'show_releases', id: @keyword, success: 'Ebay listings scraped'\n\n \n #logger.info (\"LOGGER keyword=\" + @keyword.inspect )\n #logger.info (\"LOGGER page=\" + page.body )\n\n #respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @keyword }\n #end\n end", "title": "" }, { "docid": "f138c91d8fc819680f883c2834b4b86d", "score": "0.5427708", "text": "def scrape\n uri = URI.parse(REQUEST_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n response = http.send_request('GET', uri.request_uri)\n json = JSON.parse(response.body)\n\n json['results'].each do |result|\n # Skip and discard articles outside of start and end dates\n pubDate = DateTime.parse(result['published_date'])\n if pubDate.to_date < @start || pubDate.to_date > @end\n next\n end\n\n @articles << Article.new(source: SOURCE,\n title: result['title'],\n pub_date: pubDate,\n summary: result['abstract'],\n # Remove \"By \" and titleize\n author: result['byline'].sub(/^by /i,'').titleize,\n # Set image to the 1st multimedia url if it exists\n images: result['multimedia'][0] ? result['multimedia'][0]['url'] : nil,\n link: result['url'])\n end\n end", "title": "" }, { "docid": "9515ebd9959faf2cf7a7c2937e42d169", "score": "0.542516", "text": "def scrape_page(url)\n\n # open single PHMSA operator data page\n html = ScraperWiki.scrape url\n \n # create a variable to hold the website, parsed with nokogiri\n doc = Nokogiri::HTML(html)\n \n # store all data\n doc.search('tbody').each do |tbody|\n h4 = doc.search('h4')\n ScraperWiki.save([:name, :urls, :data], {name:h4.inner_html, urls:url, data:tbody.inner_html})\n end\n\n # clear variables\n doc = nil\n html = nil\n h4 = nil\n\nend", "title": "" }, { "docid": "9515ebd9959faf2cf7a7c2937e42d169", "score": "0.542516", "text": "def scrape_page(url)\n\n # open single PHMSA operator data page\n html = ScraperWiki.scrape url\n \n # create a variable to hold the website, parsed with nokogiri\n doc = Nokogiri::HTML(html)\n \n # store all data\n doc.search('tbody').each do |tbody|\n h4 = doc.search('h4')\n ScraperWiki.save([:name, :urls, :data], {name:h4.inner_html, urls:url, data:tbody.inner_html})\n end\n\n # clear variables\n doc = nil\n html = nil\n h4 = nil\n\nend", "title": "" }, { "docid": "24e704c346a1135543c6b3eaf751724b", "score": "0.54239994", "text": "def doc\n\tNokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\"))\nend", "title": "" }, { "docid": "4b52ace40f35185416a7d0bc1dccd9df", "score": "0.5419446", "text": "def index_master\n page = params[:page] || 1\n @riders = Rider.master.page(page)\n end", "title": "" }, { "docid": "d871192fca13018f26eabbacfb3a1919", "score": "0.541597", "text": "def scrape\n cp = add_content_provider(Tess::API::ContentProvider.new(\n {title: \"Nuffield Department for Population Health\",\n url: config[:root_url],\n image_url: \"https://www.ndph.ox.ac.uk/images/site-logos/primary-logo\",\n description: \"Nuffield Department for Population Health undertakes research and trains scientists to seek answers to some of the most important questions about the causes, prevention and treatment of disease to reduce disability and premature death in both the developed and developing worlds.\",\n content_provider_type: :organisation,\n keywords: [\"HDRUK\"]\n }))\n\n forthcoming_events_url = config[:root_url] + config[:forthcoming_events_path]\n past_events_url = config[:root_url] + config[:past_events_path]\n\n # Get HTML snippets together for past and future events\n events_html = get_events(forthcoming_events_url) + get_events(past_events_url)\n\n # Wrap the HTML snippet with events into a dummy HTML doc\n html_text = \"<html><head></head><body>#{events_html}</body></html>\"\n # Parse the HTML doc\n html_doc = Nokogiri::HTML(StringIO.open(html_text))\n event_divs = html_doc.css(\"div.listing-item-event\")\n event_divs.each do |event_div|\n event_title = event_div.xpath(\".//h2/a\").try(:text)\n event_url = event_div.xpath('.//h2/a/@href').first.try(:text)\n # Nothing is available for description of the events so using speaker's name (which is also not always available)\n event_speaker = event_div.xpath('.//p[@class=\"event-speaker\"]/a').first.try(:text)\n event_description = \"Speaker: \" + event_speaker unless event_speaker.nil?\n event_start_date = event_div.xpath('.//p[@class=\"details\"]/span[@itemprop=\"startDate\"]/@content').try(:text)\n event_end_date = event_div.xpath('.//p[@class=\"details\"]/span[@itemprop=\"endDate\"]/@content').try(:text)\n event_venue = event_div.xpath('.//p[@class=\"details\"]/span[@itemprop=\"location\"]').first.try(:text)\n\n event = Tess::API::Event.new(\n {content_provider: cp,\n title: event_title,\n url: event_url,\n start: event_start_date,\n end: event_end_date,\n description: event_description,\n organizer: 'Nuffield Department for Population Health',\n venue: event_venue,\n country: 'United Kingdom',\n event_types: [:workshops_and_courses], # these are actually seminars - we'd need a new category\n keywords: [\"HDRUK\"]\n })\n add_event(event)\n end\n end", "title": "" }, { "docid": "385b7b89e9b41040326cce573b75001b", "score": "0.54099536", "text": "def get_decks\n\t\t@webpage = Page.new(\"http://www.ruby-doc.org/core-1.9.3/\")\n\t\tputs \"fetching...\"\n\t\tresponse = @webpage.fetch!\n\t\tdisplay_page_info(response)\n\tend", "title": "" }, { "docid": "2d7dc34b90c0cb31a7277006b80e3dd9", "score": "0.5402105", "text": "def browse\n themoviedb = ApplicationHelper::themoviedb\n paramaters = {'api_key'=> themoviedb[:api_key], 'page'=> 1}\n data = ApplicationHelper.get(themoviedb[:endpoint]+themoviedb[:on_the_air], paramaters)\n set_current_endpoint(themoviedb[:endpoint]+themoviedb[:on_the_air])\n @on_the_air = JSON.parse data\n @results = @on_the_air['results']\n set_current_query(nil)\n set_total_page(@on_the_air[\"total_pages\"])\n set_current_page(1)\n\n end", "title": "" }, { "docid": "7b2e2e33feecc7fa245f944c149d09f2", "score": "0.5396288", "text": "def index\n\t @b4 = true\n #render layout: false\n #@doc = Nokogiri::HTML(open(\"https://www.biodiversidad.gob.mx/pais/mares/infoceanos/\")).css('#project')\n @doc = Nokogiri::HTML(open(\"https://www.biodiversidad.gob.mx/monitoreo/infoceanos\")).css('#el-titulo, #introenciclovida')\n\n #@doc.css('#pagetitle').remove\n #@doc.css('#sectionmenu').remove\n #@doc.css('#pageima').remove\n @doc.xpath('//comment()').remove\n\n @doc.each do |el|\n el.traverse do |n|\n if n.matches?('img')\n #n.attribute('src').value = n.attribute('src').value.gsub('../../../', 'https://www.biodiversidad.gob.mx/')\n n.attribute('src').value = \"https://www.biodiversidad.gob.mx/\" + n.attribute('src').value unless n.attribute('src').value.include?('biodiversidad.gob.mx')\n n['class'] = n['class'].present? ? (n['class'] + ' img-fluid') : 'img-fluid'\n end\n end\n end\n\n @doc = @doc.to_html\n end", "title": "" }, { "docid": "3e9d25d3d7fbce7042a40bf7e2d003f1", "score": "0.53928345", "text": "def scraper\n url = \"https://www.groupon.com.au/\" ##Source web page link\n unparsed_page = HTTParty.get(url)\n parsed_page = Nokogiri::HTML(unparsed_page)\n activity_cards = parsed_page.css('figure.card-ui')\n puts \"Number of cards is #{activity_cards.count}\"\n # byebug\nend", "title": "" }, { "docid": "a2bf2c0a320606d5390ef85a6b58c951", "score": "0.53905666", "text": "def run\n return scrape(@main_page) if search_entire_site\n scrape_once(@main_page)\n end", "title": "" }, { "docid": "6a8e23e95308911967002ef8c8e6f575", "score": "0.53877735", "text": "def crawl\n @agent = Mechanize.new\n @uristate = Hash.new{|h,k| h[k] = 0}\n @stack = [ agent.get(root_uri) ]\n until stack.empty?\n to_check = stack.shift\n case to_check\n when ::Mechanize::Page\n check_web_page(to_check)\n else\n listener.doc_skipped(to_check)\n end\n end\n @agent = nil\n @uristate = nil\n @stack = nil\n end", "title": "" }, { "docid": "458752116b5fd4d6fade464f8918ac87", "score": "0.5387379", "text": "def scrape_shows_index\n self.get_page_shows.css(\"table #stitcher-list\")\n end", "title": "" }, { "docid": "8283320933a3b31d15db20b1a8976353", "score": "0.5385547", "text": "def page_source; end", "title": "" }, { "docid": "3bbea4fa63f54b6d41975a517498ebde", "score": "0.53850013", "text": "def get_merchant_info(merchant_container, page)\n # merchant_container is expected to be with ??? piece of information\n\n # 0. info_url\n # 1. \n # 2. \n # 3. \n # 4. \n # 5. \n\n # Todo: Put your code to process the merchant_container to get the merchant_info here\n \n container = merchant_container.search('.desc-container')[0]\n company_name = container.at('h2').inner_text\n domain = container.at('span').inner_text\n description = container.search('.description')[0]\n if description.search('.truncate').size > 0\n description = description.inner_text.gsub('... More','')\n else\n description = description.inner_text\n end\n \n detail_url = \"/siteinfo/\" + domain\n \n detail_page = page.link_with(:href => detail_url).click\n global_rank_container = detail_page.search('#siteStats tbody td')[0]\n if global_rank_container.nil? \n detail_url = @url + detail_url \n detail_page = @agent.get(detail_url )\n global_rank_container = detail_page.search('#siteStats tbody td')[0]\n end\n \n puts detail_page.body\n\n global_rank = clean_whitespace(global_rank_container.at('div').inner_text)\n \n us_rank_container = detail_page.search('#siteStats tbody td')[1]\n if us_rank_container.at('div').nil? \n us_rank_container = detail_page.search('#siteStats tbody td')[2]\n end\n us_rank = clean_whitespace(us_rank_container.at('div').inner_text)\n record = {\n 'global_rank' => global_rank,\n 'us_rank' => us_rank,\n 'company_name' => company_name,\n 'domain' => domain,\n 'description' => description\n }\n \n return record \nend", "title": "" }, { "docid": "3bbea4fa63f54b6d41975a517498ebde", "score": "0.53850013", "text": "def get_merchant_info(merchant_container, page)\n # merchant_container is expected to be with ??? piece of information\n\n # 0. info_url\n # 1. \n # 2. \n # 3. \n # 4. \n # 5. \n\n # Todo: Put your code to process the merchant_container to get the merchant_info here\n \n container = merchant_container.search('.desc-container')[0]\n company_name = container.at('h2').inner_text\n domain = container.at('span').inner_text\n description = container.search('.description')[0]\n if description.search('.truncate').size > 0\n description = description.inner_text.gsub('... More','')\n else\n description = description.inner_text\n end\n \n detail_url = \"/siteinfo/\" + domain\n \n detail_page = page.link_with(:href => detail_url).click\n global_rank_container = detail_page.search('#siteStats tbody td')[0]\n if global_rank_container.nil? \n detail_url = @url + detail_url \n detail_page = @agent.get(detail_url )\n global_rank_container = detail_page.search('#siteStats tbody td')[0]\n end\n \n puts detail_page.body\n\n global_rank = clean_whitespace(global_rank_container.at('div').inner_text)\n \n us_rank_container = detail_page.search('#siteStats tbody td')[1]\n if us_rank_container.at('div').nil? \n us_rank_container = detail_page.search('#siteStats tbody td')[2]\n end\n us_rank = clean_whitespace(us_rank_container.at('div').inner_text)\n record = {\n 'global_rank' => global_rank,\n 'us_rank' => us_rank,\n 'company_name' => company_name,\n 'domain' => domain,\n 'description' => description\n }\n \n return record \nend", "title": "" }, { "docid": "c670ce77f3447ed0ea2c27decc2e43d9", "score": "0.5384663", "text": "def website_scrape(d)\n search_url, search_params = website_get_search_url_and_params(d)\n \n doc = fetch_url( search_url, search_params)\n \n #figure out number of result pages\n page_count = website_parse_out_page_count(doc)\n NewsScrapers.logger.info \" #{page_count} pages of results\"\n \n #for each page of results\n article_count = 0\n (0..page_count-1).each do |current_page|\n NewsScrapers.logger.info \" Page #{current_page}\"\n search_params[:frow] = 10 * current_page\n doc = fetch_url(search_url, search_params) # will refetch from cache the first time - no biggie\n # for each article link\n website_parse_out_article_urls(doc).each do |article_info|\n NewsScrapers.logger.info \" Article #{article_info[:url]}\"\n if Article.scraped_already? article_info[:url]\n # skip it if we've already fetched this link\n NewsScrapers.logger.info \" scraped already - skipping\"\n else\n # load an article page and parse it to fill in an Article object, save it\n article_doc = fetch_url(article_info[:url],{},false, false) # fetch without mechanize to avoid \"\\x8B\" from ASCII-8BIT to UTF-8 encoding problem\n article = website_parse_out_article_info(article_doc)\n article.src_url = article_info[:url]\n article.pub_date = d\n article.source = get_source_name\n article.headline = article_info[:headline] if article.headline == nil\n article.section = article_info[:section] if article.section == nil\n article.byline = article_info[:byline] if article.byline == nil\n article.word_count = article_info[:word_count] if article.word_count == nil\n article.set_queue_status(:complete)\n article.save\n article_count = article_count + 1\n NewsScrapers.logger.info \" saved\"\n sleep 0.2 # throttle each article request\n end\n end\n sleep 1 # throttle each page request\n end \n \n article_count\n end", "title": "" }, { "docid": "eb8ee02b6639ed2273f6726cd34d2554", "score": "0.5384609", "text": "def scrape\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n http.use_ssl = true if uri.scheme == 'https'\n\n # Make a GET request to the given url\n response = http.send_request('GET', uri.request_uri)\n\n # Parse the response body\n data = JSON.parse(response.body)\n\n article_list = data['results']\n\n article_list.each do |item|\n item['byline'].slice!('By ')\n\n # Get image\n image_url = nil\n unless item['multimedia'].empty?\n item['multimedia'].each do |image|\n if image['format'] == 'Normal'\n image_url = image['url']\n break\n end\n end\n end\n\n # Sanitize HTML\n item['title'] = CGI.unescapeHTML(item['title'])\n item['abstract'] = CGI.unescapeHTML(item['abstract'])\n item['byline'] = CGI.unescapeHTML(item['byline'])\n item['byline'] = nil if item['byline'].nil? || item['byline'].empty?\n\n @articles.push(\n author: item['byline'],\n title: item['title'],\n summary: item['abstract'],\n image_url: image_url,\n source: @source,\n url: item['url'],\n pub_date: item['published_date']\n )\n end\n end", "title": "" }, { "docid": "2df259766e3b9bfb2e8243306566fba1", "score": "0.5364525", "text": "def load\n @html = response_data['html']\n\n super\n end", "title": "" }, { "docid": "58f39ff654d28dfc5249d2703451f9fe", "score": "0.53572476", "text": "def get_the_marque (url_lmdw)\n page = HTTParty.get(url_lmdw)\n parse_page = Nokogiri::HTML(page)\n marque = []\n xpath2 ='//li[@class=\"product\"]'\n marque = parse_page.xpath(xpath2)\n marque.text\nend", "title": "" }, { "docid": "fa20e922f6e4569dd664bf766ec461fb", "score": "0.5355583", "text": "def scrape_url \n recipe_url = Nokogiri::HTML(open(\"http://seriouseats.com/tags/recipes/#{@option}\"))\n \n recipe_links = []\n links = recipe_url.css('.module__link')\n links.each{|link| recipe_links << link['href']}\n \n @url = recipe_links.sample\n @url\n end", "title": "" }, { "docid": "b604bf70d2c34be9303d83b5bc84eba9", "score": "0.535523", "text": "def parse(page)\n super(page)\n\n form = page.form_with(:id => 'careerform')\n company = page.parser.xpath('//input[@id=\"career_company\"]').first['value']\n\n SuccessFactors.set_company_name(company)\n\n\n get_details_page = lambda { |page,ref_code|\n SuccessFactors.data_sets[:view_job_details]['career_job_req_id'] = ref_code\n @agent.post(page.forms.first.action, SuccessFactors.data_sets[:view_job_details])\n }\n\n details_links = lambda { |page|\n page.links.select { |link| link.href =~ /career_job_req_id/ }.\n map { |link| $1 if link.href =~ /setField\\('.*', '(\\d+)'\\)/ }\n }\n\n switch_results_page = lambda { |page|\n SuccessFactors.set_pagination_start(SuccessFactors.current_results_page*10 + 1)\n @agent.post(SuccessFactors.actions[:view], SuccessFactors.data_sets[:switch_page])\n if details_links.call(@agent.page).length > 0\n @agent.page\n else\n nil\n end\n }\n\n if form\n page = @agent.post(form.action, SuccessFactors.data_sets[:search])\n SuccessFactors.actions[:view] = page.forms.first.action\n end\n\n @rows_total = $1.gsub(',', '').to_i if page.parser.xpath(\"//div[@class='content']/div[@class='pagination_row'][1]/div[@class='pagination_top']/div\").text.strip =~ /.*of\\s*([\\d,]+)/m\n @done = false\n\n until @done\n details_links.call(page).each do |details_link|\n details_page = get_details_page.call(page, details_link)\n\n log \"Opened '#{details_page.uri.to_s}'\"\n\n fields = get_fields_from_page(details_page)\n fields[:ref_code] = details_link unless fields[:ref_code]\n save_result_page details_page.uri.to_s, fields\n end\n\n page = switch_results_page.call(page)\n @done = true if page.nil?\n SuccessFactors.current_results_page += 1\n end\n\n site_done\n\n end", "title": "" }, { "docid": "d4a7ab63ba409c3e45164d6aeac30137", "score": "0.53476584", "text": "def get_metadata\n login\n page = parse_one_page(@base_uri)\n last = page.search(\"//div//ul[@class='pager']//li[@class='pager-last last']\")\n last_page_link = last.css(\"a\").first[\"href\"]\n begin\n next_page = page.search(\"//div//ul[@class='pager']//li[@class='pager-next']\")\n link = next_page.css(\"a\").first\n if link\n link = link[\"href\"]\n @current_page = @base + link\n puts \"Fetching...\" + @current_page\n page = parse_one_page(@current_page)\n end\n end while link != last_page_link\n\n @metadata_master\n end", "title": "" }, { "docid": "ba7637badf6025aa83ef6a480a77b910", "score": "0.53459126", "text": "def home\n \t#uri = URI.parse(\"http://octopart.com/api/v2/parts/search?q=CY7C2544\")\n \turi = URI.parse(\"http://octopart.com/api/v2/parts/search?q=MT49H&apikey=298ff890\")\n \t#@data = Net::HTTP.get(uri) - works\n \t#render :json => @data\n \t@data = MultiJson.load(Net::HTTP.get(uri))\n \t@data = @data[\"results\"]\n end", "title": "" }, { "docid": "ff37a5f06d04b316bfbfceb601bc55a6", "score": "0.5345609", "text": "def index\n @gs1_masters = Gs1Master.page(params[:page])\n # @gs1_masters = Gs1Master.all\n end", "title": "" }, { "docid": "c384afcfd54973da7284d391d7f32bc0", "score": "0.5341238", "text": "def crawl()\n raise NotImplementedError, 'You must override this method'\n end", "title": "" } ]
93841cafee735a7d634bfa93c55de5e0
Returns a limit that will be used on the query
[ { "docid": "062a3131d33823690c8ab49abf8dce9e", "score": "0.0", "text": "def get_autocomplete_limit(options)\n options[:limit] ||= 10\n end", "title": "" } ]
[ { "docid": "a6425d2fa55606e391096759ea40eb41", "score": "0.83633053", "text": "def query_limit\n if params[:limit]\n limit = params[:limit].to_i # defaults to 0\n if self.respond_to?(:allowed_limit) && !self.allowed_limit.nil?\n [limit, allowed_limit].min\n else\n limit\n end\n elsif self.respond_to?(:allowed_limit)\n self.allowed_limit\n else\n 10_000\n end\n end", "title": "" }, { "docid": "35bc82f605f39e69bb28d2d3cbf5d698", "score": "0.83108044", "text": "def limit\n @limit\n end", "title": "" }, { "docid": "0396ee652652fda44650fa612cc4789b", "score": "0.827718", "text": "def limit\n @limit\n end", "title": "" }, { "docid": "445a456f41c395c8f60128f148a35af6", "score": "0.8221733", "text": "def limit\n return @limit\n end", "title": "" }, { "docid": "cb546a8426e35d48594274461afc56e9", "score": "0.8159246", "text": "def limit\n @limit\n end", "title": "" }, { "docid": "bbc9e3d16391f01d1945a79e37e3a4e8", "score": "0.8068467", "text": "def limit\n meta.fetch('limit', nil)\n end", "title": "" }, { "docid": "ca9e0abb672b3b710fe5ee60b781d230", "score": "0.80461806", "text": "def limit_value\n @query.per_page\n end", "title": "" }, { "docid": "274838a7d171be8dfb0bce94cfb89618", "score": "0.79545", "text": "def limit(options={})\n limit = options[:limit]\n raise \"Need to provide a limit\" unless limit\n queryLimitedToLast(limit)\n end", "title": "" }, { "docid": "1ed9b2544ce1c2e4174004e193c9d623", "score": "0.7926847", "text": "def selected_limit\n param('limit') || DEFAULT_LIMIT\n end", "title": "" }, { "docid": "1430d56fe074e3ca37c045c42d80a2c9", "score": "0.78856826", "text": "def limit\n 10\n end", "title": "" }, { "docid": "0c3953fd67b736ec09830b2f6f3409e6", "score": "0.7885304", "text": "def limit\n pagination.fetch(:limit, 10).to_i\n end", "title": "" }, { "docid": "4e62856a5d97de9b5b14fa60d7401cfa", "score": "0.787858", "text": "def limit\n options[:limit]\n end", "title": "" }, { "docid": "2d1c605bcef0fbda24eaf99cd134d112", "score": "0.78593564", "text": "def result_limit\n if params[:limit]\n if params[:limit].to_i > 0 && params[:limit].to_i <= 10000\n params[:limit].to_i\n else\n raise OSM::APIBadUserInput, \"Note limit must be between 1 and 10000\"\n end\n else\n 100\n end\n end", "title": "" }, { "docid": "c91ac0ee1a08cd12aa6d994636fa0bef", "score": "0.78460395", "text": "def limit(value)\n query.limit(value.to_i)\n self\n end", "title": "" }, { "docid": "de6308bd260ee9b65d5052abc3215e07", "score": "0.78361684", "text": "def limit\n operation.limit\n end", "title": "" }, { "docid": "3931b3563e79a66f090fc607e47e05db", "score": "0.783217", "text": "def limit(num=nil)\n self.query[:limit] = num if num\n self.query[:limit]\n end", "title": "" }, { "docid": "60bdb4b40ea0e10d0135bbe4615a4319", "score": "0.78223413", "text": "def limit\n options[:limit]\n end", "title": "" }, { "docid": "166861c34bc1adb3bc54a313e0ee05df", "score": "0.76997787", "text": "def limit\n (params[:limit] || 25).to_i\n end", "title": "" }, { "docid": "7720bea773325714e8d0e02186ecfa19", "score": "0.76259077", "text": "def limit(value)\n return self if value.nil? && !@_fetch.nil?\n where(limit: value)\n end", "title": "" }, { "docid": "2078a16b0c1a6cf623a6571ac8574343", "score": "0.7623272", "text": "def limit limit\n _with(:limit => limit)\n end", "title": "" }, { "docid": "1da097f25050eb1fc8c6c4eb45cbfefd", "score": "0.7622685", "text": "def select_limit_sql(sql)\n if l = @opts[:limit]\n sql << \" TOP \"\n literal_append(sql, l)\n end\n end", "title": "" }, { "docid": "e6fc5d24ca30b3ad90f16a023b0ca1e5", "score": "0.76177096", "text": "def limit_value\n return unless self.query.clause?(:limit)\n limit_clause = self.query.send(:clauses).find { |clause| clause.is_a?(ActiveGraph::Core::QueryClauses::LimitClause) }\n limit_clause.instance_variable_get(:@arg)\n end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "e30f5ad58700b669f4df7ea570b13072", "score": "0.76064295", "text": "def limit; end", "title": "" }, { "docid": "b95736def4ca27c6181fd2a42ea1d494", "score": "0.7592908", "text": "def default_limit\n 10\n end", "title": "" }, { "docid": "1da8868b105ebb9ece7f52496fdf91d2", "score": "0.7587542", "text": "def limit\n self.class.limit\n end", "title": "" }, { "docid": "22a401811a4a6f4b4da72a0f9c6fef83", "score": "0.7577702", "text": "def retrieve_limit_value(env)\n retrieve_integer_value('LIMIT', env)\n end", "title": "" }, { "docid": "9e6e0b7203ab45aeabb36d50e25f54c5", "score": "0.75759876", "text": "def limit\n default_limit = 80\n max_limit = 100\n (params[:limit] ? [params[:limit].to_i, max_limit].min : default_limit)\n end", "title": "" }, { "docid": "7e25aa0ba44742b98fabbd0c1c9cedf9", "score": "0.7553333", "text": "def get_limit(options)\n options[:limit] ||= 10\n end", "title": "" }, { "docid": "32d77a23beb5373afe78d6f21b5d666e", "score": "0.75324667", "text": "def query_limit\n field&.max_page_size.presence || context.schema.default_max_page_size\n end", "title": "" }, { "docid": "ea8d4694036047c9a358ed7effbc7b8b", "score": "0.75284857", "text": "def limit\n 5\n end", "title": "" }, { "docid": "e209bd5ea747eadf37f1d2f211cbbb91", "score": "0.7522954", "text": "def select_limit_sql(sql)\n sql << \" TOP #{@opts[:limit]}\" if @opts[:limit]\n end", "title": "" }, { "docid": "e209bd5ea747eadf37f1d2f211cbbb91", "score": "0.7522954", "text": "def select_limit_sql(sql)\n sql << \" TOP #{@opts[:limit]}\" if @opts[:limit]\n end", "title": "" }, { "docid": "9066e8fecc964e51aa5d948c5bfffaa3", "score": "0.7502865", "text": "def limit_value\n @query.per_page || Kaminari.config.default_per_page\n end", "title": "" }, { "docid": "b70e39e2d8d687ae0ced94f44a1b43ff", "score": "0.7501192", "text": "def limit limit\n _clone._tap do |c|\n c.limit_clause = limit\n end\n end", "title": "" }, { "docid": "869195ace92673e8b9696c366cdcde73", "score": "0.7495985", "text": "def limit(n)\n where(limit_param => n)\n end", "title": "" }, { "docid": "82a8fd73bb66eac7a75fc9677388fe93", "score": "0.74374974", "text": "def limit_from_sql\n limit_clause = original_select.limit_option == :LIMIT_OPTION_DEFAULT ? nil : original_select&.limit_count\n return nil if limit_clause.nil?\n\n get_int_value(limit_clause)\n end", "title": "" }, { "docid": "c852260a26937a91815369767b8f0826", "score": "0.74371654", "text": "def limit *args\n return @limit if args.empty?\n collection_with(:limit => Integer(args.first))\n end", "title": "" }, { "docid": "2bdfa41d1177ee3e2a91335ada426eea", "score": "0.74056447", "text": "def limit\n (params[:limit].presence || 20).to_i\n end", "title": "" }, { "docid": "82006decd90c0d5b5315603b4a2c9a02", "score": "0.7404526", "text": "def limit\n params[:limit].to_i.zero? ? Serial::PER_PAGE : params[limit].to_i\n end", "title": "" }, { "docid": "32101554aa86e683b9e6ade01d2ae28a", "score": "0.7398329", "text": "def limit(limitable)\n @limits.get(limitable)\n end", "title": "" }, { "docid": "959ced3167dc8dd8c95e55651419c25f", "score": "0.7385783", "text": "def select_limit_sql(sql)\n if l = @opts[:limit]\n sql << TOP\n literal_append(sql, l)\n end\n end", "title": "" }, { "docid": "17b5d62ed9ecdc500031152482a93a9e", "score": "0.7382755", "text": "def apply_limit_to(query)\n return query unless _limit\n query.limit(_limit)\n end", "title": "" }, { "docid": "b0cbbca3ebf769c92d3232f87e6b970a", "score": "0.7378696", "text": "def limit\n @column.limit if @column\n end", "title": "" }, { "docid": "97462eb46cd123e7c15b2ea89724dac1", "score": "0.7378471", "text": "def limit(limit)\n @criteria[:limit] = limit\n self\n end", "title": "" }, { "docid": "97462eb46cd123e7c15b2ea89724dac1", "score": "0.7378471", "text": "def limit(limit)\n @criteria[:limit] = limit\n self\n end", "title": "" }, { "docid": "d88d3c76fa63a8b44fd5430aa4ee413d", "score": "0.7364301", "text": "def limit(limit)\n limit_options[:offset] ||= 0\n limit_options[:limit] = limit.to_i\n self\n end", "title": "" }, { "docid": "da2f95ce361aaeb84a72818d67998df5", "score": "0.7348887", "text": "def limit(n)\n\t Query.new(self).limit(n)\n\t end", "title": "" }, { "docid": "6bab5151e4f4c4fa43820fa1d6cef38a", "score": "0.73483914", "text": "def limit\n return 0 if just_count?\n limit = if list?\n @params[:limit_per_page_for_list].to_i\n else\n @params[:limit_per_page_for_details].to_i\n end\n limit = 1 if limit < 1\n [limit, MAX_LIST_LIMIT].min\n end", "title": "" }, { "docid": "6bab5151e4f4c4fa43820fa1d6cef38a", "score": "0.73483914", "text": "def limit\n return 0 if just_count?\n limit = if list?\n @params[:limit_per_page_for_list].to_i\n else\n @params[:limit_per_page_for_details].to_i\n end\n limit = 1 if limit < 1\n [limit, MAX_LIST_LIMIT].min\n end", "title": "" }, { "docid": "8135d7eddd1122c1dc46cc8d674f8785", "score": "0.7344569", "text": "def limit(value = nil)\n option(value) do |options, query|\n val = value.to_i\n options.store(:limit, val)\n query.pipeline.push(\"$limit\" => val) if aggregating?\n end\n end", "title": "" }, { "docid": "d03e67b574d5505079bc8e92951fa3dd", "score": "0.73368514", "text": "def select_limit_sql(sql)\n l = @opts[:limit]\n o = @opts[:offset]\n if l || o\n if l\n sql << \" TOP \"\n literal_append(sql, l)\n else\n sql << \" TOP 2147483647\"\n end\n\n if o \n sql << \" START AT (\"\n literal_append(sql, o)\n sql << \" + 1)\"\n end\n end\n end", "title": "" }, { "docid": "5d61e4b90139a16530b5a0751df13029", "score": "0.731676", "text": "def limit(*args)\n return @limit if args.empty?\n collection_with(:limit => Integer(args.first))\n end", "title": "" }, { "docid": "05ffc8211f611ec3f508e4a67c2ce3ad", "score": "0.73141813", "text": "def limit\n @view.limit\n end", "title": "" }, { "docid": "47a30fc58d39b4e0801566b325f7d668", "score": "0.7311603", "text": "def select_limit_sql(sql)\n raise(Error, \"OFFSET not supported\") if @opts[:offset]\n if l = @opts[:limit]\n sql << \" TOP \"\n literal_append(sql, l)\n end\n end", "title": "" }, { "docid": "fd769ac0570b62d11c2b6b0caafc921f", "score": "0.73077613", "text": "def limit\n return 0 if just_count?\n limit = 1\n limit = if list?\n @params[:limit_per_page_for_list].to_i\n else\n @params[:limit_per_page_for_details].to_i\n end\n limit = 1 if limit < 1\n [limit, MAX_LIST_LIMIT].min\n end", "title": "" }, { "docid": "d85d10427f523e5e47e61387da8e85e3", "score": "0.7305766", "text": "def limit(value); end", "title": "" }, { "docid": "f504adad9a1ec189ab56ed4a7b9876ad", "score": "0.73005694", "text": "def limit(limit)\n record_limit(limit)\n end", "title": "" }, { "docid": "f504adad9a1ec189ab56ed4a7b9876ad", "score": "0.73005694", "text": "def limit(limit)\n record_limit(limit)\n end", "title": "" }, { "docid": "e2b62cfcd0439b145790f1a89ad51a30", "score": "0.72935545", "text": "def select_limit_sql(sql)\n sql << \" LIMIT #{literal(@opts[:limit])}\" if @opts[:limit]\n sql << \" OFFSET #{literal(@opts[:offset])}\" if @opts[:offset]\n end", "title": "" }, { "docid": "2f440065f91b97f6d1ad2c5f0f578b3c", "score": "0.72911096", "text": "def limit(count)\n @sql += \" LIMIT #{count}\"\n\n self\n end", "title": "" }, { "docid": "87c53ff959d4bd1ec2db7fa2ce3ad83b", "score": "0.72771746", "text": "def limit ; options.limit ; end", "title": "" }, { "docid": "cd637a096fc51a0194733d4a1aaa4f8b", "score": "0.7258634", "text": "def limit_value\n @_q_limit_value || default_per_page\n end", "title": "" }, { "docid": "563aa6c37725ac96d345da601599de06", "score": "0.72495294", "text": "def limit int\n @limit = int\n self\n end", "title": "" }, { "docid": "0477fd17ef74c812c8ec4e8cef677c40", "score": "0.7244923", "text": "def select_limit_sql(sql)\n raise(Error, \"OFFSET not supported\") if @opts[:offset]\n # if l = @opts[:limit]\n # sql << \" TOP \"\n # literal_append(sql, l)\n # end\n end", "title": "" }, { "docid": "8be793b7e606fe8c5d0aa88bb3dd1596", "score": "0.72412944", "text": "def limit_value\n case\n when search.definition[:size]\n search.definition[:size]\n else\n __default_per_page\n end\n end", "title": "" }, { "docid": "ea5e41fef1d36ff425ce35aaf91754dd", "score": "0.7237375", "text": "def _limit(max)\n @cache = evaluate_expression '$limit', max\n end", "title": "" }, { "docid": "fea2f67950de56365e3f5068d277a3df", "score": "0.72351545", "text": "def limit count\n self\n end", "title": "" }, { "docid": "a649ff21da6383a52e680c1817db2d37", "score": "0.7233031", "text": "def maximum_limit\n 100\n end", "title": "" }, { "docid": "f410c69495227ea965ca4a31a9823a9d", "score": "0.7231558", "text": "def limit(num)\n @query[:limit] = num\n self\n end", "title": "" }, { "docid": "2be3ecb3e5acb88df970bcb36e2486b1", "score": "0.7218183", "text": "def select_limit_sql(sql)\n if l = @opts[:limit]\n return if is_2012_or_later? && @opts[:order] && @opts[:offset]\n shared_limit_sql(sql, l)\n end\n end", "title": "" }, { "docid": "92f44d10081fbacd234c4bd5a5067f38", "score": "0.7217963", "text": "def limit(*params)\n client.limit(*params)\n end", "title": "" }, { "docid": "4f73ad49ac92fa7f8ff93937185e3452", "score": "0.72098696", "text": "def limit_value\n case\n when search.definition[:size]\n search.definition[:size]\n else\n __default_per_page\n end\n end", "title": "" }, { "docid": "2a2e26074361ccec45f2d5901b4373a1", "score": "0.720505", "text": "def limit_sql(sql)\n if l = @opts[:limit]\n sql << \" LIMIT \"\n literal_append(sql, l)\n end\n end", "title": "" }, { "docid": "3bc73455efbf4498305395b9e837bd36", "score": "0.7202426", "text": "def limit(limit)\r\n @limit = limit\r\n return self\r\n end", "title": "" }, { "docid": "a5d256d6d33b503025cd4729be855c4e", "score": "0.71950847", "text": "def limit(limit = nil)\n configure(:limit, limit)\n end", "title": "" }, { "docid": "c9b50bd5421e813fde81605c4a2e31e1", "score": "0.7193079", "text": "def limit(num)\n @cached_exec = nil\n\n criteria[:limit] = num\n self\n end", "title": "" }, { "docid": "360038cbc761ae46a967a148dc84c9cc", "score": "0.7193069", "text": "def select_limit_sql(sql)\n return unless @opts[:from]\n l = @opts[:limit]\n o = @opts[:offset]\n if l || o\n sql << \" LIMIT \"\n if o\n literal_append(sql, o)\n if l\n sql << ', '\n literal_append(sql, l)\n else\n # Hope you don't have more than 2**32 + offset rows in your dataset\n sql << \",4294967295\"\n end\n else\n literal_append(sql, l)\n end\n end\n end", "title": "" }, { "docid": "4d2edbe306a863a6193f4faab38299d1", "score": "0.71871877", "text": "def limit(n)\n Query.new(self).limit(n)\n end", "title": "" }, { "docid": "9e775fcc34f094801fd390376ced2adb", "score": "0.71476763", "text": "def limit_clause_for_count\n case limit\n when :none then \"\"\n else \" LIMIT #{limit}\"\n end\n end", "title": "" }, { "docid": "4a82e9b48101619eff08e16731ab61e7", "score": "0.71434814", "text": "def limit(limit)\n Operation::Limit.new(self, limit)\n end", "title": "" }, { "docid": "966f1601558319628ad9b67a1ada9143", "score": "0.7140387", "text": "def record_limit( fallback = 0, max = nil )\n i = params[:limit].try(:to_i) || fallback\n i = i > max ? max : i if max\n i > 0 ? i : fallback\n end", "title": "" }, { "docid": "0c0f3b8c0817224d88a37d6c900253f5", "score": "0.71326065", "text": "def limit(value)\n @limit = value\n end", "title": "" }, { "docid": "73f9869721205871b5105598b9d15d58", "score": "0.71192735", "text": "def pager_limit(limit = 10)\n @scope[\"pager_limit\"] = limit\n offset = request.fetch(PAGER_PARAM, \"0\")\n return \"LIMIT #{limit+1} OFFSET #{offset}\"\n end", "title": "" }, { "docid": "16085955242b9dc54d455a56718f3eaf", "score": "0.7115059", "text": "def add_filter_for_limit(q, limit)\n q.limit(limit)\n end", "title": "" }, { "docid": "10547604a1767f16ad28cdb21a9afb43", "score": "0.70997554", "text": "def select_limit_sql(sql)\n if o = @opts[:offset]\n sql << \" OFFSET \"\n literal_append(sql, o)\n sql << \" ROWS\"\n end\n if l = @opts[:limit]\n sql << \" FETCH FIRST \"\n literal_append(sql, l)\n sql << \" ROWS ONLY\"\n end\n end", "title": "" }, { "docid": "5ffc3d67756f15f19b64c3c9f6edfbb6", "score": "0.709774", "text": "def limit(value = nil); end", "title": "" }, { "docid": "b20e86fd747e747d3ff17c13d82513b2", "score": "0.7083765", "text": "def limit(value)\n merge(drlimit: value.to_s)\n end", "title": "" }, { "docid": "952daed4509f29431c4a038de4029c38", "score": "0.70821154", "text": "def limit=(value)\n @limit = value\n end", "title": "" }, { "docid": "9136569cbc2c93cf61e5da5d23e28b0c", "score": "0.7081654", "text": "def calculate_limit\r\n limit = 100\r\n limit = 8000 if @options[:results].present? || @options[:days].present? || @options[:start].present? || @options[:end].present?\r\n limit = @options[:results].to_i if (@options[:results].present? && @options[:results].to_i < 8000)\r\n return limit\r\n end", "title": "" } ]
73339376842edc3016d5c603cd331944
Same as +can_do+ mathod, but returns a string name of the CSS class to enable or disable a rendered item according to the currrent user access grants. (Usually, 'disabled' for no access/don't perform, and +nil+ otherwise)
[ { "docid": "80e6a93a31012ef628c5c8fe65207e65", "score": "0.7199838", "text": "def get_css_class_to_do( ctrl_name, action_name = 'index' )\n if can_do( ctrl_name, action_name )\n nil\n else\n 'disabled'\n end\n end", "title": "" } ]
[ { "docid": "5dcd06b7d0bededaadce740ee9ffaffe", "score": "0.68667305", "text": "def get_css_class_to_access( ctrl_name )\n if can_access( ctrl_name )\n nil\n else\n 'disabled'\n end\n end", "title": "" }, { "docid": "5d1e7cd6ff77f1cca6d1b6d4d50595f8", "score": "0.59696114", "text": "def type_for_user_role\n current_user.admin? ? :text : :hidden\n end", "title": "" }, { "docid": "43e260f8e23b17f4253a9a9bc5fc0d5f", "score": "0.59667474", "text": "def check_access usr\n access?(usr) ? UserType.active : UserType.unhidden\n end", "title": "" }, { "docid": "21042b9e6ca3c70cd8197213bc67a504", "score": "0.59273237", "text": "def action_allowed?\n ['Super-Administrator',\n 'Administrator',\n 'Instructor',\n 'Teaching Assistant'].include? current_role_name\n end", "title": "" }, { "docid": "b376fc67ea1a672abe03572c303f18d8", "score": "0.5891055", "text": "def check_if_user_can_perform_action_on_user\n case params[:action]\n when 'edit'\n not_allowed if typus_user.is_not_root? && (typus_user != @item)\n when 'update'\n user_profile = (typus_user.is_root? || typus_user.is_not_root?) && (typus_user == @item) && !(@item.role == params[@object_name][:role])\n other_user = typus_user.is_not_root? && !(typus_user == @item)\n not_allowed if (user_profile || other_user)\n when 'toggle', 'destroy'\n root = typus_user.is_root? && (typus_user == @item)\n user = typus_user.is_not_root?\n not_allowed if (root || user)\n end\n end", "title": "" }, { "docid": "5c28c5a58a78aa943200ae10296577ed", "score": "0.5859234", "text": "def show_access\n if !@user\n return LOGGED_OUT_RESULT\n elsif effective_sysadmin?(@user, @role_limit)\n return AUTHORIZED_RESULT\n elsif @ctx_institution != @item.institution\n return WRONG_SCOPE_RESULT\n elsif @user\n @item.collections.each do |collection|\n # collection admins can see access of items within their collections\n return AUTHORIZED_RESULT if (@role_limit >= Role::COLLECTION_ADMINISTRATOR) &&\n @user.effective_collection_admin?(collection)\n # unit admins can see access of items within their units\n collection.units.each do |unit|\n return AUTHORIZED_RESULT if (@role_limit >= Role::UNIT_ADMINISTRATOR) &&\n @user.effective_unit_admin?(unit)\n end\n end\n end\n { authorized: false,\n reason: \"You must be an administrator of one of the collections or \"\\\n \"units in which this item resides.\" }\n end", "title": "" }, { "docid": "135946c0b2045acf1620841a5ad8c7be", "score": "0.58562857", "text": "def permit_user_to_access_admin user\n user &&\n (!user.respond_to?( :active? ) || user.active?) &&\n (!user.respond_to?( :enabled? ) || user.enabled?) &&\n (!user.respond_to?( :disabled? ) || !user.disabled?) &&\n (!user.respond_to?( :admin? ) || user.admin?)\n end", "title": "" }, { "docid": "2ec14223cf290c6061dd638770c080bd", "score": "0.58365655", "text": "def can_be_modified_by?( user )\n return false if ( user.restricted? )\n return true if ( user.admin? )\n return self.active\n end", "title": "" }, { "docid": "b0695aaa31586de17ddd5e9a8b060e7b", "score": "0.5822939", "text": "def permission_to_user(another_user, action = :activate)\n return 0 if another_user.nil?\n if owned_by_user?(another_user)\n if manageable_by_user?(another_user, action)\n return ::Users::Permission::EditItem | ::Users::Permission::ManageItem\n else\n return ::Users::Permission::EditItem\n end\n else\n 0\n end\n end", "title": "" }, { "docid": "3b3c67258a8495ad3d40392a8d49149e", "score": "0.5818637", "text": "def access_level\n if has_system?\n 'system'\n elsif has_admin?\n 'admin'\n elsif has_editor?\n 'editor'\n elsif has_registered?\n 'registered'\n elsif has_read_only?\n 'read_only'\n end\n end", "title": "" }, { "docid": "bd5af914d496012354af1fdb35a1def8", "score": "0.5813664", "text": "def granted_to(action, item)\n case action\n when :create\n # item may nil if action is :create\n return false unless logged_in?\n return true if permit? 'developer'\n when :show\n return true\n when :update\n return false unless logged_in?\n return true if permit? 'superadmin | developer'\n when :destroy\n return false unless logged_in?\n return false unless item.can_destroyed?\n return true if permit? 'developer'\n end\n # otherwise prevent action\n return false\n end", "title": "" }, { "docid": "bb9b2462cadd81560ef6bf08808dd351", "score": "0.58104706", "text": "def current_user_can(access_types)\n current_user.id == @list.user_id || access_types.include?(current_user.access_to_list(@list))\n end", "title": "" }, { "docid": "03187839343d3d525d88262826e32600", "score": "0.57928467", "text": "def user_can_perform_any_action?\n current_ability.can?(:edit, id) || current_ability.can?(:destroy, id) || current_ability.can?(:download, id)\n end", "title": "" }, { "docid": "c802df1c9c2b571c3116ff93787b1cf3", "score": "0.5779792", "text": "def action_allowed?\n ['Student',\n 'Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end", "title": "" }, { "docid": "be5657140c78196bd44444d4477c0047", "score": "0.5752981", "text": "def check_if_user_can_perform_action_on_resources\n if @item.is_a?(Typus.user_class)\n check_if_user_can_perform_action_on_user\n elsif typus_user.cannot?(params[:action], @resource.model_name)\n not_allowed\n end\n end", "title": "" }, { "docid": "dca3d4d9ace75774105d7b2a2556d1c4", "score": "0.5744557", "text": "def user_only\n return true if logged_in?\n access_denied\n end", "title": "" }, { "docid": "ff09722dfba77f9bdf7c8c0f12ff8edc", "score": "0.57421046", "text": "def allowed_view?\n current_user.send(\"#{controller}?\") && @resource == current_user.role\n end", "title": "" }, { "docid": "a4a1606acb451f3df2ab16641a6f57c1", "score": "0.57179093", "text": "def admin_required\n current_user && current_user.admin? ? true : access_denied\n end", "title": "" }, { "docid": "5348e932eb09cb464cbdefbdf8bd6ab9", "score": "0.5714435", "text": "def users_only\n logged_in? || access_denied\n end", "title": "" }, { "docid": "8017124dbe63f83f15afe6ac46c4650e", "score": "0.57139117", "text": "def role_require\n admin_or_moderator = current_user.has_role?(:system, :administrator) || current_user.has_role?(:moderator, controller_name)\n access_denied unless current_user.has_role?(controller_name, action_name) || admin_or_moderator\n end", "title": "" }, { "docid": "0eb7588f7be75cf1a5cd8f4337005d41", "score": "0.57089233", "text": "def only_can_read bit; raise ParkPlace::AccessDenied unless bit.readable_by? @user end", "title": "" }, { "docid": "8a24bb6ca679f3d69a0345f283783c76", "score": "0.56985736", "text": "def action_allowed?\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator'].include? current_role_name\n end", "title": "" }, { "docid": "65cf2c302342eddc3dea887b3e2cad89", "score": "0.56915325", "text": "def forbid\n if not current_user.is_admin and not @object.can_manage_content?(current_user.roles params[:id])\n render :status=> :forbidden, :text =>'forbidden'\n return\n end\n end", "title": "" }, { "docid": "a49e159f75b27d62bf6e24e21f82244f", "score": "0.56869525", "text": "def is_moderated?\n self.protected\n end", "title": "" }, { "docid": "cfbbe1568b79d9a95b8538b66b456fbb", "score": "0.56734914", "text": "def check_if_user_can_perform_action_on_user\n\n return unless Typus.authentication.eql?(:session)\n\n return unless @item.kind_of?(Typus.user_class)\n\n current_user = (@current_user == @item)\n\n message = case params[:action]\n when 'edit'\n\n # Only admin and owner of Typus User can edit.\n if @current_user.is_not_root? && !current_user\n _(\"As you're not the admin or the owner of this record you cannot edit it.\")\n end\n\n when 'update'\n\n # current_user cannot change her role.\n if current_user && !(@item.role == params[@object_name][:role])\n _(\"You can't change your role.\")\n end\n\n when 'toggle'\n\n # Only admin can toggle typus user status, but not herself.\n if @current_user.is_root? && current_user\n _(\"You can't toggle your status.\")\n elsif @current_user.is_not_root?\n _(\"You're not allowed to toggle status.\")\n end\n\n when 'destroy'\n\n # Admin can remove anything except herself.\n if @current_user.is_root? && current_user\n _(\"You can't remove yourself.\")\n elsif @current_user.is_not_root?\n _(\"You're not allowed to remove Typus Users.\")\n end\n\n end\n\n if message\n flash[:notice] = message\n redirect_to set_path\n end\n\n end", "title": "" }, { "docid": "cfeba7c0094060e3f29baa37d7587cb1", "score": "0.56636196", "text": "def restricted_link_to(txt, path, section, opt = {})\n unless current_user.access?(section)\n opt[:class] = opt[:class].to_s << ' disabled'\n end\n\n link_to(txt, path, opt)\n end", "title": "" }, { "docid": "759571539fb1b6bf92d3dbb71cc81e0d", "score": "0.56557536", "text": "def admin_required \r\n admin_user? || access_denied(debates_path)\r\n end", "title": "" }, { "docid": "9e3c681615af65954f4109632590620c", "score": "0.5651846", "text": "def can_edit(item, user)\n if logged_in? && (user.is_admin || user.id == item.user.id)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "9798cd3d1321a00bd6f8069b6762f791", "score": "0.5651057", "text": "def check_access\n render_no_permission unless @sir_log.user_is_owner_or_deputy?( current_user.id )\n end", "title": "" }, { "docid": "5cae7c73357179abd352df8f0569e97b", "score": "0.5648234", "text": "def method_missing(name, *args)\n if name.to_s.starts_with?('may_')\n resource = args[0]\n if resource.respond_to?(:allows?)\n resource.send(:allows?, name.to_s.sub(/may_/, '').to_sym, current_user)\n elsif current_user.respond_to?(name)\n current_user.send(name)\n end\n else\n super\n end\n end", "title": "" }, { "docid": "6b749e61a4096b87604b66a215a3cfeb", "score": "0.56445557", "text": "def can_i_view? attr\n if current_user.cid == @user.uid || current_user.admin?\n return true\n end\n !priv_attrs.include?(attr)\n end", "title": "" }, { "docid": "85f45784b35b938fcab61f6a4c79fd71", "score": "0.56363744", "text": "def visible_for?(user)\n can_view_page = (\n if menuable.kind_of?(Effective::Page)\n menuable.roles_permit?(user)\n else\n true\n end\n )\n\n can_view_menu_item = (\n if roles_mask == nil\n true\n elsif roles_mask == -1 # Am I logged out?\n user.blank?\n elsif roles_mask == 0 # Am I logged in?\n user.present?\n else\n roles_permit?(user)\n end\n )\n\n can_view_page && can_view_menu_item\n end", "title": "" }, { "docid": "bae5e28695e84873a11fee80cdbd4cd1", "score": "0.56180716", "text": "def can_edit? user\n user.try(\"is_admin?\") || user.try(\"is_a_moderator?\") || instructed_by?(user)\n end", "title": "" }, { "docid": "75f219a1e807e833facd137800058cd5", "score": "0.56076735", "text": "def rights\n case access_rights\n when public_visibility\n \"Public\"\n else\n \"Restricted\"\n end\n end", "title": "" }, { "docid": "6a8b284bd6833fce8603f451687a4b87", "score": "0.56022805", "text": "def authorized?\n %w(new create plans canceled thanks).include?(self.action_name) || \n ((self.action_name == 'dashboard') && current_user) ||\n admin?\n end", "title": "" }, { "docid": "50dbf68bcfca881f3651c06a25780cb0", "score": "0.5598813", "text": "def ensure_moderator\n if ensure_usertype == 'normal' or ensure_usertype == 'banned' or ensure_usertype == 'administrator'\n render :nothing => true, :status => :forbidden\n end\n end", "title": "" }, { "docid": "8a9ea1eb824a128b7b85bc1cf373c503", "score": "0.55937225", "text": "def managed_access\n # OVERRIDE: Change check for manage access from :edit to :destroy\n if current_ability.can?(:destroy, solr_document)\n return I18n.t('hyrax.dashboard.my.collection_list.managed_access.manage')\n end\n # OVERRIDE: Add label for Edit access\n if current_ability.can?(:edit, solr_document)\n return I18n.t('hyrax.dashboard.my.collection_list.managed_access.edit')\n end\n if current_ability.can?(:deposit, solr_document)\n return I18n.t('hyrax.dashboard.my.collection_list.managed_access.deposit')\n end\n if current_ability.can?(:read, solr_document)\n return I18n.t('hyrax.dashboard.my.collection_list.managed_access.view')\n end\n ''\n end", "title": "" }, { "docid": "21ce089d435681974e34af245af26fae", "score": "0.5584254", "text": "def list_item_class\n if can? :manage, load\n case load.state\n when \"dirty\"\n \"load list-group-item list-group-item-danger clearfix\"\n when \"in_washer\"\n \"object list-group-item list-group-item-info clearfix\"\n when \"washed\"\n \"object list-group-item list-group-item-warning clearfix\"\n when \"wet\"\n \"object list-group-item list-group-item-warning clearfix\"\n when \"in_dryer\"\n \"object list-group-item list-group-item-success clearfix\"\n when \"dried\"\n \"object list-group-item list-group-item-success clearfix\"\n\n when \"clean\"\n \"object list-group-item list-group-item-success clearfix\"\n\n else\n \"object list-group-item disabled clearfix\"\n end\n end\n end", "title": "" }, { "docid": "a1526feb46109aa5147b3acd39647265", "score": "0.55812275", "text": "def user_can_do? resource, action, target = nil, attr = nil\n attr = nil if attr == ''\n target = nil if target == ''\n\n if _user_can_do?('*') == true\n return true\n end\n\n target = ':self' if resource == 'user' && (target == user || target.to_s == user.id.to_s)\n\n $stderr.puts \" resource = #{resource.inspect}\"\n $stderr.puts \" action = #{action.inspect}\"\n $stderr.puts \" target = #{target.inspect}\"\n $stderr.puts \" attr = #{attr.inspect}\"\n\n if _user_can_do_?(resource, action, target, attr) == false\n return false\n end\n\n case action\n when 'index'\n case\n when ! (x = user_can_do?(resource, 'list', target, attr)).nil?\n x\n else\n _user_can_do_?(resource, action, target, attr)\n end\n\n when 'create'\n case\n when ! (x = user_can_do?(resource, 'new', target, attr)).nil?\n x\n else\n _user_can_do_?(resource, action, target, attr)\n end\n\n when 'update'\n case\n when ! (x = user_can_do?(resource, 'edit', target, attr)).nil?\n x\n else\n _user_can_do_?(resource, action, target, attr)\n end\n\n when 'edit'\n case\n # If show is not allowed, don't allow edit.\n when user_can_do?(resource, 'show', target, attr) == false\n false\n else\n _user_can_do_?(resource, action, target, attr)\n end\n\n else\n _user_can_do_?(resource, action, target, attr)\n end\n end", "title": "" }, { "docid": "09ca73e577e476281e4340d105258273", "score": "0.55780536", "text": "def with_admin_css_class_if_needed(user, current_classes = [])\n user&.admin? ? (current_classes << admin_css_class) : current_classes\n end", "title": "" }, { "docid": "c3b1a50237451210ac644f61a91c8ba3", "score": "0.5577757", "text": "def can_access?(authorizable); true end", "title": "" }, { "docid": "54162c7f3529e0c01114a77678b97b33", "score": "0.5576818", "text": "def can_user_do?(user, action, dID)\n\t\t\tif USER_ACTIONS.include?(action)\n\t\t\t\traise ArgumentError.new('dID must be a fixnum') unless dID.is_a?(Fixnum)\n\t\t\t\treturn @db.fetch(:count, CAN_USER_PERFORM_ACTION, user.id, dID) == 0\n\t\t\telsif ADMIN_ACTIONS.include?(action)\n\t\t\t\treturn user.admin\n\t\t\telse\n\t\t\t\traise ArgumentError.new(\"Invalid action (#{action})\")\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "4577be018e23be77bbd484bc74e8497a", "score": "0.5575921", "text": "def cando\n role.try(:capability).try(:can)\n end", "title": "" }, { "docid": "078b09a5ef41c0b53c1cb99735f96aaa", "score": "0.5571972", "text": "def visible_to?(user)\n approved? || user.try(:admin?) || user == self.user\n end", "title": "" }, { "docid": "36c123be0c53503274747c2f7f536a30", "score": "0.55657107", "text": "def can_edit? user\n user and user.is_a_moderator?\n end", "title": "" }, { "docid": "997c4aa04b57dfc7a7e753399a0bb2cd", "score": "0.55635357", "text": "def current_item_enabled?; enable?(item); end", "title": "" }, { "docid": "10d20269004f3fcd2a0d28f007244353", "score": "0.5560803", "text": "def edit?\n user.has_role? :site_admin or user.has_role? :can_edit_category\n end", "title": "" }, { "docid": "39c296a5177f2770a07cf3795a6f9a5e", "score": "0.5556044", "text": "def is_admin?\n if current_trader.admin?\n true\n else\n render :text => \"Not allowed\"\n end\n end", "title": "" }, { "docid": "f81c49bba5c36db0daefe394216a891f", "score": "0.5550102", "text": "def admin_required\n \tif @user != nil\n\t\treturn true if @user.name == 'chadc'\n\tend\n\taccess_denied\n\treturn false\n end", "title": "" }, { "docid": "4bac10bb612b60849f9f92d7a053c63f", "score": "0.5549047", "text": "def can_edit?(user)\n is_admin?(user)\n end", "title": "" }, { "docid": "f0fde79c05ae154e55ca6ccf98630750", "score": "0.5546707", "text": "def only_can_write bit; raise ParkPlace::AccessDenied unless bit.writable_by? @user end", "title": "" }, { "docid": "e3e8fdbeac14bcce5340fe9afc7e6c87", "score": "0.5543451", "text": "def require_permission?\n #~ ToDo: Add setting to specify if the screen neeed to check User/Role permission\n self.name != 'Report Requests'\n end", "title": "" }, { "docid": "99c91e914a1195318df48d23027b69db", "score": "0.55398136", "text": "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_cost_entries, project)) || usr.allowed_to?(:edit_cost_entries, project)\n end", "title": "" }, { "docid": "667523a5f48be725fe978567b340596e", "score": "0.5534321", "text": "def editable_by?(someone, something)\n someone.administrator?\n end", "title": "" }, { "docid": "bab7da89e2b36797d1e29a7c95fd6808", "score": "0.5533831", "text": "def current_user_can_edit(user)\n return false unless current_user\n\n user == current_user || current_user.admin?\n end", "title": "" }, { "docid": "cf8191108cd1edc01d20c34b73e78993", "score": "0.5532898", "text": "def can_view?(user)\n user == self.user || course.is_staff?(user) || !!(user && user.admin?)\n end", "title": "" }, { "docid": "6fa5720fc6c4ca63da269c1a8c192395", "score": "0.5530303", "text": "def user_required\n authorized? || access_denied\n end", "title": "" }, { "docid": "cc14d34bf79cfa347e24a95411fa7848", "score": "0.5527418", "text": "def card_admin_access?\n ['admin', 'staff'].include?(role)\n end", "title": "" }, { "docid": "8a3d84c65100412edd8edca3d77ec4bb", "score": "0.5526821", "text": "def admin_only\n return true if admin_user?\n admin_access_denied\n end", "title": "" }, { "docid": "1ce77d77580a7492c402dd234bb6def5", "score": "0.5526015", "text": "def can_edit?(user)\n user == self || !!(user && user.admin?)\n end", "title": "" }, { "docid": "96ded044eb1b06bb8426176e1cd58930", "score": "0.55244607", "text": "def can_edit?(current_item)\n return false unless logged_in?\n if request.path_parameters['controller'] == \"users\"\n return (current_user == current_item) \n else\n return (posting_user.id == current_item.nickname_id) \n end\n end", "title": "" }, { "docid": "e6eb346668ac119d3e3415d7a703ca86", "score": "0.55234957", "text": "def visible?(usr=nil)\n (usr || User.current).allowed_to?(:view_cm_items, self.project)\n end", "title": "" }, { "docid": "9719d75649a2c5fad0dfdf6614872987", "score": "0.5523113", "text": "def editable_by?(user)\n user == self.user || user.try(:admin?)\n end", "title": "" }, { "docid": "2706e5fa88d1f3b396a78a6723ba1e26", "score": "0.55106986", "text": "def check_if_admin_or_accessible\n if current_user.admin?\n return\n else \n ids = get_accessible_user_ids(current_user) \n if !ids.include?(params[:id])\n flash[:error] = \"You Do Not Have Permission To Access That\"\n if current_user.user?\n redirect_to tickets_path\n else\n redirect_to tickets_path\n end\n end\n end\n end", "title": "" }, { "docid": "21634846d7566c1952b834c5b13ada17", "score": "0.5509956", "text": "def admin_required\n (logged_in? && current_user.role == Role.find_by_name('Admin')) || admin_denied\n end", "title": "" }, { "docid": "eddafea6246a63120ee7688fa5ccc811", "score": "0.5508102", "text": "def can?(thing)\n return true if admin?\n # Check if user is granted the function\n return true if granted?(thing)\n # Check if user is denied the function\n return false if denied?(thing)\n # Ignore \"System Admin\" function from CSUM/CSEM users\n return false if thing.include?(\"System Admin\")\n\n roles.include?(thing)\n end", "title": "" }, { "docid": "ed7865d908ebb8193657e1bdee3e0e4e", "score": "0.5507092", "text": "def current_user_can_edit(user)\n return false unless current_user\n user == current_user || current_user.admin?\n end", "title": "" }, { "docid": "ba737c2c9733869a514bb72a99047a64", "score": "0.5502068", "text": "def user_can?(user, action)\n true\n end", "title": "" }, { "docid": "49a7d9de64769f45432342381be36313", "score": "0.5493193", "text": "def access(access_role='deactivated')\r\n ROLES.index(role) >= ROLES.index(access_role)\r\n end", "title": "" }, { "docid": "6ac1e3e368e8b28bb37a6b09b56481e0", "score": "0.5492187", "text": "def authorized?\n\n return false unless current_user\n\n %w{ show index tree }.include?(action_name) || current_user.is_admin?\n end", "title": "" }, { "docid": "ac161dcfd10f2a16dd4cbc89a15840ec", "score": "0.5490736", "text": "def divider_access\n\t\tauthenticate_moderator! unless moderator_signed_in? || controller_name == \"guest_pages\" || legaly_actions.include?(action_name)\n\tend", "title": "" }, { "docid": "163723036376ad9e73b3b778bb25d923", "score": "0.54893285", "text": "def ensure_administrator\n if ensure_usertype == 'normal' or ensure_usertype == 'banned' or ensure_usertype == 'moderator'\n render :nothing => true, :status => :forbidden\n end\n end", "title": "" }, { "docid": "57400d4145eb81eb58f533e22bb24ff7", "score": "0.5487233", "text": "def can_edit?(user)\n return user == self.user || user.has_role?(:admin)\n end", "title": "" }, { "docid": "d83ef892b23d55c70119006090add657", "score": "0.54736227", "text": "def edit_allowed?\n User.current.can?(:manage_wikis, :manage_roles)\n end", "title": "" }, { "docid": "39872b9311bdd73124adf5ab2c36722a", "score": "0.5473326", "text": "def may_access?\n\t\tret=!self.role.nil? && !self.group.nil? && !self.project.nil?\n\t\t#puts \"User.may_access?:#{ret}\"\n\t\tret\n\tend", "title": "" }, { "docid": "893ca676731624097855b89a30ce4ce4", "score": "0.547122", "text": "def show\n if signed_in? && current_user.role_id == 2\n else\n restricted_access\n end\n end", "title": "" }, { "docid": "fd34bdae846692476c89a1957b60ad5e", "score": "0.54707813", "text": "def view_authorized(current_user)\n return self.public? || self.edit_authorized(current_user)\n end", "title": "" }, { "docid": "a79474ec78ad2247191ae9c732d461bd", "score": "0.5469246", "text": "def is_admin_user\n if current_user != :false\n if current_user.role == \"Admin\"\n return true\n else\n access_denied\n end\n else\n access_denied\n end\n end", "title": "" }, { "docid": "93d7c79161a62caa4441d4b2800de7de", "score": "0.54692304", "text": "def is_authorized_for(user, group=nil, action=Permissions::View)\n invisible? ? [] : accessors.allowed_action(user, group, action)\n end", "title": "" }, { "docid": "d739e042777123b80c6baf9a0b0c6f1e", "score": "0.5468045", "text": "def can_edit? user\n user and user.is_admin?\n end", "title": "" }, { "docid": "80dfa6026937f6ff79d2e416efaaa383", "score": "0.54662925", "text": "def show?\n @current_user.permission('FrameworkTender', :guest) \n end", "title": "" }, { "docid": "8b86e7c3855592991de008c9644f4803", "score": "0.54633963", "text": "def so_user_check\n if current_user.present? and current_user.role == :SO\n @forbidden = Forbidden.find(params[:id])\n end\n end", "title": "" }, { "docid": "bb8358d2a0aae4d31d3f5e54dd015521", "score": "0.5461402", "text": "def self_or_admin_only\n if site_user.id.to_s == params[:id].to_s or site_user.admin == true\n return true\n else\n flash[:error] = \"You are not authorized to take this action.\"\n redirect_to :action => 'index', :controller => 'faculty'\n return false\n end\n end", "title": "" }, { "docid": "73fcbc64199327b7eaae01e519ebdbe9", "score": "0.5458378", "text": "def render_admin_only\n render_unauthorized(msg=\"You must be Admin to perform this operation\")\n end", "title": "" }, { "docid": "17696c62cf4f04f3d24e911f52312163", "score": "0.54564565", "text": "def is_restricted?\n return true if self.class._cn_excluded.nil?\n return false if self.class._cn_excluded == :all\n return !(self.class._cn_excluded.include? action_name.to_sym)\n end", "title": "" }, { "docid": "7ff9c7997a378b50c3b7a342a0724196", "score": "0.54562026", "text": "def can_edit_user?(user)\n administrator? or (self == user)\n end", "title": "" }, { "docid": "bb6253ab871820524d81706fca22aec7", "score": "0.5451149", "text": "def admin\n current_user.admin? ? true : access_denied\n end", "title": "" }, { "docid": "5534a4358579ae7a0587d79a2c86e89e", "score": "0.5449352", "text": "def can_edit?(user)\n self.user == user || !!(user && user.admin?)\n end", "title": "" }, { "docid": "fe091150f376da0d1b6a8ca7407eb73c", "score": "0.54477394", "text": "def visible(current_user=User.current_user)\n if current_user.is_a?(Admin) || (current_user.is_a?(User) && current_user.is_author_of?(self))\n return self\n elsif current_user == :false || !current_user\n return self unless self.restricted || self.hidden_by_admin\n elsif (!self.hidden_by_admin && !self.posted_works.empty?)\n return self\n end\n end", "title": "" }, { "docid": "d589784ff97efd71f864cbda9981189e", "score": "0.54375905", "text": "def require_admin\n require_login unless current_user\n restrict_access unless current_user.is_admin\n end", "title": "" }, { "docid": "f3f800fbe2cf63f8b85d3a4fee0409df", "score": "0.5434659", "text": "def can_edit(item)\n if item.owner?(current_user) || admin_or_moderator?\n yield\n else\n render :partial => 'items/cannot_edit', :layout => true\n end\n end", "title": "" }, { "docid": "f0f1da7d159495eff1d856fb323e19f6", "score": "0.5433614", "text": "def custom_permissions\n if current_user.groups.include? :admin.to_s\n can [:discover, :read, :edit], AdministrativeCollection\n can [:discover, :read, :edit], Collection\n can [:discover, :read, :edit], GenericFile\n can [:download], FileContentDatastream\n can [:destroy], ActiveFedora::Base\n end\n end", "title": "" }, { "docid": "7e1213a144d0e487a4f0c2f4416a33be", "score": "0.54301673", "text": "def can_edit\n unless current_user.is_admin? || @circus.belongs_to_user?(current_user)\n flash[:danger] = \"You do not have permission to do that!\"\n redirect_to circuses_path\n end\n end", "title": "" }, { "docid": "6ed1c29affa731e2a6c1c92afd2b0bde", "score": "0.5428196", "text": "def admin_access_required\n access_denied unless admin?\n end", "title": "" }, { "docid": "6ed1c29affa731e2a6c1c92afd2b0bde", "score": "0.5428196", "text": "def admin_access_required\n access_denied unless admin?\n end", "title": "" }, { "docid": "6ed1c29affa731e2a6c1c92afd2b0bde", "score": "0.5428196", "text": "def admin_access_required\n access_denied unless admin?\n end", "title": "" }, { "docid": "3a9a8a72f8474ba1d3644383deb74c6f", "score": "0.5427502", "text": "def render_access_denied\n render_error_data :message => 'Admin access only.', :reason => :denied\n false\n end", "title": "" }, { "docid": "244386c7a08b6ed6a993ca48d6e2d519", "score": "0.5427201", "text": "def access(write)\n write ? \"read/write\" : \"read only\"\nend", "title": "" }, { "docid": "accce12fe82830e075cd134578ef4627", "score": "0.5427158", "text": "def act_as_administrator(user, **)\n can :manage, :all\n cannot :show_current, Org\n cannot :edit_current, Org\n cannot :list_org, :all\n end", "title": "" }, { "docid": "c08e7d916439b7df5f56a69eedbd0562", "score": "0.54241645", "text": "def not_logged_in_required\n !logged_in? || permission_denied\n end", "title": "" } ]
cbc69b864b268ea67d2d13267c36edb3
Add a logger to the MultiLogger and adjust its level to the MultiLogger's current level.
[ { "docid": "ef13c771065ce268bb67f346cf1dfec3", "score": "0.7768799", "text": "def add_logger(logger)\n logger.level = level\n @loggers << logger\n end", "title": "" } ]
[ { "docid": "7f2cde947fcc0adbcb4d1d9b479f4c74", "score": "0.71602935", "text": "def add_logger(logger)\n\t start_logging\n\t @loggers << logger\n\tend", "title": "" }, { "docid": "a740543c9e9a98e19f4ab4bd5fb22bd9", "score": "0.71110916", "text": "def add_logger(logger)\n @loggers << logger\n end", "title": "" }, { "docid": "9317927945704ceb2700056cc38d7411", "score": "0.6863323", "text": "def add_old_logger(logger)\n @old_loggers << logger\n end", "title": "" }, { "docid": "45f6dc2d94915dbd829dd8b06d98bc60", "score": "0.6714892", "text": "def change_logger(new_logger)\n raise ArgumentError,\"Logger may not be nil\" if new_logger.nil?\n @@logger = new_logger\n @@logger.level = @log_level if defined?(@log_level) && @log_level\n end", "title": "" }, { "docid": "a65a1116c206b166e1579808706ed2f9", "score": "0.6662051", "text": "def additional_logger=(logger)\n @additional_logger = logger || ::Logger.new(nil)\n end", "title": "" }, { "docid": "f149a665563e0557fd607982fdfaac20", "score": "0.65573937", "text": "def level(level, logger_name)\n loggers[logger_name].level = level\n end", "title": "" }, { "docid": "e864112da429c1c7223bf0123ec32393", "score": "0.6539454", "text": "def logger=(new_logger)\n @logger = new_logger\n end", "title": "" }, { "docid": "05dd6d72ab30710b284059a287533c9a", "score": "0.6515532", "text": "def attach(logger)\n logger.token = @loggers.first.token rescue nil\n @loggers << logger\n end", "title": "" }, { "docid": "fd983097bed2a70cf4675b0751e4a926", "score": "0.64511985", "text": "def attach_to(logger)\n logger.extend ActiveSupport::Logger.broadcast(ActiveSupport::Logger.new(self))\n end", "title": "" }, { "docid": "c2cfae42e37fc9be1bafacf7a2c3f4fe", "score": "0.644594", "text": "def setup_log\n return unless @logger.is_a? MultiLogger\n\n @logger.add_output_path logfile_path\n @logger.add_output_path repo_logfile_path\n end", "title": "" }, { "docid": "60abc90cc3637da61c15d2eabc432304", "score": "0.63923067", "text": "def register_logger\n if registered?(:logger)\n self\n elsif config.logger\n register(:logger, config.logger)\n else\n config.logger = config.logger_class.new(log_file_path)\n config.logger.level = log_level\n\n register(:logger, config.logger)\n self\n end\n end", "title": "" }, { "docid": "d40ed145dbd6d7877fe61919e132ee04", "score": "0.63795125", "text": "def logger=(value)\n @logger = value\n @logger.class.class_eval { include LoggerEnhancement }\n end", "title": "" }, { "docid": "7b7fb88a91431960e6c29308fc942ca7", "score": "0.63752556", "text": "def add_logger(key, logger)\n @loggers[key] = logger\n end", "title": "" }, { "docid": "08232933ccc9af1f3189f3a62f212071", "score": "0.63648546", "text": "def logger=( newlogger )\n\t\t@logger = Loggability::Logger( newlogger )\n\tend", "title": "" }, { "docid": "b1bf1c8727a4c0aeccf8dfce670e2a09", "score": "0.6363118", "text": "def logging_on(level = nil)\n @logger = default_logger if logger.is_a? NilLogger\n @logger.level = level if level\n @logger\n end", "title": "" }, { "docid": "f7ad614eb1f62bc85fbbe5cac29e68dd", "score": "0.63484585", "text": "def define_logger(logger)\n return logger if logger.respond_to?(:info)\n\n Logger.new(logger)\n end", "title": "" }, { "docid": "a054ba9e812b56260eec5f229a9b2f95", "score": "0.62797195", "text": "def level=(lvl)\n @loggers.each{|l| l.level = lvl }\n @level = lvl\n end", "title": "" }, { "docid": "6c0b35e982806da5734a42c8999bec7f", "score": "0.6209581", "text": "def log(logger = @logger, level, &msg)\n logger.call(level, &msg) if logger\n end", "title": "" }, { "docid": "19b3b3c96ac9d6b7ece08ac0b1521dff", "score": "0.6209516", "text": "def level=(level)\n loggers.values.each do |logger|\n logger.level = level\n end\n end", "title": "" }, { "docid": "02e5fac25d8c6c3ca522c582d771a42a", "score": "0.62044334", "text": "def level=(severity)\n @additional_logger.level = severity\n end", "title": "" }, { "docid": "f078474251fd91c55bab00dbf55a8f29", "score": "0.6195498", "text": "def logger=(value)\n @_logger = value\n end", "title": "" }, { "docid": "6c8d0d7e2dcd970604ff663c6fbf8225", "score": "0.61666113", "text": "def level=(level)\n @level = level\n @loggers.each { |logger| logger.level = level }\n end", "title": "" }, { "docid": "f526a33b0c181a867d56179f11ecaf70", "score": "0.6163176", "text": "def logger=(logger)\n @loggers = Array(logger)\n end", "title": "" }, { "docid": "77fef34e364b0ff17e913096b12d8fc5", "score": "0.6157981", "text": "def logger=(logger)\n @loggers = Array(logger)\n end", "title": "" }, { "docid": "77fef34e364b0ff17e913096b12d8fc5", "score": "0.6157981", "text": "def logger=(logger)\n @loggers = Array(logger)\n end", "title": "" }, { "docid": "f7e624e4ebc85e62302690e09eda183d", "score": "0.6153699", "text": "def logger=(custom_logger)\n [ :level ,\n :level= ,\n :debug ,\n :info ,\n :warn ,\n :error ,\n :fatal ,\n :unknown ,\n ].each do |method|\n if not custom_logger.respond_to?(method)\n raise ArgumentError, \"logger must respond to #{method}\"\n end\n end\n\n @logger = custom_logger\n end", "title": "" }, { "docid": "82d68b9b32fb28866ef5b54f43eae913", "score": "0.61519617", "text": "def set_logger(new_logger)\n $rnlog = new_logger\n $rnlog.info('Rastman#set_logger: done')\n end", "title": "" }, { "docid": "ef9fe9acd013dd092620145eef130389", "score": "0.6144636", "text": "def set_logger(logger)\n ActiveSupport::LogSubscriber.logger = logger\n end", "title": "" }, { "docid": "ef9fe9acd013dd092620145eef130389", "score": "0.6144636", "text": "def set_logger(logger)\n ActiveSupport::LogSubscriber.logger = logger\n end", "title": "" }, { "docid": "3f1065c330a9e7a9ee75467b6dfb9571", "score": "0.6123639", "text": "def global_logger=(logger)\n if logger.is_a?(String) || logger.is_a?(IO)\n @@global_logger = ::Logger.new(logger)\n elsif logger.is_a?(Logger)\n @@global_logger = logger\n else\n raise ArgumentError\n end\n\n @@global_logger.setup_format do |severity, timestamp, progname, msg|\n SIMPLE_FORMAT % [severity, msg]\n end\n end", "title": "" }, { "docid": "d8bdcc3ba7e419b79224381efe499b98", "score": "0.6120236", "text": "def logger=(logger)\n @loggers = Array(logger)\n end", "title": "" }, { "docid": "f2bfadd70c5939fba14e7e65fa9f8d5c", "score": "0.61115205", "text": "def add(severity, message, progname, modifiers: {}, filters: Set[], &block)\n loggers.each do |pair|\n logger_name = pair[0]\n logger = pair[1]\n next if filters.include? logger_name\n\n if modifiers.key? logger_name\n modified_message = modifiers[logger_name].call(message)\n logger.add(severity, modified_message, progname, &block)\n else\n logger.add(severity, message, progname, &block)\n end\n end\n end", "title": "" }, { "docid": "52d436d6b3709b3a899ad50e8bc72b7f", "score": "0.6088515", "text": "def define_logger(logger)\n return logger if logger.kind_of?(Logger)\n\n Logger.new(logger)\n end", "title": "" }, { "docid": "52d436d6b3709b3a899ad50e8bc72b7f", "score": "0.6088515", "text": "def define_logger(logger)\n return logger if logger.kind_of?(Logger)\n\n Logger.new(logger)\n end", "title": "" }, { "docid": "7858eff5c857e45e19425d382302ca54", "score": "0.6074377", "text": "def log_level=(level)\n return unless logger\n logger.level = level unless level.nil?\n end", "title": "" }, { "docid": "a44a4fb5c002f9f87b330153746447ab", "score": "0.6043367", "text": "def logger=(obj)\n unless obj.respond_to?(:add) and obj.method(:add).arity != 3\n raise ArgumentError, \"invalid Logger instance #{obj.inspect}\"\n end\n\n @logger = obj\n\n on_log do |level, message|\n severity = LOG_LEVELS[level] || Logger::UNKNOWN\n logger.add(severity, message.to_s, \"MQTT\")\n end\n end", "title": "" }, { "docid": "be78adc9c232ad8d8e2c798c8fcd1720", "score": "0.60315365", "text": "def switch_level(level)\n @logger.level = level\n end", "title": "" }, { "docid": "4732320c93d2d1c11f84940b8aea1696", "score": "0.60189015", "text": "def set_log_level(level)\n get_logger.level = level\n end", "title": "" }, { "docid": "21961cc752bc7b126ced3f5823299e4e", "score": "0.6013472", "text": "def log_level=(level)\n @@logger.level = level\n end", "title": "" }, { "docid": "ac928fb5c87bf5e34eef1ed7afce8969", "score": "0.6007011", "text": "def level=(level)\r\n @@mutex.synchronize{\r\n @@logger.level = level\r\n }\r\n end", "title": "" }, { "docid": "a111394bdf166ae9b460b9d0bda41f9f", "score": "0.60059464", "text": "def set(*args)\n if(LEVELS.all?{|meth| args.first.respond_to?(meth)})\n @@logger = args.first\n elsif(args.first.respond_to?(:to_s) && !args.first.to_s.empty?)\n @@logger = ::Logger.new(args.first.to_s, 'weekly')\n elsif(args.first)\n raise 'Invalid type specified for logger'\n end\n if(args.size > 1)\n @@logger.level = args[1]\n end\n end", "title": "" }, { "docid": "28530c02399c1ed86c5e7bc826ae3e5b", "score": "0.5999732", "text": "def add(severity, message = nil, progname = nil)\n if severity >= self.level\n # super logger.\n if message.nil?\n if block_given?\n message = yield\n else\n message = progname\n progname = self.progname\n end\n end\n super(severity, message, progname)\n\n # record errors (with detail) and warnings.\n if @recording_messages\n if severity >= Logger::ERROR\n @errors << [nil, :log, message]\n elsif severity == ::Logger::WARN\n @warnings << message\n end\n end\n end\n true\n end", "title": "" }, { "docid": "77c768cad3c65eeba98b95d17c10d137", "score": "0.59958047", "text": "def logger=(value)\n @logger = value\n end", "title": "" }, { "docid": "77c768cad3c65eeba98b95d17c10d137", "score": "0.59958047", "text": "def logger=(value)\n @logger = value\n end", "title": "" }, { "docid": "80732d90a1ff4f3fe7e96baa4abb8c7c", "score": "0.59913826", "text": "def log_level=(value)\n logger.level = value\n end", "title": "" }, { "docid": "f61f0f32d2ad0349e802808a72de987a", "score": "0.59907395", "text": "def set_logger(logger)\r\n @@mutex.synchronize{\r\n @@logger = logger\r\n }\r\n end", "title": "" }, { "docid": "36802ceebb71806f66bf504a36141e9e", "score": "0.5986544", "text": "def logger=(value)\n @backend = value\n @logger = create_backend\n define_level_methods\n end", "title": "" }, { "docid": "d4ea441afe847149979472e5dc706d51", "score": "0.5983308", "text": "def custom_logger(custom_logger)\n @options[:custom_logger] = custom_logger\n end", "title": "" }, { "docid": "69e3a5ed5276dd85750ffa3889297298", "score": "0.5982157", "text": "def logging=(level)\n @logger.level = level\n end", "title": "" }, { "docid": "bd6d3f4560f3ad5b9123bce565e2e46a", "score": "0.5960529", "text": "def log_level=(level)\n Manager.logger.level = level\n # TODO: forwarding to server, or unify loggers\n Tamashii::Server.logger.level = level\n end", "title": "" }, { "docid": "6e6f4f7fe9369d6226fe621c7084b8ca", "score": "0.59484625", "text": "def default_logger(logger)\n update { @logger = logger }\n end", "title": "" }, { "docid": "05643898816ecd3a018e169d6dc3193b", "score": "0.5940442", "text": "def logger=(new_logger)\n @logger = new_logger ? new_logger : Logger.new('/dev/null')\n end", "title": "" }, { "docid": "df23e95758fb4e256c16b7c2c86aeab8", "score": "0.5913225", "text": "def setup_logger\n if logger\n warn_on_custom_logger\n return logger\n end\n log = Log4r::Logger.new('goliath')\n\n log_format = Log4r::PatternFormatter.new(:pattern => \"[#{Process.pid}:%l] %d :: %m\")\n setup_file_logger(log, log_format) if @log_file\n setup_stdout_logger(log, log_format) if @log_stdout\n\n log.level = @verbose ? Log4r::DEBUG : Log4r::INFO\n log\n end", "title": "" }, { "docid": "4af46135e44110a6406011d141fd05b5", "score": "0.5910962", "text": "def set_logger(logger)\n Engines::LOGGER.set_logger(logger) # TODO: no need for Engines:: part\n end", "title": "" }, { "docid": "4f003dac5296522dcc94506a385bbc00", "score": "0.588755", "text": "def logger=(value)\n @logger = value\n @log_with_color = false\n end", "title": "" }, { "docid": "7f1d6d9a88ac14f566f69e17a14498b6", "score": "0.5883693", "text": "def logger=(value)\n @logger = value\n end", "title": "" }, { "docid": "6a126879dbd46a443b3696824cf14804", "score": "0.58740926", "text": "def logger=(logger)\n @logger = Log.set_logger(logger.new(self))\n end", "title": "" }, { "docid": "33f1a6ede02baba43af6de7ca376c258", "score": "0.5872475", "text": "def for( arg ) #:nodoc:\n new_logger = ::Logging::Logger[arg]\n new_logger.level = @options[:level]\n new_logger.additive = @options[:additive]\n new_logger.appenders = @appenders\n return new_logger\n end", "title": "" }, { "docid": "98a960fa3bb09e9dff03df5759d39544", "score": "0.5851956", "text": "def status_logger=(new_status_logger)\n @status_logger = new_status_logger ? new_status_logger : nil\n end", "title": "" }, { "docid": "9326346650588c9a1362fba06ab35211", "score": "0.58490777", "text": "def logger=(other)\n config.logger = other\n end", "title": "" }, { "docid": "7f1a6db5e3d503d2b23ac2f81933cca7", "score": "0.584591", "text": "def logger=(input)\n @@logger = input\n end", "title": "" }, { "docid": "55a95c7513ae072320ddaea4ae1171b8", "score": "0.5845698", "text": "def use_logger(level = Logger::FATAL, output = $stderr)\n Rogu.logger = create_logger(level, output)\n end", "title": "" }, { "docid": "0def649dc8652815387a4852872389fa", "score": "0.58416253", "text": "def log!(logger = nil)\n @@logger = Register.new logger\n end", "title": "" }, { "docid": "1e47217300ef0c8eedf28d429dd2bdb0", "score": "0.58343524", "text": "def add_log_method(lvl)\n arity = logger.method(:log).arity\n if arity.abs == 1\n # one single mandatory parameter, the string logged\n prefix_s = \"[#{lvl.upcase}]\"\n if prefix and not prefix.empty?\n prefix_s += \" \" + prefix\n end\n klass.define_singleton_method lvl do |*msg, &blk|\n if blk\n logger.send :log, *msg do\n str = blk.call\n \"#{prefix_s} #{str}\"\n end\n else\n logger.send :log, \"#{prefix_s} #{msg.join ' '}\"\n end\n end\n else\n # assume two or more params, best effort with 1st being level\n if lvl_s = ruby_logger_severity(lvl)\n klass.define_singleton_method lvl do |*msg, &blk|\n if blk\n logger.send :log, lvl_s, *msg, &blk\n else\n logger.send :log, lvl_s, msg.join(' ')\n end\n end\n end\n end\n end", "title": "" }, { "docid": "be1ea41e85ac5c33d063a4993f3ec95b", "score": "0.5822917", "text": "def add(severity, message = nil, progname = nil, &block)\n severity ||= Logger::UNKNOWN\n return true if severity < @level\n message = clean(message || block.call)\n SYSLOG.send LEVEL_LOGGER_MAP[severity], clean(message)\n return true\n end", "title": "" }, { "docid": "e9c046c1761fed63655bcf71b4485c8f", "score": "0.5818379", "text": "def logger=(logger)\n @logger = setup_logger(logger)\n end", "title": "" }, { "docid": "128bded5ea21e6e0bd507e7bde096624", "score": "0.5814212", "text": "def logger=(custom_logger)\n @@logger = custom_logger\n end", "title": "" }, { "docid": "372e922806d7c5df2b972d1fc765e64d", "score": "0.5812756", "text": "def setloglevel(lvl)\n\t\tprevlevel = $logger.level\n\t\tif prevlevel == $loglevels.index(lvl)\n\t\t\tinfo(\"Log level kept as #{$loglevels[prevlevel].upcase}\")\n\t\telse\n\t\t\t$logger.level = $loglevels.index(lvl)\n\t\t\tinfo(\"Log level changed from #{$loglevels[prevlevel].upcase} to #{lvl.upcase}\")\n\t\tend\n\tend", "title": "" }, { "docid": "ab318ae4cd3915bbaf408dc6bfe4d978", "score": "0.57975996", "text": "def set_level(name, level=nil)\n # Default\n if not level then\n level = name\n name = nil \n end\n\n # Look up the level if the user provided a :symbol or \"string\"\n level = MultiOutputLogger.string_to_level(level.to_s) if level.class != Fixnum\n\n if name\n # Set a specific one\n raise \"No log by the name '#{name}'\" if not @logdevs[name]\n @logdevs[name][:level] = level\n else\n # Set them all by default \n @logdevs.each{|name, logdev| logdev[:level] = level }\n end\n end", "title": "" }, { "docid": "da6ee9b197b4d6b96b7f0b66c1a26ff0", "score": "0.579291", "text": "def setup_logger(loglevel)\n\n case loglevel\n when \"debug\"\n $logger.level = Logger::DEBUG\n when \"warn\"\n $logger.level = Logger::WARN\n when \"info\"\n $logger.level = Logger::INFO\n else\n $logger.level = Logger::ERROR\n end\nend", "title": "" }, { "docid": "ee8c3f6816082c5b5b4a566f934360d2", "score": "0.578949", "text": "def logger=(logger)\n @log = logger\n end", "title": "" }, { "docid": "ea53a3abd8285eafe0ca9a2bcbc8d265", "score": "0.5775201", "text": "def logger=(logger)\n case logger\n when false, nil then @logger = nil\n when true then @logger = default_logger\n else\n @logger = logger if logger.respond_to?(:info)\n end\n end", "title": "" }, { "docid": "ea53a3abd8285eafe0ca9a2bcbc8d265", "score": "0.5775201", "text": "def logger=(logger)\n case logger\n when false, nil then @logger = nil\n when true then @logger = default_logger\n else\n @logger = logger if logger.respond_to?(:info)\n end\n end", "title": "" }, { "docid": "ea53a3abd8285eafe0ca9a2bcbc8d265", "score": "0.5775201", "text": "def logger=(logger)\n case logger\n when false, nil then @logger = nil\n when true then @logger = default_logger\n else\n @logger = logger if logger.respond_to?(:info)\n end\n end", "title": "" }, { "docid": "e1e09005f8fabcbc1fa69d3d855af5be", "score": "0.57612", "text": "def log_level=(level)\n if level #don't accept nil for an answer\n level = level.to_sym\n Loggable::LOGGER.level = level\n @log_level = log_level\n end\n level\n end", "title": "" }, { "docid": "585c4b014c79dde134d76f19636af27e", "score": "0.5758756", "text": "def set_logger(logger) # rubocop:disable Naming/AccessorMethodName\n @logger = logger\n end", "title": "" }, { "docid": "3e2a96978ff106132de07782f2739985", "score": "0.57519096", "text": "def logger=(logger)\n @log = logger\n end", "title": "" }, { "docid": "29950c8018fec8bc2ab9221b95867918", "score": "0.5748103", "text": "def logger=(logger)\n @logger = logger\n end", "title": "" }, { "docid": "29950c8018fec8bc2ab9221b95867918", "score": "0.5748103", "text": "def logger=(logger)\n @logger = logger\n end", "title": "" }, { "docid": "29950c8018fec8bc2ab9221b95867918", "score": "0.5748103", "text": "def logger=(logger)\n @logger = logger\n end", "title": "" }, { "docid": "29950c8018fec8bc2ab9221b95867918", "score": "0.5748103", "text": "def logger=(logger)\n @logger = logger\n end", "title": "" }, { "docid": "29950c8018fec8bc2ab9221b95867918", "score": "0.5748103", "text": "def logger=(logger)\n @logger = logger\n end", "title": "" }, { "docid": "43c6f4355c905a43c47d4aa732469011", "score": "0.5746598", "text": "def logger=(logger)\n @logger = logger\n @config.set('library.logger', @logger)\n end", "title": "" }, { "docid": "ac1f018b3a3af2edbf6ac0a483b6903c", "score": "0.574088", "text": "def log_level=(level)\n @log_level = level\n logger.level = @log_level\n end", "title": "" }, { "docid": "69d5d0e10874255690bbcb093e46f722", "score": "0.5740818", "text": "def logger=(logger_instance)\n @logger_instance = logger_instance\n end", "title": "" }, { "docid": "410aa8bcfb165251922c2d7addb3b6e9", "score": "0.57376", "text": "def set_logger(logger)\n @logger = logger\n end", "title": "" }, { "docid": "410aa8bcfb165251922c2d7addb3b6e9", "score": "0.57376", "text": "def set_logger(logger)\n @logger = logger\n end", "title": "" }, { "docid": "410aa8bcfb165251922c2d7addb3b6e9", "score": "0.57376", "text": "def set_logger(logger)\n @logger = logger\n end", "title": "" }, { "docid": "a36a337fa34a2484ec9d8788c62ada6f", "score": "0.5731151", "text": "def logger=(logger)\n @log = logger\n end", "title": "" }, { "docid": "a81b88bcbba57cfcce765c09a874f326", "score": "0.5722602", "text": "def logger=(logger)\n @logger = logger\n end", "title": "" }, { "docid": "a16dff43b08e3fb9e32d82f6d85d6eb9", "score": "0.5714318", "text": "def logger=(logger); @logger = logger; end", "title": "" }, { "docid": "1a3b46dce710d944e6384d5606fdb4d9", "score": "0.57123333", "text": "def set_log_level(log_level)\n\tcase log_level.downcase\n\twhen \"debug\"\n\t\t$logger.level = Logger::DEBUG\n\twhen \"info\"\n\t\t$logger.level = Logger::INFO\n\twhen \"warn\"\n\t\t$logger.level = Logger::WARN\n\twhen \"error\"\n\t\t$logger.level = Logger::ERROR\n\twhen \"fatal\"\n\t\t$logger.level = Logger::FATAL\n\telse\n\t\t$logger.level = Logger::ERROR\n\tend\nend", "title": "" }, { "docid": "d1b7cd4513434da12dcbfb7553388138", "score": "0.5711874", "text": "def log_level=(level)\n if level.is_a?(Integer)\n @logger.level = level\n else\n @logger.level = Logger.const_get(level.to_s.upcase)\n end\n end", "title": "" }, { "docid": "d1b7cd4513434da12dcbfb7553388138", "score": "0.5711874", "text": "def log_level=(level)\n if level.is_a?(Integer)\n @logger.level = level\n else\n @logger.level = Logger.const_get(level.to_s.upcase)\n end\n end", "title": "" }, { "docid": "cb90334343ed9efe6e12d07c1bf013ce", "score": "0.5709911", "text": "def logger=(logger)\n @logger = logger\n end", "title": "" }, { "docid": "d1cb843b28f8d72b1a8f0e04a0bb7c6a", "score": "0.5706671", "text": "def logger=(writer)\n @logger = LogAdapter.new(writer, (ENV[\"JEKYLL_LOG_LEVEL\"] || :info).to_sym)\n end", "title": "" }, { "docid": "641fe6cca5f6801d59d0a83922d5726d", "score": "0.56979513", "text": "def logger(logger)\n HTTPI.logger = logger\n @options[:logger] = logger\n end", "title": "" }, { "docid": "99088b2a0643413616044c5ef0202f86", "score": "0.5694859", "text": "def logger=(log)\n @logger = log\n end", "title": "" }, { "docid": "781555b6676b367ab3112a1e488605de", "score": "0.56937146", "text": "def log(priority, message, logger = @logger)\n return unless logger\n logger.send(priority, [message])\n end", "title": "" }, { "docid": "0c0cf06ad03539b178cd768e3be18e9b", "score": "0.56933993", "text": "def logger=(logger)\n @logger = logger\n end", "title": "" } ]
1855b9aa36e21ebb82af057bd50b8e51
Initialize an Entry. This will also yield itself, so an Entry can be constructed like this: entry = Entry.new do |entry| entry.title = "My Cool entry" end +o+:: An XML Reader or a Hash of attributes.
[ { "docid": "745f4286b1cc40e3127a9577cfb6dc61", "score": "0.75138927", "text": "def initialize(o = {})\n @links = Links.new\n @authors = []\n @contributors = []\n @categories = []\n \n case o\n when XML::Reader\n if current_node_is?(o, 'entry', Atom::NAMESPACE) || next_node_is?(o, 'entry', Atom::NAMESPACE)\n o.read\n parse(o)\n else\n raise ArgumentError, \"Entry created with node other than atom:entry: #{o.name}\"\n end\n when Hash\n o.each do |k,v|\n send(\"#{k.to_s}=\", v)\n end\n else\n raise ArgumentError, \"Got #{o.class} but expected a Hash or XML::Reader\"\n end\n\n yield(self) if block_given?\n end", "title": "" } ]
[ { "docid": "e18c1ae1bf94a38ded30212e1f4be881", "score": "0.74488163", "text": "def initialize(o = {})\n @links = Links.new\n @authors = []\n @contributors = []\n @categories = []\n\n case o\n when Nokogiri::XML::Reader\n if current_node_is?(o, 'entry', Atom::NAMESPACE) || next_node_is?(o, 'entry', Atom::NAMESPACE)\n o.read\n parse(o)\n else\n raise ArgumentError, \"Entry created with node other than atom:entry: #{o.name}\"\n end\n when Hash\n o.each do |k,v|\n send(\"#{k.to_s}=\", v)\n end\n else\n raise ArgumentError, \"Got #{o.class} but expected a Hash or XML::Reader\"\n end\n\n yield(self) if block_given?\n end", "title": "" }, { "docid": "b75eec944b6f9aa6ce40eba859141618", "score": "0.6998872", "text": "def initialize(entry)\n @entry = entry\n end", "title": "" }, { "docid": "b75eec944b6f9aa6ce40eba859141618", "score": "0.6998872", "text": "def initialize(entry)\n @entry = entry\n end", "title": "" }, { "docid": "b75eec944b6f9aa6ce40eba859141618", "score": "0.6998872", "text": "def initialize(entry)\n @entry = entry\n end", "title": "" }, { "docid": "e4edebae82869b74551789647e1db78a", "score": "0.6997832", "text": "def initialize (entry)\n @entry = entry\n end", "title": "" }, { "docid": "14ccff19f52afd4d773514ed44e76322", "score": "0.69925326", "text": "def initialize(entry)\n @entry = entry\n end", "title": "" }, { "docid": "4367c26e47d7bf8addaf06c3c46effb3", "score": "0.69662976", "text": "def initialize(o = {})\n\t @links, @collections, @entries, @authors, @contributors, @categories = Links.new, [], [], [], [], []\n\t \n\t case o\n\t when XML::Reader\n\t if next_node_is?(o, 'feed', Atom::NAMESPACE)\n\t o.read\n\t parse(o)\n\t else\n\t raise ArgumentError, \"XML document was missing atom:feed: #{o.read_outer_xml}\"\n\t end\n\t when Hash\n\t o.each do |k, v|\n\t self.send(\"#{k.to_s}=\", v)\n\t end\n\t else\n\t raise ArgumentError, \"Got #{o.class} but expected a Hash or XML::Reader\"\n\t end\n\t \n\t yield(self) if block_given?\n\t end", "title": "" }, { "docid": "9d4c81aa89c5fbcadf7ee93b0a580375", "score": "0.6896262", "text": "def initialize(o = {})\n @links, @entries, @authors, @contributors, @categories = Links.new, [], [], [], []\n\n case o\n when Nokogiri::XML::Reader\n if next_node_is?(o, 'feed', Atom::NAMESPACE)\n o.read\n parse(o)\n else\n raise ArgumentError, \"XML document was missing atom:feed\"\n end\n when Hash\n o.each do |k, v|\n self.send(\"#{k.to_s}=\", v)\n end\n else\n raise ArgumentError, \"Got #{o.class} but expected a Hash or XML::Reader\"\n end\n\n yield(self) if block_given?\n end", "title": "" }, { "docid": "843ef6be5491a620c1308bda9e5709c1", "score": "0.684407", "text": "def initialize\n @entries = nil\n yield self if block_given?\n end", "title": "" }, { "docid": "36b63bab1b33b5562e93ffe99b9b4c9e", "score": "0.68013793", "text": "def make_entry()\n ## already have access to a the instance var @filehandler, no need to pass it in\n # def make_entry(f)\n # remove the trailing newline\n header = @filehandler.readline.chomp\n sequence = \"\"\n # f.each do |line|\n @filehandler.each do |line|\n unless line.include? \">\"\n sequence += line.chomp\n else\n break\n end\n end\n # no need to create the object, just return the new annonymous instance\n # entry = Entry.new(header,sequence)\n # return entry\n Entry.new(header,sequence)\n end", "title": "" }, { "docid": "e3d8b2c109476481eb41e2b67a9cb807", "score": "0.6652976", "text": "def initialize(entry)\n @entry = entry\n @raw_content = entry.content.value\n @stripped_content = @raw_content.gsub(/<br\\s?\\/?>/,\"\\n\").gsub(/<\\/?[^>]*>/, \"\")\n @content = @raw_content\n @id = entry.id ? entry.id.strip : \"\"\n @published = entry.published\n @updated = entry.updated\n @title = entry.title ? entry.title.strip : \"\"\n @links = entry.links\n parse_when\n parse_where\n parse_details #summary\n parse_dates\n end", "title": "" }, { "docid": "995835a1c3366f562da3c1f5d807fddd", "score": "0.6354995", "text": "def initialize(atom_entry)\n @atom_entry = atom_entry\n end", "title": "" }, { "docid": "995835a1c3366f562da3c1f5d807fddd", "score": "0.6354995", "text": "def initialize(atom_entry)\n @atom_entry = atom_entry\n end", "title": "" }, { "docid": "93e00d47e805cfbcb8ccdea4b6a9ec79", "score": "0.6145356", "text": "def initialize(raw_entry)\n @raw_entry = raw_entry\n end", "title": "" }, { "docid": "9bf554195bb5e929c193225dbb3ba23d", "score": "0.6055757", "text": "def initialize( metadata = { \"id\" => \"atomtestid\", \"authors\" => [\"Mark\", \"Richard\"], \"dc\" => { \"title\" => \"dctesttitle\" } } )\n\n entry = Atom::Entry.new do |entry|\n # add ATOM stuff\n entry.id = metadata[\"id\"] if metadata.has_key?(\"id\")\n entry.updated = metadata[\"updated\"] if metadata.has_key?(\"updated\")\n entry.published = metadata[\"published\"] if metadata.has_key?(\"published\")\n entry.title = metadata[\"title\"] if metadata.has_key?(\"title\")\n entry.summary = metadata[\"summary\"] if metadata.has_key?(\"summary\")\n entry.rights = metadata[\"rights\"] if metadata.has_key?(\"rights\")\n entry.source = metadata[\"source\"] if metadata.has_key?(\"source\")\n entry.content = metadata[\"content\"] if metadata.has_key?(\"content\")\n metadata[\"authors\"].each { |author| entry.authors << Atom::Person.new(:name => author) } if metadata.has_key?(\"authors\")\n metadata[\"contributors\"].each { |contributor| entry.contributors << Atom::Person.new(:name => contributor) } if metadata.has_key?(\"contributors\")\n metadata[\"links\"].each { |link| entry.links << Atom::Link.new(:href => link) } if metadata.has_key?(\"links\")\n metadata[\"categories\"].each { |category| entry.links << Atom::Categories.new(:category => category) } if metadata.has_key?(\"categories\")\n\n # add DCTERMS stuff - just presume passed keys are valid\n metadata[\"dc\"].each { |key, value| entry[\"http://purl.org/dc/terms/\", key] << value } if metadata.has_key?(\"dc\")\n end\n\n @object = entry\n end", "title": "" }, { "docid": "5e1ea537ef9310642cf49b8bd635f5d4", "score": "0.6054992", "text": "def initialize(o = {})\n case o\n when Nokogiri::XML::Reader\n @name = o.inner_xml.strip\n parse(o, :once => true)\n when Hash\n o.each do |k, v|\n self.send(\"#{k.to_s}=\", v)\n end\n else\n raise ArgumentError, \"Got #{o.class} but expected a Hash or XML::Reader\"\n end\n\n yield(self) if block_given?\n end", "title": "" }, { "docid": "ffe9288a2a73574c4ff7dc9ea2b440cf", "score": "0.6027405", "text": "def new\n @entry = Entry.new\n end", "title": "" }, { "docid": "ffe9288a2a73574c4ff7dc9ea2b440cf", "score": "0.6027405", "text": "def new\n @entry = Entry.new\n end", "title": "" }, { "docid": "ffe9288a2a73574c4ff7dc9ea2b440cf", "score": "0.6027405", "text": "def new\n @entry = Entry.new\n end", "title": "" }, { "docid": "ecc22ed015823069b85edd09655a0d17", "score": "0.5987858", "text": "def new\n\t\t@entry = Entry.new\n\tend", "title": "" }, { "docid": "62463ebeb1d2ab8782fc100f939be69a", "score": "0.596896", "text": "def initialize(input = \"\")\n @entries = EntryCollection.new\n parse input\n end", "title": "" }, { "docid": "9c3c1932657da8f429d69c52928fcb57", "score": "0.59019536", "text": "def initialize(entry, menu)\n # check keys in entry\n error \"Unknown entry type '#{entry['type']}'\" unless\n TYPES.member?(entry['type'])\n error \"A menu entry must be a Hash\" unless entry.kind_of?(Hash)\n error \"'title' key is mandatory in menu entries\" unless entry['title']\n error \"One of 'file' or 'dir' keys must be in a menu entry\" unless\n (entry['file'] or entry['dir']) or entry['type'] == 'link' or \n entry['type'] == 'section'\n error \"'file' and 'dir' keys can't be in a menu entry at the \" +\n \"same time\" if entry['file'] and entry['dir']\n # save keys into fields\n @menu = menu\n @title = entry['title']\n @type = entry['type']\n @file = entry['file']\n @dir = entry['dir']\n @dest = entry['dest']\n @template = entry['template']\n @erb = entry['erb']\n @toc = entry['toc']\n @level = entry['level'] || DEFAULT_TOC_LEVEL\n @depth = entry['depth'] || DEFAULT_TOC_DEPTH\n @process = entry['process']\n end", "title": "" }, { "docid": "91a132359717f2c88a85fed47cffca23", "score": "0.58844924", "text": "def initialize(o = {})\n case o\n when Nokogiri::XML::Reader\n o.read\n parse(o)\n when Hash\n o.each do |k, v|\n self.send(\"#{k.to_s}=\", v)\n end\n else\n raise ArgumentError, \"Got #{o.class} but expected a Hash or XML::Reader\"\n end\n\n yield(self) if block_given?\n end", "title": "" }, { "docid": "b3337f49f70d4ab1622471b97540acd4", "score": "0.5868346", "text": "def make_entry(params)\n unless params\n return Atom::Entry.new\n end\n\n if params[:complete]\n return Atom::Entry.parse(params[:complete])\n end\n\n entry = if params[:original]\n Atom::Entry.parse(params[:original], params[:base_url])\n else\n Atom::Entry.new\n end\n\n entry.id = \"urn:uuid:#{UUID.create}\" unless entry.id\n\n entry.title = params[:title]\n\n if params[:tags] and not params[:tags].empty?\n entry.categories.clear\n entry.tag_with params[:tags]\n end\n\n if params[:draft] and not params[:draft].empty?\n entry.draft = true\n elsif params[:publish] and not params[:publish].empty?\n entry.draft = false\n end\n\n if author = params[:author]\n a_auth = entry.authors.new\n a_auth.name = author[:name] if author[:name]\n a_auth.email = author[:email] if author[:email]\n\n if uri = author[:uri]\n a_auth.uri = n_url uri\n end\n end\n\n if links = params[:links]\n links.each do |l|\n a_link = entry.links.new\n a_link['href'] = n_url l[:href]\n a_link['rel'] = l[:rel] if l[:rel]\n end\n end\n\n [:content, :summary].each do |sym|\n if ptext = params[sym]\n ptype = params[(sym.to_s + '_type').to_sym]\n\n case ptype\n when 'text', 'html', 'xhtml'\n text = ptext\n text = PushPin::HTML::xmlize_entities(ptext) if ptype == 'xhtml'\n when 'markdown'\n text = BlueCloth.new(ptext.to_s).to_html\n type = 'html'\n else\n raise \"don't know text construct type #{ptype.inspect}\"\n end\n\n entry.send(sym.to_s + '=', text)\n entry.send(sym)['type'] = (type or ptype)\n end\n end\n\n # extension mechanism\n if EntryConstructor.singleton_methods.member? params['extra']\n EntryConstructor.send params['extra'].to_sym, entry, params\n end\n\n entry\n end", "title": "" }, { "docid": "34055bf5eddbc06eada630a5bb0ecacf", "score": "0.5847778", "text": "def initialize(f_in, max_depth = 2)\n @f_md = f_in\n @max_depth = max_depth\n Struct.new(\"TocEntry\", :id, :heading, :original_markdown, :level)\n end", "title": "" }, { "docid": "7d3f6b7d097dbc56d853bce13ff71e82", "score": "0.5846141", "text": "def generate_entry options = {}\n\t\t\t\tsettings = {\n\t\t\t\t\t:bookmark_url => nil,\n\t\t\t\t\t:body => nil,\n\t\t\t\t\t:created_at => Time.now,\n\t\t\t\t\t:title => \"(untitled)\",\n\t\t\t\t\t:updated_at => Time.now\n\t\t\t\t}.merge(options)\n\n\t\t\t\tEntry.new settings\n\t\t\tend", "title": "" }, { "docid": "9aec9c2336880b47d8d3e39d4ee85df3", "score": "0.58349496", "text": "def initialize(o)\n case o\n when XML::Reader\n if current_node_is?(o, 'link')\n self.text = o.read_string\n parse(o, :once => true)\n else\n raise ArgumentError, \"Link created with node other than atom:link: #{o.name}\"\n end\n when Hash\n [:href, :rel, :type, :length, :hreflang, :title].each do |attr|\n self.send(\"#{attr}=\", o[attr])\n end\n else\n raise ArgumentError, \"Don't know how to handle #{o}\"\n end\n end", "title": "" }, { "docid": "cafd883555ece28bdc9b138f366c33ff", "score": "0.58108974", "text": "def make_new_entry\n Entry.new\n end", "title": "" }, { "docid": "1554ee45ce599ba281f099efb3ca6ba7", "score": "0.5753744", "text": "def wrap(entry)\n wrapper = EntryWrapper.new\n wrapper.entry = entry\n wrapper.receiver = self\n return wrapper\n end", "title": "" }, { "docid": "a21aa90ece6e931239337805ec3ca9ac", "score": "0.5734126", "text": "def initialize(o)\n case o\n when Nokogiri::XML::Reader\n if current_node_is?(o, 'link')\n parse(o, :once => true)\n else\n raise ArgumentError, \"Link created with node other than atom:link: #{o.name}\"\n end\n when Hash\n [:href, :rel, :type, :length, :hreflang, :title].each do |attr|\n self.send(\"#{attr}=\", o[attr])\n end\n else\n raise ArgumentError, \"Don't know how to handle #{o}\"\n end\n end", "title": "" }, { "docid": "31ca13b9fa07bb5b532ef9f696bf22ad", "score": "0.5715615", "text": "def initialize(node, *args)\n @element = if node.is_a?(REXML::Element)\n node\n else \n REXML::Element.new(node) \n end\n \n @child_nodes = {}\n \n if attributes = args.last.is_a?(Hash) ? args.pop : nil\n attributes.each { |k,v| @element.add_attribute(k.to_s, v.to_xml_value) }\n end\n \n if !args[0].nil?\n @element.text = args[0].to_xml_value\n end\n\n if block_given? \n yield self \n end\n end", "title": "" }, { "docid": "449fb2a6b3e3dabbc1a2cf770632ae3b", "score": "0.5712452", "text": "def initialize(entry_fetcher = Post.public_method(:all))\n @entry_fetcher = entry_fetcher\n end", "title": "" }, { "docid": "5fe6dc1b0b0ffbd97c3a4b732334cbb3", "score": "0.56833255", "text": "def initialize\n self.title = nil\n self.url = nil\n self.description = nil\n self.updated_at = nil\n self.entries = []\n self.author = nil\n end", "title": "" }, { "docid": "ef115d8d64e9fe796daa9b1a39db9cbd", "score": "0.5683103", "text": "def initialize(entry)\n entry.each_pair do |name, value|\n self[\"_#{name}\"] = value\n end\n end", "title": "" }, { "docid": "f29fa5a08c63f66bb0a5a49e5de7b51a", "score": "0.5665163", "text": "def initialize(*ary)\n @entries = ary\n end", "title": "" }, { "docid": "0ee2269c74357a68eaffde1198259755", "score": "0.5658759", "text": "def initialize entry_text='', hsh={}\n # Some defaults\n @creation_date = Time.now\n @starred = false\n @entry_text = entry_text\n @saved = false\n @tags = []\n @location = DayOne::Location.new hsh.delete(:location)\n \n hsh.each do |k,v|\n setter = \"#{k}=\"\n self.send(setter,v) if self.respond_to? setter\n end\n end", "title": "" }, { "docid": "3be5b2b359bdfdac71e51ad6349220a6", "score": "0.56586516", "text": "def next_entry()\n\t\t\t\tbuf = @fp.read(BLOCKSIZE)\n\t\t\t\tif buf == \"\\000\" * BLOCKSIZE\n\t\t\t\t\tentry = nil\n\t\t\t\telse\n\t\t\t\t\tentry = Entry.new(buf, @fp)\n\t\t\t\tend\n\t\t\t\tentry\n\t\t\tend", "title": "" }, { "docid": "45aefda5059b8eeb642481134c3e5540", "score": "0.56431997", "text": "def initialize(feed)\n raise \"Feed cannot be nil\" unless feed\n @feed = feed\n end", "title": "" }, { "docid": "e525d58cf499a869253694af375ade9f", "score": "0.5628328", "text": "def new(&block)\n assign_attributes\n respond_with(entry, &block)\n end", "title": "" }, { "docid": "0e45bba8e3ad057e5584b50da11cc8dc", "score": "0.56271493", "text": "def initialize( repo, entryhash )\n\t\t\t@repo = repo\n\n\t\t\t@description = entryhash[:desc]\n\t\t\t@is_entry = entryhash[:isentry]\n\t\t\t@node = entryhash[:node]\n\t\t\t@stack_index = entryhash[:stack_index]\n\t\t\t@state = entryhash[:state]\n\t\t\t@symbol = entryhash[:symbol]\n\t\tend", "title": "" }, { "docid": "a9de67eebe2dbde42e5fd7d02fc6aa24", "score": "0.5599845", "text": "def initialize\n yield self\n end", "title": "" }, { "docid": "5de0daf13a39187c3098c857c3d2d068", "score": "0.5584404", "text": "def initialize(entry, doc)\n @doc = doc\n @entry = entry\n @hqmf_id = attr_val('./*/cda:id/@extension') || attr_val('./*/cda:typeId/@extension')\n @title = attr_val('./*/cda:code/cda:displayName/@value') \n @type = attr_val('./*/cda:code/@code')\n @aggregator = nil\n @comments = @entry.xpath(\"./*/cda:text/cda:xml/cda:qdmUserComments/cda:item/text()\", HQMF2::Document::NAMESPACES)\n .map{ |v| v.content }\n obs_test = attr_val('./cda:measureObservationDefinition/@classCode')\n if !@title && obs_test.to_s == \"OBS\"\n @title = attr_val('../cda:code/cda:displayName/@value')\n @aggregator = attr_val('./cda:measureObservationDefinition/cda:methodCode/cda:item/@code')\n end\n if(!@hqmf_id) # The id extension is not required, if it's not provided use the code\n @hqmf_id = @type\n end\n @preconditions = @entry.xpath('./*/cda:precondition[not(@nullFlavor)]', HQMF2::Document::NAMESPACES).collect do |precondition|\n Precondition.new(precondition, @doc)\n end\n end", "title": "" }, { "docid": "d64f36cdbe00d12b6b5e8182df778031", "score": "0.5580844", "text": "def init_with_yield &block\n new.tap do |t|\n t.yield_dictionary &block\n end\n end", "title": "" }, { "docid": "3be31542d408c6384fa252d673e6f579", "score": "0.55362546", "text": "def initialize\n super('')\n @parent = nil\n @entries = [ ]\n end", "title": "" }, { "docid": "4efdfba227600ecadace96ce6271eac7", "score": "0.5533441", "text": "def make_entry(path)\n return ::Base::Entry.from_file(path)\n end", "title": "" }, { "docid": "ff3fe472b2e56ae92315df1c77f3a83b", "score": "0.55224025", "text": "def event_from_entry(entry, feed)\n Feeds::Event.new entry.to_h.merge(\n summary: Nokogiri::HTML(entry.summary).text,\n event_id: digest(entry.to_json)\n )\n end", "title": "" }, { "docid": "6865205fbc830b07a707090121526959", "score": "0.5518197", "text": "def entries\n @entries ||= feed[\"entries\"].map do |entry| \n Entry.new(entry)\n end\n end", "title": "" }, { "docid": "e03970c69f76bcae0b6401b3800e647a", "score": "0.55115616", "text": "def initialize\n @entries = []\n end", "title": "" }, { "docid": "1ff3bfbdbfd8191204789911ab9f0027", "score": "0.5487499", "text": "def make_entry()\n header = @filehandler.readline.chomp\n\n sequence = \"\"\n # f.each do |line|\n @filehandler.each do |line|\n unless line.include? \">\"\n sequence += line.chomp\n else\n break\n end\n end\n\n FastaEntry.new(header,sequence)\n end", "title": "" }, { "docid": "5daf536b117362e78e40e57af8ba58c2", "score": "0.54823875", "text": "def build_entry\n @entry = model_class.new\n end", "title": "" }, { "docid": "c3d3cd757e076de738da653cb7cf2ca6", "score": "0.54810244", "text": "def entry(title, body)\n x = Builder::XmlMarkup.new :indent => 2\n x.entry 'xmlns' => 'http://www.w3.org/2005/Atom' do\n x.title title, 'type' => 'text'\n x.content 'type' => 'xhtml' do\n x.div body, 'xmlns' => 'http://www.w3.org/1999/xhtml'\n end\n end\n \n @entry ||= x\n path = \"/feeds/#{@blog_id}/posts/default\"\n post(path, entry.to_s)\n end", "title": "" }, { "docid": "0d26af286aeaf3938fc7c4e10afc8e1c", "score": "0.5475715", "text": "def initialize(entry_hash, options)\n @options = options.with_indifferent_access\n @es_options = @options[:elastic_search]\n @entry_hash = entry_hash.with_indifferent_access\n @items = self.process\n end", "title": "" }, { "docid": "d0bf42147052b0abebc4a7779a507c6e", "score": "0.5474871", "text": "def initialize\n @entries = []\n end", "title": "" }, { "docid": "53c973ca82ca70b663359502fe06f0d4", "score": "0.5470347", "text": "def initialize(rss_entry:, id:)\n @rss_entry = rss_entry\n @job = SoJob.new(id: id)\n end", "title": "" }, { "docid": "8ad0ab6b28b05809c74740ada0e52aa5", "score": "0.5468677", "text": "def create_entry(title, body)\n x = Builder::XmlMarkup.new :indent => 2\n x.entry 'xmlns' => 'http://www.w3.org/2005/Atom' do\n x.title title, 'type' => 'text'\n x.content 'type' => 'xhtml' do\n x.div body, 'xmlns' => 'http://www.w3.org/1999/xhtml'\n end\n end\n \n @entry ||= x.target!\n path = \"/feeds/#{@blog_id}/posts/default\"\n post(path, @entry)\n end", "title": "" }, { "docid": "cfb62f84a762969196d11fd6025ceeb5", "score": "0.5456926", "text": "def initialize entry, signature = nil, plaintext = nil\n @entry = entry\n @signature = signature\n @plaintext = plaintext\n end", "title": "" }, { "docid": "cfb62f84a762969196d11fd6025ceeb5", "score": "0.5456926", "text": "def initialize entry, signature = nil, plaintext = nil\n @entry = entry\n @signature = signature\n @plaintext = plaintext\n end", "title": "" }, { "docid": "5993d99ac8da03aa02e7be4b73557ed4", "score": "0.5456515", "text": "def initialize_entries(e)\r\n @TableEntryCollection = []\r\n\r\n e.each {|x|\r\n temp = Entry.new(x)\r\n @TableEntryCollection.push(temp)\r\n }\r\n return @TableEntryCollection\r\n end", "title": "" }, { "docid": "67d9a5f430bf111c8d8ed50bbfed6ea9", "score": "0.5450473", "text": "def initialize(zip_io_stream)\n @current_entry = nil\n @zip_contents = {}\n zip_io_stream.each do |entry|\n next unless entry.file?\n content = entry.get_input_stream.read\n @zip_contents[entry.name] = wrap_entry(entry.name, content)\n end\n #\n @dom = build_dom(@zip_contents)\n end", "title": "" }, { "docid": "a54bf2ae21d4c7a5253169f35f624cec", "score": "0.54456383", "text": "def initialize\n\t\t@entries = {}\n\tend", "title": "" }, { "docid": "590b883479d8b9473db9228b7e638092", "score": "0.54449517", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "590b883479d8b9473db9228b7e638092", "score": "0.54449517", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "35762dd60a16bad779cba5c9a071eb74", "score": "0.5444926", "text": "def initialize(o)\n raise ArgumentError, \"Got #{o} which isn't an XML::Reader\" unless o.kind_of?(Nokogiri::XML::Reader)\n super(\"\")\n parse(o, :once => true)\n end", "title": "" }, { "docid": "daf2ac3d3c45ad9727bb2f155f4e14c0", "score": "0.54446614", "text": "def create_entry(entry_type, header, initial_record)\n new_entry = entry_type.new(**initial_record)\n new_entry.populate(header, initial_record)\n end", "title": "" }, { "docid": "6ffecaa761f5cece94a39eefacb61550", "score": "0.54401875", "text": "def initialize(entries_and_options={})\n entries_and_options.each{|k,v| send(\"#{k}=\", v) if respond_to?(\"#{k}=\") && k.is_a?(Symbol) }\n without_autocommit do\n entries_and_options.each{|k,v| self[k] = v if k.is_a?(String) }\n end\n zipfile.commit if autocommit?\n yield self if block_given?\n end", "title": "" }, { "docid": "59022007ff8941038558511bfea76561", "score": "0.5425228", "text": "def initialize(parent = nil)\n @char = nil\n @parent = parent\n @children = []\n @links = []\n @end_indexes = []\n yield(self) if block_given?\n end", "title": "" }, { "docid": "e53559a12267ae9289a25a55e6b62ea9", "score": "0.54185754", "text": "def initialize\n @entries = []\n\n end", "title": "" }, { "docid": "6adebdcf65ab6abc3998aa161ddcc6e3", "score": "0.5418262", "text": "def initialize(entry, doc)\n @doc = doc\n @entry = entry\n @hqmf_id = attr_val('./*/cda:id/@extension')\n @title = attr_val('./*/cda:code/cda:displayName/@value') \n @type = attr_val('./*/cda:code/@code')\n @preconditions = @entry.xpath('./*/cda:precondition[not(@nullFlavor)]', HQMF2::Document::NAMESPACES).collect do |precondition|\n Precondition.new(precondition, @doc)\n end\n end", "title": "" }, { "docid": "61387b3b6b77b1fab7cf94982b833469", "score": "0.5407337", "text": "def init=(xml_entry)\n self.uid = xml_entry.css('id').text\n self.etag = xml_entry['etag'].to_s\n self.title = xml_entry.css('title').text\n self.body = xml_entry.to_s\n end", "title": "" }, { "docid": "bd8fc51775c21378b027b49feecff23a", "score": "0.540731", "text": "def initialize node\n# $stderr.puts \"ContainerEntry(#{node})\"\n @name = node.xpath(\"./td/b\").text\n while node = node.next do # next <tr>\n\tbreak if node['class']\n\tkey = value = nil\n\tnode.children.each do |child| # iterate over <td>\n\t if child.child.name == \"b\" # <td><b>\n\t key = child.child.text\n\t else\n\t value = child.text\n\t end\n\t if key && value\n\t case key\n\t when \"Description:\": @description = value\n\t when \"Documents:\": @size = value.to_i\n\t when \"Notification postmaster: \": @postmaster = value\n\t end\n\t key = value = nil\n\t end\n\tend\n end\n end", "title": "" }, { "docid": "61aed3b5f83cf9ebb92b6949861c5463", "score": "0.5399925", "text": "def initialize\n yield(self) if block_given?\n end", "title": "" }, { "docid": "5793d9ea49ceeee0dc4a323627b2b672", "score": "0.5387199", "text": "def create_if(&block)\n @feed.entries.each do |entry|\n if block.call(entry)\n create_entry(entry)\n end\n end\n end", "title": "" }, { "docid": "92f3bc4d0630c39739f9d8b2035b0420", "score": "0.538133", "text": "def to_atom_entry(options = {})\n Atom::Entry.new do |entry|\n entry.title = self.title\n entry.updated = self.updated_on\n entry.published = self.created_on\n entry.id = self.uri\n entry.links << Atom::Link.new(:rel => 'via', :href => self.url)\n entry.links << Atom::Link.new(:rel => 'self', :href => \"#{options[:base]}/feeds/#{self.id}.atom\")\n entry.links << Atom::Link.new(:rel => 'alternate', :href => self.link)\n entry.links << Atom::Link.new(:rel => 'http://peerworks.org/duplicateOf', \n :href => self.duplicate.uri) if self.duplicate\n end\n end", "title": "" }, { "docid": "6433d228d965cdc0791f5d6b4de2afea", "score": "0.5378689", "text": "def initialize(entries)\n @entries = entries\n @header_entry = POEntry.new(\n flags: ['fuzzy'],\n msgid: '',\n msgstr: <<-STRING.unindent\n POT-Creation-Date: #{Time.now.strftime('%Y-%m-%d %H:%M%z')}\n MIME-Version: 1.0\n Content-Type: text/plain; charset=UTF-8\n STRING\n )\n end", "title": "" }, { "docid": "0123fa2f367c6d5ec022db2f1554cfc4", "score": "0.5364353", "text": "def each_entry(&block)\n entries.each do |child|\n yield child\n end\n end", "title": "" }, { "docid": "3566078199b107903f30c3efaa977a13", "score": "0.5362537", "text": "def entry(entry_name)\n ::Zip::Entry.new(name, entry_name)\n end", "title": "" }, { "docid": "b40359653c19631bcde1bef1a4b102a7", "score": "0.534571", "text": "def initialize entry\n\n define_attrs\n\n if ((entry) && (entry.class == REXML::Element))\n @xml = entry\n @id = /\\w{16}/.match(@xml.elements['id'].text).to_s\n populate_attrs\n\n elsif((entry.class==String)&&(entry =~ /\\w{16}/))\n @id = entry.to_s\n else\n raise \"The Playlist class did not understand the parameter it was initialized with.\"\n end\n @url = \"http://gdata.youtube.com/feeds/api/playlists/#{@id}\"\n end", "title": "" }, { "docid": "ddd2638be1ddad90c0ee0d460afeb1c1", "score": "0.53362715", "text": "def atom\n if @str != nil\n @str\n elsif @options == nil and @access_token == nil\n # simply open the url\n open(@url).read\n elsif @options == nil and @url != nil\n # open the url through OAuth\n @access_token.get(@url).body\n else\n # build the atom file from internal information\n feed = TinyAtom::Feed.new(\n self.id,\n self.title,\n\n @url,\n\n :author_name => self.author.name,\n :author_email => self.author.email,\n :author_uri => self.author.uri,\n\n :hubs => self.hubs\n )\n\n @options[:entries].each do |entry|\n entry_url = entry.url\n entry_url = @url if entry_url == nil\n\n feed.add_entry(\n entry.id,\n entry.title,\n entry.updated,\n\n entry_url,\n\n :published => entry.published,\n\n :content => entry.content,\n\n :author_name => self.author.name,\n :author_email => self.author.email,\n :author_uri => self.author.uri\n )\n end\n\n feed.make(:indent => 2)\n end\n end", "title": "" }, { "docid": "54226afdfc9e16f0b03b66f7abc92fb5", "score": "0.53314346", "text": "def entry(title, body)\n x = Builder::XmlMarkup.new :indent => 2\n x.entry 'xmlns' => 'http://www.w3.org/2005/Atom' do\n x.title title, 'type' => 'text'\n x.content 'type' => 'xhtml' do\n x.div body, 'xmlns' => 'http://www.w3.org/1999/xhtml'\n end\n end\n \n @entry ||= x.target!\n path = \"/feeds/#{@blog_id}/posts/default\"\n post(path, @entry)\n end", "title": "" }, { "docid": "772c8b22590d0061006828b861ec8b32", "score": "0.5325879", "text": "def initialize\n # initialize default values for most properties\n self.title = ''\n self.description = ''\n self.base_url = ''\n self.post_path = 'post/'\n self.author = ''\n self.posts_per_page = 10\n self.reversed = false\n self.date_path_format = self.class.default_date_path_format\n self.slug_separator = self.class.default_slug_separator\n self.rss_length = 20\n\n yield self if block_given?\n\n @blog_root = File.expand_path(Dir.getwd) + '/'\n end", "title": "" }, { "docid": "85ff5acecb533849e893ca715ba2fa40", "score": "0.532432", "text": "def build_post_from_entry(entry)\n self.posts.build(\n :summary => entry[:description],\n :service_action => Service::SERVICE_ACTION_BOOKMARK,\n :identifier => entry[:guid].to_s,\n :title => entry[:title],\n :markup => Post::PLAIN_MARKUP,\n :url => entry[:link],\n :published_at => entry[:pubDate],\n :extra_content => {\n :original_tags => entry[:tags],\n :image_url => entry[:image_url],\n :thumbnail_url => entry[:thumbnail_url],\n :medium_image_url => entry[:medium_image_url]\n }\n )\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.53234565", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.53234565", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.53234565", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.53234565", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.53234565", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.53234565", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.53234565", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "dee263abfa3a582f8a75b732c36429bf", "score": "0.53234565", "text": "def initialize\n yield self if block_given?\n end", "title": "" }, { "docid": "fc9066dbef1a61e10d46ba4eee017a88", "score": "0.5322948", "text": "def initialize(entry, type = nil, verbose = false)\n @entry = entry\n @type = type || attr_val('./@classCode')\n @mood = attr_val('./@moodCode')\n @entry = entry.elements.first unless entry.at_xpath('./@extension')\n @verbose = verbose\n end", "title": "" }, { "docid": "5f258f3fa195b1d2169b47dbfcb8a0a5", "score": "0.5319883", "text": "def initialize\n\t\t@entries = []\n\tend", "title": "" }, { "docid": "fe9e0c507a37b37197da42bb1224ea11", "score": "0.5313906", "text": "def entries\n raw_entries.each {|entry| entry.feed = self }\n end", "title": "" }, { "docid": "bb76726cb3e057696c5e9541d827bb4d", "score": "0.5298916", "text": "def initialize *entries\r\n @size = 0\r\n unless entries.empty?\r\n @first = LLNode.new(entries.shift, nil, nil)\r\n @last = @first\r\n @size = 1\r\n self.push(*entries) unless entries.empty?\r\n end\r\n end", "title": "" }, { "docid": "af483ccf2562f8dad2b855aacc8c17f0", "score": "0.52920735", "text": "def initialize(*args)\n hash = {}\n if args.length > 0\n hash = args.shift\n end\n\n if hash.is_a? Nelumba::Feed\n hash = hash.to_hash\n end\n\n if hash[:authors].is_a? Array\n hash[:authors].map! do |author|\n if author.is_a? Hash\n author = Nelumba::Person.find_or_create_by_uid!(author)\n end\n author\n end\n end\n\n if hash[:contributors].is_a? Array\n hash[:contributors].map! do |contributor|\n if contributor.is_a? Hash\n contributor = Nelumba::Person.find_or_create_by_uid!(contributor)\n end\n contributor\n end\n end\n\n if hash[:items].is_a? Array\n hash[:items].map! do |item|\n if item.is_a? Hash\n item = Nelumba::Activity.find_or_create_by_uid!(item)\n end\n item\n end\n end\n\n super hash, *args\n end", "title": "" }, { "docid": "a805568e69589848e8fda6a11d11aad9", "score": "0.5276986", "text": "def rss_create_entries(feed_stream, feed_record)\n feed_stream.channel.items.each do |item|\n attributes = {\n title: item.title,\n url: item.link,\n author: item.author,\n summary: item.description,\n content: clean_xml(item.content_encoded),\n published: item.pubDate,\n feed_id: feed_record.id,\n # categories: item.categories,\n guid: item.guid.content\n }\n Entry.create(attributes)\n\n end\n end", "title": "" }, { "docid": "f227216d7729fc92af14a7b73e9a812b", "score": "0.52663773", "text": "def initialize(contents = nil)\n @attributes = { }\n\n case (contents)\n when Hash\n assign(contents)\n when ReDNS::Buffer\n deserialize(contents)\n when String\n if (respond_to?(:primary_attribute=))\n self.primary_attribute = contents\n end\n else\n # FUTURE: Raise exception on invalid or unexpected type, but for now\n # allow the subclass to try.\n end\n \n yield(self) if (block_given?)\n end", "title": "" }, { "docid": "358ee8f3b31fa0e8e6df2da1a809960e", "score": "0.5263471", "text": "def initialize(entry)\n for name in entry\n self[\"_#{name}\"] = entry[name]\n end\n end", "title": "" }, { "docid": "377bdaa35d170c46f8c7735b0c271a1f", "score": "0.52631724", "text": "def entry opts={}, &b\n create_append :Entry, opts\n end", "title": "" }, { "docid": "377bdaa35d170c46f8c7735b0c271a1f", "score": "0.52631724", "text": "def entry opts={}, &b\n create_append :Entry, opts\n end", "title": "" }, { "docid": "0647d3b11551f89123c3fe6efba64906", "score": "0.52568984", "text": "def initialize(entry, doc)\n @doc = doc\n @entry = entry\n @id = attr_val('cda:observation/cda:id/@root').upcase\n @preconditions = [Precondition.new(@entry, nil, @doc)]\n end", "title": "" } ]
4de3241c287260b069ca08b46d991a8b
Waits until the element is visible
[ { "docid": "a41825fdbb74b67a90a23c313ced8975", "score": "0.74703", "text": "def when_visible(timeout=::PageObject.default_element_wait)\n when_present(timeout)\n element.wait_until(timeout: timeout, message: \"Element not visible in #{timeout} seconds\", &:visible?)\n self\n end", "title": "" } ]
[ { "docid": "a397b64eea513d32c084d3003ded3f59", "score": "0.838602", "text": "def wait_until_visible\n wait_for_visibility(true) { DriverManager.driver.find_element(@by, @locator).displayed? }\n end", "title": "" }, { "docid": "bf7c9430140fa346f553e4b781119cd4", "score": "0.8140137", "text": "def wait_for_element_to_be_visible(id, name, time)\n begin\n element = get_element(id, name)\n !time.times {\n break if element.displayed?\n sleep 1\n }\n rescue\n end\nend", "title": "" }, { "docid": "3fed933bf2bc0ffa7114e921458628b2", "score": "0.8049807", "text": "def wait_until_visible(seconds = nil)\n wait(seconds){visible?}\n rescue\n raise DATPages::Errors::ElementNotFound.new\n end", "title": "" }, { "docid": "ad1dd110143700d5799cfe60e9e7325f", "score": "0.8023925", "text": "def wait_until_visible(seconds_to_wait: nil)\n wait_for(seconds_to_wait: seconds_to_wait) do\n exists? && el.visible?\n end\n end", "title": "" }, { "docid": "99dfe4e8e958f6276b2bb63f1f553a7a", "score": "0.7982761", "text": "def wait_for_element(element)\n @wait.until {\n bool = false\n\n if(element.displayed?)\n bool = true\n @element = element\n break\n end\n\n bool == true\n }\n end", "title": "" }, { "docid": "4ff3d58d05ecffd59b3c83c3c02e55ea", "score": "0.7842589", "text": "def wait_till_element_visible(element_name, n_retry = 3)\n dbg_msg('info',\"Wait till element #{element_name} is visible\")\n wait_for_visibility(element_name, true, n_retry)\n end", "title": "" }, { "docid": "d46e48e83e809bef30def5445a1c38d4", "score": "0.7773451", "text": "def wait_until_webelement_displays(webelement, timeout=15)\n puts \"Waiting for an Webelement to show up\"\n wait = Selenium::WebDriver::Wait.new(:timeout=> timeout)\n wait.until {webelement.displayed?}\n end", "title": "" }, { "docid": "593cc60faf08d2614303e3d657ff6c02", "score": "0.76467806", "text": "def waitForElementUtillVisibility(locator)\n wait = Selenium::WebDriver::Wait.new(:timeout => 60)\n return wait.until {\n driver.find_element(locator)\n }\n end", "title": "" }, { "docid": "c106a73409ab2cac8de93a1b2dd78843", "score": "0.7581343", "text": "def wait_until_not_visible\n wait_for_visibility(false) { DriverManager.driver.find_element(@by, @locator).displayed? }\n end", "title": "" }, { "docid": "7f0ac3bd29fc91c80659b33954a3390f", "score": "0.7566091", "text": "def wait_until_visible\n wait_for_ajax\n end", "title": "" }, { "docid": "71f1147af54452e6da802fdd2eb58cf8", "score": "0.75369996", "text": "def check_visible(timeout=::PageObject.default_element_wait)\n timed_loop(timeout) do |element|\n element.visible?\n end\n end", "title": "" }, { "docid": "71f1147af54452e6da802fdd2eb58cf8", "score": "0.75369996", "text": "def check_visible(timeout=::PageObject.default_element_wait)\n timed_loop(timeout) do |element|\n element.visible?\n end\n end", "title": "" }, { "docid": "1febaa4c0074451b6ad99fef11507c94", "score": "0.75149035", "text": "def when_visible(timeout = ::PageObject.default_element_wait)\n wait = Object::Selenium::WebDriver::Wait.new(timeout: timeout, message: \"Element not visible in #{timeout} seconds\")\n wait.until do\n root.visible?\n end\n self\n end", "title": "" }, { "docid": "2e89903b9cc7f63570e5fd3228f9d09b", "score": "0.74807394", "text": "def wait_for_element_to_disappear(element)\n @wait.until {\n begin\n !element.displayed?\n rescue\n break\n end\n }\n end", "title": "" }, { "docid": "b11cfa0e331f4fa80386fa0eb07e0ff7", "score": "0.740246", "text": "def IsElementVisible(element)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n element = @chromedriver.find_element(:class, element)\n wait.until { element.displayed? }\n\n end", "title": "" }, { "docid": "da2979e6b524c6cde85947c23863dd63", "score": "0.73337394", "text": "def element_visible?\n default_wait = driver.default_wait if driver\n driver.no_wait if driver\n\n if exists?\n driver.set_wait(default_wait) if driver\n true\n else\n false\n end\n rescue RuntimeError\n false\n end", "title": "" }, { "docid": "62e4b6249a4cc84dbc33e512aa3bd47f", "score": "0.7287367", "text": "def wait_for_visibility(element_name, visible_test = true, max_retry = 3)\n nretry = 0\n res = false\n while nretry < max_retry && !res do\n nretry += 1\n res = is_element_visible?(element_name)\n if !visible_test\n res = !res\n end\n\n if !res\n sleep(1)\n end\n end\n res\n end", "title": "" }, { "docid": "0c1b5c61e5f642a6f2960793ebafe9e6", "score": "0.72853714", "text": "def wait_until_gone(seconds = nil)\n wait(seconds){!exists?}\n rescue\n raise DATPages::Errors::ElementVisible.new\n end", "title": "" }, { "docid": "0a39bbc54df27adddab926403afaf13a", "score": "0.7281845", "text": "def when_visible(timeout=5)\n Object::Watir::Wait.until(timeout, \"Element was not visible in #{timeout} seconds\") do\n visible?\n end\n self\n end", "title": "" }, { "docid": "3da4484c7fa53480f30f64a8c194e1b4", "score": "0.7254316", "text": "def wait_for_element(obj)\n # exists? – Returns whether this element actually exists.\n # present? – Returns true if the element exists and is visible on the page , equivalent to visible and exists\n # visible? – If any parent element isn’t visible then we cannot write to the element. The only reliable way to determine this is to\n # iterate up the DOM element tree checking every element to make sure it’s visible.\n # obj.exists?\n # obj.visible?\n obj.wait_until_present\n obj.present?\n obj.enabled?\n\nend", "title": "" }, { "docid": "6a680157eda1cf9afa1e121158a68991", "score": "0.7243216", "text": "def wait_for_render(how, what)\n\t\[email protected] {@driver.find_element(how, what).displayed? == true}\n\tend", "title": "" }, { "docid": "b7ef986ec1c2367299ff2c80e29365de", "score": "0.7181599", "text": "def wait_for_element(obj)\r\n # exists? – Returns whether this element actually exists.\r\n # present? – Returns true if the element exists and is visible on the page , equivalent to visible and exists\r\n # visible? – If any parent element isn’t visible then we cannot write to the element. The only reliable way to determine this is to\r\n # iterate up the DOM element tree checking every element to make sure it’s visible.\r\n # obj.exists?\r\n # obj.visible?\r\n obj.wait_until_present\r\n obj.present?\r\n obj.enabled?\r\nend", "title": "" }, { "docid": "67daece741372c9fe4d193e831879ae2", "score": "0.7083092", "text": "def wait_for_element(element)\n self.send(element).wait_until_present(@ole.explicit_wait)\n end", "title": "" }, { "docid": "0efcbb95951fe6c1f78e44ff98311460", "score": "0.7071844", "text": "def wait_until_displayed(locator)\n wait_for { driver.find_element(locator).displayed? } ||\n (raise ElementNotInteractableError, element_not_displayed_err(locator))\n end", "title": "" }, { "docid": "3a58bfc4cb8b854e6cb4dce75825a574", "score": "0.70557904", "text": "def wait_until_present\n adapter.window.wait_until_present\n end", "title": "" }, { "docid": "4d76da3e2eb617533c87ac5029674d66", "score": "0.70550346", "text": "def wait_for_element(element)\n @wait.until { find_element(element) }\n end", "title": "" }, { "docid": "4d73c413e82f6612967641b3984aa504", "score": "0.70401776", "text": "def wait_for_elements\n adapter.wait_for_elements\n end", "title": "" }, { "docid": "df66512c47622d5a842b0ff1b62e2c4a", "score": "0.7030606", "text": "def wait_for_element_display(times=150)\n 1.upto(times) do |i|\n break unless yield == nil\n raise \"Element does not exist in the viewport.\" if i == times\n sleep 0.2\n end\n end", "title": "" }, { "docid": "9dc87a285e37649d01213b71f235645b", "score": "0.70291257", "text": "def wait_until_appears(finder)\n @wait.until { @driver.find_element(finder) }\n end", "title": "" }, { "docid": "e527db3fd4115155b36f55250a19c7e0", "score": "0.70205903", "text": "def ****_wait(selector, element, timeout = DEFAULT_TIMEOUT)\n begin\n ****_display(selector, element, timeout)\n rescue Exception => e\n raise e.message\n raise e.backtrace.inspect\n end\nend", "title": "" }, { "docid": "3c676f9deba03db9d10240abe202b305", "score": "0.70078605", "text": "def wait_for_loading(timeout = 20)\n wait_until(timeout) { find('.loading', visible: false).present? }\nend", "title": "" }, { "docid": "64780b51634ab456edd33a7f445ab9c3", "score": "0.7003603", "text": "def wait_for(element, time = IMPLICIT_WAIT_TIME)\n Selenium::WebDriver::Wait.new(timeout: time).until do\n @@driver.find_element(element).displayed?\n end\n rescue StandardError => er\n puts er.inspect\n take_screenshot\n false\n end", "title": "" }, { "docid": "dec5e7e267ffbc5507cc588e3009b352", "score": "0.6994596", "text": "def when_displayed(locator, timeout)\n when_exists(locator, timeout)\n wait_until(timeout) { element(locator).displayed? }\n end", "title": "" }, { "docid": "da7f2d09c738ea1c20cf66527522f61b", "score": "0.6969876", "text": "def wait_until_displayed(timeout = 5)\n max = timeout * 10\n count = 0\n displayed = false\n while count < max\n displayed = displayed?(false)\n break if displayed\n sleep 0.2\n count += 2\n end\n displayed\n end", "title": "" }, { "docid": "59b1ce580776743fa520acbd45745a96", "score": "0.6949647", "text": "def when_not_visible(timeout=::PageObject.default_element_wait)\n when_present(timeout)\n element.wait_while(timeout: timeout, message: \"Element still visible after #{timeout} seconds\", &:visible?)\n end", "title": "" }, { "docid": "59b1ce580776743fa520acbd45745a96", "score": "0.6949647", "text": "def when_not_visible(timeout=::PageObject.default_element_wait)\n when_present(timeout)\n element.wait_while(timeout: timeout, message: \"Element still visible after #{timeout} seconds\", &:visible?)\n end", "title": "" }, { "docid": "2db9a8a16c4eb66832baa6d573099663", "score": "0.69260275", "text": "def click_wait_until_displayed(element, timeout, element_waiting_for, arg = nil, second_arg = nil)\n Log.message(\"Clicking and wait until element #{element_waiting_for.element_id} present >>\")\n\n click(element, arg)\n wait_until_element_displayed(element_waiting_for, timeout, second_arg)\n end", "title": "" }, { "docid": "f12745bdc76f0a6b1c5ffcad3804fe36", "score": "0.69035316", "text": "def wait_for_element_present(web_element)\n Selenium::WebDriver::Wait.new(:timeout => 60).until {web_element}\n end", "title": "" }, { "docid": "9dbf57f25cb4bba19599f31e370b61a2", "score": "0.68682325", "text": "def wait_until_element_displayed(element, timeout, arg = nil)\n Log.message('Waiting until element displayed >>')\n\n if timeout.instance_of?(Integer) && element.instance_of?(ElementLocator)\n Selenium::WebDriver::Wait.new(timeout: timeout).until { displayed?(element, arg, false) }\n elsif !timeout.instance_of?(Integer) && element.instance_of?(ElementLocator)\n Selenium::WebDriver::Wait.new(timeout: 10).until { displayed?(element, arg, false) }\n Log.warning('Param <timeout> is not [Integer] ---Ignored and default used')\n else\n Log.error('Param <element> is not [ElementLocator] ---Ignored')\n end\n end", "title": "" }, { "docid": "f6f006acb9732608f3c24087e199c798", "score": "0.684812", "text": "def wait_for_element(element)\n wait = Selenium::WebDriver::Wait.new(timeout: 60)\n wait.until { find_element(element) }\n end", "title": "" }, { "docid": "f6f006acb9732608f3c24087e199c798", "score": "0.684812", "text": "def wait_for_element(element)\n wait = Selenium::WebDriver::Wait.new(timeout: 60)\n wait.until { find_element(element) }\n end", "title": "" }, { "docid": "d178e231c6ed8a80108af4fabbb0af13", "score": "0.68257517", "text": "def visible?\n calabash_proxy.when_element_exists(selector, timeout: 5, action: lambda { return true })\n rescue\n false\n end", "title": "" }, { "docid": "6c8a200b986ac0bc80c5e87dcd9d6107", "score": "0.6815491", "text": "def wait_for_element_present(element)\n assert !60.times{ break if (is_element_present(element) rescue false); sleep 1 }\n end", "title": "" }, { "docid": "67a4e04697fb230517e54144a31e66c1", "score": "0.6770016", "text": "def wait_for_dom(dom_finder: nil)\n Timeout.timeout(Capybara.default_max_wait_time) do\n loop until element_visible?(dom_finder)\n end\n end", "title": "" }, { "docid": "cb165d46fa5137753c7ea8798b771ece", "score": "0.6767558", "text": "def expected_element_visible(element_name, timeout=Capybara.default_wait_time)\n define_method(\"has_expected_element_visible?\") do\n expect(self.send(\"#{element_name}_element\")).to be_visible\n end\n end", "title": "" }, { "docid": "272129522f17ffe217421eefa44bb794", "score": "0.676039", "text": "def wait_for_element_to_present(locator, timeout=60000)\r\n timeout = timeout.to_i / 1000\r\n flag = false\r\n for wait_time in 1..timeout\r\n if is_element_present(locator)\r\n flag = true\r\n break\r\n end\r\n sleep 1\r\n end\r\n return flag\r\n end", "title": "" }, { "docid": "9cca42866e612a1f90dbf6d3e16efabe", "score": "0.672695", "text": "def wait_till_element_not_visible(element_name, n_retry = 3)\n dbg_msg('info',\"Wait till element #{element_name} is NOT visible\")\n wait_for_visibility(element_name, false, n_retry)\n end", "title": "" }, { "docid": "d25c8d0fc95e1244db7755b65edbaec9", "score": "0.66709405", "text": "def wait_for_element(options = {})\n puts \"#{method_name}(#{options.inspect})\" if @@debug\n index = 0\n if(options[:index])\n index = options[:index]\n end\n if(options[:timeout])\n timeout = options[:timeout]\n options.delete(:timeout)\n else\n timeout = @@timeout\n end\n refresh_screen\n start_time = Time.now\n until(element_exists?(options)) do\n if Time.now - start_time > timeout\n flunk(\"Timed out after #{timeout} seconds\\n\")\n end\n refresh_screen\n sleep 0.1\n end\n get_all_elements(options)[index]\n end", "title": "" }, { "docid": "616ab446bbfd82550b79e4c29200b04f", "score": "0.66411984", "text": "def wait_for check = :visible?, *args, &block\n wait :for => block, :until => [check, *args]\nend", "title": "" }, { "docid": "339b49c48a2ad7d713a2ebd3193eb852", "score": "0.66325545", "text": "def when_not_visible(timeout=5)\n Object::Watir::Wait.while(timeout, \"Element still visible after #{timeout} seconds\") do\n visible?\n end\n self\n end", "title": "" }, { "docid": "309e7d3b863a2418d0b793d9082b43ab", "score": "0.66281724", "text": "def wait_for_screen(timeout_duration: 25)\n wait_for_elements_exist(trait, :timeout=>timeout_duration)\n end", "title": "" }, { "docid": "6c6c2da1b077b9400b4f5863999fc3cb", "score": "0.66076654", "text": "def when_not_visible(timeout = ::PageObject.default_element_wait)\n wait = Object::Selenium::WebDriver::Wait.new(timeout: timeout, message: \"Element still visible in #{timeout} seconds\")\n wait.until do\n !root.visible?\n end\n self\n end", "title": "" }, { "docid": "dfe14895660ed3b29566e55c92e1300f", "score": "0.66065246", "text": "def wait_to_disappear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and !element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end", "title": "" }, { "docid": "a851df14822f59e433c5fac6e9d24c42", "score": "0.66024595", "text": "def wait_for_visibility(is_visible, timeout = TIMEOUT)\n max_time = Time.now + timeout\n\n while Time.now < max_time\n begin\n yield\n return\n rescue Selenium::WebDriver::Error::InvalidElementStateError,\n Selenium::WebDriver::Error::StaleElementReferenceError => e\n # These exceptions are unrelated to visibility\n puts \"Swallowing error waiting for visibility #{is_visible} and saw #{e.message}\"\n rescue Selenium::WebDriver::Error::ElementNotVisibleError,\n Selenium::WebDriver::Error::NoSuchElementError => e\n return unless is_visible\n # We're waiting for the element to be visible and we get an element not found keep waiting\n puts \"Swallowing error waiting for visibility #{is_visible} and saw #{e.message}\"\n end\n sleep(POLL_INTERVAL)\n end\n\n # Throw exception if our block didn't get evaluated as expected in the specified timeout period\n raise Error::WaitExpiredException, \"Wait expired waiting for element visibility #{is_visible}\"\n end", "title": "" }, { "docid": "ddc23e249fc4dde8cedeee65f50875f2", "score": "0.6588257", "text": "def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end", "title": "" }, { "docid": "4b761b815bf94e7e036a3a8a66d7d472", "score": "0.6588078", "text": "def wait_until(timeout=::PageObject.default_element_wait, message=nil, &block)\n element.wait_until(timeout: timeout, message: message, &block)\n end", "title": "" }, { "docid": "4b761b815bf94e7e036a3a8a66d7d472", "score": "0.6588078", "text": "def wait_until(timeout=::PageObject.default_element_wait, message=nil, &block)\n element.wait_until(timeout: timeout, message: message, &block)\n end", "title": "" }, { "docid": "01ecff459eb4851c2c62963832818c1a", "score": "0.65878", "text": "def wait_for_clickable_element(locator)\n $wait2 = Selenium::WebDriver::Wait.new(:timeout => 10)\n\n $elementx = $wait2.until { $driver.find_element(locator) }\n $wait2.until { $elementx.displayed? }\n $wait2.until { $elementx.enabled? }\n\n return $elementx\nend", "title": "" }, { "docid": "129f5008c8ed9cee13784f3e368e479a", "score": "0.65764076", "text": "def wait_fade_in(model)\n web_el = view_for(model).root_el\n self.class.wait_for { web_el.css_value('opacity').to_i == 1 }\n end", "title": "" }, { "docid": "f38eff576d4afb6ef1dd0ea7d112de58", "score": "0.6557845", "text": "def wait_for_element(id, name, time)\n wait = Selenium::WebDriver::Wait.new(:timeout => time)\n wait.until {@driver.find_element(id => name) }\nend", "title": "" }, { "docid": "859837cfe465a67b68e553372da299c8", "score": "0.6548916", "text": "def results_loaded?\r\n # Watir::Wait.until { emc_loading('loading').present? }\r\n sleep 2\r\n emc_loading('loading').wait_while_present \r\n\r\n end", "title": "" }, { "docid": "2c7bed0b077cdf7bea9fdb92d106d00b", "score": "0.6536117", "text": "def wait_until_elements_text_is_displayed(element, text)\n wait_until_element_is_displayed(element)\n stored_text = get_element_text(element)\n expect(stored_text).to include(text.to_s)\nrescue Selenium::WebDriver::Error::TimeoutError\n raise_with_new_message \"Element text is not displayed\"\nend", "title": "" }, { "docid": "8a439ba820543667a0e1d0599cb7f440", "score": "0.6534486", "text": "def waitLoading\r\n puts \"Loading data ...\"\r\n\r\n self.browser.div(:xpath => \"//div[@class='temp-container']/div[@class='placeholder-loader' and not (@id='interviewCount')]\").wait_while_present\r\n end", "title": "" }, { "docid": "8a439ba820543667a0e1d0599cb7f440", "score": "0.6534486", "text": "def waitLoading\r\n puts \"Loading data ...\"\r\n\r\n self.browser.div(:xpath => \"//div[@class='temp-container']/div[@class='placeholder-loader' and not (@id='interviewCount')]\").wait_while_present\r\n end", "title": "" }, { "docid": "2eef0ee0f0720b80a691f11a76cb8b14", "score": "0.6529905", "text": "def displayed?(*args)\n wait_until_displayed(*args)\n rescue SitePrism::TimeoutError\n false\n end", "title": "" }, { "docid": "1708edb8a1324475eaae885761e1a2b6", "score": "0.6520987", "text": "def make_visible\n ta_request.click\n wait_until_ta_request_visible\n end", "title": "" }, { "docid": "37b745c7566ec1768c429686390f4398", "score": "0.651932", "text": "def loaded?\r\n # Watir::Wait.until { emc_loading('loading').present? }\r\n sleep 3\r\n emc_loading('loading').wait_while_present\r\n end", "title": "" }, { "docid": "e641b1950d8c85ec8f4297b2badffe0c", "score": "0.6512465", "text": "def wait_for_disable_element(obj)\r\n # exists? – Returns whether this element actually exists.\r\n # present? – Returns true if the element exists and is visible on the page , equivalent to visible and exists\r\n # visible? – If any parent element isn’t visible then we cannot write to the element. The only reliable way to determine this is to\r\n # obj.exists?\r\n obj.present?\r\n obj.wait_until_present\r\n\r\nend", "title": "" }, { "docid": "cd8dace184d36dafab5382cdeffd72ff", "score": "0.6511751", "text": "def visible?\n element.isVisible\n end", "title": "" }, { "docid": "cd8dace184d36dafab5382cdeffd72ff", "score": "0.6511751", "text": "def visible?\n element.isVisible\n end", "title": "" }, { "docid": "75964f3d2dd69b2ebe35b43d929cfade", "score": "0.65073985", "text": "def when_present(timeout=5)\n @element.wait_until_present(timeout)\n self\n end", "title": "" }, { "docid": "a6d82ad4192a121afd1b2f7dbf39ce07", "score": "0.65042084", "text": "def wait_until(timeout=nil)\n Log.debug('Waiting for new element...')\n timeout = Gridium.config.element_timeout if timeout.nil?\n ElementVerification.new(self, timeout, fail_test=true)\n end", "title": "" }, { "docid": "e4f30c29875e13a469b798cfb2cea871", "score": "0.6488595", "text": "def verify_visible element_locator\r\n command 'verifyVisible', element_locator\r\n end", "title": "" }, { "docid": "f885528bed591ed830c3db05a0e637e8", "score": "0.64882237", "text": "def wait_detail_screen\n print \"wait detail screen \\n\"\n sleep(10)\n wait_for_elements_exist(trait, timeout: 60)\n print \"in detail screen \\n\"\n self\n end", "title": "" }, { "docid": "5970f9530582563cbf093fc1398cefd7", "score": "0.64808404", "text": "def wait_for_search_result_section_to_load\n wait_for_element_present(SEARCH_RESULT_SECTION)\n end", "title": "" }, { "docid": "46eb22a94c0613d67d2a50cabe690305", "score": "0.6479501", "text": "def wait_for_disable_element(obj)\n # exists? – Returns whether this element actually exists.\n # present? – Returns true if the element exists and is visible on the page , equivalent to visible and exists\n # visible? – If any parent element isn’t visible then we cannot write to the element. The only reliable way to determine this is to\n # obj.exists?\n obj.present?\n obj.wait_until_present\n\nend", "title": "" }, { "docid": "c3ecef7c4bc72cb436fa17000fcf2f15", "score": "0.6468852", "text": "def wait_for_spinner\n begin\n spinner = @browser.div(id: 'opaqueOverlay')\n Watir::Wait.until(20, \"Spinner #{spinner.attribute_value('class')} is still visible. Page is loading...\") do\n !spinner.present?\n end\n rescue Watir::Exception::UnknownObjectException => error\n $log.error(\"Rescued exception #{error.class}: #{error.message}\")\n $log.info(\"Unable to locate the spinner. Perhaps it's gone. Proceed...\")\n end\n\n end", "title": "" }, { "docid": "04c7ba38989c2148c83ea7acf6163e9e", "score": "0.64642", "text": "def wait(target:, timeout: 30)\n wait = Selenium::WebDriver::Wait.new(timeout: timeout)\n wait.until { @driver.find_element(:id, target).displayed? }\n end", "title": "" }, { "docid": "4ccb4d6d5843076396728e7621db0f9b", "score": "0.6460023", "text": "def wait_for_progress\n sleep(2)\n wait_for(timeout: 10) { element_does_not_exist \"* marked:'#{loading_screen}'\" }\n end", "title": "" }, { "docid": "25067ff9d718073694de5af2e8848911", "score": "0.64594287", "text": "def wait_for_object location_param\n \tWatir::Wait.until {\n \[email protected](xpath: location_param).visible?\n \t}\n \tend", "title": "" }, { "docid": "eaa1c70eb6f5072cb32e9df06c69552b", "score": "0.6435631", "text": "def wait_until(timeout: nil)\n Log.debug('Waiting for new element...')\n timeout = Gridium.config.element_timeout if timeout.nil?\n ElementVerification.new(self, timeout, fail_test: true)\n end", "title": "" }, { "docid": "e53f97e1c888ca0d9fa9fbe0f6b280cc", "score": "0.6425252", "text": "def wait_for_element(locator)\n wait_until do\n locator.present? && locator_is_enabled?(locator)\n end\n end", "title": "" }, { "docid": "23b108d8e5768dfde46354f936ed630f", "score": "0.6414887", "text": "def wait_for_page_to_load\n @wait_on.each { |element| wait_for_element(element) }\n end", "title": "" }, { "docid": "91a1063fe8746ee4a3410e98d77d6328", "score": "0.64141303", "text": "def wait_for_elements\n @wait_on << :title\n end", "title": "" }, { "docid": "f7773b9d30cc1e28066e8ebb84a1a12f", "score": "0.64001274", "text": "def wait_for_enabled\n wait_for_widget_enabled\n end", "title": "" }, { "docid": "e10c5357a83bed1b836030c21614c8c4", "score": "0.6399114", "text": "def element_waiter locator\n wait_until { element_exists? locator }\n end", "title": "" }, { "docid": "6a891d75c1271a6ed58415ec70655d92", "score": "0.6395301", "text": "def wait_for_text(text)\n Timeout.timeout(Capybara.default_max_wait_time) do\n loop until text_visible?(text)\n end\n end", "title": "" }, { "docid": "8f51316645a45faac97acfeffa54d2d9", "score": "0.6390531", "text": "def is_element_displayed(access_type,access_name)\n\tWAIT.until{$driver.find_element(:\"#{access_type}\" => \"#{access_name}\")}.displayed?\nend", "title": "" }, { "docid": "c266c73481ed488eced182221423f7c3", "score": "0.6389913", "text": "def wait_until(timeout=Druid.default_element_wait, message=nil, &block)\n element.wait_until(timeout: timeout, message: message, &block)\n end", "title": "" }, { "docid": "2aec1d998664581e34edf34228edf559", "score": "0.63814855", "text": "def wait_for_elements\n super\n end", "title": "" }, { "docid": "b5594532576c349c1249c289c6649b21", "score": "0.63742125", "text": "def wait_for_ajax_element(obj)\r\n# Add gem watir-dom-wait\r\n obj.wait_until(&:dom_changed?).present?\r\n obj.wait_until(&:dom_changed?).enabled?\r\n obj.wait_while_present # For AJAX and Javascript loads\r\n\r\nend", "title": "" }, { "docid": "d8fa12aaab0fd580ea3c5fae90b7bdf9", "score": "0.63678384", "text": "def wait_for_screen(timeout_duration: 30, sleep_duration: 0, retry_frequency: 0.3)\n wait_element(trait, sleep_duration: sleep_duration, timeout_duration: timeout_duration, retry_frequency: retry_frequency)\nend", "title": "" }, { "docid": "e3201e4635b093fcca174707818ab4fc", "score": "0.63643456", "text": "def ****_wait_gone(selector, element, timeout = SHORT_WAIT)\n begin\n ****_wait_true(timeout) {****_expect_not_displayed?(selector, element, timeout)}\n rescue Exception => e\n raise e.message\n end\nend", "title": "" }, { "docid": "c34969ef78db2e5a7a705373764a1e9d", "score": "0.6358579", "text": "def wait\r\n #ff = FireWatir::Firefox.new\r\n #ff.wait()\r\n #puts @container\r\n @container.wait()\r\n @@current_level = 0\r\n end", "title": "" }, { "docid": "64dcd6f7e120a837891d3e3ea805b30b", "score": "0.6343433", "text": "def wait_until(timeout=5, message=nil, &block)\n Object::Watir::Wait.until(timeout, message, &block)\n end", "title": "" }, { "docid": "e96b2c6a9f537dd581a9bd75f8a073b7", "score": "0.63374203", "text": "def wait_until_loaded\n wait_for_ajax Watir.default_timeout,\"\\n#{self.class.name}: wait until loaded.\"\n # wait_for.each {|lmnt| self.send(lmnt).wait_until_present } unless wait_for.nil?\n Watir::Wait.until {wait_for.each {|lmnt| self.send(lmnt).present?}} unless wait_for.nil?\n true\n end", "title": "" }, { "docid": "7018a4955a2f24d242f26406980421c4", "score": "0.6327642", "text": "def is_element_present?(locator, options={:visible => true})\n Capybara.default_max_wait_time = 3\n if page.has_selector?(locator, options)\n begin\n return true\n ensure\n Capybara.default_max_wait_time = 40\n end\n else\n return false\n end\n end", "title": "" }, { "docid": "2751714d5a2092c1030a15e266155201", "score": "0.6318131", "text": "def wait_for_element(id, waitTime)\n\t\twait_for_elements_exist [\"* marked:'#{id}'\"], timeout: waitTime\n\tend", "title": "" }, { "docid": "5fb6b479fae26b11d2ec52afccef0a6f", "score": "0.6309098", "text": "def visible?\n existence_check\n !@automation_element.current.is_offscreen\n end", "title": "" } ]
0ae418b08e754c9fa8c903215f803d0d
Registers the item in the Ready Menu.
[ { "docid": "79fec96eb713157663a216f7e2920bb7", "score": "0.5801691", "text": "def pbRegisterItem(item)\n if item.is_a?(String) || item.is_a?(Symbol)\n item = getID(PBItems,item)\n end\n if !item || item<1\n raise ArgumentError.new(_INTL(\"Item number {1} is invalid.\",item))\n return\n end\n registeredlist = self.registeredItems\n registeredlist.push(item) if !registeredlist.include?(item)\n end", "title": "" } ]
[ { "docid": "07e780b827dc2b63777f2147ecbad460", "score": "0.58742607", "text": "def register_state_item(item)\n name = item.name\n if @state_items[name]\n raise \"Duplicate item name: #{name}! Failing!\"\n end\n @state_items[name] = item\n if item.zone?\n @zones.push(item)\n end\n if @finished_init\n send_notification(type: ::Demiurge::Notifications::NewItem, zone: item.zone_name, location: item.location_name, actor: name)\n end\n item\n end", "title": "" }, { "docid": "7f9477d2e13fb7a1b1aa91c98b84f684", "score": "0.58205754", "text": "def do_ready_state( item )\n @proxy.do_ready_state( validate_item( item ) )\n end", "title": "" }, { "docid": "8600093d47385bf0b530464e82330007", "score": "0.55699074", "text": "def add(item)\r\n fail \"missing item\" if item.nil?\r\n fail \"item is not active, it cannot be put in your wish list\" unless item.is_active?\r\n\r\n self.items << item\r\n item.add_observer(self)\r\n end", "title": "" }, { "docid": "be8acdbb04e9dd89751162c2d63db2ed", "score": "0.5541472", "text": "def notify_ready\n notify(\"READY=1\")\n end", "title": "" }, { "docid": "4dcb6ce5d321a83393ecf6605317c03b", "score": "0.54757136", "text": "def on_item_ok\n @item = @item_window.item\n BattleManager.actor.input.set_item(@item.id)\n action = BattleManager.actor.input\n case @item.target_type[0]\n when :one\n select_target_selection\n when :all\n BattleManager.actor.input.set = SES::TargetManager.make_targets(action)\n when :rand\n targets, set = [], SES::TargetManager.make_targets(action)\n (@item.target_type[1][0] + rand(@item.target_type[1][1])).times do\n targets << set[rand(set.size)]\n end\n BattleManager.actor.input.set = set\n else\n @item_window.hide\n next_command\n end\n $game_party.last_item.object = @item\n end", "title": "" }, { "docid": "44dbb9045d071f6f29568022ee390a4c", "score": "0.54519844", "text": "def on_item_ok\n SceneManager.call(Scene_Book)\n SceneManager.scene.set_book(Bestiary.new(@item_window.item.id))\n end", "title": "" }, { "docid": "209bdd05bd5eadc218a5d6ff335c5940", "score": "0.5450027", "text": "def items\n @new_register\n end", "title": "" }, { "docid": "da55d8227d7e03ba4c523ac04d25c2cf", "score": "0.5441483", "text": "def add_item(item)\n @menu[item.name] = item\n return self\n end", "title": "" }, { "docid": "e80107d61583dd9fd380f8faf4abb0ad", "score": "0.5418703", "text": "def register_choice\n end", "title": "" }, { "docid": "d5fbc3084cdf4983dee3dc84444a90a0", "score": "0.5354801", "text": "def register\n @is_registered = true\n self\n end", "title": "" }, { "docid": "71d09f26c54d4b50554f9515d7a1c685", "score": "0.5348596", "text": "def add_item(item)\n if @item\n log(\"Item is already equipped in EquipSlot.\")\n return\n end\n @item = item\n return\n end", "title": "" }, { "docid": "b22b1f57591662c4e629a22428082a7c", "score": "0.53385586", "text": "def register_ui thing\n @uis << thing\n end", "title": "" }, { "docid": "8f87441c46d7848d096b735a08a18d65", "score": "0.52734053", "text": "def send_ready_signal()\n do_send(Erlang::Tuple.new([Erlang::Atom.new('ready')]))\n end", "title": "" }, { "docid": "ceeeec1f7d72e4c2e95911a9c06fafab", "score": "0.5251795", "text": "def register(controller_name, item)\n @items[controller_name] ||= []\n @items[controller_name] << item\n end", "title": "" }, { "docid": "6c8d34711d509cc0fb42e7f173270ff6", "score": "0.5247681", "text": "def menuitem(title, options={}, &block)\n options[:id] = \"mitem-#{rand.to_s.split('.').last}\" if options[:id].nil?\n options[:title] = title\n @menuinfo[menu_number][:menuitems] << options\n nil\n end", "title": "" }, { "docid": "d0118f2978d980a6b628cd0b950a6fb9", "score": "0.522581", "text": "def register_menu(section)\n Optopus::Menu.instance.register_section(section)\n end", "title": "" }, { "docid": "79229c0f39858a2e7ed467da258ac21a", "score": "0.51929426", "text": "def register( *args )\n LOG.debug \"#{self} is attempting to register #{args.inspect}\"\n item = create_item( *args )\n unless item.respond_to?( :name )\n raise TypeError, \"Return value of #create_item must respond to #name, \"+\n \"but was a #{item.class.name}.\"\n end\n @lock.synchronize do\n @registry.store( item.name, item)\n LOG.info \"[r] Registered #{item.name} (#{item}) in #{self}.\"\n end\n notify_observers(:add, item)\n return item\n end", "title": "" }, { "docid": "3c412b2268d44ca8035f9bf86fcef737", "score": "0.51862544", "text": "def register(key, &block)\n raise ArgumentError, \"block required\" unless block_given?\n @items[key] = block\n end", "title": "" }, { "docid": "a96e76cbd6a829c4b3c184badb6dec4a", "score": "0.51769805", "text": "def status_bar_item\n @status_bar_item ||= NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength)\n @status_bar_item.target = self\n @status_bar_item.action = :\"item_clicked:\"\n @status_bar_item\n end", "title": "" }, { "docid": "a1d4f20ba641753e0fa62be5b0155014", "score": "0.51703376", "text": "def add_item(item)\n @chores << item\n end", "title": "" }, { "docid": "d62ebfd61d16e2f36f34b2fda04bf1c3", "score": "0.5169254", "text": "def set_bar_menu_item\n @bar_menu_item = BarMenuItem.find(params[:id])\n end", "title": "" }, { "docid": "a3cf327f89fe3e85344a6fac28f9bfa7", "score": "0.51623094", "text": "def set_menu_item\n @menu_item = Menu::Item.find(params[:id])\n end", "title": "" }, { "docid": "724714af9603746ee9f1f86fbf267755", "score": "0.5137657", "text": "def activate_item(position)\r\n self.items.fetch(position).activate\r\n end", "title": "" }, { "docid": "181378e120950268efb74cb22379ebf6", "score": "0.5135633", "text": "def pbUseKeyItem\n # TODO: Remember move order\n moves = [:CUT,:DEFOG,:DIG,:DIVE,:FLASH,:FLY,:HEADBUTT,:ROCKCLIMB,:ROCKSMASH,\n :SECRETPOWER,:STRENGTH,:SURF,:SWEETSCENT,:TELEPORT,:WATERFALL,\n :WHIRLPOOL]\n realmoves = []\n for i in moves\n move = getID(PBMoves,i)\n next if move==0\n for j in 0...$Trainer.party.length\n next if $Trainer.party[j].egg?\n if $Trainer.party[j].hasMove?(move)\n realmoves.push([move,j]) if Kernel.pbCanUseHiddenMove?($Trainer.party[j],move,false)\n break\n end\n end\n end\n realitems = []\n for i in $PokemonBag.registeredItems\n realitems.push(i) if $PokemonBag.pbHasItem?(i)\n end\n if realitems.length==0 && realmoves.length==0\n Kernel.pbMessage(_INTL(\"An item in the Bag can be registered to this key for instant use.\"))\n else\n $game_temp.in_menu = true\n $game_map.update\n sscene = PokemonReadyMenu_Scene.new\n sscreen = PokemonReadyMenu.new(sscene) \n sscreen.pbStartReadyMenu(realmoves,realitems)\n $game_temp.in_menu = false\n end\nend", "title": "" }, { "docid": "99b8653363969354627838158c6d20f0", "score": "0.5131632", "text": "def init_menu\n @menus.set_selected(\"about\")\n end", "title": "" }, { "docid": "e8d878afa0fab2f5fd73cad2f5c03e84", "score": "0.51291895", "text": "def make_ready\n \tself.ready = true\n \tself.save\n end", "title": "" }, { "docid": "1db7c8dcdb3646c822a07d7381997816", "score": "0.51198834", "text": "def on_mixitem_ok\n @mix_window.add_item\n if @mix_window.mix_done?\n @mix_window.hide\n determine_mix_target\n else\n @mix_window.activate\n end\n end", "title": "" }, { "docid": "b62a9be070b3f65ab5ab771fb445ddbe", "score": "0.51177126", "text": "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "title": "" }, { "docid": "b62a9be070b3f65ab5ab771fb445ddbe", "score": "0.51177126", "text": "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "title": "" }, { "docid": "b62a9be070b3f65ab5ab771fb445ddbe", "score": "0.51177126", "text": "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "title": "" }, { "docid": "6554642e8092e60e7126953250b38d5d", "score": "0.5102748", "text": "def setup_item_choice(params)\r\n $game_message.item_choice_variable_id = params[0]\r\n end", "title": "" }, { "docid": "b531acca103098d59f7065f1ff0c0eb5", "score": "0.5092944", "text": "def update_item\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to menu screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the item window\r\n @item = @item_window.item\r\n # If not a use item\r\n unless @item.is_a?(RPG::Item)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # If effect scope is an ally\r\n\r\n puts \"User chose item #{ItemService.item_sym_of(id)}\"\r\n @pedestal.pedestal_item_id = id\r\n\t\t\t$game_party.gain_item(rmxp_item_id, -1)\r\n\r\n SetupEventService.new.setup!\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n end", "title": "" }, { "docid": "1bbf42defeefdaebdf8939bd7ed55e55", "score": "0.5078974", "text": "def activate_item\n @p.activate_item(self)\n end", "title": "" }, { "docid": "4e3abdd0b63857d9a15654b6b6de6638", "score": "0.5074679", "text": "def phase3_command_item\r\n # Set action\r\n @active_battler.current_action.kind = 2\r\n # Start item selection\r\n start_item_select\r\n end", "title": "" }, { "docid": "2c72bbaf26484d4c543b5f1060af0230", "score": "0.50742954", "text": "def take_item(command)\n if @current_room.has_item?(command) # item isn't in current room\n self.new_current_item(command)\n # Remove from room and add to backpack\n @current_room.remove_item(command)\n @player.pick_up(command)\n puts \"\\nYou have picked up a #{@current_item.name}\"\n puts @current_item.collect_description + \"\\n\\n\"\n else\n puts \"This item isn't here\\n\"\n end\n end", "title": "" }, { "docid": "c5ba82a6cdcc46ade08a6f006e5e0b31", "score": "0.50461704", "text": "def set_item\n @item = Item.active.find(params[:id])\n end", "title": "" }, { "docid": "f3a405f0b28df7a1551b6e40fd2c5212", "score": "0.5033665", "text": "def create\n @item = Item.new(item_params)\n# authorize @item\n @item.user = current_user \n if @item.save\n flash[:notice] = \"\\\"#{@item.name}\\\" was added to your registry.\"\n else\n flash[:error] = \"There was a problem adding the item to your registry. Please try again.\"\n end\n redirect_to user_registry_path(current_user.link_id)\n end", "title": "" }, { "docid": "9abc8be193ebe5932f180e46037da069", "score": "0.5009825", "text": "def add_menu_signal(&block)\n @menu_signal << block\n end", "title": "" }, { "docid": "d6bd89748657b669423672bd86f1dfe9", "score": "0.50097245", "text": "def on_ready(&block)\n block_given? ? @_on_ready = block : @_on_ready\n end", "title": "" }, { "docid": "60639b2f089bab76deeeef34d4270fc0", "score": "0.50070566", "text": "def enable(item)\n run(item)\n end", "title": "" }, { "docid": "ad65210082434754332ae708c5d32bdc", "score": "0.50044173", "text": "def set_item\n # 出品機能未実装のため仮置き\n @item = Item.find(params[:id])\n end", "title": "" }, { "docid": "6701cf0d3eef78f628b7878368daa1f0", "score": "0.50033", "text": "def set_item(item)\n set_text(item ? item.description : \"\")\n if item != @item\n @item = item\n refresh\n end\n end", "title": "" }, { "docid": "1f962d14f3d341ef6f13138e71ad1ce6", "score": "0.5002698", "text": "def insert_menu_item(menu, item, idx)\n menu.insert(idx, item)\n end", "title": "" }, { "docid": "4e7b68c1527ea9c28c2e31ceabaf95ac", "score": "0.49974096", "text": "def notify_ready\n if state == :smoking\n puts \"#{name} says: I'm good on smokes, thanks\"\n else\n transition :procuring\n end\n end", "title": "" }, { "docid": "c9b361a8db06f9b375c5bd686a81025a", "score": "0.49776328", "text": "def evaluate_ready_status(item = nil, symbol: true, **added)\n if (value = added[:ready_status]).blank?\n data = item_fields(item, added)\n value = ready?(data) ? :ready : :missing\n end\n symbol ? value.to_sym : ReadyStatus(value)\n end", "title": "" }, { "docid": "cba739f4f9c5d4ee9b73d68a1871cf23", "score": "0.49769324", "text": "def register_node\n @registered = @registry.register_node(system)\n end", "title": "" }, { "docid": "5d54205c6c6c7fe1415609418673bb2c", "score": "0.49764302", "text": "def when_ready(&block)\n handle :ready, &block\n end", "title": "" }, { "docid": "8d05489a0da1c75f5800fc9242a83663", "score": "0.49497753", "text": "def offer_an_item(item)\r\n item.status = true\r\n end", "title": "" }, { "docid": "9aa8136ab8510e1084551f928a77155b", "score": "0.4947508", "text": "def send_ready(subs)\n self.send({\n msg: 'ready',\n subs: subs\n })\n end", "title": "" }, { "docid": "abad2d661ea47fe909586af3e522ca60", "score": "0.4941697", "text": "def press_menu\n driver.pressQuickMenuItem(text, true);\n end", "title": "" }, { "docid": "b2e5e9ef283b8e8453a1bcb704fe31ad", "score": "0.49416775", "text": "def addMenuItem _obj, _args\n \"_obj addMenuItem _args;\" \n end", "title": "" }, { "docid": "2f53175aee2e3eb51d04fdd906f5b069", "score": "0.49289915", "text": "def send_ready_notification\n\n end", "title": "" }, { "docid": "fee9310e451e3bec6c9ea9dc938f4b2f", "score": "0.49284074", "text": "def on_ready\n end", "title": "" }, { "docid": "7b39c085b3a1a2a56ed8f4809fe186ab", "score": "0.4922521", "text": "def define_menu_items\n add_menu_item(\"Http request\", 1)\n add_menu_item(\"Http status\", 2)\n add_menu_item(\"Sourceadress\", 3)\n add_menu_item(\"Timestamp\", 4)\n end", "title": "" }, { "docid": "403026049b3145e49125c96992b0a06e", "score": "0.4919132", "text": "def set_needed_item\n @needed_item = NeededItem.find(params[:id])\n end", "title": "" }, { "docid": "7e26a5f95d66989f27d3a3ac5cce7657", "score": "0.49107048", "text": "def set_menu_item\n @menu_item = @menu.menu_items.find(params[:id])\n end", "title": "" }, { "docid": "aa56cbc6d77300bf0a2c386a23f3b988", "score": "0.4908606", "text": "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "title": "" }, { "docid": "aa56cbc6d77300bf0a2c386a23f3b988", "score": "0.4908606", "text": "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "title": "" }, { "docid": "8f13fb3ed578fbec28adfb2af8fe5109", "score": "0.4908037", "text": "def init_status_bar(menu)\n\t status_bar = NSStatusBar.systemStatusBar\n\t status_item = status_bar.statusItemWithLength(NSVariableStatusItemLength)\n\t status_item.setMenu menu \n\t status_item.setTitle \"虾米同步状态\"\n\n\t @status_item = status_item\n\tend", "title": "" }, { "docid": "6917430e9b6fc5556a0955bb4e73ec59", "score": "0.4907112", "text": "def after_item(item)\n item\n end", "title": "" }, { "docid": "3b254badb9d0df35ab433b3dc843bb71", "score": "0.4893902", "text": "def add_task_submenu\n\t\tputs \"Enter task to add to list:\"\n\t\tchoice = get_choice\n\t\t@todo_list.add_item choice\n\t\tprint_menu\n\tend", "title": "" }, { "docid": "456d14c69a5cc65399bf6b7652a61d97", "score": "0.48822182", "text": "def init_menu\n @menus.set_selected(\"dashboard\")\n end", "title": "" }, { "docid": "7e5e2b467f17bd4062a8f01fad5bfe7f", "score": "0.48801762", "text": "def on_ready(&handler)\n @on_ready_handler = handler\n end", "title": "" }, { "docid": "1165fe742c79fbe8ac36073259787b88", "score": "0.4858889", "text": "def <<(item)\n add_item(item)\n end", "title": "" }, { "docid": "379b67d2550304e2327db01b956f85b2", "score": "0.4855263", "text": "def define_menu_items\n add_menu_item(\"File storage.\", 1)\n add_menu_item(\"Sqlite3.\", 2)\n end", "title": "" }, { "docid": "1a2e117330611764982def67d2b00dad", "score": "0.48488563", "text": "def add_item(item)\n\t\[email protected](item)\n\tend", "title": "" }, { "docid": "c6f8f70e8ccd99f02a5a1e94b67fc11f", "score": "0.484503", "text": "def register!\n @planet.next_raid_at += Cfg.raiding_delay_random\n @planet.raid_arg = generate_arg\n CallbackManager.register_or_update(\n @planet, CallbackManager::EVENT_RAID, @planet.next_raid_at\n )\n @planet.delayed_fire(@planet, EventBroker::CHANGED,\n EventBroker::REASON_OWNER_PROP_CHANGE)\n @planet.save!\n end", "title": "" }, { "docid": "212642165bbf8bac34c9cee1e19ae42a", "score": "0.48297086", "text": "def initialize(*args)\n super\n @cur_menu = 0\n @past_menu = nil\n @items = [Item.new('New', :read_new_menu),\n Item.new('Boards', :print_board_menu),\n Item.new('Select', :select_board_menu),\n Item.new('Read', :read_board_menu)]\n @items.concat(\n %w(Post Talk Mail Diary Welcome Xyz Goodbye Help)\n .map { |name| Item.new(name) })\n # @items.concat(%w(Extra Visit InfoBBS).map { |name| Item.new(name) }))\n @items << Item.new('Admin') if term.current_user.admin?\n @items.freeze\n end", "title": "" }, { "docid": "d0c32e656ebd8e52d30a4352e03fd20f", "score": "0.48281476", "text": "def init_menu\n @menus.set_selected(\"teambox\")\n @menus.set_selected(\"licenses\")\n end", "title": "" }, { "docid": "a71b9d90e2ec16c8a8fbeac75f95d0d4", "score": "0.48276854", "text": "def ready\n @room.user_ready!(current_user)\n broadcast_ready_changed\n end", "title": "" }, { "docid": "153842c922113d42d6a8e5d768e293c0", "score": "0.4827004", "text": "def setup_status_menu # I've tried to move this to a separate class, but it just crashes, so I'll keep it here.\n LOG.debug \"Enter setup_status_menu\"\n statusbar = NSStatusBar.systemStatusBar\n status_item = statusbar.statusItemWithLength(NSVariableStatusItemLength)\n image_name = NSBundle.mainBundle.pathForResource_ofType('stretch', 'tiff')\n image = NSImage.alloc.initWithContentsOfFile(image_name)\n status_item.setImage(image) # TODO: fix the image\n status_item.setTitle(\"TEST\")\n\n menu = NSMenu.alloc.init\n status_item.setMenu(menu)\n\n # menu_item = menu.addItemWithTitle_action_keyEquivalent( \"Empty inbox once\", \"empty_inbox_once:\", '')\n # menu_item.setTarget(self) # TODO: Will with all probably be moved to another class & module\n\n menu_item = menu.addItemWithTitle_action_keyEquivalent( \"Test\", \"test:\", '') # TEST\n menu_item.setTarget(self)\n\n menu_item = menu.addItemWithTitle_action_keyEquivalent( \"Quit\", \"terminate:\", '')\n #menu_item.setKeyEquivalentModifierMask(NSCommandKeyMask)\n menu_item.setTarget(NSApp)\n\n LOG.info(\"Added status menu\")\n end", "title": "" }, { "docid": "987505c500c4898cf08aade9367a2517", "score": "0.48267516", "text": "def set_menuitem\n @menu_item = params[:action]\n end", "title": "" }, { "docid": "e33ca1479f313e8a838d64c00e3d3c1f", "score": "0.48262188", "text": "def action_item(name, options = {}, &block)\n config.add_action_item(name, options, &block)\n end", "title": "" }, { "docid": "4464ad470bae2141a17f0f5d7e8e4768", "score": "0.48121443", "text": "def define_menu_items\n add_menu_item(\"Weekly worktime.\", 1)\n add_menu_item(\"Monthly worktime.\", 2)\n add_menu_item(\"Custom worktime interval.\", 3)\n add_menu_item(\"Cancel and return to previous menu.\", 4)\n end", "title": "" }, { "docid": "6c447b6527f295a0759b0d337df59234", "score": "0.48055997", "text": "def addItem(item)\n @items << item\n end", "title": "" }, { "docid": "170eca1544a9285af949f02789a8411d", "score": "0.48016626", "text": "def createStatusBarItem\n # Create a status bar item and set it so that it gets highlighted when clicked\n @status_item = NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength).init\n @status_item.setHighlightMode(true)\n\n # Note, because we're using NSVariableStatusItemLength above, THERE WILL BE\n # NOTHING DISPLAYED IN THE STATUS BAR if there is not a valid image here\n @status_item.setImage(NSImage.imageNamed \"menu_bar_icon.png\")\n @status_item.setAlternateImage(NSImage.imageNamed \"menu_bar_icon_alt.png\")\n\n # TODO: Make the icon stay highlighted when the menu is open. This can\n # likely be accomplished by following these links:\n # http://undefinedvalue.com/2009/07/07/adding-custom-view-nsstatusitem\n # http://stackoverflow.com/questions/14296522/is-there-any-way-to-highlight-the-status-bar-item-programmatically\n\n @status_item.setTarget(self) #?\n\n # Set the function to be called when the app icon is clicked\n @status_item.setAction('showHide:')\n end", "title": "" }, { "docid": "3eb2ba1c7e4325dddaf3c9c5f4779418", "score": "0.4787276", "text": "def add(item)\n item.available? ? items.create(cartable: item) : false\n release\n end", "title": "" }, { "docid": "7e28526c44c0f7fa3c0c7efb74f655af", "score": "0.47823393", "text": "def set_choice_item\n @choice_item = ChoiceItem.find(params[:id])\n end", "title": "" }, { "docid": "7ba3c2ea11ba048399083cd94e3416fa", "score": "0.4776643", "text": "def on_create\n #of course, menu options are also addable programmatically:\n add_menu(\"Execute\", drawable_ic_menu_play) do\n #some business logic here\n end \n end", "title": "" }, { "docid": "e4c44460e84375eaa571ca67d99131cb", "score": "0.4769976", "text": "def set_command_item\n @command_item = CommandItem.find(params[:id])\n end", "title": "" }, { "docid": "4bf3c9488285708848512dc449a7475c", "score": "0.47668934", "text": "def set_item(item)\n return if @item == item\n @item = item\n refresh\n end", "title": "" }, { "docid": "4bf3c9488285708848512dc449a7475c", "score": "0.47668934", "text": "def set_item(item)\n return if @item == item\n @item = item\n refresh\n end", "title": "" }, { "docid": "4a3c042e75689ce5d7371c5e44fa57ad", "score": "0.47661248", "text": "def define_menu_items\n check_attributes\n @menu_description.concat(\"\\n #{set_boundaries}\")\n add_menu_item(\"All tasks to a person in the given #{time_string}.\", 1)\n add_menu_item(\"Worktime of a person in that #{time_string}.\", 2)\n add_menu_item(\"All tasks running during the interval.\", 3)\n add_menu_item(\"Write Query result to csv-file.\", 4)\n add_menu_item(\"Cancel and return to previous menu.\", 5)\n end", "title": "" }, { "docid": "d97f59478ba31f7d128473b7b6147778", "score": "0.4765824", "text": "def create_menu\n @tk_root.tk_item.native_item.bind('Command-r', -> { main_component.execute_sql(nil) })\n end", "title": "" }, { "docid": "e2310e3f4eb737a81b20f51d608b1121", "score": "0.47645706", "text": "def add_item( klass, name, action )\n fail SyntaxError, \"Undefined class #{klass} found in #{self}\" unless library_defined?(klass)\n library_handler[klass].define(name, action) \n end", "title": "" }, { "docid": "c7bd8811d8f384a509a94a0f60cf2ecf", "score": "0.47533664", "text": "def enq item\r\n @mutex.synchronize {\r\n if not @done\r\n @tasks << item\r\n @resource.signal\r\n end\r\n not @done\r\n }\r\n end", "title": "" }, { "docid": "5fd3d685c27463b4d0ac60374374bd1c", "score": "0.47523838", "text": "def useItem?\n # to make sure duplicates are not registered at the beginning\n Input.update\n # render bitmap for item use confirmation\n bitmap = @sprites[\"confirm\"].bitmap\n bitmap.clear; bmp = pbBitmap(@path + @confirmImg)\n bitmap.blt(0, 0, bmp, bmp.rect)\n icon = pbBitmap(GameData::Item.icon_filename(@ret))\n bitmap.blt(20, 30, icon, icon.rect)\n # draw text\n drawTextEx(bitmap, 80, 12, 364, 3, GameData::Item.get(@ret).description, @baseColor, Color.new(0, 0, 0, 32))\n # select confirm message as target\n @sprites[\"sel\"].target(@sprites[\"confirm\"])\n # animate in\n 8.times do\n # slide panels into screen\n @sprites[\"confirm\"].x += @viewport.width/8\n @sprites[\"cancel\"].x += @viewport.width/8\n if @pocket\n # fade out panels\n for i in [email protected]\n @items[\"#{i}\"].opacity -= 32\n end\n end\n for i in 0...4\n @sprites[\"pocket#{i}\"].opacity -= 64 if @sprites[\"pocket#{i}\"].opacity > 0\n end\n # animate bottom items moving off screen\n @sprites[\"pocket4\"].y += 10 if @sprites[\"pocket4\"].y < @sprites[\"pocket4\"].ey + 80\n @sprites[\"pocket5\"].y += 10 if @sprites[\"pocket5\"].y < @sprites[\"pocket5\"].ey + 80\n @sprites[\"name\"].x -= @sprites[\"name\"].width/8\n @sprites[\"sel\"].update\n @scene.animateScene\n @scene.pbGraphicsUpdate\n end\n # ensure pocket name is off screen\n @sprites[\"name\"].x = -@sprites[\"name\"].width\n index = 0; oldindex = 0\n choice = (index == 0) ? \"confirm\" : \"cancel\"\n # start the main input loop\n loop do\n @sprites[\"#{choice}\"].src_rect.y += 1 if @sprites[\"#{choice}\"].src_rect.y < 0\n # process directional input\n if Input.trigger?(Input::UP)\n index -= 1\n index = 1 if index < 0\n choice = (index == 0) ? \"confirm\" : \"cancel\"\n elsif Input.trigger?(Input::DOWN)\n index += 1\n index = 0 if index > 1\n choice = (index == 0) ? \"confirm\" : \"cancel\"\n end\n # process change in index\n if index != oldindex\n oldindex = index\n pbSEPlay(\"EBDX/SE_Select1\")\n @sprites[\"#{choice}\"].src_rect.y -= 6\n @sprites[\"sel\"].target(@sprites[\"#{choice}\"])\n end\n # confirmation and cancellation input\n if Input.trigger?(Input::C)\n pbSEPlay(\"EBDX/SE_Select2\")\n break\n elsif Input.trigger?(Input::B)\n @scene.pbPlayCancelSE()\n index = 1\n break\n end\n Input.update\n @sprites[\"sel\"].update\n @scene.animateScene\n @scene.pbGraphicsUpdate\n end\n # animate exit\n 8.times do\n @sprites[\"confirm\"].x -= @viewport.width/8\n @sprites[\"cancel\"].x -= @viewport.width/8\n @sprites[\"pocket5\"].y -= 10 if index > 0\n @sprites[\"sel\"].update\n @scene.animateScene\n @scene.pbGraphicsUpdate\n end\n # refresh old UI (swap cursor to target)\n self.refresh\n # return output\n if index > 0\n @ret = nil\n return false\n else\n @index = 0 if @index == 4 && GameData::Item.get(@lastUsed).id_number == 0\n return true\n end\n end", "title": "" }, { "docid": "0bd51674e3b698f0e3cc170842cb46c8", "score": "0.475193", "text": "def on_status_ok\n @slot_window.activate.select(0)\n set_controls_help\n end", "title": "" }, { "docid": "e7f14cc8fa39e763dc63845615d9b675", "score": "0.47503325", "text": "def dwp_make_available\n @dwp_runner.make_worker_available(self)\n dwp_run_callback 'on_available'\n dwp_log{ \"Available\" }\n end", "title": "" }, { "docid": "c267c619bd1cddc526974590408996eb", "score": "0.47468278", "text": "def registered\n\t\t\tself\n\t\tend", "title": "" }, { "docid": "b1558e07720b76f92a8b0288c699bf69", "score": "0.4746313", "text": "def add_item(item)\n @inventory.push(item)\n if item.include? \"weapon\"\n @weapon = item\n end\n end", "title": "" }, { "docid": "19a5184d36d566b876573a1958cccec0", "score": "0.4743943", "text": "def enqueue(node)\n @items[@items.count] = node\n end", "title": "" }, { "docid": "8e0ba123777b03e5f4b924dd41ae0b74", "score": "0.47233054", "text": "def items_node\n unless node = self.pubsub.find_first('ns:items', :ns => self.class.registered_ns)\n (self.pubsub << (node = XMPPNode.new('items', self.document)))\n node.namespace = self.pubsub.namespace\n end\n node\n end", "title": "" }, { "docid": "ec248f28e3f9dc28aee3c00809c63d19", "score": "0.4710815", "text": "def add(name, path=nil, options={}, &block)\n @items << Menu.new(name, path, options, &block)\n end", "title": "" }, { "docid": "a211891eb7feb409759ce66596727e8d", "score": "0.47092324", "text": "def add_item item\n @items << item\n @@all_items << item\n end", "title": "" }, { "docid": "f93636d73698dba4cc83260d0a5abcfc", "score": "0.47087505", "text": "def add_item_command(disabled)\n add_command(Vocab::item, :item) unless GTBS::HIDE_INACTIVE_COMMANDS && @actor.perf_action\n end", "title": "" }, { "docid": "e76b4ac35164ec0ff2bf3937c5b0244d", "score": "0.47076887", "text": "def select_menu(menu_item)\n session[:active_menu] = menu_item\n end", "title": "" }, { "docid": "acd463d7fc3f97d8292b56a0879bbf8c", "score": "0.47015235", "text": "def set_item\n @item = Item.friendly.find(params[:id])\n end", "title": "" }, { "docid": "acd463d7fc3f97d8292b56a0879bbf8c", "score": "0.47015235", "text": "def set_item\n @item = Item.friendly.find(params[:id])\n end", "title": "" }, { "docid": "058177f2ccb6e52bb9b76b95a1d49b48", "score": "0.47014305", "text": "def set_item\n @resource_item = ResourceItem.find(params[:id])\n end", "title": "" } ]
cf6edcd90375d524d41797979b1c6823
POST /api/v1/users/token_varification reset password token varification
[ { "docid": "9adfa7fab2949e68578a0afbc1784fea", "score": "0.0", "text": "def token_verification\n user = User.with_reset_password_token(params[:user][:reset_password_token])\n if user && user.email == params[:user][:email] && user.reset_password_period_valid?\n render_success_response({},\"Token is valid\")\n else\n json_response({\n success: false,\n message: \"Invalid Token\"\n }, 400)\n end\n end", "title": "" } ]
[ { "docid": "4a8d9e241f2056b332cab336ed6f2d93", "score": "0.7530991", "text": "def with_reset_password_token(token); end", "title": "" }, { "docid": "61d1cc8844c255b848a4f127694f5e36", "score": "0.7427701", "text": "def forgot_password token\n recipients token.user.email\n from SETTING.master_email!\n sent_on Time.now \n subject t(:forgot_password_title, :name => token.user.name, :host => SETTING.master_domain!)\n \n body \\\n :user => token.user,\n :url => reset_password_form_identities_url(:host => SETTING.master_domain!, :token => token.token)\n end", "title": "" }, { "docid": "0b61fb1cb99c1b38b111ae0efac6bf0b", "score": "0.7352553", "text": "def reset_password\n token = params[:token]\n\n # If the token is valid update the users password\n if @user.verify_token(\"reset_password\", token) &&\n @user.update(params.require(:user).permit(:password, :password_confirmation))\n flash[:success] = I18n.t(\"reset_password.success\")\n redirect_to signin_path\n else\n flash[:alert] = I18n.t(\"reset_password.failed\")\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "0043ca458d9c97388d2f9a5caa63dbe6", "score": "0.7336544", "text": "def reset_password\n if verify_token(params['reset_device_id'], params['reset_otp_token'])\n status = :ok\n response = set_password(session[:user_id], params['new_password'])\n else\n status = :unauthorized\n response = 'Invalid token'\n end\n\n render json: response, status: status\n end", "title": "" }, { "docid": "aab6690d8d8eb44e7748e4302ab80bd5", "score": "0.7302893", "text": "def reset_password_token\n generate_token(:reset_password_token)\n end", "title": "" }, { "docid": "f991a3954abd11c166dad03ce6b4d9f0", "score": "0.7209522", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token #присваивается значение токена сброса пароля\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "67657968c148f7ecc9abbd0ef61a5c62", "score": "0.7199304", "text": "def password_reset(token)\n get(\"/v1/password_resets/#{token}\")\n end", "title": "" }, { "docid": "dc9e046174a174015daf85ac8033bc05", "score": "0.7173306", "text": "def reset_password\n user = User.find_by(reset_password_token: params[:token])\n\n return invalid_reset unless user&.password_token_valid?\n\n if user.reset_password!(params[:password])\n render json: { success: true }, status: 204\n else\n render json: { error: user.errors.full_messages }, status: 422\n end\n end", "title": "" }, { "docid": "bf76e02bdd1581bd943134e79e8cbfc8", "score": "0.7151934", "text": "def reset_password_token!\n raw, enc = Devise.token_generator.generate(self.class, :reset_password_token)\n self.reset_password_token = enc\n self.reset_password_sent_at = Time.now.utc\n save(validate: false)\n raw\n end", "title": "" }, { "docid": "3e141f9f656bcfa81779ab021bf01953", "score": "0.7129173", "text": "def pass_reset_token(uid, timestamp, hashed_pass)\n values = {\n uid: uid,\n timestamp: timestamp,\n hashed_pass: hashed_pass\n }\n @client.make_request :post,\n auth_path('user_pass_reset'),\n values\n end", "title": "" }, { "docid": "e9f40f9ad2745bbd92094ea6014cc072", "score": "0.7101075", "text": "def generate_password_token!\n self.reset_password_token = generate_token\n self.reset_password_sent_at = Time.now.utc\n self.save(validate: false)\n end", "title": "" }, { "docid": "075e23c818c844dc39488711fcc1f531", "score": "0.70968246", "text": "def use_password_reset(token, new_password)\n put(\"/v1/password_resets/#{token}\", password: new_password)\n end", "title": "" }, { "docid": "643cb3df1d8476fd09fd82c1be5b5a87", "score": "0.7086077", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "276caa101374f00c54a45472dd026f81", "score": "0.70835614", "text": "def password_reset\n user = RailsTutorial::Sample::User.first\n user.reset_token = RailsTutorial::Sample::User.new_token\n RailsTutorial::Sample::UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "66d1419e105194cc80a8bbec417c341c", "score": "0.7076696", "text": "def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "66d1419e105194cc80a8bbec417c341c", "score": "0.7076696", "text": "def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "3402ed8bd4ac25f1aa60d9acee2cdb75", "score": "0.7067855", "text": "def password_reset\n user = User.first\n user.password_reset_token = new_token\n email = EmailAddress.find_by(id: user.primary_email_address_id).email\n UserMailer.password_reset(user, email)\n end", "title": "" }, { "docid": "d863a00939e2224ab52dc31b9ea66fa8", "score": "0.7065916", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "d863a00939e2224ab52dc31b9ea66fa8", "score": "0.7065916", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "d863a00939e2224ab52dc31b9ea66fa8", "score": "0.7065916", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "d863a00939e2224ab52dc31b9ea66fa8", "score": "0.7065916", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "d863a00939e2224ab52dc31b9ea66fa8", "score": "0.7065916", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "d863a00939e2224ab52dc31b9ea66fa8", "score": "0.7065916", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "d863a00939e2224ab52dc31b9ea66fa8", "score": "0.7065916", "text": "def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "674cebed9f6cff63d31c3a2ceccd4d3e", "score": "0.70345163", "text": "def reset_password(params)\n user = User.find_by_reset_password_token(params[:token])\n if user.nil?\n fail BadRequestError.user_not_found(:token), \"User not found by token.\"\n end\n\n user.reset_password!(params[:password], params[:password_confirmation])\n user\n end", "title": "" }, { "docid": "2f6057b730c9d9789435327df9064a76", "score": "0.7013094", "text": "def generate_reset_password_token!\n generate_reset_password_token && save(:validate => false)\n end", "title": "" }, { "docid": "2f6057b730c9d9789435327df9064a76", "score": "0.7013094", "text": "def generate_reset_password_token!\n generate_reset_password_token && save(:validate => false)\n end", "title": "" }, { "docid": "7e1468db6358492e98e5364a60a4d531", "score": "0.7008922", "text": "def password_reset\n user = Volunteer.first\n user.reset_token = Volunteer.new_token\n VolunteerMailer.password_reset(user)\n end", "title": "" }, { "docid": "2de123c311986526f6ba91a5a6cbe057", "score": "0.69870675", "text": "def confirm_reset\n \n new_pass = params[:password]\n token = params[:token]\n if User.confirm_reset token, new_pass\n head :no_content\n else\n render json: {message: error_messages[:incorrect_reset_token]},\n status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "5b50adfa27df7901a36016e57e7cbb73", "score": "0.69830436", "text": "def reset_token\n self.reset_password_token = BCrypt::Engine.generate_salt\n self.save(:validate => false)\n end", "title": "" }, { "docid": "7e548cdfec07de090518e825b4476bef", "score": "0.6977997", "text": "def password_reset\n participant = Participant.first\n participant.reset_token = Participant.new_token\n ParticipantMailer.password_reset(participant)\n end", "title": "" }, { "docid": "221e1d6c9234335ccd845ac280b56334", "score": "0.6965262", "text": "def generate_token\n account = Authentication::Account.find_by(email: username)\n reset_hash = reset_password(account, expires_at || Time.now + 24.hours)\n {'success' => true, 'reset_password_token' => reset_hash['raw_token'], 'expires_at' => reset_hash['expires_at']}\n end", "title": "" }, { "docid": "e72787d988c9cac7706129834a692aa7", "score": "0.6963858", "text": "def password_reset\n tester = Tester.first\n tester.reset_token = Tester.new_token\n TesterMailer.password_reset(tester)\n end", "title": "" }, { "docid": "32b7d063b389ecd2fef198b3c59604f0", "score": "0.69616747", "text": "def create_reset_token\n self.reset_token = User.new_token\n update_attribute :reset_digest, User.digest(reset_token)\n update_attribute :reset_sent_at, Time.zone.now\n end", "title": "" }, { "docid": "c4791c50e83f0696d29fbb6ad0ec32ce", "score": "0.69604003", "text": "def send_password_reset\n\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!(validate: false)\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "533839c63d825f257a390e99020e56d5", "score": "0.69418466", "text": "def reset_password\n self.password_reset_token = SecureRandom::uuid\n save!\n UserMailer.send_password_reset_token(self).deliver\n end", "title": "" }, { "docid": "5ce61844b5803b0f8f5a0e9b7342af4d", "score": "0.69356716", "text": "def send_pass\n username = params[:user][:account_name]\n email = params[:user][:email]\n resp = LinkedData::Client::HTTP.post(\"/users/create_reset_password_token\", {username: username, email: email})\n\n if resp.nil?\n redirect_to login_index_path, notice: \"Please check your email for a message with reset instructions\"\n else\n flash[:notice] = resp.errors.first + \". Please try again.\"\n redirect_to \"/lost_pass\"\n end\n end", "title": "" }, { "docid": "e9798de60d46187a54d4504f80a86c09", "score": "0.69287765", "text": "def password_reset\n \tuser = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "1a58de61cf32ebf7d8a4dfecc18bc1ea", "score": "0.6926868", "text": "def generate_password_token!\n\t\tself.reset_password_token\t= generate_token\n\t\tself.reset_password_sent_at\t= Time.now\n\t\tsave!\n\tend", "title": "" }, { "docid": "52885373c65f990119ac47c8027b4202", "score": "0.6924581", "text": "def reset_token!\n token = Devise.friendly_token[0,20]\n self.password = self.password_confirmation = token\n self.email = \"#{name}@scribe\"\n save! validate: false\n token\n end", "title": "" }, { "docid": "1dac3a200d72ef3470493e9cd4d1da54", "score": "0.69139874", "text": "def password_reset(user, token)\n @user = user\n @token = token\n mail(\n to: @user.email,\n from: '[email protected]',\n subject: 'パスワードの再設定'\n )\n end", "title": "" }, { "docid": "ac78e6ef7ec07537bc04f3e2bfff683b", "score": "0.6909202", "text": "def password_reset\n user = User.first\n user.reset_token = SecureRandom.uuid\n user.e_token = User.digest(user.email)\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "4a2904743ffc2e9ef0dea2fa578f4ea5", "score": "0.6908571", "text": "def reset_password\n @token = params[:token]\n @user = User.load_from_reset_password_token(@token)\n\n if @user.blank?\n not_authenticated\n return\n end\n end", "title": "" }, { "docid": "c85a17665e8907b82091fff1d7d754d1", "score": "0.6899112", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!(validate: false)\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "214bd4c912eba9f602d3ced626a827da", "score": "0.689548", "text": "def password_change_token _email, _token\n @token = _token\n mail(to: _email, subject: \"Please change your password\")\n end", "title": "" }, { "docid": "9eacc7bcad3f3294072da5ebf5470f4a", "score": "0.68851477", "text": "def reset_password\n user = User.first\n ticket = user.tickets.create(\n name: 'Réinitialiser le mot de passe',\n action: '/password_resets/%{token}/edit',\n duree: 2.days\n )\n UserMailer.reset_password(user, ticket)\n end", "title": "" }, { "docid": "93bbe527777fd8be2652b99a158261fe", "score": "0.6884339", "text": "def generate_token\n self.password_reset_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "bc21005c475de18e6e31cfe45d976c42", "score": "0.68795586", "text": "def password_reset\n user = SbUser.first\n user.reset_token = SbUser.new_token\n SbuserMailer.password_reset(user)\n\n end", "title": "" }, { "docid": "9e397760185186c500e3b2e475adff36", "score": "0.687617", "text": "def reset_password\n if (params[:token] === @user.reset_token) && (@user.updated_at > DateTime.now - 1)\n @user.update(password: params[:password], password_confirmation: params[:confirm_password], reset_token: \"\")\n render \"reset\" if @user.errors.any?\n else\n @error = \"Token is expired\"; render \"reset\"\n end\n rescue StandardError => e\n render json: { message: \"Error: Something went wrong... \" }, status: :bad_request\n end", "title": "" }, { "docid": "355889a93198126c0c2aeb84ff89a560", "score": "0.6869104", "text": "def send_password_resets\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n self.save!\n NotificationsMailer.password_reset_mail(self).deliver\n end", "title": "" }, { "docid": "a5010280d1de391fccefd252b2063d9b", "score": "0.685931", "text": "def password_reset\n user = User.first || Lecturer.first\n user.reset_token = User.new_token || Lecturer.new_token\n UserMailer.password_reset(user)\n end", "title": "" }, { "docid": "89ead95d14c50e5e8797a1a8c9fa3f91", "score": "0.6850042", "text": "def create_reset_password_token\n reset_token = Digest::MD5.hexdigest(\"#{@user.id}::#{@user.password}::#{Time.now.to_i}::reset_password::#{rand}\")\n db_row = TemporaryToken.create!({\n client_id: @client_id,\n entity_id: @user.id,\n kind: GlobalConstant::TemporaryToken.reset_password_kind,\n token: reset_token\n })\n\n reset_pass_token_str = \"#{db_row.id.to_s}:#{reset_token}\"\n encryptor_obj = LocalCipher.new(GlobalConstant::SecretEncryptor.email_tokens_key)\n r = encryptor_obj.encrypt(reset_pass_token_str)\n return r unless r.success?\n\n @reset_password_token = r.data[:ciphertext_blob]\n\n success\n end", "title": "" }, { "docid": "cbad4a85f5e214c95c8f477cd622e815", "score": "0.68442965", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save(:validate => false)\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "30b1cfec92d2c81d1cfcb6c5011a5c9c", "score": "0.68374795", "text": "def reset_password\n if (params[:token] === @current_user.reset_token) && (@current_user.updated_at > DateTime.now - 1)\n @current_user.update(password: params[:password], password_confirmation: params[:confirm_password], reset_token: \"\")\n render \"reset\" if @current_user.errors.any?\n else\n @error = \"Token is expired\"; render \"reset\"\n end\n rescue StandardError => e\n render json: { message: \"Error: Something went wrong... \" }, status: :bad_request\n end", "title": "" }, { "docid": "b428c34f4ef7dbba5d47083f3a08f0db", "score": "0.683501", "text": "def generate_reset_password_token\n raw, enc = Devise.token_generator.generate(self.class, :reset_password_token)\n\n self.reset_password_token = enc\n self.reset_password_sent_at = Time.now.utc.next_week\n self.save(validate: false)\n raw\n end", "title": "" }, { "docid": "c320930e9950fd9c264d610983f72ac1", "score": "0.6814375", "text": "def password_reset\n account = Account.first\n account.reset_token = Account.new_token\n AccountMailer.password_reset(account)\n end", "title": "" }, { "docid": "889b358bca177f9e77d622df6a1d8897", "score": "0.68109906", "text": "def password_reset\n player = Player.first\n player.reset_token = Player.new_token\n PlayerMailer.password_reset(player)\n end", "title": "" }, { "docid": "cdad055d6254a202dca314d19fbcf425", "score": "0.68089783", "text": "def generate_password_reset_token\n self.password_reset_token = SecureRandom.urlsafe_base64\n end", "title": "" }, { "docid": "27ccd03f193c0af4377bccdf77a19642", "score": "0.6806724", "text": "def reset\r\n @user = User.new\r\n\r\n if params[:token].blank?\r\n redirect_to 'password/resetpass'\r\n flash[:danger] = 'Token password reset not present'\r\n end\r\n\r\n token = params[:token].to_s\r\n\r\n if User.exists?(reset_password_token: token)\r\n @user = User.find_by(reset_password_token: token)\r\n if @user.password_token_valid? == false\r\n redirect_to '/password/resetpass'\r\n flash[:danger] = \"Token password reset expired\"\r\n end\r\n else\r\n redirect_to '/password/resetpass'\r\n flash[:danger] = \"Invalid token password reset\"\r\n end\r\n end", "title": "" }, { "docid": "ec469be45b95b5c7446e259346d0dd2f", "score": "0.6793597", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n self.save\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "bca2fa49797f4d0c02ffdc72d7a1951a", "score": "0.67918026", "text": "def send_password_reset_token(user)\n user.set_password_reset_token\n user.password_reset_sent_at = Time.zone.now\n user.save!\n PasswordMailer.password_reset(user).deliver\n end", "title": "" }, { "docid": "ea5679d0343bbe7a8f1edfbfc610cc4b", "score": "0.6784685", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n PasswordMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "20af322e12d37a4053a031fe172b3f29", "score": "0.6775549", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "20af322e12d37a4053a031fe172b3f29", "score": "0.6775549", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "20af322e12d37a4053a031fe172b3f29", "score": "0.6775549", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "20af322e12d37a4053a031fe172b3f29", "score": "0.6775549", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "515a30e0130121ba11108e2974d8555e", "score": "0.6774007", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now \n save!\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "34844f79178b94dfaed6dc7cf4ea3cf4", "score": "0.6767282", "text": "def send_password_reset\n generate_token\n self.password_reset_token_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "714abb289a77082449b30debc8cea4cf", "score": "0.6750021", "text": "def send_password_reset\n generate_token(:password_reset_token)\n update_attributes!(password_reset_sent_at: Time.zone.now)\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "5d0b273dacfe6414233252755d8e4590", "score": "0.67407894", "text": "def genrate_tokn(password_reset_token)\n self.password_reset_token = (Digest::MD5.hexdigest \"#{ActiveSupport::SecureRandom.hex(10)}-#{DateTime.now.to_s}\")\n end", "title": "" }, { "docid": "9942c2e05656f1ced80801e974e0aaad", "score": "0.6737442", "text": "def reset_password\n # Make sure there is an email with the user and reset token\n user = User.find_by({\n email: params[:user][:email],\n reset_password_token: params[:user][:reset_password_token],\n })\n \n if user\n # Make sure the password reset token is only good for 10 minutes\n if (Time.now > user.reset_password_sent_at + 10.minutes)\n # Invalidate the password reset data\n user.reset_password_token = nil\n user.reset_password_sent_at = nil\n user.save\n return render json: {errors: {general: ['Your password reset token has expired']}}, status: 400\n else\n # If the password confirmation matches the password\n if(params[:user][:password] === params[:user][:password_confirmation])\n user.password = params[:user][:password]\n # Invalidate the password reset data\n user.reset_password_token = nil\n user.reset_password_sent_at = nil\n user.save\n return render json: {status: 200 }, status: 200 \n else\n # if the password confirmation was incorrect\n return render json: {\n errors: {\n fields: {\n password_confirmation: ['Your passwords did not match']\n }\n }\n }\n end\n\n end\n else\n return render json: {status: 404}, status: 404 \n end\n end", "title": "" }, { "docid": "6119733e38dc4bdbe159404309193504", "score": "0.6724847", "text": "def password_reset\n owner = Owner.first\n owner.reset_token = Owner.new_token\n Owner::UserMailer.password_reset(owner)\n end", "title": "" }, { "docid": "aafb26ca3422bcb72763f77f3285ad10", "score": "0.6719916", "text": "def password_reset\n user = Customer.last\n user.reset_token = Customer.new_token\n CustomerMailer.password_reset(user)\n end", "title": "" }, { "docid": "1031db87011dba5443911eb06410ee1b", "score": "0.6717992", "text": "def password_reset\n gamer = Gamer.first\n gamer.reset_token = Gamer.new_token\n GamerMailer.password_reset(gamer)\n end", "title": "" }, { "docid": "9590e30062d0f6ff09bb23a741a3b806", "score": "0.6713876", "text": "def password_reset\n\t\tshepherd = Shepherd.first\n\t\tshepherd.reset_token = Shepherd.new_token\n ShepherdMailer.password_reset(shepherd)\n end", "title": "" }, { "docid": "a45c1073216744a7a162d9cdcfc1b398", "score": "0.6706168", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver_now\n end", "title": "" }, { "docid": "e13b1229d8a8f8bec1568d9d053d53df", "score": "0.6688214", "text": "def require_password_reset!\n token = password_reset_token || build_password_reset_token\n token.reset!\n token\n end", "title": "" }, { "docid": "c48aa66e0d8a80df3dfd10dc21ed2dbc", "score": "0.6687868", "text": "def reset_params\n params.permit(:reset_password_token, :password, :password_confirmation)\n end", "title": "" }, { "docid": "eded41d83513fc55dc3b389cbc391a09", "score": "0.6686326", "text": "def reset_password(account, reset_expires_at)\n raw, enc = Authentication::TokenGenerator.generate(Authentication::Account, 'reset_password_token')\n account.reset_password_token = enc\n account.reset_password_expires_at = reset_expires_at\n # account.login_attempts = 0\n account.save\n return {'raw_token' => raw, 'expires_at' => reset_expires_at}\n end", "title": "" }, { "docid": "052a7bf14fc7aadcd51b65105086a735", "score": "0.6682766", "text": "def new_password\n if token = LoginToken.find_by_token(params[:token])\n @user = token.user\n if request.post?\n @tmp_user = User.new(params[:user])\n @tmp_user.validate_attributes(:only => [:password, :password_confirmation])\n if @tmp_user.errors.empty?\n User.transaction do\n @user.change_password(params[:user][:password])\n token.destroy\n @user.reset_login_attempts\n end \n flash[:notice] = 'Password changed!'\n return redirect_to(account_url(:action => :login))\n end\n end # request.post?\n else\n flash[:notice] = 'Sorry, this password regeneration request is no longer valid. Please create a new request.'\n return redirect_to(account_url(:action => :forgot_password))\n end\n end", "title": "" }, { "docid": "127ee1fe8da38214305cfe72cad45e78", "score": "0.6680952", "text": "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver \n end", "title": "" }, { "docid": "3516a3125163ebcb565eac88d7f468fe", "score": "0.66728204", "text": "def generate_reset_password_token\n self.reset_password_token = new_reset_password_token\n self.reset_password_sent_at = Time.now.utc\n self.reset_password_token\n end", "title": "" }, { "docid": "3531408aec8f898ff5d338bd27cd3e20", "score": "0.66723716", "text": "def create_reset_digest\n self.reset_token = User.new_token\n self.save\n end", "title": "" }, { "docid": "0512ab9959ae6e478ea467001ba94c5e", "score": "0.6660358", "text": "def reset_password\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.now\n save!\n UserMailer.delay.password_reset(self)\n end", "title": "" }, { "docid": "283197174649567d0ea43a1186b95ecf", "score": "0.6657394", "text": "def password_reset\n\t token = params.first[0]\n\t @user = User.find_by_confirm_token(token)\n\n\t if @user.nil?\n\t flash[:error] = 'You have not requested a password reset.'\n\t return redirect_to :root\t \n\t end\n\n\t if @user.password_expires_after < DateTime.now\n\t clear_password_reset(@user)\n\t @user.save\n\t flash[:error] = 'Password reset has expired. Please request a new password reset.'\n\t redirect_to :forgot_password\n\t end\n\tend", "title": "" }, { "docid": "fee65f97c61ad964230e2d988f4bcb8d", "score": "0.6656742", "text": "def forgot_password\n user = User.find_by(email: params[:email])\n\n return render json: { error: 'Something went wrong.' }, status: 422 unless user\n\n user.generate_password_token!\n send_reset_password_email(user.email, user.reload.reset_password_token)\n\n render json: { success: true }, status: 204\n end", "title": "" }, { "docid": "cf52f870c9a7d5f38096ca1c4d54c99b", "score": "0.665255", "text": "def send_password_reset\n self.password_reset_sent_at = Time.now\n update_attribute(:password_reset_token, genrate_tokn(:password_reset_token) )\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "938e9016fce68afb2412f6e6d2dd2ea4", "score": "0.66495997", "text": "def update\n return render status: :unprocessable_entity, json: {errors: [I18n.t('errors.insufficient_params')]} unless params[:token]\n confirmation = UserConfirmation.find_by(c_type: :reset_password, status: :pending, token: params[:token])\n return render status: :unauthorized, json: {errors: [I18n.t('errors.invalid_token')]} if confirmation.nil?\n confirmation.user.update(confirmed_at: Time.zone.now) unless confirmation.user.confirmed?\n return render status: :unauthorized, json: {errors: [I18n.t('errors.late_token')]} if confirmation.created_at + RESET_TOKEN_LIFETIME < Time.zone.now\n confirmation.update(status: :approved)\n session = Session.create(user: confirmation.user)\n token = JsonWebToken.encode({user_id: confirmation.user.id, uid: session.uid, exp: 1.hours.from_now.to_i})\n redirect_to EMAIL_RESET_SITE + \"?token=#{token}\"\n end", "title": "" }, { "docid": "92566fdcbec15eea0099126730158e70", "score": "0.6641511", "text": "def create_reset_digest\n totp = ROTP::TOTP.new(\"base32secret3232\")\n self.reset_token = totp.now\n update_attribute(:reset_password_token, self.reset_token)\n update_attribute(:reset_password_sent_at, Time.zone.now)\n end", "title": "" }, { "docid": "ed308fcfb58a77baeb27847240a7dcdd", "score": "0.6640925", "text": "def password_reset\n # ShopMailer.password_reset\n shop = Shop.first\n shop.reset_token = Shop.new_token\n ShopMailer.password_reset(shop)\n end", "title": "" }, { "docid": "6f283b25d13b3147ce654dde3080bf5b", "score": "0.6633722", "text": "def generate_reset_password_token!\n characters = ('a'..'z').to_a + ('A'..'Z').to_a \n self.reset_password_sent_at = Time.zone.now.utc\n self.reset_password_token = (1..12).map{characters.sample}.join # Generate a 12-length random string\n save(:validate => false)\n end", "title": "" }, { "docid": "fec1c04536630fba52d84fa1adf293a3", "score": "0.6630379", "text": "def forgot_password\n return unless request.post?\n @user = User.find_first(['email = ?', @params[:user]['email']])\n if @user\n @user.update_attributes({ :token => token_string(10),\n :token_expiry => 7.days.from_now })\n url = url_for(:controller => 'user', :action => 'login_by_token', \n :id => @user.id, :token => @user.token)\n UserNotifier.deliver_forgot_password(@user, url) \n render :action => 'forgot_password_done'\n else\n flash[:notice] = \"El correo #{@params[:user]['email']} NO existe en el salva!\"\n end\n end", "title": "" }, { "docid": "b581ef96475361457bbd3c397d89d61a", "score": "0.663011", "text": "def reset_password\n\t\tself.password_reset_token = User.new_token\n\t\tupdate_columns(password_reset_digest: User.digest(self.password_reset_token), password_reset_sent_at: Time.zone.now)\n\tend", "title": "" }, { "docid": "1d12c05fae097eceb35d5d553217cf1d", "score": "0.6620212", "text": "def password_reset\n user = Investor.first\n user.activation_token = Investor.new_token\n NemabollonMailer.password_reset(user)\n end", "title": "" }, { "docid": "e9c30737d3319132233b897d99062211", "score": "0.6616402", "text": "def edit_password\n @token = params[:token]\n end", "title": "" }, { "docid": "6a91a475803bdbff28679a002f772eae", "score": "0.66075724", "text": "def create_password_reset\n @user = User.where(email: user_params_for_password_reset[:email]).first\n password_reset_token = User.generate_token\n if(@user and @user.update(password_reset_token: password_reset_token))\n UserMailer.password_reset(@user).deliver_later\n end\n end", "title": "" }, { "docid": "f015d0aca0ae713570e1e89efc0041fe", "score": "0.66045636", "text": "def reset_password_with_token\n user = User.first(:perishable_token => params[:token])\n if user.nil? || user.password_reset_sent.to_time < 2.days.ago\n flash[:notice] = \"Your link is no longer valid, please request a new one.\"\n redirect_to \"/forgot_password\"\n else\n @token = params[:token]\n @user = user\n render \"login/password_reset\"\n end\n end", "title": "" }, { "docid": "20c22c0f3528d0a488aec311ce95dda8", "score": "0.6587674", "text": "def create_reset_password_token\n reset_token = Digest::MD5.hexdigest(\"#{@admin.id}::#{@admin.password}::#{Time.now.to_i}::reset_password::#{rand}\")\n db_row = TemporaryToken.create!({\n client_id: @admin.default_client_id,\n entity_id: @admin.id,\n kind: GlobalConstant::TemporaryToken.admin_reset_password_kind,\n token: reset_token\n })\n\n reset_pass_token_str = \"#{db_row.id.to_s}:#{reset_token}\"\n encryptor_obj = LocalCipher.new(GlobalConstant::SecretEncryptor.email_tokens_key)\n r = encryptor_obj.encrypt(reset_pass_token_str)\n return r unless r.success?\n\n @reset_password_token = r.data[:ciphertext_blob]\n\n success\n end", "title": "" }, { "docid": "f1c523eff4ed0c2b0049cbc969491c6b", "score": "0.65785223", "text": "def password_reset_request\n end", "title": "" }, { "docid": "762e4c3a6a267d9e0a1f9f52144a9e70", "score": "0.65742016", "text": "def send_password_reset\n create_password_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "title": "" }, { "docid": "4847c523c1a38b382b59bb3fc2b1d937", "score": "0.6559005", "text": "def reset_password\n password_reset_token = params[:password_reset_token]\n user = User.find_by_password_reset_token(password_reset_token)\n is_expired = Time.now > user.password_reset_token_expires_at if user\n delete_password_reset_token(user) if is_expired\n if ! user || is_expired\n flash[:error] = I18n.t(:reset_password_token_expired_error)\n redirect_to forgot_password_users_path\n else\n set_current_user(user)\n delete_password_reset_token(user)\n flash[:notice] = I18n.t(:reset_password_enter_new_password_notice)\n redirect_to edit_user_path(user)\n end\n end", "title": "" } ]
af8e2fc42399850292025cdda6903638
app specific environment variables.
[ { "docid": "23c9ab37308eba9316ff3550c7e7f626", "score": "0.6463189", "text": "def default_app_variables_path\n Hanami.root.join(\"apps\", Concierge.app.to_s, \"config\", \"environment_variables.yml\").to_s\n end", "title": "" } ]
[ { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.75201654", "text": "def env_config; end", "title": "" }, { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.75201654", "text": "def env_config; end", "title": "" }, { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.75201654", "text": "def env_config; end", "title": "" }, { "docid": "bd1d501b2cb07953ec759dab24efe265", "score": "0.75201654", "text": "def env_config; end", "title": "" }, { "docid": "ee24cea4d6893f8dd0d171d844c7781f", "score": "0.7412899", "text": "def env_vars\n { \"OS_CLIENT_CONFIG_FILE\" => os_credentials_file }\n end", "title": "" }, { "docid": "937d036dacf0799126e63d333c738c0e", "score": "0.7359433", "text": "def env_vars\n @env ||= calculate_env_vars\n end", "title": "" }, { "docid": "37ea91bbe3e67be7a9a8249cffaa836a", "score": "0.7338542", "text": "def env_key; end", "title": "" }, { "docid": "6010eac99119044591a1fb74beadb1d3", "score": "0.73036426", "text": "def env_vars\n {\n \"AWS_ACCESS_KEY_ID\" => auth.userid || \"\",\n \"AWS_SECRET_ACCESS_KEY\" => auth.password || \"\",\n \"AWS_SECURITY_TOKEN\" => auth.auth_key\n }.delete_nils\n end", "title": "" }, { "docid": "04005ea31bd35bee03f73f88ae97b765", "score": "0.72659326", "text": "def env_vars\n {\n \"VMWARE_USER\" => auth.userid || \"\",\n \"VMWARE_PASSWORD\" => auth.password || \"\",\n \"VMWARE_HOST\" => auth.host || \"\"\n }\n end", "title": "" }, { "docid": "dd4c7aaa043d21ce104908fc19ac0201", "score": "0.7222315", "text": "def env\n %w[INSTALLATION=1] + extra_env\n end", "title": "" }, { "docid": "c88d0c732b08431295430a7e8ec71bf9", "score": "0.71983856", "text": "def export_dynatrace_app_environment_variables\n profiled_dir = File.join(@app_dir, '.profile.d')\n FileUtils.mkdir_p(profiled_dir)\n\n variables = {}\n variables[RUXIT_APPLICATION_ID] = application_id\n variables[RUXIT_HOST_ID] = host_id\n\n env_file_name = File.join(profiled_dir, '0dynatrace-app-env.sh')\n env_file = File.new(env_file_name, 'w')\n variables.each do |key, value|\n env_file.puts(\"export #{key}=\\\"${#{key}:-#{value}}\\\"\") # \"${VAR1:-default value}\"\n end\n env_file.close\n end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "6e039d61c2b0532f8ead0b97b47f234d", "score": "0.71591", "text": "def env; end", "title": "" }, { "docid": "fc308d5ce7c3246ebed4bdfc6af7dd12", "score": "0.71247977", "text": "def app_env\n @_app_env ||= PlatformAPI.connect_oauth(heroku_api_key).config_var.info_for_app(app_name)\n end", "title": "" }, { "docid": "e773d2cc4ce21ce5487b4d0d55845b6e", "score": "0.70697683", "text": "def environment_variables\n global_variables = @config.environment_variables\n process_vars = @config.process_options[@name] ? @config.process_options[@name]['env'] || {} : {}\n process_local_vars = @config.local_process_options[@name] ? @config.local_process_options[@name]['env'] || {} : {}\n global_variables.merge(process_vars.merge(process_local_vars)).each_with_object({}) do |(key, value), hash|\n hash[key.to_s] = value.to_s\n end\n end", "title": "" }, { "docid": "1f5e2d6b5fb48d2d2d1176e9a81e4f19", "score": "0.70583194", "text": "def app_config\n {\n env: Rails.env,\n host: ENV[\"RENDER_EXTERNAL_URL\"],\n veue: {\n env: ENV[\"VEUE_ENV\"] || \"dev\",\n revision: ENV[\"RENDER_GIT_COMMIT\"] || `git rev-parse HEAD`,\n branch: ENV[\"RENDER_GIT_BRANCH\"] || `git branch --show-current`,\n },\n service: {\n id: ENV[\"RENDER_SERVICE_ID\"],\n name: ENV[\"RENDER_SERVICE_NAME\"],\n pod: ENV[\"RENDER_POD_NAME\"],\n },\n appsignal: {\n key: ENV[\"APPSIGNAL_FRONTEND_KEY\"],\n },\n }\n end", "title": "" }, { "docid": "b6320c75a8e80c70cef60ca414dec8cd", "score": "0.70467305", "text": "def env_vars\n env = {\n \"ANSIBLE_NET_USERNAME\" => auth.userid || \"\",\n \"ANSIBLE_NET_PASSWORD\" => auth.password || \"\",\n \"ANSIBLE_NET_AUTHORIZE\" => auth.authorize ? \"1\" : \"0\"\n }\n\n env[\"ANSIBLE_NET_AUTH_PASS\"] = auth.become_password || \"\" if auth.authorize\n env[\"ANSIBLE_NET_SSH_KEYFILE\"] = network_ssh_key_file if auth.auth_key\n env\n end", "title": "" }, { "docid": "02425002908fa7ae73ba80ca16c3cfb6", "score": "0.70293057", "text": "def static_env; end", "title": "" }, { "docid": "02425002908fa7ae73ba80ca16c3cfb6", "score": "0.70293057", "text": "def static_env; end", "title": "" }, { "docid": "02425002908fa7ae73ba80ca16c3cfb6", "score": "0.70293057", "text": "def static_env; end", "title": "" }, { "docid": "4c11ef9fa1425c0e9f5cd2c05103b13e", "score": "0.70245254", "text": "def msys_apps_envvars_for_cmd\n vars = with_msys_install_hint{ msys_apps_envvars }\n vars.map do |key, val|\n \"#{key}=#{val}\"\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "2e0a7c7f27e81f552be9ec023c36c63f", "score": "0.6877413", "text": "def env\n config.env\n end", "title": "" }, { "docid": "2e0a7c7f27e81f552be9ec023c36c63f", "score": "0.6877413", "text": "def env\n config.env\n end", "title": "" }, { "docid": "d7d890b2b683e70913e273333fe5ee8a", "score": "0.68690616", "text": "def load_envvars\n Pkg::Params::ENV_VARS.each do |v|\n if var = ENV[v[:envvar].to_s]\n case v[:type]\n when :bool\n self.instance_variable_set(\"@#{v[:var]}\", Pkg::Util.boolean_value(var))\n when :array\n self.instance_variable_set(\"@#{v[:var]}\", string_to_array(var))\n else\n self.instance_variable_set(\"@#{v[:var]}\", var)\n end\n end\n end\n end", "title": "" }, { "docid": "050061281ebb59696f003d8c51e6a119", "score": "0.6868897", "text": "def env\n image = options[:image] || app\n config = api.get_config_vars(app).body\n\n config.keys.sort.each do |key|\n puts \"#{key}=#{config[key]}\"\n end\n end", "title": "" }, { "docid": "621615ac77394785a48d97ebbd21fc52", "score": "0.68242604", "text": "def private_env_vars\n {\n 'DISCONTINUE_API' => \"http://#{ENV['MACHINE_IP']}:8080\",\n 'AWS_REGION' => build.build_config.aws_region,\n 'S3_BUCKET' => build.build_config.aws_cache_bucket,\n 'AWS_ACCESS_KEY_ID' => build.build_config.aws_access_key,\n 'AWS_SECRET_ACCESS_KEY' => build.build_config.aws_access_secret,\n }\n end", "title": "" }, { "docid": "558903926a13f8e7476bd8aae268e626", "score": "0.6775311", "text": "def env_variable_prefix\n 'APP_'\n end", "title": "" }, { "docid": "558903926a13f8e7476bd8aae268e626", "score": "0.6775311", "text": "def env_variable_prefix\n 'APP_'\n end", "title": "" }, { "docid": "e31d40238f1fc5003fb118f98913cb19", "score": "0.6762367", "text": "def environ\n case environment\n when 'production' then :prd\n when 'staging' then :stg\n when 'test' then :tst\n when 'development' then :dev\n end\n end", "title": "" }, { "docid": "fb4328c8d25fbf44927a58d881337fb7", "score": "0.6749426", "text": "def get_env(key)\n\n end", "title": "" }, { "docid": "2c41d02939b8e93971a598895140fab1", "score": "0.67463976", "text": "def env=(environment); end", "title": "" }, { "docid": "2c41d02939b8e93971a598895140fab1", "score": "0.67463976", "text": "def env=(environment); end", "title": "" }, { "docid": "8299b932c7885cec18ee567af01684d8", "score": "0.66788346", "text": "def envvar\n CircleCi.request(@conf, \"/project/#{username}/#{project}/envvar\").get\n end", "title": "" }, { "docid": "6d53a272cf334adf4698e12085762653", "score": "0.666962", "text": "def app_env\n return @app_env if @app_env\n\n global_app_env = YAML::load_file(\"#{ENV['WARDEN_CONFIG_DIR']}/app_env.yaml\")\n project_app_env_file_path = \"#{Warden::project_path}/etc/app_env.yaml\"\n\n if File.exists?(project_app_env_file_path)\n project_app_env = YAML::load_file(\"#{Warden::project_path}/etc/app_env.yaml\")\n global_app_env.deep_merge!(project_app_env)\n end\n\n @app_env = global_app_env['app_environment']\n end", "title": "" }, { "docid": "4e5c528225835e257616f133e1288ffe", "score": "0.6658614", "text": "def require_env(*args)\n args.each do |arg|\n env_var = \"#{arg}\".upcase\n if ENV[env_var]\n instance_variable_set(\"@#{env_var.downcase}\", ENV[env_var])\n else\n puts \"You need to provide the ENV variable '#{env_var}'\"\n exit 1\n end\n end\n end", "title": "" }, { "docid": "f8c845ac539da3758853def106221ce4", "score": "0.6654804", "text": "def environment\n verify_environment\n ENV['ENV']\nend", "title": "" }, { "docid": "e6d5b2351b5275b8943c68c743e40359", "score": "0.66499543", "text": "def envvar\n CircleCi.request(conf, \"#{base_path}/envvar\").get\n end", "title": "" }, { "docid": "0be0d3cb4d643c1bfa59e134a66ebdcc", "score": "0.662913", "text": "def environment\n @environment ||= ActiveSupport::StringInquirer.new(app.environment.to_s)\n end", "title": "" }, { "docid": "79e17aed44baaf264d8bdd697c0bc545", "score": "0.6623229", "text": "def forward_local_env(env_variable_patterns); end", "title": "" }, { "docid": "4b53fbcfd8d4ec77f28474954d2c5dcb", "score": "0.6620389", "text": "def app_environment\n os = host_os\n if os.nil?\n Applitools::EyesLogger.info 'No OS set, checking for mobile OS...'\n if driver.mobile_device?\n platform_name = nil\n Applitools::EyesLogger.info 'Mobile device detected! Checking device type..'\n if driver.android?\n Applitools::EyesLogger.info 'Android detected.'\n platform_name = ANDROID\n elsif driver.ios?\n Applitools::EyesLogger.info 'iOS detected.'\n platform_name = IOS\n else\n Applitools::EyesLogger.warn 'Unknown device type.'\n end\n # We only set the OS if we identified the device type.\n unless platform_name.nil?\n platform_version = driver.platform_version\n if platform_version.nil?\n os = platform_name\n else\n # Notice that Ruby's +split+ function's +limit+ is the number of elements, whereas in Python it is the\n # maximum splits performed (which is why they are set differently).\n major_version = platform_version.split('.', 2)[0]\n os = \"#{platform_name} #{major_version}\"\n end\n Applitools::EyesLogger.info \"Setting OS: #{os}\"\n end\n else\n Applitools::EyesLogger.info 'No mobile OS detected.'\n end\n end\n\n # Create and return the environment object.\n Applitools::Base::Environment.new(os, host_app, viewport_size, inferred_environment)\n end", "title": "" }, { "docid": "cbb7756a961b75424f069d72f9f4c86e", "score": "0.6617918", "text": "def local_env(body)\n env = ''\n vtmp = @var.dup\n vtmp[:pub_rsa] = '[PUBLIC RSA KEY]'\n vtmp[:prv_rsa] = '[PRIVATE RSA KEY]'\n vtmp[:user_keys] = @var[:user_keys].collect { |k,_| k }\n vtmp.each { |k,v| env << \"#{(k.to_s + ' '*20)[0,20]} => #{v.inspect}\\n\" }\n _notice \" -- Current Environment Variables --\\n#{env}\"\nend", "title": "" }, { "docid": "38833adc7c59a55c5b18cee00c952d1d", "score": "0.6610399", "text": "def environment\n return @vars unless @vars.nil?\n\n # If not set, Try to find them...\n glob_path = File.join(@deployment_home, @settings.env_file_glob_path)\n regexp_find = glob_path.gsub(/\\*/, '(.*)')\n Dir[glob_path].each do | file_name |\n # Get the environment name from the file part of the glob path:\n # e.g. given ./environments/ci_mgt/kb8or.yaml\n # get ci_mgt from ./environments/*/kb8or.yaml\n /#{regexp_find}/.match(file_name)\n env_name = $1\n if env_name == @env_name\n debug \"env=#{env_name}\"\n # Ensure we set the defaults as vars BEFORE we add environment specifics:\n @vars = @settings.defaults\n env_vars = Context.resolve_env_file(file_name)\n @vars = @vars.merge(env_vars)\n @vars = @vars.merge(@overridden_vars)\n @vars['env'] = env_name\n @environment_file = file_name\n break\n end\n end\n # Now finaly, update the settings now we know the environment!\n unless @vars\n @vars = {}\n end\n @settings = @settings.new(@vars)\n update_k8context\n debug \"vars=#{vars}\"\n @vars\n end", "title": "" }, { "docid": "605a5f65b0c4c123d1a9b37d7032d988", "score": "0.6595317", "text": "def get_env(format, app, node = self.node)\n return '' unless node.attribute?(app)\n\n if node[app]['env'].nil?\n Chef::Log.info(\"Attribute 'env' for application '#{app}' is not defined!\")\n return ''\n end\n\n appenv = streamline_appenv(node[app]['env'])\n generate_config_part(format, 'settings', appenv)\n end", "title": "" }, { "docid": "e9a361d0b8685eb619ef98b31fc6a487", "score": "0.6583665", "text": "def environment(app)\n choose do |menu|\n puts Rainbow(\"Step 2. Adding the Rails environment\").foreground(:green)\n\n menu.prompt = \"Which environment?\"\n\n menu.choice \"production\" do\n Bundler.with_clean_env do\n system(\"heroku config:set RACK_ENV=production RAILS_ENV=production --app #{app}\")\n end\n end\n\n menu.choice \"staging\" do\n Bundler.with_clean_env do\n system(\"heroku config:set RACK_ENV=staging RAILS_ENV=staging --app #{app}\")\n system(\"cp config/environments/production.rb config/environments/staging.rb\")\n end\n end\n end\n end", "title": "" }, { "docid": "10a6a1f98eee80935b45c2a539e8aa96", "score": "0.6576953", "text": "def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end", "title": "" }, { "docid": "18cfdb842e5132007b69ab86ff7c0363", "score": "0.65602976", "text": "def gather_calabash_env\n sdk = ENV['target'] || ENV['sdk'] || ENV['SDK_VERSION'] || \"7.0\" #Calabash env vars\n major = sdk[0]\n os = ENV['os'] || ENV['OS']\n if os.nil?\n os = \"ios#{major}\"\n end\n device = ENV['device_family'] || ENV['device'] || ENV['DEVICE'] || 'iphone' #Calabash env vars\n {\"SDK_VERSION\" => sdk, \"OS\" => os, \"DEVICE\" => device}\n end", "title": "" }, { "docid": "26fa3597d0174179ebc841417a14ddaa", "score": "0.65444857", "text": "def env\n @env || {}\n end", "title": "" }, { "docid": "7df6510031b34452a56fb06dc1f932dd", "score": "0.6541389", "text": "def set_env(papers, site_host, site_name, nwo)\n ENV['REVIEW_REPOSITORY'] = nwo\n ENV['DOI_PREFIX'] = \"10.21105\"\n ENV['PAPER_REPOSITORY'] = papers\n ENV['JOURNAL_URL'] = site_host\n ENV['JOURNAL_NAME'] = site_name\n end", "title": "" }, { "docid": "d238dd3a1916ccc9e2c14046357a6661", "score": "0.65353376", "text": "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "title": "" }, { "docid": "98ed2537cbb886860931cfff20df9f96", "score": "0.6530305", "text": "def setup_env\n @env['kiwi.app'] = self\n @env['kiwi.mime'] = @env['HTTP_ACCEPT']\n @env['kiwi.params'] = ::Rack::Request.new(@env).params\n @env['kiwi.path'] = @env['PATH_INFO']\n @env['kiwi.method'] = @env['REQUEST_METHOD'].downcase.to_sym\n @env['kiwi.format'] ||= @env['kiwi.mime'].to_s.sub(%r{^\\w+/\\w+\\+?}, '')\n @env['kiwi.serializer'] ||= Kiwi.serializers[@env['kiwi.format'].to_sym]\n @env['kiwi.resource'] ||=\n self.class.resources.find{|rsc| rsc.routes? @env['kiwi.path']}\n end", "title": "" }, { "docid": "0aed5da15196117af69b9c39b1a05ce8", "score": "0.6520781", "text": "def get_env_mappings()\n {\n 'prd' => 'production',\n 'prv' => 'preview',\n 'rev' => 'review',\n 'stg' => 'staging',\n 'qa' => 'qa',\n 'dev' => 'development',\n 'dvp' => 'devops',\n }\nend", "title": "" }, { "docid": "7001f086ee7d0f5efb85d717889449a3", "score": "0.6510945", "text": "def export_config_to_env\n ENV['TAOBAO_API_KEY'] = config['app_key']\n ENV['TAOBAO_SECRET_KEY'] = config['secret_key']\n ENV['TAOBAO_ENDPOINT'] = config['endpoint']\n ENV['TAOBAO_AUTHORIZE'] = config['authorize']\n ENV['TAOBAO_TOKEN'] = config['token']\n ENV['TAOBAO_AUTHORIZE_REDIRECT_URI'] = config['authorize_redirect_uri']\n ENV['TAOBAO_TOKEN_REDIRECT_URI'] = config['token_redirect_uri']\n end", "title": "" }, { "docid": "cdc2023df2be9a0723bba49ec72c12aa", "score": "0.65020806", "text": "def set_env\n env = (container[:env] ||= [])\n\n # static data\n metadata = release_doc_metadata\n [:REVISION, :TAG, :DEPLOY_ID, :DEPLOY_GROUP].each do |k|\n env << {name: k, value: metadata.fetch(k.downcase).to_s}\n end\n\n [:PROJECT, :ROLE].each do |k|\n env << {name: k, value: template[:spec][:template][:metadata][:labels][k.downcase].to_s}\n end\n\n # dynamic lookups for unknown things during deploy\n {\n POD_NAME: 'metadata.name',\n POD_NAMESPACE: 'metadata.namespace',\n POD_IP: 'status.podIP'\n }.each do |k, v|\n env << {\n name: k,\n valueFrom: {fieldRef: {fieldPath: v}}\n }\n end\n\n if needs_secret_sidecar?\n vault_config = VaultClient.client.config_for(@doc.deploy_group.vault_instance)\n raise StandardError, \"Could not find Vault config for #{@doc.deploy_group.permalink}\" unless vault_config\n\n sidecar_env = (sidecar_container[:env] ||= [])\n {\n VAULT_ADDR: vault_config['vault_address'],\n VAULT_SSL_VERIFY: vault_config['tls_verify']\n }.each do |k, v|\n sidecar_env << {\n name: k,\n value: v.to_s\n }\n end\n end\n end", "title": "" }, { "docid": "7fed6fc502bf9a6e203778675bdd4f52", "score": "0.6493284", "text": "def env_defaults\n DataCache.env_defaults\n end", "title": "" }, { "docid": "a5ddb7778b1920c4bbb01c3aa78fde48", "score": "0.64911765", "text": "def env_sanitizer\n %Q{ENV[\"GEM_HOME\"] = ENV[\"GEM_PATH\"] = nil unless ENV[\"APPBUNDLER_ALLOW_RVM\"] == \"true\"}\n end", "title": "" }, { "docid": "e288d08dd87db26a1815c39d4760d6d2", "score": "0.6474057", "text": "def pseudo_env\n ENV[\"PSEUDO_PRODUCTION_ENV\"]&.inquiry || Rails.env\n end", "title": "" }, { "docid": "4723d8e1727a228108c8c4cbd8056c90", "score": "0.6464633", "text": "def app_url\n ENV['APP_URL']\nend", "title": "" }, { "docid": "11cb12c400b5f9c93da81a31c0d94041", "score": "0.6462934", "text": "def check_vars\n req_env_vars = ['REDMINE_BASE_URL', 'REDMINE_API_KEY', 'SLACK_WEBHOOK_URL', 'DATABASE_URL']\n missing_env_vars = req_env_vars - ENV.keys\n unless missing_env_vars.empty?\n puts \"The following environment variables are required: #{missing_env_vars.join ', '}\"\n exit\n end\nend", "title": "" }, { "docid": "1916614c4f70334f56f5e5bcbe9b73c7", "score": "0.6451621", "text": "def hacked_env\n @hacked_env ||= {}\n end", "title": "" }, { "docid": "79dba7c77a02475a86219823aca02f54", "score": "0.6449346", "text": "def env\n Thread.current[ENVIRONMENT] or raise(\"no env in scope\")\n end", "title": "" }, { "docid": "185c081da08fdcf6af37407c303721d2", "score": "0.644171", "text": "def registered_env_vars\n @registered_env_vars = @registered_env_vars || {}\n end", "title": "" }, { "docid": "185c081da08fdcf6af37407c303721d2", "score": "0.644171", "text": "def registered_env_vars\n @registered_env_vars = @registered_env_vars || {}\n end", "title": "" }, { "docid": "23921d8a6e12b58baa347d2e86b3f726", "score": "0.64387244", "text": "def env\n legacy_env || app_env\n end", "title": "" }, { "docid": "fe5f9381d7e75462e81bf00f98272eb7", "score": "0.64342827", "text": "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "title": "" }, { "docid": "ea11a24a588254fe119098750cbcda05", "score": "0.64328706", "text": "def env\n site.env\n end", "title": "" }, { "docid": "7ee577add1330ed382b9a54c08c9f471", "score": "0.6430326", "text": "def load_env(environment=nil)\n environment ||= \"production\"\n load_dot_env \".env\" if environment == \"production\"\n load_dot_env \".env.#{environment}\"\nend", "title": "" }, { "docid": "371772f9dc2d713be576597a3cead683", "score": "0.64196926", "text": "def env\n @env\n end", "title": "" }, { "docid": "d6e5f42921a5557277e1503e1045d8b9", "score": "0.6417601", "text": "def env_config\n @env_config ||= {}\n end", "title": "" }, { "docid": "2a5ec1f7fd2ae6d8e47a74849008e1b3", "score": "0.6400022", "text": "def default_envs\n {\n \"PATH\" => \"\"\n }\n end", "title": "" }, { "docid": "bd688e9c22e3f7616caaa7e222117c91", "score": "0.6395809", "text": "def check_and_set_environment\n check_env\n set_env\n end", "title": "" }, { "docid": "0cf74f283f46be3d488424694580a074", "score": "0.6391985", "text": "def env_brine_vars\n ENV.select{|k, v| k.start_with? 'BRINE_VAR_'}\n .transform_keys{|k| k.delete_prefix 'BRINE_VAR_' }\n end", "title": "" }, { "docid": "309eac4d886e6bc367f092ac4d4a1f4b", "score": "0.6386747", "text": "def env\n @_env ||= ActiveSupport::EnvironmentInquirer.new(ENV[\"RAILS_ENV\"].presence || ENV[\"RACK_ENV\"].presence || \"development\")\n end", "title": "" }, { "docid": "788815bf7fa7aa3eec5b11fea461bc46", "score": "0.63782454", "text": "def launcher_env_options(opts)\n if getenv(\"AUTH_TYPE\") == \"RANDOM\"\n ## each day we want to use different auth type ignoring weekends\n time = Time.now\n day_of_year = time.yday\n passed_weeks_of_year = time.strftime('%W').to_i - 1\n opts[:auth_type] = ALTERNATING_AUTH[\n (day_of_year - 2 * passed_weeks_of_year) % ALTERNATING_AUTH.size\n ]\n elsif getenv(\"AUTH_TYPE\")\n opts[:auth_type] = getenv(\"AUTH_TYPE\")\n end\n\n # workaround https://issues.jenkins-ci.org/browse/JENKINS-30719\n # that means to remove extra `\\` chars\n ENV['IMAGE_PRE'] = ENV['IMAGE_PRE'].gsub(/\\\\\\${/,'${') if ENV['IMAGE_PRE']\n\n keys = [:crt_path, :deployment_type,\n :hosts_spec, :auth_type,\n :ssh_key, :ssh_user,\n :app_domain, :host_domain,\n :rhel_base_repo,\n :dns, :set_hostnames,\n :use_rpm_playbook,\n :use_nfs_storage,\n :image_pre,\n :puddle_repo,\n :etcd_num,\n :pre_ansible,\n :ansible_url,\n :customized_ansible_conf,\n :kerberos_docker_base_image,\n :kerberos_kdc, :kerberos_keytab_url,\n :kerberos_docker_base_image,\n :kerberos_admin_server]\n\n keys.each do |key|\n val = getenv(key.to_s.upcase)\n opts[key] = val if val\n end\n\n opts[:use_rpm_playbook] = false unless to_bool(opts[:use_rpm_playbook])\n opts[:use_nfs_storage] = false unless to_bool(opts[:use_nfs_storage])\n end", "title": "" }, { "docid": "c7c2be03d3f81ec029c25d35884aafd5", "score": "0.6370321", "text": "def load_integ_environment_vars\n env_file = File.join(__dir__, 'config/local_env_integ.yml')\n env_key_vals = YAML.load_file(env_file)\n %w[\n SqsQueueIntegTests_QueueUrl\n SqsQueueIntegTests_QueueRegion\n SqsQueueIntegTests_AccessId\n SqsQueueIntegTests_SecretKey\n ].each { |var| ENV[var] = env_key_vals.fetch(var) }\nend", "title": "" }, { "docid": "9a68f7793f4828c65dac21dc1974f195", "score": "0.6365555", "text": "def environ\n\t\tif @os.to_i == 0\n\t\t\tputs \"[\".light_red + \"X\".white + \"] Your target appears to be Winblows\".light_red + \"!\".white\n\t\t\tputs \"[\".light_red + \"X\".white + \"] This option is only available for *nix machines\".light_red + \"!\".white\n\t\telse\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Testing for \".light_green + \"/proc/self/environ\".white + \" RCE Vuln\".light_green + \".....\".white\n\n\t\t\tfilez = [ \"proc/self/./environ\", \"proc/self/environ\" ]\n\n\t\t\t@ua=0\n\t\t\t@found=0\n\t\t\t@accept=0\n\t\t\twhile @found.to_i < 1\n\t\t\t\tfilez.each do |file|\n\t\t\t\t\tif $module_required['Min'].to_i == 0\n\t\t\t\t\t\t@thegoods=\"/#{file}\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@thegoods=\"#{@stepstone}#{file}\"\n\t\t\t\t\tend\n\t\t\t\t\tbody = basicregex(@thegoods, 69)\n\t\t\t\t\t#Regex for /proc/self/environ file\n\t\t\t\t\tif body =~ /HTTP_USER_AGENT=/ or body =~ /HTTP_ACCEPT=/ or body =~ /DOCUMENT_ROOT=/ or body =~ /VHOST_ROOT=/ or body =~ /HTTP_HOST/\n\t\t\t\t\t\t@environ = 'true'\n\t\t\t\t\t\tif body =~ /HTTP_USER_AGENT=/\n\t\t\t\t\t\t\t@ua = 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif body =~ /HTTP_ACCEPT=/\n\t\t\t\t\t\t\t@accept = 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\t#Successful injection will match our regex, failure won't (concat on exec proves its working)\n\t\t\t\t\t\tif body =~ /:#{@rnd}:(.+):#{@rnd}:/ \n\t\t\t\t\t\t\t@envirores = $1 #make results available\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@found = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\t@environ = 'false'\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif @found.to_i == 0\n\t\t\t\t\t@found = 2 #break cause we are out of file options to test, will use value to offset from true success...\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif @environ == 'true'\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] File Found: \".light_green + \"/proc/self/environ\".white\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] User-Agent is present in response\".light_green + \"!\".white if @ua.to_i == 1\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] Accept Header is present in response\".light_green + \"!\".white if @accept.to_i == 1\n\t\t\t\tenvirosupport\n\t\t\telse\n\t\t\t\tputs \"[\".light_red + \"X\".white + \"] Sorry, \".light_red + \"/proc/self/environ\".white + \" doesn't appear to be available\".light_red + \".....\".white\n\t\t\t\tputs \"[\".light_red + \"X\".white + \"] Returning to Previous Menu\".light_red + \"...\".white\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "ed1a25191798e1e854ecea1c4efafd44", "score": "0.63549274", "text": "def default_environment=(env); end", "title": "" }, { "docid": "297453b6d2cd86a3038f8f375c9ece21", "score": "0.6354345", "text": "def env\n env = job[:env]\n env = env - (config[:env].is_a?(Hash) && config[:env][:global] || []) if env\n env = env - config[:global_env] if config[:global_env].is_a?(Array)\n env\n end", "title": "" }, { "docid": "be681d028c6d31d40b28b529554c22e9", "score": "0.6349374", "text": "def environment\n 'dev'\nend", "title": "" }, { "docid": "3b54b517523b68fe4dc1e6f783d3e8f0", "score": "0.634294", "text": "def config\n {\n :APP_NAME => APP_NAME,\n :APP_ENV => APP_ENV,\n :AWS_ACCESS_KEY_ID => AMI_ACCESS_KEY_ID,\n :AWS_SECRET_ACCESS_KEY => AMI_SECRET_ACCESS_KEY\n }\nend", "title": "" }, { "docid": "d1b31c56a8bf70a98bf4c11c10ae087a", "score": "0.633872", "text": "def args_env_vars\r\n puts \"SMS Order Notifier for Blomming, release: 1 February 2014, by: [email protected]\"\r\n puts \"CTRL+C to stop\"\r\n\r\n # get necessary environment variables\r\n @username = ENV['SMSNOTIFIER_SKEBBY_USERNAME']\r\n @password = ENV['SMSNOTIFIER_SKEBBY_PASSWORD'] \r\n @seller_cell_number = ENV['SMSNOTIFIER_SELLER_PHONENUM']\r\n\r\n if @username.nil? || @password.nil? || @seller_cell_number.nil?\r\n puts \"please set environment variables:\"\r\n puts \"export SMSNOTIFIER_SKEBBY_USERNAME=your_skebby_username\"\r\n puts \"export SMSNOTIFIER_SKEBBY_PASSWORD=your_skebby_password\"\r\n puts \"export SMSNOTIFIER_SELLER_PHONENUM=seller_cell_number as: <country_prefix><number> by example: 391234567890\"\r\n exit 1\r\n end\r\n\r\n # get Blomming YAML configuration filename\r\n if ARGV[0].nil?\r\n puts \" usage: #{$0} <blomming_config_file.yml>\" \r\n puts \"example: ruby #{$0} $CONFIG\"\r\n exit 2\r\n end\r\n\r\n blomming_config_file = ARGV[0]\r\nend", "title": "" } ]
7572e69f587d4adde9a698abbac44c29
PUT /carts/1 PUT /carts/1.xml
[ { "docid": "b1aa26a28e08640fa5872183b1372c43", "score": "0.0", "text": "def update\n #@cart_item = session_cart.shopping_cart_items.find(params[:id])\n\n respond_to do |format|\n if session_cart.update_attributes(params[:cart])\n if params[:commit] && params[:commit] == \"checkout\"\n format.html { redirect_to( checkout_shopping_order_url('checkout')) }\n else\n format.html { redirect_to(shopping_cart_items_url(), :notice => I18n.t('item_passed_update') ) }\n end\n else\n format.html { redirect_to(shopping_cart_items_url(), :notice => I18n.t('item_failed_update') ) }\n end\n end\n end", "title": "" } ]
[ { "docid": "8a71d9c7ea55392fb47b2f950a1b0495", "score": "0.65048224", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n flash[:notice] = 'Cart was successfully updated.'\n format.html { redirect_to(@cart) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a61910aa4c9849870bcc30c07c746c5b", "score": "0.6461822", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to(@cart, :notice => 'Cart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a61910aa4c9849870bcc30c07c746c5b", "score": "0.6461822", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to(@cart, :notice => 'Cart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "222a267ca25f4495cb89146d5f5e3b9d", "score": "0.6434016", "text": "def update_cart(payload, params={})\n execute(method: :put, url: \"#{base_path}/cart\", params: params, payload: payload.to_json)\n end", "title": "" }, { "docid": "1e9068928ebdb3216f737cf639719d5a", "score": "0.6390018", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to carts_path, notice: 'Quantity updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57150fd796cd4ce789e7805b70dc8a1c", "score": "0.63760173", "text": "def update\n if @cart.update(cart_params)\n render json: @cart\n else\n render json: @cart.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "7e64f9a6216d38cada5155a5ddd6c97a", "score": "0.63653684", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n flash[:notice] = 'Cart was successfully updated.'\n format.html { redirect_to(admin_carts_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f5c67a00245dfd4aadaa0c258e6b32df", "score": "0.63562423", "text": "def update\n if @cart.update(cart_params)\n render json: {\n status: :ok,\n message: 'Updated cart successfully'\n }\n else\n render json: {\n status: :internal_server_error,\n message: 'Error updating cart'\n }\n end\n end", "title": "" }, { "docid": "8fc0fcb59352fef95d83f7225fc25231", "score": "0.6326574", "text": "def update_cart\n @cart.add_item(params[:sku], 1) if params[:q] == \"add\"\n @cart.reduce_qty_of(params[:sku]) if params[:q] == \"reduce\"\n @cart.remove_item(params[:sku]) if params[:q] == \"remove\"\n\n respond_to do |format|\n format.json {\n render :json => update_cart_response\n }\n end\n end", "title": "" }, { "docid": "92b8b43d432322f190a30cbb9bd75c89", "score": "0.63123846", "text": "def update_cart\n self.cart.touch\n end", "title": "" }, { "docid": "eb6bd4b517e8bb7b4dead3937d59e79a", "score": "0.62911403", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93279e0700fb7d331333df3fdf1e0e37", "score": "0.6267406", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, :notice => 'Cart was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93279e0700fb7d331333df3fdf1e0e37", "score": "0.6267406", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, :notice => 'Cart was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc6e5334e4018ea3e6925b5a3d4394ca", "score": "0.62416816", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: \"Cart was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.6234508", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.6234508", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.6234508", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.6234508", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df4c26e75cc7831e533329a510eba5a6", "score": "0.6234508", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d9e43244924af04aa8b257eda64409d", "score": "0.6233329", "text": "def update\r\n @cart = Cart.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @cart.update_attributes(params[:cart])\r\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @cart.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "debfa5dd900df2caf2ee106d07e22bdf", "score": "0.62284803", "text": "def update\n @shop_cart = ShopCart.find(params[:id])\n\n respond_to do |format|\n if @shop_cart.update_attributes(params[:shop_cart])\n format.html { redirect_to(@shop_cart, :notice => 'Shop cart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shop_cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f96e6c8cb8a79464f4630f594fcc5756", "score": "0.6219759", "text": "def update\n @shoppint_cart = ShoppintCart.find(params[:id])\n\n respond_to do |format|\n if @shoppint_cart.update_attributes(params[:shoppint_cart])\n format.html { redirect_to(@shoppint_cart, :notice => 'ShoppintCart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shoppint_cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c611d018eb744945d8c2f44e0a7cc9c", "score": "0.621507", "text": "def update\n cart = params[\"cart\"]\n SyncLog.create(additional_info: cart)\n render status: 200, json: cart.to_json\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06e5c84fff1bc208ba6bed551bcb345e", "score": "0.6215002", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b279e7a69c0b4779a61d9bb2ee7dd787", "score": "0.6211092", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e3dcf786cdd016a219dc2505cf077fe", "score": "0.6194067", "text": "def update\n @cartao = Cartao.find(params[:id])\n\n respond_to do |format|\n if @cartao.update_attributes(params[:cartao])\n flash[:notice] = 'Cartão atualizado com sucesso.'\n format.html { redirect_to(@cartao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cartao.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53561b0f037704fa2e113f786fc787fc", "score": "0.61891925", "text": "def update_cart_item\n\t\t@persona = Persona.where(:screen_name => params[:persona_id]).first\n\t\t@cart = @persona.carts.find(params[:cart_id])\n\t\trespond_to do |format|\n\t\t\tif @cart.update_attributes(params[:cart]) then\n\t\t\t\tformat.json { respond_with_bip @cart }\n\t\t\telse\n\t\t\t\tformat.json { respond_with_bip @cart }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "b061ea0432e4ae4183d2e9b1211311f7", "score": "0.61793214", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9dcd6f1db832ae80537f37b52223e1ea", "score": "0.61715823", "text": "def update\n @cartorio = Cartorio.find(params[:id])\n\n respond_to do |format|\n if @cartorio.update_attributes(params[:cartorio])\n flash[:notice] = 'Cartorio was successfully updated.'\n format.html { redirect_to(@cartorio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cartorio.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2268e5af05faed35487f3b1a9f56bdc3", "score": "0.616012", "text": "def update\n @cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @cart.update_attributes(params[:cart])\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "647a47822b2a55ae149beda1ad939001", "score": "0.61595017", "text": "def update\n \n \n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "593f50d7ac25f8ab93ed95a960d242f8", "score": "0.61561406", "text": "def update\n @home_categories_products_indices_cart = Home::Categories::Products::Indices::Cart.find(params[:id])\n\n respond_to do |format|\n if @home_categories_products_indices_cart.update_attributes(params[:home_categories_products_indices_cart])\n format.html { redirect_to @home_categories_products_indices_cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home_categories_products_indices_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.6125662", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.6125662", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.6125662", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.6125662", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.6125662", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.6125662", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9111b980ecfe1995443f1089b9a3848d", "score": "0.6125662", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aabd357abf4c4ad53038a7d3f2b83ffc", "score": "0.611718", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to(@cart_item, :notice => 'Cart item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94fb02654e184f5498eff4e03c0573f8", "score": "0.6108752", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, greenNotice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "daf88b95b6a86589146568f0703f75b8", "score": "0.6102343", "text": "def update\n @cart_item = CartItem.find(params[:id])\n\n respond_to do |format|\n if @cart_item.update_attributes(params[:cart_item])\n format.html { redirect_to(@cart_item, :notice => 'Cart item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85d85959739a9c2d6c51c7b1b1ab235b", "score": "0.6085274", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to user_carts_path(user_id: session[:login]), notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "863f5df3428757786003675f78aa608b", "score": "0.6082132", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to :back, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5ebcf7069d4cf267f7aa6686ffec126", "score": "0.60711586", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "3b5efdc6ecfbe8970f938ccfc3c99c7c", "score": "0.6067324", "text": "def update\n respond_to do |format|\n if @cart1.update(cart1_params)\n format.html { redirect_to @cart1, notice: 'Cart1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart1.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99ac3993a837c0ff6e13ae56d1deb023", "score": "0.60622674", "text": "def update\n @resarch_cart = ResarchCart.find(params[:id])\n\n respond_to do |format|\n if @resarch_cart.update_attributes(params[:resarch_cart])\n format.html { redirect_to @resarch_cart, notice: 'Resarch cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resarch_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc993ac9b2971c33c527b5bdd9062497", "score": "0.60537684", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html {redirect_to @cart, notice: 'Cart was successfully updated.'}\n format.json {render :show, status: :ok, location: @cart}\n else\n format.html {render :edit}\n format.json {render json: @cart.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "a3eaec61656ae5c68de6cee9ba71c80e", "score": "0.60507834", "text": "def modify_cart (params)\n request_params = {\n 'Service' => @service,\n 'Operation' => 'CartModify',\n 'CartId' => params['cart']['id'],\n 'HMAC' => params['cart']['hmac'],\n 'URLEncodedHMAC' => params['cart']['urlencodedhmac'],\n 'AWSAccessKeyId' => @access_key_id,\n 'AssociateTag' => @associate_tag,\n 'Item.1.CartItemId' => params['item']['cart_item_id'],\n 'Item.1.Quantity' => params['item']['qty'],\n 'ResponseGroup' => 'Cart'\n }\n\n # create signed url with all data\n signed_url = self.create_url(request_params)\n\n # make call to api\n response_from_aws = Nokogiri::HTML(open(signed_url))\n\n # grab error messages from nokogiri object\n errors = response_from_aws.xpath(\"//errors\").text\n is_valid = response_from_aws.xpath(\"//isvalid\").text\n\n # send response\n return is_valid\n end", "title": "" }, { "docid": "149ca2269bf28d98ca92f611f955e26c", "score": "0.6029309", "text": "def update\n find_cart\n item = @cart.cart_items.find(params[:cart_item_id])\n if item\n item.update_attributes(:quantity => params[:qty])\n end\n redirect_to cart_path\n end", "title": "" }, { "docid": "933afd44d965ed2a9a414531b47cdf9a", "score": "0.5995944", "text": "def index\n update_cart_items\n end", "title": "" }, { "docid": "ebeb41fa3fb731457283b9c74dde12bf", "score": "0.59871596", "text": "def update\n @rent_cart = RentCart.find(params[:id])\n\n respond_to do |format|\n if @rent_cart.update_attributes(params[:rent_cart])\n format.html { redirect_to(@rent_cart, :notice => 'RentCart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rent_cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "855fa644985c5a8ab98ec5252d5f033a", "score": "0.59817857", "text": "def update\n @cartt = Cartt.find(params[:id])\n\n respond_to do |format|\n if @cartt.update_attributes(params[:cartt])\n format.html { redirect_to @cartt, notice: 'Cartt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cartt.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37dea2be1a223afd8ed62d1ead85d4f6", "score": "0.5980468", "text": "def update\n @shop_cart = ShopCart.find(params[:id])\n\n respond_to do |format|\n if @shop_cart.update_attributes(shop_cart_params)\n format.html { redirect_to @shop_cart, notice: 'Shop cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a809bcb66a3ecd190e1de67f88f9a34c", "score": "0.59459394", "text": "def update\n @cartitem = Cartitem.find(params[:id])\n\n respond_to do |format|\n if @cartitem.update_attributes(params[:cartitem])\n format.html { redirect_to cart_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cartitem.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cae1a1667e7f817b0112aff35298ccec", "score": "0.5942613", "text": "def update\n @cart = Cart.find(params[:cart_id])\n @item = @cart.items.find(params[:id])\n @item.update(item_params)\n \n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @cart, notice: 'Товаров изменен.' }\n format.json { render :show, status: :created, location: @cart }\n else\n format.html { render :new }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ca392278a6051881aaf9cfce68978192", "score": "0.5940204", "text": "def update\n respond_to do |format|\n if @cartsitem.update(cartsitem_params)\n format.html { redirect_to @cartsitem, notice: 'Cartsitem was successfully updated.' }\n format.json { render :show, status: :ok, location: @cartsitem }\n else\n format.html { render :edit }\n format.json { render json: @cartsitem.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bc0ff0ba29b5d9bbc241556bad03f31", "score": "0.5936741", "text": "def update\n respond_to do |format|\n if @item_cart.update_attributes(item_cart_params)\n format.html { redirect_to @item_cart, notice: \"Item cart was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item_cart }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "391da254546ac0641c399c30cd2b1b2e", "score": "0.59364027", "text": "def update\n @admin_shopping_cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @admin_shopping_cart.update_attributes(params[:admin_shopping_cart])\n format.html { redirect_to(@admin_shopping_cart, :notice => 'Cart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @admin_shopping_cart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94aa615ef05478dac5ef65304c66ca58", "score": "0.59341395", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to products_url(@cart.product), notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f1492a7ac1c200367018fd4582ab20c", "score": "0.5932948", "text": "def update\n @mycart = Mycart.find(params[:id])\n\n respond_to do |format|\n if @mycart.update_attributes(params[:mycart])\n flash[:notice] = 'Mycart was successfully updated.'\n format.html { redirect_to(@mycart) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mycart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91427802eb406f38bee7bb663edfe70f", "score": "0.5926431", "text": "def update\n @cart2 = Cart2.find(params[:id])\n\n respond_to do |format|\n if @cart2.update_attributes(params[:cart2])\n format.html { redirect_to @cart2, notice: 'Cart2 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cart2.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb88402e2d986005ec254095d3deb56d", "score": "0.5921081", "text": "def update\n respond_to do |format|\n if @item_cart.update(item_cart_params)\n format.html { redirect_to catigories_path, notice: 'Item cart was successfully added to your cart.' }\n format.json { render :show, status: :ok, location: @item_cart }\n else\n format.html { render :edit }\n format.json { render json: @item_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "040b8518276c72565b70b658586b3555", "score": "0.59165645", "text": "def update \r\n shoppingCart = ShoppingCart.find(params[:id])\r\n setTotalPrice\r\n if shoppingCart.update_attributes(shopping_cart_params)\r\n render json: {\r\n status: 'SUCCESS',\r\n message: 'Updated specific shopping cart',\r\n data: shoppingCart\r\n }, status: :ok\r\n else\r\n render json: {\r\n status: 'ERROR',\r\n message: 'Could not update specific shopping cart',\r\n data: shoppingCart.errors\r\n }, status: :unprocessable_entity\r\n end\r\n end", "title": "" }, { "docid": "043f4b1c05a36a6d2f9ba68315dd9dff", "score": "0.5908724", "text": "def update\n @shoppingcart = Shoppingcart.find(params[:id])\n\n respond_to do |format|\n if @shoppingcart.update_attributes(params[:shoppingcart])\n format.html { redirect_to(@shoppingcart, :notice => 'Shoppingcart was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shoppingcart.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8941f046aca3a4ff66335822204887ec", "score": "0.59033084", "text": "def update\n @carton_box = CartonBox.find(params[:id])\n\n respond_to do |format|\n if @carton_box.update_attributes(params[:carton_box])\n format.html { redirect_to @carton_box, notice: 'Carton box was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carton_box.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "443bf968427b88319c760083ef4040aa", "score": "0.58865035", "text": "def update\n @active_cart = Cart.find(params[:id])\n\n respond_to do |format|\n if @active_cart.update_attributes(params[:cart])\n format.html { redirect_to @active_cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @active_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37cf8df76323a109d7fc5e1b63ab43e1", "score": "0.58791965", "text": "def update\n respond_to do |format|\n if @cart_with_item.update(cart_with_item_params)\n format.html { redirect_to @cart_with_item, notice: 'Cart with item was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart_with_item }\n else\n format.html { render :edit }\n format.json { render json: @cart_with_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91135f252e471edfd0e0bee2b0146c53", "score": "0.5840641", "text": "def update\n if @cartitem.update(cartitem_params)\n render json: @cartitem\n else\n render json: @cartitem.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "27242261b26dc28331a6d4f2b85dc765", "score": "0.58378845", "text": "def update\n respond_to do |format|\n if @admin_cart.update(admin_cart_params)\n format.html { redirect_to @admin_cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_cart }\n else\n format.html { render :edit }\n format.json { render json: @admin_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e1fe262c603be3d85ea9206bc73cfcf7", "score": "0.58217", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4d30f4f8cd98e55970a9be0c0ac729b2", "score": "0.5820997", "text": "def update\n @cart_row = CartRow.find(params[:id])\n\n respond_to do |format|\n if @cart_row.update_attributes(params[:cart_row])\n flash[:notice] = 'CartRow was successfully updated.'\n format.html { redirect_to(@cart_row) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cart_row.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d1d2a18e470947cb118e73b6589e224b", "score": "0.58201236", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: \"Cart item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d1d2a18e470947cb118e73b6589e224b", "score": "0.58201236", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: \"Cart item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b467f4a308ea8e3b5fabcbf477786b4", "score": "0.5796279", "text": "def update\n respond_to do |format|\n if @carts_product.update(carts_product_params)\n format.html { redirect_to carts_products_url, notice: 'Quantity was successfully updated.' }\n format.json { render :show, status: :ok, location: @carts_product }\n else\n format.html { render :edit }\n format.json { render json: @carts_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be6ee9957632aca2a3f951bb5d9ca186", "score": "0.57928765", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be6ee9957632aca2a3f951bb5d9ca186", "score": "0.57928765", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85e2d8344e8d84329c2dc7d89d2dbba0", "score": "0.5782744", "text": "def update_cart_with_http_info(cart, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CheckoutApi.update_cart ...'\n end\n # verify the required parameter 'cart' is set\n if @api_client.config.client_side_validation && cart.nil?\n fail ArgumentError, \"Missing the required parameter 'cart' when calling CheckoutApi.update_cart\"\n end\n # resource path\n local_var_path = '/checkout/cart'\n\n # query parameters\n query_params = {}\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(cart)\n auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CartResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CheckoutApi#update_cart\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "eea211556b87ede4c941a4ff5325541a", "score": "0.5782064", "text": "def update\n @m_cart = MCart.find(params[:id])\n\n respond_to do |format|\n if @m_cart.update_attributes(params[:m_cart])\n format.html { redirect_to @m_cart, notice: 'M cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2cb6bbdc3f3e45fd6e2881bf040fc60f", "score": "0.5753725", "text": "def update\n respond_to do |format|\n if @cart.update(cart_params)\n @cart.cart_items.each do |item|\n\t\t if item.quantity == 0\n item.destroy\n end\n end\n format.html { redirect_to action: \"index\", notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c551574e3c540ac82ca1bf18133adea", "score": "0.57483435", "text": "def update_cart(user = {}, items = [])\n data = {\n items: items,\n user: user\n }\n Iterable.request(conf, '/commerce/updateCart').post(data)\n end", "title": "" }, { "docid": "ad471d6e70ab977b1f39721d1477c6dd", "score": "0.5746417", "text": "def update\n shoppingCartItem = ShoppingCartItem.find(params[:id])\n shoppingCartItem.update(shoppingCartItem_params)\n render json: shoppingCartItem, except: [:updated_at, :created_at]\n end", "title": "" }, { "docid": "8f2714764bbb2e738e12c2ba0b745cd5", "score": "0.5745141", "text": "def update\n respond_to do |format|\n if @cart_item.update(cart_item_params)\n format.html { redirect_to @cart_item, notice: 'Cart item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac0b6cdf3e843b3df13cd5f58ed23731", "score": "0.5741369", "text": "def update_cart_item(id, payload, params={})\n validate_id!(id)\n execute(method: :put, url: \"#{base_path}/cart/items/#{id}\", params: params, payload: payload.to_json)\n end", "title": "" }, { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.57344294", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" } ]
177797b7e146f57365fc19cdfd9f60ef
POST /children POST /children.json
[ { "docid": "f2b0673a1bb580aa798149e50cf5e0de", "score": "0.5761691", "text": "def create\n @child = Child.new(child_params)\n base_uri = 'https://postjson-d117c.firebaseio.com/'\n @firebase = Firebase::Client.new(base_uri)\n kid = []\n child_params.each do |k,v|\n kid << k\n kid<< v\n \n end\n \n # render :json => kid\n\n response = @firebase.push(\"Child\", :name => kid[1.to_i].to_s, :age => kid[3.to_i].to_s)\n \n respond_to do |format|\n if response.success?\n format.html { redirect_to @child, notice: 'Child was successfully created.' }\n format.json { render :show, status: :created, location: @child }\n else\n format.html { render :new }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end \n end\n \n \n end", "title": "" } ]
[ { "docid": "50d9c02cec905d2ade6fa2c9f24cb035", "score": "0.7426617", "text": "def create_post!(params)\n @children.create! params\n end", "title": "" }, { "docid": "812a70516c81e60f615b2ac2a8d5d721", "score": "0.73090565", "text": "def create\n @children = Children.new(params[:children])\n\n respond_to do |format|\n if @children.save\n flash[:notice] = 'Children was successfully created.'\n format.html { redirect_to(@children) }\n format.xml { render :xml => @children, :status => :created, :location => @children }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @children.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b9bd57d3f61741554401c7645932af7", "score": "0.685491", "text": "def children\n @pages = @page.children\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "5b25b7101a7199acf044d58155c5028a", "score": "0.6664779", "text": "def repair_children\n @obj = Node.find(params[:id])\n @obj.repair_children\n respond_to do |format|\n format.html {redirect_to nodes_url}\n format.json {render json: @obj}\n end\n end", "title": "" }, { "docid": "80ed3e75931db7ef0565f3334b809870", "score": "0.6652258", "text": "def children\n render json: { status: 'ok', content: [] }\n end", "title": "" }, { "docid": "82063887151f9d21a5b7d7bd3375c330", "score": "0.65630364", "text": "def create\n @child = Child.new(child_params)\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to children_path, notice: \"Child was successfully created.\" }\n format.json { render :show, status: :created, location: @child }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b5e918775a1a4e6720660aaa0ab7f67", "score": "0.6543847", "text": "def children\n @id = fix_id(params[:id], params[:format], params[:extra])\n if params[:root]==\"source\" then\n @isRoot = true;\n @work = DcmWork.new(@id)\n @children = [@work.pi]\n else\n @isRoot = false;\n @children = get_children(\"nla.\"+params[:root])\n end\n render :action => \"children.json\"\n end", "title": "" }, { "docid": "bcf81997b06b7dc9d5ceda95848d8724", "score": "0.651399", "text": "def children_for page, title\n page.children.create({\n :title => title,\n :deletable => true,\n :status => 'live',\n :show_in_menu => true,\n :parent_id => page.id\n })\nend", "title": "" }, { "docid": "6beb1d7bceaac12af964d04a888ea73c", "score": "0.6508057", "text": "def add_children\n parent = Event.find(params[:parent_id])\n parent.missing_children.each do |child|\n child.parent = parent\n child.save!\n end\n redirect_to(edit_admin_event_path(parent))\n end", "title": "" }, { "docid": "cc7017c0801682c6ae77405dd3fa34ab", "score": "0.6461266", "text": "def create\n @provider = Provider.find(params[:provider_id])\n @child = @provider.children.create(child_params)\n # @child = Child.new(child_params)\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to :back, notice: 'Child was successfully created.' }\n format.json { render :show, status: :created, location: @child }\n else\n format.html { render :new }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "847621b10831bfd5c284f0368d141a58", "score": "0.6390719", "text": "def add_children children\n children.each { |child| add_child child }\n end", "title": "" }, { "docid": "04a4bd21c58575fb8f4d6a79f102c841", "score": "0.6346286", "text": "def children\n\t@child = Child.find(params[:id])\n\t@parents = @child.parents.all\n\trespond_to do |format|\n\t\tformat.js { }\n\tend\n end", "title": "" }, { "docid": "2ef3fd665d54c22c9ab43f3b9dc6f360", "score": "0.62191105", "text": "def children\n parent_id = params['parent_id']\n\n children = Child.includes(:bursts).where(parent_id: parent_id).map{ |child|\n last_burst = child.bursts.last\n burst_rate = last_burst.present? ? calc_burst_rate(last_burst) : 0\n\n {\n id: child.id,\n name: child.name,\n burst_rate: burst_rate\n }\n }\n\n render json: children\n end", "title": "" }, { "docid": "f6aefebbfd875243794eeebb8fa815db", "score": "0.61931896", "text": "def create\n @child = Child.new(child_params)\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to @child, notice: 'Child was successfully created.' }\n format.json { render :show, status: :created, location: @child }\n else\n format.html { render :new }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbcb9a1515b4302af56619b379d0c62c", "score": "0.6185605", "text": "def create_children(&block)\n if respond_to?(:response)\n self.response &block\n else\n block.call if block_given?\n end\n end", "title": "" }, { "docid": "a72ddf22566db29406a02eab805a5ca5", "score": "0.61737835", "text": "def create\n @kid = Kid.create(kid_params)\n @parent = Parent.find(params[:parent_id])\n @parent.kids << @kid\n redirect_to parent_kids_path\n # render json: @kid, status: 201\n end", "title": "" }, { "docid": "487213a8f1adecb7bfbd00dc74413136", "score": "0.6164681", "text": "def create\n @child = Child.new(child_params)\n \n respond_to do |format|\n if @child.save\n format.html { redirect_to @child, notice: 'Child was successfully created.' }\n format.json { render action: 'show', status: :created, location: @child }\n else\n format.html { render action: 'new' }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "d89aa9426463137948fa0a6753a97f9f", "score": "0.6148178", "text": "def index\n children = []\n base_uri = 'https://postjson-d117c.firebaseio.com/'\n @firebase = Firebase::Client.new(base_uri)\n childrenjs = @firebase.get(\"Child\")\n parsed = JSON.parse(childrenjs.raw_body)\n kids = parsed.deep_symbolize_keys\n\n kids.uniq.each do |key, value|\n value.each do |key2, value2|\n children << value\n end\n end \n \n@children = children.flatten.uniq\n # render :json => @children\n\n end", "title": "" }, { "docid": "48190cec216d8c31e250661a8139e886", "score": "0.613725", "text": "def add_children(child_ids)\n\t\tchild_ids.each do |child_id|\n\t\t\tself.passoc.create(:child_id => child_id)\n\t\tend\n\tend", "title": "" }, { "docid": "7e38ae83cebd4303576755df8b69b976", "score": "0.61069894", "text": "def new\n @children = Children.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @children }\n end\n end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "0b7f7f62ae4d027851d78a4dbbf4411e", "score": "0.6087279", "text": "def children; end", "title": "" }, { "docid": "3e951ff99f834ff0328f6126109bce43", "score": "0.60814947", "text": "def add_children(kids)\n i = 0\n while i < kids.size\n t = kids.get(i)\n add_child(t)\n i += 1\n end\n end", "title": "" }, { "docid": "0249644a55d1149ef9d9949e78261d72", "score": "0.6076403", "text": "def _children\n @children\n end", "title": "" }, { "docid": "0249644a55d1149ef9d9949e78261d72", "score": "0.6076403", "text": "def _children\n @children\n end", "title": "" }, { "docid": "0249644a55d1149ef9d9949e78261d72", "score": "0.6076403", "text": "def _children\n @children\n end", "title": "" }, { "docid": "0249644a55d1149ef9d9949e78261d72", "score": "0.6076403", "text": "def _children\n @children\n end", "title": "" }, { "docid": "bdf78054bbc4baa0cf8483b0b69b5f22", "score": "0.6040731", "text": "def create\n @child = Child.new(params[:child])\n @child_crud = true\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to children_url, notice: 'Child was successfully created.' }\n format.js { @current_child = @child}\n format.json { render json: @child, status: :created, location: @child }\n else\n format.html { render :layout => false, action: \"new\"}\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "384d67fb977b94d33ca1ff09ad8665f3", "score": "0.6014053", "text": "def create\n @child = Child.new(child_params)\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to @child, notice: \"Child was successfully created.\" }\n format.json { render :show, status: :created, location: @child }\n format.js {}\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "title": "" }, { "docid": "6aed3b73049b2c3e1aaa20b8f7fd1e6b", "score": "0.5991178", "text": "def update_children\n self.children.each do |child|\n child.update_children\n unless child.new_record?\n child.save\n child.move_to_child_of(self) if child.parent_id != self.id\n end\n end if self.changed?\n end", "title": "" }, { "docid": "8a9f6de6abe1664fc786ba00976bace6", "score": "0.59824413", "text": "def children\n @children\n end", "title": "" }, { "docid": "8a9f6de6abe1664fc786ba00976bace6", "score": "0.59824413", "text": "def children\n @children\n end", "title": "" }, { "docid": "9718de7f1245bff0804708d2f3cf94b1", "score": "0.5971857", "text": "def get_children\n @children\n end", "title": "" }, { "docid": "d312a267f068bda631ffb7f7841e7728", "score": "0.5971483", "text": "def get_children\n \t@children\n end", "title": "" }, { "docid": "649310284782eb9912c36073d5a7382e", "score": "0.59694374", "text": "def children\n @resource.children\n end", "title": "" }, { "docid": "30f3b2ec627aca35918b04ce997ea32e", "score": "0.5960736", "text": "def add_new_child(name)\n\tnew_child = Child.new(name)\n\tnew_hash = {}\n\tnew_child.instance_variables.each {|item| new_hash[item.to_s.delete('@')] = new_child.instance_variable_get(item)}\n\tChildren[\"children\"].push(new_hash)\n\tupdate_file('children.yaml', Children)\nend", "title": "" }, { "docid": "84e898f0dd1c62781c1bbbf7d047b42e", "score": "0.5959877", "text": "def create\n @traumatized_child = TraumatizedChild.new(traumatized_child_params)\n\n respond_to do |format|\n if @traumatized_child.save\n format.html { redirect_to @traumatized_child, notice: \"Traumatized child was successfully created.\" }\n format.json { render :show, status: :created, location: @traumatized_child }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @traumatized_child.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bea90249a84ee3d043d4150b08b78bfe", "score": "0.59529954", "text": "def children\n attributes.fetch(:children)\n end", "title": "" }, { "docid": "3632f15c39fc0396ac73f519ca129e6d", "score": "0.594085", "text": "def create_from_children\n single_day_event = Event.find(params[:id])\n new_parent = MultiDayEvent.create_from_children(single_day_event.multi_day_event_children_with_no_parent)\n expire_cache\n redirect_to(action: :edit, id: new_parent.to_param)\n end", "title": "" }, { "docid": "738a607c54a4e889f11bbfec9d9f0232", "score": "0.5938283", "text": "def children\n @children ||= []\n end", "title": "" }, { "docid": "7b0d7df35e8294faed45284f56d865b9", "score": "0.593668", "text": "def _children\n @children\n end", "title": "" }, { "docid": "55a57aeef446cbb9327288ed1cd3c27f", "score": "0.5914673", "text": "def _children\n @children\n end", "title": "" }, { "docid": "573c582a0575daab511ad7be915aa113", "score": "0.591248", "text": "def addChildren(child)\n\t\tfm = Family.new\n\t\tfm.person_id = child.id\n\t\tfm.parent_id = id\n\t\tif fm.save\n\t\t\tputs 'children was added successfully!'\n\t\telse \n\t\t\tputs 'children was added unsuccessfully!'\n\t\tend\n\tend", "title": "" }, { "docid": "ad88a81df8ff7910f7637e47300b28ec", "score": "0.58921343", "text": "def index\n @dec_form_children = DecFormChild.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dec_form_children }\n end\n end", "title": "" }, { "docid": "4dbb283a8d041c3e40c3191ac70016a7", "score": "0.5862787", "text": "def new\n @child = Child.new\n @child_crud = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.html {render}\n format.json { render json: @child }\n end\n end", "title": "" }, { "docid": "c0c17099c437ceffa8c7534c7d6c3337", "score": "0.5814473", "text": "def add_child name\n @children << name\n end", "title": "" }, { "docid": "6d189c3d68db1a35583ca078b053d7c6", "score": "0.57930255", "text": "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "title": "" }, { "docid": "5ed26cb6bbf9b115df8bd8feaa6d3eb5", "score": "0.5791151", "text": "def children\n @children ||= {}.with_indifferent_access\n end", "title": "" }, { "docid": "8367027b0ecdd345dfa72a907915e7f0", "score": "0.57897633", "text": "def update\n @children = Children.find(params[:id])\n\n respond_to do |format|\n if @children.update_attributes(params[:children])\n flash[:notice] = 'Children was successfully updated.'\n format.html { redirect_to(@children) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @children.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c2e2c45512da4691cea9b62d52feb5c", "score": "0.57891524", "text": "def children\n []\n end", "title": "" }, { "docid": "1eab2a601a2b6fcf3ac137c740dd7f48", "score": "0.57747304", "text": "def add_children(more_children)\n @children.push(*more_children)\n end", "title": "" }, { "docid": "eaae4dedc73d7972cddb86d7fb25bc9f", "score": "0.57584965", "text": "def show\n if(params.has_key?(:children))\n if(params[:children] == \"true\")\n @node = Node.find(params[:id]).children\n end\n else\n @node = Node.find(params[:id])\n end\n render json: @node\n end", "title": "" }, { "docid": "e537bf99402c44f37d02a29a345dc158", "score": "0.57573414", "text": "def child\n @folder = Folder.new\n @folder.parent = Folder.find(params[:id])\n @folder.user = @current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @folder }\n end\n end", "title": "" }, { "docid": "beedcbc30b24d6dfbc5fca686d026af4", "score": "0.57303524", "text": "def add_child\n category_id = params[:id].gsub('category_', '')\n @category = Category.find(category_id)\n parent_id = params[:parent_id]\n if parent_id\n @parent = Category.find(parent_id)\n @category.parent = @parent \n else\n @category.parent = nil\n end\n @category.save!\n render :update do |page|\n page.remove(\"category_#{@category.id}_row\")\n if @parent\n if @parent.name == ASSOCIATION.short_name\n page.replace_html(\"category_root\", :partial => \"category\", :collection => @parent.children.sort)\n else\n page.call(:expandDisclosure, parent_id)\n end\n end\n if @parent.nil?\n page.replace_html(\"unknown_category_root\", :partial => \"category\", :collection => Category.find_all_unknowns.sort)\n end\n end\n end", "title": "" }, { "docid": "a6217bf9bc3bd954a5ab60801e48102a", "score": "0.572139", "text": "def create_child_items\n category.path.each do |category|\n create_child_item_for_category category\n end\n end", "title": "" }, { "docid": "435d7ac71194929a9bd246fba994b474", "score": "0.5713403", "text": "def children(max_distance=@default_distance)\n @children[0] = [@entity] if @children[0].empty?\n add_relatives(@children,1,max_distance,:children)\n @children\n end", "title": "" }, { "docid": "ceb82857a224c37970cea0ddd209719d", "score": "0.5701113", "text": "def children; []; end", "title": "" }, { "docid": "bb0d69660045cb775b7ed5a3795e6afd", "score": "0.5692246", "text": "def visit_children(parent)\n parent.children.each do |child|\n child.node_parent = parent\n visit(child)\n end\n end", "title": "" }, { "docid": "bb0d69660045cb775b7ed5a3795e6afd", "score": "0.5692246", "text": "def visit_children(parent)\n parent.children.each do |child|\n child.node_parent = parent\n visit(child)\n end\n end", "title": "" }, { "docid": "4c0f7e88cb89190f5f3217233f24926b", "score": "0.5663912", "text": "def children_get()\n @children\n end", "title": "" }, { "docid": "d4b2375e7df0f02b71049f3c31e37088", "score": "0.56474745", "text": "def create\n @user = current_user.children.create(params[:user].merge :email => \"design+parent_id#{current_user.id}_child_count#{current_user.children.count + 1}@newint.com.au\")\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_path(current_user), notice: 'User was successfully created.' }\n format.json { render json: [:institution, @user], status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73d7fed5539085d5b93e5676ba1f5088", "score": "0.56399584", "text": "def destroy\n @children = Children.find(params[:id])\n @children.destroy\n\n respond_to do |format|\n format.html { redirect_to(childrens_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9fe43c7b0b677a59f1e52d30f5933cd4", "score": "0.5629163", "text": "def child_params\n params.require(:child).permit(:id, :age, :name)\n end", "title": "" }, { "docid": "13c6c84d4c80c0fadf1c86766d86d0d8", "score": "0.56284034", "text": "def children\n []\n end", "title": "" }, { "docid": "0976b9feed66e6bbf9e0e18e867d9e44", "score": "0.5620404", "text": "def create_instance_children(instance)\n # Add children to component\n if children\n children.each do |child|\n instance.add_child(child.create())\n end\n end\n end", "title": "" }, { "docid": "f0e146595b9093e61e39d048835e94f5", "score": "0.5612894", "text": "def sync_child_pages\n children.each{ |p| p.save! } if full_path_changed?\n end", "title": "" }, { "docid": "4dc49121453e1246161254be8bcb5026", "score": "0.56090605", "text": "def create\n if params[:tag][:parent]==nil then params[:tag][:parent]=0 end\n if params[:tag][:parent].to_i>0\n parent=Tag.find(params[:tag][:parent])\n parent.children+=1\n parent.save\n end\n @tag = Tag.create(params[:tag])\n @tag.type_id=params[:tag][:type_id]\n @tag.save\n respond_to do |format|\n if @tag.valid?\n format.html { redirect_to(:action=>'new') }\n else\n format.html { redirect_to(:action=>'new') }\n format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3917c00541a34989ab9a90563ac7cf6f", "score": "0.55961263", "text": "def create\n child = Assembly.find(params[:child_id])\n @relationship = @assembly.relationships.build(child: child)\n child = @relationship.child\n child.used = true\n child.save\n\n respond_to do |format|\n if @relationship.save\n format.html { redirect_to [@plan, @assembly], notice: 'Relationship was successfully created.' }\n format.json { render json: @relationship, status: :created, location: @relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bc2407410d2bffdbddf7812b48685b9", "score": "0.5594224", "text": "def create_relationship_within\n authorize! :read, form_params[:child_id]\n\n if form.save\n notice = I18n.t('create_within', scope: 'hyrax.dashboard.nest_collections_form', child_title: form.child.title.first, parent_title: form.parent.title.first)\n redirect_to redirect_path(item: form.child), notice: notice\n else\n redirect_to redirect_path(item: form.child), flash: { error: form.errors.full_messages }\n end\n end", "title": "" }, { "docid": "7726c888d8af2b8b2fdd7ae3e325db4a", "score": "0.55928385", "text": "def new_child\n @parent = Comment.find(params[:id])\n @comment = @parent.children.new(user_id: current_user.id, task_id: @task.id)\n\n end", "title": "" }, { "docid": "17a6b3e63b2b42df94ac5d4d87543334", "score": "0.55854726", "text": "def add_child(child)\n \t\t@children << child\n \tend", "title": "" }, { "docid": "3dd90fddd3009618ae33bc3d43672651", "score": "0.5584218", "text": "def add_child\n @portfolio = @site.portfolios.build\n @parent_id = params[:id]\n render :action => 'new'\n end", "title": "" }, { "docid": "94c843e6dda4d14f8bda5c8f8ad7fb96", "score": "0.5583741", "text": "def create\n parent = Location.find(params[:location][:parent_id])\n @location = parent.children_class.new(params[:location])\n\n respond_to do |format|\n if @location.save\n flash[:notice] = 'Admin::Location was successfully created.'\n format.html { redirect_to(admin_location_path(@location)) }\n format.xml { render :xml => @location, :status => :created, :location => [:admin,@location] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @location.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9cd6758ddf5f0607480da6228d626ab2", "score": "0.5579625", "text": "def create_child(name, file_contents)\n # Parse the contents to ensure they are valid JSON\n begin\n object = Chef::JSONCompat.parse(file_contents)\n rescue Chef::Exceptions::JSON::ParseError => e\n raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, \"Parse error reading JSON creating child '#{name}': #{e}\")\n end\n\n # Create the child entry that will be returned\n result = make_child_entry(name, true)\n\n # Normalize the file_contents before post (add defaults, etc.)\n if data_handler\n object = data_handler.normalize_for_post(object, result)\n data_handler.verify_integrity(object, result) do |error|\n raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, nil, \"Error creating '#{name}': #{error}\")\n end\n end\n\n # POST /api_path with the normalized file_contents\n begin\n rest.post(api_path, object)\n rescue Timeout::Error => e\n raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, \"Timeout creating '#{name}': #{e}\")\n rescue Net::HTTPClientException => e\n # 404 = NotFoundError\n if e.response.code == \"404\"\n raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e)\n # 409 = AlreadyExistsError\n elsif $!.response.code == \"409\"\n raise Chef::ChefFS::FileSystem::AlreadyExistsError.new(:create_child, self, e, \"Failure creating '#{name}': #{path}/#{name} already exists\")\n # Anything else is unexpected (OperationFailedError)\n else\n raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, \"Failure creating '#{name}': #{e.message}\")\n end\n end\n\n # Clear the cache of children so that if someone asks for children\n # again, we will get it again\n @children = nil\n\n result\n end", "title": "" }, { "docid": "e82c2ababa69a134d06113d7e25e47ee", "score": "0.55790514", "text": "def children\n []\n end", "title": "" }, { "docid": "e82c2ababa69a134d06113d7e25e47ee", "score": "0.55790514", "text": "def children\n []\n end", "title": "" }, { "docid": "e82c2ababa69a134d06113d7e25e47ee", "score": "0.55790514", "text": "def children\n []\n end", "title": "" }, { "docid": "037ed10ecae0fc2983269bdf3c31b21a", "score": "0.5572978", "text": "def index\n @traumatized_children = TraumatizedChild.all\n end", "title": "" }, { "docid": "7ddbcd302b5b01afd998f05d0e839fac", "score": "0.5572228", "text": "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f5ce6549bdf488764e37b88e52273541", "score": "0.5568224", "text": "def create\n parent_id = params[:parent_id]\n if parent_id\n @category = Category.new(category_params.except(:edge))\n @edge = Edge.new(:weight => category_params[:edge][:weight])\n @parent_category = Category.find(parent_id)\n if @parent_category.children.create category_params.except(:edge)\n @category.id = @parent_category.children.where(:name => category_params[:name].upcase).first.id\n @edge.update_attributes(:start_node_id => parent_id.to_i, :end_node_id => @category.id)\n render :json => {:message => 'Category was successfully created.', :parent_id => parent_id, :id => @category.id, :name => @category.name}, :status => 200, :layout => false\n else\n render :json => {:message => 'Category failed to create.'}, :status => 400, :layout => false\n end\n end\n end", "title": "" }, { "docid": "16672caa67b34a6d840fecd54a28a506", "score": "0.5562058", "text": "def set_children\n all_mentees = self.mentees\n new_mentees = all_mentees\n\n while new_mentees.length > 0\n to_add = []\n new_mentees.each do |new_mentee|\n to_add << new_mentee.mentees.to_a\n end\n new_mentees = to_add.flatten!\n all_mentees << to_add\n end\n\n all_mentees.each do |mentee|\n mentee.lineage_id = self.lineage_id\n mentee.save\n end\n end", "title": "" }, { "docid": "701a2337c150098c264222993eb87a71", "score": "0.55620134", "text": "def children=(_arg0); end", "title": "" }, { "docid": "701a2337c150098c264222993eb87a71", "score": "0.55620134", "text": "def children=(_arg0); end", "title": "" }, { "docid": "afe8d1a71b1a6304f043de2547c1d76c", "score": "0.5561944", "text": "def descendant_params\n params.require(:descendant).permit(:name, :child_id)\n end", "title": "" }, { "docid": "ac3e8e3f39897294face2e75a27de9d6", "score": "0.55617225", "text": "def create\n \t\tif current_user.donor?\n\t\t\t@parent_child = current_user.parent_parent_children.new(parent_child_params)\n\t\telse\n\t\t\t@parent_child=current_user.build_child_parent_child(parent_child_params)\n\t\tend\n\n\t\trespond_to do |format|\n\t \t\tif @parent_child.save\n\t \t\t\tuser=User.find(@parent_child[:child_id])\n\t \t\t\tif current_user.student?\n\t \t\t\t\tuser.add_role :parent\n\t \t\t\t\tcurrent_user.add_role :child\n\t \t\t\t\tuser.add_role :parent,@parent_child\n\t \t\t\t\tcurrent_user.add_role :child,@parent_child\n\t \t\t\telse\n\t \t\t\t\tuser.add_role :child\n\t \t\t\t\tcurrent_user.add_role :parent\n\t \t\t\t\tuser.add_role :child,@parent_child\n\t \t\t\t\tcurrent_user.add_role :parent,@parent_child\n\t \t\t\tend\n\t\t\t\tformat.html { redirect_to @parent_child, notice: 'Parent child was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @parent_child }\n\t \t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @parent_child.errors, status: :unprocessable_entity }\n\t \t\tend\n\t\tend\n \tend", "title": "" }, { "docid": "e67b72597418312228c1500955f5cfcf", "score": "0.5558516", "text": "def child_params\n params.require(:child).permit(:name, :surname, :birthday, :lang, :hand, :school, :school_type, :school_lvl, :imagepath, :note, :archived, :version, :id_child, :id)\n end", "title": "" }, { "docid": "cee9af580f56de614fd388641378a430", "score": "0.5551233", "text": "def apply_children\n \n end", "title": "" }, { "docid": "10500ff8e380cc4bb734704895836e48", "score": "0.55494475", "text": "def children\n params[:scope] ||= \"private\"\n\n children = if params[:scope] == Scopes::SCOPE_PRIVATE\n @folder&.children ||\n current_user.nodes.where(parent_folder_id: nil)\n elsif params[:scope] == Scopes::SCOPE_PUBLIC\n @folder&.children ||\n Node.where(scope: params[:scope], parent_folder_id: nil)\n end\n\n if [Scopes::SCOPE_PRIVATE, Scopes::SCOPE_PUBLIC].include?(params[:scope])\n children = children.where.not(sti_type: \"Asset\")\n end\n\n children = children.where(scope: params[:scope]).order(:sti_type, :name)\n\n render json: children, root: \"nodes\", adapter: :json\n end", "title": "" }, { "docid": "e328c421c9144c943cd7ccb59bffef0d", "score": "0.55446285", "text": "def download_children(children, path)\n children.each do |child|\n new_path = \"#{path}/#{child.title}\"\n backup_folder_rec child.id, new_path if child.mimeType == FOLDER\n download_if_allowed_child child, new_path\n end\n end", "title": "" }, { "docid": "fff7fa96185977a18d36689dd1da664d", "score": "0.5541977", "text": "def create\n @child = Child.new_with_user_name(current_user_name, params[:child])\n respond_to do |format|\n if @child.save\n flash[:notice] = 'Child record successfully created.'\n format.html { redirect_to(@child) }\n format.xml { render :xml => @child, :status => :created, :location => @child }\n else\n format.html {\n @form_sections = get_form_sections_for_child @child\n render :action => \"new\"\n }\n format.xml { render :xml => @child.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
97b01f401b310832887bccd330d0fd3e
GET /allergen_components/1 GET /allergen_components/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "7021214e68687f3932b5c92cbc0c0633", "score": "0.743687", "text": "def components\n\t return JSON.parse(get(\"info/components.json\"))\n\tend", "title": "" }, { "docid": "6a980194ac676133468b7dde46a1192e", "score": "0.7231996", "text": "def index\n @allergen_components = AllergenComponent.all\n end", "title": "" }, { "docid": "c39fda7507d708614041aa0605780c54", "score": "0.69810456", "text": "def index\n @components = Component.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @components }\n end\n end", "title": "" }, { "docid": "8d7583c289658983f67f685c145ea671", "score": "0.6930576", "text": "def index\n @components = Component.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @components }\n end\n end", "title": "" }, { "docid": "4c4c629f5be926b9e2fe125704a3e881", "score": "0.6746842", "text": "def index\n @eg_components = EgComponent.all\n end", "title": "" }, { "docid": "e7daca08c8f7ddb1d5ddf950ebe9ecba", "score": "0.6717456", "text": "def index\n @components = Gooey::Component.all\n end", "title": "" }, { "docid": "a84abf5d494d1a1e447b7a14fabce39b", "score": "0.66498023", "text": "def request_components; end", "title": "" }, { "docid": "db2aa5899e00deab9076c29c5c71e512", "score": "0.6634321", "text": "def index\n\t@title = @header = 'Комплектующие'\n\t@component_types = ComponentType.order('name ASC')\n\t@components = []\n\tif params[:t] != nil and params[:t] != ''\n\t\t@componentType = ComponentType.find_by_id(params[:t])\n\telse\n\t\t@componentType = ComponentType.find_by_id(10)\n\tend\n\t@components = @componentType.components.select('id, name, cost, designation').order('name ASC') if @componentType != nil\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @components }\n end\n end", "title": "" }, { "docid": "2835727a2519e930992d248ef62fd3c0", "score": "0.66043514", "text": "def index\n @components = Component.all\n @components_grid = initialize_grid(Component, include: :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @components }\n end\n end", "title": "" }, { "docid": "8e310eac8277f7f0e3f0a1783758df2f", "score": "0.6495953", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "8e310eac8277f7f0e3f0a1783758df2f", "score": "0.6495953", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "8e310eac8277f7f0e3f0a1783758df2f", "score": "0.64959246", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "1ed2d669516800ced61b085401002bf7", "score": "0.64546853", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "cc4885ac7aaa42e60d3ce9a51dab9f1e", "score": "0.64018935", "text": "def index\n @components = Component\n\n apply_scopes_and_pagination\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @components }\n end\n end", "title": "" }, { "docid": "6d2041e44a1630ec223336e85c81558b", "score": "0.6382321", "text": "def show\n @component = Component.find(params[:id])\n\t@title = @header = @component.name\n\t@componentLinks = @component.component_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @component }\n end\n end", "title": "" }, { "docid": "84f8309fedbcb779ef2807e82ba2239f", "score": "0.6332945", "text": "def show\n @component = Component.find(params[:id])\n\t @title = @header = @component.name\n @photos = @component.photos.size > 1 ? @component.photos.where.not(id: @component.get_photo.id) : []\n\t @componentLinks = @component.component_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @component }\n end\n end", "title": "" }, { "docid": "262325989f76ccc8308e39d9b8152ba2", "score": "0.63251966", "text": "def get_component_family(opts)\n opts[:query]['all_elements'] = \"yes\"\n rest_crud_request(opts[:req_uri], opts[:query]['id'], opts[:format],\n {'Model Entity' => 'pack',\n 'Permission' => 'view'},\n opts[:user], opts[:query])\nend", "title": "" }, { "docid": "6ff580a3c957677879fc50f2de4703f5", "score": "0.6316037", "text": "def index\n @components = Component.all\n end", "title": "" }, { "docid": "6ff580a3c957677879fc50f2de4703f5", "score": "0.6316037", "text": "def index\n @components = Component.all\n end", "title": "" }, { "docid": "6ff580a3c957677879fc50f2de4703f5", "score": "0.6316037", "text": "def index\n @components = Component.all\n end", "title": "" }, { "docid": "6ff580a3c957677879fc50f2de4703f5", "score": "0.6316037", "text": "def index\n @components = Component.all\n end", "title": "" }, { "docid": "f7cfef8680cea5b778af01e8f5a89436", "score": "0.6296442", "text": "def create\n @allergen_component = AllergenComponent.new(allergen_component_params)\n\n respond_to do |format|\n if @allergen_component.save\n format.html { redirect_to @allergen_component, notice: 'Allergen component was successfully created.' }\n format.json { render action: 'show', status: :created, location: @allergen_component }\n else\n format.html { render action: 'new' }\n format.json { render json: @allergen_component.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a8067c17ece4aaceb188de6b97bd036a", "score": "0.6276696", "text": "def index\n list_components \n\n if @user.privilege == \"admin\"\n if params[:type] && params[:type] != \"all\"\n @components = Component.find_all_by_component_type(params[:type])\n else\n @components = Component.all\n end\n else\n @components = Component.find_all_by_client_id(@user.client_id)\n\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @components }\n end\n end", "title": "" }, { "docid": "6a506ed6e0cd24780c595ff56ff981ca", "score": "0.6250444", "text": "def set_allergen_component\n @allergen_component = AllergenComponent.find(params[:id])\n end", "title": "" }, { "docid": "f3b62306555325358d0782dfc0b01fae", "score": "0.6177214", "text": "def show\n @standard_component = StandardComponent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @standard_component }\n end\n end", "title": "" }, { "docid": "bc818a75834fc584b6fe5ef96d2307ac", "score": "0.6170897", "text": "def new\n @component = Component.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "bc818a75834fc584b6fe5ef96d2307ac", "score": "0.6170897", "text": "def new\n @component = Component.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "e8e62036a8bed31a0dc0d9614e9ee9da", "score": "0.61632246", "text": "def index\n @comps = Comp.all\n\n render json: @comps\n end", "title": "" }, { "docid": "1c0a31895b3fe98e4061f170b3fc8190", "score": "0.6129702", "text": "def show\n @component_model = ComponentModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_model }\n end\n end", "title": "" }, { "docid": "b02456ae24aeed1f3234ffbf6b13b8e1", "score": "0.6124438", "text": "def show\n @component_type = ComponentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_type }\n end\n end", "title": "" }, { "docid": "bcf9650755ac203f60a1413a808d5513", "score": "0.61135185", "text": "def get_all_components_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ComponentApi.get_all_components ...'\n end\n # resource path\n local_var_path = '/v1/component'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Component>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ComponentApi#get_all_components\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "327a88001d26acdae9e850d251121798", "score": "0.6110692", "text": "def show\n @componenttype = Componenttype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @componenttype }\n end\n end", "title": "" }, { "docid": "f9de39bd7cf6826ed421efc902badd14", "score": "0.6099817", "text": "def index\n @registered_components = RegisteredComponent.all\n end", "title": "" }, { "docid": "e20cb5d393eed5c1f06427d628bcdeff", "score": "0.60950667", "text": "def index\n # @composers = Composer.all\n @composers = @category.composers \n\n render json: @composers \n end", "title": "" }, { "docid": "f248ed755aaf6e9336f702b6c97f0628", "score": "0.6092049", "text": "def index\n @components = Component.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @components }\n end\n end", "title": "" }, { "docid": "14c3881037ae7be3283ea7fab916c443", "score": "0.6090655", "text": "def components\n {}\n end", "title": "" }, { "docid": "c81c2890f3c2f895e6f1ef5aa981095e", "score": "0.60750043", "text": "def new\n @standard_component = StandardComponent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @standard_component }\n end\n end", "title": "" }, { "docid": "845fbcf8cc9554bdd0dec231320ebcf7", "score": "0.60653585", "text": "def show\n @partner_org_component = PartnerOrgComponent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partner_org_component }\n end\n end", "title": "" }, { "docid": "30dbaaedab66c07791fd01285c325861", "score": "0.6065268", "text": "def components\n end", "title": "" }, { "docid": "721ff3c4d797fa60aae35b165c6e14d4", "score": "0.6048054", "text": "def index\n @device_components = DeviceComponent.all\n end", "title": "" }, { "docid": "f41cdc8e5035c5a6f2a0c6c5e7b6be59", "score": "0.60454756", "text": "def index\n @components = Component.for_app(@active_app)\n end", "title": "" }, { "docid": "900a1497cdcba53367a56574bd03b134", "score": "0.6039185", "text": "def new\n\t\t@title = @header = 'Новый компонент'\n\t\t@component = Component.new\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @component }\n\t\tend\n end", "title": "" }, { "docid": "23caa258b8aedad977d57d8026f9f106", "score": "0.6037259", "text": "def index\n @components = Component::RamModule.all\n end", "title": "" }, { "docid": "ce0b9361b9c82d05429d37efce5ef3d4", "score": "0.59980905", "text": "def index\n @components = Component.where(bridge: @bridge).all\n end", "title": "" }, { "docid": "eb69a73aab4dc7e932db618239b945a6", "score": "0.59897846", "text": "def new\n @component_package = ComponentPackage.new\n list_components\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "a600e6f6ac625d24b24299a394d2bb8b", "score": "0.598843", "text": "def index\n @componentes = Componente.all\n end", "title": "" }, { "docid": "e0c2c65e02250ef9735bced90da69beb", "score": "0.598512", "text": "def get url_components\n url = Util.url_escape_join url_components\n @http.get \"https://#{@host}/api/v1/#{url}\", request_headers\n end", "title": "" }, { "docid": "581873ec1ba323137cb69416c45af219", "score": "0.59772694", "text": "def index\n respond_to do |format|\n format.html { @components = Component.all }\n format.json {\n @components = Hash[Component.pluck(:category).uniq.each_with_object(nil).to_a]\n @components.each do |k,v|\n @components[k] = Component.where(\"category = ?\", k)\n end\n }\n end\n #respond_with @components\n end", "title": "" }, { "docid": "bb873dbbd8b88677e36c5f3bec34ab79", "score": "0.5972582", "text": "def show\n @requests_devolutions_component = Requests::Devolutions::Component.find(params[:id])\n respond_to do |format|\n format.js\n end\n end", "title": "" }, { "docid": "4a73078e48091560b9de22e4f01b1d14", "score": "0.5952469", "text": "def show\n\n render json: @comp\n end", "title": "" }, { "docid": "d3df1e26da4b70e6a5f9587cb46bd486", "score": "0.5948608", "text": "def index\n @components = current_cms.components.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @components }\n end\n end", "title": "" }, { "docid": "2853ec31dd514754216a7633b88a728e", "score": "0.5944968", "text": "def show\n if @components.present?\n respond_with @components\n else\n respond_with @component\n end\n end", "title": "" }, { "docid": "25d1aa0fa2d9678f19d0f79e3bc9e260", "score": "0.5942627", "text": "def index\n @components_cogs = Components::Cog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @components_cogs }\n end\n end", "title": "" }, { "docid": "d63f9515bcfdbe65a9798645fe14f4bd", "score": "0.59349775", "text": "def index\n @components = @sys_config.components.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @components.to_xml }\n end\n end", "title": "" }, { "docid": "0f0a864dfb93cc8902bb272d01c77d2e", "score": "0.5929085", "text": "def index\n if Settings.clients_can_see_equipment_outside_their_groups\n @component_models = ComponentModel\n else\n @component_models = ComponentModel.for_user(current_user)\n end\n\n apply_scopes\n\n # get a total (used by the select2 widget) before we apply pagination\n # @total = @component_models.count\n\n apply_pagination\n\n respond_to do |format|\n format.html\n format.json { render json: { items: component_models.map(&:select2_json), total: @total} }\n end\n end", "title": "" }, { "docid": "ca2f437ee4f429809c30783b29df581d", "score": "0.5922999", "text": "def new\n @partner_org_component = PartnerOrgComponent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner_org_component }\n end\n end", "title": "" }, { "docid": "4e03f179618b16733c1b071277ec3fec", "score": "0.5910995", "text": "def components\n end", "title": "" }, { "docid": "43a2fc880cb1fdc242628c1a7bc71778", "score": "0.5906961", "text": "def index\n @upper_components = UpperComponent.all\n end", "title": "" }, { "docid": "71953691949f33b67165c835e2f90294", "score": "0.59065187", "text": "def new\n @component = Component.new\n\n # Checking if we already set page via 'Add Component' buttons on pages\n if params[:page]\n @component.page = params[:page]\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component }\n end\n end", "title": "" }, { "docid": "359474617a4e26247eeff3172a882ff2", "score": "0.5905154", "text": "def get_component\n @component = Component.find(params[:component_id])\n end", "title": "" }, { "docid": "c46cb72364fb5b7a174988749a8d28aa", "score": "0.59000367", "text": "def index\n @componente = Componente.new\n resultados_componentes(true)\n end", "title": "" }, { "docid": "e09744f73579bba3bfffcf3f6441bd50", "score": "0.58799946", "text": "def new\n @component = Admin::Component.new\n @component.component_type_id = params[:type]\n @component.theme_id = session[:theme_id]\n \n prepare_sidebar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_component }\n end\n end", "title": "" }, { "docid": "f18d79625f607b7b4ffb992ca26def1f", "score": "0.5872718", "text": "def new\n @componenttype = Componenttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @componenttype }\n end\n end", "title": "" }, { "docid": "b51465ff66e814a6dc465e2c86dd85bf", "score": "0.5868992", "text": "def index\n @combos = Combo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @combos }\n end\n end", "title": "" }, { "docid": "65769fe6727efa98645f31a1b03d863e", "score": "0.5853023", "text": "def new\n @component_type = ComponentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component_type }\n end\n end", "title": "" }, { "docid": "baa19e0e37b1598f5f15bb65489359ad", "score": "0.5849326", "text": "def components(*args)\n if args.empty?\n components = @status_page.show_all_components\n components.each do |c|\n puts c['name']\n end\n elsif args.one?\n component_name = @status_page.components_hash.keys.grep(/#{args[0].downcase}/).first\n component_id = @status_page.components_hash[\"#{component_name}\"]\n\n response = @status_page.show_component_by_id(component_id)\n puts \"Status of #{response['name']}: #{response['status'].gsub('_',' ')}\"\n else \n valid_component_status?(args[1].downcase)\n component_names = @status_page.components_hash.keys.grep(/#{args[0].downcase}/)\n if component_names.size == 0\n raise \"Cannot find component matching '#{args[0]}'\"\n elsif component_names.size == 1\n component_new_status = COMPONENT_STATUSES.grep(/#{args[1].downcase}/).first.gsub(' ', '_')\n response = @status_page.update_component_by_id(@status_page.components_hash[component_names.first], component_new_status)\n puts \"Status for #{component_names.first} is now #{response['status'].gsub('_',' ')}\"\n else\n raise \"Multiple components matching '#{name}'\"\n end\n end\n end", "title": "" }, { "docid": "8015ae6281e84711044ef23a41ce3071", "score": "0.58404005", "text": "def new\n @component_model = ComponentModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component_model }\n end\n end", "title": "" }, { "docid": "5605aa9878528c12a9a7d6ab75e4cadc", "score": "0.5837133", "text": "def show\n #Finds selected component\n @component = Component.find(params[:id])\n #Creates an array of all components\n @all_components = Component.all\n #creats an array of all images\n @all_images = Image.all\n #Creates a sorted array of all products\n @all_products = Product.all.sort {|x,y| x.name <=> y.name }\n #Creates a sorted array of all groups\n @all_groups = Group.all.sort {|x,y| x.name <=> y.name }\n #creates a sorted array of all properties\n @all_properties = Property.all.sort {|x,y| x.name <=> y.name }\n respond_to do |format|\n format.html # popup_showp_show.html.erb\n format.json { render json: @component }\n format.xml { render :xml => @component }\n format.js\n end\n end", "title": "" }, { "docid": "a09ec6bf44bacde0f3dc6023780e0c9e", "score": "0.5836753", "text": "def index\n @subcomponents = Subcomponent.all\n end", "title": "" }, { "docid": "ffa24c7aaf5055363215b07b393061e5", "score": "0.58244604", "text": "def create\n @component = Gooey::Component.new(component_params)\n\n respond_to do |format|\n if @component.save\n format.html { redirect_to @component.group, notice: 'Component was successfully updated.' }\n format.json { render :show, status: :created, location: @component }\n else\n format.html { render :new }\n format.json { render json: @component.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e83341a0cd1079d65717f4c971ded42d", "score": "0.580975", "text": "def new\n @component = Component.new\n @new_component = 'true'\n list_components\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "4c1e8d54f240c9077f228277e7aea74e", "score": "0.5809032", "text": "def index\n @product_assembly_components = ProductAssemblyComponent.all\n end", "title": "" }, { "docid": "e59e7a0e54f6aff8dfe0c782b59a1721", "score": "0.5790891", "text": "def set_component\n @component = Gooey::Component.find(params[:id])\n end", "title": "" }, { "docid": "45c35bf2e4b058aeec947cbd7fb6edb0", "score": "0.5790875", "text": "def index\n #@part_manufacturers = PartManufacturer.find(:all, :order => 'name')\n\t@part_manufacturers = PartManufacturer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @part_manufacturers }\n end\n end", "title": "" }, { "docid": "2a62220edbd0689c1e3bac39e0e50dc4", "score": "0.57621205", "text": "def components\n COMPONENTS\n end", "title": "" }, { "docid": "ca1c0021ef9c993d5554d79de34413e0", "score": "0.57618564", "text": "def show\n @assessment_component = AssessmentComponent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment_component }\n end\n end", "title": "" }, { "docid": "0dde67aa7b7308cdeb5bf4f4a3efc271", "score": "0.5759368", "text": "def show\n @components_cog = Components::Cog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @components_cog }\n end\n end", "title": "" }, { "docid": "6384a189d5a517202af6efd5ba61b723", "score": "0.5755205", "text": "def piping_components\n \t@piping_class = PipingClass.find(params[:piping_class_id])\n @piping_components = @piping_class.piping_components.find(:all, :order => \"piping_component\").uniq\n\n @piping_components = @piping_components.map { |l| l.sext_data}\n @json = { :count => @piping_components.size, :records => @piping_components}\n render :json => @json.to_json\n\n end", "title": "" }, { "docid": "650aebe631758889faca22349bed4102", "score": "0.5754923", "text": "def show\n @requests_devolutions_components_detail = Requests::Devolutions::Components::Detail.find(params[:id])\n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "31d0b9373a4a7822da6613b316b21249", "score": "0.57534915", "text": "def new\n @available_components = @plan.components.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end", "title": "" }, { "docid": "1be412c952ca06bd82948f3bc12f77c9", "score": "0.5752809", "text": "def new\n\tif user_type == 'admin'\n\t\t@title = @header = 'Новый компонент'\n\t\t@component = Component.new\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @component }\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "title": "" }, { "docid": "dcc856abbce90e0b575433ba814461fb", "score": "0.5716806", "text": "def index\n @sub_components = SubComponent.all\n end", "title": "" }, { "docid": "5ef31fa382e624c5460f11fc68042277", "score": "0.5711897", "text": "def show\n @component = Component.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "db9ac57080ee422ed8663e58b37ff967", "score": "0.56851685", "text": "def create\n @eg_component = EgComponent.new(eg_component_params)\n\n respond_to do |format|\n if @eg_component.save\n format.html { redirect_to @eg_component, notice: 'Eg component was successfully created.' }\n format.json { render :show, status: :created, location: @eg_component }\n else\n format.html { render :new }\n format.json { render json: @eg_component.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f28dba470640dd616ba4e92e8c61ccb2", "score": "0.5678348", "text": "def create\n c_n = params[:comp_name]\n v_num = params[:version]\n comp = {}\n ver = {}\n comp[\"name\"] = c_n\n comp[\"c_type\"] = \"gem\"\n Component.create(comp)\n last_id = Component.last.id\n ver[\"version_num\"] = v_num\n ver[\"component_id\"] = last_id\n Version.create(ver)\n @component = Component.new(params[:component])\n respond_to do |format|\n if @component.save\n flash[:notice] = 'Component was successfully created.'\n format.html { redirect_to(@component) }\n format.xml { render :xml => @component, :status => :created, :location => @component }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @component.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b83b1f10cb84eda52771ae25ef043f95", "score": "0.56759506", "text": "def show\n @component = current_cms.components.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "ebeb42b724f1d104359cdce6b45383d4", "score": "0.56576926", "text": "def components\n @components ||= {}\n end", "title": "" }, { "docid": "f7dc537e5e9774d8bb786e701f318fdb", "score": "0.56569386", "text": "def new\n @assessment_component = AssessmentComponent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assessment_component }\n end\n end", "title": "" }, { "docid": "84eb04e7f3cabe0912acf777ce904c07", "score": "0.5633942", "text": "def get_clients_by_manufacturer(args = {}) \n get(\"/clients.json/stats/manufacturer\", args)\nend", "title": "" }, { "docid": "13ec962397c8b2a319f793d7a3965317", "score": "0.5629143", "text": "def index\n @component_results = ComponentResult.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @component_results }\n end\n end", "title": "" }, { "docid": "806c9be937322b24424170b10043158f", "score": "0.5628739", "text": "def index\n doorkeeper_authorize! 'product:read'\n\n vendors = configs.collect(&:vendor)\n\n # Calculate most recent updated_at date between both the configs and the\n # vendors\n last_modified = configs\n .collect(&:updated_at)\n .concat(vendors.collect(&:updated_at))\n .max\n\n # Blueprinter options\n options = {\n shop: shop,\n }\n\n render json: V1::Ui::VendorBlueprint.render(vendors, options) if http_cache vendors, last_modified\n end", "title": "" }, { "docid": "009f912fb2dc29c2106a140ec2f1571a", "score": "0.5627876", "text": "def index\n @gadgets = Gadget.where(owner: params[:owner])\n render json: @gadgets\n end", "title": "" }, { "docid": "41fb3821e5a49e6c47236ca4b447ab6f", "score": "0.56224656", "text": "def index\n @componentes_juegos = ComponentesJuego.all\n end", "title": "" }, { "docid": "8d9b0b9ea80bcdf16cad661cad3205c1", "score": "0.56219006", "text": "def show\n @component_nutrient = ComponentNutrient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_nutrient }\n end\n end", "title": "" }, { "docid": "530302953cd89030e79afb781320cb64", "score": "0.5620327", "text": "def get_component_families(opts)\n # Find all component family packs\n families = Pack.component_families\n\n # Filter by component profile, if given\n component_profile_uri = opts[:query]['component-profile']\n if component_profile_uri\n component_profile = resource_from_uri(component_profile_uri)\n if component_profile.nil?\n return rest_response(404, :reason => 'Component profile not found')\n else\n # Check for the given component profile in the set of families\n families = families.select { |family| family.component_profile == component_profile }\n end\n end\n\n # Authorization\n families = families.select { |r| Authorization.check(\"view\", r, opts[:user]) }\n\n # Render results\n produce_rest_list(opts[:uri], opts[:rules], opts[:query], families, \"component-families\", [], opts[:user])\nend", "title": "" }, { "docid": "86a045da40b6d79b81ce024c36f47261", "score": "0.5606661", "text": "def index\n if session[:stream_id]\n @stream_id = session[:stream_id]\n @components = Component.where(:stream_id => @stream_id).all\n\n @stream = Stream.find(@stream_id)\n @breadcrumbs = [{\"link\" => '#', \"name\" => @stream.campaign.name}, {\"link\" => \"/facebase/streams?campaign_id=#{@stream.campaign.id}\", \"name\" => @stream.name}]\n else\n @components = Component.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @components }\n end\n end", "title": "" }, { "docid": "8bae652401f7707d1e4fd2b5bbd6ea5a", "score": "0.56019455", "text": "def new\n @components_cog = Components::Cog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @components_cog }\n end\n end", "title": "" }, { "docid": "068a3d7e2cc29f4316177ed90805b8dc", "score": "0.559776", "text": "def index\n @component_groups = ComponentGroup.all\n end", "title": "" }, { "docid": "87320f567587cf6a3ad354f79e3b2330", "score": "0.5596695", "text": "def index\n @components_chains = Components::Chain.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @components_chains }\n end\n end", "title": "" }, { "docid": "9f0ba8699df2b0138aa52761c32338fe", "score": "0.5592916", "text": "def show\n @component = Component.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @component }\n end\n end", "title": "" }, { "docid": "de6166730a9b4f43158b3cd9c6115d14", "score": "0.5591159", "text": "def new\n @common_allergen = CommonAllergen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @common_allergen }\n end\n end", "title": "" } ]
197a334bc76be82e855ee1cf3f9ccd18
Show the value of the first node
[ { "docid": "620b198db72993cac39ad03630d2bf90", "score": "0.0", "text": "def peek\n raise EmptyQueueError if is_empty?\n @head.data\n end", "title": "" } ]
[ { "docid": "b593b5a838f2ea6a12fba001727dd781", "score": "0.7845881", "text": "def getFirst\n @firstNode.value\n end", "title": "" }, { "docid": "1549d390c935f97e167f53c7a554899d", "score": "0.72628736", "text": "def value\n node.string\n end", "title": "" }, { "docid": "605df8de534f3e83cae01c219a098d30", "score": "0.726231", "text": "def value\n node.value\n end", "title": "" }, { "docid": "4e640d2bd16174e18bbbdcab82d0b404", "score": "0.72229844", "text": "def first\n @head.next_node.value\n end", "title": "" }, { "docid": "3c12e7ff931963c82e828d6ebb7a483c", "score": "0.7117982", "text": "def display\n\t\tstr = \"\"\n\t\tself.each_node {|n| str << \"node: #{n.value} \\n\"}\n\t\tstr\n\tend", "title": "" }, { "docid": "510dd86c841198ac1cff34627ef8c935", "score": "0.70715475", "text": "def first\n @nodes.first\n end", "title": "" }, { "docid": "881631e33191361bad6093d72c71346a", "score": "0.70602334", "text": "def first\n all.nodes.first\n end", "title": "" }, { "docid": "e6097938525b1babeeda5cf581e5a915", "score": "0.70416355", "text": "def display\n each { |node| puts node.value }\n end", "title": "" }, { "docid": "055db499dc3e25ce7b7dbb99512a426b", "score": "0.69914025", "text": "def node_value(node)\n node[1]\n end", "title": "" }, { "docid": "480b317b29b7fa56ce2ad25b61501225", "score": "0.69593227", "text": "def value\n @children[0]\n end", "title": "" }, { "docid": "a681a52cfda69314f56a1e72b6ddeebd", "score": "0.6897779", "text": "def print\r\n \"Node with value: #{@value}\"\r\n end", "title": "" }, { "docid": "628596bd25f99c8fa7ddacfe16a664b7", "score": "0.689169", "text": "def first\n @head_[:value]\n end", "title": "" }, { "docid": "cbf5f0e7b3ed58700eed8c2d3324569f", "score": "0.6883406", "text": "def nodeValue\n @value\n end", "title": "" }, { "docid": "cbf5f0e7b3ed58700eed8c2d3324569f", "score": "0.6883406", "text": "def nodeValue\n @value\n end", "title": "" }, { "docid": "cbf5f0e7b3ed58700eed8c2d3324569f", "score": "0.6883406", "text": "def nodeValue\n @value\n end", "title": "" }, { "docid": "f413a1ebccffee92c2b0482ecdc61a4a", "score": "0.6880084", "text": "def value\n @node.value unless @node.nil?\n end", "title": "" }, { "docid": "1b27cae40cd97756012b29cac8545171", "score": "0.6875045", "text": "def getFirstNode() getNode(0); end", "title": "" }, { "docid": "ca87b191503e32a5b5d7c478ddb324a5", "score": "0.67751867", "text": "def first\n node_from_value(super)\n end", "title": "" }, { "docid": "ea94ea39c6e23d1a0a4016ebc94ba3d4", "score": "0.677387", "text": "def first\n @head.value\n end", "title": "" }, { "docid": "66989f35b4a1b033202fd401eeb63cc1", "score": "0.6766435", "text": "def value\n node_parts[1]\n end", "title": "" }, { "docid": "056e30f7152a4d349efad3e8d9f63f75", "score": "0.67338693", "text": "def show\r\n\t\t\thead = @head.next_node\r\n\t\t\twhile head.next_node != nil\r\n\t\t\t\tputs \"{#{head.key}, #{head.value}}\"\r\n\t\t\t\thead = head.next_node\r\n\t\t\tend\r\n\t\tend", "title": "" }, { "docid": "80ee09de3eb0777f81c71a8d5c97ef53", "score": "0.66665107", "text": "def first\n @head.value\n end", "title": "" }, { "docid": "8ac97cd5b78432365f28fc8c9f4deb95", "score": "0.66314614", "text": "def value\n children[2]\n end", "title": "" }, { "docid": "067583a4bd436fd8eda975f351c2c74c", "score": "0.66310424", "text": "def value\n @xml_node.inner_text\n end", "title": "" }, { "docid": "536267e2ac9b10b5e1ffcf41a51afe86", "score": "0.6630793", "text": "def first\n searchnode[0]\n end", "title": "" }, { "docid": "caf0b27f0fabcc1e0527a80d033b0dd4", "score": "0.6624557", "text": "def display\n count = 1\n node = @head\n self.length.times do |index|\n print \"(Node: #{index} | value: #{node.value}) -> \"\n print \"\\n\" if count % 4 == 0 && count != 0\n print 'nil' if node.next_node == nil\n node = node.next_node\n count += 1\n end\n nil\n end", "title": "" }, { "docid": "9e9a2f6296027d3cf85a99f227d9d722", "score": "0.6608422", "text": "def getFirstNode() getNodeByIndex(0); end", "title": "" }, { "docid": "bb9ca6a186458bea788cac89ac82a3ab", "score": "0.6595394", "text": "def first\n @node.min\n end", "title": "" }, { "docid": "3b67d1386a73cac0342e055d42d75a96", "score": "0.65916723", "text": "def first\n value.first\n end", "title": "" }, { "docid": "6690e57d3f54e3201729d9f5ffd5f6a0", "score": "0.6531868", "text": "def get_node_value(x)\n x.value\n end", "title": "" }, { "docid": "31db53b218ef6fab1ebf389a78899efa", "score": "0.6522614", "text": "def get_first(node,path='.')\n\t\t\t\treturn unless node\n\t\t\t\tresult = node.xpath(path).first\n\t\t\t\tresult ? textf(result.text) : \"\" # return blank if no mathcing elment to be consistent with get method\n\t\t\tend", "title": "" }, { "docid": "c006fb4c0b92a9cc170af2358a0e3ab5", "score": "0.64868295", "text": "def to_s\n pointer = @head\n # loop until last node to print the values\n until pointer == nil\n print \"( #{pointer.value} ) -> \"\n pointer = pointer.next_node\n end\n print \"nil\\n\"\n end", "title": "" }, { "docid": "96945572b46ea43a2b26fa050f049e9b", "score": "0.6472417", "text": "def print\n current_node = @head\n while current_node != nil\n puts \"\\nNode value = #{current_node.value}\"\n current_node = current_node.next\n end\n end", "title": "" }, { "docid": "39f1d0a0f94d7648056239e94845c19f", "score": "0.6439933", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "39f1d0a0f94d7648056239e94845c19f", "score": "0.6439933", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "2830d523dd539afb373bccb03f388813", "score": "0.6437708", "text": "def print\n cur_node = @first\n while(!cur_node.nil?)\n puts cur_node.data\n cur_node = cur_node.next\n end\n end", "title": "" }, { "docid": "196f15002ba1ff06b82c3c00417eb813", "score": "0.64148784", "text": "def print\r\n\ttemp = @first\r\n\twhile !(temp.nil?)\r\n\t\tprintf \" #{temp.value}\"\r\n\t\ttemp = temp.next\r\n\tend\r\n end", "title": "" }, { "docid": "8d80f5b4d7b90003d8f01372877eae3e", "score": "0.64137214", "text": "def firstChild\n childNodes.first\n end", "title": "" }, { "docid": "7ed8adeb3776438474cf3441b657064a", "score": "0.64037347", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "44ed06fd1da9495ef7ba85a30b18f337", "score": "0.6399572", "text": "def first\n\t\tnode = @first_node\n\t\tif node.nil?\n\t\t\treturn nil\n\t\tend\n\t\treturn node.e\n\tend", "title": "" }, { "docid": "6555ae6001730270aaef42cfdf6a4a6f", "score": "0.6398084", "text": "def print\n current_node = @head\n \n while current_node != nil\n puts \"\\tLL Node Value = #{current_node.value}\"\n current_node = current_node.next\n end\n end", "title": "" }, { "docid": "91a55df5fcf25e2d65cdd349ae8efc4b", "score": "0.63973045", "text": "def nodeValue\n ret = \"\"\n @children.each do |child|\n ret << child.nodeValue\n end if @children\n ret\n end", "title": "" }, { "docid": "eca4f6e6e113455c294de8b7d874e608", "score": "0.6387112", "text": "def print ()\r\n puts @node_data.to_s\r\n end", "title": "" }, { "docid": "05a7f5180e45655f5aeadfab7a300d29", "score": "0.6383061", "text": "def print\n\ttemp = @first\n\twhile !(temp.nil?)\n\t\tprintf \" #{temp.value}\"\n\t\ttemp = temp.next\n\tend\n end", "title": "" }, { "docid": "bd8f345e04331732e5b796a34c02e83b", "score": "0.6379671", "text": "def value\n val = children.first\n val = val.children.first while val.respond_to?(:children)\n val\n end", "title": "" }, { "docid": "bd8f345e04331732e5b796a34c02e83b", "score": "0.6379671", "text": "def value\n val = children.first\n val = val.children.first while val.respond_to?(:children)\n val\n end", "title": "" }, { "docid": "bd8f345e04331732e5b796a34c02e83b", "score": "0.6379671", "text": "def value\n val = children.first\n val = val.children.first while val.respond_to?(:children)\n val\n end", "title": "" }, { "docid": "bd8f345e04331732e5b796a34c02e83b", "score": "0.6379671", "text": "def value\n val = children.first\n val = val.children.first while val.respond_to?(:children)\n val\n end", "title": "" }, { "docid": "598acefe05cab1ce18e9201ee11b907a", "score": "0.6374424", "text": "def first_value; end", "title": "" }, { "docid": "c00ddf1172aca85beb5b58e013dade8b", "score": "0.6352366", "text": "def first_node\n @head.next\n end", "title": "" }, { "docid": "212c9e8e662278490fe5e5ad4c9ba2c2", "score": "0.6341006", "text": "def first\n @children[0]\n end", "title": "" }, { "docid": "38d030b20c9a50126bf11ef875e246d4", "score": "0.6330579", "text": "def value\n val = children.first\n val = val.children.first while val.respond_to?(:children)\n val\n end", "title": "" }, { "docid": "ac3868954ee2daded4c6317f110edf52", "score": "0.63274574", "text": "def show_value(index)\n if index.class != Fixnum then raise\n else\n if index<1 then raise\n else if index == 1 then return @head.value\n else\n temp_node=@head\n i=1\n while i<(index) do\n temp_node.node_to_go == nil ? raise : temp_node=temp_node.node_to_go\n i+=1\n end\n return temp_node.value\n end\n end\n end\n rescue\n puts \"There is no such index\"\n end", "title": "" }, { "docid": "b09df5d7f360e81df6abb51c7a07f85f", "score": "0.63226473", "text": "def first_value\n return @first_value unless @first_value.nil?\n @first_value = first_value_raw.value\n @first_value\n end", "title": "" }, { "docid": "b09df5d7f360e81df6abb51c7a07f85f", "score": "0.63226473", "text": "def first_value\n return @first_value unless @first_value.nil?\n @first_value = first_value_raw.value\n @first_value\n end", "title": "" }, { "docid": "c7ae8f80b56acaea65db8e90897600a8", "score": "0.6319625", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "c7ae8f80b56acaea65db8e90897600a8", "score": "0.6319625", "text": "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "title": "" }, { "docid": "69f5122d4b8f401d4ac34317ae6138bc", "score": "0.62910324", "text": "def display\n\t\tarr = []\n\t\tcurrent_node = @head\n\t\twhile current_node do\n\t\t\tarr << current_node.value\n\t\t\tcurrent_node = current_node.next\n\t\tend\t\n\t\tarr\t\n\tend", "title": "" }, { "docid": "3bfb53662fad8dbb51bf8ecc7e8b7b99", "score": "0.6289654", "text": "def first_s_text\n first_ele :text\n end", "title": "" }, { "docid": "3bfb53662fad8dbb51bf8ecc7e8b7b99", "score": "0.6289654", "text": "def first_s_text\n first_ele :text\n end", "title": "" }, { "docid": "3a7c0faec69155671263c022654ddd6e", "score": "0.62821996", "text": "def first\n @head.next.datum\n end", "title": "" }, { "docid": "58631ab9ce621d10605d97bc2dec76d7", "score": "0.6277085", "text": "def value\n @value ||= self.node.children\n end", "title": "" }, { "docid": "ff265c596e3e34ef3f58e104916c2955", "score": "0.62557346", "text": "def value\n @java_node.value\n end", "title": "" }, { "docid": "3e6dbf6637bf86510db73b4961d55ee6", "score": "0.6241955", "text": "def val\n raise 'No such element' if @size == 0\n @current.value\n end", "title": "" }, { "docid": "d5433b4ac9f00268f16e9d2afea2d51b", "score": "0.6233585", "text": "def print()\r\n puts @node_data.to_s\r\n end", "title": "" }, { "docid": "e7e5bef8511bdb2f2c3183eb9b8f632e", "score": "0.62126", "text": "def print\n temp = @first\n while !temp.nil?\n printf \" #{temp.value}\"\n temp = temp.next\n end\n end", "title": "" }, { "docid": "ddb66afdf788a77f863fd552efcc7d5b", "score": "0.62061", "text": "def value_at_node(node)\n document.xpath(node).text\n end", "title": "" }, { "docid": "15ddd73178fb41a84e93d626938b0818", "score": "0.61998093", "text": "def visit\r\n # Set a temp value to keep track of the current node, starting at the head\r\n curr = @head\r\n\r\n # Iterate throught the list and print node values until reach the end of the list (current value is nil)\r\n until curr == nil\r\n print \"#{curr.data} \"\r\n curr = curr.next\r\n end\r\n\r\n # Add a line break for readability\r\n puts\r\n end", "title": "" }, { "docid": "82db7f804d2919db84e7f1bbef3eee26", "score": "0.61984444", "text": "def to_s\n node = @head\n output = \"\"\n \n @size.times {\n output << \"( #{node.value} ) ~> \" #in case you want to display the index aswell #{, index: #{node.index}}\n node = node.next_node\n }\n output + \"nil\"\n end", "title": "" }, { "docid": "ce67099f6ce9073fa08019b7e84648ca", "score": "0.61900634", "text": "def print\n node = @head\n if !node\n puts \"The list is empty\"\n return\n end\n puts node.value #print the head of the list\n\n while node && node.next #iterate through each node and print its value\n node = node.next\n puts node.value\n end\n end", "title": "" }, { "docid": "785bf6ea8eb8baca5a2695772436b05c", "score": "0.6174129", "text": "def first_text_under(node)\n node.xpath(\".//text()\").first.to_s\n end", "title": "" }, { "docid": "68243926d32cb07ff90680751a1a4c12", "score": "0.6169666", "text": "def label\n @node[\"label\"]\n end", "title": "" }, { "docid": "225d1aa5d51931604790017f53fff82f", "score": "0.61664057", "text": "def print\n temp = @first\n while !temp.nil?\n printf \" #{temp.value}\"\n temp = temp.next\n end \n end", "title": "" }, { "docid": "51bdf61f845f44f090eae5ecedd90fbd", "score": "0.61663383", "text": "def print\n current_node = @head\n\n while current_node != nil\n puts \"\\t#{current_node.value}\"\n current_node = current_node.next\n end\n end", "title": "" }, { "docid": "5aaafcd19683ad6f6aeb8a7fcbb3d1d6", "score": "0.61578584", "text": "def print\n current_node = @head\n while current_node != nil\n puts current_node.value\n current_node = current_node.next\n end\n end", "title": "" }, { "docid": "e935f69abb177c9c67942175e9c071de", "score": "0.61578524", "text": "def first\n\t\tnode = @head_node\n\t\tif node.nil?\n\t\t\treturn nil\n\t\tend\n\t\treturn node.e\n\tend", "title": "" }, { "docid": "5565be47843812496d07c6290c8c8a60", "score": "0.6150354", "text": "def showValue; end", "title": "" }, { "docid": "5565be47843812496d07c6290c8c8a60", "score": "0.6150354", "text": "def showValue; end", "title": "" }, { "docid": "4a0b953dc118ed4523ca66f4920ca568", "score": "0.614678", "text": "def print_values\n LinkedListNode.print_values @head\n end", "title": "" }, { "docid": "533c9595783b7d1987efa821ae40374a", "score": "0.6131842", "text": "def to_s\n\t\tx = @head\n\t\tuntil x == nil\n\t\t\tprint \"(#{x.value}) -> \"\n\t\t\tx = x.next_node\n\t\tend\n\t\tprint \"nil\"\n\tend", "title": "" }, { "docid": "10eea11e195b8ca7a61efb07f100c5d0", "score": "0.6128156", "text": "def first_value\n tree = @nodes[@root]\n loop do\n break if tree.leaf?\n tree = @nodes[tree.sub_trees[0]]\n end\n if tree.size>0 then tree.left else false end\n end", "title": "" }, { "docid": "d6a698f61d19faf65bfe5f633c959150", "score": "0.6126643", "text": "def to_s\n\t\tcurrent = @head\n\t\tuntil current == nil\n\t\t\tprint \"( #{current.value} )\"\n\t\t\tprint \" -> \" if current.next_node != nil\n\t\t\tcurrent = current.next_node\n\t\tend\n\t\tprint \" -> nil\"\n\t\tputs \"\"\n\tend", "title": "" }, { "docid": "ffa71d8909fe72b6c0599c3f41ab35ea", "score": "0.61236376", "text": "def print\n node = self.head\n while(node != nil)\n puts node.value\n node = node.next\n end\n end", "title": "" }, { "docid": "baab008acddd619490116a4dec692c2e", "score": "0.6120087", "text": "def first_child\r\n find(:xpath, \"child::*[1]\")\r\n end", "title": "" }, { "docid": "7a45ad8f35079fc85f365ba83acbbff2", "score": "0.61113805", "text": "def print_values(list_node)\r\n if list_node\r\n print \"#{list_node.value} --> \"\r\n print_values(list_node.next_node)\r\n else\r\n print \"nil\\n\"\r\n return\r\n end\r\nend", "title": "" }, { "docid": "7a45ad8f35079fc85f365ba83acbbff2", "score": "0.61113805", "text": "def print_values(list_node)\r\n if list_node\r\n print \"#{list_node.value} --> \"\r\n print_values(list_node.next_node)\r\n else\r\n print \"nil\\n\"\r\n return\r\n end\r\nend", "title": "" }, { "docid": "7a45ad8f35079fc85f365ba83acbbff2", "score": "0.61113805", "text": "def print_values(list_node)\r\n if list_node\r\n print \"#{list_node.value} --> \"\r\n print_values(list_node.next_node)\r\n else\r\n print \"nil\\n\"\r\n return\r\n end\r\nend", "title": "" }, { "docid": "ce1bf96733e6f6ed671f5bd386a1db9f", "score": "0.610189", "text": "def display\n return \"Empty list. Add nodes\" if @head.nil?\n\n current = @head\n list = []\n\n while !current.nil?\n list << current.value\n current = current.next\n end\n puts list.join('->')\n end", "title": "" }, { "docid": "ce6d4f21dcd2e8e7ebc1dd7a5dbf3f17", "score": "0.61015457", "text": "def first_text\n first_ele TextView\n end", "title": "" }, { "docid": "ce6d4f21dcd2e8e7ebc1dd7a5dbf3f17", "score": "0.61015457", "text": "def first_text\n first_ele TextView\n end", "title": "" }, { "docid": "7b1d6618babdf04c6b7cedd823eae860", "score": "0.610088", "text": "def simpleContent\n (0 == @_index) ? @_value : nil\n end", "title": "" }, { "docid": "bfd0da82a1fa496a5e35caf4a01b881d", "score": "0.6099236", "text": "def get_first_node_child\n # Interface method\n end", "title": "" }, { "docid": "d361aab1c3bd30c0bd1f008d75db6f4d", "score": "0.6095827", "text": "def at(index)\n node_at(index).value\n end", "title": "" }, { "docid": "a06c58ebe4f41137067a0126ab74bd20", "score": "0.6086687", "text": "def first\n head.data\n end", "title": "" }, { "docid": "558c0d2eec7cc078795bf561372d882e", "score": "0.6073146", "text": "def display_value()\n @value.to_s\n end", "title": "" }, { "docid": "6c8e6209708f3f042b9753626f997267", "score": "0.60673124", "text": "def text\n value || '' if leaf?\n end", "title": "" }, { "docid": "c43e39b9c1352258e45cb09e19b1572c", "score": "0.6065095", "text": "def valora\n\t\taux2 = @node.prev\n\t\taux2.devuelve_valor\n\tend", "title": "" }, { "docid": "c2314be6f364e427dc982f355b73b5b3", "score": "0.60553646", "text": "def peek\n @root.value\n end", "title": "" }, { "docid": "b171a86c26085489fa1cb5fea93b20bc", "score": "0.60503936", "text": "def node_li_value(node, target)\n node.to_s\n end", "title": "" }, { "docid": "e63aafda75c68c2523acb14ed66a061e", "score": "0.6042198", "text": "def text_zero_one(node)\n nodes = node.childNodes.to_a.size\n\n if nodes == 1\n text(node.firstChild)\n elsif nodes == 0\n \"\"\n else\n raise \"wrong xml-rpc (size)\"\n end\n end", "title": "" }, { "docid": "10180c03c7196e2c1ee15e29fb2d8d69", "score": "0.6041081", "text": "def first\n @data[:first]\n end", "title": "" } ]
199bfb5bec27147ca6972606c3fafb91
Triggers an event, moving record to associated state, if permitted Raises exception if event is not permitted
[ { "docid": "3e6493e85e692d754123cf58208cd10c", "score": "0.6480659", "text": "def trigger!(event, metadata={})\n if !trigger(event, metadata)\n raise StateTransitionException::TransitionNotPermitted\n end\n end", "title": "" } ]
[ { "docid": "f8d6bea5a10127ef5aafb4e9844f65d8", "score": "0.6229441", "text": "def trigger(event, metadata={})\n if (event_permitted(event) || User.is_admin?(metadata[:user_id])) &&\n required_metadata_present?(event, metadata)\n to_state = self.event_to_state(event)\n callback_metadata = metadata.clone\n transition_to(to_state, metadata)\n if respond_to?(:event_callbacks)\n event_callbacks(event, callback_metadata)\n reload\n end\n update_index\n true\n else\n false\n end\n end", "title": "" }, { "docid": "ec67219972747f0906ebae813878fb18", "score": "0.5922498", "text": "def fire!(record)\n run(record, true) || raise(PluginAWeek::StateMachine::InvalidTransition, \"Cannot transition via :#{name} from \\\"#{record.send(machine.attribute)}\\\"\")\n end", "title": "" }, { "docid": "d4816fe93ba6bb4b241355cace66994e", "score": "0.5919675", "text": "def fire_event(event, record, persist, *args)\n state_index[record.current_state].call_action(:exit, record)\n begin\n if new_state = @events[event].fire(record, nil, *args)\n state_index[new_state].call_action(:enter, record)\n\n if record.respond_to?(:event_fired)\n record.send(:event_fired, record.current_state, new_state, event)\n end\n\n record.update_current_state(new_state, persist)\n @events[event].success.call(record) if @events[event].success\n return true\n else\n record.send(:event_failed, event) if record.respond_to?(:event_failed)\n return false\n end\n rescue => e\n if record.respond_to?(:event_failed)\n record.send(:event_failed, event)\n return false\n else\n raise e\n end\n end\n end", "title": "" }, { "docid": "dbbcfb1f2851e9f34bf421be30f38ad1", "score": "0.5870206", "text": "def fire_workflow_event\n\n # Check that this is a valid event name for the state machines\n if @project.class.event_names.include? params[:event]\n event_name = params[:event]\n if @project.fire_state_event(event_name)\n event = WorkflowEvent.new\n event.creator = current_user\n event.accountable = @project\n event.event_type = event_name\n event.save\n notify_user(:notice, \"Capital Project #{@project.project_number} is now #{@project.state.humanize}.\")\n else\n notify_user(:alert, \"Could not #{event_name.humanize} capital project #{@project.project_number}\")\n end\n else\n notify_user(:alert, \"#{params[:event_name]} is not a valid event for a #{@project.class.name}\")\n end\n\n redirect_back(fallback_location: root_path)\n\n end", "title": "" }, { "docid": "c5574e8d70396c1b3f832ee7713ac466", "score": "0.5862686", "text": "def perform!(record)\n run(record, true) || raise(PluginAWeek::StateMachine::InvalidTransition, \"Could not transition via :#{event.name} from #{record.send(machine.attribute).inspect} to #{@options[:to].inspect}\")\n end", "title": "" }, { "docid": "28cd3279c698249fb68b57f2b637edd9", "score": "0.57361746", "text": "def execute!(event, obj)\n state_machine.run_callback event.name, obj do |obj|\n unless execute_action(event, obj)\n raise Jsm::IllegalTransitionError, \"there is no matching transitions or invalid, Cant do event #{event.name}\"\n end\n true\n end\n end", "title": "" }, { "docid": "5a6da2d999895c53185a44fa09962482", "score": "0.5734076", "text": "def fire_event(event_name, resource)\n unless event = find_event(event_name)\n raise InvalidEvent, \"Could not find event (#{event_name.inspect})\"\n end\n transition = event.transitions.find do |t|\n t[:from].to_s == @current_state_name.to_s\n end\n unless transition\n raise InvalidEvent, \"Event (#{event_name.inspect}) does not\" +\n \"exist for current state (#{@current_state_name.inspect})\"\n end\n\n # == Run :exit hook (if present) ==\n resource.run_hook_if_present current_state.options[:exit]\n\n # == Change the current_state ==\n @current_state_name = transition[:to]\n\n # == Run :enter hook (if present) ==\n resource.run_hook_if_present current_state.options[:enter]\n end", "title": "" }, { "docid": "498931ed935c3c0677a7e47995cdc4b7", "score": "0.5732156", "text": "def record!\n find_or_build_event_group\n update_event_group_attributes\n send_notifications_for_event_group\n \n @event_group.archived = false\n @event_group.save\n @event_group.events.create(event_params)\n @event_group\n end", "title": "" }, { "docid": "486e9cb1d80efd7e25cf1245b18e95e5", "score": "0.57278764", "text": "def execute!\n event.persist_and_dispatch\n end", "title": "" }, { "docid": "e1e9cd37b0b7770bb0d0dd45bf114f04", "score": "0.5684377", "text": "def do_transition!( transition )\n state.trigger( transition.to_sym )\n self.save\n end", "title": "" }, { "docid": "6be871df2b5d3c6817e5a807c7f11dd5", "score": "0.566975", "text": "def trigger(owner, event, *args); end", "title": "" }, { "docid": "9aae28bdf4c6bbcd495d0ceeae3f845f", "score": "0.5612304", "text": "def perform(&block)\n reset\n\n if valid?\n if use_event_attributes? && !block_given?\n each do |transition|\n transition.transient = true\n transition.machine.write(object, :event_transition, transition)\n end\n\n run_actions\n else\n within_transaction do\n catch(:halt) { run_callbacks(&block) }\n rollback unless success?\n end\n end\n end\n\n if actions.length == 1 && results.include?(actions.first)\n results[actions.first]\n else\n success?\n end\n end", "title": "" }, { "docid": "e7cbcc0e2568f75564c255725f635671", "score": "0.5575925", "text": "def trigger_event\n event_name = params[:event_name]\n review = Review.find(params[:id])\n nb_opinions, nb_opinions_moved = 0,0\n review.opinions.each do |opinion|\n begin\n opinion.send(\"#{event_name}!\")\n nb_opinions_moved += 1\n rescue\n puts \"transition for opinion #{opinion.id} in state #{opinion.state} with event #{event_name} impossible \"\n end\n nb_opinions += 1\n end\n review.paragraphs.collect(&:update_status)\n review.update_status\n flash[:notice] = \"#{nb_opinions_moved} opinion(s) moved for #{nb_opinions} opinions total\"\n redirect_to \"/reviews/edit/#{review.id}\"\n end", "title": "" }, { "docid": "c69742896938bcd79467b35e52ef1836", "score": "0.55410093", "text": "def trigger(event)\n if @events.include? event\n @triggered << event\n catch(:transition) do\n @events[event].each { |block| instance_eval(&block) }\n nil\n end\n else\n raise NameError, \"No such event: #{event}\"\n end\n end", "title": "" }, { "docid": "c69742896938bcd79467b35e52ef1836", "score": "0.55410093", "text": "def trigger(event)\n if @events.include? event\n @triggered << event\n catch(:transition) do\n @events[event].each { |block| instance_eval(&block) }\n nil\n end\n else\n raise NameError, \"No such event: #{event}\"\n end\n end", "title": "" }, { "docid": "ebbeed21e3f33b9c6af2ee0fbaf677f0", "score": "0.542458", "text": "def set_event\n @event = Event.find(params[:id])\n skip_authorization\n end", "title": "" }, { "docid": "e47b9efd07c15d75b020c1f4552644fd", "score": "0.53809494", "text": "def changeState(user)\n if user.current_role == Role.Fachschaft || user.current_role == Role.Admin\n if self.unsubmitted?\n #Set the author of this event revision\n self.author = user\n #Make sure the event is awaiting approval\n self.waiting!\n elsif user.current_role == Role.Admin\n if self.reviewed?\n self.admin = user\n self.submitted!\n self.publish\n end\n end\n end\n save\n end", "title": "" }, { "docid": "b477af2da469ace4d071db9e663ed00b", "score": "0.5369966", "text": "def do_event_action\n if self.casetype == 'order' || self.casetype == 'abandoned_cart' || self.casetype == 'preorder'\n puts \"Case do_event_action start\"\n events = Event.where(casetype: self.casetype)\n if events.present?\n puts \"case do_event_action\"\n user = User.find_by_subdomain(Apartment::Tenant.current)\n events.each do |event|\n Services::EventAction.do_action(user, event, self)\n end\n end\n puts \"Case do_event_action finish\"\n end\n end", "title": "" }, { "docid": "34bb270058893e45bac16a68140f6a6d", "score": "0.53378475", "text": "def on_editing_entry(state, event, *event_args)\n super\n\n # TODO: simulation - remove\n if simulating\n action =\n case existing_record\n when false then :set_record\n when true then :reset_record\n else :create_record\n end\n if action == :create_record\n # From UploadController#edit:\n # @item = (get_record(@item_id) unless show_menu?(@item_id))\n __debug_sim('CODE') do\n args = \"id=#{submission.id.inspect}\"\n \"@item = get_record(#{args})\"\n end\n submission.set_item\n else\n action = :set_record\n end\n else\n action = :create_record\n end\n\n unless simulating\n wf_start_submission(*event_args)\n end\n\n # TODO: simulation - remove\n __debug_sim do\n case action\n when :set_record then 'Form error message displayed if present.'\n when :reset_record then 'Edit form reset after cancel.'\n else 'System presents a pre-populated edit form.'\n end\n end\n\n # TODO: simulation - remove\n commit = file_valid? ? 'submit' : 'upload'\n __debug_sim('USER modifies form to enable submit.')\n __debug_sim(\"USER must `cancel!` or `#{commit}!` to advance...\")\n\n self\n end", "title": "" }, { "docid": "89ebc3dd83129143bacdcc2c5a582035", "score": "0.53007096", "text": "def update\n authorize! :index, @event, :message => 'Not authorized as an administrator.'\n @event.update(event_params)\n respond_to do |format|\n format.html { redirect_to action: \"index\"}\n end\n end", "title": "" }, { "docid": "0cc380d5a754a52ad3a9f97e75662491", "score": "0.52587366", "text": "def find_and_trigger_event(event_type, args = nil)\r\n \r\n case event_type\r\n when :before_change\r\n \r\n if respond_to?(:before_change)\r\n \r\n results = send(:before_change, args)\r\n return false if results == false\r\n \r\n end\r\n \r\n when :after_change\r\n \r\n if respond_to?(:after_change)\r\n \r\n results = send(:after_change, args)\r\n return false if results == false\r\n \r\n end\r\n \r\n when :before_change_field\r\n \r\n #CALL FOR A SPECIFIC FIELD THAT HAS CHANGED\r\n trigger_function_name = \"#{:before_change_field}_#{args.field_name}\"\r\n if respond_to?(trigger_function_name)\r\n \r\n results = send(trigger_function_name, args) \r\n return false if results == false\r\n \r\n end\r\n \r\n #CALL FOR ANY FIELD THAT CHANGES\r\n trigger_function_name = \"#{:before_change_field}\"\r\n if respond_to?(trigger_function_name)\r\n \r\n results = send(trigger_function_name, args) \r\n return false if results == false\r\n \r\n end\r\n \r\n when :after_change_field\r\n #looks in own class for :after_change_field for the field passed, requires the parameter of a Field object to be passed\r\n \r\n #SAPPHIRE UPDATE\r\n #SEARCH FOR ACTIVE MAP DEFINITION THAT INCLUDES THE CURRENT TABLE AND FIELD.\r\n #IF ANY ARE FOUND QUEUE THE PROCESS\r\n if args.table.field_order.include?(\"student_id\")\r\n \r\n if map_id = $tables.attach(\"SAPPHIRE_INTERFACE_MAP\").field_value(\r\n \"primary_id\",\r\n \"WHERE athena_table = '#{table_name }'\r\n AND athena_field = '#{args.field_name }'\r\n AND trigger_event = 'after_change_field'\"\r\n )\r\n \r\n sid = $tables.attach(args.table.table_name).field_value(\"student_id\", \"WHERE primary_id = '#{args.primary_id}'\")\r\n student = $students.get(sid)\r\n \r\n if student && student.active.is_true?\r\n \r\n queue_record = $tables.attach(\"SAPPHIRE_INTERFACE_QUEUE\").new_row\r\n queue_record.fields[\"map_id\" ].value = map_id\r\n queue_record.fields[\"athena_pid\" ].value = args.primary_id\r\n queue_record.save\r\n \r\n end\r\n \r\n end\r\n \r\n end\r\n \r\n #CALL FOR A SPECIFIC FIELD THAT HAS CHANGED\r\n trigger_function_name = \"#{:after_change_field}_#{args.field_name}\"\r\n if respond_to?(trigger_function_name)\r\n \r\n results = send(trigger_function_name, args) \r\n return false if results == false\r\n \r\n end\r\n \r\n #CALL FOR ANY FIELD THAT CHANGES\r\n trigger_function_name = \"#{:after_change_field}\"\r\n if respond_to?(trigger_function_name)\r\n \r\n results = send(trigger_function_name, args)\r\n return false if results == false\r\n \r\n end\r\n \r\n when :before_load #any table can have this event for self table\r\n \r\n continue_with_load = true\r\n \r\n this_trigger_event = \"before_load_#{table_name.downcase}\"\r\n \r\n tables_with_before_load_events = args ? args : event_array(this_trigger_event)\r\n \r\n tables_with_before_load_events.each{|file|\r\n this_table = $tables.attach(file)\r\n \r\n begin\r\n continue_with_load = this_table.send(this_trigger_event)\r\n \r\n rescue=> e\r\n #raise e #THIS SHOULD HAVE BEEN A SYSTEM NOTIFICATION - ADDING NOW BUT LEACING THIS NOTE HERE TO HELP IDENTIFY ANY ISSUES THAT MAY COME TO LIGHT WHICH WERE CONCEALED BY THIS BEFORE...\r\n $base.system_notification(\r\n subject = \"BEFORE LOAD FAILED - #{file}\",\r\n content = \"Don't just stand there and shout it; do something about it... Here's the error:\r\n #{e.message}\r\n <br>\r\n <br>\r\n #{e.backtrace}\"\r\n )\r\n \r\n end\r\n \r\n } if tables_with_before_load_events\r\n \r\n return continue_with_load\r\n \r\n when :after_load #any table can have this event for self table\r\n \r\n this_trigger_event = \"after_load_#{table_name.downcase}\"\r\n \r\n tables_with_after_load_events = args ? args.dup : event_array(this_trigger_event)\r\n \r\n db_config_record(\r\n field_name = \"phase_total\",\r\n new_value = tables_with_after_load_events.join(\",\")\r\n )\r\n db_config_record(\r\n field_name = \"phase_completed\",\r\n new_value = nil\r\n )\r\n \r\n if !args || args.include?(\"move_source_to_dest\")\r\n tables_with_after_load_events.delete(\"move_source_to_dest\")\r\n move_source_to_dest\r\n end\r\n \r\n tables_with_after_load_events.each{|file|\r\n this_table = $tables.attach(file)\r\n db_config_record(\r\n field_name = \"after_load_status\",\r\n new_value = \"Started #{file} - #{DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")}\"\r\n )\r\n \r\n begin\r\n this_table.send(this_trigger_event)\r\n db_config_record = $tables.attach(\"Db_Config\").by_table_name(table_name)\r\n phase_completed = db_config_record.fields[\"phase_completed\"].value\r\n phase_completed = (phase_completed ? \"#{phase_completed},#{file}\" : file)\r\n db_config_record(\r\n field_name = \"phase_completed\",\r\n new_value = phase_completed\r\n )\r\n db_config_record(\r\n field_name = \"after_load_status\",\r\n new_value = \"Completed #{file} - #{DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")}\"\r\n )\r\n \r\n rescue=> e\r\n after_load_failed(message = \"#{file} - #{e.message} <br><br> #{e.backtrace}\", e)\r\n raise e\r\n end\r\n \r\n } if tables_with_after_load_events\r\n \r\n when :after_insert\r\n send(:after_insert, args) if respond_to?(:after_insert)\r\n \r\n when :after_save\r\n send(:after_save, args) if respond_to?(:after_save)\r\n \r\n when :before_insert\r\n #Looks in own class for before_insert event, requires the parameter of a Row object to be passed\r\n if respond_to?(:before_insert)\r\n send(:before_insert, args)\r\n else\r\n return true\r\n end\r\n \r\n end\r\n \r\n return true\r\n \r\n end", "title": "" }, { "docid": "847e5210af16563bfc76ae1dfa36416e", "score": "0.5244523", "text": "def call(event)\n return false if drop?\n event\n end", "title": "" }, { "docid": "7fe95cfa471285371b065b78f3ca3204", "score": "0.5243257", "text": "def rollback\n super\n each { |transition| transition.machine.write(object, :event, transition.event) unless transition.transient? }\n end", "title": "" }, { "docid": "51175d706e6bf136727bafd2c907779e", "score": "0.5242847", "text": "def shift_event(&block)\n @event_action = block\n\n self\n end", "title": "" }, { "docid": "e96e96126f932abc97d1f0880f21d1fa", "score": "0.5208639", "text": "def trigger(event, payload={})\n broadcast(false, \"triggered.event\", { event: event, payload: payload })\n broadcast(true, event, payload)\n end", "title": "" }, { "docid": "8fe288b069b7ab0c3288639354df95f4", "score": "0.52044916", "text": "def trigger_event(event)\n event.watch(self) if can_trigged?(event)\n end", "title": "" }, { "docid": "9ef0d02546eb32ebbcbb3ab8468b08fa", "score": "0.51988375", "text": "def persist_event\n raise NotImplementedError\n end", "title": "" }, { "docid": "3a5116cb0fdbb49225597fd1e6442c3f", "score": "0.5197029", "text": "def save_event?(event)\n event.save\n end", "title": "" }, { "docid": "332a1bf3e58e798a117aabb296521cc9", "score": "0.5196944", "text": "def mark_worker_was_here\n @adventure.events.create(action: 'worker_ran')\n end", "title": "" }, { "docid": "6fb405bed4d03af15bf1418e60106acc", "score": "0.51915514", "text": "def perform\n @event = Event.new(\n stakato_version_key: @stakato_version_key,\n key: @key,\n #event_key: @event_key,\n event_profile_key: @event_profile_key,\n profile_id: @profile_id,\n event_type_key: @event_type_key,\n event_data: @event_data,\n ruby_message: @ruby_message\n )\n @event.save\n @event\n end", "title": "" }, { "docid": "15070496469af03681a96e7d4abc0986", "score": "0.5188739", "text": "def trigger\n raise ArgumentError, \"A paper is required\" if paper.nil?\n raise ArgumentError, \"Event #{name} not registered\" unless self.class.allowed?(name)\n raise StandardError, \"Event #{self} already triggered\" if @triggered\n\n # Run handlers\n paper.journal.behaviors.where(event_name: name).each { |behavior| behavior.call(self) }\n\n # Broadcast it\n Notifier.notify(event: name, data: notify_payload)\n\n # Log to the activity feed\n Activity.create!(**activity_feed_payload)\n @triggered = true\n end", "title": "" }, { "docid": "6262a10bc278e9f4ef5ccff998e27911", "score": "0.5183904", "text": "def fired_event(event)\n history << event\n\t update_task_status(event)\n end", "title": "" }, { "docid": "a9fdaf51089d5bfc90e6ba13d680dbdb", "score": "0.5168594", "text": "def fire(record)\n run(record, false) || false\n end", "title": "" }, { "docid": "436e3ca2bb7b16526315425a8a746b53", "score": "0.51575357", "text": "def on_modifying_entry(state, event, *event_args)\n super\n\n # Verify validity of the submission. # TODO: simulation - remove\n if simulating\n # From UploadController#update:\n # @item, failed = upload_edit(**data)\n __debug_sim('CODE') do\n args = \"data=#{submission.data.inspect}\"\n opt = 'index: false'\n \"@item, failed = upload_edit(#{args}, #{opt})\"\n end\n bad = nil\n if (db_fail = submission.db_failure)\n self.failures << 'DB create failed'\n elsif (bad = !(submission.metadata_valid = !submission.invalid_entry))\n self.failures << 'bad metadata'\n else\n self.succeeded << submission.id\n end\n if db_fail\n __debug_sim('[edit_db_failure: true]')\n __debug_sim('The database entry could not be updated.')\n elsif bad\n __debug_sim('[edit_invalid_entry: true]')\n __debug_sim('The entry is invalid/incomplete.')\n __debug_sim('(NOTE: PROBABLE FAILURE OF CLIENT-SIDE FORM VALIDATION)')\n else\n __debug_sim('[edit_invalid_entry: false]')\n __debug_sim('[edit_db_failure: false]')\n end\n end\n\n # Verify validity of the submission.\n unless simulating\n wf_validate_submission(*event_args)\n end\n\n valid = ready?\n\n # TODO: simulation - remove\n if valid\n __debug_sim('The database entry was updated.')\n else\n __debug_sim('System generates a form error message to be displayed.')\n end\n\n # Automatically transition to the next state based on submission status.\n if valid\n advance! # NOTE: => :modified\n else\n reject! # NOTE: => :editing\n end\n self\n end", "title": "" }, { "docid": "c4ac69a1661fa60987e73de436f5f014", "score": "0.51522267", "text": "def set_event\n @event = Event.find(params[:id])\n authorize @event\n end", "title": "" }, { "docid": "2af021acd1b8df173441146c84a8a1d1", "score": "0.51437724", "text": "def event(event, opts={}, &block)\r\n tt = read_inheritable_attribute(:transition_table)\r\n \r\n et = read_inheritable_attribute(:event_table)\r\n e = et[event.to_sym] = SupportingClasses::Event.new(event, opts, tt, &block)\r\n define_method(\"#{event.to_s}!\") { e.fire(self) }\r\n end", "title": "" }, { "docid": "37d5e02c30ce7bdb09a77bb9870eed23", "score": "0.50978285", "text": "def fire_events!(*events)\n run_action = [true, false].include?(events.last) ? events.pop : true\n fire_events(*(events + [run_action])) || fail(StateMachines::InvalidParallelTransition.new(self, events))\n end", "title": "" }, { "docid": "089ee706ed4f602979540ede3fb3e067", "score": "0.50860363", "text": "def transmit_event\n # Extract just the old values from change_hash\n old_values = {}\n change_hash.each_pair do |k,v|\n old_values[k] = v[0]\n end\n case source_type\n when \"Instance\"\n if ['running', 'stopped'].include?(status_code)\n # If we look this up through the 'source' association, we end up with it being a stale object.\n instance = Instance.unscoped.find(source_id)\n # If we have a time_last_running, use it; otherwise, we just started and it's not populated yet\n start_time = instance.time_last_running || Time.now\n terminate_time = status_code == 'stopped' ? instance.time_last_stopped : nil\n # Because this is an after-save hook, rescue any possible exceptions -- if for some reason\n # we cannot save the Event, we don't want to abort the Instance update transaction.\n begin\n e = Aeolus::Event::Cidr.new({\n :instance_id => instance.id,\n :deployment_id => instance.deployment_id,\n :image_uuid => instance.image_uuid,\n :owner => instance.owner.username,\n :pool => instance.pool.name,\n :provider => instance.provider_account.provider.name,\n :provider_type => instance.provider_account.provider.provider_type.name,\n :provider_account => instance.provider_account.label,\n :hardware_profile => instance.hardware_profile.name,\n :start_time => start_time,\n :terminate_time => terminate_time,\n :old_values => old_values,\n :action => status_code\n })\n e.process\n rescue Exception => e\n logger.error \"Caught exception trying to save event for instance: #{e.message}\"\n return true\n end\n end\n # There is also a \"summary\" attribute on state changes, but we don't appear to need to check it\n when \"Deployment\"\n if ['some_stopped', 'first_running', 'all_stopped', 'all_running'].include?(status_code)\n deployment = Deployment.unscoped.find(source_id)\n begin\n # TODO - The Cddr method supports a :deployable_id, but we don't implement this at the moment\n e = Aeolus::Event::Cddr.new({\n :deployment_id => deployment.id,\n :owner => deployment.owner.username,\n :pool => deployment.pool.name,\n :provider => (deployment.provider.name rescue \"-nil-\"),\n :provider_type => (deployment.provider.provider_type.name rescue \"-nil-\"),\n :provider_account => (deployment.instances.first.provider_account.label rescue \"-nil-\"),\n :start_time => deployment.start_time,\n :terminate_time => deployment.end_time,\n :old_values => old_values,\n :action => status_code\n })\n e.process\n rescue Exception => e\n logger.error \"Caught exception trying to save event for deployment: #{e.message}\"\n return true\n end\n end\n end\n end", "title": "" }, { "docid": "c6e82db5fb89398138a3c1d27a2af990", "score": "0.5075664", "text": "def trigger_success(data=nil)\n event.success = true\n event.data = data\n event.trigger\n end", "title": "" }, { "docid": "6365cc954448a7c5a4617f688ae6dedb", "score": "0.5066899", "text": "def execute(event, obj)\n state_machine.run_callback event.name, obj do |obj|\n execute_action(event, obj)\n end\n end", "title": "" }, { "docid": "d1fc3dd241b83c7afbcbd096fa0bccad", "score": "0.5061866", "text": "def trigger_failure(data=nil)\n event.success = false\n event.data = data\n event.trigger\n end", "title": "" }, { "docid": "b20d5ce01ce7927cb3ba43fdd3f548ab", "score": "0.50573444", "text": "def call\n catch_event unless no_event_possible?\n end", "title": "" }, { "docid": "f4bfa9509b955551f0fd5bb9e9e58b11", "score": "0.50482273", "text": "def fired_event(event)\n history << event\n update_task_status(event)\n end", "title": "" }, { "docid": "22b668cc6351ec88de1609f70407f105", "score": "0.50472766", "text": "def update_event\r\n if request.post?\r\n @event = PrivateEvent.find(params[:id])\r\n if @event.update_attributes(params[:event])\r\n redirect_to :action => 'events'\r\n end \r\n else \r\n @event = PrivateEvent.find(params[:id])\r\n end\r\n end", "title": "" }, { "docid": "a2cb5947a573d16e37912543afa8ffc2", "score": "0.50411177", "text": "def save(record, status)\n if !(valid = record.valid?)\n log.error \"Event invalid after transformation. #{record_messages(record).join(' ')}\"\n record.errors.keys.each do |prop|\n record.errors[prop].each do |e|\n status.unsuccessful_record(\n record, \"Invalid after transformation: #{e}.\",\n :attribute_name => prop,\n :attribute_value => record.send(prop).inspect\n )\n end\n end\n end\n\n if valid || @configuration.soft_validations\n log.debug(\"Saving valid transformed event record #{record_ident record}.\")\n begin\n unless (@configuration.soft_validations ? record.save! : record.save)\n msg = \"Could not save valid record #{record.inspect}. #{record_messages(record).join(' ')}\"\n log.error msg\n status.unsuccessful_record(record, msg)\n end\n rescue => e\n msg = \"Error on save. #{e.class}: #{e}.\"\n log.error msg\n status.unsuccessful_record(record, msg)\n end\n end\n end", "title": "" }, { "docid": "c58f15befbe131788d9fd9dae2224eec", "score": "0.5040967", "text": "def save\n this_event = FedoraAccessEvent.new\n this_event.pid = pid\n this_event.agent = agent.truncate(254)\n this_event.event = event\n this_event.location = ip_format(ip)\n this_event.event_time = event_time\n this_event.save\n end", "title": "" }, { "docid": "1b1b3df713ab00137eb5174f9d5f432a", "score": "0.5036151", "text": "def execute\n raise \"Event.execute is abstract\"\n end", "title": "" }, { "docid": "a9ddf38dc2249ab079e41d1c94ca4c17", "score": "0.5032704", "text": "def process!(event_name, options={}, &block)\n process(event_name, options, &block) or\n raise ActiveRecord::RecordInvalid, record\n end", "title": "" }, { "docid": "144b8d0f7fc45f1a723e89452b66cfc4", "score": "0.50257343", "text": "def update\n if @event.update(event_params)\n msg = MSG[:update][:success]\n else\n @success = false\n msg = @event.errors.full_messages\n end\n common_response(msg, event: @event)\n end", "title": "" }, { "docid": "7b19c382f790b05d818ee6696bc1716d", "score": "0.50233954", "text": "def save\n case event.event_type\n when 'enter' then enter\n when 'leave' then leave\n else logger.info \"Unsupported event_type: #{event.event_type}\"\n end\n end", "title": "" }, { "docid": "6c3ced31e0c2457c0504c69f4b3fe95d", "score": "0.5012706", "text": "def event_permitted(event)\n case event\n when :review\n [:pending, :requested].include? current_state\n when :confirm\n if !has_digital_items?\n [:pending, :reviewing].include? current_state\n else\n current_state == :reviewing\n end\n when :begin_work\n current_state == :pending && any_items_ready?\n when :complete_work\n current_state == :in_progress\n when :fulfill\n if reproduction_order?\n current_state == :work_complete\n else\n all_items_ready? && (current_state == :confirmed)\n end\n when :activate\n current_state == :fulfilled\n when :close\n if reproduction_order?\n current_state == :fulfilled\n else\n (current_state == :fulfilled) && finished?\n end\n end\n end", "title": "" }, { "docid": "547c3f52c1ab579bc9e17ff1b536507b", "score": "0.5012067", "text": "def set_event\n exist_event = Event.where(id: params[:id])\n if exist_event != [] and logged_in?\n @event = Event.find(params[:id])\n else\n flash[:danger] = \"You don't have permission to perform this action.\"\n if !logged_in?\n redirect_to root_path\n else\n redirect_to events_path\n end\n end\n end", "title": "" }, { "docid": "484b293da480d12a9fa75eb5bef8848f", "score": "0.5009206", "text": "def can_trigged?(event)\n false\n end", "title": "" }, { "docid": "9d0afe5ffcbd242eedf955a50ec4d2d9", "score": "0.5003182", "text": "def set_event \n if current_user != nil\n @event = Event.find(params[:id])\n else\n redirect_to('/login?force=true')\n end\n end", "title": "" }, { "docid": "b154f3a1a9a73bb963c41efab433badb", "score": "0.5001729", "text": "def update\n @event = Event.find(params[:id])\n @event.associate_with_venue(params[:venue_name])\n has_new_venue = @event.venue && @event.venue.new_record?\n\n @event.start_time = params[:start_date], params[:start_time]\n @event.end_time = params[:end_date], params[:end_time]\n\n if evil_robot = !params[:trap_field].blank?\n flash[:failure] = \"<h3>Evil Robot</h3> We didn't update this event because we think you're an evil robot. If you're really not an evil robot, look at the form instructions more carefully. If this doesn't work please file a bug report and let us know.\"\n end\n\n respond_to do |format|\n if !evil_robot && @event.update_attributes(params[:event])\n flash[:success] = 'Event was successfully updated.'\n format.html {\n if has_new_venue && !params[:venue_name].blank?\n flash[:success] += \"Please tell us more about where it's being held.\"\n redirect_to(edit_venue_url(@event.venue, :from_event => @event.id))\n else\n redirect_to(@event)\n end\n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36af67eeedc38d319e3ccbdae6f5a640", "score": "0.4996509", "text": "def event_requirement; end", "title": "" }, { "docid": "c67bfe0f320329b5e5cc71d54cc2e98b", "score": "0.49926686", "text": "def edit_event(event_info_hash) \n\t\tif event_info_hash.has_key?(:name)\n\t\t\tnew_name = event_info_hash[:name]\n\t\t\treturn ERR_INVALID_NAME if new_name.blank? || new_name.length > NAME_MAX_LENGTH\n\t\t\tself.name = new_name\n\t\t\tself.update_attribute(:name, new_name)\n\t\tend\n\t\tif event_info_hash.has_key?(:time)\n\t\t\tnew_time = event_info_hash[:time].to_i\n\t\t\t\treturn ERR_INVALID_TIME if new_time.blank? || (new_time < DateTime.now.ago(60*15).to_i)\n\t\t\tself.time = new_time\n\t\t\tself.update_attribute(:time, new_time)\n\t\t\tbegin\n\t\t\t\tNotifyHandler.task_scheduler.unschedule(self.scheduler_job_id) if self.scheduler_job_id != -1\n\t\t\trescue \n\t\t\tend\n\t\t\t# Schedule a notification only if the event is starting more than 10\n\t\t\t# minutes from now. \n\t\t\tif (self.time > (DateTime.now.to_i + 10*60))\n\t\t\t\ttime_string = Time.at(self.time).to_datetime.to_formatted_s(:rfc822)\n\t\t\t\tnotify_job_id = NotifyHandler.task_scheduler.in time_string, NotifyHandler\n\t\t\t\tNotifyHandler.add_job_mapping(notify_job_id, self.id)\n\t\t\tend\n\t\tend\n\t\tif event_info_hash.has_key?(:description)\n\t\t\tself.description = event_info_hash[:description]\n\t\t\tself.update_attribute(:description, self.description)\n\t\tend\n\t\tif event_info_hash.has_key?(:location)\n\t\t\tself.location = event_info_hash[:location]\n\t\t\tself.update_attribute(:location, self.location)\n\t\tend\n\t\treturn SUCCESS\n\tend", "title": "" }, { "docid": "4e2e4b12a033bd02730f39a4341d5b76", "score": "0.49849355", "text": "def run_callbacks(index = 0)\n if index == 0\n # Clears any traces of the event attribute to prevent it from being\n # evaluated multiple times if actions are nested\n each do |transition|\n transition.machine.write(object, :event, nil)\n transition.machine.write(object, :event_transition, nil)\n end\n\n # Rollback only if exceptions occur during before callbacks\n begin\n super\n rescue\n rollback unless @before_run\n @success = nil # mimics ActiveRecord.save behavior on rollback\n raise\n end\n\n # Persists transitions on the object if partial transition was successful.\n # This allows us to reference them later to complete the transition with\n # after callbacks.\n each { |transition| transition.machine.write(object, :event_transition, transition) } if skip_after && success?\n else\n super\n end\n end", "title": "" }, { "docid": "a1ab663a1adc56e02c03c2e95d5b7a14", "score": "0.49848145", "text": "def run(record, bang)\n from_state = record.send(machine.attribute)\n \n # Stop the transition if any before callbacks fail\n return false if invoke_callbacks(record, :before, from_state) == false\n result = update_state(record, bang)\n \n # Always invoke after callbacks regardless of whether the update failed\n invoke_callbacks(record, :after, from_state)\n \n result\n end", "title": "" }, { "docid": "4fa1ee1dad7a1105db36be1ce6f48511", "score": "0.49745885", "text": "def perform_action\n action_name = params[:action_name].to_sym\n action = resource.member_actions[action_name]\n if action.is_method_action?\n @record.send(action.method_name)\n end\n if action.is_block_action?\n action.block.call(@record)\n end\n return redirect_to([app_kit, @record])\n end", "title": "" }, { "docid": "12a790e896e52e26a1f39c1c97ebf16b", "score": "0.4969866", "text": "def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "title": "" }, { "docid": "cd95a34be34322acc35807764aa76fbe", "score": "0.49640706", "text": "def execute\n begin\n return false unless check_guards\n execute_actions\n rollback_actions unless self.failed_action.nil?\n self.failed_action.nil?\n ensure\n self.save!\n end\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.4954018", "text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "title": "" }, { "docid": "632b1d94027e3cf0e84c98d546d4a094", "score": "0.49496305", "text": "def dispatch event\n raise Exception.new(\"workers cannot dispatch while blocked\") if blocked?\n @event = event\n @is_running = true\n \n self.resume event\n end", "title": "" }, { "docid": "177fdb6553245b2448d45bb0b447469c", "score": "0.49488074", "text": "def update\n @event.user.account.update(account_params)\n \n if @event.update(event_params)\n redirect_to :back\n else\n redirect_to dashboard_path\n end\n end", "title": "" }, { "docid": "edd530ccf6e98732cd788276c2aadc27", "score": "0.49389595", "text": "def set_event\n @event = ::Event.find(params[:event_id] || params[:rollcall][:event_id])\n end", "title": "" }, { "docid": "3fa06acf0b400377752aa21b07e079be", "score": "0.49250114", "text": "def post( event )\n if @thread && @conditions[ event.event_class ]\n set_event_status(event, :pending )\n @event_queue.push event\n CFSM.logger.info \"Event #{event.inspect} posted to #{namespace}\"\n process_event if @thread==true\n end\n end", "title": "" }, { "docid": "11804b164682e7d29d867923fb3c7d32", "score": "0.49246532", "text": "def rollback\n each {|transition| transition.machine.write(object, :event, transition.event)}\n super\n end", "title": "" }, { "docid": "d171a9cf192fa7d5fdd020dea288091b", "score": "0.4913224", "text": "def handle_event(event)\n\n\t\tend", "title": "" }, { "docid": "733789d4581e085fea0388fc763e2474", "score": "0.49129796", "text": "def set_new_state_after_notify(was_successful, event, status)\n unless status.attending?\n if was_successful\n if event.event?\n status.not_responded!\n else\n status.delivered!\n end\n else\n status.not_delivered!\n end\n status.save\n end\n end", "title": "" }, { "docid": "deff81ee0b3b81b61e2f6ad7a5730507", "score": "0.49128628", "text": "def record_event(type, target_obj)\n event_type_id = case type\n when :ask then 1\n when :answer then 2\n when :comment then 3\n when :compose then 4\n when :vote then 5\n when :downvote then 6\n when :watch then 7\n when :unwatch then 8\n when :follow then 9\n when :unfollow then 10\n when :update then 11\n when :accept then 12\n else 0\n end\n\n target_type_id = case\n when target_obj.is_a?(Question) then 1\n when target_obj.is_a?(Answer) then 2\n when target_obj.is_a?(Comment) then 3\n when target_obj.is_a?(Article) then 4\n when target_obj.is_a?(User) then 5 # update profile without param 'obj'\n else 0\n end\n\n event = self.events.build(\n event_type: event_type_id,\n target_type: target_type_id,\n target_id: target_obj.id\n )\n\n if event.valid?\n event.save\n else\n raise \"event_recording_error\"\n end\n end", "title": "" }, { "docid": "ffa0c110dce310860c2bf353909fc037", "score": "0.49122068", "text": "def on_creating_entry(state, event, *event_args)\n super\n\n # TODO: simulation - remove\n if simulating\n action =\n case existing_record\n when false then :set_record\n when true then :reset_record\n else :create_record\n end\n if action == :create_record\n # From UploadController#new:\n # @item = new_record(user_id: @user.id, base_url: request.base_url)\n __debug_sim('CODE') do\n args = 'user_id: @user.id, base_url: request.base_url'\n \"@item = new_record(#{args})\"\n end\n submission.set_item\n else\n action = :set_record\n end\n else\n action = :create_record\n end\n\n unless simulating\n wf_start_submission(*event_args)\n end\n\n # TODO: simulation - remove\n __debug_sim do\n case action\n when :set_record then 'Form error message displayed if present.'\n when :reset_record then 'New-item form emptied after cancel.'\n else 'System presents a new-item submission form.'\n end\n end\n\n # TODO: simulation - remove\n commit = file_valid? ? 'submit' : 'upload'\n __debug_sim('USER fills form until submit is enabled.')\n __debug_sim(\"USER must `cancel!` or `#{commit}!` to advance...\")\n\n self\n end", "title": "" }, { "docid": "bca2b48f35af55cfb52f79f221f2471c", "score": "0.49118525", "text": "def _perform(&block)\n\n begin\n\n r = validate\n return r unless r.success?\n\n yield if block_given?\n\n mark_contract_event_as_processed\n\n success\n\n rescue StandardError => se\n\n mark_contract_event_as_failed\n\n return exception_with_data(\n se,\n 'cem_b_1',\n 'exception in contract event management: ' + se.message,\n 'Something went wrong.',\n GlobalConstant::ErrorAction.default,\n {contract_event_obj_id: @contract_event_obj.id}\n )\n\n end\n\n end", "title": "" }, { "docid": "a696d016c00338b99f1f16459c5c7491", "score": "0.49058223", "text": "def update\n respond_to do |format|\n if params[:commit]==\"Approve Event\"\n @event.is_approved = true\n end\n if @event.update(event_params)\n \n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f6723bdf9d22a7d6ff4266db9e26f17", "score": "0.49024984", "text": "def assist_to_event\n creator.assist(self)\n end", "title": "" }, { "docid": "df0eefacb81aa153987c9578a5523698", "score": "0.48958635", "text": "def create\n event = Event.new(event_params.merge(state: State.find(event_params[:state])).merge(user: User.find(session[:user_id])))\n if not event.save\n flash[:errors] = event.errors.full_messages\n end\n redirect_to '/events'\n end", "title": "" }, { "docid": "2602b84f3a775e12ed49b3b0e35f8cd3", "score": "0.48929593", "text": "def dispatch event\n @dispatch_fiber.resume event\n end", "title": "" }, { "docid": "56d60e6ddfee0be763518502cadcf86b", "score": "0.4891", "text": "def apply(raw_event); end", "title": "" }, { "docid": "1240019e86677f6db0dd4d9eafc00582", "score": "0.48892164", "text": "def update\n return unless restrict_to_admin\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc7d3800e11a7214a4d1d1ceb8716003", "score": "0.48849973", "text": "def update\n #@event.status = \"Pending\"\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, success: 'Event was successfully rescheduled.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "faf483df6f64f12a9943f8eca2898680", "score": "0.4884636", "text": "def update\n redirect_to :root and return unless @car_request.aasm.events.map(&:name).map(&:to_s).include? params[:form_action]\n @car_request.send(params[:form_action], nil, current_user)\n @car_request.save!\n redirect_to car_requests_url\n end", "title": "" }, { "docid": "55e7dc46ff34e51da81c8ee23f2e8cca", "score": "0.48843652", "text": "def issueEvent\n loop do\n [email protected]\n changed\n notify_observers(event[0],event[1],event[2],event[3])\n end\n end", "title": "" }, { "docid": "8f4bd88da32a611457bfac8f90b5ab47", "score": "0.48763186", "text": "def commit\n\t\t\t if valid?\n\t\t\t\t\tcallback_process = setup(klass)\n\t\t\t\t\tklass.send(event, callback_process)\n\t\t\t\t\tklass\n\t\t\t else\n\t\t\t\t\tInnsights::ErrorMessage.log(\"#{klass} doesn't respond to callback event #{event}\")\n\t\t\t end\n\t\t\tend", "title": "" }, { "docid": "e7d07162db5f4dcd225b789f3fa1520f", "score": "0.48635578", "text": "def alaram_operation action\n @state = action\n notify\nend", "title": "" }, { "docid": "c9aa4c535d87f1bc4a88155675fae3b2", "score": "0.4858619", "text": "def performed?(event)\n @triggered.include?(event)\n end", "title": "" }, { "docid": "c9aa4c535d87f1bc4a88155675fae3b2", "score": "0.4858619", "text": "def performed?(event)\n @triggered.include?(event)\n end", "title": "" }, { "docid": "08c4007fa124e593d7fdf30dd0c76c02", "score": "0.484831", "text": "def perform(record)\n run(record, false)\n end", "title": "" }, { "docid": "60952d92e2b0fa5b05fd8b5b3cc6a9aa", "score": "0.48449218", "text": "def activate\n \n @event = Event.find(params[:act][:event_id])\n @event.purchase_type = 'p'\n @event.save\n\n current_user.decrement(:purchased_events)\n current_user.save\n\n redirect_to @event, notice: \"Thank you for activating the Event Page for #{@event.title}. You will now have permanent access to this page.\"\n\nend", "title": "" }, { "docid": "630a75b238699389e4b7eee1688ca82a", "score": "0.48445958", "text": "def exec_event(ce)\r\n if ce.event\r\n @direction, @completed, @message = ce.event.happens(@pc)\r\n ce.update_attribute(:completed, @completed)\r\n @pc.reload\r\n else\r\n Rails.logger.warn \"!!! No event found for current event; #{ce.inspect}\"\r\n ce.update_attribute(:completed, @completed)\r\n @pc.reload\r\n end\r\n\r\n if @direction\r\n flash[:notice] = @message\r\n redirect_to @direction\r\n else\r\n render :file => 'game/complete', :layout => true\r\n end\r\n end", "title": "" }, { "docid": "f155b79585c56e66cf076e45963090fd", "score": "0.48418853", "text": "def perform_update\n @resource = controller.send(model.name)\n resource.tap do\n trigger_event(:save) do\n update_and_save_resource\n end\n end\n end", "title": "" }, { "docid": "83ef2e9cc9876ea39766a1ec63242dbe", "score": "0.48416287", "text": "def mark_contract_event_as_failed\n @contract_event_obj.status = GlobalConstant::ContractEvent.failed_status\n @contract_event_obj.save!\n end", "title": "" }, { "docid": "6512a1b626f36f059f718e6da6fac43f", "score": "0.48400858", "text": "def guard_against_tampering(event)\n if event.user != current_user # Must be the event's owner\n if current_user.admin? != true # or they must be a site Administrator\n redirect_to event, alert: \"You are not the creator of this event or a Protest45 Admin.\"\n end\n end\n end", "title": "" }, { "docid": "f4735c32bcc6edf037bf9d001e4d77f9", "score": "0.48377627", "text": "def record_event(event)\n @events_mutex.synchronize do\n @events << event\n end\n end", "title": "" }, { "docid": "21c3baf1487453bd8a8ac29b2398e598", "score": "0.4837023", "text": "def update\r\n @event.update(event_params)\r\n end", "title": "" }, { "docid": "0ea8cbc59fd0f8e894a6fca89a0c8687", "score": "0.48284724", "text": "def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end", "title": "" }, { "docid": "9fd8a1ea84e62a631c0a8aa0a7015709", "score": "0.48276454", "text": "def update\n authorize @event\n if @event.update(event_params)\n redirect_to event_path( @event ) , notice: 'Event was successfully updated.'\n else\n render :edit\n end\n end", "title": "" }, { "docid": "88586014eec6a855b1f39a1630c86752", "score": "0.48258233", "text": "def handle(event_or_id)\n case event_or_id\n when Hash\n upsert_user(event_or_id)\n when String\n table.insert_ignore.insert(id: event_or_id)\n event_or_id\n end\n end", "title": "" }, { "docid": "d3e6f816947ed2a75473b3a5fdb767f3", "score": "0.48181513", "text": "def run(record, bang)\n result = false\n \n record.class.transaction do\n transitions.each do |transition|\n if transition.can_perform?(record)\n result = bang ? transition.perform!(record) : transition.perform(record)\n break\n end\n end\n \n # Rollback any changes if the transition failed\n raise ActiveRecord::Rollback unless result\n end\n \n result\n end", "title": "" }, { "docid": "fdc4e0e443228d981db87529bd81cba4", "score": "0.48157638", "text": "def record_submission\n transaction do\n task.update_attributes(completed_at: DateTime.now)\n project.signal_or_raise!(:accept_proposal, nil, self)\n end\n end", "title": "" }, { "docid": "665bb291b5970ce1a8737a978bf57526", "score": "0.48155057", "text": "def update\n @event = Event.find(params[:id])\n\n # given event was not created by the current user\n if (@event.creator.id != current_user.id) && (!current_user.admin?)\n logger.error \"Attempt to update invalid event #{params[:id]} with creator_id #{@event.creator.id} for current user_id #{current_user.id}\" \n redirect_to events_path, notice: 'You do not have permission to update that event!'\n end\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
14713210bbceb73f53e55e5152a51213
POST /requests POST /requests.json
[ { "docid": "5c8280e144fcd43fb5455ecb61cea0b1", "score": "0.57172066", "text": "def create\n @request = Request.new(request_params)\n\n respond_to do |format|\n if @request.save\n format.html do\n redirect_to user_requests_path,\n notice: 'Request was successfully created.'\n end\n format.json { render :show, status: :created, location: @request }\n else\n format.html { render :new }\n format.json do\n render json: @request.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "title": "" } ]
[ { "docid": "a318fea357a4f157da49db8a2440f565", "score": "0.72750616", "text": "def create\n RestClient.post \"#{@uri}/api/requests\", @data.to_json, :content_type => :json\n end", "title": "" }, { "docid": "f3e5a41d5f246112fb00f6a4d86d9da3", "score": "0.6256417", "text": "def create\n if current_user\n @request = current_user.requests.create!(request_params)\n # @request.user=current_user\n # @request.save\n \n json_response(@request, :created)\n\n else\n json_response({message:\"Login to create a request\"}, :unauthorized)\n\n end\n end", "title": "" }, { "docid": "f10d783a085f71b688b91a0339125abf", "score": "0.6244971", "text": "def post(path, data)\n request(:post, path, JSON.dump(data))\n end", "title": "" }, { "docid": "40aba877727263a2c561ae175967c91c", "score": "0.62318623", "text": "def do_POST(request, response)\n hash = {\n body: JSON.parse(request.body),\n request: request,\n response: response\n }\n @requests.add(hash)\n\n response.header['Access-Control-Allow-Origin'] = '*'\n response.status = Server.status_code('POST')\n rescue JSON::ParserError => e\n msg = \"Unable to parse request as JSON: #{e.message}\"\n $logger.error msg\n Server.invalid_requests.add({\n reason: msg,\n request: request,\n response: response,\n body: request.body\n })\n rescue StandardError => e\n $logger.error \"Invalid request: #{e.message}\"\n Server.invalid_requests.add({\n invalid: true,\n reason: e.message,\n request: {\n request_uri: request.request_uri,\n header: request.header.to_h,\n body: request.inspect\n },\n response: response\n })\n end", "title": "" }, { "docid": "0556289324955c9ffa69590033c7dfb3", "score": "0.6162292", "text": "def make_batch_request\n\t\trequest = Net::HTTP::Post.new( self.endpoint.path )\n\t\trequest[ 'Content-Type' ] = 'application/json'\n\n\t\treturn request\n\tend", "title": "" }, { "docid": "d36a673e069f25db830f44f153b24588", "score": "0.6100216", "text": "def post_request(url, object)\n results = @@client.post url, object\n results.to_json\nend", "title": "" }, { "docid": "9e84448f8a2be23697788a74899131c2", "score": "0.60970503", "text": "def post_request(param)\n param=add_oauth_data(param)\n \n data_json=JSON.generate(param)\n \n res=@http_session.post(@request_uri.path,data_json).body\n\n if @debug then\n puts \"DEBUG INFO...\"\n puts \"Request in JSON:\"\n puts data_json\n puts \"Server Responce:\"\n puts res\n puts \"End of DEBUG INFO...\"\n \n end\n res=JSON.parse(res,:symbolize_names => true) \n end", "title": "" }, { "docid": "bfd91294d1f53e95371b17e5435f672a", "score": "0.6090965", "text": "def post(request)\n do_request(:post, request)\n end", "title": "" }, { "docid": "658751e62138cca8e2a94212c458dc43", "score": "0.60698915", "text": "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "title": "" }, { "docid": "658751e62138cca8e2a94212c458dc43", "score": "0.60698915", "text": "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "title": "" }, { "docid": "8ff75fb65202906bd00ed9fd31d99c30", "score": "0.6036355", "text": "def create\n @request = @current_user.requests.create(params[:request])\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to @request, notice: 'Request was successfully created.' }\n format.json { render json: @request, status: :created, location: @request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26aa1078e2fbc1e7482871493e2af503", "score": "0.6035252", "text": "def post_json(path, data = {})\n @request_uri = \"#{@base_uri}#{path}\" \n body = JSON.generate(data)\n extheader = { 'Content-Type' => 'application/json' }\n req = post_request(path, body, extheader)\n @res = http_connection.start {|http| http.request(req) }\n handle_error(@res, @request_uri)\n JSON.parse(@res.body)\n end", "title": "" }, { "docid": "04ac50941ce75edf12180eab5c00c007", "score": "0.6028802", "text": "def post(path, params: {}, headers: {})\n request_json :post, path, params, headers\n end", "title": "" }, { "docid": "b60d4e39bc7cc623832d3a8b550b4b06", "score": "0.60151726", "text": "def create\n # byebug\n @request = Request.new(request_params(:user_id, :mouths_to_feed, :taken))\n if @request.save\n render json: @request\n else\n render json: {error: \"couldn't make request\"}\n end\n end", "title": "" }, { "docid": "7acdb16652feaf175da3c582691caee5", "score": "0.6008637", "text": "def post_rest(path, json) \n run_request(:POST, create_url(path), json) \n end", "title": "" }, { "docid": "a101637da0aa69820ef325c82c21eb35", "score": "0.5993348", "text": "def POST(api_url_m1)\n uri = URI(ENV['API_URL_M'] + api_url_m1)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri)\n request[\"Content-Type\"] = 'application/json'\n request[\"Authorization\"] = $bearerToken\n request[\"Cache-Control\"] = 'no-cache'\n request.body = \"{\\n device: 'string',\\n user_name: 'string',\\n team: 'string',\\n work_order: 'string',\\n planned_start_dt: '2018-07-05T20:20:07.819Z',\\n planned_end_dt: '2018-07-05T20:20:07.819Z',\\n time_zone: 'EST',\\n down_time: true,\\n description: 'test55',\\n title: 'test55',\\n cmp_number: 0,\\n url: 'jnj.mdsol.com'\\n}\"\n response = http.request(request)\n puts response.read_body\n $lastJsonResponse = JSON.parse($response.read_body)\nend", "title": "" }, { "docid": "5601a0a311e83ad85f83faa4a6aeae1f", "score": "0.5989912", "text": "def create\n @request = current_user.requests.build(request_params)\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to @request, notice: \"Request was successfully created.\" }\n format.json { render :show, status: :created, location: @request }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end \n end", "title": "" }, { "docid": "4e9fc3b152fbc23a9e74a9e7e2c44741", "score": "0.5978193", "text": "def post(request)\n _request(request) { |client, options| client.post options }\n end", "title": "" }, { "docid": "e8530dce99700dc35a29109492925361", "score": "0.59533924", "text": "def do_POST(request, response)\n log_request(request)\n case request['Content-Type']\n when %r{^multipart/form-data; boundary=([^;]+)}\n boundary = WEBrick::HTTPUtils::dequote($1)\n body = WEBrick::HTTPUtils.parse_form_data(request.body, boundary)\n hash = {\n body: body,\n request: request\n }\n else\n # \"content-type\" is assumed to be JSON (which mimics the behaviour of\n # the actual API). This supports browsers that can't set this header for\n # cross-domain requests (IE8/9)\n digests = check_digest request\n hash = {\n body: JSON.parse(request.body),\n request: request,\n digests: digests\n }\n end\n @requests.add(hash)\n response.header['Access-Control-Allow-Origin'] = '*'\n response.status = Server.status_code\n rescue JSON::ParserError => e\n msg = \"Unable to parse request as JSON: #{e.message}\"\n $logger.error msg\n Server.invalid_requests << {\n reason: msg,\n request: request\n }\n rescue StandardError => e\n $logger.error \"Invalid request: #{e.message}\"\n Server.invalid_requests << {\n reason: e.message,\n request: request\n }\n end", "title": "" }, { "docid": "dd00ccca28e293d2da904241b68f3b91", "score": "0.59504956", "text": "def post()\n @response = RestClient.post(\n \"#{@server}#{@endpoint}\",\n @request,\n :Host => @site,\n :Authorization => \"Basic #{@credentials}\",\n :Content_Type => \"application/json\"\n )\n end", "title": "" }, { "docid": "94bdbaba496ee9f9b5b2b03fce45fcf5", "score": "0.5947922", "text": "def post(path, json, headers = {}, options = {})\n request(:POST, path, headers, options, json)\n end", "title": "" }, { "docid": "1dafdf6e01a657b61378c39287ce3c38", "score": "0.593852", "text": "def post(path, json, headers = {})\n request(:POST, path, headers, json)\n end", "title": "" }, { "docid": "40010cc0357b5e184580ea1e29a417a7", "score": "0.5937656", "text": "def post_json(url, **options)\n JSON.parse(do_request('post', url, header: {'Content-Type' => 'application/json'}, **options).content)\n end", "title": "" }, { "docid": "b08e25ef37c01fdb7cd6d8b52916d826", "score": "0.5935839", "text": "def post(path, body, options = {})\n options[:body] = body\n json_request('POST', path, options)\n end", "title": "" }, { "docid": "d29e3f961726a8ec00807a1e2f728cd6", "score": "0.59150356", "text": "def post_json(path, data = {})\n client(path).post_json(path, data)\n end", "title": "" }, { "docid": "c4b8ba4273b09ed53e57e2e3ebc0e16d", "score": "0.591024", "text": "def post(options = {})\n request :post, options\n end", "title": "" }, { "docid": "6aa745d243b9d70eadfb5cc975c276f1", "score": "0.58916533", "text": "def post_request endpoint, opts={}, &block\n connection.post endpoint, opts, &block\n end", "title": "" }, { "docid": "ad8cb72cbe9ffb7ef434662a2e7d28fe", "score": "0.5877938", "text": "def post_json(path, body)\n uri = build_uri(path)\n # puts \"🤖 POST #{path}\"\n # puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(post_request)\n end\n\n # puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n # puts result[:result]\n result\nend", "title": "" }, { "docid": "484ab5cf9c3a31130136ff2f02ee9dbf", "score": "0.58763504", "text": "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "title": "" }, { "docid": "484ab5cf9c3a31130136ff2f02ee9dbf", "score": "0.58763504", "text": "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "title": "" }, { "docid": "a567e2c99d9ca0474bcd1e0738148458", "score": "0.5867574", "text": "def create\n @request = Request.new(request_params)\n\n if @request.save\n \n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f9da332f1694c09086a98b74b6ff09ac", "score": "0.58519065", "text": "def post(request)\n do_request(request) { |client, body| client.http_post body }\n end", "title": "" }, { "docid": "a1d4884b4ad6633b34882ff0031108df", "score": "0.5850967", "text": "def create_api_post_request(access_token, request)\n response = access_token.post request\n response.body\n end", "title": "" }, { "docid": "fd5469d0152ed1d73b3cd59fb8b12a07", "score": "0.58498985", "text": "def post *args\n make_request :post, *args\n end", "title": "" }, { "docid": "c840df2b574d7e45c9a87240d8f7c240", "score": "0.5845702", "text": "def post\n resource.post(request, response)\n end", "title": "" }, { "docid": "c840df2b574d7e45c9a87240d8f7c240", "score": "0.5845702", "text": "def post\n resource.post(request, response)\n end", "title": "" }, { "docid": "5f63b396364db37d280224e5486df44a", "score": "0.5841292", "text": "def build_post_data request\n data = {\n \"clientID\" => client_id,\n \"ts\" => Time.now.to_i.to_s,\n \"verify\" => verify_string(request),\n \"type\" => \"json\"\n }\n request.empty? ? data : data['request'] = request\n data\n end", "title": "" }, { "docid": "9bad5e09e567c69b754b4d0e03c103f1", "score": "0.5838173", "text": "def post_rest(path, json, headers={})\n run_request(:POST, create_url(path), headers, json) \n end", "title": "" }, { "docid": "31cbf80ef614bf89e74ca0f0a3fe4a2e", "score": "0.5835487", "text": "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "title": "" }, { "docid": "dd597ef9174092a9d593b6412f43ef96", "score": "0.58322275", "text": "def request_post(json_rules)\n payload = json_rules\n response = RestClient.post(@url, payload, {:Authorization => form_auth_header}) \n response\n end", "title": "" }, { "docid": "7ff2f30e005562067017dcff0e10277f", "score": "0.58316994", "text": "def create\n @request = current_user.requests.new\n @request.type = params[:request][:type]\n @request.start_date = params[:request][:start_date]\n @request.end_date = params[:request][:end_date]\n @request.comment = params[:request][:comment]\n @request.status = \"Pending\"\n @request.organization_id = current_user.organization.id\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to requests_url, notice: 'Request was successfully created.' }\n format.json { render json: @request, status: :created, location: @request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2f7f36b96e085c573a47d6e45c9a681", "score": "0.5818489", "text": "def create\n puts \"Received request\"\n \n @request = Request.new(params[:request])\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to @request, :notice => 'Request was successfully created.' }\n format.json { render :json => @request, :status => :created, :location => @request }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @request.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a34c60c751cd26114c8fdcbc65abd6e", "score": "0.57982135", "text": "def create\n @request = Request.new(request_params)\n @request.user = current_user\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to requests_url, notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n else\n format.html { redirect_to requests_url }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "11c90008c92c724ff8ee4e3beb90368a", "score": "0.5793294", "text": "def post(path, body, options = {})\r\n options[:body] = body\r\n json_request('POST', path, options)\r\n end", "title": "" }, { "docid": "f8a83a1f02ff662cc8dd0ad2b34f95f2", "score": "0.57850784", "text": "def post_request\n return \"204\" if self.suppressed?\n uri = URI.parse(\"#{self.base_request_url}/patrons/#{self.patron_id}/holds/requests\")\n\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Authorization\"] = \"Bearer #{self.bearer}\"\n\n request.body = JSON.dump({\n \"recordType\" => \"i\", #TODO: This may change at a later date, but for now we are only doing item requests. KAK.\n \"recordNumber\" => self.record_number.to_i,\n \"pickupLocation\" => self.pickup_location\n })\n $logger.debug \"Posting hold-request: #{request.body} to #{uri}\"\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n read_timeout: 10\n }\n\n begin\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n rescue Exception => e\n $logger.error \"Sierra post_request error: #{e.message}\"\n response = TimeoutResponse.new\n end\n\n $logger.debug \"Sierra Post request response code: #{response.code}, response: #{response.body}\"\n response # returns empty content, either code 204 if success, 404 if not found, or 500 if error, so passing code along.\n end", "title": "" }, { "docid": "af07dc01523901accd2d9e9706e7517f", "score": "0.5777591", "text": "def receive\n perform_request(:post, '/rest/v2/reply.json')\n end", "title": "" }, { "docid": "5e889fe05b4a4a54d2067711c5921457", "score": "0.5771708", "text": "def post_json(path, data = {})\n pp data if @debug\n @res = client.post(\"#{@base_uri}#{path}\", data)\n handle_error(@res)\n JSON.parse(@res.body)\n end", "title": "" }, { "docid": "8472c2b250a721ea097efc166ffb290d", "score": "0.577104", "text": "def post(path, params={}); make_request(:post, host, port, path, params); end", "title": "" }, { "docid": "8fffaa1df592ccc633e1d218cbe4fca9", "score": "0.576337", "text": "def post(request, options={})\n request(request, :post, options)\n end", "title": "" }, { "docid": "462e91c077542fc8ef939f687caceabf", "score": "0.5757879", "text": "def post_json(url, input_json)\n # we don't need the serial hash anymore so we\n # can reuse the serial json payload from the sensor\n input_json.delete \"hash\"\n\n # parse our input url\n uri = URI.parse(url)\n\n # make a new request\n req = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'})\n\n\n # have to format it as json again with .to_json to avoid a\n # undefined method 'bytesize' for #<Hash: ...\n # error message.\n req.body = input_json.to_json\n\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req)}\n puts \"Response #{response.code} #{response.message}: #{response.body}\"\nend", "title": "" }, { "docid": "e620a3ac25a2863bf684264c63d47c5f", "score": "0.57524854", "text": "def post_api_request(relative_url, form_data, request_body)\n uri = URI(API_BASE + relative_url)\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data) if form_data\n if request_body\n req.body = request_body\n req['Content-Type'] = 'application/json'\n end\n req['Authorization'] = \"Bearer #{@auth_token}\"\n res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n http.request(req)\n end\n JSON.parse(res.body)\n end", "title": "" }, { "docid": "6c625272f8596f63d4b6a64a50938d9a", "score": "0.57459354", "text": "def post(options = {})\n request(:post, options)\n end", "title": "" }, { "docid": "791cd49b6916ccae7004e4771deb5138", "score": "0.57414794", "text": "def post_request(_context, endpoint, data)\n Puppet.runtime[:http].post(\n build_uri(endpoint),\n Puppet::Util::Json.dump(data),\n headers: {\n 'Content-Type' => 'application/json'\n },\n options: build_options,\n )\n end", "title": "" }, { "docid": "e89f9f90b4af7532936a66ac4e091b3c", "score": "0.57401514", "text": "def parallel_post(requests, options = {})\n base_parallel_call(:post, requests, options)\n end", "title": "" }, { "docid": "61e533088f2298e9fbd942c1a237212a", "score": "0.57347405", "text": "def post_data( requestPath, data )\n @request_counter += 1\n data[:counter] = @request_counter\n data[:time] = Time.now.strftime( '%Y/%m/%d %H:%M:%S' )\n do_request( requestPath, data )\n end", "title": "" }, { "docid": "4dea54d2bbae9efd42a454926affa34b", "score": "0.5734558", "text": "def send_post_request(url, body, method)\n response = RestClient::Request.execute(\n method: method,\n url: url,\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Bearer #{@security_bearer}\"\n },\n payload: body.to_json\n )\n end", "title": "" }, { "docid": "49a306b7f7a7aa89c4d481fd1c3d135f", "score": "0.5720692", "text": "def post(path,json,&block)\n post = Net::HTTP::Post.new(url_for(path))\n post.basic_auth @id, @secret\n post.content_type = 'application/json'\n post.body = json.to_json\n\n request(post,&block)\n end", "title": "" }, { "docid": "760fd242a86f771f96239f2e74b5ecfb", "score": "0.5716506", "text": "def request(message)\n req = Net::HTTP::Post.new(@request_path)\n req.add_field('Content-Type', 'application/json-rpc')\n req.body = JSON.generate(message)\n req\n end", "title": "" }, { "docid": "92a1f02d8cb473ae58e66c2ade391b53", "score": "0.5715366", "text": "def post(request)\n do_request request do |url, headers, body|\n client.post url, body, headers\n end\n end", "title": "" }, { "docid": "e907fb65f56d78e9be5033fe1c42872d", "score": "0.5705066", "text": "def create\n if request_factory.save\n render json: body, status: :created\n else\n render json: { data: { errors: @request_factory.errors.messages } },\n status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c0237a1bb485de6ed3b0aa484a3d9bef", "score": "0.5698449", "text": "def create\n status = Request.new_request(request_params)\n @request = Request.get_request(status[0], status[1], status[2], status[3]) if status\n respond_to do |format|\n if status\n format.html { redirect_to @request, notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n else\n format.html { render :new }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3901fbfc3d621a2ae3d03c7273875efb", "score": "0.5673094", "text": "def make_json_request profile, method, path, data, **kwargs\n return make_request(\n profile,\n method,\n path,\n body: JSON.dump(data),\n headers: { 'content-type' => $APPLICATION_JSON },\n **kwargs\n )\nend", "title": "" }, { "docid": "97a56c5b99edf47c0ddecf12f03685f7", "score": "0.56555504", "text": "def post(path, options={}, request_opts={})\n request(:post, path, options, request_opts)\n end", "title": "" }, { "docid": "2667e5d1f96994e85df22a0a8ef34478", "score": "0.5646801", "text": "def api_json_post(uri, data)\n json = Oj.dump(data)\n api_raw_post(uri, json, 'application/json')\n end", "title": "" }, { "docid": "30fc5638df58994cbb6de8e68624670f", "score": "0.56448174", "text": "def post_json(data, action)\n response = RestClient.post \"#{@url}/#{action}\", data.merge(@auth).to_json, :content_type => :json, :accept => :json\n response.body\n end", "title": "" }, { "docid": "e2a594a101e12ed29fa8584c6087cb5e", "score": "0.56378305", "text": "def postRequest(url, payload, extra_headers={})\n headers = {\n :Content_Type => \"application/json\",\n :Accept => \"application/json\",\n :Authorization => \"Bearer #{@oauth.access_token}\"\n }\n\n headers.merge!(extra_headers)\n\n RestClient.post url, payload, headers\n end", "title": "" }, { "docid": "70bbcc364e7b409f10e4e9511536431f", "score": "0.5632419", "text": "def post(rectype,attribs,http)\r\n endpoint=\"#{URL_PREFIX}/t#{rectype}s.json\"\r\n req = Net::HTTP::Post.new(endpoint,initheader = {'Content-Type' =>'application/json'})\r\n req.body = attribs.to_json\r\n http.request(req)\r\nend", "title": "" }, { "docid": "600af786ff6ebb22b8b29df892091eb9", "score": "0.5625089", "text": "def create_request(request_data, token)\n # Take test request data and test user JWT to create a request\n # Return the request ID\n post '/requests',\n params: request_data,\n headers: {\n \"authorization\" => \"bearer #{token}\"\n },\n as: :json\n res = JSON.parse(response.body)\n request_id = res['id']\n return request_id\n end", "title": "" }, { "docid": "7a66b8e683b6b8b4c7ba6097b00cef40", "score": "0.5619837", "text": "def postRequest(payload, url)\n begin\n response = RestClient.post(url, payload, headers=@@SERVICE_HEADERS)\n rescue RestClient::ExceptionWithResponse => err\n response = err.response\n end\n\n JSON.load response\n rescue JSON::ParserError => err\n response\n end", "title": "" }, { "docid": "6376ae4509ea00f319a182fd223e015e", "score": "0.56182736", "text": "def post(path, json, headers={})\n api_request(:POST, create_url(path), headers, json)\n end", "title": "" }, { "docid": "22201f22e629399ac67e583badeab894", "score": "0.561698", "text": "def post_users_json payload\n\tJSON.parse ( rest_client_request :post, HF_URL, payload ).body\nend", "title": "" }, { "docid": "1dfbc707276e8f20ed3d403e2be5aa5c", "score": "0.561553", "text": "def post(path, opts = {})\n request(:post, path, opts)\n end", "title": "" }, { "docid": "6cd31da7cbf2b042854da7e13a64b41b", "score": "0.5612421", "text": "def post(path, opts = {})\n request('POST', path, opts)\n end", "title": "" }, { "docid": "5171639ab569fa649362a74cea1f83a9", "score": "0.560329", "text": "def post_request(object)\n end", "title": "" }, { "docid": "38235d9a7a42d494dcfd99f8875ec1b7", "score": "0.5594507", "text": "def requests\n @types = %w[holidays expenses trips]\n @statuses = %w[applied accepted declined]\n\n @allrequests = @chair.create_allrequests(@types, @statuses)\n end", "title": "" }, { "docid": "cc59581d5ee086fc797a2f2df91d0cee", "score": "0.55931854", "text": "def request_params\n params.require(:request).permit(:number, :polyclinic_id, :post_id, :routine_id, :schedule_id, :user_id, :date)\n end", "title": "" }, { "docid": "c556baf7314be5071aae3194e1865339", "score": "0.5591436", "text": "def post_request(url, hash={})\n req = Net::HTTP::Post.new(url.path)\n req.set_form_data(hash)\n req \n end", "title": "" }, { "docid": "357cc2f23e8fda77730e8dcaa0e82837", "score": "0.55840486", "text": "def post(path, params = {}, options = {})\n options[:content_type] ||= :json\n options[:Authorization] = \"simple-token #{self.access_token}\"\n RestClient.post(request_url(path), params.to_json, options)\n end", "title": "" }, { "docid": "2fe1107c0435235a916a3946097d9ac6", "score": "0.5581422", "text": "def post(path, json, &block)\n post = Net::HTTP::Post.new(url_for(path))\n post.basic_auth @id, @secret\n post.content_type = 'application/json'\n post.body = json.to_json\n\n request(post, &block)\n end", "title": "" }, { "docid": "f7e9a54e8229b79510f796b963f69a22", "score": "0.5579399", "text": "def post_request(path, params = {}, options={})\n r = HttpHelper::HttpRequest.new(get_params(path, params)).post\n parse_api_response(r, options)\n end", "title": "" }, { "docid": "aeff6d61c7f469ec32d025291f939eab", "score": "0.5560864", "text": "def post_json(url:, params: {}, headers: {})\n post url, params: params, headers: headers(additional_headers: headers)\n end", "title": "" }, { "docid": "e8bbeb31baa7b1e3039b5fa9a31a57f2", "score": "0.5560435", "text": "def post_json url, args, headers = {}, mock_response = nil\n response = post_json_no_check url, args, headers, mock_response\n raise \"Request failed\" if !response[\"responseResult/isSuccess\"]\n\n response\n end", "title": "" }, { "docid": "8c9f08ffe8452919752e6d4df87c49fd", "score": "0.55585617", "text": "def create\n @requests_room = RequestsRoom.new(requests_room_params)\n\n if @requests_room.save\n render json: @requests_room, status: :created, location: @requests_room\n\n else\n render json: @requests_room.errors.full_messages , status: :unprocessable_entity\n\n end\n\n end", "title": "" }, { "docid": "21e5c6716dc5f8a688dbdaa47abfd3d2", "score": "0.55547637", "text": "def post(path, data={})\n request(:post, path, data)\n end", "title": "" }, { "docid": "8ecdfd2defcafb4bef30d18ef6fb5d8d", "score": "0.5552012", "text": "def post_requests_by_id(organization, id, hash)\n HttpClient::Preconditions.assert_class('organization', organization, String)\n HttpClient::Preconditions.assert_class('id', id, String)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n r = @client.request(\"/#{CGI.escape(organization)}/webhook/deliveries/#{CGI.escape(id)}/requests\").with_json(hash.to_json).post\n ::Io::Flow::V0::Models::WebhookRequest.new(r)\n end", "title": "" }, { "docid": "6a65b041c6abde562ba63354bdcd99ce", "score": "0.55506414", "text": "def create\n bin = Bin.find_by(slug: request_params)\n payload = {\n headers: request.headers.env.reject { |key| key.to_s.include?('.') || REJECT_HEADERS.include?(key) },\n method: request.method,\n body: request.body,\n query_params: request.query_parameters,\n timestamp: Time.now\n }\n payload = JSON.generate(payload)\n\n # fetch request headers, method, body, query params\n # create timestamp\n # stitch together and put payload column of requests object\n # ensure bin id is set too\n @request = Request.new(payload: payload, bin_id: bin.id)\n\n respond_to do |format|\n if @request.save\n # redirect to bins show page\n format.html { redirect_to \"/data/#{bin.slug}\", notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n else\n format.html { redirect_to '/', status: :unprocessable_entity }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9a2a48c5c31956aea46f0ad5dfb5f06", "score": "0.5545395", "text": "def post(url, payload, options = {})\n options.merge!({ content_type: :json, accept: :json })\n RestClient.post(url, payload.to_json, options, &method(:request_block))\n end", "title": "" }, { "docid": "b896b3ae5153e8cfa34a0a08345a3252", "score": "0.55384225", "text": "def create_request\n create_file file_json, write_json\n end", "title": "" }, { "docid": "2b3bebf92836b82d94bc6ce0e319e3e7", "score": "0.55381536", "text": "def create\n @requestinfo = Requestinfo.new(requestinfo_params)\n\n if @requestinfo.save\n render json: @requestinfo, status: :created, location: @requestinfo\n else\n render json: @requestinfo.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2accb7f3f27c94d8bc919a114f654529", "score": "0.5529637", "text": "def create\n @request = Request.new(request_params)\n @customers = Customer.all\n @suppliers = Supplier.all\n @designers = Designer.all\n @statuses = Status.all\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to @request, notice: 'Request was successfully created.' }\n format.json { render action: 'show', status: :created, location: @request }\n else\n format.html { render action: 'new' }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "84be56c51b3e1ca58494e3eaf93c0249", "score": "0.55286294", "text": "def api_request(body)\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field('Content-Type', 'application/json-rpc')\n request.body = body\n \n # increment the request id\n @id+=1\n # returnng entire responce. Will think of how to hadle errors and what to return later.\n return response = http.request(request)\n end", "title": "" }, { "docid": "c7926d6334a227ec010c01eafcbca60a", "score": "0.5519791", "text": "def create\n req = Request.create(creation_params)\n if req.id\n render :json => { \"id\" => req.id }.to_json\n else\n render nothing: true, status: 500\n end\n end", "title": "" }, { "docid": "44670185a7afc3cfd3dc9bfe3a81d166", "score": "0.55192786", "text": "def http_post_request(url, json_command)\n JSON.parse(RestClient.post(url, json_command, get_headers))\n end", "title": "" }, { "docid": "8b1b2b3a66d6c8d4d38ad023f03919df", "score": "0.55174285", "text": "def send_post_request(req_hash)\n # retried = false\n # begin\n\n uri = URI(API_URL)\n\n req =\n Net::HTTP::Post.new(\n uri,\n 'Content-Type' => 'application/json' )\n req.body = req_hash.to_json\n\n res =\n Net::HTTP\n .start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https', read_timeout: 15) do |http|\n http.request(req) end\n\n # rescue Errno::ECONNREFUSED, Net::ReadTimeout => error\n # unless retried\n # retried = true\n # retry\n # else error end\n # end\n end", "title": "" }, { "docid": "4c498964f5b5c47ab0a786c014047de8", "score": "0.55087715", "text": "def create\n @request = Request.new(secure_params)\n @request.user_id = current_user.id\n if @request.save\n respond_to do |format|\n format.json{\n render json: { status: 'success' }\n }\n end\n else\n respond_to do |format|\n format.json{\n render json: { status: 'error' }\n }\n end\n end\n end", "title": "" }, { "docid": "af37572a99f1212cea2eb2a39f08c911", "score": "0.5507983", "text": "def create\n @request = Request.new(request_params)\n \n respond_to do |format|\n if @request.save\n format.html { redirect_to @request, notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n else\n format.html { render :new }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "6b4b956e25a47a7cbd87091edad3e575", "score": "0.55072325", "text": "def post(path, params = {})\n request(:post, path, params)\n end", "title": "" }, { "docid": "783edf74afd5b37c2d3c65524cd6679c", "score": "0.55066335", "text": "def post(path, params = {})\n request :post, path, params\n end", "title": "" }, { "docid": "6a9747b17ee84befca59880c1f77fc75", "score": "0.5503412", "text": "def post_request(name, options = {})\n HTTMultiParty::post(@endpoint + name, query: options).body\n end", "title": "" }, { "docid": "adbd4063f9795c23205a346f6dfd3f22", "score": "0.5500977", "text": "def post uri, args = {}; Request.new(POST, uri, args).execute; end", "title": "" } ]
74239dae12903555efb98e7ee65af49d
tell the led string to render
[ { "docid": "6c371bc90b7121c63856ee7cbdcfa3bd", "score": "0.6272336", "text": "def render!\n serial_write \"r;\"\n end", "title": "" } ]
[ { "docid": "d96f49c957a8bfedbc161e14d1d9f7ad", "score": "0.6326887", "text": "def render_data pad, lineno, text\n text = text.join\n # FIXME why repeatedly getting this colorpair\n cp = @color_pair\n att = @attrib\n FFI::NCurses.wattron(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n FFI::NCurses.mvwaddstr(pad, lineno, 0, text)\n FFI::NCurses.wattroff(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n end", "title": "" }, { "docid": "f47b919fd64981f952f0595365632767", "score": "0.6288711", "text": "def render\n outputs.labels << [10, 30, state.tick_count]\n render_alert\n render_room\n render_highlights\n end", "title": "" }, { "docid": "67ed9bbfa5aba29ea77917bbaed17d8f", "score": "0.6277466", "text": "def render\n grid = @board.to_s # Grid is a string\n cursor_pos = @cursor.cursor_pos\n row, col = cursor_pos\n grid[row*18+(col*2)+1] = \"\\e[38;2;0;255;125m\\u25A3\\e[0m\"\n\n puts grid\n end", "title": "" }, { "docid": "442028521a0f4af999fe7790d8f744cd", "score": "0.62716293", "text": "def render\n super\n outputs.primitives << { x: 500, y: 66, text: 'Take a Break', size_enum: 10, r: 250, g: 250, b: 250 }.label\n end", "title": "" }, { "docid": "ee22547268d1e5796ca04804197ad021", "score": "0.62334704", "text": "def generate_sled(length, opts)\n\t\t\"\\x90\" * length\n\tend", "title": "" }, { "docid": "c1f5de0d4f9d46b5cde05642289a5627", "score": "0.61915594", "text": "def render\n out = HighLine.new\n out.wrap_at = 78\n out.say <<-RENDER\n<%=color(\"#{@name}\", :bold)%>\n<%='-'*#{@name.length}%>\n#{@text}\nRENDER\n end", "title": "" }, { "docid": "310a46b4851c329d563ad1570eae0f38", "score": "0.6161116", "text": "def after_render(str)\n str\n end", "title": "" }, { "docid": "1107dadafba2b348820e8f677e12ce8d", "score": "0.60686284", "text": "def info(str)\n @draw_mutex.synchronize do\n @current_step.blank if @current_step\n print '--> '.green\n puts str\n @current_step.repaint if @current_step\n end\n end", "title": "" }, { "docid": "a5441c65fcf187b3412002ae245deed2", "score": "0.60652554", "text": "def display\n print color + \"|\"\n end", "title": "" }, { "docid": "f2e20d804daca6f01ef173f7bf1f2827", "score": "0.59994894", "text": "def render_text s, c, f = font\n f.render renderer, s, color[c]\n end", "title": "" }, { "docid": "8d66c0f722b2cd51e7c4c6f37cf076c8", "score": "0.5989872", "text": "def render\n Curses.clear\n # braille encoding from UL: (1,3) (0,3) (1,2) (1,1) (1,0) (0,2) (0,1) (0,0)\n setpos(0,0)\n 0.upto(@screenLines-1) do |y|\n 0.upto(@screenCols-1) do |x|\n startX = x << 1 # x * 2\n startY = y << 2 # y * 4\n # nn = 0\n # 0.upto(7) do |i|\n # nn = nn << 1\n # nn = nn | @bits[startX + @mapping[i][0]][startY + @mapping[i][1]]\n # end\n # aa = 0xa0 + (nn >> 6)\n # bb = 0x80 + (nn % 64)\n # ...rewritten below to get rid of final / and & operations\n aa = 0\n bb = 0\n 0.upto(1) do |i|\n aa = aa << 1\n aa = aa | @bits[startX + @mapping[i][0]][startY + @mapping[i][1]]\n end\n 2.upto(7) do |i|\n bb = bb << 1\n bb = bb | @bits[startX + @mapping[i][0]][startY + @mapping[i][1]]\n end\n aa += 0xa0\n bb += 0x80\n\n\n astr = \"\\xe2\"\n astr << aa\n astr << bb\n #setpos(y, x) # don't need to do this every character since we print them all in order\n addstr(astr)\n end\n end\n refresh\n end", "title": "" }, { "docid": "8a9b59e0bf0ae001ba73f59e23806025", "score": "0.59563124", "text": "def output\n\t\tputs \"#{@lights} lights are lit\"\n\tend", "title": "" }, { "docid": "235b69bd3634733c12b7f7ab7d012aab", "score": "0.59498036", "text": "def render_text\n @state.transpose.map { |row| row.join }.join(\"\\n\")\n end", "title": "" }, { "docid": "a1694ee92a84f23485cca4549fb4d5d3", "score": "0.5941348", "text": "def render_data pad, lineno, text\n text = text.join\n # FIXME why repeatedly getting this colorpair\n cp = @color_pair\n att = @attrib\n # added for selection, but will crash if selection is not extended !!! XXX\n if @source.is_row_selected? lineno\n att = REVERSE\n # FIXME currentl this overflows into next row\n end\n\n FFI::NCurses.wattron(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n FFI::NCurses.mvwaddstr(pad, lineno, 0, text)\n FFI::NCurses.wattroff(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n end", "title": "" }, { "docid": "1c8d9ea9b4f917e015c9af1bc89b4fda", "score": "0.5934329", "text": "def render\r\n puts '-------------'\r\n puts '| %s | %s | %s |' % @state[1..3]\r\n puts '-------------'\r\n puts '| %s | %s | %s |' % @state[4..6] + \" Turn #{$turn}/9\"\r\n puts '-------------' + \" #{$tokens[1]}: #{$player_name[1]}\"\r\n puts '| %s | %s | %s |' % @state[7..9] + \" #{$tokens[2]}: #{$player_name[2]}\"\r\n puts '-------------'\r\n nil\r\n end", "title": "" }, { "docid": "a51a04a619c6e28ef21d3393aec78f67", "score": "0.58915186", "text": "def render \n counter = 0\n (0...8).each do |row|\n output = ''\n row % 2 == 1 ? counter = 0 : counter = 1\n (0...8).each do |col|\n piece = @board[[row, col]]\n if [row, col] == @cursor.cursor_pos\n output << ' '.colorize(:white).on_light_black\n if piece.color == 'B'\n output << piece.to_s.colorize(:blue).on_light_black \n else \n output << piece.to_s.colorize(:red).on_light_black\n end\n output << ' '.colorize(:white).on_light_black\n elsif counter % 2 == 0\n output << ' '.colorize(:white).on_white\n if piece.color == 'B'\n output << piece.to_s.colorize(:blue).on_white \n else \n output << piece.to_s.colorize(:red).on_white\n end\n output << ' '.colorize(:white).on_white\n else \n output << ' '.colorize(:black).on_black\n if piece.color == 'B'\n output << piece.to_s.colorize(:blue).on_black\n else \n output << piece.to_s.colorize(:red).on_black\n end\n output << ' '.colorize(:black).on_black\n end\n counter += 1\n end\n puts output\n end\n \n end", "title": "" }, { "docid": "f27e6d3df6145acd2857cd6d157ab74a", "score": "0.5883224", "text": "def led\n @message = 'Someone activated a led!'\n\n Pusher['myscreen-input'].trigger('led-activated', @message)\n end", "title": "" }, { "docid": "b74fc0417d058708a10f09d19caf86d9", "score": "0.5880354", "text": "def red text; \"\\033[0;31m#{text}\\033[0m\"; end", "title": "" }, { "docid": "de744343d23bc33e1606a620f112b6e8", "score": "0.58441687", "text": "def write(string, x, y, color, *args)\n @font.style = SDL::TTF::STYLE_BOLD if args.include?('bold')\n @font.style = SDL::TTF::STYLE_ITALIC if args.include?('italic')\n r, g, b = color\n @font.draw_solid_utf8(@screen, string, x, y, r, g, b)\n @screen.update_rect(0,0,0,0)\n @font.style = SDL::TTF::STYLE_NORMAL\n end", "title": "" }, { "docid": "4497679df709e044ce691f73d21b7d1b", "score": "0.58264244", "text": "def blink\n\t\tstring = self\n\t\t\"#{Hawknee::Cli::Effects[:blink]}#{string}#{Hawknee::Cli::Effects[:clear]}\"\n\tend", "title": "" }, { "docid": "14051532652893cdae4840247eb0c483", "score": "0.5819187", "text": "def render\n \"<a id=\\\"#{html_id}\\\" href=\\\"#{toggle_url}\\\">#{text}</a>\"\n end", "title": "" }, { "docid": "904590287b400638d580d90da83cca28", "score": "0.5813921", "text": "def put_str(x: -10, y: -10, clr: nil, str:)\n @color = clr if clr\n set_pos(x: x, y: y)\n Curses.attron(color_pair(@color)|A_NORMAL) { Curses.addstr(str) } \n end", "title": "" }, { "docid": "e676bb0360449e44b4043801bb243fbd", "score": "0.58062655", "text": "def render(text)\n puts text\n end", "title": "" }, { "docid": "e676bb0360449e44b4043801bb243fbd", "score": "0.58062655", "text": "def render(text)\n puts text\n end", "title": "" }, { "docid": "379fe5900a86a2c6921ac73100132275", "score": "0.5799226", "text": "def text_to_draw\n text\n end", "title": "" }, { "docid": "bd78cc598339a5a7cddf6db4f2db77c6", "score": "0.579677", "text": "def render content, pad, color_pair, attr\n cp = color_pair\n FFI::NCurses.wbkgd(pad, FFI::NCurses.COLOR_PAIR(color_pair) | attr);\n FFI::NCurses.wattron(pad, FFI::NCurses.COLOR_PAIR(cp) | attr)\n # WRITE\n #filler = \" \"*@content_cols\n content.each_index { |ix|\n #FFI::NCurses.mvwaddstr(pad,ix, 0, filler)\n FFI::NCurses.mvwaddstr(pad,ix, 0, content[ix])\n }\n FFI::NCurses.wattroff(pad, FFI::NCurses.COLOR_PAIR(cp) | attr)\n end", "title": "" }, { "docid": "2f71ea21e97264bb6e9420854d664cea", "score": "0.5776592", "text": "def instead(string)\n @stasis.action._render = string\n end", "title": "" }, { "docid": "8d64ef3db7ea56a94c99c5cc076ab5df", "score": "0.57731014", "text": "def text= text\r\n \r\n if text == :default\r\n @component.string = nil\r\n @component.string_painted = true\r\n elsif text == :no_paint\r\n @component.string_painted = false\r\n else\r\n @component.string = text\r\n @component.string_painted = true\r\n end\r\n \r\n end", "title": "" }, { "docid": "5af8523c25caadbd9bf62dfead5ff78c", "score": "0.5755446", "text": "def set_text\n self.x = @target.screen_x - 98\n self.y = @target.screen_y - 54\n self.z = 3 * 100\n self.opacity = @target.opacity\n #self.bitmap.font.bold = true\n self.bitmap.font.shadow = true\n item = @target.target.battler.used_item\n if item != nil and !item.scope.between?(1, 6) and \n item.tool_data(\"User Graphic = \", false).nil?\n @text = item.name if @text.nil?\n end\n @target.target.battler.used_item = nil\n self.bitmap.draw_text(0, 0, 200, 32, @text, 1)\n end", "title": "" }, { "docid": "6e3610ac2371c8f0191ade5aba78e2f8", "score": "0.5751707", "text": "def render( state )\n\t\treturn ''\n\tend", "title": "" }, { "docid": "322f4d37eb1a54784d24a335d80ea55a", "score": "0.57515085", "text": "def html_out(msg, color_name=\"black\")\n rgb = Color::RGB::by_name color_name\n @handle.puts \"<span style='color:#{rgb.css_rgb};'>#{msg}</span>\"\n end", "title": "" }, { "docid": "322f4d37eb1a54784d24a335d80ea55a", "score": "0.57515085", "text": "def html_out(msg, color_name=\"black\")\n rgb = Color::RGB::by_name color_name\n @handle.puts \"<span style='color:#{rgb.css_rgb};'>#{msg}</span>\"\n end", "title": "" }, { "docid": "08e9ea5a072fc812a5cd3685a5dc383a", "score": "0.5750538", "text": "def render_stencil(stencil, text, attributes, &content)\np \"OH NO TILT!!!!\"\n #if Malt.support?(stencil)\n context = TemplateContext.new(attributes)\n Malt.render(text, :to=>format, :data=>context, &content)\n #else\n # text\n #end\n\n #if engine = Tilt[stencil]\n # engine.new{text}.render(nil, attributes, &content)\n #else\n # text\n #end\n end", "title": "" }, { "docid": "0bc6f2138916e74eddc0e532219cb7fd", "score": "0.5746803", "text": "def draw_turn_texts args\n #$gtk.log \"INFO: RENDERING TURNS TEXTS...\"\n args.outputs.primitives << {\n x: args.state.board.x,\n y: args.state.board.y + 450,\n text: \"PLAYER 1\",\n size_enum: 22,\n r: 0,\n g: 0,\n b: 255,\n a: args.state.turn == 0 ? 255 : args.state.ualpha\n }.label\n\n args.outputs.primitives << {\n x: args.state.board.x + 770,\n y: args.state.board.y + 450,\n text: \"PLAYER 2\",\n size_enum: 22,\n r: 255,\n g: 0,\n b: 0,\n a: args.state.turn == 1 ? 255 : args.state.ualpha\n }.label\nend", "title": "" }, { "docid": "582812a67fd0bfefb3fb42662f32c414", "score": "0.5741799", "text": "def red(text); \"\\033[31m#{text}\\033[0m\" end", "title": "" }, { "docid": "982652fc1303d0f63ddd09a57ed10962", "score": "0.5726614", "text": "def render pad, lineno, text\n if text.is_a? Chunks::ChunkLine\n FFI::NCurses.wmove @pad, lineno, 0\n a = get_attrib @attrib\n \n show_colored_chunks text, nil, a\n return\n end\n if @renderer\n @renderer.render @pad, lineno, text\n else\n FFI::NCurses.mvwaddstr(@pad,lineno, 0, @content[lineno])\n end\n end", "title": "" }, { "docid": "2115bc7b2a808aeb62c4b836da11f317", "score": "0.5725928", "text": "def draw_sight\n #return if @character.sensor.nil?\n #self.bitmap = load_bitmap(\"Graphics/Lights/\", \"RS5\")\n end", "title": "" }, { "docid": "2115bc7b2a808aeb62c4b836da11f317", "score": "0.5725928", "text": "def draw_sight\n #return if @character.sensor.nil?\n #self.bitmap = load_bitmap(\"Graphics/Lights/\", \"RS5\")\n end", "title": "" }, { "docid": "c8c34ce36708940450f4d23506770247", "score": "0.5705346", "text": "def render\n \n #system(\"clear\")\n (0..7).each do |i|\n (0..7).each do |j|\n \n if @board.grid[i][j].inspect == \"P\" \n if cursor.cursor_pos == [i,j]\n print \"P\".colorize(:background => :green), \" \" \n else\n print \"P\".red.on_white, \" \"\n end\n elsif @board.grid[i][j].inspect == \"R\"\n if cursor.cursor_pos == [i,j]\n print \"R\".colorize(:background => :green), \" \" \n else\n print \"R\".red.on_white, \" \"\n end\n else\n if cursor.cursor_pos == [i,j]\n print \"N\".colorize(:background => :green), \" \" \n else\n print \"N\".blue, \" \"\n end\n end\n end\n\n puts\n end\n #debugger\n #sleep(2.5)\n #cursor.get_input\n #i+=1\n #render\n end", "title": "" }, { "docid": "0525e668d36ed9e4da82ed19e310a75b", "score": "0.5686735", "text": "def render\n ascii_art_time = @font.asciify(formatted_current_time).split(\"\\n\")\n start_y = Ncurses.LINES / 2 - ascii_art_time.size / 2\n start_x = Ncurses.COLS / 2 - ascii_art_time[0].size / 2\n y = 0\n\n ascii_art_time.each_with_index do |line, offset_y|\n Ncurses.mvaddstr(start_y + offset_y, start_x, line)\n end\n\n Ncurses.move(0, 0)\n Ncurses.refresh\n end", "title": "" }, { "docid": "21342f2de2757005423bcb6c3c1baabf", "score": "0.56743723", "text": "def white; bold 39; end", "title": "" }, { "docid": "c52e0fd3edf9026cbb82b16d7d9cde9d", "score": "0.5672499", "text": "def render\n output = \"<span \"\n output << \"#{render_active}>\"\n link = \"#{@name}\"\n output << @view.link_to(link, :controller => @path)\n output << \"</span>\"\n output\n end", "title": "" }, { "docid": "dc4966504cf822082dc19311bea9e977", "score": "0.5670658", "text": "def ascii\n if @tally == 0\n\nputs \"\n\n _ _\n (.|( ) ✨\n (_Y|_/\n /_|\n L\n \"\n\n elsif @tally == 1\n puts \"\n\n <~>\n | |,_____\n ___`|\n |\"+\"('>\".colorize(:red)+\"|`-__\n ~ ~~~--__\n ______ (@| _ _\n / ~~~~|| (.|( ) ✨\n | `--____ (_Y|_/\n / ~~~--_____ ~~~/ /_|\n `~~~~~ L\n \"\n\n elsif @tally == 2\n puts \"\n\n <~>\n | |,_____\n ___`|\n |\"+\"('>\".colorize(:red)+\"|`-__\n ~ ~~~--__\n ______ (@| \"+\"*****\".colorize(:light_yellow)+\"**\".colorize(:light_red)+\" _ _\n /\"+\"******\".colorize(:light_yellow)+\"~~~~||\"+\"******\".colorize(:light_yellow)+\"***\".colorize(:light_red)+\" (.|( ) ✨\n | `--____\"+\"***********\".colorize(:light_yellow)+\"****\".colorize(:light_red)+\" (_Y|_/\n / ~~~--_____ ~~~/ \"+\"*******\".colorize(:light_yellow)+\"*****\".colorize(:light_red)+\" /_|\n `~~~~~ \"+\"****\".colorize(:light_yellow)+\"**\".colorize(:light_red)+\" L\n\n\n\n \"\n elsif @tally == 3\n puts \"\n <~>\n | |,_____ ______\n ___`| (Oh no!)\n |\"+\"('>\".colorize(:red)+\"|`-__ ⁻⁻⁻⁻⁻⁻\n ~ ~~~--__ \"+\"** *****\".colorize(:red)+\" ****\".colorize(:light_red)+\" o \"+\"*\".colorize(:red)+\"\n ______ (@| \"+\"*****\".colorize(:light_yellow)+\"** ****\".colorize(:light_red)+\" ***\".colorize(:red)+\" _ _ º \"+\"**\".colorize(:red)+\"\n /\"+\"******\".colorize(:light_yellow)+\"~~~~||\"+\"*****\".colorize(:light_yellow)+\"******\".colorize(:light_red)+\"********* ******\".colorize(:red)+\" (.|( ) ✨\n | `--____\"+\"**********\".colorize(:light_yellow)+\"*********\".colorize(:light_red)+\"******** ******\".colorize(:red)+\" (_Y|_/ \"+\"** **\".colorize(:red)+\"\n / ~~~--_____ ~~~/ \"+\"******\".colorize(:light_yellow)+\"**********\".colorize(:light_red)+\"*********** **\".colorize(:red)+\" /_| \"+\"** **\".colorize(:red)+\"\n `~~~~~ \"+\"***\".colorize(:light_yellow)+\"*********\".colorize(:light_red)+\"*********\".colorize(:red)+\" L \"+\" ***\".colorize(:red)+\"\n **\".colorize(:light_yellow)+\"** *****\".colorize(:light_red)+\" ***** ****\".colorize(:red)+\"\n \"+\"***\".colorize(:red)+\"\n\n \"\n elsif @tally == 4\n puts \"\n <~> ___________\n | |,_____ (BWAHAHAAHA!)\n ___`| ⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻⁻\n |\"+\"('>\".colorize(:red)+\"|`-__ o\n ~ ~~~--__ º \"+\"** ***\".colorize(:light_red).blink+\"\n ______ (@| \"+\"*\".colorize(:light_yellow).blink+\"****** *\".colorize(:light_red).blink+\"*** ******* ******\".colorize(:red).blink+\"\n /\"+\"******\".colorize(:light_yellow).blink+\"~~~~||\"+\"*\".colorize(:light_yellow).blink+\"***********\".colorize(:light_red).blink+\"**********************\".colorize(:red).blink+\"\n | `--____\"+\"*******\".colorize(:light_yellow).blink+\"******\".colorize(:light_red).blink+\"*****************************\".colorize(:red).blink+\"\n / ~~~--_____ ~~~/ \"+\"***\".colorize(:light_yellow).blink+\"******\".colorize(:light_red).blink+\"******************************\".colorize(:red).blink+\"\n `~~~~~ \"+\"*\".colorize(:light_yellow).blink+\"*********\".colorize(:light_red).blink+\"********************\".colorize(:red).blink+\"\n \"+\"**** *********\".colorize(:light_red).blink+\"*****\".colorize(:red).blink+\"\n \"+\"*** ********\".colorize(:light_red).blink+\"***\".colorize(:red).blink+\"\n \"+\"****\".colorize(:light_red).blink+\"****\".colorize(:red).blink+\"\n\n \".colorize(:red).blink\n puts \"The word was: #{@current_word}\".colorize(:magenta)\n end\n end", "title": "" }, { "docid": "a290091e28c182e4f3a7c8021c6fadbb", "score": "0.56667835", "text": "def render\n links.each_with_index do |link, index|\n if link.color\n output.puts(\"#{prefix}linkStyle #{index} stroke:#{link.color}\")\n end\n end\n\n output.string\n end", "title": "" }, { "docid": "6525d1ddcb75607ccad403137ca6ef31", "score": "0.5648347", "text": "def render_to_string(*args, &block); end", "title": "" }, { "docid": "da5c691a11db2c605c351d59b2fbd57c", "score": "0.56464595", "text": "def draw_text(data,x,y,r = 0,font_selection = 1,horizontal_multiplier = 1,vertical_multiplier = 1,reverse = false)\n data = data.gsub(\"'\", \"\\\\\\\\'\")\n data = sanitize(data)\n @output << \"A#{x},#{y},#{r},#{font_selection},#{horizontal_multiplier},#{vertical_multiplier},#{reverse ? 'R' : 'N'},\\\"#{data}\\\"\\n\" \n end", "title": "" }, { "docid": "3ff6b8c01aace5d9cfd1a01e7512feeb", "score": "0.5644675", "text": "def render_pack(pack, data)\n # string to build and return\n r = String.new\n\n height = 6\n\n pack -= 1 # start from 0\n x_offset = (pack * height) + 1 # start rendering from this line\n y_offset = 1\n\n analog = data['analog'][pack]\n alarm = data['alarm'][pack]\n ci = data['charge_info'][pack]\n\n soc = 100 * (analog['mah_remain'] / analog['mah_total'].to_f)\n stats = format('%.1fAh / %.1fAh (%d%% SOC) / ' \\\n '%.3fV @ %4.1fA = %3dW / %d cycles',\n analog['mah_remain'] / 1000.0,\n analog['mah_total'] / 1000.0,\n soc,\n analog['pack_voltage'],\n analog['current'],\n analog['pack_voltage'] * analog['current'],\n analog['pack_cycles'])\n\n r << TTY::Box.frame(top: x_offset - 1, left: 0,\n width: 80, height: height,\n style: { border: { fg: :bright_yellow } },\n title: { top_left: \"Pack #{pack + 1}\",\n top_right: stats })\n\n # min/max cell display, and mV difference between them\n max_v = analog['voltages'].max\n min_v = analog['voltages'].min\n r << CURSOR.move_to(y_offset + 21, x_offset + 3)\n r << format('(%.3fv - %.3fv dV: %2dmV)',\n min_v, max_v, (max_v * 1000) - (min_v * 1000))\n\n # render voltages as 3 lines with 5 voltages in each\n analog['voltages'].each_slice(5).each_with_index do |arr, idx|\n arr.each_with_index do |voltage, idx2|\n arr_offset = (idx * 5) + idx2\n r << CURSOR.move_to(y_offset + idx2 * 8, x_offset + idx)\n str = format('%.03fv', voltage)\n if max_v - min_v > 0.010 # 10mV\n str = PASTEL.bold.on_blue(str) if voltage == min_v\n str = PASTEL.bold.on_red(str) if voltage == max_v\n end\n r << case alarm['voltages'][arr_offset]\n when 0 then PASTEL.green(str)\n when 1 then PASTEL.clear.red(str)\n when 2 then PASTEL.clear.yellow(str)\n end\n end\n end\n\n analog['temps'].each_with_index do |temp, idx|\n r << CURSOR.move_to(y_offset + (idx * 4), x_offset + 3)\n str = format('%dC', temp)\n r << case alarm['temps'][idx]\n when 0 then PASTEL.green(str)\n when 1 then PASTEL.red(str)\n when 2 then PASTEL.yellow(str)\n end\n end\n\n # rest are just alarm booleans\n r << CURSOR.move_to(y_offset + 40, x_offset)\n str = 'CHG_CUR'\n r << case alarm['charge_current']\n when 0 then PASTEL.green(str)\n when 1 then PASTEL.red(str)\n when 2 then PASTEL.yellow(str)\n end\n\n r << CURSOR.move_to(y_offset + 40, x_offset + 1)\n str = 'DIS_CUR'\n r << case alarm['discharge_current']\n when 0 then PASTEL.green(str)\n when 1 then PASTEL.red(str)\n when 2 then PASTEL.yellow(str)\n end\n\n r << CURSOR.move_to(y_offset + 40, x_offset + 2)\n str = 'VOLTAGE'\n r << case alarm['pack_voltage']\n when 0 then PASTEL.green(str)\n when 1 then PASTEL.red(str)\n when 2 then PASTEL.yellow(str)\n end\n\n r << CURSOR.move_to(y_offset + 49, x_offset)\n # module under voltage\n r << red_if('UV', alarm['status1'] & 0x80 == 0x80)\n\n r << CURSOR.move_to(y_offset + 53, x_offset)\n # module over voltage\n r << red_if('OV', alarm['status1'] & 0x1 == 0x1)\n\n r << CURSOR.move_to(y_offset + 57, x_offset)\n # charge over current\n r << red_if('C_OC', alarm['status1'] & 0x4 == 0x4)\n\n r << CURSOR.move_to(y_offset + 57, x_offset + 1)\n # discharge over current\n r << red_if('D_OC', alarm['status1'] & 0x10 == 0x10)\n\n r << CURSOR.move_to(y_offset + 62, x_offset)\n # charge over temp\n r << red_if('C_OT', alarm['status1'] & 0x40 == 0x40)\n\n r << CURSOR.move_to(y_offset + 62, x_offset + 1)\n # discharge over temp\n r << red_if('D_OT', alarm['status1'] & 0x20 == 0x20)\n\n r << CURSOR.move_to(y_offset + 67, x_offset)\n # charge mosfet\n r << green_if('C_FET', alarm['status2'] & 0x2 == 0x2)\n\n r << CURSOR.move_to(y_offset + 74, x_offset)\n # charge enable\n r << green_if('C_EN', ci['charge_status'] & 0x80 == 0x80)\n\n r << CURSOR.move_to(y_offset + 49, x_offset + 1)\n # cell under voltage\n r << red_if('CELL_UV', alarm['status1'] & 0x2 == 0x2)\n\n r << CURSOR.move_to(y_offset + 67, x_offset + 1)\n # discharge mosfet\n r << green_if('D_FET', alarm['status2'] & 0x4 == 0x4)\n\n r << CURSOR.move_to(y_offset + 74, x_offset + 1)\n # discharge enable\n r << green_if('D_EN', ci['charge_status'] & 0x40 == 0x40)\n\n r << CURSOR.move_to(y_offset + 49, x_offset + 2)\n r << red_if('BUZ', alarm['status3'] & 0x1 == 0x1)\n\n r << CURSOR.move_to(y_offset + 55, x_offset + 2)\n # fully charged\n r << green_if('FULL', alarm['status3'] & 0x8 == 0x8)\n\n r << CURSOR.move_to(y_offset + 62, x_offset + 2)\n # using battery module power\n r << green_if('ONBAT', alarm['status2'] & 0x8 == 0x8)\n\n r << CURSOR.move_to(y_offset + 70, x_offset + 2)\n # effective discharge current\n r << green_if('EDC', alarm['status3'] & 0x40 == 0x40)\n\n r << CURSOR.move_to(y_offset + 75, x_offset + 2)\n # effective charge current\n r << green_if('ECC', alarm['status3'] & 0x80 == 0x80)\n\n r << CURSOR.move_to(y_offset + 49, x_offset + 3)\n # charge immediately (1); 5-9%\n r << red_if('CI1', ci['charge_status'] & 0x20 == 0x20)\n\n r << CURSOR.move_to(y_offset + 53, x_offset + 3)\n # charge immediately (2); 9-13%\n r << red_if('CI2', ci['charge_status'] & 0x10 == 0x10)\n\n r << CURSOR.move_to(y_offset + 58, x_offset + 3)\n # full charge request\n r << red_if('FCR', ci['charge_status'] & 0x8 == 0x8)\n\n r << CURSOR.move_to(y_offset + 63, x_offset + 3)\n r << red_if(format('S4: %03d', alarm['status4']),\n alarm['status4'].positive?)\n\n r << CURSOR.move_to(y_offset + 71, x_offset + 3)\n r << red_if(format('S5: %03d', alarm['status5']),\n alarm['status5'].positive?)\n\n r\nend", "title": "" }, { "docid": "8e1018055b0dd188437602a04ffa5699", "score": "0.56437397", "text": "def user_led\n write Request::GetRGB.new(@seq)\n end", "title": "" }, { "docid": "8e1018055b0dd188437602a04ffa5699", "score": "0.56437397", "text": "def user_led\n write Request::GetRGB.new(@seq)\n end", "title": "" }, { "docid": "d31b95aaca8171c1742592826646fc72", "score": "0.563843", "text": "def betabrite (text, color = 'amber', anim = 'rotate')\n bb = BetaBrite::Serial.new('/dev/ttyUSB0') do |sign|\n sign.stringfile('0') do\n print string(\"dummy\").green\n end\n \n sign.textfile do\n self.send(anim)\n print stringfile('0')\n print string(text.ascii).send(color).seven_stroke\n end\n end\n bb.write!\nend", "title": "" }, { "docid": "f8070534770a26429abc3922546abe4a", "score": "0.5637484", "text": "def render_colour\n \"#{colour}#{yield}\".freeze\n end", "title": "" }, { "docid": "8234774c049fb3bf6b7ed7f9278e9e3d", "score": "0.56374204", "text": "def render\n puts to_s\n end", "title": "" }, { "docid": "96d029e52138280e3abec59820a7c4e0", "score": "0.5635625", "text": "def render_text( health, goons )\n\t\tresult = FONT.render( \"HEALTH: #{health}\", true, STATUS_COLOR )\n\t\tresult.blit( @screen, [STATUS_HEALTH_X,STATUS_Y] )\n\t\t\n\t\tresult = FONT.render( \"BEES: #{goons}\", true, STATUS_COLOR )\n\t\tresult.blit( @screen, [STATUS_GOONS_X,STATUS_Y] )\n\tend", "title": "" }, { "docid": "f9fc03e7d17b46421a41a352956b5182", "score": "0.5634174", "text": "def normal(string)\n \"\\033[30m#{string}\\033[0m\"\nend", "title": "" }, { "docid": "e4e25feca2e0c490bee5aed297d0278a", "score": "0.56329715", "text": "def tell *msgs\n color_and_print :blue, *msgs\n end", "title": "" }, { "docid": "890a515b9885ebf4650f4fcc9a6155b9", "score": "0.5628878", "text": "def decorate_string(str, istruct)\n result = Rainbow(str)\n result = colorize(result, istruct.color, istruct.bgcolor)\n result = result.bold if istruct.bold\n result = result.italic if istruct.italic\n result = result.underline if istruct.underline\n result = result.blink if istruct.blink\n result\n end", "title": "" }, { "docid": "a827283421df52a310cfb58b6be62dba", "score": "0.5627939", "text": "def render #make it pretty, requires a little more code\n puts \"#{@board[0][0]}|#{@board[0][1]}|#{@board[0][2]}\"\n puts \"-\" * 5\n puts \"#{@board[1][0]}|#{@board[1][1]}|#{@board[1][2]}\"\n puts \"-\" * 5\n puts \"#{@board[2][0]}|#{@board[2][1]}|#{@board[2][2]}\"\n end", "title": "" }, { "docid": "657ea82df1ccd056f9ba5106b8dc2ea6", "score": "0.5619692", "text": "def display\n @color == :black ? \"⚫\" : \"⚪\"\n end", "title": "" }, { "docid": "944b2813826f8b2eff8215a1eafadb51", "score": "0.5618196", "text": "def bleu_gras\n \"\\033[1;96m#{self}\\033[0m\"\n end", "title": "" }, { "docid": "944b2813826f8b2eff8215a1eafadb51", "score": "0.5618196", "text": "def bleu_gras\n \"\\033[1;96m#{self}\\033[0m\"\n end", "title": "" }, { "docid": "944b2813826f8b2eff8215a1eafadb51", "score": "0.5618196", "text": "def bleu_gras\n \"\\033[1;96m#{self}\\033[0m\"\n end", "title": "" }, { "docid": "944b2813826f8b2eff8215a1eafadb51", "score": "0.5618196", "text": "def bleu_gras\n \"\\033[1;96m#{self}\\033[0m\"\n end", "title": "" }, { "docid": "eb58c2fddce303d0423c72fd0473d383", "score": "0.56171757", "text": "def render_plain; end", "title": "" }, { "docid": "d6ccb1d587ad7cc2f9f49e211e3f9f80", "score": "0.56156325", "text": "def render\n\n\t\tputs \"\"\n\n\t\[email protected] do | row |\n\n\t\t\trow.each { | col | print col }\n\t\t\tputs \"\"\n\n\t\tend\n\n\t\tprint \"-1234567-\"\n\n\t\tputs \"\"\n\n\tend", "title": "" }, { "docid": "cd4ea301f2828d9c0d40126844ba4d80", "score": "0.56053984", "text": "def render\n outputs.labels << [600, 620, 'Sadistic Self-Care Survival Game!', 5, 1]\n outputs.primitives << meters.map(&:render)\n outputs.primitives << [\n @task.render,\n { x: 340, y: 370, text: \"Money: $#{state.money}\", size_enum: 5, alignment_enum: align(:left) }.label,\n { x: 80, y: 90, text: state.granola_count }.label,\n @scene_button\n ]\n outputs.debug << [30, 30.from_top, \"#{args.inputs.mouse.point}\"].label\n \n # Sprites\n outputs.sprites << [\n [0, 0, 1280, 720, 'sprites/laptop.png'],\n @water_bottle,\n granola_bars,\n @store_icon\n ]\n end", "title": "" }, { "docid": "8c7c886171a0afabb6bb7c50c44aeaf1", "score": "0.560375", "text": "def color(type, str)\n text.send(Pry.config.ls.send(:\"#{type}_color\"), str)\n end", "title": "" }, { "docid": "a88626e33ee305777086e66dd86e8330", "score": "0.5600788", "text": "def render\n outputs.primitives << [\n { w: 1280, h: 720, r: 0, g: 0, b: 0}.solid,\n { x: 640, y: 460, text: 'You have died.', r: 255, g: 255, b: 255, size_enum: 5, alignment_enum: align(:center) }.label,\n { x: 640, y: 400, text: state.death_message, r: 255, g: 255, b: 255, size_enum: 5, alignment_enum: align(:center) }.label,\n { x: 640, y: 340, text: \"You made $#{state.money}, and survived #{state.time_of_death.fdiv(3600).to_sf} minutes.\", r: 255, g: 255, b: 255, size_enum: 5, alignment_enum: align(:center) }.label\n ]\n end", "title": "" }, { "docid": "133704df4460a72d87389ed181ce8c6d", "score": "0.5597639", "text": "def text_render_style!(style)\n @current_text_render_style = style\n end", "title": "" }, { "docid": "557e4767c702f5a15f3bcc19dc4c8bac", "score": "0.55961883", "text": "def render(string)\n @engine.render(string)\n end", "title": "" }, { "docid": "b21d4aaff7b2253b0af469d45b7f481a", "score": "0.55890626", "text": "def template\n if color\n Code::CYAN +\n \"%s: \" +\n Code::YELLOW +\n \"%s \" +\n Code::BLUE +\n \"|\" +\n Code::CLEAR +\n \"%s\" +\n Code::BLUE +\n \"|\" +\n Code::CLEAR\n else\n \"%s: %s |%s|\"\n end\n end", "title": "" }, { "docid": "159bc240e5cf5ed531841ac5f1ab3db2", "score": "0.55885386", "text": "def to_s\n if called == false\n return \"\\e[44m ~ \\e[0m|\"\n else\n if hit == true\n return \"\\e[41m X \\e[0m|\"\n else\n return \"\\e[36m O \\e[0m|\"\n end\n end\n end", "title": "" }, { "docid": "8e685a1c98ef21a8999231826eebb70f", "score": "0.55841804", "text": "def back_led_on()\n puts \"#{@sphero_name} -- back LED on\"\n @sphero.back_led_output=0xFF\n end", "title": "" }, { "docid": "25ce495f79156943e353ae34fd37f3b1", "score": "0.55726796", "text": "def colorize(txt)\n str = \"\"\n str << bold unless @@foreground == :black\n str << send(\"on_#{@@background}\") unless @@background == :white\n str << send(@@foreground)\n str << txt \n str << reset\n end", "title": "" }, { "docid": "0cbf29d1a22fa5df6061ebc9fc616545", "score": "0.5551873", "text": "def error(str)\n @draw_mutex.synchronize do\n @current_step.blank if @current_step\n print '--> '.red\n puts str\n @current_step.repaint if @current_step\n end\n end", "title": "" }, { "docid": "6d9924b85e989a89bab598623bb61bbe", "score": "0.55496705", "text": "def render_output(should_flood, start_line, text, color=:blue)\n if start_line\n text = Pry::Helpers::Text.with_line_numbers text, start_line, color\n end\n\n if should_flood\n output.puts text\n else\n stagger_output(text)\n end\n end", "title": "" }, { "docid": "e27c422463e4bd3f2a1bd5335e4937ad", "score": "0.55425864", "text": "def render\n Terminal.output(view, cursor)\n end", "title": "" }, { "docid": "86414fb8efaa7e4c8210d426cc4346c0", "score": "0.55370015", "text": "def conversion_character_rendering_test_method; end", "title": "" }, { "docid": "abeccf96cdd128818d3ddfba6ac70d0e", "score": "0.5531977", "text": "def draw_esper_state(esper, x, y, width = 100)\n if esper.recharged?\n change_color(power_up_color)\n text = Vocab.ready_dom\n else\n change_color(crisis_color)\n text = Vocab.rec_dom\n end\n draw_text(x, y, width, line_height, text)\n end", "title": "" }, { "docid": "e0ce7727ad8a9456d2c00f801ed216a6", "score": "0.55289775", "text": "def color_string value\n \"\\e[#{value}m\" + self + \"\\e[0m\"\n end", "title": "" }, { "docid": "b47e3474092133eb7ff96aad9bffd304", "score": "0.5526067", "text": "def render_string\n return value unless characteristic\n if characteristic.proc\n render_proc\n elsif characteristic.accessor\n use_accessor\n elsif characteristic.measurement\n defer_to_measurement\n elsif value.respond_to? :as_characteristic\n defer_to_value\n else\n render_value\n end\n end", "title": "" }, { "docid": "6c93783f62673e7d5109efc52bd9a672", "score": "0.5522576", "text": "def addlabelstr(s, drawactive, color1, color2, color3, color4)\n JTCur.attrset(drawactive ? color2 : color1)\n sa = s.split \"_\"\n addstr sa.shift\n while sae = sa.shift\n if sae == \"\"\n addchar(?_.ord | (drawactive ? color2 : color1))\n JTCur.attrset drawactive ? color2 : color1\n addstr sa.shift\n else\n JTCur.attrset drawactive ? color4 : color3\n addchar(sae[0].ord) if sae[0]\n JTCur.attrset drawactive ? color2 : color1\n addstr sae[1..-1]\n end\n end\n end", "title": "" }, { "docid": "255988d088e6763644b33c4b1031a445", "score": "0.5517302", "text": "def render dc ; end", "title": "" }, { "docid": "6da6804d9589d9e15be5cfa9e9382fc8", "score": "0.550877", "text": "def oraclethinking\n msg = \"The oracle is thinking\"\n 6.times do\n print ColorizedString[\"\\r#{ msg}\"].blue\n sleep 0.5\n print \"\\r#{ ' ' * msg.size }\" # Send return and however many spaces are needed.\n sleep 0.5\n end\nend", "title": "" }, { "docid": "58cb081636c39e49d233d053c8c6280e", "score": "0.55086255", "text": "def power_down_color\n return text_color(25)\n end", "title": "" }, { "docid": "ad4263215cf425260fbbf7575075e318", "score": "0.550561", "text": "def red(msg)\n \"\\033[0;31m#{msg}\\033[0;37m\"\nend", "title": "" }, { "docid": "ad4263215cf425260fbbf7575075e318", "score": "0.550561", "text": "def red(msg)\n \"\\033[0;31m#{msg}\\033[0;37m\"\nend", "title": "" }, { "docid": "9b1babb87d24e04eb4a752a81cf32e5a", "score": "0.5503395", "text": "def text_notify(text); text_light_grey(text);end", "title": "" }, { "docid": "c38be2a3fb7a9237bfa91c1febcc2355", "score": "0.5499751", "text": "def ahh_fresh_paint\n paint_msg = \"The new #{color} color was a good choice\"\n end", "title": "" }, { "docid": "8afc581d3c01822f9f7a971734d0d6ea", "score": "0.54985386", "text": "def make_red(str)\n \"\\033[41m\" + str + \"\\033[0m\"\nend", "title": "" }, { "docid": "c855a215808b6525b6b5d5abd1c31059", "score": "0.54974145", "text": "def bleu\n \"\\033[0;96m#{self}\\033[0m\"\n # 96=bleu clair, 93 = jaune, 94/95=mauve, 92=vert\n end", "title": "" }, { "docid": "c855a215808b6525b6b5d5abd1c31059", "score": "0.54974145", "text": "def bleu\n \"\\033[0;96m#{self}\\033[0m\"\n # 96=bleu clair, 93 = jaune, 94/95=mauve, 92=vert\n end", "title": "" }, { "docid": "c855a215808b6525b6b5d5abd1c31059", "score": "0.54974145", "text": "def bleu\n \"\\033[0;96m#{self}\\033[0m\"\n # 96=bleu clair, 93 = jaune, 94/95=mauve, 92=vert\n end", "title": "" }, { "docid": "c855a215808b6525b6b5d5abd1c31059", "score": "0.54974145", "text": "def bleu\n \"\\033[0;96m#{self}\\033[0m\"\n # 96=bleu clair, 93 = jaune, 94/95=mauve, 92=vert\n end", "title": "" }, { "docid": "98f4f018ce9d6b2d53ec2c0334eb9c6d", "score": "0.54968727", "text": "def draw_item(index)\n if index < @switch_max\n n = index * 10\n text = sprintf(\"S [%04d-%04d]\", n+1, n+10)\n else\n n = (index - @switch_max) * 10\n text = sprintf(\"V [%04d-%04d]\", n+1, n+10)\n end\n rect = item_rect(index)\n rect.x += 4\n rect.width -= 8\n self.contents.clear_rect(rect)\n self.contents.draw_text(rect, text)\n end", "title": "" }, { "docid": "521bf8d62fe309521a8a36ec8abee517", "score": "0.5496633", "text": "def rainbowify(string)\n c = colors[color_index % colors.size]\n self.color_index += 1\n \"#{ESC}38;5;#{c}m#{string}#{NND}\"\n end", "title": "" }, { "docid": "1bcd5c1460dd1a9e31757482e8e25257", "score": "0.5492997", "text": "def draw_equip\n change_color(system_color)\n draw_text(0, 0, 120, line_height, Vocab::etype(@etype_id))\n end", "title": "" }, { "docid": "25dc24b4d240ca5639e05f884912395f", "score": "0.54884773", "text": "def render\n return if done?\n\n if @hide_cursor && !spinning?\n write(TTY::Cursor.hide)\n end\n\n data = message.gsub(MATCHER, @frames[@current])\n data = replace_tokens(data)\n write(data, true)\n end", "title": "" }, { "docid": "9df788f011b35208ce8334bd63ce0b29", "score": "0.5485765", "text": "def red(string)\n ::Nucleon::Util::Console.red(string)\n end", "title": "" }, { "docid": "f1e84c31f0dd6e7956cf0c41a6c423e7", "score": "0.5483371", "text": "def render\n sb = StringIO.new\n append_to_string_builder(sb)\n sb.string\n end", "title": "" }, { "docid": "25d8a3e8d5f706a9c8c305e14101ddea", "score": "0.54794097", "text": "def single_character_display\n SINGLE_CHARACTER.color(:red).bright\n end", "title": "" } ]
4fdf7e179e8794f001693dbbcad58d0d
Return true if request is valid. def is_valid_request?
[ { "docid": "46a177c32232dbe935934a06cefa6511", "score": "0.0", "text": "def items\n unless @items\n @items = (@doc/\"product\").collect {|item| Element.new(item)}\n end\n @items\n end", "title": "" } ]
[ { "docid": "ab4339bbd5199eda59338279d012e20f", "score": "0.93123084", "text": "def valid_request?\n true\n end", "title": "" }, { "docid": "abdc40894375c619deea034e57181500", "score": "0.87378854", "text": "def valid_request?\n \n end", "title": "" }, { "docid": "375cfa8ca25e134f56f431238c5c20e9", "score": "0.8599277", "text": "def validrequest?(req)\n Log.error(\"validrequest? is not implemented in #{self.class}\")\n end", "title": "" }, { "docid": "7c8ac0b45e0c8419d666f566d333cf48", "score": "0.85257185", "text": "def valid?\n return false if @request_id.nil?\n true\n end", "title": "" }, { "docid": "78580c78a982c3f11020181de6f6e675", "score": "0.83949715", "text": "def validrequest?(req)\n @stats.validated\n return true\n end", "title": "" }, { "docid": "426320fcee8dfb2d3959cc7a5ec1dafc", "score": "0.8318437", "text": "def is_valid_request?\n Element.get(@doc, \"//IsValid\") == \"True\"\n end", "title": "" }, { "docid": "bc0c96004bbf5babd82dec0b316f9673", "score": "0.83126956", "text": "def is_valid_request?\n Element.get(@doc, \"//IsValid\") == \"True\"\n end", "title": "" }, { "docid": "469f8c7e8195a65060b3ae11527e0743", "score": "0.8287392", "text": "def valid?(request)\n begin\n valid!(request)\n rescue AlexaVerifier::BaseError => e\n puts e\n\n return false\n end\n\n true\n end", "title": "" }, { "docid": "5fea7b2f89af790acc02c11c96cf0b51", "score": "0.81745595", "text": "def valid_request!(request)\n valid_request?(request, false)\n end", "title": "" }, { "docid": "e9f9dfa961548f760733396368fb4626", "score": "0.8142277", "text": "def valid?\n [email protected]?\n end", "title": "" }, { "docid": "34773e6ef2065d9864a9959c2ed54ff6", "score": "0.8120535", "text": "def valid_params_request?\n true\n end", "title": "" }, { "docid": "36acf84ff33f1c968d60c88136671f94", "score": "0.812027", "text": "def is_valid_req(request)\n is_valid = true\n if request.put? or request.delete? or request.head? or request.params.empty?\n is_valid = false\n end\n is_valid\n end", "title": "" }, { "docid": "c4c3ca09f6d8fef982f4b01b9f47ee66", "score": "0.8085777", "text": "def is_valid_request?\n (@doc/\"isvalid\").inner_html == \"True\"\n end", "title": "" }, { "docid": "1b8da14f7a37d6421a19ab11d6a3d37b", "score": "0.8083892", "text": "def malformed_request?\n false\n end", "title": "" }, { "docid": "840975e37c79c95a080eae02a465abcf", "score": "0.803352", "text": "def valid_auth_request?\n @valid ||= auth_request.valid?(opts)\n end", "title": "" }, { "docid": "00a542842862d2b3e9301700aac7d0f3", "score": "0.79620236", "text": "def request_valid?( request )\n # Request must contain status update, mac address, sensor type\n #TODO ONLY WORKS FOR DOOR SENSOR RIGHT NOW\n required_keys = [\"mac\", \"status\", \"battery\", \"type\"]\n required_keys.each do |key|\n if !request.has_key?(key)\n return false\n end\n end\n return true\n end", "title": "" }, { "docid": "d46d9522d5b25a321f31d6e9bcd63c36", "score": "0.79043245", "text": "def valid_request?\n # 400 - Error with input\n # 403 - Key related error\n # 500 -Unknown error\n # Check http://www.mapquestapi.com/geocoding/status_codes.html for more details\n invalid_requests = [400, 403, 500]\n if invalid_requests.include? status[:code]\n if status[:code] === 500\n raise InvalidRequest\n end\n @valid = false\n else\n @valid = true\n end\n end", "title": "" }, { "docid": "9df80f9c76cf9c6182e81a6f787841ee", "score": "0.7789325", "text": "def invalid_request?\n return false unless response_error\n response_error['code'] == 400\n end", "title": "" }, { "docid": "0e7b0bef3c295fe22a8e5dd78b449d19", "score": "0.7776091", "text": "def invalid_request?\n @req[:user].nil? || @req[:surface].nil? || @req[:conversation].nil? ||\n @req[:inputs].nil?\n end", "title": "" }, { "docid": "d34d9ae458f32cd1d98c90c2adb04496", "score": "0.77448064", "text": "def malformed_request?\n request.get? && validation_errors_for_schema?(schema, request.query)\n end", "title": "" }, { "docid": "aae230be7157b3b83ce3f3b50a3008e8", "score": "0.77292466", "text": "def validrequest?(req)\n digest = makehash(req[:body])\n\n if digest == req[:hash]\n @stats.validated\n\n return true\n else\n @stats.unvalidated\n\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end\n end", "title": "" }, { "docid": "f9b9213478bb7fb34009f4dcde46b5d3", "score": "0.7723335", "text": "def valid?\n return false unless @req_id\n return false unless @msg_id\n return false unless @argv\n return true\n end", "title": "" }, { "docid": "f9b9213478bb7fb34009f4dcde46b5d3", "score": "0.7723335", "text": "def valid?\n return false unless @req_id\n return false unless @msg_id\n return false unless @argv\n return true\n end", "title": "" }, { "docid": "ae0d2b43d78720a92d3abfc86acc233b", "score": "0.7691806", "text": "def valid?\n return false if @assertions.nil?\n return false if @name.nil?\n return false if @request.nil?\n return false if @subtype.nil?\n true\n end", "title": "" }, { "docid": "2cf51a084911b793daf29c4f08968cdc", "score": "0.7686332", "text": "def valid?\n !request(\"validate\").exec_sync(:get).error?\n end", "title": "" }, { "docid": "396e7d67c9f1e163962c4aa38a266d6e", "score": "0.76188624", "text": "def request?\n true\n end", "title": "" }, { "docid": "225a70028a3a080e582aa83329f64f35", "score": "0.75963634", "text": "def valid?(request)\n (self.keyword.eql? request.keyword) &&\n action_defined(request.action)\n end", "title": "" }, { "docid": "c9403adbac4f3bd11c0e6f50021a422d", "score": "0.7595968", "text": "def incoming_request_valid?( request )\n request.has_key?( \"CONTENT_TYPE\" )\n end", "title": "" }, { "docid": "c9403adbac4f3bd11c0e6f50021a422d", "score": "0.7595968", "text": "def incoming_request_valid?( request )\n request.has_key?( \"CONTENT_TYPE\" )\n end", "title": "" }, { "docid": "784babf163a528d3b2bba1ad5407eeca", "score": "0.7594293", "text": "def valid_empty_request?\n request.content_type.nil? && (request.get? || request.delete? || request.head?)\n end", "title": "" }, { "docid": "5e6f618e4485e3a01142b62a64bedc7d", "score": "0.7574996", "text": "def valid_request_method?(request_method)\n @log.debug \"Validating request method: #{request_method}\"\n unless VALID_REQUEST.include?(request_method)\n return invalid(\"Invalid request method: #{request_method}\")\n end\n @log.debug \"Request method is valid\"\n return true\n end", "title": "" }, { "docid": "65195f7aceace6801431dbc07f3c4fe1", "score": "0.75579864", "text": "def valid_request?\n unless timestamp_tolerant?\n raise ArgumentError,\n 'Outdated request: request timestamp is more than ' \\\n \"#{@timestamp_diff} seconds later than current time\"\n end\n valid_uri? && valid_certificates?\n end", "title": "" }, { "docid": "7f9f7b8e6ac182d24e85e914b9ac12b0", "score": "0.75526565", "text": "def valid_request?\n # false\n params[:controller] =~ /^api/\n # params[:controller] == \"photos\" && params[:action] == \"create\"\n end", "title": "" }, { "docid": "b59db002897d657336b8dd807dc82975", "score": "0.7532601", "text": "def valid?\n valid_user?(request.headers)\n end", "title": "" }, { "docid": "b59db002897d657336b8dd807dc82975", "score": "0.7532601", "text": "def valid?\n valid_user?(request.headers)\n end", "title": "" }, { "docid": "ddbb019a4caedb5a7929c0b3de5448e5", "score": "0.7527171", "text": "def validate_request\n true # can be overridden in subclasses\n end", "title": "" }, { "docid": "aecca82d7d657db33ee7a568774b5325", "score": "0.7506061", "text": "def request?\n !request.nil?\n end", "title": "" }, { "docid": "aecca82d7d657db33ee7a568774b5325", "score": "0.7506061", "text": "def request?\n !request.nil?\n end", "title": "" }, { "docid": "0603788893966e5d6e0257e1852c0f7b", "score": "0.74603206", "text": "def valid?\n self.errors.size == 0 && self.raw_response.code < 400\n end", "title": "" }, { "docid": "a16aa4773c4ebe1408f43989d9b247a6", "score": "0.7452457", "text": "def valid?\n response_code == 'Valid'\n end", "title": "" }, { "docid": "0dd0a6a0a95e595a650d63b110486d74", "score": "0.7447501", "text": "def request_valid?\n # Invalid request format TODO refactor this to allow whitelist of formats\n return render_error_status(404, \"Invalid Shortcut Request Format: '#{request.format}'\") if request.format.blank?\n return true\n end", "title": "" }, { "docid": "3e343e8eadec51f6dc8cc0b432269133", "score": "0.7434979", "text": "def valid?\n !base_url.nil? && !api_key.nil?\n end", "title": "" }, { "docid": "3e343e8eadec51f6dc8cc0b432269133", "score": "0.7434979", "text": "def valid?\n !base_url.nil? && !api_key.nil?\n end", "title": "" }, { "docid": "0ec0db76c6dd1f6f95c8b5bf04c96417", "score": "0.7426642", "text": "def is_requestable?\n if self.defunct?\n return false\n end\n if self.not_apply?\n return false\n end\n if self.request_email.nil?\n return false\n end\n return !self.request_email.empty? && self.request_email != 'blank'\n end", "title": "" }, { "docid": "5b066cf4e0eb36a48620f548d14cd17a", "score": "0.7403597", "text": "def valid?\r\n signature == request.parameters[:signature]\r\n end", "title": "" }, { "docid": "92e00513f554a441a2f8c029c73cf9a8", "score": "0.7353534", "text": "def valid?\n auth_initialized = request.env['msf.auth_initialized']\n authorization = request.env[AUTHORIZATION]\n !auth_initialized || (authorization.is_a?(String) && authorization.start_with?(AUTHORIZATION_SCHEME)) || !params[TOKEN_QUERY_PARAM].nil?\n end", "title": "" }, { "docid": "227fbe715e90cea98899264ab2be9dfb", "score": "0.73502374", "text": "def valid?\n !empty_response? && !response_body.frozen? && response_not_a_file? &&\n status == 200 && can_handle_response?\n end", "title": "" }, { "docid": "02abc974c383f83612b8278cc2f856e1", "score": "0.7326126", "text": "def failed_or_invalid?\n invalid_request? || failed_request?\n end", "title": "" }, { "docid": "02abc974c383f83612b8278cc2f856e1", "score": "0.7326126", "text": "def failed_or_invalid?\n invalid_request? || failed_request?\n end", "title": "" }, { "docid": "a2d8bc433bcc1434280ffcbb923cc268", "score": "0.7315985", "text": "def request?\n true\n end", "title": "" }, { "docid": "53659a64b93bfd94e90f757ca0eb4885", "score": "0.7288569", "text": "def validrequest?(req)\n message = req[:body]\n\n Log.debug(\"Validating request from #{req[:callerid]}\")\n\n cert = verify(req[:cert], req[:sig], message.to_s)\n\n # if signature doesn't check out, fail\n if cert == false\n @stats.unvalidated\n raise(SecurityValidationFailed,\n \"Received an invalid signature in message, claimed #{req[:callerid]}\")\n else\n\n # if no callerid, assume valid (responses are like this)\n if req[:callerid].nil?\n @stats.validated\n return true\n end\n\n # if a callerid is claimed, check it against the certificate\n if cert.subject.to_s == req[:callerid]\n @stats.validated\n return true\n else\n @stats.unvalidated\n raise(SecurityValidationFailed,\n \"Received incorrect callerid, claimed #{req[:callerid]}, was #{cert.subject}\")\n end\n end\n end", "title": "" }, { "docid": "2bac8c35b7ebc8f5ea3468bfff4d57f8", "score": "0.7277264", "text": "def valid?\n not @url.nil?\n end", "title": "" }, { "docid": "c0b83139690d7033142cb13e408e3ba8", "score": "0.72757155", "text": "def valid_for_requests?\n return true if plan.routes.none?\n constraints.any?\n end", "title": "" }, { "docid": "71590a02aff16adaefda0cfc82c90dbe", "score": "0.72684056", "text": "def valid?\n \n if @action_url.nil?\n false\n elsif @call_connect_url.nil?\n false\n elsif @calling_number.nil?\n false\n elsif @destination.nil?\n false\n elsif @if_machine.nil?\n false\n elsif @if_machine_url.nil?\n false\n elsif @send_digits.nil?\n false\n elsif @status_callback_url.nil?\n false\n elsif @timeout.nil?\n false\n elsif @privacy_mode.nil?\n false\n else\n list_invalid_properties.length() == 0\n end\n end", "title": "" }, { "docid": "6c3730e523282ef160cd6749914256b6", "score": "0.7264702", "text": "def valid?\n @status == 200\n end", "title": "" }, { "docid": "9ff7119e40f591fd6e00714a3170e6f5", "score": "0.7261829", "text": "def signature_valid?\n Twilio::Security::RequestValidator.new(\n Figaro.env.twilio_auth_token,\n ).validate(url, params, signature)\n end", "title": "" }, { "docid": "ca55b746edd2c006757bb0e7bf3505e1", "score": "0.72521853", "text": "def valid?\n if @uri.nil? || @query_data.nil?\n return false\n end\n true\n end", "title": "" }, { "docid": "58618a737653b278d10bc181ce5c7bad", "score": "0.7228771", "text": "def valid?\n @url.match?(UrlRegex.get(mode: :validation))\n end", "title": "" }, { "docid": "7b1d4cadbb9796724d63f4b74a07f748", "score": "0.7216402", "text": "def valid?\n HDIUtil.validate @url\n end", "title": "" }, { "docid": "bf01fde7cf34f7ea5ee7d490c7fc85ec", "score": "0.72154593", "text": "def valid?\n response = validate\n !!response.is_valid\n end", "title": "" }, { "docid": "2b92b6abf5fe4f2cdbf337b30fcf338f", "score": "0.7214701", "text": "def form_request?\n\t\tcase self.request_method\n\t\twhen 'GET', 'HEAD', 'DELETE', 'PUT'\n\t\t\treturn (!self.parsed_uri.query.nil? || \n\t\t\t\tself.request_content_type =~ FORM_CONTENT_TYPES) ? true : false\n\n\t\twhen 'POST'\n\t\t\treturn self.request_content_type =~ FORM_CONTENT_TYPES ? true : false\n\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "155e5dcb20be5eaf46aa3ca7e02ae59f", "score": "0.71965903", "text": "def valid?\n return false if @body_type.nil?\n return false if @sensitivity.nil?\n return false if @discriminator.nil?\n return false if @client_submit_time.nil?\n return false if @delivery_time.nil?\n return false if @message_format.nil?\n return false if @read_receipt_requested.nil?\n true\n end", "title": "" }, { "docid": "73cfd9c8f9700fe64216a87c8210484d", "score": "0.7187971", "text": "def well_formed?\n valid_line_definitions? && valid_request_class?\n end", "title": "" }, { "docid": "ba29dbc57b89cc63317afd96a0dc2ff4", "score": "0.7185373", "text": "def request?\n code == CODES['Request']\n end", "title": "" }, { "docid": "be97f835a8d0620ebe93e4b37d925b84", "score": "0.7182545", "text": "def request?\n false\n end", "title": "" }, { "docid": "5c3c27300a9e757aac62e665c4bad707", "score": "0.71818095", "text": "def isValidRequest(data)\n\t\tnonOptionalParameters = ['cvr', 'name', 'address', 'city', 'country']\n\t\tmissingKeys = []\n\n\t\tnonOptionalParameters.each do |key|\n\t\t\tif !data.key?(key)\n\t\t\t\tmissingKeys << key\n\t\t\tend\n\t\tend\n\n\t\tif !missingKeys.empty?\n\t\t\tstatus 400\n\t\t\tbody 'Bad request. Missing keys: ' << missingKeys.join(',')\n\t\t\treturn false\n\t\tend\n\t\treturn true\n\tend", "title": "" }, { "docid": "6e24726d716969b8ae215c5f9065c63c", "score": "0.7169176", "text": "def valid?\n\t\t\treturn true unless content_type.empty? && content_transfer_encoding.empty? && content_location.empty?\n\t\t\tfalse\n\t\tend", "title": "" }, { "docid": "d2ada3ca8c79133515063dc486bb243b", "score": "0.71506333", "text": "def valid_request_class?\n request_class.ancestors.include?(RequestLogAnalyzer::Request)\n end", "title": "" }, { "docid": "9b75fc6cf48c5b0a652af873e310d5f5", "score": "0.7130165", "text": "def validate_request\n unless params['query'].present?\n self.status_code = 400\n self.error_message = 'Query not present'\n return false\n end\n\n unless parsed_query.present?\n self.parsed_query['query-0'] = \"TX:*\"\n end\n\n if params['filters'].present?\n # only one set of filters alowed\n if !params['filters'].one?\n self.status_code = 400\n self.error_message = \"Only one set of filters alowed.\"\n return false\n end\n\n filters = params['filters'].first['facets']\n\n filters.map! do |f|\n # Check if given keys match required FILTER_KEYS\n if (FILTER_KEYS - f.keys).present?\n self.status_code = 400\n self.error_message = \"Required filter keys are: #{FILTER_KEYS.to_sentence}\"\n return false\n end\n f\n end\n end\n\n self.requested_filters = filters || []\n return true\n end", "title": "" }, { "docid": "3cf10973c3e8cf5c5c809bcb1688271c", "score": "0.7128452", "text": "def valid?\n return false if @user_id.nil?\n return false if @webhook_id.nil?\n return false if @webhook_url.nil?\n return false if @message_id.nil?\n return false if @http_method.nil?\n http_method_validator = EnumAttributeValidator.new('String', [\"GET\", \"HEAD\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"OPTIONS\", \"TRACE\"])\n return false unless http_method_validator.valid?(@http_method)\n return false if @webhook_event.nil?\n webhook_event_validator = EnumAttributeValidator.new('String', [\"EMAIL_RECEIVED\", \"NEW_EMAIL\", \"NEW_CONTACT\", \"NEW_ATTACHMENT\", \"EMAIL_OPENED\", \"EMAIL_READ\", \"DELIVERY_STATUS\", \"BOUNCE\", \"BOUNCE_RECIPIENT\", \"NEW_SMS\"])\n return false unless webhook_event_validator.valid?(@webhook_event)\n return false if @response_time_millis.nil?\n result_type_validator = EnumAttributeValidator.new('String', [\"BAD_RESPONSE\", \"EXCEPTION\", \"SUCCESS\"])\n return false unless result_type_validator.valid?(@result_type)\n return false if @created_at.nil?\n return false if @updated_at.nil?\n return false if @seen.nil?\n true\n end", "title": "" }, { "docid": "2456a501a77009d90335bcc543e8a204", "score": "0.71204734", "text": "def valid_params_request?\n session.has_key?(authentication_keys.first)\n end", "title": "" }, { "docid": "29fa118567da7d9dec4b8b9a5c77fead", "score": "0.71098155", "text": "def signature_valid? request\n # Wrap the request with our class that provides the \"headers\" method.\n request = RequestWithHeaders.new request\n\n # Validate the request signature.\n slack_request = Slack::Events::Request.new request,\n signing_secret: @signing_secret\n slack_request.valid?\n end", "title": "" }, { "docid": "43f84092fe71431f9511e1940c34ca82", "score": "0.710834", "text": "def request?\n @bytes[2] == Message::REQUEST\n end", "title": "" }, { "docid": "cb3bc4fc5f93035b76d71c10e9d63041", "score": "0.7104929", "text": "def valid?\n return false if @_end.nil?\n return false if @level.nil?\n return false if @name.nil?\n return false if @partial_retry.nil?\n return false if !@queue_time.nil? && @queue_time < 0\n return false if @start.nil?\n return false if @status.nil?\n return false if @unique_id.nil?\n return false if @url.nil?\n true\n end", "title": "" }, { "docid": "8770dfa6784469dd38bdeacf10a15fd2", "score": "0.7097585", "text": "def valid?\n code == 200\n end", "title": "" }, { "docid": "0cf182bb2875c9768458d3608b0085d1", "score": "0.70916194", "text": "def allowed_request?\n true\n end", "title": "" }, { "docid": "80d5503c753030f66d4faa8efc4ef617", "score": "0.7085076", "text": "def request?\n !RequestInterceptor.request.nil?\n end", "title": "" }, { "docid": "efcf66fb46231acb2c0695e64d484fbd", "score": "0.7072559", "text": "def is_valid?\n return true\n end", "title": "" }, { "docid": "2a94ab3301e3b1fc1b3a857c8fbecf3e", "score": "0.7071562", "text": "def valid?\n return false if @application_id.nil?\n return false if @client_token.nil?\n return false if @created_at.nil?\n return false if @created_by_handle.nil?\n return false if @name.nil?\n return false if @org_id.nil?\n return false if @org_id > 2147483647\n return false if @type.nil?\n return false if @updated_at.nil?\n return false if @updated_by_handle.nil?\n true\n end", "title": "" }, { "docid": "8ca576a457ac06892c912996746738ed", "score": "0.707032", "text": "def verified_request?\n if (!request.format.nil? && request.format.json?) || request.content_type == \"application/json\"\n true\n else\n super\n end\n end", "title": "" }, { "docid": "b663fb4645d45923ddadadf0401814d5", "score": "0.7067145", "text": "def is_valid?\n return false unless @raw.is_a?(String) and @raw.length > 0\n return false unless @sender.is_a?(String) and @sender.length > 0\n return false unless @action.is_a?(String) and @action.length > 0\n return false unless @arguments.is_a?(Array)\n\n return true\n end", "title": "" }, { "docid": "19725cea4a05f8e0779e6aeed3a6272d", "score": "0.70667344", "text": "def valid?\n return false if @id.nil?\n return false if @domain.nil?\n return false if @is_resolving.nil?\n return false if @is_used_for_blog_post.nil?\n return false if @is_used_for_site_page.nil?\n return false if @is_used_for_landing_page.nil?\n return false if @is_used_for_email.nil?\n return false if @is_used_for_knowledge.nil?\n true\n end", "title": "" }, { "docid": "cfba4d5bdc89f263b3bb6cfda6438151", "score": "0.70522", "text": "def valid?\n # TODO\n true\n end", "title": "" }, { "docid": "df3a382435ae2f31d9a306c98324a283", "score": "0.70465934", "text": "def valid?\n response = validate\n response[:is_valid]\n end", "title": "" }, { "docid": "fb840d01b8fcc2f197a42aefaef13ad5", "score": "0.7043104", "text": "def valid?\n return false if !@_type.nil? && @_type.to_s.length < 1\n return false if @name.nil?\n return false if @name.to_s.length < 1\n return false if @url.nil?\n return false if @url.to_s.length < 1\n return false if !@ssl_ca_certificate.nil? && @ssl_ca_certificate.to_s.length < 1\n return false if !@ssl_client_certificate.nil? && @ssl_client_certificate.to_s.length < 1\n return false if !@ssl_client_key.nil? && @ssl_client_key.to_s.length < 1\n return false if !@proxy_url.nil? && @proxy_url.to_s.length < 1\n return false if [email protected]? && @username.to_s.length < 1\n return false if [email protected]? && @password.to_s.length < 1\n return false if !@download_concurrency.nil? && @download_concurrency < 1\n policy_validator = EnumAttributeValidator.new('String', [\"immediate\", \"on_demand\", \"streamed\"])\n return false unless policy_validator.valid?(@policy)\n return false if @upstream_name.nil?\n return false if @upstream_name.to_s.length < 1\n return false if !@whitelist_tags.nil? && @whitelist_tags.to_s.length < 1\n true\n end", "title": "" }, { "docid": "82246efab38e5219e00509e73d7ac9c1", "score": "0.7041194", "text": "def is_valid?\n if true\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "efe7fd903c2bbc159c34aef005971e13", "score": "0.7040008", "text": "def malformed_request?\n from_json\n @error = true if @coffee.nil?\n @coffee.nil?\n end", "title": "" }, { "docid": "fdb4be4c79b8af2fa470114e10ac81d9", "score": "0.703409", "text": "def valid?\n ![status, headers, body].any? { |item| item.equal?(Undefined) }\n end", "title": "" }, { "docid": "c55a2da16829f15c047b352e149666d1", "score": "0.7020656", "text": "def valid?\n @response = gvive_request(passport_endpoint, id_params({ pid: @id }))\n @data = @response.to_o\n @response.success?\n end", "title": "" }, { "docid": "db9421d8deaaf0638665e4d821b9bca5", "score": "0.7011907", "text": "def bad_request?\n status == 400\n end", "title": "" }, { "docid": "8e4801fed91d714b512dfee7daafe461", "score": "0.7004837", "text": "def validate_request_signature\n # Sometimes we don't want to check request signature and trust it (e.g. in test mode)\n return true unless Rails.configuration.x.perform_request_signature_validation\n received_signature = request.headers['signature']\n app_name = request.headers['app-name']\n expected_signature = begin\n RequestSignatureCalculator.(request, app_name)\n rescue ActiveRecord::RecordNotFound\n raise InvalidRequestSignature\n end\n\n raise InvalidRequestSignature if received_signature != expected_signature\n true\n end", "title": "" }, { "docid": "6b97b92a1b47b8855e7da906fd86e80d", "score": "0.6993118", "text": "def valid_for?(request)\n request.uri == @request_uri and \n @request_vary_headers.all? {|key, value| \n request.header[key] == value\n }\n end", "title": "" }, { "docid": "bd8953f51849d5d2e9fa98a79a724a6e", "score": "0.6982654", "text": "def valid?\n !!body\n end", "title": "" }, { "docid": "8de51c4c2048e05c2aeb1c3bd9a92eb8", "score": "0.6978885", "text": "def invalid_request?\n EXTERNAL_RESPONSE_CODES[:invalid_request] == @code\n end", "title": "" }, { "docid": "8de51c4c2048e05c2aeb1c3bd9a92eb8", "score": "0.6978885", "text": "def invalid_request?\n EXTERNAL_RESPONSE_CODES[:invalid_request] == @code\n end", "title": "" }, { "docid": "37aa92a00ffa7a8cc3b6e814d640ddcd", "score": "0.6967412", "text": "def check_params\n begin\n return false unless params['RequestNumber'] && params['SequenceNumber'] && params['RequestType'] &&\n params['DateTimes']['ResponseDueDateTime'] && params['Excavator']['CompanyName'] &&\n params['ServiceArea']['PrimaryServiceAreaCode']['SACode'] &&\n params['ServiceArea']['AdditionalServiceAreaCodes']['SACode'] &&\n params['Excavator']['CrewOnsite'] &&\n # for preventing ActionController::UnfilteredParameters:\n # unable to convert unpermitted parameters to hash\n params['ExcavationInfo']['DigsiteInfo']['WellKnownText'].present? &&\n params['Excavator']['Address'].present? &&\n params['Excavator']['State'].present? &&\n params['Excavator']['City'].present? &&\n params['Excavator']['Zip'].present?\n rescue NoMethodError, TypeError\n return false\n end\n true\n end", "title": "" }, { "docid": "0f898862f0ada034e606d77f3fc1271f", "score": "0.6952521", "text": "def valid?\n return false unless protocol_version && username && id && version &&\n network_type && address_type && unicast_address && name &&\n start_time && stop_time && !media_sections.empty?\n\n true\n end", "title": "" }, { "docid": "c717a6ea0df76ae7952659e48edafa75", "score": "0.69515306", "text": "def valid?\n all_requried_types_present?\n end", "title": "" }, { "docid": "51bad88ecfe8e5c04a70b2e668fbe3c5", "score": "0.6944104", "text": "def unvalidRequest? msg, response\n unless (msg =~ /.+={.*}/) == 0\n Log::Client.error \"Unvalid request : bad body\"\n response.status = Constant::UnvalidRequest\n return true\n end\n false\n end", "title": "" }, { "docid": "cc328c8a0f99f1b760133b409e381629", "score": "0.69391835", "text": "def valid?\n [:api_key, :host, :port].all? do |key|\n !__send__(key).nil?\n end\n end", "title": "" }, { "docid": "a513f4bca31d310c144776e9ea441562", "score": "0.6939053", "text": "def valid_signature?\n signature == request_signature\n end", "title": "" } ]
eee621497b66a04cc71ec3926f174c77
Read a service Read a service
[ { "docid": "b12e10feb7dbb4b6eba87340d9113d30", "score": "0.0", "text": "def read_service_for_tenant_with_http_info(service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PolicyApi.read_service_for_tenant ...\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling PolicyApi.read_service_for_tenant\"\n end\n # resource path\n local_var_path = \"/infra/services/{service-id}\".sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'Service')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyApi#read_service_for_tenant\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "7061160cb98f17f33ef2e734f2795313", "score": "0.6753136", "text": "def service\n services.fetch(service_name)\n end", "title": "" }, { "docid": "9e3f3ac05d53fed4617f91897310890b", "score": "0.66918033", "text": "def read_service(service)\n vals = Hash.new\n host, port = srv_lookup(service)\n sock = sockopen(host, port)\n if sock\n sock.puts(\"all\")\n loop {\n rtn_val = sock.gets\n # Can get an error on stripping if you don't check for NilClass first.\n break unless rtn_val\n # This is the normal exit, i.e., \".EOF\" read at end of data.\n next if rtn_val == \".EOF\"\n rtn_val = rtn_val.strip\n rtn_val =~ /(\\w+)\\s+(.*)/\n if $1 and $2\n\tvals[$1] = $2\n else\n\tbreak\n end\n }\n end\n sock.close() if sock\n sock = nil\n return vals\nend", "title": "" }, { "docid": "96853b4bdc7e85b2be150d9161287a12", "score": "0.6611499", "text": "def read_service(service_id, opts = {})\n data, _status_code, _headers = read_service_with_http_info(service_id, opts)\n return data\n end", "title": "" }, { "docid": "9b57a4453fea0fe00cf2fc48931bcb34", "score": "0.65917784", "text": "def get_service(service)\n @node_server.get_service(service)\n end", "title": "" }, { "docid": "42d73c25f95f54226a3736ebf22578bf", "score": "0.6521292", "text": "def _get_service(uuid) Tutum::Service.get(uuid) ; end", "title": "" }, { "docid": "35b550d4fe13cd05bc5945ddee7eb104", "score": "0.6512083", "text": "def service\n fetcher.get(Service, service_id)\n end", "title": "" }, { "docid": "1c44ee44a79f2b0081a6dedc244f2ac5", "score": "0.6487786", "text": "def service\n @service ||= client.services.get_from_uri(info[:service]) unless info[:service].nil?\n end", "title": "" }, { "docid": "34b87393bf6a57ac474ea1035728f7b9", "score": "0.64191467", "text": "def service(name)\n get(\"catalog/service/#{name}\")\n end", "title": "" }, { "docid": "291c97fd4c2eaeeed8a92a3c8d4d96f2", "score": "0.63723", "text": "def service(name)\n ZM.get(\"service/#{name}\")\n end", "title": "" }, { "docid": "4561ec2b4265ae764f5109e8db14b422", "score": "0.6338009", "text": "def cabot_service_get(name)\n services = JSON.parse(get_request(\"services/\").body)\n service = services.find {|h1| h1['name']==\"#{name}\"}\n\n return service\nend", "title": "" }, { "docid": "fea89e6a0304f622ffbc6f9edba06d18", "score": "0.63334703", "text": "def get_values service\n begin\n if @monit.get\n index = @monit.services.map(&:name).index(service)\n unless index.nil?\n @monit.services[index]\n else\n puts \"[#{Time.now}]: Service #{service} not known by Monit\" if @debug\n {}\n end\n else\n puts \"[#{Time.now}]: Monit instance didn't give right answer\" if @debug\n {}\n end\n rescue\n puts \"[#{Time.now}]: Error trying to connect to Monit instance\" if @debug\n {}\n end\n end", "title": "" }, { "docid": "2420df31dc78c457b9df2e0cd1a89b61", "score": "0.63249785", "text": "def get_service_information()\n uri = URI::HTTP.build( {:host => @host, :port => @port,\n :path => @context + \"/service\"} )\n\n headers = {}\n\n request = build_request( EsuRestApi::GET, uri, headers, nil )\n\n response = @session.request( request )\n\n handle_error( response )\n\n return parse_service_information( response )\n end", "title": "" }, { "docid": "9b17cb7882f714a295f2a1b843b1cbb4", "score": "0.63246423", "text": "def service\n @service ||= fetcher.get(Service, service_id)\n end", "title": "" }, { "docid": "632b860b18bbaa95f55a93e02c616f74", "score": "0.62686247", "text": "def service(id, options = {}) \n response = get(\"/services/#{id}\", options)\n response[:service]\n end", "title": "" }, { "docid": "dec6476215b794ae873e5c1157f83a19", "score": "0.62674737", "text": "def load_service\n @service = Service.find(params[:id])\n end", "title": "" }, { "docid": "5d386c1d9d2fa2c830261d31f020a055", "score": "0.6242816", "text": "def fetch_service\n @service = Service.find_by_name(params[:service_id]) if params[:service_id]\n end", "title": "" }, { "docid": "15cd790d9ce6894315eb64f7deba839d", "score": "0.6174052", "text": "def get_service_by_id(id)\n require_relative 'service'\n Service.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/services/#{id}\"))\n end", "title": "" }, { "docid": "15cd790d9ce6894315eb64f7deba839d", "score": "0.6174052", "text": "def get_service_by_id(id)\n require_relative 'service'\n Service.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/services/#{id}\"))\n end", "title": "" }, { "docid": "15cd790d9ce6894315eb64f7deba839d", "score": "0.6172361", "text": "def get_service_by_id(id)\n require_relative 'service'\n Service.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/services/#{id}\"))\n end", "title": "" }, { "docid": "1c8ccbc59062d1887feb31e354318869", "score": "0.6148667", "text": "def get_service\n cluster = self.get_cluster\n service = cluster.get_service_by_name(@aws_service_name)\n return service\n end", "title": "" }, { "docid": "168d5eb7fdded263c0276da6a5a12100", "score": "0.61285216", "text": "def service(service_name =\"all\", command=\"status\")\n sendreceive(\"service #{service_name} #{command}\")\n end", "title": "" }, { "docid": "522bbf31d1b2b51d8a64c81e2a10e5cb", "score": "0.6013727", "text": "def service\n @service\n end", "title": "" }, { "docid": "4e5254c26d8f6eded188e045e90bcac5", "score": "0.6006333", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'certificates'\n return certificates_service\n end\n if path.start_with?('certificates/')\n return certificates_service.service(path[13..-1])\n end\n if path == 'networks'\n return networks_service\n end\n if path.start_with?('networks/')\n return networks_service.service(path[9..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "89fbec0ce9ac1d21e7c0374900710dbf", "score": "0.6004195", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'balances'\n return balances_service\n end\n if path.start_with?('balances/')\n return balances_service.service(path[9..-1])\n end\n if path == 'filters'\n return filters_service\n end\n if path.start_with?('filters/')\n return filters_service.service(path[8..-1])\n end\n if path == 'weights'\n return weights_service\n end\n if path.start_with?('weights/')\n return weights_service.service(path[8..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "fa124dc82a720a0953e32e6d09b7e64e", "score": "0.59950715", "text": "def read_search_service(opts = {})\n data, _status_code, _headers = read_search_service_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "3c537215a03bb61cc6b50cec84bef36a", "score": "0.59801394", "text": "def getHttpService; @service; end", "title": "" }, { "docid": "eb4e435d45eb9d7c255cc34ad0b6b1ca", "score": "0.5978448", "text": "def service(service_id, params = nil)\n if service_id.is_a?(Hash)\n params = service_id\n service_id = params[:service_id]\n end\n\n request_url = \"catalog/service/#{service_id}\"\n\n params = {} if params.nil?\n params = params.select { |key, _value| %w(tag dc).include?(key.to_s) }\n\n response = ConsulClient.http.get(ConsulClient.request_url(request_url, params))\n JSON.parse(response.body)\n end", "title": "" }, { "docid": "3d2d359b6295524b6752e2ee77dcc534", "score": "0.59737784", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'clusters'\n return clusters_service\n end\n if path.start_with?('clusters/')\n return clusters_service.service(path[9..-1])\n end\n if path == 'iscsibonds'\n return iscsi_bonds_service\n end\n if path.start_with?('iscsibonds/')\n return iscsi_bonds_service.service(path[11..-1])\n end\n if path == 'networks'\n return networks_service\n end\n if path.start_with?('networks/')\n return networks_service.service(path[9..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'qoss'\n return qoss_service\n end\n if path.start_with?('qoss/')\n return qoss_service.service(path[5..-1])\n end\n if path == 'quotas'\n return quotas_service\n end\n if path.start_with?('quotas/')\n return quotas_service.service(path[7..-1])\n end\n if path == 'storagedomains'\n return storage_domains_service\n end\n if path.start_with?('storagedomains/')\n return storage_domains_service.service(path[15..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "187cc1ad217d54191b9990211af59a5d", "score": "0.5971907", "text": "def lookup_service(service_name)\n resolver = Resolv::DNS.open\n record = resolver.getresource(service_name, Resolv::DNS::Resource::IN::SRV)\n return resolver.getaddress(record.target), record.port\nend", "title": "" }, { "docid": "456c0ade6172fe5338b797e73f9d2b7d", "score": "0.59643567", "text": "def service_info(name)\n require_login\n raise CloudFoundry::Client::Exception::BadParams, \"Name cannot be blank\" if name.nil? || name.empty?\n get(\"#{CloudFoundry::Client::SERVICES_PATH}/#{name}\")\n end", "title": "" }, { "docid": "18406645876f52a4aa0b5c27c4dad495", "score": "0.59622985", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'authenticationkeys'\n return authentication_keys_service\n end\n if path.start_with?('authenticationkeys/')\n return authentication_keys_service.service(path[19..-1])\n end\n if path == 'certificates'\n return certificates_service\n end\n if path.start_with?('certificates/')\n return certificates_service.service(path[13..-1])\n end\n if path == 'volumetypes'\n return volume_types_service\n end\n if path.start_with?('volumetypes/')\n return volume_types_service.service(path[12..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "e5bced4a4fdd716c727caa94b2a9cca1", "score": "0.5924234", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'disksnapshots'\n return disk_snapshots_service\n end\n if path.start_with?('disksnapshots/')\n return disk_snapshots_service.service(path[14..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a6d3c7b4b5f0419477a06f4f948c6790", "score": "0.5910486", "text": "def get_service(service = nil)\n log.debug \"Requesting #{api_service_url(service_name(service))} \" \\\n \"as user #{api_user}\"\n response = RestClient::Request.execute(\n method: :get,\n url: api_service_url(service_name(service)),\n user: api_user,\n password: generate_token,\n headers: {\n user_agent: RestClient::Platform.default_user_agent.prepend(\n \"confidant-client/#{Confidant::VERSION} \"\n )\n }\n )\n\n JSON.parse(response.body)\n rescue StandardError => ex\n Confidant.log_exception(self, ex)\n @suppress_errors ? api_error_response : raise\n end", "title": "" }, { "docid": "3d5bf95b9c59895d360f89a98093f213", "score": "0.5908487", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'networkfilterparameters'\n return network_filter_parameters_service\n end\n if path.start_with?('networkfilterparameters/')\n return network_filter_parameters_service.service(path[24..-1])\n end\n if path == 'reporteddevices'\n return reported_devices_service\n end\n if path.start_with?('reporteddevices/')\n return reported_devices_service.service(path[16..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "8e27dca98ef9b24d2fe381fb8a8bb761", "score": "0.590129", "text": "def first_service\n accessible_services.first\n end", "title": "" }, { "docid": "34a987449bc06513c6f31e750f240c8d", "score": "0.5892763", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'certificates'\n return certificates_service\n end\n if path.start_with?('certificates/')\n return certificates_service.service(path[13..-1])\n end\n if path == 'computeresources'\n return compute_resources_service\n end\n if path.start_with?('computeresources/')\n return compute_resources_service.service(path[17..-1])\n end\n if path == 'discoveredhosts'\n return discovered_hosts_service\n end\n if path.start_with?('discoveredhosts/')\n return discovered_hosts_service.service(path[16..-1])\n end\n if path == 'hostgroups'\n return host_groups_service\n end\n if path.start_with?('hostgroups/')\n return host_groups_service.service(path[11..-1])\n end\n if path == 'hosts'\n return hosts_service\n end\n if path.start_with?('hosts/')\n return hosts_service.service(path[6..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "134d57f98aa26620bd542c613a294a0a", "score": "0.58909935", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'cdroms'\n return cdroms_service\n end\n if path.start_with?('cdroms/')\n return cdroms_service.service(path[7..-1])\n end\n if path == 'disks'\n return disks_service\n end\n if path.start_with?('disks/')\n return disks_service.service(path[6..-1])\n end\n if path == 'nics'\n return nics_service\n end\n if path.start_with?('nics/')\n return nics_service.service(path[5..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a10f51d98d6484a1ac0772a34c4f6aae", "score": "0.5889531", "text": "def find(service_id)\n self[service_id]\n end", "title": "" }, { "docid": "de46ae4d3072fe60a3424d3fc69d56a7", "score": "0.58738124", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'roles'\n return roles_service\n end\n if path.start_with?('roles/')\n return roles_service.service(path[6..-1])\n end\n if path == 'tags'\n return tags_service\n end\n if path.start_with?('tags/')\n return tags_service.service(path[5..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "d0c01e8e080e61c408710871460d7a39", "score": "0.58665013", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'cdroms'\n return cdroms_service\n end\n if path.start_with?('cdroms/')\n return cdroms_service.service(path[7..-1])\n end\n if path == 'diskattachments'\n return disk_attachments_service\n end\n if path.start_with?('diskattachments/')\n return disk_attachments_service.service(path[16..-1])\n end\n if path == 'graphicsconsoles'\n return graphics_consoles_service\n end\n if path.start_with?('graphicsconsoles/')\n return graphics_consoles_service.service(path[17..-1])\n end\n if path == 'nics'\n return nics_service\n end\n if path.start_with?('nics/')\n return nics_service.service(path[5..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'tags'\n return tags_service\n end\n if path.start_with?('tags/')\n return tags_service.service(path[5..-1])\n end\n if path == 'watchdogs'\n return watchdogs_service\n end\n if path.start_with?('watchdogs/')\n return watchdogs_service.service(path[10..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "f2f773e8ef60ed85a2a7dcf36205376c", "score": "0.5845832", "text": "def get_service(name)\n if @services.has_key?(name)\n return @services[name]\n else\n raise InterfaceException, \"No such service #{name}.\"\n end\n end", "title": "" }, { "docid": "50dae00254fb559691894d84535d8563", "score": "0.58449435", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'networklabels'\n return network_labels_service\n end\n if path.start_with?('networklabels/')\n return network_labels_service.service(path[14..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'vnicprofiles'\n return vnic_profiles_service\n end\n if path.start_with?('vnicprofiles/')\n return vnic_profiles_service.service(path[13..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "dcfe1872ec979711562e6593c749f21e", "score": "0.5839317", "text": "def read\n @client.read @handle\n end", "title": "" }, { "docid": "21b401bc3e4703347ba9a8f93c1b468a", "score": "0.5828187", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'affinitygroups'\n return affinity_groups_service\n end\n if path.start_with?('affinitygroups/')\n return affinity_groups_service.service(path[15..-1])\n end\n if path == 'cpuprofiles'\n return cpu_profiles_service\n end\n if path.start_with?('cpuprofiles/')\n return cpu_profiles_service.service(path[12..-1])\n end\n if path == 'enabledfeatures'\n return enabled_features_service\n end\n if path.start_with?('enabledfeatures/')\n return enabled_features_service.service(path[16..-1])\n end\n if path == 'externalnetworkproviders'\n return external_network_providers_service\n end\n if path.start_with?('externalnetworkproviders/')\n return external_network_providers_service.service(path[25..-1])\n end\n if path == 'glusterhooks'\n return gluster_hooks_service\n end\n if path.start_with?('glusterhooks/')\n return gluster_hooks_service.service(path[13..-1])\n end\n if path == 'glustervolumes'\n return gluster_volumes_service\n end\n if path.start_with?('glustervolumes/')\n return gluster_volumes_service.service(path[15..-1])\n end\n if path == 'networkfilters'\n return network_filters_service\n end\n if path.start_with?('networkfilters/')\n return network_filters_service.service(path[15..-1])\n end\n if path == 'networks'\n return networks_service\n end\n if path.start_with?('networks/')\n return networks_service.service(path[9..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "a38e56ff571dccd23389bfaa0cfec70b", "score": "0.5828065", "text": "def service(name)\n # The service might not exist at this time so we cannot really check\n # anything\n Service.new(name, self)\n end", "title": "" }, { "docid": "ca585b5e53a8e9aff164eefc35e57334", "score": "0.58184975", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'diskprofiles'\n return disk_profiles_service\n end\n if path.start_with?('diskprofiles/')\n return disk_profiles_service.service(path[13..-1])\n end\n if path == 'disksnapshots'\n return disk_snapshots_service\n end\n if path.start_with?('disksnapshots/')\n return disk_snapshots_service.service(path[14..-1])\n end\n if path == 'disks'\n return disks_service\n end\n if path.start_with?('disks/')\n return disks_service.service(path[6..-1])\n end\n if path == 'files'\n return files_service\n end\n if path.start_with?('files/')\n return files_service.service(path[6..-1])\n end\n if path == 'images'\n return images_service\n end\n if path.start_with?('images/')\n return images_service.service(path[7..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'storageconnections'\n return storage_connections_service\n end\n if path.start_with?('storageconnections/')\n return storage_connections_service.service(path[19..-1])\n end\n if path == 'templates'\n return templates_service\n end\n if path.start_with?('templates/')\n return templates_service.service(path[10..-1])\n end\n if path == 'vms'\n return vms_service\n end\n if path.start_with?('vms/')\n return vms_service.service(path[4..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "3215f5543efe8540cf2467fde6489aa9", "score": "0.5814638", "text": "def read_service_with_http_info(service_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LogicalRoutingAndServicesApi.read_service ...\"\n end\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling LogicalRoutingAndServicesApi.read_service\"\n end\n # resource path\n local_var_path = \"/services/{service-id}\".sub('{' + 'service-id' + '}', service_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LogicalService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogicalRoutingAndServicesApi#read_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "2c1ea088950ce1f97302e37077c2216f", "score": "0.58084863", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "2c1ea088950ce1f97302e37077c2216f", "score": "0.58084863", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "2c1ea088950ce1f97302e37077c2216f", "score": "0.58084863", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "3c4ed680e91d1b546588111a4aec57df", "score": "0.58017063", "text": "def initialize\n get_service\n end", "title": "" }, { "docid": "527f01e48568aca8c38ab3398fada69c", "score": "0.58008736", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'hosts'\n return hosts_service\n end\n if path.start_with?('hosts/')\n return hosts_service.service(path[6..-1])\n end\n if path == 'vms'\n return vms_service\n end\n if path.start_with?('vms/')\n return vms_service.service(path[4..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "267106a9a156c4f09fba8623768c90c0", "score": "0.5798969", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'eventsubscriptions'\n return event_subscriptions_service\n end\n if path.start_with?('eventsubscriptions/')\n return event_subscriptions_service.service(path[19..-1])\n end\n if path == 'groups'\n return groups_service\n end\n if path.start_with?('groups/')\n return groups_service.service(path[7..-1])\n end\n if path == 'options'\n return options_service\n end\n if path.start_with?('options/')\n return options_service.service(path[8..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'roles'\n return roles_service\n end\n if path.start_with?('roles/')\n return roles_service.service(path[6..-1])\n end\n if path == 'sshpublickeys'\n return ssh_public_keys_service\n end\n if path.start_with?('sshpublickeys/')\n return ssh_public_keys_service.service(path[14..-1])\n end\n if path == 'tags'\n return tags_service\n end\n if path.start_with?('tags/')\n return tags_service.service(path[5..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "34b3ede4644ba38f52f5ae67625d1153", "score": "0.5797229", "text": "def get_read(id)\n resp = @conn.get 'reads/'+id.to_s+'.json'\n resp.body\n end", "title": "" }, { "docid": "268bc36ce797c049c496ef7527ee4441", "score": "0.5789119", "text": "def get_service_by_name(service_name)\n return RaisEcs::Service.new({\n cloud: @cloud,\n cluster: self,\n service_name: service_name\n })\n end", "title": "" }, { "docid": "dfb37743478d8cfe74172ac8677426b0", "score": "0.5788845", "text": "def obtain_service_block(key1, key2=nil)\n service = @services[self.key(key1,key2)]\n if service.nil? \n raise ServiceNotFoundError, \"No service could be found registered under the name '#{key(key1,key2)}'.\" \n end\n service # return\n end", "title": "" }, { "docid": "299c38dcb9457953e24a9f52c47068fe", "score": "0.57726115", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'certificates'\n return certificates_service\n end\n if path.start_with?('certificates/')\n return certificates_service.service(path[13..-1])\n end\n if path == 'images'\n return images_service\n end\n if path.start_with?('images/')\n return images_service.service(path[7..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "d04e92dc0a5a39f6126b85ef115f557e", "score": "0.5766913", "text": "def fetch_service(new_resource)\n service = new_resource.service\n if new_resource.fetch_name_from_service_resource\n begin\n service_resource = new_resource.resources(service: service)\n service = service_resource.service_name\n rescue Chef::Exceptions::ResourceNotFound\n Chef::Log.warn(\"Unable to find resource for service #{service}!\")\n end\n end\n service\nend", "title": "" }, { "docid": "36d2ee73885275da7f5f51850560aa45", "score": "0.57648367", "text": "def service name\n obj = services.find { |s| s.name.downcase == name.downcase }\n raise ArgumentError, \"Unknown service #{name}\" if not obj\n return obj\n end", "title": "" }, { "docid": "e980f4a96d5ababc2d9dd609ad177ec1", "score": "0.5758855", "text": "def find service_name\n found = nil\n\n each_tuple_space.any? do |ts|\n tuples = ts.read_all [:name, nil, DRbObject, nil]\n\n found = tuples.find do |_, found_service_name, service, _|\n begin\n next unless found_service_name == service_name\n\n if DRbObject === service then\n service.method_missing :object_id # ping service for liveness\n else\n service\n end\n rescue DRb::DRbConnError\n next\n rescue NoMethodError\n next\n end\n end\n end\n\n raise \"unable to find service #{service_name.inspect}\" unless found\n\n found[2]\n end", "title": "" }, { "docid": "5ee6d9d4aea5732e4702df59984be295", "score": "0.5756432", "text": "def service\n @service ||= OData::ServiceRegistry[service_name]\n end", "title": "" }, { "docid": "a2e815b230300dd67d6d0319e017d35a", "score": "0.5752748", "text": "def service(id)\n service_registry[id].service if service_registry.has_key? id\n end", "title": "" }, { "docid": "2766135a6bd300a37ca08d73431c0d3e", "score": "0.5749249", "text": "def read_service_reference_0(service_reference_id, opts = {})\n data, _status_code, _headers = read_service_reference_0_with_http_info(service_reference_id, opts)\n data\n end", "title": "" }, { "docid": "fa5e4d855467a4174d3bbc2b12dadeb4", "score": "0.57445025", "text": "def find(service:, ref:)\n new(id: ref, service: service).tap(&:attrs)\n rescue ThreeScaleToolbox::InvalidIdError, ThreeScale::API::HttpClient::NotFoundError\n find_by_system_name(service: service, system_name: ref)\n end", "title": "" }, { "docid": "2915c14a9406b94e75349f3ea53faa7d", "score": "0.5739824", "text": "def service\n @service ||= FrOData::ServiceRegistry[service_name]\n end", "title": "" }, { "docid": "526dc4850e6dd3e3fe3ef2eb801fd174", "score": "0.5734735", "text": "def lookup_service(service_name)\n service_name = service_name + \".apps.gureu.me\"\n resolver = Resolv::DNS.open\n record = resolver.getresource(service_name, Resolv::DNS::Resource::IN::A)\n #return resolver.getaddress(record.target), record.port\n return service_name, 80\nend", "title": "" }, { "docid": "7600362a5d8fb47a0dc4851356d30fa9", "score": "0.5731957", "text": "def get(key, scope = :first, options = nil, meta = nil)\n url = [\"/v1/catalog/service/#{key}\"]\n url += check_acl_token\n url << use_named_parameter('wait', options[:wait]) if options && options[:wait]\n url << use_named_parameter('index', options[:index]) if options && options[:index]\n url << use_named_parameter('dc', options[:dc]) if options && options[:dc]\n url << use_named_parameter('tag', options[:tag]) if options && options[:tag]\n\n # If the request fails, it's probably due to a bad path\n # so return a PathNotFound error.\n begin\n ret = @conn.get concat_url url\n rescue Faraday::ClientError => e\n raise Diplomat::PathNotFound, e\n end\n\n if meta && ret.headers\n meta[:index] = ret.headers['x-consul-index']\n meta[:knownleader] = ret.headers['x-consul-knownleader']\n meta[:lastcontact] = ret.headers['x-consul-lastcontact']\n end\n\n if scope == :all\n JSON.parse(ret.body).map { |service| OpenStruct.new service }\n else\n OpenStruct.new JSON.parse(ret.body).first\n end\n end", "title": "" }, { "docid": "9492f3631e6057bf3d84110de983846f", "score": "0.5730583", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'networks'\n return networks_service\n end\n if path.start_with?('networks/')\n return networks_service.service(path[9..-1])\n end\n if path == 'storageserverconnections'\n return storage_server_connections_service\n end\n if path.start_with?('storageserverconnections/')\n return storage_server_connections_service.service(path[25..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "5037b1bcf3f52f295d01af4de88a67e8", "score": "0.57239705", "text": "def request_service *params\n request 'service', *params\n end", "title": "" }, { "docid": "a56cfc58189dff516916239c2681d994", "score": "0.57174826", "text": "def get_service serviceid\n service = PcoOutboundservice.find(:first, :conditions => [\"ID = ?\", serviceid])\n return breakdown_cli_components(service.phoneprefix, service)\n end", "title": "" }, { "docid": "1ebcb8335c342adca30a65d726dc5f3e", "score": "0.5716561", "text": "def service(name)\n if self.class.services.include?(name.to_sym)\n Serviced.fetch_service(name).for(self)\n end\n end", "title": "" }, { "docid": "622e3f605fcdcf5f1a3de7bcb57fcb49", "score": "0.57111615", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return nic_service(path)\n end\n return nic_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "622e3f605fcdcf5f1a3de7bcb57fcb49", "score": "0.57111615", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return nic_service(path)\n end\n return nic_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "622e3f605fcdcf5f1a3de7bcb57fcb49", "score": "0.57111615", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return nic_service(path)\n end\n return nic_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "beed88d067d84d5a6b8dce7f9a212ae8", "score": "0.5710644", "text": "def read_service_reference(service_reference_id, opts = {})\n data, _status_code, _headers = read_service_reference_with_http_info(service_reference_id, opts)\n data\n end", "title": "" }, { "docid": "622e3f605fcdcf5f1a3de7bcb57fcb49", "score": "0.57101274", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return nic_service(path)\n end\n return nic_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "622e3f605fcdcf5f1a3de7bcb57fcb49", "score": "0.57101274", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return nic_service(path)\n end\n return nic_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "6c553961954511c8004acb89edbe801d", "score": "0.57039136", "text": "def lookup_service(key1, key2=nil)\n k = key(key1,key2)\n puts \"#> looking up service for '#{k}'\"\n @cache[k] ||= obtain_service_block(key1, key2).call(self)\n end", "title": "" }, { "docid": "cf9d8beaf51378d8fa0a984a2f76cfcb", "score": "0.57025427", "text": "def get(host_name, service_name, lazzy = true)\n raise('wrong type: String required for host_name') unless host_name.is_a?(String)\n raise('wrong value: host_name must be valid') unless !host_name.nil? && !host_name.empty?\n raise('wrong type: String required for service_name') unless service_name.is_a?(String)\n raise('wrong value: service_name must be valid') unless !service_name.nil? && !service_name.empty?\n raise('wrong type: boolean required for lazzy') unless [true, false].include? lazzy\n\n # Search if host exist\n services = fetch(host_name, service_name)\n found_service = nil\n services.each do |service|\n if service.host.name == host_name && service.name == service_name\n found_service = service\n break\n end\n end\n\n if !found_service.nil? && !lazzy\n load(found_service)\n end\n\n found_service\n end", "title": "" }, { "docid": "9562fc63f0e5f4689d51656dc6a7af64", "score": "0.56983346", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return resource_service(path)\n end\n return resource_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "b8168dd3443a8d509ae7f9e51d9710c9", "score": "0.5698187", "text": "def service\n @service ||= ServiceStore.instantiate_service!( self.service_id, nil )\n end", "title": "" }, { "docid": "da06dbd30a3eaf9bb72db09f29397875", "score": "0.5696443", "text": "def read_service_entry(service_id, service_entry_id, opts = {})\n data, _status_code, _headers = read_service_entry_with_http_info(service_id, service_entry_id, opts)\n data\n end", "title": "" }, { "docid": "dff1ea369376b41a7966e83161eaff74", "score": "0.5691706", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'affinitylabels'\n return affinity_labels_service\n end\n if path.start_with?('affinitylabels/')\n return affinity_labels_service.service(path[15..-1])\n end\n if path == 'devices'\n return devices_service\n end\n if path.start_with?('devices/')\n return devices_service.service(path[8..-1])\n end\n if path == 'externalnetworkproviderconfigurations'\n return external_network_provider_configurations_service\n end\n if path.start_with?('externalnetworkproviderconfigurations/')\n return external_network_provider_configurations_service.service(path[38..-1])\n end\n if path == 'fenceagents'\n return fence_agents_service\n end\n if path.start_with?('fenceagents/')\n return fence_agents_service.service(path[12..-1])\n end\n if path == 'hooks'\n return hooks_service\n end\n if path.start_with?('hooks/')\n return hooks_service.service(path[6..-1])\n end\n if path == 'katelloerrata'\n return katello_errata_service\n end\n if path.start_with?('katelloerrata/')\n return katello_errata_service.service(path[14..-1])\n end\n if path == 'networkattachments'\n return network_attachments_service\n end\n if path.start_with?('networkattachments/')\n return network_attachments_service.service(path[19..-1])\n end\n if path == 'nics'\n return nics_service\n end\n if path.start_with?('nics/')\n return nics_service.service(path[5..-1])\n end\n if path == 'numanodes'\n return numa_nodes_service\n end\n if path.start_with?('numanodes/')\n return numa_nodes_service.service(path[10..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n if path == 'storage'\n return storage_service\n end\n if path.start_with?('storage/')\n return storage_service.service(path[8..-1])\n end\n if path == 'storageconnectionextensions'\n return storage_connection_extensions_service\n end\n if path.start_with?('storageconnectionextensions/')\n return storage_connection_extensions_service.service(path[28..-1])\n end\n if path == 'tags'\n return tags_service\n end\n if path.start_with?('tags/')\n return tags_service.service(path[5..-1])\n end\n if path == 'unmanagednetworks'\n return unmanaged_networks_service\n end\n if path.start_with?('unmanagednetworks/')\n return unmanaged_networks_service.service(path[18..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "403b15fe7cc1f02ee087997009e46986", "score": "0.5689639", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'affinitylabels'\n return affinity_labels_service\n end\n if path.start_with?('affinitylabels/')\n return affinity_labels_service.service(path[15..-1])\n end\n if path == 'applications'\n return applications_service\n end\n if path.start_with?('applications/')\n return applications_service.service(path[13..-1])\n end\n if path == 'backups'\n return backups_service\n end\n if path.start_with?('backups/')\n return backups_service.service(path[8..-1])\n end\n if path == 'cdroms'\n return cdroms_service\n end\n if path.start_with?('cdroms/')\n return cdroms_service.service(path[7..-1])\n end\n if path == 'checkpoints'\n return checkpoints_service\n end\n if path.start_with?('checkpoints/')\n return checkpoints_service.service(path[12..-1])\n end\n if path == 'diskattachments'\n return disk_attachments_service\n end\n if path.start_with?('diskattachments/')\n return disk_attachments_service.service(path[16..-1])\n end\n if path == 'graphicsconsoles'\n return graphics_consoles_service\n end\n if path.start_with?('graphicsconsoles/')\n return graphics_consoles_service.service(path[17..-1])\n end\n if path == 'hostdevices'\n return host_devices_service\n end\n if path.start_with?('hostdevices/')\n return host_devices_service.service(path[12..-1])\n end\n if path == 'katelloerrata'\n return katello_errata_service\n end\n if path.start_with?('katelloerrata/')\n return katello_errata_service.service(path[14..-1])\n end\n if path == 'nics'\n return nics_service\n end\n if path.start_with?('nics/')\n return nics_service.service(path[5..-1])\n end\n if path == 'numanodes'\n return numa_nodes_service\n end\n if path.start_with?('numanodes/')\n return numa_nodes_service.service(path[10..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'reporteddevices'\n return reported_devices_service\n end\n if path.start_with?('reporteddevices/')\n return reported_devices_service.service(path[16..-1])\n end\n if path == 'sessions'\n return sessions_service\n end\n if path.start_with?('sessions/')\n return sessions_service.service(path[9..-1])\n end\n if path == 'snapshots'\n return snapshots_service\n end\n if path.start_with?('snapshots/')\n return snapshots_service.service(path[10..-1])\n end\n if path == 'statistics'\n return statistics_service\n end\n if path.start_with?('statistics/')\n return statistics_service.service(path[11..-1])\n end\n if path == 'tags'\n return tags_service\n end\n if path.start_with?('tags/')\n return tags_service.service(path[5..-1])\n end\n if path == 'watchdogs'\n return watchdogs_service\n end\n if path.start_with?('watchdogs/')\n return watchdogs_service.service(path[10..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "bf9041cf4cfd322d6c69de51295afd2d", "score": "0.5687306", "text": "def acquire_service_data\n if config[:tags] && config[:service]\n tags = config[:tags].split(',').to_set\n services = []\n Diplomat::Health.service(config[:service]).each do |s|\n if s['Service']['Tags'].to_set.superset? tags\n services.push(*s['Checks'])\n end\n end\n return services\n elsif config[:all]\n Diplomat::Health.state('any')\n else\n Diplomat::Health.checks(config[:service])\n end\n rescue Faraday::ConnectionFailed => e\n warning \"Connection error occurred: #{e}\"\n rescue Diplomat::UnknownStatus => e\n if e.message.include?('403')\n critical %(ACL token is not authorized to access service \"#{config[:service]}\")\n else\n critical \"Unhandled exception(#{e.class}) -- #{e.message}\"\n end\n rescue Faraday::ClientError => e\n if e.response[:status] == 403\n critical %(ACL token is not authorized to access service \"#{config[:service]}\": #{e.response[:body]})\n else\n unknown \"Exception occurred when checking consul service: #{e}\"\n end\n rescue StandardError => e\n unknown \"Exception occurred when checking consul service: #{e}\"\n end", "title": "" }, { "docid": "86ae3f89919d56a0da48bad1066378b5", "score": "0.5687265", "text": "def get_service\n request({\n :expects => 200,\n :headers => {},\n :host => @host || region_to_host(DEFAULT_REGION),\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::Parsers::AWS::Storage::GetService.new\n })\n end", "title": "" }, { "docid": "1ad5ca14f853bf97a862f066f1504749", "score": "0.56851524", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'graphicsconsoles'\n return graphics_consoles_service\n end\n if path.start_with?('graphicsconsoles/')\n return graphics_consoles_service.service(path[17..-1])\n end\n if path == 'nics'\n return nics_service\n end\n if path.start_with?('nics/')\n return nics_service.service(path[5..-1])\n end\n if path == 'watchdogs'\n return watchdogs_service\n end\n if path.start_with?('watchdogs/')\n return watchdogs_service.service(path[10..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "cba9a89e5dced7458fcb568843f93aad", "score": "0.5685079", "text": "def load_service\n clear\n # currently forcing SSL verification off (seems to be required for projectnimbus)\n # TODO: this should probably be a setting in the ServiceListing\n rest_options = {:verify_ssl=>false}\n if credentialset && credentialset != 'projectnimbus'\n credentials = config.credentialsets[credentialset]\n # merge basic auth\n rest_options.merge!({ :username => credentials['username'], :password => credentials['password'] })\n end\n svc = OData::Service.new(uri, rest_options)\n if credentialset && credentialset == 'projectnimbus'\n credentials = config.credentialsets[credentialset]\n # some special funk to insert headers for projectnimbus authentication\n actual_rest_options = svc.instance_variable_get(:@rest_options)\n rest_options = actual_rest_options.merge({:headers => {\n 'AccountKey' => credentials['AccountKey'], 'UniqueUserID' => credentials['UniqueUserID']\n }})\n svc.instance_variable_set(:@rest_options,rest_options)\n end\n svc\n end", "title": "" }, { "docid": "97a1ab3b681419a0fd7fa65198dd9402", "score": "0.56805366", "text": "def read_namespaced_service(name, namespace, opts = {})\n data, _status_code, _headers = read_namespaced_service_with_http_info(name, namespace, opts)\n return data\n end", "title": "" }, { "docid": "3abe8179714feb2cb81dc969a5ef83f1", "score": "0.5677294", "text": "def read_ns_service(ns_service_id, opts = {})\n data, _status_code, _headers = read_ns_service_with_http_info(ns_service_id, opts)\n data\n end", "title": "" }, { "docid": "8a2086b2c15dbd2800ee4730895bbf4b", "score": "0.5674097", "text": "def service\n return @service\n end", "title": "" }, { "docid": "8a2086b2c15dbd2800ee4730895bbf4b", "score": "0.5674097", "text": "def service\n return @service\n end", "title": "" }, { "docid": "8a2086b2c15dbd2800ee4730895bbf4b", "score": "0.5674097", "text": "def service\n return @service\n end", "title": "" }, { "docid": "8a2086b2c15dbd2800ee4730895bbf4b", "score": "0.5674097", "text": "def service\n return @service\n end", "title": "" }, { "docid": "a332a62604242fa5f441fa2563218eae", "score": "0.56736976", "text": "def read(*args)\n get(*args)\n end", "title": "" }, { "docid": "40f5db724d3edc4717d94c5991ef2610", "score": "0.5661005", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return data_center_service(path)\n end\n return data_center_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "cb7d7e54adc1e138a80fc14da43ae587", "score": "0.56569916", "text": "def services\n space.read_all([:name,self.name.underscore,nil,nil]).map{|s| s[3]} rescue []\n end", "title": "" }, { "docid": "a1d384cf423c89623f9d34c00abb8b04", "score": "0.56558377", "text": "def read_ssh_service(opts = {})\n data, _status_code, _headers = read_ssh_service_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "1cc43d366cf6290a018d9d0befdfc2b3", "score": "0.5655191", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'diskattachments'\n return disk_attachments_service\n end\n if path.start_with?('diskattachments/')\n return disk_attachments_service.service(path[16..-1])\n end\n if path == 'disks'\n return disks_service\n end\n if path.start_with?('disks/')\n return disks_service.service(path[6..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "92ef6f7cf1e8c416cc726f54732ea92d", "score": "0.56492794", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n if path == 'affinitylabels'\n return affinity_labels_service\n end\n if path.start_with?('affinitylabels/')\n return affinity_labels_service.service(path[15..-1])\n end\n if path == 'bookmarks'\n return bookmarks_service\n end\n if path.start_with?('bookmarks/')\n return bookmarks_service.service(path[10..-1])\n end\n if path == 'clusterlevels'\n return cluster_levels_service\n end\n if path.start_with?('clusterlevels/')\n return cluster_levels_service.service(path[14..-1])\n end\n if path == 'clusters'\n return clusters_service\n end\n if path.start_with?('clusters/')\n return clusters_service.service(path[9..-1])\n end\n if path == 'cpuprofiles'\n return cpu_profiles_service\n end\n if path.start_with?('cpuprofiles/')\n return cpu_profiles_service.service(path[12..-1])\n end\n if path == 'datacenters'\n return data_centers_service\n end\n if path.start_with?('datacenters/')\n return data_centers_service.service(path[12..-1])\n end\n if path == 'diskprofiles'\n return disk_profiles_service\n end\n if path.start_with?('diskprofiles/')\n return disk_profiles_service.service(path[13..-1])\n end\n if path == 'disks'\n return disks_service\n end\n if path.start_with?('disks/')\n return disks_service.service(path[6..-1])\n end\n if path == 'domains'\n return domains_service\n end\n if path.start_with?('domains/')\n return domains_service.service(path[8..-1])\n end\n if path == 'events'\n return events_service\n end\n if path.start_with?('events/')\n return events_service.service(path[7..-1])\n end\n if path == 'externalhostproviders'\n return external_host_providers_service\n end\n if path.start_with?('externalhostproviders/')\n return external_host_providers_service.service(path[22..-1])\n end\n if path == 'externalvmimports'\n return external_vm_imports_service\n end\n if path.start_with?('externalvmimports/')\n return external_vm_imports_service.service(path[18..-1])\n end\n if path == 'groups'\n return groups_service\n end\n if path.start_with?('groups/')\n return groups_service.service(path[7..-1])\n end\n if path == 'hosts'\n return hosts_service\n end\n if path.start_with?('hosts/')\n return hosts_service.service(path[6..-1])\n end\n if path == 'icons'\n return icons_service\n end\n if path.start_with?('icons/')\n return icons_service.service(path[6..-1])\n end\n if path == 'imagetransfers'\n return image_transfers_service\n end\n if path.start_with?('imagetransfers/')\n return image_transfers_service.service(path[15..-1])\n end\n if path == 'instancetypes'\n return instance_types_service\n end\n if path.start_with?('instancetypes/')\n return instance_types_service.service(path[14..-1])\n end\n if path == 'jobs'\n return jobs_service\n end\n if path.start_with?('jobs/')\n return jobs_service.service(path[5..-1])\n end\n if path == 'katelloerrata'\n return katello_errata_service\n end\n if path.start_with?('katelloerrata/')\n return katello_errata_service.service(path[14..-1])\n end\n if path == 'macpools'\n return mac_pools_service\n end\n if path.start_with?('macpools/')\n return mac_pools_service.service(path[9..-1])\n end\n if path == 'networkfilters'\n return network_filters_service\n end\n if path.start_with?('networkfilters/')\n return network_filters_service.service(path[15..-1])\n end\n if path == 'networks'\n return networks_service\n end\n if path.start_with?('networks/')\n return networks_service.service(path[9..-1])\n end\n if path == 'openstackimageproviders'\n return openstack_image_providers_service\n end\n if path.start_with?('openstackimageproviders/')\n return openstack_image_providers_service.service(path[24..-1])\n end\n if path == 'openstacknetworkproviders'\n return openstack_network_providers_service\n end\n if path.start_with?('openstacknetworkproviders/')\n return openstack_network_providers_service.service(path[26..-1])\n end\n if path == 'openstackvolumeproviders'\n return openstack_volume_providers_service\n end\n if path.start_with?('openstackvolumeproviders/')\n return openstack_volume_providers_service.service(path[25..-1])\n end\n if path == 'operatingsystems'\n return operating_systems_service\n end\n if path.start_with?('operatingsystems/')\n return operating_systems_service.service(path[17..-1])\n end\n if path == 'options'\n return options_service\n end\n if path.start_with?('options/')\n return options_service.service(path[8..-1])\n end\n if path == 'permissions'\n return permissions_service\n end\n if path.start_with?('permissions/')\n return permissions_service.service(path[12..-1])\n end\n if path == 'roles'\n return roles_service\n end\n if path.start_with?('roles/')\n return roles_service.service(path[6..-1])\n end\n if path == 'schedulingpolicies'\n return scheduling_policies_service\n end\n if path.start_with?('schedulingpolicies/')\n return scheduling_policies_service.service(path[19..-1])\n end\n if path == 'schedulingpolicyunits'\n return scheduling_policy_units_service\n end\n if path.start_with?('schedulingpolicyunits/')\n return scheduling_policy_units_service.service(path[22..-1])\n end\n if path == 'storageconnections'\n return storage_connections_service\n end\n if path.start_with?('storageconnections/')\n return storage_connections_service.service(path[19..-1])\n end\n if path == 'storagedomains'\n return storage_domains_service\n end\n if path.start_with?('storagedomains/')\n return storage_domains_service.service(path[15..-1])\n end\n if path == 'tags'\n return tags_service\n end\n if path.start_with?('tags/')\n return tags_service.service(path[5..-1])\n end\n if path == 'templates'\n return templates_service\n end\n if path.start_with?('templates/')\n return templates_service.service(path[10..-1])\n end\n if path == 'users'\n return users_service\n end\n if path.start_with?('users/')\n return users_service.service(path[6..-1])\n end\n if path == 'vmpools'\n return vm_pools_service\n end\n if path.start_with?('vmpools/')\n return vm_pools_service.service(path[8..-1])\n end\n if path == 'vms'\n return vms_service\n end\n if path.start_with?('vms/')\n return vms_service.service(path[4..-1])\n end\n if path == 'vnicprofiles'\n return vnic_profiles_service\n end\n if path.start_with?('vnicprofiles/')\n return vnic_profiles_service.service(path[13..-1])\n end\n raise Error.new(\"The path \\\"#{path}\\\" doesn't correspond to any service\")\n end", "title": "" }, { "docid": "7c0a0a87620660669009e3e302cdd1dd", "score": "0.5645867", "text": "def get(id)\n @service.get(id)\n end", "title": "" } ]
5d5d395924de2e8562a7baeef0cd1766
echo returns the input string i.e., if the passed input string is "hello", returns "hello"
[ { "docid": "d1e90fea81041a5ad934ba86038d228b", "score": "0.6332094", "text": "def echo hello\n return hello\nend", "title": "" } ]
[ { "docid": "a343ea1f398ab3bb706995a4bda077d0", "score": "0.8129564", "text": "def echo (string)\n string\n end", "title": "" }, { "docid": "8784d1ec78196e2b5142d05f6815b12e", "score": "0.8114601", "text": "def echo(string)\n string\n end", "title": "" }, { "docid": "80900339f3f30198aec791d5f59cfd89", "score": "0.7822837", "text": "def echo(input)\n input\n end", "title": "" }, { "docid": "80900339f3f30198aec791d5f59cfd89", "score": "0.7822837", "text": "def echo(input)\n input\n end", "title": "" }, { "docid": "440c037e020d0fe0cebbc2047baac842", "score": "0.77541995", "text": "def echo(string)\nstring\nend", "title": "" }, { "docid": "0640a563402997c5a903b197d7145092", "score": "0.7746167", "text": "def echo(string)\r\n string\r\nend", "title": "" }, { "docid": "1e8b761d463f999bc7385d3946da10b9", "score": "0.7694136", "text": "def echo(string)\n string\nend", "title": "" }, { "docid": "1e8b761d463f999bc7385d3946da10b9", "score": "0.7694136", "text": "def echo(string)\n string\nend", "title": "" }, { "docid": "1e8b761d463f999bc7385d3946da10b9", "score": "0.7694136", "text": "def echo(string)\n string\nend", "title": "" }, { "docid": "1e8b761d463f999bc7385d3946da10b9", "score": "0.7694136", "text": "def echo(string)\n string\nend", "title": "" }, { "docid": "793492a96143074db5110ab1de68bf67", "score": "0.7693029", "text": "def echo(string)\n string\nend", "title": "" }, { "docid": "878190339452b0f051dbb66c8de45268", "score": "0.7689386", "text": "def echo(string)\n return string\nend", "title": "" }, { "docid": "b662a930f1a43b1352a06ed681a9dc0a", "score": "0.76633596", "text": "def echo(input)\n\tinput\nend", "title": "" }, { "docid": "e0acb4ee8ab25daed853276449dc7b57", "score": "0.76299274", "text": "def echo (str)\n return str\nend", "title": "" }, { "docid": "e0acb4ee8ab25daed853276449dc7b57", "score": "0.76299274", "text": "def echo (str)\n return str\nend", "title": "" }, { "docid": "051b4195c9530fd802d08049a2447a52", "score": "0.7576848", "text": "def echo (str)\n str\nend", "title": "" }, { "docid": "6e4cdd7792e68313063440ddc783b020", "score": "0.7549423", "text": "def echo(input)\n input\nend", "title": "" }, { "docid": "6e4cdd7792e68313063440ddc783b020", "score": "0.7549423", "text": "def echo(input)\n input\nend", "title": "" }, { "docid": "6e4cdd7792e68313063440ddc783b020", "score": "0.7549423", "text": "def echo(input)\n input\nend", "title": "" }, { "docid": "a2a5a206eb160ba3b79ea8b4ec826ec3", "score": "0.7515276", "text": "def echo(s)\n s\nend", "title": "" }, { "docid": "4c2a07ad55d50af13e87a7bc1dfee01c", "score": "0.75123954", "text": "def echo string\n return string\nend", "title": "" }, { "docid": "207c90513bacf92274f05960673c63d8", "score": "0.7490175", "text": "def echo(str)\n str\nend", "title": "" }, { "docid": "207c90513bacf92274f05960673c63d8", "score": "0.7490175", "text": "def echo(str)\n str\nend", "title": "" }, { "docid": "207c90513bacf92274f05960673c63d8", "score": "0.7490175", "text": "def echo(str)\n str\nend", "title": "" }, { "docid": "207c90513bacf92274f05960673c63d8", "score": "0.7490175", "text": "def echo(str)\n str\nend", "title": "" }, { "docid": "207c90513bacf92274f05960673c63d8", "score": "0.7490175", "text": "def echo(str)\n str\nend", "title": "" }, { "docid": "fd2642f84435f06a8cab20cd8929d6c0", "score": "0.74829555", "text": "def echo string\n string\nend", "title": "" }, { "docid": "a70a1b87a0e6b9248b7d0bb66f4852e4", "score": "0.7433404", "text": "def echo input\n input\nend", "title": "" }, { "docid": "87bab27733749d50600568d03a2442f1", "score": "0.74015254", "text": "def echo (word)\n word\nend", "title": "" }, { "docid": "96d472ecad3d9b0ed70dacdf9b6f5a99", "score": "0.73578787", "text": "def echo(word)\n\treturn word\nend", "title": "" }, { "docid": "96d472ecad3d9b0ed70dacdf9b6f5a99", "score": "0.73578787", "text": "def echo(word)\n\treturn word\nend", "title": "" }, { "docid": "b06c0f31a0d29d2eca039c7c00fa41aa", "score": "0.733254", "text": "def echo (phrase)\n \"#{phrase}\"\nend", "title": "" }, { "docid": "1cf72274c0466267a51e4d904a4d2909", "score": "0.7296073", "text": "def echo(stringy)\n return stringy\nend", "title": "" }, { "docid": "7ca26a528f691822eb7376b6afcec1e6", "score": "0.72595906", "text": "def echo(word)\n\tword\nend", "title": "" }, { "docid": "58716caae6c65b3b6d0afc0ee8b14876", "score": "0.72432745", "text": "def echo(word)\n word\nend", "title": "" }, { "docid": "d708ac07f2b59f33b87a010dcee80777", "score": "0.7243179", "text": "def echo(word)\n word\nend", "title": "" }, { "docid": "ca3c6de517160c6d6b155b742298770d", "score": "0.72152233", "text": "def echo(input)\n input #why doesn't this use puts???\nend", "title": "" }, { "docid": "176e7a4cb556493eac585930361dcd2c", "score": "0.7200329", "text": "def echo( string )\n message string.chomp + \"\\n\"\n end", "title": "" }, { "docid": "3c31c8448959291d78868cdbfe2c2d70", "score": "0.7183735", "text": "def echo(phrase)\n phrase\nend", "title": "" }, { "docid": "686a5d7b4e4c388d621e8cf5606bcf63", "score": "0.7182233", "text": "def echo( word )\n\n\tword\n\nend", "title": "" }, { "docid": "486edae288bc179f33993992f3b65660", "score": "0.715123", "text": "def echo(word)\n word\nend", "title": "" }, { "docid": "764dc3217440ee9e2332d4b9c0bb8719", "score": "0.7000707", "text": "def say(input)\n Kernel.puts(\"==>> #{input} <<==\")\nend", "title": "" }, { "docid": "b2009bab977e7ebc72cc767f4632e41b", "score": "0.697641", "text": "def displays_string(string)\n puts \"#{string}\"\nend", "title": "" }, { "docid": "7d028420d7f4d5c7dd022f214c29a697", "score": "0.6969233", "text": "def echo(text)\n\ttext\nend", "title": "" }, { "docid": "3285d0cb7a455574c1d4410c3c06bdb5", "score": "0.6871478", "text": "def say_hello\n puts \"Hello! What is your name?\"\n input = gets.strip\n puts \"Hi #{input}!\"\nend", "title": "" }, { "docid": "ac1e7a5287e45c5283904fbacbfaf05c", "score": "0.68297035", "text": "def say_hello\n puts \"Whats your name?\"\n name = gets.strip #gets strip from user #strip just takes away the line break \n puts \"Hello #{name}!\"#called interpolation \nend", "title": "" }, { "docid": "769b906348268ae053e46fd27ec6c4a6", "score": "0.6756328", "text": "def echo(value); end", "title": "" }, { "docid": "769b906348268ae053e46fd27ec6c4a6", "score": "0.6756328", "text": "def echo(value); end", "title": "" }, { "docid": "4eac5c1aaf001559124da95a8ba9ca41", "score": "0.6743761", "text": "def echo(value)\n puts \"echo#\" + value.to_s\nend", "title": "" }, { "docid": "e50492938403861e3066952274c2737d", "score": "0.67175096", "text": "def print_string\n puts @input_string\n end", "title": "" }, { "docid": "1e6643ab4ddd7ddb9711b3d9befb831f", "score": "0.6618365", "text": "def show(string)\n puts string\nend", "title": "" }, { "docid": "f754e5febf76eabfc895f052da4438da", "score": "0.65827894", "text": "def say(string)\r\n puts \"#{string}\"\r\nend", "title": "" }, { "docid": "7c50b758e7f4264579e113c4b1ca85a7", "score": "0.6560821", "text": "def echo\n \"$ #{cmd(false)}\"\n end", "title": "" }, { "docid": "f502a5cd6f910ca947d24d2fbb0d6f9c", "score": "0.65039283", "text": "def echo(a)\n a\n end", "title": "" }, { "docid": "5cd555f9e54a31b7fa1ab6b0ebe7473b", "score": "0.64838046", "text": "def echo; end", "title": "" }, { "docid": "10c735b0807cf78457b6cddd0ec98f98", "score": "0.6371343", "text": "def test_echo\n random_message = get_random_string()\n assert_equal(random_message, ChitoCmd.echo(\"echo #{random_message}\"))\n end", "title": "" }, { "docid": "f3bbfa53ae933701592cbe903118fa10", "score": "0.6356726", "text": "def prompt(string)\n puts \"#{string}, tell me a word. -> \"\n answer = gets.to_s.chomp\n puts \"#{answer} is your word.\"\nend", "title": "" }, { "docid": "a2454f65ed48728bba0a136a49296222", "score": "0.6356509", "text": "def echo(message)\n\treturn message\nend", "title": "" }, { "docid": "6c9a5897c3a1acc44308d2c84efbdd8f", "score": "0.63485324", "text": "def echo (x)\n return x\nend", "title": "" }, { "docid": "caffc939be0b10d00efa9899329407b5", "score": "0.6332711", "text": "def echo(message)\n puts message\n end", "title": "" }, { "docid": "7dc041548f117b27214c574317a514f0", "score": "0.62820154", "text": "def output(string)\n puts('===========================================')\n puts(string)\n puts('-------------------------------------------')\nend", "title": "" }, { "docid": "11475a20bb05f42887e1fbf0d58e3745", "score": "0.6278014", "text": "def echo(greeting)\n\tgreeting\nend", "title": "" }, { "docid": "f4c5d650a91d43406a6a752089b96be4", "score": "0.6273129", "text": "def prompt(greeting=\"What do you want me to echo?\")\n puts greeting\n value = STDIN.gets\n print value\nend", "title": "" }, { "docid": "82b558a1e89660020a7acfb0df94464e", "score": "0.62529284", "text": "def echo(value)\n puts \"#{API::API_ECHO_PREFIX}#{value.to_s}#{API::API_CMD_SUFFIX}\"\nend", "title": "" }, { "docid": "5e71023e4eb82d3355201916b3ec00b6", "score": "0.624711", "text": "def ask_user(string)\n print string\n gets.chomp\n end", "title": "" }, { "docid": "0754b9ec50451485028bdc5e506cb2a9", "score": "0.6246183", "text": "def say string\n puts \"=> \" + string\nend", "title": "" }, { "docid": "110d7526a61e10052c650e9f453147f0", "score": "0.6232307", "text": "def output(s)\n puts s\n end", "title": "" }, { "docid": "dc73a9d4b2f3f5af5439c5442043164a", "score": "0.6230256", "text": "def puts(str); end", "title": "" }, { "docid": "dc73a9d4b2f3f5af5439c5442043164a", "score": "0.6230256", "text": "def puts(str); end", "title": "" }, { "docid": "dc73a9d4b2f3f5af5439c5442043164a", "score": "0.6230256", "text": "def puts(str); end", "title": "" }, { "docid": "121ed0326cd88c2a3d0983d57c82458d", "score": "0.6224825", "text": "def say_hello\n puts \"What's your name?\"\n name = gets.strip #gets info from the user. Strip just takes away the line break.\n puts \"Hello #{name}!\" #this is called INTERPOLATION :)\nend", "title": "" }, { "docid": "cc9ba175cb52164c801e743407158f02", "score": "0.6222892", "text": "def echo\n get url(\"echo\")\n end", "title": "" }, { "docid": "f000c36e9dd2c90a38e4c400fc9ba303", "score": "0.6201336", "text": "def say(s)\n puts \"==> \" + s.to_s\nend", "title": "" }, { "docid": "afb94c05db7dd65b321ec4459c985182", "score": "0.61948955", "text": "def puts(string)\n puts expand(string)\n end", "title": "" }, { "docid": "396f83682d87775e27e95acfb62b1369", "score": "0.61840093", "text": "def echo(param = nil)\n send :echo, param\n end", "title": "" }, { "docid": "4bc295d73eb2cfdd42e0228224ad9b77", "score": "0.61687225", "text": "def say(text)\n puts \">> #{text}\"\nend", "title": "" }, { "docid": "706a1a32b5a4f21b68cc36eded2ed6f9", "score": "0.6157528", "text": "def prompt(string)\n puts \">>> #{string}\"\nend", "title": "" }, { "docid": "162229d25f34194562e1f778bb4f6519", "score": "0.61568785", "text": "def message(string)\n puts\n puts \"--> #{ string }\"\nend", "title": "" }, { "docid": "162229d25f34194562e1f778bb4f6519", "score": "0.61568785", "text": "def message(string)\n puts\n puts \"--> #{ string }\"\nend", "title": "" }, { "docid": "211aaa937bb6b6f45095b83aeec9a4b7", "score": "0.61505395", "text": "def say(str)\n return_interface.send(DismalTony::Formatter.format(str, return_interface.default_format))\n end", "title": "" }, { "docid": "86fad5bfc27326861e20fdac6ce49591", "score": "0.61445147", "text": "def get_input(str)\n print str\n STDIN.gets.strip\nend", "title": "" }, { "docid": "86fad5bfc27326861e20fdac6ce49591", "score": "0.61445147", "text": "def get_input(str)\n print str\n STDIN.gets.strip\nend", "title": "" }, { "docid": "700ce5669a53f92dcab888d06920d52d", "score": "0.6134149", "text": "def get_string(prompt)\r\n puts(prompt)\r\n s = gets.chomp()\r\n return s\r\nend", "title": "" }, { "docid": "faa7404a39d2dcc64a13587557be2db9", "score": "0.6132885", "text": "def message(str)\n puts str\n end", "title": "" }, { "docid": "16f83942383c8f40a2f18faea388728f", "score": "0.6118375", "text": "def say(phrase)\n puts phrase\n end", "title": "" }, { "docid": "d5446edb147bb014c4b2c1df2694f60f", "score": "0.611409", "text": "def ask_for(this_kind_of_word)\n puts ''\n print \"Please give me #{this_kind_of_word} ==> \"\n gets.chomp.to_s\nend", "title": "" }, { "docid": "0053e6f505056ac1ce4c7800cc7b915c", "score": "0.6113227", "text": "def echo(*args)\n args\n end", "title": "" }, { "docid": "ce5c17ac47611a0a39c40dff779dbf6e", "score": "0.6106981", "text": "def get_word(word)\n\tputs \"Give me a #{word}.\"\n\tinput = gets.chomp\n\treturn input\nend", "title": "" }, { "docid": "ce5c17ac47611a0a39c40dff779dbf6e", "score": "0.6106981", "text": "def get_word(word)\n\tputs \"Give me a #{word}.\"\n\tinput = gets.chomp\n\treturn input\nend", "title": "" }, { "docid": "8297998cee48f2b1658e46679736c9fa", "score": "0.6104947", "text": "def nombre(string)\n puts \"Hola #{string} como estas?\"\nend", "title": "" }, { "docid": "9632df8ea469228838a4a9cd31fab613", "score": "0.6104021", "text": "def say(string)\n end", "title": "" }, { "docid": "2ee10af7848e63c526bf5b84a241580a", "score": "0.6092914", "text": "def echo(text)\n echothis = Echo.new(text)\n echothis.parseline\n if echothis.detectredirect\n echothis.directtext\n else\n puts echothis.printarray\n end\n end", "title": "" }, { "docid": "3bd34bdbc7315dc15c1d960ae45b409b", "score": "0.6091297", "text": "def prompt(string)\n puts \">> #{string}\"\nend", "title": "" }, { "docid": "3bd34bdbc7315dc15c1d960ae45b409b", "score": "0.6091297", "text": "def prompt(string)\n puts \">> #{string}\"\nend", "title": "" }, { "docid": "3bd34bdbc7315dc15c1d960ae45b409b", "score": "0.6091297", "text": "def prompt(string)\n puts \">> #{string}\"\nend", "title": "" }, { "docid": "3bd34bdbc7315dc15c1d960ae45b409b", "score": "0.6091297", "text": "def prompt(string)\n puts \">> #{string}\"\nend", "title": "" }, { "docid": "3bd34bdbc7315dc15c1d960ae45b409b", "score": "0.6091297", "text": "def prompt(string)\n puts \">> #{string}\"\nend", "title": "" }, { "docid": "3bd34bdbc7315dc15c1d960ae45b409b", "score": "0.6091297", "text": "def prompt(string)\n puts \">> #{string}\"\nend", "title": "" }, { "docid": "3bd34bdbc7315dc15c1d960ae45b409b", "score": "0.6091297", "text": "def prompt(string)\n puts \">> #{string}\"\nend", "title": "" }, { "docid": "3bd34bdbc7315dc15c1d960ae45b409b", "score": "0.6091297", "text": "def prompt(string)\n puts \">> #{string}\"\nend", "title": "" } ]
049da2faf9013df61fbefeaec6cb1c38
Creates a new Super for the rule currently being defined in the grammar. A block may be provided to specify semantic behavior (via ext).
[ { "docid": "764fd52fc70eebc357258c8b4ac2ffb5", "score": "0.68341017", "text": "def sup(&block)\n ext(Super.new, block)\n end", "title": "" } ]
[ { "docid": "2fad3244ba65871efbc44edddc476451", "score": "0.6821774", "text": "def sup(&block)\n ext(Super.new, block)\n end", "title": "" }, { "docid": "4d9776a1d374095d211d8920b714642f", "score": "0.59749925", "text": "def inherit(klass, &block)\n Class.new(klass, &block)\n end", "title": "" }, { "docid": "4d9776a1d374095d211d8920b714642f", "score": "0.59749925", "text": "def inherit(klass, &block)\n Class.new(klass, &block)\n end", "title": "" }, { "docid": "32adb4c77f3b13d43583536fc261167e", "score": "0.5946044", "text": "def initialize_block(...)\n parent << self\n super\n end", "title": "" }, { "docid": "29a7dcc5d60c093d45e140cf3898dfb2", "score": "0.5873726", "text": "def on_super( statement )\n arguments = process_all(statement.children)\n SuperStatement.new( arguments)\n end", "title": "" }, { "docid": "ed54997ed074a85f73676dfcd0263e44", "score": "0.58126456", "text": "def setup_super(rule, name) # :nodoc:\n if Nonterminal === rule\n rule.rules.each { |r| setup_super(r, name) }\n elsif Super === rule\n rule.rule_name = name\n end\n end", "title": "" }, { "docid": "d0f3172487b2efed73c67d373fcaa819", "score": "0.5796102", "text": "def setup_super(rule, name) # :nodoc:\n if Nonterminal === rule\n rule.rules.each {|r| setup_super(r, name) }\n elsif Super === rule\n rule.rule_name = name\n end\n end", "title": "" }, { "docid": "bd033250a7667e08e693cefb8b3a533f", "score": "0.5793706", "text": "def initialize(*args)\n raise TypeError, 'BlockCommand.new should not be called directly' if self.class == BlockCommand\n super\n end", "title": "" }, { "docid": "129a50ef21d2ae58c97261d4032643ae", "score": "0.575848", "text": "def compile_super(scope, args, block = nil)\n method = scope.method.name\n @e.comment(\"super #{method.inspect}\")\n trace(nil,\"=> super #{method.inspect}\\n\")\n ret = compile_callm(scope, :self, method, args, block, true)\n trace(nil,\"<= super #{method.inspect}\\n\")\n ret\n end", "title": "" }, { "docid": "fcb5043dbab08423415e0c552a6d3729", "score": "0.5736684", "text": "def new(name = nil, options = {}, &block)\n name ? supervise_as(name, options, &block) : supervise(options, &block)\n end", "title": "" }, { "docid": "fcb5043dbab08423415e0c552a6d3729", "score": "0.5736684", "text": "def new(name = nil, options = {}, &block)\n name ? supervise_as(name, options, &block) : supervise(options, &block)\n end", "title": "" }, { "docid": "6d03745a2b5b861e713dd4e6077f90ea", "score": "0.56205714", "text": "def compile_super block, source, options\n hierarchy_reg = 'hierarchy'\n # Advance the hierarch search object\n block.add_instr [CALL_NATIVE, hierarchy_reg, 'next']\n\n # Get method name\n block.add_instr [CALL_NATIVE, 'method', 'name']\n method_name_reg = copy_and_return_reg block\n\n # TODO: (super!) will re-use the arguments\n args_reg = compile_args block, source, options, true\n\n block.add_instr [CALL_NATIVE, 'context', 'self']\n\n block.add_instr [CALL_DYNAMIC_METHOD, 'default', method_name_reg, args_reg, hierarchy_reg]\n end", "title": "" }, { "docid": "234351829bf2e7ebffd8079db25260e2", "score": "0.5612387", "text": "def initialize(&aBlock)\n @symbols = {}\n @productions = []\n @parser = RGN::Parser.new\n @visitor2rhs = {}\n @synthetized = {}\n\n if block_given?\n instance_exec(&aBlock)\n grammar_complete!\n end\n end", "title": "" }, { "docid": "e4f0df5d6921843d03c9102a83a57bb2", "score": "0.5611172", "text": "def new(name, *args, &blk)\n parser = grammar.const_get(name)\n grammar.parser(parser, *args, &blk)\n end", "title": "" }, { "docid": "2f6cb1b69c77c5e62e8467d3dc5b498e", "score": "0.55883735", "text": "def create_extend(type, &block)\n new_extend = RbsGenerator::Extend.new(\n generator,\n type: type,\n &block\n )\n move_next_comments(new_extend)\n children << new_extend\n new_extend\n end", "title": "" }, { "docid": "ec9ea4c8a8f7a99e1d134c02f1aa7a4b", "score": "0.556395", "text": "def block(block)\n composition.new_component(:__base__, &block)\n true\n end", "title": "" }, { "docid": "b279c02c306e5ffe80314689dbb5c79d", "score": "0.55519944", "text": "def initialize(type, name = :\"\", &ruby_block)\n # Initialize the behavior.\n super(type,name)\n\n unless name.empty? then\n # Named block, set the hdl-like access to the block.\n obj = self # For using the right self within the proc\n High.space_reg(name) { obj }\n end\n\n # Creates the namespace.\n @namespace = Namespace.new(self)\n\n build(&ruby_block)\n end", "title": "" }, { "docid": "96418e7983709a31f32e996b59203665", "score": "0.5551544", "text": "def parse_block(**opts, &block)\n sub_pattern = self.class.new(&block)\n append_clause sub_pattern.parse, opts\n end", "title": "" }, { "docid": "5ea0b25a3d4f2909c717a4611c2027c5", "score": "0.5536659", "text": "def subclass(match, description, options, helpers, &block); end", "title": "" }, { "docid": "bf23d9ccc426778d1786ad8e5ebe12b4", "score": "0.5520515", "text": "def initialize(*args, &block)\n options = args.extract_options!\n @block = block_given? ? block : options[:block]\n raise ArgumentError, 'block must be provided' unless @block\n @parent = options[:parent]\n end", "title": "" }, { "docid": "94bfd70e38828adc228db2bc67659d74", "score": "0.55188817", "text": "def initialize(&block)\n super\n\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "626c7447b7c4a140f0111d1fd915c9e9", "score": "0.5503278", "text": "def visit_super(node); end", "title": "" }, { "docid": "3e94f377530bff3712340b038cc7bd46", "score": "0.54951936", "text": "def superscript\n style = CharacterStyle.new\n style.superscript = true\n if block_given?\n apply(style) {|node| yield node}\n else\n apply(style)\n end\n end", "title": "" }, { "docid": "0b13a8ca7a0d26fbb264cd41d2874413", "score": "0.5478206", "text": "def initialize(grammar, name, block)\n @grammar = grammar\n @block = block\n @node = TmGrammar::Node::Capture.new\n @node.name = name\n end", "title": "" }, { "docid": "da3123c1b7161d7da8998e0d0c447415", "score": "0.54417473", "text": "def rule(name, &block)\n grammar.define_rule(name, block)\n end", "title": "" }, { "docid": "0796350f29be34a7c5b3ab251051e6b7", "score": "0.5436311", "text": "def new(*args, &block)\n base_instance.new(*args, &block)\n end", "title": "" }, { "docid": "925b870661903a7cd52cced1c5338146", "score": "0.54224324", "text": "def on_zsuper\n return Token::KeywordToken.new(\n :name => 'super',\n :line => lineno,\n :column => column,\n :code => code(lineno)\n )\n end", "title": "" }, { "docid": "882502cdfd78aa6f01481bb4de7a10b1", "score": "0.5422188", "text": "def on_zsuper exp\n SuperStatement.new([])\n end", "title": "" }, { "docid": "32effb9d8fdba1329cdc8882291fee22", "score": "0.53907907", "text": "def on_zsuper\n keyword = consume_keyword(:super)\n\n ZSuper.new(location: keyword.location)\n end", "title": "" }, { "docid": "142e0bdf10396d4b18ec2be1a5881b70", "score": "0.5384042", "text": "def super_instruct(*args)\n opts = (Hash === args.last) ? args.last : {}\n result = create_result_if_needed opts\n\n add_instruction(:super, result, *args)\n add_potential_raise_edge\n result\n end", "title": "" }, { "docid": "1b846d15c0b60474e3c3ba284f7c443f", "score": "0.53826934", "text": "def create_extend(name, &block)\n new_extend = RbiGenerator::Extend.new(\n generator,\n name: name,\n &block\n )\n move_next_comments(new_extend)\n children << new_extend\n new_extend\n end", "title": "" }, { "docid": "42aa7ff3ab4d820885d3f353056cb571", "score": "0.5357091", "text": "def initialize(scope_name, block)\n @node = TmGrammar::Node::Grammar.new(scope_name)\n @block = block\n end", "title": "" }, { "docid": "dfb175d8e705d530f6db89a2c7217819", "score": "0.53472066", "text": "def +(block)\n SerialBlock.new(self, block)\n end", "title": "" }, { "docid": "f83bd6aed6545f5577e33611b928deb6", "score": "0.5339823", "text": "def initialize(&block)\n\n @root_set = RuleSet.new\n @set = RuleSet.new\n @current_set = @set\n\n add_rules(&block)\n end", "title": "" }, { "docid": "e997d167464be890f1d0945e288b7aa6", "score": "0.5333233", "text": "def block_node\n parent if block_literal?\n end", "title": "" }, { "docid": "4cfeb848d9cbf18e8282cd9974466f4d", "score": "0.5323369", "text": "def initialize(block)\n # Initialize the sensitivity list.\n @events = []\n # Check and set the block.\n return unless block # No block case\n # There is a block\n self.block = block\n # unless block.is_a?(Block)\n # raise AnyError, \"Invalid class for a block: #{block.class}.\"\n # end\n # # Time blocks are only supported in Time Behaviors.\n # if block.is_a?(TimeBlock)\n # raise AnyError, \"Timed blocks are not supported in common behaviors.\"\n # end\n # # Set the block's parent.\n # block.parent = self\n # # And set the block\n # @block = block\n end", "title": "" }, { "docid": "3c0f7793f21e9e9e814a164704dbf106", "score": "0.53035396", "text": "def define(&block)\n if block && block.arity > 0\n yield self\n elsif block\n self.instance_eval(&block)\n end\n self\n end", "title": "" }, { "docid": "0590888b3fc7a2aa58a35ad1690a4576", "score": "0.5302331", "text": "def initialize(&block)\n instance_eval do\n block.call(self)\n end\n end", "title": "" }, { "docid": "93e84060580637c239aa6edfb0d8156e", "score": "0.52961814", "text": "def sub(name = :\"\", &ruby_block)\n # Ensure there is a block.\n ruby_block = proc {} unless block_given?\n self.add_block(self.mode,name,&ruby_block)\n end", "title": "" }, { "docid": "5f51f2d5c507ae5310ef7e69beb0c5a7", "score": "0.5292059", "text": "def new(parent = nil, opts = {})\n caching(opts) do\n # could all this now live in initialize?\n obj = Type::Node[type].new(parent&.node, namespace: registry_name, id: id)\n node = super(parent, obj)\n node.assign(opts)\n node.before_define\n node.define\n node.after_define\n node\n end\n end", "title": "" }, { "docid": "0ae3f719b91262f2e47f3d8b822bb4c2", "score": "0.5287358", "text": "def visit_super(node)\n if node.arguments.is_a?(Args)\n s(\n :super,\n visit_all(node.arguments.parts),\n smap_keyword_bare(\n srange_length(node.start_char, 5),\n srange_node(node)\n )\n )\n else\n case node.arguments.arguments\n when nil\n s(\n :super,\n [],\n smap_keyword(\n srange_length(node.start_char, 5),\n srange_find(node.start_char + 5, node.end_char, \"(\"),\n srange_length(node.end_char, -1),\n srange_node(node)\n )\n )\n when ArgsForward\n s(\n :super,\n [visit(node.arguments.arguments)],\n smap_keyword(\n srange_length(node.start_char, 5),\n srange_find(node.start_char + 5, node.end_char, \"(\"),\n srange_length(node.end_char, -1),\n srange_node(node)\n )\n )\n else\n s(\n :super,\n visit_all(node.arguments.arguments.parts),\n smap_keyword(\n srange_length(node.start_char, 5),\n srange_find(node.start_char + 5, node.end_char, \"(\"),\n srange_length(node.end_char, -1),\n srange_node(node)\n )\n )\n end\n end\n end", "title": "" }, { "docid": "da9a67dc7af8da6fab23a7f1726682f2", "score": "0.52736574", "text": "def begin(match = nil, &block)\n if block_given?\n pattern_object.define_begin_match(block)\n else\n node.begin = match\n end\n end", "title": "" }, { "docid": "bc4b7e21a6ecdb60d2b026d2de19b0d5", "score": "0.526206", "text": "def initialize( name , supe , body)\n @name , @super_class_name = name , supe\n case body\n when MethodStatement , SendStatement\n @body = Statements.new([body])\n when Statements\n @body = body\n when nil\n @body = Statements.new([])\n else\n raise \"what body #{body.class}:#{body}\"\n end\n end", "title": "" }, { "docid": "28cc04f10e4c91c7fac92316ffd7d8cf", "score": "0.5260457", "text": "def new(*args)\n parsed_node = Treetop::Runtime::SyntaxNode.new(*args)\n\n node_name, node_class = @node_name, @node_class # local scope for the block below\n\n # so the node knows how to build itself:\n parsed_node.meta_def :build do\n node_class.new(self)\n end\n\n # so the node can be filtered based on what kind of AST node it will build\n parsed_node.meta_def :node_to_build do\n node_name\n end\n\n parsed_node\n end", "title": "" }, { "docid": "7f269fc148782bc38141adecb99472ba", "score": "0.5252666", "text": "def initialize(&block)\n create_lspace.enter do\n block.call self\n end\n end", "title": "" }, { "docid": "97f730317782169ed37f19b89747a24e", "score": "0.5251389", "text": "def initialize(mode, name=:\"\", &ruby_block)\n # Initialize the block.\n super(mode,name)\n\n unless name.empty? then\n # Named block, set the hdl-like access to the block.\n obj = self # For using the right self within the proc\n High.space_reg(name) { obj }\n end\n\n # Creates the namespace.\n @namespace = Namespace.new(self)\n\n # puts \"methods = #{self.methods.sort}\"\n build(&ruby_block)\n end", "title": "" }, { "docid": "5dd4261acf120f2f3c3664ef37f2ba8e", "score": "0.5243198", "text": "def block\n\t\tdeclaration_nodes = declarations\n\t\tcompound_statement_node = compound_statement\n\t\tBlock.new(declaration_nodes, compound_statement_node)\n\tend", "title": "" }, { "docid": "6d15bec5e44d3b78d6e41f6195442c84", "score": "0.5241948", "text": "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", "title": "" }, { "docid": "feadde7bcc216ff569cd475b6c212d4a", "score": "0.523988", "text": "def initialize( &block )\n # set some defaults\n group( :user )\n opts( \"\" )\n \n self.instance_exec( &block ) if block_given?\n self # explicitly return. Thought that wasn't necessary, but...\n end", "title": "" }, { "docid": "e8e5eb40ffacd6a4be700bdabb0e3d1c", "score": "0.52392495", "text": "def syntax(name, &block)\n self[name] = Syntax.new(self, &block)\n end", "title": "" }, { "docid": "fa878c84e9a82a43a0f75d3f9eab2fd7", "score": "0.5234082", "text": "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "fa878c84e9a82a43a0f75d3f9eab2fd7", "score": "0.5234082", "text": "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "53e7af5cf57bb4589ba1fbb30b112625", "score": "0.52331865", "text": "def __create_block(name, location = nil, &block)\n Bade::Runtime::Block.new(name, location, self, &block)\n end", "title": "" }, { "docid": "efd8cfd7791dfa201b641c9b78ec019b", "score": "0.5222779", "text": "def initialize(mode, &ruby_block)\n # Create a default par block for the behavior.\n block = High.make_time_block(mode,&ruby_block)\n # Initialize the behavior with it.\n super(block)\n end", "title": "" }, { "docid": "93e1f5fb58716037acc17150fa846a58", "score": "0.5219254", "text": "def add_rules(&block)\n\n instance_eval(&block) if block\n\n self\n end", "title": "" }, { "docid": "c74fde0775e7f76427781728b1017f7d", "score": "0.52179253", "text": "def initialize(name, content = nil, &block)\n @name = name\n return @content = content unless content.nil?\n return unless block_given?\n @arity = block.arity\n if @arity <= 0\n @context = eval('self', block.binding)\n instance_eval(&block)\n else\n yield self\n end\n end", "title": "" }, { "docid": "f87113056dcfef9ed129633facb51c52", "score": "0.5215285", "text": "def as( &block )\n assert(@entity.nil?, \"you can define the entity using one \\\"each\\\" or \\\"as\\\" clause only\")\n assert(@parent.nil?, \"derived entities cannot have a base entity\" )\n \n @entity = Model::DerivedEntity.new(@name, block)\n @schema.entities.register(@entity)\n end", "title": "" }, { "docid": "ec0d2d07690e20be51d1067cb7e08e6b", "score": "0.52127695", "text": "def initialize(&block)\n @block = block\n end", "title": "" }, { "docid": "7809de8e079ecac0d3d915c5a96cc808", "score": "0.5212344", "text": "def initialize()\n\t\tyield self if block_given?\n\t\tdefine\n end", "title": "" }, { "docid": "d5743f0f8a11e1c3d8171e1a34a06f1a", "score": "0.52115154", "text": "def initialize(blocks=HParser::Parser.default_parser,\n inlines=HParser::Inline::Parser.new)\n @blocks = Many1.new(Concat.new(Or.new(*blocks),\n Skip.new(Empty)))\n @inlines = inlines\n end", "title": "" }, { "docid": "21c0d537b9de21be82c535475c112a83", "score": "0.5208996", "text": "def new_block(x, y, z, a, b)\n @chain.push(Block.new(x, y, z, a, b))\n end", "title": "" }, { "docid": "acf17c99b677fba7ebc7d4d4c9533a7d", "score": "0.5203271", "text": "def create_rule(*args, &block); end", "title": "" }, { "docid": "54f947aad5c417eaa4fc9af109338400", "score": "0.52008814", "text": "def inherits_from(parent, *args, &block)\n eval(\"Proc.new { |#{args.first.keys.map { |k| k.to_s }.join ','}| #{parse_method method(parent).to_proc.source_location}\\n#{parse_method block.source_location} }\").call args\n end", "title": "" }, { "docid": "e6cba0b12abe84e3e127d4e116738216", "score": "0.519947", "text": "def define_rule(name, block)\n pattern_node = TmGrammar::Pattern.new(node, block).evaluate\n node.add_rule(name, pattern_node)\n end", "title": "" }, { "docid": "fad2ecdab673a0e027614e2e6bfd268b", "score": "0.5198408", "text": "def create(&block)\n Class.new(AdHoc, &block)\n end", "title": "" }, { "docid": "fcf1a615e217b70a064cd341dafa2413", "score": "0.5191613", "text": "def t__30!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n type = T__30\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 19:9: 'extends'\n match( \"extends\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n end", "title": "" }, { "docid": "41ed4f375c62d023abd28eed49c954da", "score": "0.51878583", "text": "def syntaxer(&block)\n self.instance_eval(&block)\n end", "title": "" }, { "docid": "031377417c3e9adb2568342a06db0461", "score": "0.5184169", "text": "def do_extend(extends)\n node = dup\n node.resolved_rules = resolved_rules.do_extend(extends)\n node\n end", "title": "" }, { "docid": "031377417c3e9adb2568342a06db0461", "score": "0.5184169", "text": "def do_extend(extends)\n node = dup\n node.resolved_rules = resolved_rules.do_extend(extends)\n node\n end", "title": "" }, { "docid": "935fe2d80475f682299bd49904bb9c6b", "score": "0.51779777", "text": "def _klass_new(*args, &block)\n inst = super()\n inst._set_self(_self)\n if(args.first.is_a?(::Hash))\n inst._load(args.first)\n end\n if(block)\n inst.build!(&block)\n end\n inst\n end", "title": "" }, { "docid": "d8bddf4501c0ab461df54ba40c2ba18f", "score": "0.51598865", "text": "def initialize(&block)\n yield self if block_given?\n end", "title": "" }, { "docid": "d8bddf4501c0ab461df54ba40c2ba18f", "score": "0.51598865", "text": "def initialize(&block)\n yield self if block_given?\n end", "title": "" }, { "docid": "b38fb6b3be868d885d36c9b7ec585673", "score": "0.5148188", "text": "def initialize(name,&ruby_block)\n # Initialize the type structure.\n super(name)\n\n # Sets the block to execute when instantiating the type.\n @instance_proc = ruby_block\n end", "title": "" }, { "docid": "ab74629f1a93ccc35982fb482e7f35f7", "score": "0.5146751", "text": "def initialize(klass, &block)\n @rules = []\n @klass = klass\n instance_eval(&block)\n end", "title": "" }, { "docid": "abcd282ee3c1d025e7f48bc3a4651a44", "score": "0.5144518", "text": "def new!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n\n\n\n type = NEW\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 69:6: 'new'\n match( \"new\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n\n\n end", "title": "" }, { "docid": "130b3e39bb474140ac5286c7249b7ea7", "score": "0.514392", "text": "def initialize(base, name, &block)\n @base = base\n @name = name\n @expansions = {}\n @attributes = {:basic => [], :full => [], :expansion => []}\n @dsl = Moonrope::DSL::StructureDSL.new(self)\n @dsl.instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "97085533a6040d6de09256ff92c126cb", "score": "0.5135924", "text": "def initialize(grammar = '')\n @grammar = grammar == '' ? yield(GenericBlockToHashCreator.new) : grammar.dup\n end", "title": "" }, { "docid": "9102fa935c7ce0e04861a363f1fd9b89", "score": "0.5126896", "text": "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n\n begin\n # at line 100:8: ( paragraph | div | table )\n alt_17 = 3\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == TAG )\n look_17_1 = @input.peek( 2 )\n\n if ( look_17_1 == DOWN )\n case look_17 = @input.peek( 3 )\n when P then alt_17 = 1\n when DIV then alt_17 = 2\n when TABLE then alt_17 = 3\n else\n raise NoViableAlternative( \"\", 17, 2 )\n end\n else\n raise NoViableAlternative( \"\", 17, 1 )\n end\n else\n raise NoViableAlternative( \"\", 17, 0 )\n end\n case alt_17\n when 1\n # at line 100:10: paragraph\n @state.following.push( TOKENS_FOLLOWING_paragraph_IN_block_596 )\n paragraph\n @state.following.pop\n\n when 2\n # at line 101:10: div\n @state.following.push( TOKENS_FOLLOWING_div_IN_block_607 )\n div\n @state.following.pop\n\n when 3\n # at line 102:10: table\n @state.following.push( TOKENS_FOLLOWING_table_IN_block_618 )\n table\n @state.following.pop\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 16 )\n\n end\n \n return \n end", "title": "" }, { "docid": "222a29bf2fb4f383a7abe1edb312baa0", "score": "0.51260656", "text": "def initialize(*args, &block)\n #p [:init, 1, args, block]\n if block_given?\n #p [:init, 2]\n original_block = block\n block = proc { |index|\n #p [:init, 3, index]\n normalize_value(original_block[normalize_index(index)])\n }\n #p [:init, 4, block]\n end\n replace(super(*args, &block))\n end", "title": "" }, { "docid": "a0ff2f9f9a580dba95f79e77d34ed6c9", "score": "0.5117904", "text": "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n\n\n begin\n # at line 233:5: START ( estatutes )* R_END\n match( START, TOKENS_FOLLOWING_START_IN_block_1176 )\n # at line 233:11: ( estatutes )*\n while true # decision 22\n alt_22 = 2\n look_22_0 = @input.peek( 1 )\n\n if ( look_22_0 == FOR || look_22_0.between?( ID, IF ) || look_22_0 == INPUT || look_22_0 == PRINT || look_22_0 == RETURN || look_22_0 == WHILE )\n alt_22 = 1\n\n end\n case alt_22\n when 1\n # at line 233:11: estatutes\n @state.following.push( TOKENS_FOLLOWING_estatutes_IN_block_1178 )\n estatutes\n @state.following.pop\n\n else\n break # out of loop for decision 22\n end\n end # loop for decision 22\n\n match( R_END, TOKENS_FOLLOWING_R_END_IN_block_1181 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n\n end\n\n return \n end", "title": "" }, { "docid": "b4aa073ae27ae68454e3201b1bf020eb", "score": "0.51144713", "text": "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "b4aa073ae27ae68454e3201b1bf020eb", "score": "0.51144713", "text": "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "6f394ff31537eb9169c3c084fd1a4b35", "score": "0.51052356", "text": "def define(&block)\n Class.new(Definition, &block)\n end", "title": "" }, { "docid": "70b6926434688b928f8eef80c39ab077", "score": "0.5104288", "text": "def initialize(attributes = {}, &block)\n @attributes = defaults.merge!(attributes)\n @parent = @attributes[:parent]\n\n if block_given?\n @self_before_instance_eval = eval('self', block.binding)\n\n instance_eval(&block)\n end\n end", "title": "" }, { "docid": "1f307d674eedc76758737a8005767c5d", "score": "0.51022154", "text": "def new(*args, &block)\n scoping { @klass.new(*args, &block) }\n end", "title": "" }, { "docid": "1f307d674eedc76758737a8005767c5d", "score": "0.51022154", "text": "def new(*args, &block)\n scoping { @klass.new(*args, &block) }\n end", "title": "" }, { "docid": "3c65897f835422ac8680dae19eb9a54e", "score": "0.5098106", "text": "def styleguide_extend_block(section, *parents, &block)\n block_html = capture(&block)\n content = section_modifiers(parents).map{ |m|\n block_html.gsub(\"$modifier_class\", m +\" $modifier_class\").strip\n }.join(\"\\n\")\n @section = styleguide.section(section)\n render 'kss/shared/styleguide_block', :section => @section, :example_html => content\n end", "title": "" }, { "docid": "82f2af4c85921338aa9887dd12c5a882", "score": "0.5093423", "text": "def create_block_from_dup_alt(alt)\n nalt = GrammarAST.dup_tree_no_actions(alt, nil)\n blk = self.attr_ast_factory.make((ASTArray.new(3)).add(self.attr_ast_factory.create(BLOCK, \"BLOCK\")).add(nalt).add(self.attr_ast_factory.create(EOB, \"<end-of-block>\")))\n return blk\n end", "title": "" }, { "docid": "550927cf837ee659c3a03f8438108318", "score": "0.5089889", "text": "def initialize(hash = {}, &block)\n @block = block\n super\n end", "title": "" }, { "docid": "b7b93c61bb4cf765916525a01c193a44", "score": "0.50888854", "text": "def initialize(parent, **options, &block)\n @parent = parent\n @children = []\n\n @options = options\n\n if block_given?\n case block.arity\n when 1 then block.call(self)\n else instance_eval(&block)\n end\n end\n end", "title": "" }, { "docid": "98229ae9521bbd64fcab166fd8cf6707", "score": "0.5086329", "text": "def new(&block)\n Builder.new(&block).to_transport\n end", "title": "" }, { "docid": "98229ae9521bbd64fcab166fd8cf6707", "score": "0.5086329", "text": "def new(&block)\n Builder.new(&block).to_transport\n end", "title": "" }, { "docid": "7bcf5497c8361955e6765643783e5959", "score": "0.50843906", "text": "def parse(*args, &block)\n super(*args, &block)\n @object\n end", "title": "" }, { "docid": "04bb61e00b1bf548ade99e5eaf7ad718", "score": "0.5084253", "text": "def initialize(name, type=:Normal, &block)\r\n @name, @type, @block = name, type, block\r\n end", "title": "" }, { "docid": "a2c5f56727aa5204db1aeb2ae6863d2e", "score": "0.508419", "text": "def initialize(ctx = nil, &block)\n self.root = Saxxy::Context.new\n @ctx = ctx || eval(\"self\", block.binding)\n eval_subtree!(&block)\n end", "title": "" }, { "docid": "f0724c094e43ae15560f3d52210bed1c", "score": "0.5068849", "text": "def new_block name\n new_b = Block.new( name , @function , @next )\n @next = new_b\n return new_b\n end", "title": "" }, { "docid": "e84a570a8424979cf22cdab28b48bc2f", "score": "0.50650924", "text": "def initialize pattern, &block\n @pattern = pattern\n @block = block\n end", "title": "" }, { "docid": "e84a570a8424979cf22cdab28b48bc2f", "score": "0.50650924", "text": "def initialize pattern, &block\n @pattern = pattern\n @block = block\n end", "title": "" }, { "docid": "1e0ddbc92521fdb10ef12a53f18ca969", "score": "0.50536704", "text": "def new(_options = {}, &_block)\n raise \"implement me!\"\n end", "title": "" }, { "docid": "3e08ca068c62bca781a85b26b00eadff", "score": "0.50499076", "text": "def parse(&block)\n self.instance_eval(&block)\n end", "title": "" } ]
52ceb63468a23fd1c77ac27182eadb05
test if the user can follow another user and create the relationship method will throw an exception if not possible
[ { "docid": "769736433c7085012ffa7838241c96f1", "score": "0.0", "text": "def test_follow_user\n assert_raise {users(:testUser_1).follow_user(users(:testUser2))}\n assert_raise {users(:testUser_1).follow_user(nil)}\n assert_raise {users(:testUser_1).follow_user(users(:testUser1))}\n assert_nothing_raised {users(:testUser_2).follow_user(users(:testUser_1))}\n end", "title": "" } ]
[ { "docid": "b1225c0c8dd7827bb9570b584572bec3", "score": "0.77791286", "text": "def follow!(other_user)\n relationships.create!(followed_id:other_user.id)\n end", "title": "" }, { "docid": "9f6d7a23bdb6e4b06feb50e47a25e4cf", "score": "0.77761656", "text": "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "9f6d7a23bdb6e4b06feb50e47a25e4cf", "score": "0.77761656", "text": "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "9f6d7a23bdb6e4b06feb50e47a25e4cf", "score": "0.77761656", "text": "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "9f6d7a23bdb6e4b06feb50e47a25e4cf", "score": "0.77761656", "text": "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "9f6d7a23bdb6e4b06feb50e47a25e4cf", "score": "0.77761656", "text": "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "26f0ad3f1139f23372caa2c64a2c276f", "score": "0.77560645", "text": "def follow!(other_user)\n self.relationships.create!(followed_id: other_user.id) # The follow! method calls create! through the relationships association to create the following relationship.\n end", "title": "" }, { "docid": "524b370b9335c5b185b41b39d03100fe", "score": "0.7743387", "text": "def follow!(other_user)\n active_relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "c150252185be1fc3523d429be06225e5", "score": "0.7723818", "text": "def follow(other_user)\n if other_user.public_profile # if the other user is a public user, auto-confirm\n active_relationships.create(followed_id: other_user.id, confirmed: true)\n else\n active_relationships.create(followed_id: other_user.id)\n end\n end", "title": "" }, { "docid": "069ed8c5350830dc8dea94ca777b7c32", "score": "0.7722278", "text": "def follow!(user)\n relationships.create!(:followed_id => user.id)\n end", "title": "" }, { "docid": "f779e5d7c3b0a27156403ae0779721fb", "score": "0.77168185", "text": "def follow!(other_user)\r\n relationships.create!(followed_id: other_user.id)\r\n end", "title": "" }, { "docid": "ad04c0799f35f0877aef6fa7114b7d6f", "score": "0.76977646", "text": "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "f9931d3488434569f50070461d0fe3e6", "score": "0.76698786", "text": "def follow(other_user)\n followed_user_relationships.create(followed_user: other_user)\n end", "title": "" }, { "docid": "c194ebd67a66fd5c688cf7b17d118ac5", "score": "0.764319", "text": "def follow!(other_user)\n active_relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "3337b3a99a6fee197619364a77e45467", "score": "0.76187545", "text": "def follow(other_user)\n #active relationships creates a follower_id, and this creates an active \n #relationship associaeted with user\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "351760146a926bf64ca0afe4df9b5929", "score": "0.7618101", "text": "def follow(other_user)\r\n active_relationships.create(followed_id: other_user.id) \r\n end", "title": "" }, { "docid": "89f53c986b18984dbe83cb0275bbddc1", "score": "0.76130193", "text": "def follow!(other_user)\n\trelationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "35c04d8b0bd64a37e1fa511c9ae5e0cb", "score": "0.7603788", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\nend", "title": "" }, { "docid": "304b42e0dae65b40e14ab20757263133", "score": "0.7593829", "text": "def follow(other_user)\n follow_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "9bb3f0a1b49e98ea2248badac5428ec8", "score": "0.7590611", "text": "def follow!(other_user)\n\t\trelationships.create!(followed_id: other_user.id)\n\tend", "title": "" }, { "docid": "9bb3f0a1b49e98ea2248badac5428ec8", "score": "0.7590611", "text": "def follow!(other_user)\n\t\trelationships.create!(followed_id: other_user.id)\n\tend", "title": "" }, { "docid": "04ff1f82c28f025dd3f2b9d7707585e9", "score": "0.75794196", "text": "def follow(other_user)\n relationships.create!(followed_id: other_user.id) # whoever we follow, we get their ID\n # current user is FLLOWER and the other user is FOLLOWED\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "36a9e1443c1c8f03e98a844dbee98352", "score": "0.75625646", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "7026a273823713283591d88cc1b559ce", "score": "0.75619835", "text": "def follow(user)\n\n following_relationships.create(following_id: user.id)\n end", "title": "" }, { "docid": "fc8913934bdf768a98a98569f18e8ed3", "score": "0.7516823", "text": "def ask_follow(other_user)\n\t\tpended_relationships.create(followed_id: other_user.id)\n\tend", "title": "" }, { "docid": "a96f1aa11f1627bb8863982193132371", "score": "0.7506455", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id) # current user follows the user he wants to follow.\n end", "title": "" }, { "docid": "e8468d54d5da87340f6d49732f45e77d", "score": "0.7498035", "text": "def follow(user)\n if user and user.is_registered and self.is_registered and !self.followees.find_by_id(user.id) and user.id != self.id\n self.followees << user\n self.save()\n else\n false\n end\n end", "title": "" }, { "docid": "bb025db4aed18a5f4d0f358178d6ed4d", "score": "0.74902433", "text": "def follow(user_id) \n following_relationships.create(following_id: user_id)\n end", "title": "" }, { "docid": "ceaf9e1dbc2f3bde47562c18ddf6c39a", "score": "0.7468219", "text": "def follow(user)\n if can_follow?(user)\n self.followeds << user\n return true\n end\n false\n end", "title": "" }, { "docid": "7afbe1a6a959502e5340ffaf3f888d79", "score": "0.7441316", "text": "def create\n # If it is a login function that you created yourself, you should have implemented it yourself\n # logged_in?メソッドを使用して、ログイン時のみFollowできるようにする。\n if logged_in?\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n end\n end", "title": "" }, { "docid": "2296bbefdda8d9bc186599678252e296", "score": "0.7425927", "text": "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "title": "" }, { "docid": "22be9a868ef12e7da85f4583a747b335", "score": "0.7423776", "text": "def follow(user)\n active_relationships.create(followed_id: user.id)\n end", "title": "" }, { "docid": "a446a3e590587a6ba297574b1810ae41", "score": "0.74181896", "text": "def follow!(other_user)\n # Set the attr_accessible in new row\n self.relationships.create!(followed_id: other_user.id)\n end", "title": "" }, { "docid": "4256c34b6cd5af1441473ef302608f02", "score": "0.74095696", "text": "def follow(other_user)\n # Relationship.new(follower_id: self.id, followed_id: user.id)\n # `active_relationships` is another name for `Relationship` model for active relationship (as described above)\n active_relationships.create(followed_id: other_user.id) #follower_id is automatically set, e.g. gai.id, and kathy.id is followed_id\n end", "title": "" }, { "docid": "aa1947f30204741a1ad23768a4761f4e", "score": "0.74043214", "text": "def follow(user_id) \n following_relationships.create(following_id: user_id, follower_id: self.id)\n end", "title": "" }, { "docid": "ea5e3f1787dce1215a510d09e6cf38d2", "score": "0.73937696", "text": "def create\r\n @user = User.find(params[:relationship][:followed_id])\r\n current_user.follow_confirm!(@user)\r\n @user.follow!(current_user)\r\n redirect_to :back\r\n end", "title": "" }, { "docid": "458cdd41f0738ceb94677a4dc0a3e56e", "score": "0.73744726", "text": "def follow(other_user)\n\t\tactive_relationships.create(followed_id: other_user.id)\n\tend", "title": "" }, { "docid": "458cdd41f0738ceb94677a4dc0a3e56e", "score": "0.73744726", "text": "def follow(other_user)\n\t\tactive_relationships.create(followed_id: other_user.id)\n\tend", "title": "" }, { "docid": "0ac7e7820c1f89dbb1b67756334b4102", "score": "0.7344851", "text": "def create\n #--! If statement needed for if the follow works? !--#\n current_user.follow!(@user)\n redirect_to :back\n Activity.add(current_user, Activity::NEW_RELATIONSHIP, @user) # record the activity \n end", "title": "" }, { "docid": "9aae0165b58dfe9d564e6cbf4f0e78b0", "score": "0.73411834", "text": "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n redirect_to @user\n end", "title": "" }, { "docid": "2803f5b8bdb2cc51a5cb4be1b51d3245", "score": "0.7338523", "text": "def create\n # If it's a self-created login feature, you should have implemented your own\n # Use the logged_in? method to make it possible to follow only when logged in.\n if user_signed_in?\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n end\n # FollowMailer.follow_mail(@user).deliver\n end", "title": "" }, { "docid": "2d616c602fdb024efcec794f3638ba8e", "score": "0.73087865", "text": "def follow(other_user)\n if (self == other_user) || other_user.blocked?(self)\n false\n else\n if blocked?(other_user)\n # active_blacklists.find_by(blocked_id: other_user.id).destroy\n unblock other_user\n end\n\n active_relationships.create(followed_id: other_user.id)\n end\n end", "title": "" }, { "docid": "f8443ce3f507355280a9f6354814bea1", "score": "0.73055893", "text": "def follow(user)\n \n unless user.nil?\n \n if !self.follows?(user)\n \n UserConnection.create({\n :user_id => self.id,\n :connected_to_user_id => user.id\n })\n \n end\n \n end\n \n end", "title": "" }, { "docid": "b34149a3652584e12f9bd0a8111098d2", "score": "0.73010254", "text": "def follow(user_id)\n following_relationships.create(following_id: user_id)\n end", "title": "" }, { "docid": "b34149a3652584e12f9bd0a8111098d2", "score": "0.73010254", "text": "def follow(user_id)\n following_relationships.create(following_id: user_id)\n end", "title": "" }, { "docid": "f04a6d49606c1d8006f115b99760a01f", "score": "0.72816324", "text": "def follow\n\t\tputs \"Testing user follow functionality\"\n\t\t# Find the original user\n\t\tuser = User.find_by(id:@id)\n\t\t# Create a second user\n\t\tuser2 = User.create()\n\t\t@id2 = user2.id\n\t\t# Make the second user follow the first user\n\t\tuser.followers.create(user_id:@id, follower_id:@id2)\n\t\t# Check that user2 follows\n\t\traise \"User follow test failed \" unless user.followers.first.follower_id == @id2 and user.followers.first.user_id == @id\n\t\tputs \"User follow test passed\"\n\tend", "title": "" }, { "docid": "1376c3776987ea2b4c5a5740ff7a3d32", "score": "0.72454727", "text": "def can_follow?(user)\n self.id != user.id && !following?(user)\n end", "title": "" }, { "docid": "3baa8decc959ed1cf4eed994a0a3af38", "score": "0.72266436", "text": "def follow(user)\n return if user == self\n find_follower(user) || Follower.create(user: user, follower: self)\n end", "title": "" }, { "docid": "021391bd52b2415c79103dcb6eeb5abd", "score": "0.7225211", "text": "def create \n @relationship = current_user.relationships.new(friend_id: params[:friend_id])\n if @relationship.save\n redirect_to request.referrer, notice: \"Followed successfully.\"\n else\n redirect_to request.referrer, notice: \"Unable to follow\"\n end\n end", "title": "" }, { "docid": "ffc53c4335189ce7d125a47fbdcf51c8", "score": "0.72127604", "text": "def create # follow a user\n current_user.follow(@user)\n redirect_to user_path(@user)\n end", "title": "" }, { "docid": "9a7b8b6f884151d0456f9603e65bf0f8", "score": "0.7207425", "text": "def create\n user = User.find(params[:id])\n if curent_user.following?(user)\n @entity=user #entity disini berarti user yang di follow si current user! BUKAN CURENT_USER!\n broadcast_notification\n render json: {message: \"you allready following her / him\", httpstatus: followfailed}\n else\n curent_user.follow(user)\n render json: {id: Relationship.last.id, message: \"follow success\", httpstatus: followsucces}, status: :created\n end\n end", "title": "" }, { "docid": "ddaed76a52d40eeb0bdcb9e5e4d917a7", "score": "0.7206638", "text": "def can_follow?(another_user)\n !(self.follows?(another_user) || self.id == another_user.id)\n end", "title": "" }, { "docid": "fe162173efa2a3b7805c023cba59b27d", "score": "0.7203827", "text": "def create?\n record.follower_id == user.id\n end", "title": "" }, { "docid": "889a85f1c05fdfefa13bfcac56bc27e6", "score": "0.71965146", "text": "def follow!(followed)\n self.relationships.create!(:followed_id => followed.id)\n end", "title": "" }, { "docid": "ed3c1f36fd9f808ae6ccc30d3bb49e01", "score": "0.71961087", "text": "def follow(user_id)\n begin\n follower_relationships.create(follower_id: user_id)\n rescue Exception => e\n self.errors.add(:base, e.message)\n end\n end", "title": "" }, { "docid": "aa0dec9288646faeff87d2669d7ae5d1", "score": "0.71827847", "text": "def followable_by?(user)\n return false if self.id == user.id #can't follow self\n return false if user.following?(self) #can't follow someone already following\n true #otherwise \n end", "title": "" }, { "docid": "e6f246e7a6fffe490e234da6e244d982", "score": "0.7159088", "text": "def create\n # For the login function you created by yourself,\n # use the logged_in? method you implemented by yourself and make it possible to like something only when logged in.\n if logged_in?\n @user = current_user.id\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_with @user\n else\n respond_with @user\n end \n end", "title": "" }, { "docid": "5f2f894e32f16b9853b89dbcfdf724f7", "score": "0.7151863", "text": "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "5f2f894e32f16b9853b89dbcfdf724f7", "score": "0.7151863", "text": "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "5f2f894e32f16b9853b89dbcfdf724f7", "score": "0.7151863", "text": "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "5f2f894e32f16b9853b89dbcfdf724f7", "score": "0.7151863", "text": "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "5f2f894e32f16b9853b89dbcfdf724f7", "score": "0.7151863", "text": "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "5f2f894e32f16b9853b89dbcfdf724f7", "score": "0.7151863", "text": "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "5f2f894e32f16b9853b89dbcfdf724f7", "score": "0.7151863", "text": "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "27907b8a2536e6135d21c649f2acdb62", "score": "0.714873", "text": "def create\n @sender = User.find(params[:follower_id])\n reverse_pair = check_reverse_pair(params[:followed_id], params[:follower_id])\n if reverse_pair.empty?\n @follow = Following.new(followed_id: params[:followed_id], follower_id: params[:follower_id])\n\n if @follow.save\n redirect_to user_path(id: params[:followed_id]), notice: 'Now following'\n else\n redirect_to user_path(id: params[:followed_id]), notice: 'You already followed each other'\n end\n else\n redirect_to user_path(id: params[:followed_id]), notice: 'User either follows you or you followed the user'\n end\n end", "title": "" }, { "docid": "a97e105e72365dbae24c5ec0ace43116", "score": "0.71476996", "text": "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "99f6ef23f5ddfc38e3b5c8df1c63a678", "score": "0.71377796", "text": "def follow(user_to_follow)\n if(self.id != user_to_follow.id && self.followings.where(id: user_to_follow.id).count == 0)\n self.followings << user_to_follow\n self.save!\n else\n false\n end\n end", "title": "" }, { "docid": "8ca012caad876e972fd844e29c841a1d", "score": "0.71331596", "text": "def can_follow?(another_user)\n\n !(self == another_user || self.follower_relationships.map(&:leader_id).include?(another_user.id))\n end", "title": "" }, { "docid": "463078323becd9c9fc443c057a61ba83", "score": "0.71258307", "text": "def follow(user)\n #--\n # Only someone who is not still being followed can be followed.\n #++\n unless self.is_following_to?(user)\n self.followments.create(:followed_id => user.id)\n else\n raise TheUserIsAlreadyBeingFollowed, self.email + \" is already following \" + user.email + \".\"\n end\n end", "title": "" }, { "docid": "14683e41a763777d42731f50545d509c", "score": "0.71180946", "text": "def follow(other)\n \tactive_relationships.create(followed_id: other.id)\n end", "title": "" }, { "docid": "273932e44ac85c4e53176699722204d8", "score": "0.7102383", "text": "def follow(other)\n\tactive_relationships.create(followed_id: other.id)\nend", "title": "" }, { "docid": "0e710ceac969f2e21cd8d2c0a33b9aa2", "score": "0.7091352", "text": "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_with @user\n end", "title": "" }, { "docid": "c4a812f2905ee8f04a703392864c5a16", "score": "0.7069683", "text": "def follow_a_user(other_user_id)\n active_followers.create(followed_id: other_user_id)\n end", "title": "" }, { "docid": "507668c7dad1e6aa79036fe005d390eb", "score": "0.7069303", "text": "def follow!(other, options = {})\n raise \"Can't follow unregistered user\" unless other.registered?\n options[:follow_type] = OrganicFollow if options[:follow_type].nil?\n unless self.following?(other) or other.blocking?(self)\n logger.debug(\"User #{id} following user #{other.id}\")\n attrs = options.fetch(:attrs, {}).reverse_merge(\n user: other,\n follower: self,\n follow_type: Follow.follow_type_id(options[:follow_type])\n )\n Follow.create!(attrs)\n end\n end", "title": "" }, { "docid": "be1314bae3091b4ae3ba030dedc80844", "score": "0.70606387", "text": "def create\n\t\tother_user = User.find(params[:followed_id])\n\t\tcurrent_user.follow(other_user)\n\t\tredirect_to other_user\n\tend", "title": "" }, { "docid": "b6d7440f4866b21b8c3765d797f81fb0", "score": "0.7058301", "text": "def follow!(followed)\n relationships.create!(:followed_id => followed.id)\n end", "title": "" }, { "docid": "b6d7440f4866b21b8c3765d797f81fb0", "score": "0.7058301", "text": "def follow!(followed)\n relationships.create!(:followed_id => followed.id)\n end", "title": "" }, { "docid": "b6d7440f4866b21b8c3765d797f81fb0", "score": "0.7058301", "text": "def follow!(followed)\n relationships.create!(:followed_id => followed.id)\n end", "title": "" }, { "docid": "2e94e0d21a1d23878ebabfba43da9854", "score": "0.70579714", "text": "def add_follow(_user)\n unless self.follow_ids.include?(_user.id_to_s)\n self.follow_ids << _user.id_to_s\n self.save\n end\n\n unless _user.follower_ids.include?(self.id_to_s)\n _user.follower_ids << self.id_to_s\n _user.save\n end\n end", "title": "" }, { "docid": "5a3d4dc245a5192178f2bdeed4d0c4a0", "score": "0.70452005", "text": "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n\n #send a mail to user that is followed - This might need to be placed in a job later\n UserMailer.mail_followed_user(self, other_user).deliver\n end", "title": "" }, { "docid": "a154637e810db0b813d9459035847d3d", "score": "0.70136565", "text": "def following?(user)\n !!relation_with(user)\n end", "title": "" }, { "docid": "3d9cf557dcdfb2a11e4c72e33cc4fca3", "score": "0.70125544", "text": "def already_follows?(other_user_id)\n relationships.find_by_followed_id(other_user_id)\n end", "title": "" }, { "docid": "5b5bbec13c04cb7ee2717319c129ccc5", "score": "0.7012519", "text": "def follow(other)\n\t\tactive_relationships.create(followed_id: other.id)\n\tend", "title": "" }, { "docid": "5c0668005a3d51b2473c9c8bcd1aba31", "score": "0.70010835", "text": "def follow(other_user)\n\t\tfollowing << other_user\t\n\t\t#active_relationship.create(followed_id: other_user.id)\t\t\t\t\t\t\n\tend", "title": "" }, { "docid": "c92b7f5d9473e4e6b2eb734a5b5aafa5", "score": "0.69978344", "text": "def create\n # If it is a login function that you created yourself, you should have implemented it yourself\n # Use logged_in? method so that you can follow only when logged in.\n if logged_in?\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n end\n\n def destroy\n @user = Relationship.find(params[:id]).followed\n current_user.unfollow!(@user)\n end\n end", "title": "" }, { "docid": "aa71375a1d01b75f202c8f3e33a897f6", "score": "0.6962043", "text": "def follow(other)\n\t\t\tactive_relationships.create(follower_id: other.id)\n\t\tend", "title": "" }, { "docid": "2059e94ffc14890080099e62611391a9", "score": "0.6960461", "text": "def follow!(target)\n relationships.create(:target => target)\n end", "title": "" }, { "docid": "288f5a0732c9e1dd2b9237a8666c5883", "score": "0.69580877", "text": "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n redirect_to vanity_url_path(@user.profile.slug)\n end", "title": "" }, { "docid": "eed80b420e065652009c65c8ee9bcf23", "score": "0.69500035", "text": "def follow(person)\n active_relationships.create(follower_id: person.id)\n\n end", "title": "" }, { "docid": "815e6b8b0a8884d86adc1e7b4c9b6763", "score": "0.69433725", "text": "def add_user_follow\n @follower.following << @following.id\n @following.followers << @follower.id\n @follower.save\n if @following.save\n redirect_to @following, notice: 'Sucessfully following user.'\n else\n redirect_to @following\n end\n end", "title": "" }, { "docid": "65ac10590a4061c76b97e7e51cac2099", "score": "0.69422185", "text": "def follow(user_id)\n follower.create(followee_id: user_id)\n end", "title": "" } ]
fa5ae9740f2d5ff1e6d84e85b9348992
Make sure newattr handles required features correctly.
[ { "docid": "92e2da8f7b153d49d1aebe860995c494", "score": "0.71580374", "text": "def test_newattr_and_required_features\n # Make a type with some features\n type = mktype\n type.feature :fone, \"Something\"\n type.feature :ftwo, \"Something else\"\n type.newparam(:name) {}\n\n # Make three properties: one with no requirements, one with one, and one with two\n none = type.newproperty(:none) {}\n one = type.newproperty(:one, :required_features => :fone) {}\n two = type.newproperty(:two, :required_features => [:fone, :ftwo]) {}\n\n # Now make similar providers\n nope = type.provide(:nope) {}\n maybe = type.provide(:maybe) { has_feature :fone}\n yep = type.provide(:yep) { has_features :fone, :ftwo}\n\n attrs = [:none, :one, :two]\n\n # Now make sure that we get warnings and no properties in those cases where our providers do not support the features requested\n [nope, maybe, yep].each_with_index do |prov, i|\n resource = type.new(:provider => prov.name, :name => \"test#{i}\", :none => \"a\", :one => \"b\", :two => \"c\")\n\n case prov.name\n when :nope\n yes = [:none]\n no = [:one, :two]\n when :maybe\n yes = [:none, :one]\n no = [:two]\n when :yep\n yes = [:none, :one, :two]\n no = []\n end\n yes.each { |a| assert(resource.should(a), \"Did not get value for #{a} in #{prov.name}\") }\n no.each do |a|\n assert_nil(resource.should(a), \"Got value for unsupported %s in %s\" % [a, prov.name])\n if Puppet::Util::Log.sendlevel?(:info)\n assert(@logs.find { |l| l.message =~ /not managing attribute #{a}/ and l.level == :debug }, \"No warning about failed %s\" % a)\n end\n end\n\n @logs.clear\n end\n end", "title": "" } ]
[ { "docid": "682c484f27307a37a962f834606c7b30", "score": "0.65315807", "text": "def check_for_old_attributes!\n unless node['build_essential'].nil?\n Chef::Log.warn <<-EOH\nnode['build_essential'] has been changed to node['build-essential'] to match the\ncookbook name and community standards. I have gracefully converted the attribute\nfor you, but this warning and conversion will be removed in the next major\nrelease of the build-essential cookbook.\nEOH\n node.default['build-essential'] = node['build_essential']\n end\n\n unless node['build-essential']['compiletime'].nil?\n Chef::Log.warn <<-EOH\nnode['build-essential']['compiletime'] has been deprecated. Please use\nnode['build-essential']['compile_time'] instead. I have gracefully converted the\nattribute for you, but this warning and converstion will be removed in the next\nmajor release of the build-essential cookbook.\nEOH\n node.default['build-essential']['compile_time'] = node['build-essential']['compiletime']\n end\n end", "title": "" }, { "docid": "76571eba61cd5dc2bceb43a2855fba3f", "score": "0.63309616", "text": "def update_required?(old_attrs, new_attrs)\n false\n end", "title": "" }, { "docid": "fc380b7de73a794750e806a5d20ca09b", "score": "0.6277827", "text": "def attributes=(new_attributes)\n acceptable_attributes = [:ID, :Name, :Note, :Alias, :Parent]\n @attributes = if new_attributes.is_a?(Hash)\n # Symbolify the keys in the hash\n symbolized_attributes = Hash[new_attributes.map { |(attribute, value)| [attribute.to_sym, value] }]\n \n # Pull out the acceptable attributes\n detected_attributes = {}\n acceptable_attributes.each do |attribute|\n detected_attributes[attribute] = symbolized_attributes[attribute] if symbolized_attributes[attribute]\n end\n \n detected_attributes\n else\n Feature.parse_attributes(new_attributes, only: acceptable_attributes)\n end\n end", "title": "" }, { "docid": "ac55752dd9cc4f485a916c46d7b41237", "score": "0.61755395", "text": "def allowed_attributes=(_arg0); end", "title": "" }, { "docid": "ac55752dd9cc4f485a916c46d7b41237", "score": "0.61755395", "text": "def allowed_attributes=(_arg0); end", "title": "" }, { "docid": "75c2d18605bf7f8211edfcb4a93c9de1", "score": "0.60566485", "text": "def new_attributes(args)\n stats = default_attributes\n update_stats(stats, args)\n end", "title": "" }, { "docid": "51969ffa9d4e2d047c8ab88226e0a504", "score": "0.60518825", "text": "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "title": "" }, { "docid": "1fe92f91672ad60c6948e102e72e0566", "score": "0.5913943", "text": "def new_entry_attrs\n test_entry_attrs\n end", "title": "" }, { "docid": "0e35e8d57b14f61d543d46078f2d0f6f", "score": "0.58840096", "text": "def newattr(name)\n if name.is_a?(Class)\n klass = name\n name = klass.name\n end\n\n unless klass = self.class.attrclass(name)\n raise Puppet::Error, \"Resource type #{self.class.name} does not support parameter #{name}\"\n end\n\n if provider and ! provider.class.supports_parameter?(klass)\n missing = klass.required_features.find_all { |f| ! provider.class.feature?(f) }\n debug \"Provider %s does not support features %s; not managing attribute %s\" % [provider.class.name, missing.join(\", \"), name]\n return nil\n end\n\n return @parameters[name] if @parameters.include?(name)\n\n @parameters[name] = klass.new(:resource => self)\n end", "title": "" }, { "docid": "7da606925e88e5c3e72918fec82441d6", "score": "0.5821686", "text": "def merge_attributes(new_attributes)\n new_attributes = new_attributes.current_attributes if new_attributes.is_a?(Attributable)\n\n new_attributes.deep_symbolize_keys!\n\n raise AttributeError, 'No attributes exist. Have you defined any for this class?' if attributes.nil?\n\n extraneous_attrs = []\n\n new_attributes.each do |new_attribute, value|\n if attributes.has_key?(new_attribute)\n public_send(\"#{new_attribute}=\", value)\n else\n extraneous_attrs << new_attribute\n end\n end\n\n warn \"skipping attribute(s) `#{extraneous_attrs.join(',')}` for #{self.class} as they are not specified for this class.\" if extraneous_attrs.any?\n end", "title": "" }, { "docid": "b216c7fcb37dd050f85a1c3c800d440e", "score": "0.57761514", "text": "def attributes= new_attributes\n ingest_attributes(new_attributes)\n end", "title": "" }, { "docid": "de638d3db8381f6dd9e67c00b6af32a2", "score": "0.57496905", "text": "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", "title": "" }, { "docid": "c2b06bf0a9fd9613c18a9a4bded0d73f", "score": "0.57213974", "text": "def attr_required(*attr_names)\n @required_attrs ||= []\n @required_attrs += attr_names\n attr_accessor(*attr_names)\n end", "title": "" }, { "docid": "dd2a36d7e4eb4948ad56a4f051a9ef8c", "score": "0.5704856", "text": "def allow_unknown_attributes!\n define_method :handle_unknown_attribute do |*|\n end\n end", "title": "" }, { "docid": "2e742b0ae96a5b96c5e67dd0099e4902", "score": "0.5640651", "text": "def assert_known_attributes(klass, attribute_hash); end", "title": "" }, { "docid": "3a57678be68c5032227a803937e25f70", "score": "0.55847126", "text": "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "title": "" }, { "docid": "496bdf795b79e5981012f443bc0c999f", "score": "0.5548127", "text": "def assign_attributes(new_attributes, options = {})\n attributes = new_attributes.symbolize_keys\n attributes.each do |k, v|\n if has_attribute?(k)\n assign_attribute(k, v) unless options[:skip_nil_values] && v.nil?\n elsif options[:validate_attribute_presence]\n raise(StoreError, \"unknown attribute: '#{k}'\")\n else\n Prime.logger.info(\"unknown attribute: #{k}\")\n end\n end\n end", "title": "" }, { "docid": "2f4f264d418bd39da38f4df308fc6120", "score": "0.5532438", "text": "def attributes=(new_attributes)\n @attributes = if new_attributes.is_a?(Hash)\n cloned_attributes = new_attributes.clone\n cloned_attributes.delete(:ID)\n cloned_attributes.delete(:Name)\n cloned_attributes.delete(:Alias)\n cloned_attributes.delete(:Parent)\n cloned_attributes\n else\n Feature.parse_attributes(new_attributes, except: [:ID, :Name, :Alias, :Parent])\n end\n end", "title": "" }, { "docid": "cc593b3971f2bc1cea4c58ee3f70ba23", "score": "0.5514481", "text": "def create_accessible_attributes\n read_inheritable_attribute(:attr_create_accessible)\n end", "title": "" }, { "docid": "db86bed6350567ec1196869a99c89093", "score": "0.55018044", "text": "def _check_required_attr(object_missing, attr_path, attr_options, fname)\n attr_obj = KeyPath.new(attr_path)\n\n attr_name = attr_obj.key\n case attr_options[:type]\n when :data\n _check_required_attr_data(attr_name, attr_options, fname)\n when :CloudObject\n if attr_options[:required] &&\n @object_data.type?(attr_name) != :DataObject\n object_missing << attr_name\n end\n end\n end", "title": "" }, { "docid": "349988c736d7384c82ab61aba9cbd68d", "score": "0.55004025", "text": "def attrib_needed! attrib_sym, needed_now=true\n unless attrib_needed?(attrib_sym) == needed_now\n send :\"#{attrib_sym}_needed=\", needed_now\n attrib_sym\n end\n end", "title": "" }, { "docid": "4236141331cef96b2339e2643a59708c", "score": "0.5497558", "text": "def add_missing_info_for_group_attrs!(augmented_attr_list)\n dependency_analysis(augmented_attr_list) do |attr_in, _link, attr_out|\n attr_in.merge!(port_type: 'input')\n if attr_in[:required] && attr_out and not attr_out[:dynamic]\n attr_out.merge!(required: true)\n end\n end\n end", "title": "" }, { "docid": "501f7201a66af5ff28623862c13038d6", "score": "0.5490725", "text": "def add_attribute(name, &block); end", "title": "" }, { "docid": "12514fc682aa00023aed03089e5966be", "score": "0.54849786", "text": "def method_missing (name, *args, &block)\n add_attribute(name, *args, &block)\n end", "title": "" }, { "docid": "12514fc682aa00023aed03089e5966be", "score": "0.54849786", "text": "def method_missing (name, *args, &block)\n add_attribute(name, *args, &block)\n end", "title": "" }, { "docid": "12514fc682aa00023aed03089e5966be", "score": "0.54849786", "text": "def method_missing (name, *args, &block)\n add_attribute(name, *args, &block)\n end", "title": "" }, { "docid": "5a2adb075b96a13ca62432d49c734971", "score": "0.5466908", "text": "def new_requirement_attributes=(attributes)\n requirement = Requirement.find_or_create_by(attributes)\n self.requirements << requirement if requirement.valid? || !self.requirements\n end", "title": "" }, { "docid": "835e82e18b1cb87fe9507297e308cece", "score": "0.5460606", "text": "def require_attr(name)\n send(name).tap do |_|\n raise AttributeError, \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "title": "" }, { "docid": "9cab27f2aa6ea3a24d99981b039f256b", "score": "0.5447405", "text": "def has_required_attrs(*attrs)\n self.class_variable_set('@@required_attrs', attrs)\n end", "title": "" }, { "docid": "ec971bf81a4a5fc4c32c77999fe4e758", "score": "0.54374325", "text": "def set_attribute_node( new_attr )\n if new_attr.owner_document != self.owner_document then\n raise \"WRONG_DOCUMENT_ERR\"\n end\n if not new_attr.owner_element.nil? then\n raise \"INUSE_ATTRIBUTE_ERR\"\n end\n old_attr = nil\n @attr_nodes << new_attr\n new_attr._set_owner_element( self )\n old_attr\n end", "title": "" }, { "docid": "951ae19986a104b41b1793a9c4079413", "score": "0.5433201", "text": "def attributes=(new_attributes, guard_protected_attributes = true)\n return if new_attributes.nil?\n attributes = new_attributes.dup\n attributes.stringify_keys!\n multi_parameter_attributes = []\n attributes = remove_attributes_protected_from_mass_assignment(attributes) if guard_protected_attributes\n \n attributes.each do |k, v|\n if k.include?(\"(\")\n multi_parameter_attributes << [ k, v ]\n else\n # This will fail if we are adding dynamic attributes. In dynamo we'll let the method_missing pick\n # up when the attribute doesn't exist and we'll handle it from there.\n # respond_to?(:\"#{k}=\") ? send(:\"#{k}=\", v) : raise(UnknownAttributeError, \"unknown attribute: #{k}\")\n send(:\"#{k}=\", v)\n end\n end\n \n assign_multiparameter_attributes(multi_parameter_attributes)\n end", "title": "" }, { "docid": "119088f0f23b6b140ef9134559a64922", "score": "0.5428259", "text": "def attr_info; end", "title": "" }, { "docid": "d103dae805fb5f39f7c1fe97051ac54c", "score": "0.5403166", "text": "def attr(name); end", "title": "" }, { "docid": "aad243e266dd6d424e78d89da48187bb", "score": "0.5399009", "text": "def missing_required(attr = 'name')\n fail MissingRequired, \"Cannot store data without a #{attr} attribute.\"\n end", "title": "" }, { "docid": "77f5044fd4a848412af368327d7e56b2", "score": "0.539616", "text": "def init_super_attrs(args={}, inst)\n\t\t\t\targs_keys = args.keys\n\n\t\t\t\tif @@required_attrs.any?\n\t\t\t\t\t# Checks if args_keys has all attr in the \n\t\t\t\t\t# @@required_attrs. If args is empty, it will\n\t\t\t\t\t# raise an StandardError\n\t\t\t\t\tif args_keys.any?\n\t\t\t\t\t\tnot_set_attrs = []\n\t\t\t\t\t\t@@required_attrs.each do |req|\n\t\t\t\t\t\t\tnot_set_attrs << req unless args_keys.include?(req)\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\traise StandardError.new(\"Required attributes: #{not_set_attrs.join(\", \")}\") if not_set_attrs.any?\n\t\t\t\t\telse\n\t\t\t\t\t\traise StandardError.new(\"Required attributes: #{@@required_attrs.join(\", \")}\")\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Inits the arguments passed via the\n\t\t\t\t# initilize method.\n\t\t\t\targs_keys.each {|key| self.instance_method(\"#{key}=\").bind(inst).call(args[key]) }\n\t\t\tend", "title": "" }, { "docid": "b480cb79aa285d43d293078bf3d428e5", "score": "0.5387369", "text": "def attribs_needed! attrib_syms, needed_now=true\n attrib_syms.each { |attrib_sym| attrib_needed! attrib_sym, needed_now }\n end", "title": "" }, { "docid": "da8c61fdfbb1bc204b38f9e640c72ccb", "score": "0.5379859", "text": "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "title": "" }, { "docid": "4c5b6fa59e7cf834e96d449c7839ad06", "score": "0.537575", "text": "def process_attrasgn exp\n exp = exp.dup\n exp.target = process exp.target\n exp.arglist = process exp.arglist\n exp\n end", "title": "" }, { "docid": "c78b3a8fb140dcb439899a1b26aa2297", "score": "0.5373768", "text": "def old_property_check(el)\n el.attribute_nodes.each do |attr|\n if OLD_TERMS.include?(attr.uri.to_s)\n add_debug(el, \"Obsolete attribute '#{attr.uri}'\")\n raise InvalidPredicate.new(\"Obsolete attribute '#{attr.uri}'\") if @strict\n end\n end\n end", "title": "" }, { "docid": "917726fe61ba1cc500df02b1aaf48416", "score": "0.53672504", "text": "def define_attribute_methods\n if super\n define_nilify_blank_methods\n end\n end", "title": "" }, { "docid": "39a21255e67406fd38dd5f6532fb65b5", "score": "0.53483665", "text": "def setup_object_attributes; end", "title": "" }, { "docid": "3037f73cf1b8844479e32f0e0c4df270", "score": "0.5347021", "text": "def feature_setup\n raise NotImplementedError\n end", "title": "" }, { "docid": "12de1cfdb3b512756f2cafc891e17756", "score": "0.5338111", "text": "def guard_required!\n required.each do |key|\n raise ArgumentError, \"Missing required attribute #{key}\" if self[key].nil?\n end\n end", "title": "" }, { "docid": "49f33cd67d226f2a1d905a3846180661", "score": "0.5329025", "text": "def method_missing(symbol, *args)\n if symbol == :to_ary\n merged_attributes.send(symbol, *args)\n elsif args.empty?\n Chef.deprecated :attributes, %q{method access to node attributes (node.foo.bar) is deprecated and will be removed in Chef 13, please use bracket syntax (node[\"foo\"][\"bar\"])}\n self[symbol]\n elsif symbol.to_s =~ /=$/\n Chef.deprecated :attributes, %q{method setting of node attributes (node.foo=\"bar\") is deprecated and will be removed in Chef 13, please use bracket syntax (node[\"foo\"]=\"bar\")}\n key_to_set = symbol.to_s[/^(.+)=$/, 1]\n self[key_to_set] = (args.length == 1 ? args[0] : args)\n else\n raise NoMethodError, \"Undefined node attribute or method `#{symbol}' on `node'\"\n end\n end", "title": "" }, { "docid": "3428aa2ab2064c86c56b8b5e4691e9b9", "score": "0.5328921", "text": "def initialize_attributes(attributes); end", "title": "" }, { "docid": "980a560c361e175573fcf9dcf6cd0959", "score": "0.5326171", "text": "def method_missing(meth, *args, &blk)\n if args.length > 0\n self.class.add_custom_attribute meth\n send meth, *args, &blk\n else\n super meth, *args, &blk\n end\n end", "title": "" }, { "docid": "29b7edf0c7239e167d3f45062d524023", "score": "0.53254074", "text": "def vattr_set(*syms) # :nodoc:\r\n syms.each do |sym|\r\n instance_eval <<EVAL, __FILE__, __LINE__ + 1\r\ndef #{sym}_attributes(version = nil)\r\n version = validate_version! version\r\n\r\n versions.sort.inject(Set.new) { |attributes, (current_version, hash)|\r\n if current_version <= version\r\n hash[#{sym.inspect}].try(:each) { |attribute, boolean|\r\n boolean ? attributes << attribute : attributes.delete(attribute)\r\n }\r\n end\r\n\r\n attributes\r\n }\r\nend\r\nEVAL\r\n end\r\n end", "title": "" }, { "docid": "b7d72751f0f3203bc32793c1babd13e7", "score": "0.53186524", "text": "def method_missing namesym, *args\n if match = namesym.to_s.match(/(.*)_(accept|if_ready)$/)\n attrname, verb = match[1..2]\n case verb\n when 'accept'\n accept_attribute attrname, args.first\n when 'if_ready'\n # Provide\n return attrib_ready?(attrname) ? self.send(attrname.to_sym) : args.first\n end\n return\n end\n super(namesym, *args) if defined?(super)\n end", "title": "" }, { "docid": "fa0f39cf98bdd03b4e77064c2729ebdf", "score": "0.531051", "text": "def super_attr(name, opts={})\n\t\t\t\t\n\t\t\t\t# Defines getter\n\t\t\t\tdefine_method(\"#{name}\") do\n\t\t\t\t\tinstance_variable_get(\"@#{name}\")\n\t\t\t\tend\n\n\t\t\t\t# Defines setter\n\t\t\t\tdefine_method(\"#{name}=\") do |arg|\n\t\t\t\t\t# If the arg is a kind of opts[:type]\n\t\t\t\t\t# it sets the value, otherwise, it will\n\t\t\t\t\t# raise a StandardError.\n\t\t\t\t\tif arg.is_a? opts[:type]\n\t\t\t\t\t\tinstance_variable_set(\"@#{name}\", arg)\n\t\t\t\t\telse\n\t\t\t\t\t\traise StandardError.new(\"The value for #{name} is not a type #{opts[:type]}\")\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# If the attribute is required, it will\n\t\t\t\t# push its name to the @@required_attrs array\n\t\t\t\t@@required_attrs << name if opts.has_key?(:required) && opts[:required]\n\n\t\t\tend", "title": "" }, { "docid": "d971bbd7b76ed4e58067d925db75865e", "score": "0.5306266", "text": "def new_attributes(name, library)\n (library.commands_hash[name] || {}).merge(name: name).\n update(library_attributes(library))\n end", "title": "" }, { "docid": "e6f1eb9eff070f3148ed8d5fa7417621", "score": "0.5296998", "text": "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "title": "" }, { "docid": "444abfaf74b679c8d7d0ac293d6ce675", "score": "0.5296464", "text": "def update_scaffold_attributes(allowed_fields, new_attributes)\n return if new_attributes.nil?\n attributes = new_attributes.dup\n attributes.stringify_keys!\n attributes.delete_if{|k,v| !allowed_fields.include?(k.split('(')[0])}\n \n multi_parameter_attributes = []\n attributes.each do |k, v|\n k.include?(\"(\") ? multi_parameter_attributes << [ k, v ] : send(k + \"=\", v)\n end\n \n assign_multiparameter_attributes(multi_parameter_attributes)\n end", "title": "" }, { "docid": "c3a5379dc914a53ca2fbd07ff955b842", "score": "0.52916765", "text": "def update!(**args)\n @required_features = args[:required_features] if args.key?(:required_features)\n end", "title": "" }, { "docid": "5713e55cd1835dad9219c108449e7a3a", "score": "0.5284753", "text": "def set_target_attributes(_target)\n raise NoMethodError, \"subclasses must implement #{__method__}\"\n end", "title": "" }, { "docid": "9d3f7e3f432ad726f98a05f040218482", "score": "0.52844065", "text": "def validate(check_required_attributes = true)\n @processor = AttributeProcessor.new(to_hash)\n @processor.process\n\n # object identity is always required, even for patches\n missing_errors = {}\n missing_errors[identity.to_sym] = 'is missing' if self.class.method_defined?(identity) && blank?(send(identity))\n\n if check_required_attributes\n missing_attrs = required_attributes.select { |at| blank?(send(at)) }\n\n missing_attrs.each do |at|\n missing_errors[at] = 'is missing'\n end\n end\n\n @processor.errors.merge(missing_errors)\n end", "title": "" }, { "docid": "7bcf29624e07bfbbfd083e2af3609e55", "score": "0.5265325", "text": "def attributes=(_arg0); end", "title": "" }, { "docid": "1f7080cdd4622fc3db8a7878a04ca58b", "score": "0.5253927", "text": "def fix_automatic_attributes\n platform, version = Chef::Platform.find_platform_and_version(self)\n # FIXME(log): should be trace\n logger.debug(\"Platform is #{platform} version #{version}\")\n automatic[:platform] = platform\n automatic[:platform_version] = Chef::VersionString.new(version)\n automatic[:chef_guid] = Chef::Config[:chef_guid] || ( Chef::Config[:chef_guid] = node_uuid )\n automatic[:name] = name\n automatic[:chef_environment] = chef_environment\n end", "title": "" }, { "docid": "f18732b84a87a66e4ff0032defe34dc4", "score": "0.5232667", "text": "def has_attributes?; end", "title": "" }, { "docid": "03ff5ca7cda8accdbace49abe2cb9c53", "score": "0.523161", "text": "def assert_required_properties_set!; end", "title": "" }, { "docid": "1d1ee8d17a4ba4d39e31c46a8ddf8c08", "score": "0.5226652", "text": "def create_attributes(klass, members); end", "title": "" }, { "docid": "63975c297c4b02a217576c5e4f28bd4c", "score": "0.5224949", "text": "def set_attrs_soft(new_attrs)\n updatable = new_attrs.select {|k,v| self.class.column_names.include? k.to_s}\n updatable.each {|k,v| puts \"self.send '#{k}=', #{v}\"; self.send \"#{k}=\", v}\n return self\n end", "title": "" }, { "docid": "2d2ecd2314ba8d6cb887e18d0364ced2", "score": "0.5218497", "text": "def expensive_validate_presence_of_proper_attributes(attrs)\n attributes_list.each do |attr|\n unless attrs.delete(attr) || optional_attributes_list.include?(attr)\n raise BadAttributesError, \"Missing attribute '#{attr}'\"\n end\n end\n\n raise BadAttributesError, \"Unknown attributes #{attrs.inspect}\" unless attrs.empty?\n end", "title": "" }, { "docid": "a3cff569ac8eef95de813fa41e91bbbc", "score": "0.5212053", "text": "def set_allowed_attrs\n allowed_attrs = %i[id]\n fields = settings(\"views.#{params[:component]}.new\", fatal_exception: true)\n fields.each do |field|\n allowed_attrs.append(node_name(field).to_sym)\n end\n allowed_attrs\n end", "title": "" }, { "docid": "ae3397cefc189d1673c3d7e4505d89b2", "score": "0.5203208", "text": "def change_attribute current, new\n diff = current ^ new\n attribute(new & diff, current & diff)\n end", "title": "" }, { "docid": "702bebb19d5299d23a514dab791d3ba0", "score": "0.52020013", "text": "def attributes=(new_attributes, guard_protected_attributes = true)\n return if new_attributes.nil?\n attributes = new_attributes.dup\n attributes.stringify_keys!\n\n multi_parameter_attributes = []\n attributes = remove_attributes_protected_from_mass_assignment(attributes) if guard_protected_attributes\n\n attributes.each do |k, v|\n k.include?(\"(\") ? multi_parameter_attributes << [ k, v ] : send(k + \"=\", v)\n end\n\n assign_multiparameter_attributes(multi_parameter_attributes)\n end", "title": "" }, { "docid": "28c08057e0d0b98dfe394d38ad728f0f", "score": "0.5199662", "text": "def attributes=(new_attributes, guard_protected_attributes = true)\n return if new_attributes.nil?\n attributes = new_attributes.dup\n attributes.stringify_keys!\n\n multi_parameter_attributes = []\n attributes = remove_attributes_protected_from_mass_assignment(attributes) if guard_protected_attributes\n\n attributes.each do |k, v|\n if k.include?(\"(\")\n multi_parameter_attributes << [ k, v ]\n else\n send(:\"#{k}=\", v)\n end\n end\n\n assign_multiparameter_attributes(multi_parameter_attributes)\n end", "title": "" }, { "docid": "44244e271d12ef20b33fcf13b6b8d664", "score": "0.51779306", "text": "def needed_attributes\n selected_attr_trackers.collect { |ready_or_needed| ready_or_needed.to_s.match /(.*)_needed$/ ; $1&.to_sym }.compact\n end", "title": "" }, { "docid": "a2ac6194eb1d1437a5743ea2fbb3ec5c", "score": "0.5168851", "text": "def method_missing(method_name, *args, &block)\n return super unless define_attribute_methods\n self.send(method_name, *args, &block)\n end", "title": "" }, { "docid": "86aa44a04dd74b8248ee2c59fcfb70bd", "score": "0.51675665", "text": "def assign_attributes(new_attributes, options = {})\n sanitized_new_attributes = sanitize_for_mass_assignment_if_sanitizer new_attributes, options\n\n sanitized_new_attributes.each do |name, value|\n writer = \"#{name}=\"\n # originally:\n # send writer, value if respond_to? writer\n send writer, value\n end if sanitized_new_attributes\n end", "title": "" }, { "docid": "6cfe1f2e4a55f6e4beeaef590b0a1391", "score": "0.5158889", "text": "def sanitized_allowed_attributes=(attributes); end", "title": "" }, { "docid": "6cfe1f2e4a55f6e4beeaef590b0a1391", "score": "0.5158889", "text": "def sanitized_allowed_attributes=(attributes); end", "title": "" }, { "docid": "caf428c2f2b6c7306478ac5dcc1a5dfa", "score": "0.5155046", "text": "def method_missing(method, *args, &block)\n unless self.class.attribute_methods_generated?\n self.class.define_attribute_methods\n\n if respond_to_without_attributes?(method)\n send(method, *args, &block)\n else\n super\n end\n else\n super\n end\n end", "title": "" }, { "docid": "caf428c2f2b6c7306478ac5dcc1a5dfa", "score": "0.5155046", "text": "def method_missing(method, *args, &block)\n unless self.class.attribute_methods_generated?\n self.class.define_attribute_methods\n\n if respond_to_without_attributes?(method)\n send(method, *args, &block)\n else\n super\n end\n else\n super\n end\n end", "title": "" }, { "docid": "ff3d6492b89a5e43bcebf2646f946d83", "score": "0.5147925", "text": "def assign_attributes(attr)\n attr = normalize_attributes(attr)\n opt = attr.delete(:attr_opt) || {}\n set_model_options(opt)\n super(attr)\n rescue => err # TODO: testing - remove?\n Log.warn { \"#{record_name}.#{__method__}: #{err.class}: #{err.message}\" }\n raise err\n end", "title": "" }, { "docid": "e33071c8a2594bfed658e7d5409a69a2", "score": "0.51437837", "text": "def _check_attribute_completeness\n documented_attributes = ATTRIBUTES.collect { |a| a['name'].to_s }\n # ^ The attributes documented in specdoc.yaml.\n coded_attributes = Gem::Specification.attribute_names.collect { |a| a.to_s }\n # ^ The attributes defined in specification.rb.\n missing = coded_attributes - documented_attributes\n unless missing.empty?\n STDERR.puts \"Defined attributes that are not documented:\"\n STDERR.puts ' ' + missing.join(', ')\n end\n missing = documented_attributes - coded_attributes\n unless missing.empty?\n STDERR.puts \"Documented attributes that are not defined:\"\n STDERR.puts ' ' + missing.join(', ')\n end\nend", "title": "" }, { "docid": "b3162d6a7b81606ef47579ac6c800550", "score": "0.5138185", "text": "def create!(attributes = {})\n raise NotSupportedError\n end", "title": "" }, { "docid": "2dc9c5d731b1a45848546ec81f8a4299", "score": "0.5130366", "text": "def attr; end", "title": "" }, { "docid": "cfdbf32d5c828047e321b3bac4852da9", "score": "0.5128515", "text": "def attributes_exist?\n\tend", "title": "" }, { "docid": "14fe16ff2741d786ce1e30df5407e01e", "score": "0.512111", "text": "def replace(new_attributes)\n @attributes = new_attributes\n load_ab_person\n end", "title": "" }, { "docid": "5295c2170223024a0762e25512cf9fae", "score": "0.51197743", "text": "def insert_attribute m\n @attributes.add m\n end", "title": "" }, { "docid": "226d3bb8759377f0ebc48b0bd5a21a27", "score": "0.5119482", "text": "def derived_attributes\n @derive_attribute ||= {}\n end", "title": "" }, { "docid": "33edfbbca996218540aad6f8efde1f17", "score": "0.5114287", "text": "def enforce_new_permissions(opts={})\n enforce_create_permissions(opts)\n end", "title": "" }, { "docid": "a84b7c93e2fccda123dcdaf34710d7d9", "score": "0.51081955", "text": "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "title": "" }, { "docid": "a84b7c93e2fccda123dcdaf34710d7d9", "score": "0.51081955", "text": "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "title": "" }, { "docid": "ad28bc0782989ce1015ff5e926036d51", "score": "0.51034", "text": "def handle_missing_attributes(changes, fqdd)\n changes['VirtualizationMode'] = 'NONE'\n changes['NicPartitioning'] = 'Disabled'\n ['VirtualizationMode','NicPartitioning'].each do |dev_attr|\n #Check if Attribute name exists in the xml, and if it doesn't, check if we're trying to set to disabled. If so, delete from the list of changes.\n if xml_base.at_xpath(\"//Component[@FQDD='#{fqdd}']/Attribute[@Name='#{dev_attr}']\").nil?\n Puppet.debug(\"Trying to set #{dev_attr} but the relevant device does not exist on the server. The attribute will be ignored.\")\n changes.delete(dev_attr)\n end\n end\n end", "title": "" }, { "docid": "3833d48cb6752c62aa7f186a3707ae77", "score": "0.50978684", "text": "def method_missing(method, *args, &block)\n if respond_to_without_attributes?(method, true)\n super\n else\n match = matched_attribute_method(method.to_s)\n match ? attribute_missing(match, *args, &block) : super\n end\n end", "title": "" }, { "docid": "eac8c23a2718bf87574e2c484005f249", "score": "0.50976974", "text": "def test_hc_elementinuseattributeerr\n doc = nil\n newAttribute = nil\n addressElementList = nil\n testAddress = nil\n newElement = nil\n attrAddress = nil\n appendedChild = nil\n setAttr1 = nil\n setAttr2 = nil\n doc = load_document(\"hc_staff\", true)\n addressElementList = doc.getElementsByTagName(\"body\")\n testAddress = addressElementList.item(0)\n newElement = doc.createElement(\"p\")\n appendedChild = testAddress.appendChild(newElement)\n newAttribute = doc.createAttribute(\"title\")\n setAttr1 = newElement.setAttributeNode(newAttribute)\n \n begin\n success = false;\n begin\n setAttr2 = testAddress.setAttributeNode(newAttribute)\n rescue Taka::DOMException => ex\n success = (ex.code == Taka::DOMException::INUSE_ATTRIBUTE_ERR)\n end \n assert(success, \"throw_INUSE_ATTRIBUTE_ERR\")\n end\n\n end", "title": "" }, { "docid": "34e3ac98799a87580d2596dbff333a23", "score": "0.50948775", "text": "def enforce_new_permissions(opts={})\n #Call the HullAccessControlsEnforcement method for checking create/new permissions\n enforce_create_permissions\n end", "title": "" }, { "docid": "34e3ac98799a87580d2596dbff333a23", "score": "0.50948775", "text": "def enforce_new_permissions(opts={})\n #Call the HullAccessControlsEnforcement method for checking create/new permissions\n enforce_create_permissions\n end", "title": "" }, { "docid": "fdf2a9dd1798da83e6c0d01c57c8dcc3", "score": "0.5094869", "text": "def validate_required_attributes\n required = %i[currency_code direction epic force_open guaranteed_stop order_type size\n time_in_force]\n\n required.each do |attribute|\n raise ArgumentError, \"#{attribute} attribute must be set\" if attributes[attribute].nil?\n end\n end", "title": "" }, { "docid": "2aea02df3edb8715354f3233b415f8ba", "score": "0.50920266", "text": "def attr_need_validation? attr\n return false unless required_attributes\n required_attributes.include?(attr)\n end", "title": "" }, { "docid": "a722290284324a5fb53147b5a531bb33", "score": "0.50915664", "text": "def attr_type(attr_name)\n raise NotImplementedError\n end", "title": "" }, { "docid": "91b471ca37220bed55aee2923af49ed6", "score": "0.50892895", "text": "def valid_attributes\n { }\n end", "title": "" }, { "docid": "2bf414808b863daa60f4972fc1fc9bf7", "score": "0.5082506", "text": "def set_attribute_node_ns( new_attr )\n if new_attr.owner_document != self.owner_document then\n raise \"WRONG_DOCUMENT_ERR\"\n end\n if not new_attr.owner_element.nil? then\n raise \"INUSE_ATTRIBUTE_ERR\"\n end\n old_attr = nil\n @attr_nodes << new_attr\n new_attr._set_owner_element( self )\n old_attr\n end", "title": "" }, { "docid": "48056f0d52530662d0e53bdbc138f10c", "score": "0.50818837", "text": "def load_attributes()\n recipes, default_attrs, override_attrs = expand_node\n\n @cookbook_loader.each do |cookbook|\n cookbook.load_attributes(@node)\n end\n\n true\n end", "title": "" }, { "docid": "dc5b93f4cb0325c826d5301badad0f99", "score": "0.5080651", "text": "def special_attrib\n # we're going to ENFORCE that this model uses the has_role type\n a = Attrib.find_by_id self.attrib_id\n if a.nil? or !a.name.eql? HASNODE_NAME\n has_node = Attrib.add :name=>HASNODE_NAME, :description=>I18n.t('model.attribs.role.has_node'), :order=>999999\n self.attrib_id = has_node.id\n end\n end", "title": "" }, { "docid": "34eb869abc6bafeac86a6ef884d9d6f5", "score": "0.50805247", "text": "def method_missing(method, *args, &block)\n @attributes.send(method, *args, &block)\n end", "title": "" }, { "docid": "ea90de862740d9f7258b3dec87dcec01", "score": "0.5080381", "text": "def valid_attributes\n { }\n end", "title": "" }, { "docid": "ea90de862740d9f7258b3dec87dcec01", "score": "0.5080381", "text": "def valid_attributes\n { }\n end", "title": "" }, { "docid": "33a0dd8ea414602e391a4ce5691bb18e", "score": "0.5072077", "text": "def method_missing(method, *args, &block)\n @attributes.send(method, *args, &block)\n end", "title": "" } ]
1bf41563618a1457f717a80ad3c5c0fb
define the arguments that the user will input note there is no 'model' argument provided here. This may cause an issue.
[ { "docid": "501c25dc8013a7a5a48ef94db4225d19", "score": "0.0", "text": "def arguments(model = nil)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # Future functionality\n # zone_titles = []\n # model.getThermalZones.each do |thermalZone|\n # zone_name = thermalZone.name.empty? ? thermalZone.name.get : ''\n # zone_titles.push( zone_name )\n # end\n\n # Choice list of measure_zones\n measure_zones = ['All Zones']\n measure_zone = OpenStudio::Measure::OSArgument.makeChoiceArgument('measure_zone', measure_zones, measure_zones, true)\n measure_zone.setDefaultValue('All Zones')\n measure_zone.setDisplayName('Pick a Zone (or all Zones)')\n args << measure_zone\n\n return args\n end", "title": "" } ]
[ { "docid": "1ca1a7bc10c62ac56c28e41de24cddfe", "score": "0.75553864", "text": "def arguments(model = nil)\n args = OpenStudio::Measure::OSArgumentVector.new\n\t\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument(\"variable_name\",true)\n variable_name.setDisplayName(\"Enter Variable Name.\")\n\tvariable_name.setDefaultValue(\"Zone Air Temperature\")\n args << variable_name\n\t\n\tkey_name = OpenStudio::Measure::OSArgument.makeStringArgument(\"key_name\",true)\n key_name.setDisplayName(\"Enter Key Value Name.\")\n\tkey_name.setDefaultValue(\"THERMAL ZONE LAB\")\n args << key_name\n\t\n\treporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Zone Timestep\"\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency.\")\n reporting_frequency.setDefaultValue(\"Zone Timestep\")\n args << reporting_frequency \n\t\n file_path = OpenStudio::Measure::OSArgument.makeStringArgument(\"file_path\", true)\n file_path.setDisplayName(\"Enter the path to the file that contains reference value:\")\n file_path.setDescription(\"Example: 'C:\\\\Projects\\\\values.csv'\")\n\tfile_path.setDefaultValue(\"C:\\\\Users\\\\CGBC012\\\\Documents\\\\HZmodel\\\\MeasurementData\\\\lab.csv\")\n args << file_path\n\n return args\n end", "title": "" }, { "docid": "ab116ae887367a631bfa007c3a9d37d4", "score": "0.75511366", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a string argument for heater fuel type\n fuel_display_names = OpenStudio::StringVector.new\n fuel_display_names << Constants.FuelTypeGas\n fuel_display_names << Constants.FuelTypeOil\n fuel_display_names << Constants.FuelTypePropane\n fuel_display_names << Constants.FuelTypeWood\n fuel_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('fuel_type', fuel_display_names, true)\n fuel_type.setDisplayName('Fuel Type')\n fuel_type.setDescription('Type of fuel used for heating.')\n fuel_type.setDefaultValue(Constants.FuelTypeGas)\n args << fuel_type\n\n # make an argument for entering efficiency\n efficiency = OpenStudio::Measure::OSArgument::makeDoubleArgument('efficiency', true)\n efficiency.setDisplayName('Efficiency')\n efficiency.setUnits('Btu/Btu')\n efficiency.setDescription('The efficiency of the heater.')\n efficiency.setDefaultValue(0.78)\n args << efficiency\n\n # make an argument for entering fan power\n fan_power = OpenStudio::Measure::OSArgument::makeDoubleArgument('fan_power', true)\n fan_power.setDisplayName('Fan Power')\n fan_power.setUnits('W/cfm')\n fan_power.setDescription('Fan power (in W) per delivered airflow rate (in cfm) of the fan. A value of 0 implies there is no fan.')\n fan_power.setDefaultValue(0.0)\n args << fan_power\n\n # make an argument for entering airflow rate\n airflow_rate = OpenStudio::Measure::OSArgument::makeDoubleArgument('airflow_rate', true)\n airflow_rate.setDisplayName('Airflow Rate')\n airflow_rate.setUnits('cfm/ton')\n airflow_rate.setDescription('Fan airflow rate as a function of heating capacity. A value of 0 implies there is no fan.')\n airflow_rate.setDefaultValue(0.0)\n args << airflow_rate\n\n # make a string argument for heating output capacity\n capacity = OpenStudio::Measure::OSArgument::makeStringArgument('capacity', true)\n capacity.setDisplayName('Heating Capacity')\n capacity.setDescription(\"The output heating capacity of the heater. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n capacity.setUnits('kBtu/hr')\n capacity.setDefaultValue(Constants.SizingAuto)\n args << capacity\n\n # make a bool argument for open hvac flue\n has_hvac_flue = OpenStudio::Measure::OSArgument::makeBoolArgument('has_hvac_flue', true)\n has_hvac_flue.setDisplayName('Air Leakage: Has Open HVAC Flue')\n has_hvac_flue.setDescription('Specifies whether the building has an open flue associated with the HVAC system.')\n has_hvac_flue.setDefaultValue(true)\n args << has_hvac_flue\n\n return args\n end", "title": "" }, { "docid": "63e7cb4e061a44195fbd67a9c7a7ac69", "score": "0.7520922", "text": "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #make an argument for infiltration\r\n infiltration_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"infiltration_ip\",true)\r\n infiltration_ip.setDisplayName(\"Space Infiltration Flow per Exterior Envelope Surface Area (cfm/ft^2).\") #(ft^3/min)/(ft^2) = (ft/min)\r\n infiltration_ip.setDefaultValue(0.05)\r\n args << infiltration_ip\r\n\r\n #make an argument for material and installation cost\r\n material_cost_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"material_cost_ip\",true)\r\n material_cost_ip.setDisplayName(\"Increase in Material and Installation Costs for Building per Exterior Envelope Area ($/ft^2).\")\r\n material_cost_ip.setDefaultValue(0.0)\r\n args << material_cost_ip\r\n\r\n #make an argument for o&m cost\r\n om_cost_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"om_cost_ip\",true)\r\n om_cost_ip.setDisplayName(\"O & M Costs for Construction per Area Used ($/ft^2).\")\r\n om_cost_ip.setDefaultValue(0.0)\r\n args << om_cost_ip\r\n\r\n #make an argument for o&m frequency\r\n om_frequency = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"om_frequency\",true)\r\n om_frequency.setDisplayName(\"O & M Frequency (whole years).\")\r\n om_frequency.setDefaultValue(1)\r\n args << om_frequency\r\n\r\n return args\r\n end", "title": "" }, { "docid": "042b6f28fcbb878a22bb225bd28e93c0", "score": "0.7499953", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n\t#make a double argument for solar absorptivity\n\tsolar_abs = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"solar_abs\", true)\n\tsolar_abs.setDisplayName(\"Solar Absorptivity\")\n\tsolar_abs.setDescription(\"Fraction of the incident radiation that is absorbed.\")\n\tsolar_abs.setDefaultValue(0.85)\n\targs << solar_abs\n\n #make a double argument for emissivity\n\temiss = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"emissivity\", true)\n\temiss.setDisplayName(\"Emissivity\")\n\temiss.setDescription(\"Measure of the material's ability to emit infrared energy.\")\n\temiss.setDefaultValue(0.91)\n\targs << emiss\n \n #make a choice argument for material\n choices = OpenStudio::StringVector.new\n choices << Constants.RoofMaterialAsphaltShingles\n choices << Constants.RoofMaterialMembrane\n choices << Constants.RoofMaterialMetal\n choices << Constants.RoofMaterialTarGravel\n choices << Constants.RoofMaterialTile\n choices << Constants.RoofMaterialWoodShakes\n material = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"material\", choices, true)\n material.setDisplayName(\"Material\")\n material.setDescription(\"Material description used only for Manual J sizing calculations.\")\n material.setDefaultValue(Constants.RoofMaterialAsphaltShingles)\n args << material\n \n #make a choice argument for color\n choices = OpenStudio::StringVector.new\n choices << Constants.ColorWhite\n choices << Constants.ColorLight\n choices << Constants.ColorMedium\n choices << Constants.ColorDark\n color = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"color\", choices, true)\n color.setDisplayName(\"Color\")\n color.setDescription(\"Color description used only for Manual J sizing calculations.\")\n color.setDefaultValue(Constants.ColorMedium)\n args << color\n \n return args\n end", "title": "" }, { "docid": "c6536aa68817d632116a69247d8e8216", "score": "0.74726945", "text": "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #make an argument for your name\r\n source_idf_path = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"source_idf_path\",true)\r\n source_idf_path.setDisplayName(\"Path to Source IDF File to Use.\")\r\n args << source_idf_path\r\n\r\n #make an argument for importing site objects\r\n import_site_objects = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"import_site_objects\",true)\r\n import_site_objects.setDisplayName(\"Import Site Shading.\")\r\n # import_site_objects.setDisplayName(\"Import Site objects (site shading and exterior lights).\") # todo - use this once exterior lights are supported\r\n import_site_objects.setDefaultValue(true)\r\n args << import_site_objects\r\n \r\n return args\r\n end", "title": "" }, { "docid": "706e21d23dd8081c76e243f38122f8ee", "score": "0.74671876", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for the refrigeration system to modify\n ref_sys_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ref_sys_name\",true)\n ref_sys_name.setDisplayName(\"Select a Refrigeration System to Modify.\")\n ref_sys_name.setDefaultValue(\"Rack A Low Temp\")\n args << ref_sys_name \n \n #make an argument for minimum condensing temperature\n min_cond_temp_f = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"min_cond_temp_f\",true)\n min_cond_temp_f.setDisplayName(\"Minimum Condensing Temperature (F)\")\n min_cond_temp_f.setDefaultValue(70.0)\n args << min_cond_temp_f\n\n return args\n end", "title": "" }, { "docid": "7c85ef89b40db01db3f423dc7ef1cceb", "score": "0.7455161", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n \t#Make a string argument for dehumidifier energy factor\n energy_factor = OpenStudio::Measure::OSArgument::makeStringArgument(\"energy_factor\", true)\n energy_factor.setDisplayName(\"Energy Factor\")\n energy_factor.setDescription(\"The energy efficiency of dehumidifiers is measured by its energy factor, in liters of water removed per kilowatt-hour (kWh) of energy consumed or L/kWh.\")\n energy_factor.setUnits(\"L/kWh\")\n energy_factor.setDefaultValue(Constants.Auto)\n args << energy_factor\n \n \t#Make a string argument for dehumidifier water removal rate\n water_removal_rate = OpenStudio::Measure::OSArgument::makeStringArgument(\"water_removal_rate\", true)\n water_removal_rate.setDisplayName(\"Water Removal Rate\")\n water_removal_rate.setDescription(\"Dehumidifier rated water removal rate measured in pints per day at an inlet condition of 80 degrees F DB/60%RH.\")\n water_removal_rate.setUnits(\"Pints/day\")\n water_removal_rate.setDefaultValue(Constants.Auto)\n args << water_removal_rate\n \n \t#Make a string argument for dehumidifier air flow rate\n air_flow_rate = OpenStudio::Measure::OSArgument::makeStringArgument(\"air_flow_rate\", true)\n air_flow_rate.setDisplayName(\"Air Flow Rate\")\n air_flow_rate.setDescription(\"The dehumidifier rated air flow rate in CFM. If 'auto' is entered, the air flow will be determined using the rated water removal rate.\")\n air_flow_rate.setUnits(\"cfm\")\n air_flow_rate.setDefaultValue(Constants.Auto)\n args << air_flow_rate\n \n \t#Make a string argument for humidity setpoint\n humidity_setpoint = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"humidity_setpoint\", true)\n humidity_setpoint.setDisplayName(\"Annual Relative Humidity Setpoint\")\n humidity_setpoint.setDescription(\"The annual relative humidity setpoint.\")\n humidity_setpoint.setUnits(\"frac\")\n humidity_setpoint.setDefaultValue(Constants.DefaultHumiditySetpoint)\n args << humidity_setpoint \n \n return args\n end", "title": "" }, { "docid": "a621369416106dfc31a41da0e690ecb4", "score": "0.74360424", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # the name of the space to add to the model\n #inp_file = OpenStudio::Ruleset::OSArgument::makePathArgument(\"INPModelPath\",true,\"osm\")\n inp_file = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"inp_file\", true)\n inp_file.setDisplayName(\"inp_file\")\n inp_file.setDescription(\"Full path of DOE 2.2 inp file. USE FORWARD SLASH ONLY IN PATH\")\n args << inp_file\n\n return args\n end", "title": "" }, { "docid": "d244d94b938e3da3ab5baa87f7595352", "score": "0.7411796", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for external idf\n source_idf_path = OpenStudio::Measure::OSArgument.makeStringArgument('source_idf_path', true)\n source_idf_path.setDisplayName('External IDF File Name')\n source_idf_path.setDescription('Name of the IDF file to import objects from. This is the filename with the extension (e.g. MyModel.idf). Optionally this can inclucde the full file path, but for most use cases should just be file name.')\n args << source_idf_path\n\n # make an argument for importing site objects\n import_site_objects = OpenStudio::Measure::OSArgument.makeBoolArgument('import_site_objects', true)\n import_site_objects.setDisplayName('Import Site Shading.')\n # import_site_objects.setDisplayName(\"Import Site objects (site shading and exterior lights).\") # todo - use this once exterior lights are supported\n import_site_objects.setDefaultValue(true)\n args << import_site_objects\n\n return args\n end", "title": "" }, { "docid": "d244d94b938e3da3ab5baa87f7595352", "score": "0.7411796", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for external idf\n source_idf_path = OpenStudio::Measure::OSArgument.makeStringArgument('source_idf_path', true)\n source_idf_path.setDisplayName('External IDF File Name')\n source_idf_path.setDescription('Name of the IDF file to import objects from. This is the filename with the extension (e.g. MyModel.idf). Optionally this can inclucde the full file path, but for most use cases should just be file name.')\n args << source_idf_path\n\n # make an argument for importing site objects\n import_site_objects = OpenStudio::Measure::OSArgument.makeBoolArgument('import_site_objects', true)\n import_site_objects.setDisplayName('Import Site Shading.')\n # import_site_objects.setDisplayName(\"Import Site objects (site shading and exterior lights).\") # todo - use this once exterior lights are supported\n import_site_objects.setDefaultValue(true)\n args << import_site_objects\n\n return args\n end", "title": "" }, { "docid": "847e7cddf31925a0e61c29d8c82a2f78", "score": "0.74041027", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n\n\n # Make an argument for evap effectiveness\n input_csv_path = OpenStudio::Measure::OSArgument::makeStringArgument(\"input_csv_folder_path\",true)\n input_csv_path.setDisplayName(\"raw_data_input_folder_path\")\n input_csv_path.setDefaultValue(\"data_file\")\n args << input_csv_path\n\n test_numbers = OpenStudio::StringVector.new\n test_numbers << 'Experiment3_200124_input.csv'\n test_numbers << 'Experiment6_200210_input.csv'\n test_numbers << 'Experiment8_200214_input.csv'\n test_numbers << 'Experiment9_200707_input.csv'\n # test_numbers << 'Experiment8_200214_input_cooling.csv'\n test_names = OpenStudio::StringVector.new\n test_names << 'UA_test'\n test_names << 'Cooling_test'\n test_names << 'Plenum_test'\n # test_names << 'Plenum_test_cooling'\n test_selections = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('test_data',test_numbers,test_names,true)\n\n \n test_selections.setDisplayName(\"Experiment\")\n test_selections.setDefaultValue(\"Experiment3_200124_input.csv\")\n args << test_selections\n\n \n return args\n end", "title": "" }, { "docid": "933615172650e73f9fbf99dc4b96a91d", "score": "0.7403648", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for infiltration\n infiltration_ip = OpenStudio::Measure::OSArgument.makeDoubleArgument('infiltration_ip', true)\n infiltration_ip.setDisplayName('Space Infiltration Flow per Exterior Envelope Surface Area (cfm/ft^2).') # (ft^3/min)/(ft^2) = (ft/min)\n infiltration_ip.setDefaultValue(0.05)\n args << infiltration_ip\n\n # make an argument for material and installation cost\n material_cost_ip = OpenStudio::Measure::OSArgument.makeDoubleArgument('material_cost_ip', true)\n material_cost_ip.setDisplayName('Increase in Material and Installation Costs for Building per Exterior Envelope Area ($/ft^2).')\n material_cost_ip.setDefaultValue(0.0)\n args << material_cost_ip\n\n # make an argument for o&m cost\n om_cost_ip = OpenStudio::Measure::OSArgument.makeDoubleArgument('om_cost_ip', true)\n om_cost_ip.setDisplayName('O & M Costs for Construction per Area Used ($/ft^2).')\n om_cost_ip.setDefaultValue(0.0)\n args << om_cost_ip\n\n # make an argument for o&m frequency\n om_frequency = OpenStudio::Measure::OSArgument.makeIntegerArgument('om_frequency', true)\n om_frequency.setDisplayName('O & M Frequency (whole years).')\n om_frequency.setDefaultValue(1)\n args << om_frequency\n\n return args\n end", "title": "" }, { "docid": "e233db8e5e22a1e637a3b89e66d2c305", "score": "0.7401044", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for wall insulation height\n wall_ins_height = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"wall_ins_height\", true)\n wall_ins_height.setDisplayName(\"Wall Insulation Height\")\n\twall_ins_height.setUnits(\"ft\")\n\twall_ins_height.setDescription(\"Height of the insulation on the basement wall.\")\n wall_ins_height.setDefaultValue(8)\n args << wall_ins_height\n\n #make a double argument for wall cavity R-value\n wall_cavity_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"wall_cavity_r\", true)\n wall_cavity_r.setDisplayName(\"Wall Cavity Insulation Installed R-value\")\n\twall_cavity_r.setUnits(\"h-ft^2-R/Btu\")\n\twall_cavity_r.setDescription(\"Refers to the R-value of the cavity insulation as installed and not the overall R-value of the assembly. If batt insulation must be compressed to fit within the cavity (e.g. R19 in a 5.5\\\" 2x6 cavity), use an R-value that accounts for this effect (see HUD Mobile Home Construction and Safety Standards 3280.509 for reference).\")\n wall_cavity_r.setDefaultValue(0)\n args << wall_cavity_r\n \n #make a choice argument for model objects\n installgrade_display_names = OpenStudio::StringVector.new\n installgrade_display_names << \"I\"\n installgrade_display_names << \"II\"\n installgrade_display_names << \"III\"\n\n\t#make a choice argument for wall cavity insulation installation grade\n\twall_cavity_grade = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"wall_cavity_grade\", installgrade_display_names, true)\n\twall_cavity_grade.setDisplayName(\"Wall Cavity Install Grade\")\n\twall_cavity_grade.setDescription(\"Installation grade as defined by RESNET standard. 5% of the cavity is considered missing insulation for Grade 3, 2% for Grade 2, and 0% for Grade 1.\")\n wall_cavity_grade.setDefaultValue(\"I\")\n\targs << wall_cavity_grade\n \n #make a double argument for wall cavity depth\n wall_cavity_depth = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"wall_cavity_depth\", true)\n wall_cavity_depth.setDisplayName(\"Wall Cavity Depth\")\n\twall_cavity_depth.setUnits(\"in\")\n\twall_cavity_depth.setDescription(\"Depth of the stud cavity. 3.5\\\" for 2x4s, 5.5\\\" for 2x6s, etc.\")\n wall_cavity_depth.setDefaultValue(0)\n args << wall_cavity_depth\n \n\t#make a bool argument for whether the cavity insulation fills the wall cavity\n\twall_cavity_insfills = OpenStudio::Measure::OSArgument::makeBoolArgument(\"wall_cavity_insfills\", true)\n\twall_cavity_insfills.setDisplayName(\"Wall Insulation Fills Cavity\")\n\twall_cavity_insfills.setDescription(\"When the insulation does not completely fill the depth of the cavity, air film resistances are added to the insulation R-value.\")\n wall_cavity_insfills.setDefaultValue(false)\n\targs << wall_cavity_insfills\n \n #make a double argument for wall framing factor\n wall_ff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"wall_ff\", true)\n wall_ff.setDisplayName(\"Wall Framing Factor\")\n\twall_ff.setUnits(\"frac\")\n\twall_ff.setDescription(\"The fraction of a basement wall assembly that is comprised of structural framing.\")\n wall_ff.setDefaultValue(0)\n args << wall_ff\n \n #make a double argument for wall continuous insulation R-value\n wall_rigid_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"wall_rigid_r\", true)\n wall_rigid_r.setDisplayName(\"Wall Continuous Insulation Nominal R-value\")\n\twall_rigid_r.setUnits(\"hr-ft^2-R/Btu\")\n\twall_rigid_r.setDescription(\"The R-value of the continuous insulation.\")\n wall_rigid_r.setDefaultValue(10.0)\n args << wall_rigid_r\n\n #make a double argument for wall continuous insulation thickness\n wall_rigid_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"wall_rigid_thick_in\", true)\n wall_rigid_thick_in.setDisplayName(\"Wall Continuous Insulation Thickness\")\n\twall_rigid_thick_in.setUnits(\"in\")\n\twall_rigid_thick_in.setDescription(\"The thickness of the continuous insulation.\")\n wall_rigid_thick_in.setDefaultValue(2.0)\n args << wall_rigid_thick_in\n \n\t#make a choice argument for ceiling framing factor\n\tceil_ff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"ceil_ff\", true)\n ceil_ff.setDisplayName(\"Ceiling Framing Factor\")\n\tceil_ff.setUnits(\"frac\")\n\tceil_ff.setDescription(\"Fraction of ceiling that is framing.\")\n ceil_ff.setDefaultValue(0.13)\n\targs << ceil_ff\n\n\t#make a choice argument for ceiling joist height\n\tceil_joist_height = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"ceil_joist_height\", true)\n\tceil_joist_height.setDisplayName(\"Ceiling Joist Height\")\n\tceil_joist_height.setUnits(\"in\")\n\tceil_joist_height.setDescription(\"Height of the joist member.\")\n\tceil_joist_height.setDefaultValue(9.25)\n\targs << ceil_joist_height\t\n \n #make a string argument for exposed perimeter\n exposed_perim = OpenStudio::Measure::OSArgument::makeStringArgument(\"exposed_perim\", true)\n\texposed_perim.setDisplayName(\"Exposed Perimeter\")\n\texposed_perim.setUnits(\"ft\")\n\texposed_perim.setDescription(\"Total length of the basement's perimeter that is on the exterior of the building's footprint.\")\n\texposed_perim.setDefaultValue(Constants.Auto)\n\targs << exposed_perim\t\n\n return args\n end", "title": "" }, { "docid": "9ac98c89c959931c8cebc417ed6c4217", "score": "0.7400964", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for entering optional window u-factor\n ufactor = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"ufactor\",false)\n ufactor.setDisplayName(\"U-Value\")\n ufactor.setUnits(\"Btu/hr-ft^2-R\")\n ufactor.setDescription(\"The heat transfer coefficient of the windows.\")\n ufactor.setDefaultValue(0.37)\n args << ufactor\n\n #make an argument for entering optional window shgc\n shgc = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"shgc\",false)\n shgc.setDisplayName(\"SHGC\")\n shgc.setDescription(\"The ratio of solar heat gain through a glazing system compared to that of an unobstructed opening.\")\n shgc.setDefaultValue(0.3)\n args << shgc\n\n #make an argument for entering optional window u-factor\n heating_shade_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"heating_shade_mult\",false)\n heating_shade_mult.setDisplayName(\"Heating Shade Multiplier\")\n heating_shade_mult.setDescription(\"Interior shading multiplier for heating season. 1.0 indicates no reduction in solar gain, 0.85 indicates 15% reduction, etc.\")\n heating_shade_mult.setDefaultValue(0.7)\n args << heating_shade_mult\n\n #make an argument for entering optional window shgc\n cooling_shade_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cooling_shade_mult\",false)\n cooling_shade_mult.setDisplayName(\"Cooling Shade Multiplier\")\n cooling_shade_mult.setDescription(\"Interior shading multiplier for cooling season. 1.0 indicates no reduction in solar gain, 0.85 indicates 15% reduction, etc.\")\n cooling_shade_mult.setDefaultValue(0.7)\n args << cooling_shade_mult\n\n return args\n end", "title": "" }, { "docid": "e993ca7e97881e1c50f73dc4bba0c818", "score": "0.7388505", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an integer argument for number of place settings\n num_settings = OpenStudio::Measure::OSArgument::makeIntegerArgument('num_settings', true)\n num_settings.setDisplayName('Number of Place Settings')\n num_settings.setUnits('#')\n num_settings.setDescription(\"The number of place settings for the unit. Data obtained from manufacturer's literature.\")\n num_settings.setDefaultValue(12)\n args << num_settings\n\n # make a double argument for rated annual consumption\n rated_annual_energy = OpenStudio::Measure::OSArgument::makeDoubleArgument('rated_annual_energy', true)\n rated_annual_energy.setDisplayName('Rated Annual Consumption')\n rated_annual_energy.setUnits('kWh')\n rated_annual_energy.setDescription('The annual energy consumed by the dishwasher, as rated, obtained from the EnergyGuide label. This includes both the appliance electricity consumption and the energy required for water heating.')\n rated_annual_energy.setDefaultValue(290)\n args << rated_annual_energy\n\n # make a bool argument for internal heater adjustment\n has_internal_heater = OpenStudio::Measure::OSArgument::makeBoolArgument('has_internal_heater', true)\n has_internal_heater.setDisplayName('Internal Heater Adjustment')\n has_internal_heater.setDescription(\"Does the system use an internal electric heater to adjust water temperature? Input obtained from manufacturer's literature.\")\n has_internal_heater.setDefaultValue('true')\n args << has_internal_heater\n\n # make a bool argument for cold water inlet only\n cold_inlet = OpenStudio::Measure::OSArgument::makeBoolArgument('cold_inlet', true)\n cold_inlet.setDisplayName('Cold Water Inlet Only')\n cold_inlet.setDescription(\"Does the dishwasher use a cold water connection only. Input obtained from manufacturer's literature.\")\n cold_inlet.setDefaultValue('false')\n args << cold_inlet\n\n # make a double argument for cold water connection use\n cold_use = OpenStudio::Measure::OSArgument::makeDoubleArgument('cold_use', true)\n cold_use.setDisplayName('Cold Water Conn Use Per Cycle')\n cold_use.setUnits('gal/cycle')\n cold_use.setDescription(\"Volume of water per cycle used if there is only a cold water inlet connection, for the dishwasher. Input obtained from manufacturer's literature.\")\n cold_use.setDefaultValue(0)\n args << cold_use\n\n # make an integer argument for energy guide date\n test_date = OpenStudio::Measure::OSArgument::makeIntegerArgument('test_date', true)\n test_date.setDisplayName('Energy Guide Date')\n test_date.setDescription('Energy Guide test date.')\n test_date.setDefaultValue(2007)\n args << test_date\n\n # make a double argument for energy guide annual gas cost\n annual_gas_cost = OpenStudio::Measure::OSArgument::makeDoubleArgument('annual_gas_cost', true)\n annual_gas_cost.setDisplayName('Energy Guide Annual Gas Cost')\n annual_gas_cost.setUnits('$/yr')\n annual_gas_cost.setDescription('Annual cost of gas, as rated. Obtained from the EnergyGuide label.')\n annual_gas_cost.setDefaultValue(23)\n args << annual_gas_cost\n\n # make a double argument for occupancy energy multiplier\n mult_e = OpenStudio::Measure::OSArgument::makeDoubleArgument('mult_e', true)\n mult_e.setDisplayName('Occupancy Energy Multiplier')\n mult_e.setDescription('Appliance energy use is multiplied by this factor to account for occupancy usage that differs from the national average.')\n mult_e.setDefaultValue(1)\n args << mult_e\n\n # make a double argument for occupancy water multiplier\n mult_hw = OpenStudio::Measure::OSArgument::makeDoubleArgument('mult_hw', true)\n mult_hw.setDisplayName('Occupancy Hot Water Multiplier')\n mult_hw.setDescription('Appliance hot water use is multiplied by this factor to account for occupancy usage that differs from the national average. This should generally be equal to the Occupancy Energy Multiplier.')\n mult_hw.setDefaultValue(1)\n args << mult_hw\n\n # make a choice argument for location\n location_args = OpenStudio::StringVector.new\n location_args << Constants.Auto\n Geometry.get_model_locations(model).each do |loc|\n location_args << loc\n end\n location = OpenStudio::Measure::OSArgument::makeChoiceArgument('location', location_args, true, true)\n location.setDisplayName('Location')\n location.setDescription(\"The space type for the location. '#{Constants.Auto}' will automatically choose a space type based on the space types found in the model.\")\n location.setDefaultValue(Constants.Auto)\n args << location\n\n # make a choice argument for plant loop\n plant_loops = model.getPlantLoops\n plant_loop_args = OpenStudio::StringVector.new\n plant_loop_args << Constants.Auto\n plant_loops.each do |plant_loop|\n plant_loop_args << plant_loop.name.to_s\n end\n plant_loop = OpenStudio::Measure::OSArgument::makeChoiceArgument('plant_loop', plant_loop_args, true, true)\n plant_loop.setDisplayName('Plant Loop')\n plant_loop.setDescription(\"Select the plant loop for the dishwasher. '#{Constants.Auto}' will try to choose the plant loop associated with the specified space. For multifamily buildings, '#{Constants.Auto}' will choose the plant loop for each unit of the building.\")\n plant_loop.setDefaultValue(Constants.Auto)\n args << plant_loop\n\n return args\n end", "title": "" }, { "docid": "9fedd1cbaf14202928e47a7f505bb175", "score": "0.73881626", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for nominal R-value of cavity insulation\n cavity_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cavity_r\", true)\n cavity_r.setDisplayName(\"Cavity Insulation Nominal R-value\")\n cavity_r.setUnits(\"hr-ft^2-R/Btu\")\n cavity_r.setDescription(\"Refers to the R-value of the cavity insulation and not the overall R-value of the assembly.\")\n cavity_r.setDefaultValue(19.0)\n args << cavity_r\n\n #make a choice argument for wall cavity insulation installation grade\n installgrade_display_names = OpenStudio::StringVector.new\n installgrade_display_names << \"I\"\n installgrade_display_names << \"II\"\n installgrade_display_names << \"III\"\n install_grade = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"install_grade\", installgrade_display_names, true)\n install_grade.setDisplayName(\"Cavity Install Grade\")\n install_grade.setDescription(\"Installation grade as defined by RESNET standard. 5% of the cavity is considered missing insulation for Grade 3, 2% for Grade 2, and 0% for Grade 1.\")\n install_grade.setDefaultValue(\"I\")\n args << install_grade \n\n #make a choice argument for unfinished attic ceiling framing factor\n framing_factor = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"framing_factor\", true)\n framing_factor.setDisplayName(\"Framing Factor\")\n framing_factor.setUnits(\"frac\")\n framing_factor.setDescription(\"The fraction of a floor assembly that is comprised of structural framing.\")\n framing_factor.setDefaultValue(0.13)\n args << framing_factor\n \n return args\n end", "title": "" }, { "docid": "9fedd1cbaf14202928e47a7f505bb175", "score": "0.7387832", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for nominal R-value of cavity insulation\n cavity_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cavity_r\", true)\n cavity_r.setDisplayName(\"Cavity Insulation Nominal R-value\")\n cavity_r.setUnits(\"hr-ft^2-R/Btu\")\n cavity_r.setDescription(\"Refers to the R-value of the cavity insulation and not the overall R-value of the assembly.\")\n cavity_r.setDefaultValue(19.0)\n args << cavity_r\n\n #make a choice argument for wall cavity insulation installation grade\n installgrade_display_names = OpenStudio::StringVector.new\n installgrade_display_names << \"I\"\n installgrade_display_names << \"II\"\n installgrade_display_names << \"III\"\n install_grade = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"install_grade\", installgrade_display_names, true)\n install_grade.setDisplayName(\"Cavity Install Grade\")\n install_grade.setDescription(\"Installation grade as defined by RESNET standard. 5% of the cavity is considered missing insulation for Grade 3, 2% for Grade 2, and 0% for Grade 1.\")\n install_grade.setDefaultValue(\"I\")\n args << install_grade \n\n #make a choice argument for unfinished attic ceiling framing factor\n framing_factor = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"framing_factor\", true)\n framing_factor.setDisplayName(\"Framing Factor\")\n framing_factor.setUnits(\"frac\")\n framing_factor.setDescription(\"The fraction of a floor assembly that is comprised of structural framing.\")\n framing_factor.setDefaultValue(0.13)\n args << framing_factor\n \n return args\n end", "title": "" }, { "docid": "bac751bf6828fb2f05711235e44379f2", "score": "0.73861116", "text": "def arguments(_model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an electric json argument\n electric_json = OpenStudio::Measure::OSArgument.makeStringArgument('electric_json', true)\n electric_json.setDisplayName('Path to electric JSON')\n args << electric_json\n\n # make a gas json argument\n gas_json = OpenStudio::Measure::OSArgument.makeStringArgument('gas_json', true)\n gas_json.setDisplayName('Path to gas JSON')\n args << gas_json\n\n water_json = OpenStudio::Measure::OSArgument.makeStringArgument('water_json', false)\n water_json.setDisplayName('Path to water JSON')\n args << water_json\n\n # make a start date argument\n start_date = OpenStudio::Measure::OSArgument.makeStringArgument('start_date', true)\n start_date.setDisplayName('Start date')\n args << start_date\n\n # make an end date argument\n end_date = OpenStudio::Measure::OSArgument.makeStringArgument('end_date', true)\n end_date.setDisplayName('End date')\n args << end_date\n\n args\n end", "title": "" }, { "docid": "17366170d6d7476b6593ddd38fbaed2c", "score": "0.73841923", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\t\t\n\n #make a string argument for number of bedrooms\n num_br = OpenStudio::Measure::OSArgument::makeStringArgument(\"num_bedrooms\", false)\n num_br.setDisplayName(\"Number of Bedrooms\")\n num_br.setDescription(\"Specify the number of bedrooms. For a multifamily building, specify one value for all units or a comma-separated set of values (in the correct order) for each unit. Used to determine the energy usage of appliances and plug loads, hot water usage, mechanical ventilation rate, etc.\")\n num_br.setDefaultValue(\"3\")\n args << num_br\n \n #make a string argument for number of bathrooms\n num_ba = OpenStudio::Measure::OSArgument::makeStringArgument(\"num_bathrooms\", false)\n num_ba.setDisplayName(\"Number of Bathrooms\")\n num_ba.setDescription(\"Specify the number of bathrooms. For a multifamily building, specify one value for all units or a comma-separated set of values (in the correct order) for each unit. Used to determine the hot water usage, etc.\")\n num_ba.setDefaultValue(\"2\")\n args << num_ba\n \n return args\n end", "title": "" }, { "docid": "0c6b61d464214e951774a66776421d36", "score": "0.7382184", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # DR event schedule name\n dr_event_schedule = OpenStudio::Measure::OSArgument.makeStringArgument(\"dr_event_schedule\", true)\n dr_event_schedule.setDisplayName(\"DR Event Schedule Name\")\n dr_event_schedule.setDescription(\"Name of the schedule to use for setting the EMS code.\")\n dr_event_schedule.setDefaultValue(\"dr_event\")\n args << dr_event_schedule\n\n # Amount to lower water heater setpoint by during DR Event\n event_delta_t = OpenStudio::Measure::OSArgument.makeDoubleArgument(\"event_delta_t\", true)\n event_delta_t.setDisplayName(\"Event Delta T\")\n event_delta_t.setDescription(\"Amount to lower water heater setpoint by during DR Event. Use negative number to increase water heater setpoint during event.\")\n event_delta_t.setUnits(\"degC\")\n #event_delta_t.setMinValue(-20.0)\n #event_delta_t.setMaxValue(20.0)\n args << event_delta_t\n\t\t\n # water heater setpoint schedule\n water_heater_setpoint_schedule = OpenStudio::Measure::OSArgument.makeStringArgument(\"water_heater_setpoint_schedule\", true)\n water_heater_setpoint_schedule.setDisplayName(\"Water Heater Setpoint Schedule Name\")\n water_heater_setpoint_schedule.setDescription(\"Name of the water heater setpoint schedule. Will not be changed, but needed for EMS script.\")\n water_heater_setpoint_schedule.setDefaultValue(\"WH Setpoint Temp\")\n args << water_heater_setpoint_schedule\n\t\t\n # DHW plant loop setpoint schedule\n plant_setpoint_schedule = OpenStudio::Measure::OSArgument.makeStringArgument(\"plant_setpoint_schedule\", true)\n plant_setpoint_schedule.setDisplayName(\"DHW Plant Loop Setpoint Schedule Name\")\n plant_setpoint_schedule.setDescription(\"Name of the DHW plant loop setpoint schedule. Will not be changed, but needed for EMS script.\")\n plant_setpoint_schedule.setDefaultValue(\"dhw temp\")\n args << plant_setpoint_schedule\n\n return args\n end", "title": "" }, { "docid": "b358991c0fbdb1e4c2911b558c9b69aa", "score": "0.7376052", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n \n #make a double argument for hardwired CFL fraction\n hw_cfl = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"hw_cfl\",true)\n hw_cfl.setDisplayName(\"Hardwired Fraction CFL\")\n hw_cfl.setDescription(\"Fraction of all hardwired lamps (interior, garage, and exterior) that are compact fluorescent. Hardwired lighting not specified as CFL, LED, or LFL is assumed to be incandescent.\")\n hw_cfl.setDefaultValue(0.34)\n args << hw_cfl\n \n #make a double argument for hardwired LED fraction\n hw_led = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"hw_led\",true)\n hw_led.setDisplayName(\"Hardwired Fraction LED\")\n hw_led.setDescription(\"Fraction of all hardwired lamps (interior, garage, and exterior) that are LED. Hardwired lighting not specified as CFL, LED, or LFL is assumed to be incandescent.\")\n hw_led.setDefaultValue(0)\n args << hw_led\n \n #make a double argument for hardwired LFL fraction\n hw_lfl = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"hw_lfl\",true)\n hw_lfl.setDisplayName(\"Hardwired Fraction LFL\")\n hw_lfl.setDescription(\"Fraction of all hardwired lamps (interior, garage, and exterior) that are linear fluorescent. Hardwired lighting not specified as CFL, LED, or LFL is assumed to be incandescent.\")\n hw_lfl.setDefaultValue(0)\n args << hw_lfl\n \n #make a double argument for Plugin CFL fraction\n pg_cfl = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"pg_cfl\",true)\n pg_cfl.setDisplayName(\"Plugin Fraction CFL\")\n pg_cfl.setDescription(\"Fraction of all plugin lamps that are compact fluorescent. Plugin lighting not specified as CFL, LED, or LFL is assumed to be incandescent.\")\n pg_cfl.setDefaultValue(0.34)\n args << pg_cfl\n \n #make a double argument for Plugin LED fraction\n pg_led = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"pg_led\",true)\n pg_led.setDisplayName(\"Plugin Fraction LED\")\n pg_led.setDescription(\"Fraction of all plugin lamps that are LED. Plugin lighting not specified as CFL, LED, or LFL is assumed to be incandescent.\")\n pg_led.setDefaultValue(0)\n args << pg_led\n \n #make a double argument for Plugin LFL fraction\n pg_lfl = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"pg_lfl\",true)\n pg_lfl.setDisplayName(\"Plugin Fraction LFL\")\n pg_lfl.setDescription(\"Fraction of all plugin lamps that are linear fluorescent. Plugin lighting not specified as CFL, LED, or LFL is assumed to be incandescent.\")\n pg_lfl.setDefaultValue(0)\n args << pg_lfl\n \n #make a double argument for Incandescent Efficacy\n in_eff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"in_eff\",true)\n in_eff.setDisplayName(\"Incandescent Efficacy\")\n in_eff.setUnits(\"lm/W\")\n in_eff.setDescription(\"The ratio of light output from an incandescent lamp to the electric power it consumes.\")\n in_eff.setDefaultValue(15)\n args << in_eff\n \n #make a double argument for CFL Efficacy\n cfl_eff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cfl_eff\",true)\n cfl_eff.setDisplayName(\"CFL Efficacy\")\n cfl_eff.setUnits(\"lm/W\")\n cfl_eff.setDescription(\"The ratio of light output from a CFL lamp to the electric power it consumes.\")\n cfl_eff.setDefaultValue(55)\n args << cfl_eff\n \n #make a double argument for LED Efficacy\n led_eff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"led_eff\",true)\n led_eff.setDisplayName(\"LED Efficacy\")\n led_eff.setUnits(\"lm/W\")\n led_eff.setDescription(\"The ratio of light output from a LED lamp to the electric power it consumes.\")\n led_eff.setDefaultValue(80)\n args << led_eff\n \n #make a double argument for LFL Efficacy\n lfl_eff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"lfl_eff\",true)\n lfl_eff.setDisplayName(\"LFL Efficacy\")\n lfl_eff.setUnits(\"lm/W\")\n lfl_eff.setDescription(\"The ratio of light output from a LFL lamp to the electric power it consumes.\")\n lfl_eff.setDefaultValue(88)\n args << lfl_eff\n\n return args\n end", "title": "" }, { "docid": "e9134efd7a2979b6871c2f513ab1ac9b", "score": "0.73746115", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for room air eer\n eer = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"eer\", true)\n eer.setDisplayName(\"EER\")\n eer.setUnits(\"Btu/W-h\")\n eer.setDescription(\"This is a measure of the instantaneous energy efficiency of the cooling equipment.\")\n eer.setDefaultValue(8.5)\n args << eer \n \n #make a double argument for room air shr\n shr = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"shr\", true)\n shr.setDisplayName(\"Rated SHR\")\n shr.setDescription(\"The sensible heat ratio (ratio of the sensible portion of the load to the total load) at the nominal rated capacity.\")\n shr.setDefaultValue(0.65)\n args << shr\n\n #make a double argument for room air airflow\n airflow = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"airflow_rate\", true)\n airflow.setDisplayName(\"Airflow\")\n airflow.setUnits(\"cfm/ton\")\n airflow.setDefaultValue(350.0)\n args << airflow\n \n #make a choice argument for room air cooling output capacity\n output_capacity = OpenStudio::Measure::OSArgument::makeStringArgument(\"capacity\", true)\n output_capacity.setDisplayName(\"Cooling Capacity\")\n output_capacity.setDescription(\"The output cooling capacity of the air conditioner. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n output_capacity.setUnits(\"tons\")\n output_capacity.setDefaultValue(Constants.SizingAuto)\n args << output_capacity \n\n return args\n end", "title": "" }, { "docid": "b979191dcf0c58d7ef8590cd3c30c3da", "score": "0.7372544", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n \n\n # Make an argument for evap effectiveness\n run_csv_path = OpenStudio::Measure::OSArgument::makePathArgument(\"input_csv_path\",true,\".csv\")\n run_csv_path.setDisplayName(\"external_file_input\")\n run_csv_path.setDefaultValue(\"data_file.csv\")\n args << run_csv_path\n \n inside_convection_coff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"inside_convection_coff\",true)\n inside_convection_coff.setDisplayName(\"inside_convection_coff\")\n inside_convection_coff.setDefaultValue(0.395)\n args << inside_convection_coff\n\n interior_override = OpenStudio::Measure::OSArgument::makeBoolArgument (\"convection_override\")\n interior_override.setDisplayName(\"convection_override\")\n interior_override.setDefaultValue(true)\n args << interior_override\n\n inside_convection_coff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"zone_capacitance_value\",true)\n inside_convection_coff.setDisplayName(\"zone_capacitance_value\")\n inside_convection_coff.setDefaultValue(1.0)\n args << inside_convection_coff\n r_value = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"r_value\",true)\n r_value.setDisplayName(\"r_value\")\n r_value.setDefaultValue(0.019)\n args << r_value\n\n return args\n end", "title": "" }, { "docid": "767d2dab479dbf025042ec1313ad9f19", "score": "0.73665494", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n \n #make a choice argument for model objects\n roof_structure_display_names = OpenStudio::StringVector.new\n roof_structure_display_names << Constants.RoofStructureTrussCantilever\n roof_structure_display_names << Constants.RoofStructureRafter\n\t\n #make a choice argument for roof type\n roof_structure = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"roof_structure\", roof_structure_display_names, true)\n roof_structure.setDisplayName(\"Roof Structure\")\n roof_structure.setDescription(\"The roof structure of the building.\")\n roof_structure.setDefaultValue(Constants.RoofStructureTrussCantilever)\n args << roof_structure\t\n\t\n #make a choice argument for eaves depth\n eaves_depth = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"eaves_depth\", true)\n eaves_depth.setDisplayName(\"Eaves Depth\")\n eaves_depth.setUnits(\"ft\")\n eaves_depth.setDescription(\"The eaves depth of the roof.\")\n eaves_depth.setDefaultValue(2.0)\n args << eaves_depth \n \n return args\n end", "title": "" }, { "docid": "766408c13215773975416d124329f788", "score": "0.7358208", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for total floor area\n total_bldg_area_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"total_bldg_area_ip\",true)\n total_bldg_area_ip.setDisplayName(\"Total Building Floor Area (ft^2).\")\n total_bldg_area_ip.setDefaultValue(10000.0)\n args << total_bldg_area_ip\n\n #make an argument for aspect ratio\n ns_to_ew_ratio = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ns_to_ew_ratio\",true)\n ns_to_ew_ratio.setDisplayName(\"Ratio of North/South Facade Length Relative to East/West Facade Length.\")\n ns_to_ew_ratio.setDefaultValue(2.0)\n args << ns_to_ew_ratio\n\n #make an argument for number of floors\n num_floors = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"num_floors\",true)\n num_floors.setDisplayName(\"Number of Floors.\")\n num_floors.setDefaultValue(2)\n args << num_floors\n\n #make an argument for floor height\n floor_to_floor_height_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"floor_to_floor_height_ip\",true)\n floor_to_floor_height_ip.setDisplayName(\"Floor to Floor Height (ft).\")\n floor_to_floor_height_ip.setDefaultValue(10.0)\n args << floor_to_floor_height_ip\n\n #make an argument for the meter name\n spaceTypeHashString = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"spaceTypeHashString\",true)\n spaceTypeHashString.setDisplayName(\"Hash of Space Types with Name as Key and Fraction as value.\")\n args << spaceTypeHashString\n\n return args\n end", "title": "" }, { "docid": "df7c9998fb483c96bde634c2b7dc383a", "score": "0.73508406", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # url of the city database\n city_db_url = OpenStudio::Measure::OSArgument.makeStringArgument('city_db_url', true)\n city_db_url.setDisplayName('City Database Url')\n city_db_url.setDescription('Url of the City Database')\n # city_db_url.setDefaultValue(\"http://localhost:3000\")\n city_db_url.setDefaultValue('http://insight4.hpc.nrel.gov:8081/')\n args << city_db_url\n\n # project name of the building to create\n project_name = OpenStudio::Measure::OSArgument.makeStringArgument('project_name', true)\n project_name.setDisplayName('Project Name')\n project_name.setDescription('Project Name.')\n args << project_name\n\n # source id of the building to create\n source_id = OpenStudio::Measure::OSArgument.makeStringArgument('source_id', true)\n source_id.setDisplayName('Building Source ID')\n source_id.setDescription('Building Source ID to generate geometry for.')\n args << source_id\n\n # source name of the building to create\n source_name = OpenStudio::Measure::OSArgument.makeStringArgument('source_name', true)\n source_name.setDisplayName('Building Source Name')\n source_name.setDescription('Building Source Name to generate geometry for.')\n source_name.setDefaultValue('NREL_GDS')\n args << source_name\n\n # which surrounding buildings to include\n chs = OpenStudio::StringVector.new\n chs << 'None'\n chs << 'ShadingOnly'\n chs << 'All'\n surrounding_buildings = OpenStudio::Measure::OSArgument.makeChoiceArgument('surrounding_buildings', chs, true)\n surrounding_buildings.setDisplayName('Surrounding Buildings')\n surrounding_buildings.setDescription('Select which surrounding buildings to include.')\n surrounding_buildings.setDefaultValue('ShadingOnly')\n args << surrounding_buildings\n\n return args\n end", "title": "" }, { "docid": "f83d993a4f6163df531d8498de7ce596", "score": "0.7344349", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for finished roof insulation R-value\n cavity_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cavity_r\", true)\n cavity_r.setDisplayName(\"Cavity Insulation Installed R-value\")\n\tcavity_r.setUnits(\"hr-ft^2-R/Btu\")\n\tcavity_r.setDescription(\"Refers to the R-value of the cavity insulation and not the overall R-value of the assembly. If batt insulation must be compressed to fit within the cavity (e.g., R19 in a 5.5\\\" 2x6 cavity), use an R-value that accounts for this effect (see HUD Mobile Home Construction and Safety Standards 3280.509 for reference).\")\n cavity_r.setDefaultValue(30.0)\n args << cavity_r\n \n #make a choice argument for model objects\n installgrade_display_names = OpenStudio::StringVector.new\n installgrade_display_names << \"I\"\n installgrade_display_names << \"II\"\n installgrade_display_names << \"III\"\n \n #make a choice argument for wall cavity insulation installation grade\n install_grade = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"install_grade\", installgrade_display_names, true)\n install_grade.setDisplayName(\"Cavity Install Grade\")\n install_grade.setDescription(\"Installation grade as defined by RESNET standard. 5% of the cavity is considered missing insulation for Grade 3, 2% for Grade 2, and 0% for Grade 1.\")\n install_grade.setDefaultValue(\"I\")\n args << install_grade\n\n #make a double argument for wall cavity depth\n cavity_depth = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cavity_depth\", true)\n cavity_depth.setDisplayName(\"Cavity Depth\")\n cavity_depth.setUnits(\"in\")\n cavity_depth.setDescription(\"Depth of the roof cavity. 3.5\\\" for 2x4s, 5.5\\\" for 2x6s, etc.\")\n cavity_depth.setDefaultValue(9.25)\n args << cavity_depth\n \n\t#make a bool argument for whether the cavity insulation fills the cavity\n\tins_fills_cavity = OpenStudio::Measure::OSArgument::makeBoolArgument(\"ins_fills_cavity\", true)\n\tins_fills_cavity.setDisplayName(\"Insulation Fills Cavity\")\n\tins_fills_cavity.setDescription(\"When the insulation does not completely fill the depth of the cavity, air film resistances are added to the insulation R-value.\")\n ins_fills_cavity.setDefaultValue(false)\n\targs << ins_fills_cavity\n \n #make a choice argument for finished roof framing factor\n framing_factor = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"framing_factor\", false)\n framing_factor.setDisplayName(\"Framing Factor\")\n\tframing_factor.setUnits(\"frac\")\n\tframing_factor.setDescription(\"The framing factor of the finished roof.\")\n framing_factor.setDefaultValue(0.07)\n args << framing_factor\n \n return args\n end", "title": "" }, { "docid": "5219073c11a4cf04698e93474cbb7828", "score": "0.7340889", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a string argument for specified number\n specified_num = OpenStudio::Measure::OSArgument::makeIntegerArgument('specified_num', true)\n specified_num.setDisplayName('Specified Number')\n specified_num.setUnits('#/unit')\n specified_num.setDescription('Total number of fans.')\n specified_num.setDefaultValue(1)\n args << specified_num\n\n # make a double argument for power\n power = OpenStudio::Measure::OSArgument::makeDoubleArgument('power', true)\n power.setDisplayName('Power')\n power.setUnits('W')\n power.setDescription('Power consumption per fan assuming it runs at medium speed.')\n power.setDefaultValue(45.0)\n args << power\n\n # make a double argument for cooling setpoint offset\n cooling_setpoint_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument('cooling_setpoint_offset', true)\n cooling_setpoint_offset.setDisplayName('Cooling Setpoint Offset')\n cooling_setpoint_offset.setUnits('degrees F')\n cooling_setpoint_offset.setDescription('Increase in cooling set point due to fan usage.')\n cooling_setpoint_offset.setDefaultValue(0)\n args << cooling_setpoint_offset\n\n return args\n end", "title": "" }, { "docid": "bf8b596e7fb21480baf81d9dfccbb849", "score": "0.73373675", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # the name of the space to add to the model\n hhw_setpoint = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"hhw_setpoint_temperature\", true)\n hhw_setpoint.setUnits(\"Degrees Celsius\")\n hhw_setpoint.setDisplayName(\"Hot Water Loop Temperature\")\n hhw_setpoint.setDefaultValue(55)\n hhw_setpoint.setDescription(\"Temperature setpoint for the hot water loop\")\n args << hhw_setpoint\n\n hhw_delta = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"design_delta_hhw\", true)\n hhw_delta.setUnits(\"Delta Temperature\")\n hhw_delta.setDefaultValue(11) \n hhw_delta.setDisplayName(\"Hot Water Loop Design Delta Temperature\")\n hhw_delta.setDescription(\"Delta design temperature for the hot water loop\")\n args << hhw_delta\n\t\n\tchw_setpoint = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"chw_setpoint_temperature\", true)\n chw_setpoint.setUnits(\"Degrees Celsius\")\n chw_setpoint.setDisplayName(\"Chilled Water Loop Temperature\")\n chw_setpoint.setDefaultValue(7.3)\n chw_setpoint.setDescription(\"Temperature setpoint for the chilled water loop\")\n args << chw_setpoint\n\n chw_delta = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"design_delta_chw\", true)\n chw_delta.setUnits(\"Delta Temperature\")\n chw_delta.setDefaultValue(5) \n chw_delta.setDisplayName(\"Chilled Water Loop Design Delta Temperature\")\n chw_delta.setDescription(\"Delta design temperature for the chilled water loop\")\n args << chw_delta\n\n # remove_all_equipment = OpenStudio::Measure::OSArgument::makeBoolArgument(\"remove_all_equipment\",true)\n # remove_all_equipment.setDisplayName(\"Remove all HVAC systems and equipment?\")\n # remove_all_equipment.setDefaultValue(true)\n # args << remove_all_equipment\n return args\n end", "title": "" }, { "docid": "e674ffce37409554857ef8ca35ece290", "score": "0.7335199", "text": "def arguments(model)\n # create arguments\n # need to include double and integer args so method to check doesnt fail,\n # try to dynamically create these in the future\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2010'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('system_type', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_delivery_type', ['Forced Air'], true); arg.setValue('Forced Air'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('htg_src', ['NaturalGas'], true); arg.setValue('NaturalGas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('clg_src', ['Electricity'], true); arg.setValue('Electricity'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('swh_src', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('kitchen_makeup', ['Adjacent'], true); arg.setValue('Adjacent'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('exterior_lighting_zone', ['3 - All Other Areas'], true); arg.setValue('3 - All Other Areas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_constructions', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_space_type_loads', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_elevators', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_internal_mass', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exterior_lights', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('onsite_parking_fraction', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exhaust', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_swh', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_thermostat', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_hvac', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_refrigeration', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wkdy_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wknd_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('unmet_hours_tolerance', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_objects', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_dst', true); arg.setValue(true); args << arg\n\n return args\n end", "title": "" }, { "docid": "7129ef0ff0fddfc12163c6db36899ea8", "score": "0.7331521", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # glazing u_value\n u_value = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"u_value\", true)\n u_value.setDisplayName(\"U-value in W/(K-m2)\")\n\tu_value.setDefaultValue(1.65)\n args << u_value\n\t\n\t# glazing shgc\n shgc = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"shgc\", true)\n shgc.setDisplayName(\"shgc\")\n\tshgc.setDefaultValue(0.20)\n args << shgc\n\t\n\t# glazing visible transmittance\n vt = OpenStudio::Ruleset::OSArgument.makeDoubleArgument(\"vt\", true)\n vt.setDisplayName(\"vt\")\n\tvt.setDefaultValue(0.81)\n args << vt\n\n return args\n end", "title": "" }, { "docid": "5da35d15ccc52e0148823e3cf45b53e2", "score": "0.732687", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n\t# Chiller type\n\tchiller_type = OpenStudio::StringVector.new\n chiller_type << \"DistrictChilledWater\"\n\tchiller_type << \"ElectricCentrifugalChiller\"\n chiller_type << \"ElectricScrewChiller\"\n\tchiller_type << \"ElectricReciprocatingChiller\"\n chiller_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('chiller_type', chiller_type, true)\n chiller_type.setDisplayName(\"Choose chiller type.\")\n chiller_type.setDefaultValue(\"ElectricReciprocatingChiller\")\n args << chiller_type\n\t\n # chiller COP\n chiller_cop = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('chiller_cop', false)\n chiller_cop.setDisplayName(\"Chiller Nominal COP.\")\n chiller_cop.setDefaultValue(3.2)\n args << chiller_cop\n\t\n\t#Condenser type\n\t\n\tcondenser_type = OpenStudio::StringVector.new\n condenser_type << \"WaterCooled\"\n\tcondenser_type << \"AirCooled\"\n condenser_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('condenser_type', condenser_type, true)\n condenser_type.setDisplayName(\"Choose condenser type.\")\n condenser_type.setDefaultValue(\"WaterCooled\")\n args << condenser_type\n\t\t\n return args\n end", "title": "" }, { "docid": "b20c44f3a7375d469c7e0268a52427ed", "score": "0.73268425", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\t\t\n\n #make a string argument for number of bedrooms\n num_br = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"Num_Br\", false)\n num_br.setDisplayName(\"Number of Bedrooms\")\n num_br.setDescription(\"Specify the number of bedrooms for all units, or a comma-separated string of numbers of bedrooms (in the correct order) for each unit. Used to determine the energy usage of appliances and plug loads, hot water usage, mechanical ventilation rate, etc.\")\n num_br.setDefaultValue(\"3.0\")\n args << num_br\n \n #make a string argument for number of bathrooms\n num_ba = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"Num_Ba\", false)\n num_ba.setDisplayName(\"Number of Bathrooms\")\n num_ba.setDescription(\"Specify the number of bathrooms for all units, or a comma-separated string of numbers of bathrooms (in the correct order) for each unit. Used to determine the hot water usage, etc.\")\n num_ba.setDefaultValue(\"2.0\")\n args << num_ba\n \n # NOTE\n # Occupant arguments commented out for now since they are confusing. Num occupants and schedules\n # only affect occupant heat gain, not plug loads, hot water usage, etc. When we refactor HSP\n # equations to be based on num occupants rather than num bedrooms, we should uncomment this.\n \n #Make a string argument for occupants (auto or number)\n #occupants = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"occupants\", false)\n #occupants.setDisplayName(\"Number of Occupants\")\n #occupants.setDescription(\"Use '#{Constants.Auto}' to calculate the average number of occupants from the number of bedrooms. Only used to specify the internal gains from people.\")\n #occupants.setDefaultValue(Constants.Auto)\n #args << occupants\n\n #Make a string argument for 24 weekday schedule values\n #weekday_sch = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"weekday_sch\", true)\n #weekday_sch.setDisplayName(\"Weekday schedule\")\n #weekday_sch.setDescription(\"Specify the 24-hour weekday schedule.\")\n #weekday_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n #args << weekday_sch\n \n #Make a string argument for 24 weekend schedule values\n #weekend_sch = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"weekend_sch\", true)\n #weekend_sch.setDisplayName(\"Weekend schedule\")\n #weekend_sch.setDescription(\"Specify the 24-hour weekend schedule.\")\n #weekend_sch.setDefaultValue(\"1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 0.88310, 0.40861, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.24189, 0.29498, 0.55310, 0.89693, 0.89693, 0.89693, 1.00000, 1.00000, 1.00000\")\n #args << weekend_sch\n\n #Make a string argument for 12 monthly schedule values\n #monthly_sch = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"monthly_sch\", true)\n #monthly_sch.setDisplayName(\"Month schedule\")\n #monthly_sch.setDescription(\"Specify the 12-month schedule.\")\n #monthly_sch.setDefaultValue(\"1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0\")\n #args << monthly_sch\n\n return args\n end", "title": "" }, { "docid": "a33a6f74943bb0f582f91ed80bc47a69", "score": "0.7326144", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make a double argument for room air eer\n roomaceer = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"roomaceer\", true)\n roomaceer.setDisplayName(\"EER\")\n roomaceer.setUnits(\"Btu/W-h\")\n roomaceer.setDescription(\"This is a measure of the instantaneous energy efficiency of the cooling equipment.\")\n roomaceer.setDefaultValue(8.5)\n args << roomaceer \n \n #make a double argument for room air shr\n roomacshr = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"roomacshr\", true)\n roomacshr.setDisplayName(\"Rated SHR\")\n roomacshr.setDescription(\"The sensible heat ratio (ratio of the sensible portion of the load to the total load) at the nominal rated capacity.\")\n roomacshr.setDefaultValue(0.65)\n args << roomacshr\n\n #make a double argument for room air airflow\n roomacairflow = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"roomacairflow\", true)\n roomacairflow.setDisplayName(\"Airflow\")\n roomacairflow.setUnits(\"cfm/ton\")\n roomacairflow.setDefaultValue(350.0)\n args << roomacairflow\n \n #make a choice argument for room air cooling output capacity\n cap_display_names = OpenStudio::StringVector.new\n cap_display_names << Constants.SizingAuto\n (0.5..10.0).step(0.5) do |tons|\n cap_display_names << \"#{tons} tons\"\n end\n\n #make a string argument for room air cooling output capacity\n selected_accap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"selectedaccap\", cap_display_names, true)\n selected_accap.setDisplayName(\"Cooling Output Capacity\")\n selected_accap.setDefaultValue(Constants.SizingAuto)\n args << selected_accap \n\n return args\n end", "title": "" }, { "docid": "94da78aca51ced4f10b65afd8e16e9f2", "score": "0.73236996", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # Make a string argument for dehumidifier energy factor\n energy_factor = OpenStudio::Measure::OSArgument::makeStringArgument('energy_factor', true)\n energy_factor.setDisplayName('Energy Factor')\n energy_factor.setDescription('The energy efficiency of dehumidifiers is measured by its energy factor, in liters of water removed per kilowatt-hour (kWh) of energy consumed or L/kWh.')\n energy_factor.setUnits('L/kWh')\n energy_factor.setDefaultValue(Constants.Auto)\n args << energy_factor\n\n # Make a string argument for dehumidifier water removal rate\n water_removal_rate = OpenStudio::Measure::OSArgument::makeStringArgument('water_removal_rate', true)\n water_removal_rate.setDisplayName('Water Removal Rate')\n water_removal_rate.setDescription('Dehumidifier rated water removal rate measured in pints per day at an inlet condition of 80 degrees F DB/60%RH.')\n water_removal_rate.setUnits('Pints/day')\n water_removal_rate.setDefaultValue(Constants.Auto)\n args << water_removal_rate\n\n # Make a string argument for dehumidifier air flow rate\n air_flow_rate = OpenStudio::Measure::OSArgument::makeStringArgument('air_flow_rate', true)\n air_flow_rate.setDisplayName('Air Flow Rate')\n air_flow_rate.setDescription(\"The dehumidifier rated air flow rate in CFM. If 'auto' is entered, the air flow will be determined using the rated water removal rate.\")\n air_flow_rate.setUnits('cfm')\n air_flow_rate.setDefaultValue(Constants.Auto)\n args << air_flow_rate\n\n # Make a string argument for humidity setpoint\n humidity_setpoint = OpenStudio::Measure::OSArgument::makeDoubleArgument('humidity_setpoint', true)\n humidity_setpoint.setDisplayName('Annual Relative Humidity Setpoint')\n humidity_setpoint.setDescription('The annual relative humidity setpoint.')\n humidity_setpoint.setUnits('frac')\n humidity_setpoint.setDefaultValue(Constants.DefaultHumiditySetpoint)\n args << humidity_setpoint\n\n return args\n end", "title": "" }, { "docid": "c54374b6668019cbfb2c293913838216", "score": "0.7318269", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # define HW pump control\n\t\n\thw_pump_control = OpenStudio::StringVector.new\n hw_pump_control << \"intermittent\"\n\thw_pump_control << \"continuous\"\n hw_pump_control = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('hw_pump_control', hw_pump_control, true)\n hw_pump_control.setDisplayName(\"Choose HW pump control type.\")\n hw_pump_control.setDefaultValue(\"intermittent\")\n args << hw_pump_control\n\t\n\t# set HW design setpoint (F)\n\thw_design_setpoint = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('hw_design_setpoint', false)\n hw_design_setpoint.setDisplayName(\"Hot water design setpoint in Fahrenheit\")\n hw_design_setpoint.setDefaultValue(179.6)\n args << hw_design_setpoint\n\t\n\t# HW pump types\n\t\n\thw_pump_type = OpenStudio::StringVector.new\n hw_pump_type << \"ConstantFlow\"\n\thw_pump_type << \"VariableFlow\"\n hw_pump_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('hw_pump_type', hw_pump_type, true)\n hw_pump_type.setDisplayName(\"Choose HW pump type.\")\n hw_pump_type.setDefaultValue(\"ConstantFlow\")\n args << hw_pump_type\n\t\t\n\t# Loop design delta T (F)\n\thw_design_deltaT = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('hw_design_deltaT', false)\n hw_design_deltaT.setDisplayName(\"Hot water design deltaT in Fahrenheit\")\n hw_design_deltaT.setDefaultValue(19.8)\n args << hw_design_deltaT\n\t\n return args\n end", "title": "" }, { "docid": "0e7eab8b32280ceb9a21397a2b133511", "score": "0.7317701", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for OSB/Plywood Thickness\n\tosb_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"osb_thick_in\",true)\n\tosb_thick_in.setDisplayName(\"OSB/Plywood Thickness\")\n osb_thick_in.setUnits(\"in\")\n\tosb_thick_in.setDescription(\"Specifies the thickness of the floor OSB/plywood sheathing. Enter 0 for no sheathing.\")\n\tosb_thick_in.setDefaultValue(0.75)\n\targs << osb_thick_in\n \n\t#make a double argument for Rigid Insulation R-value\n\trigid_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"rigid_r\",true)\n\trigid_r.setDisplayName(\"Continuous Insulation Nominal R-value\")\n rigid_r.setUnits(\"h-ft^2-R/Btu\")\n rigid_r.setDescription(\"The R-value of the continuous insulation.\")\n\trigid_r.setDefaultValue(0.0)\n\targs << rigid_r\n\n\t#make a double argument for Rigid Insulation Thickness\n\trigid_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"rigid_thick_in\",true)\n\trigid_thick_in.setDisplayName(\"Continuous Insulation Thickness\")\n rigid_thick_in.setUnits(\"in\")\n rigid_thick_in.setDescription(\"The thickness of the continuous insulation.\")\n\trigid_thick_in.setDefaultValue(0.0)\n\targs << rigid_thick_in\n\n return args\n end", "title": "" }, { "docid": "92e0b61a3b827178303fb6baf3788a2e", "score": "0.731354", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for the refrigeration system to modify\n ref_sys_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ref_sys_name\",true)\n ref_sys_name.setDisplayName(\"Select a Refrigeration System to Get A Mechanical Subcooler.\")\n ref_sys_name.setDefaultValue(\"Rack A Low Temp\")\n args << ref_sys_name \n\n #make an argument for the refrigeration system to modify\n cap_ref_sys_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"cap_ref_sys_name\",true)\n cap_ref_sys_name.setDisplayName(\"Select a Refrigeration System to Provide Capacity.\")\n cap_ref_sys_name.setDefaultValue(\"Rack B Med Temp\")\n args << cap_ref_sys_name \n \n return args\n end", "title": "" }, { "docid": "a3570ca39b2b49895c060a356410de76", "score": "0.7302031", "text": "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n \r\n window_u_value_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"window_u_value_ip\",true)\r\n window_u_value_ip.setDisplayName(\"Window U-Value (Btu/ft^2*h*R)\")\r\n window_u_value_ip.setDefaultValue(10.0)\r\n args << window_u_value_ip\r\n\r\n window_shgc = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"window_shgc\",true)\r\n window_shgc.setDisplayName(\"Window SHGC\")\r\n window_shgc.setDefaultValue(0.5)\r\n args << window_shgc\t\r\n\t\r\n return args\r\n end", "title": "" }, { "docid": "a5a49700bbae3ca001f2437f539cad13", "score": "0.7300607", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Make integer arg to run measure [1 is run, 0 is no run]\n run_measure = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"run_measure\",true)\n run_measure.setDisplayName(\"Run Measure\")\n run_measure.setDescription(\"integer argument to run measure [1 is run, 0 is no run]\")\n run_measure.setDefaultValue(1)\n args << run_measure \n \n # Make an argument for insulation R-value\n r_value_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"r_value_ip\",true)\n r_value_ip.setDisplayName(\"Insulation R-value\")\n r_value_ip.setUnits(\"ft^2*h*R/Btu\")\n r_value_ip.setDefaultValue(30.0)\n args << r_value_ip\n\n return args\n end", "title": "" }, { "docid": "4c929485f188e20c0e2836c17c433a56", "score": "0.7300064", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make double argument for wwr\n wwr = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"wwr\",true)\n wwr.setDisplayName(\"Window to Wall Ratio (fraction).\")\n wwr.setDefaultValue(0.4)\n args << wwr\n\n #make double argument for sillHeight\n sillHeight = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"sillHeight\",true)\n sillHeight.setDisplayName(\"Sill Height (in).\")\n sillHeight.setDefaultValue(30.0)\n args << sillHeight\n\n #make choice argument for facade\n choices = OpenStudio::StringVector.new\n choices << \"North\"\n choices << \"East\"\n choices << \"South\"\n choices << \"West\"\n facade = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"facade\", choices,true)\n facade.setDisplayName(\"Cardinal Direction.\")\n facade.setDefaultValue(\"South\")\n args << facade\n\n return args\n end", "title": "" }, { "docid": "84376f28665536967c73b1c5a2c06b57", "score": "0.72979444", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a double argument for nominal R-value of cavity insulation\n cavity_r = OpenStudio::Measure::OSArgument::makeDoubleArgument('cavity_r', true)\n cavity_r.setDisplayName('Cavity Insulation Nominal R-value')\n cavity_r.setUnits('hr-ft^2-R/Btu')\n cavity_r.setDescription('Refers to the R-value of the cavity insulation and not the overall R-value of the assembly.')\n cavity_r.setDefaultValue(19.0)\n args << cavity_r\n\n # make a choice argument for wall cavity insulation installation grade\n installgrade_display_names = OpenStudio::StringVector.new\n installgrade_display_names << '1'\n installgrade_display_names << '2'\n installgrade_display_names << '3'\n install_grade = OpenStudio::Measure::OSArgument::makeChoiceArgument('install_grade', installgrade_display_names, true)\n install_grade.setDisplayName('Cavity Install Grade')\n install_grade.setDescription('Installation grade as defined by RESNET standard. 5% of the cavity is considered missing insulation for Grade 3, 2% for Grade 2, and 0% for Grade 1.')\n install_grade.setDefaultValue('1')\n args << install_grade\n\n # make a choice argument for ceiling framing factor\n framing_factor = OpenStudio::Measure::OSArgument::makeDoubleArgument('framing_factor', true)\n framing_factor.setDisplayName('Framing Factor')\n framing_factor.setUnits('frac')\n framing_factor.setDescription('The fraction of a floor assembly that is comprised of structural framing.')\n framing_factor.setDefaultValue(0.13)\n args << framing_factor\n\n # make a choice argument for joist height\n joist_height_in = OpenStudio::Measure::OSArgument::makeDoubleArgument('joist_height_in', true)\n joist_height_in.setDisplayName('Joist Height')\n joist_height_in.setUnits('in')\n joist_height_in.setDescription('Height of the joist member.')\n joist_height_in.setDefaultValue(5.5)\n args << joist_height_in\n\n return args\n end", "title": "" }, { "docid": "f72912b7eb5945eda71796b63615140d", "score": "0.72940356", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument insulation R-value\n r_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"r_value\",true)\n r_value.setDisplayName(\"Insulation R-value (ft^2*h*R/Btu).\")\n r_value.setDefaultValue(30.0)\n args << r_value\n\n #make bool argument to allow both increase and decrease in R value\n allow_reduction = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"allow_reduction\",true)\n allow_reduction.setDisplayName(\"Allow both increase and decrease in R-value to reach requested target?\")\n allow_reduction.setDefaultValue(false)\n args << allow_reduction\n\n #make an argument for material and installation cost\n material_cost_increase_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"material_cost_increase_ip\",true)\n material_cost_increase_ip.setDisplayName(\"Increase in Material and Installation Costs for Construction per Area Used ($/ft^2).\")\n material_cost_increase_ip.setDefaultValue(0.0)\n args << material_cost_increase_ip\n\n #make an argument for demolition cost\n one_time_retrofit_cost_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"one_time_retrofit_cost_ip\",true)\n one_time_retrofit_cost_ip.setDisplayName(\"One Time Retrofit Cost to Add Insulation to Construction ($/ft^2).\")\n one_time_retrofit_cost_ip.setDefaultValue(0.0)\n args << one_time_retrofit_cost_ip\n\n #make an argument for duration in years until costs start\n years_until_retrofit_cost = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"years_until_retrofit_cost\",true)\n years_until_retrofit_cost.setDisplayName(\"Year to Incur One Time Retrofit Cost (whole years).\")\n years_until_retrofit_cost.setDefaultValue(0)\n args << years_until_retrofit_cost\n\n return args\n end", "title": "" }, { "docid": "126ffb30da6016d3b88c588f43ec5f68", "score": "0.72924167", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a choice argument for the building type\n building_type_chs = OpenStudio::StringVector.new\n building_type_chs << 'SecondarySchool'\n building_type_chs << 'PrimarySchool'\n building_type_chs << 'SmallOffice'\n building_type_chs << 'MediumOffice'\n building_type_chs << 'LargeOffice'\n building_type_chs << 'SmallHotel'\n building_type_chs << 'LargeHotel'\n building_type_chs << 'Warehouse'\n building_type_chs << 'RetailStandalone'\n building_type_chs << 'RetailStripmall'\n building_type_chs << 'QuickServiceRestaurant'\n building_type_chs << 'FullServiceRestaurant'\n building_type_chs << 'MidriseApartment'\n building_type_chs << 'HighriseApartment'\n building_type_chs << 'Hospital'\n building_type_chs << 'Outpatient'\n building_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('building_type', building_type_chs, true)\n building_type.setDisplayName('Building Type')\n building_type.setDefaultValue('SmallOffice')\n args << building_type\n\n # make a choice argument for the template\n template_chs = OpenStudio::StringVector.new\n template_chs << 'DOE Ref Pre-1980'\n template_chs << 'DOE Ref 1980-2004'\n template_chs << '90.1-2004'\n template_chs << '90.1-2007'\n # template_chs << '189.1-2009'\n template_chs << '90.1-2010'\n template_chs << '90.1-2013'\n template_chs << 'NECB 2011'\n template = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', template_chs, true)\n template.setDisplayName('Template')\n template.setDefaultValue('90.1-2010')\n args << template\n\n weather_file_name = OpenStudio::Measure::OSArgument.makeStringArgument('weather_file_name', true)\n weather_file_name.setDisplayName('Weather File Name')\n weather_file_name.setDescription('Name of the weather file. This is the filename with the extension (e.g. NewWeather.epw). Optionally this can include the full file path, but for most use cases should just be file name.')\n args << weather_file_name\n\n args\n end", "title": "" }, { "docid": "c23507634f55cada6d9bf8bc9c76c2bf", "score": "0.7291239", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a string argument for central boiler fuel type\n central_boiler_fuel_type_names = OpenStudio::StringVector.new\n central_boiler_fuel_type_names << Constants.FuelTypeElectric\n central_boiler_fuel_type_names << Constants.FuelTypeGas\n central_boiler_fuel_type_names << Constants.FuelTypeOil\n central_boiler_fuel_type_names << Constants.FuelTypePropane\n central_boiler_fuel_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('central_boiler_fuel_type', central_boiler_fuel_type_names, true)\n central_boiler_fuel_type.setDisplayName('Central Boiler Fuel Type')\n central_boiler_fuel_type.setDescription('The fuel type of the central boiler used for heating.')\n central_boiler_fuel_type.setDefaultValue(Constants.FuelTypeGas)\n args << central_boiler_fuel_type\n\n # make a bool argument for open hvac flue\n has_hvac_flue = OpenStudio::Measure::OSArgument::makeBoolArgument('has_hvac_flue', true)\n has_hvac_flue.setDisplayName('Air Leakage: Has Open HVAC Flue')\n has_hvac_flue.setDescription('Specifies whether the building has an open flue associated with the HVAC system.')\n has_hvac_flue.setDefaultValue(true)\n args << has_hvac_flue\n\n return args\n end", "title": "" }, { "docid": "7add9c29be1a8c12dc060172dfe92f36", "score": "0.72878236", "text": "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # efficiency\r\n base_eff = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"base_eff\",true)\r\n base_eff.setDisplayName(\"efficiency\")\r\n base_eff.setDefaultValue(1.0)\r\n args << base_eff\r\n \r\n #capacity\r\n nom_cap = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"nom_cap\",true)\r\n nom_cap.setDisplayName(\"Nominal Capacity (W)\")\r\n nom_cap.setDefaultValue(1500)\r\n args << nom_cap\r\n\r\n return args\r\n end", "title": "" }, { "docid": "368a874c681d4b9eebb7ffb6780a4cbe", "score": "0.72795445", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for entering baseboard efficiency\n efficiency = OpenStudio::Measure::OSArgument::makeDoubleArgument('efficiency', true)\n efficiency.setDisplayName('Efficiency')\n efficiency.setUnits('Btu/Btu')\n efficiency.setDescription('The efficiency of the electric baseboard.')\n efficiency.setDefaultValue(1.0)\n args << efficiency\n\n # make a string argument for baseboard heating output capacity\n capacity = OpenStudio::Measure::OSArgument::makeStringArgument('capacity', true)\n capacity.setDisplayName('Heating Capacity')\n capacity.setDescription(\"The output heating capacity of the electric baseboard. If using '#{Constants.SizingAuto}', the autosizing algorithm will use ACCA Manual S to set the capacity.\")\n capacity.setUnits('kBtu/hr')\n capacity.setDefaultValue(Constants.SizingAuto)\n args << capacity\n\n return args\n end", "title": "" }, { "docid": "837fb942f912de11ea3a93cfc5c6082d", "score": "0.7278213", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make integer arg to run measure [1 is run, 0 is no run]\n run_measure = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"run_measure\",true)\n run_measure.setDisplayName(\"Run Measure\")\n run_measure.setDescription(\"integer argument to run measure [1 is run, 0 is no run]\")\n run_measure.setDefaultValue(1)\n args << run_measure \n \n window_r_value_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"window_r_value_ip\",true)\n window_r_value_ip.setDisplayName(\"Window R-Value\")\n window_r_value_ip.setUnits(\"ft^2*h*R/Btu\")\n window_r_value_ip.setDefaultValue(10.0)\n args << window_r_value_ip\n\n window_shgc = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"window_shgc\",true)\n window_shgc.setDisplayName(\"Window SHGC\")\n window_shgc.setDefaultValue(0.5)\n args << window_shgc\n\n window_vlt = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"window_vlt\",true)\n window_vlt.setDisplayName(\"Window VLT\")\n window_vlt.setDefaultValue(0.6)\n args << window_vlt\n\n return args\n end", "title": "" }, { "docid": "a2adc147cd916ecca1beb478beef5cd0", "score": "0.727785", "text": "def arguments(model)\n # create arguments\n # need to include double and integer args so method to check doesnt fail,\n # try to dynamically create these in the future\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2004'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('system_type', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_delivery_type', ['Forced Air'], true); arg.setValue('Forced Air'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('htg_src', ['NaturalGas'], true); arg.setValue('NaturalGas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('clg_src', ['Electricity'], true); arg.setValue('Electricity'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('swh_src', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('kitchen_makeup', ['Adjacent'], true); arg.setValue('Adjacent'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('exterior_lighting_zone', ['3 - All Other Areas'], true); arg.setValue('3 - All Other Areas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_constructions', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_space_type_loads', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_elevators', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_internal_mass', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exterior_lights', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('onsite_parking_fraction', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exhaust', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_swh', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_thermostat', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_hvac', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_refrigeration', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wkdy_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wknd_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('unmet_hours_tolerance', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_objects', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_dst', true); arg.setValue(true); args << arg\n\n return args\n end", "title": "" }, { "docid": "a2adc147cd916ecca1beb478beef5cd0", "score": "0.727785", "text": "def arguments(model)\n # create arguments\n # need to include double and integer args so method to check doesnt fail,\n # try to dynamically create these in the future\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2004'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('system_type', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_delivery_type', ['Forced Air'], true); arg.setValue('Forced Air'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('htg_src', ['NaturalGas'], true); arg.setValue('NaturalGas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('clg_src', ['Electricity'], true); arg.setValue('Electricity'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('swh_src', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('kitchen_makeup', ['Adjacent'], true); arg.setValue('Adjacent'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('exterior_lighting_zone', ['3 - All Other Areas'], true); arg.setValue('3 - All Other Areas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_constructions', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_space_type_loads', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_elevators', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_internal_mass', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exterior_lights', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('onsite_parking_fraction', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exhaust', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_swh', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_thermostat', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_hvac', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_refrigeration', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wkdy_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wknd_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('unmet_hours_tolerance', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_objects', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_dst', true); arg.setValue(true); args << arg\n\n return args\n end", "title": "" }, { "docid": "a2adc147cd916ecca1beb478beef5cd0", "score": "0.727785", "text": "def arguments(model)\n # create arguments\n # need to include double and integer args so method to check doesnt fail,\n # try to dynamically create these in the future\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2004'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('system_type', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_delivery_type', ['Forced Air'], true); arg.setValue('Forced Air'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('htg_src', ['NaturalGas'], true); arg.setValue('NaturalGas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('clg_src', ['Electricity'], true); arg.setValue('Electricity'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('swh_src', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('kitchen_makeup', ['Adjacent'], true); arg.setValue('Adjacent'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('exterior_lighting_zone', ['3 - All Other Areas'], true); arg.setValue('3 - All Other Areas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_constructions', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_space_type_loads', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_elevators', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_internal_mass', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exterior_lights', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('onsite_parking_fraction', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exhaust', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_swh', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_thermostat', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_hvac', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_refrigeration', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wkdy_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wknd_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('unmet_hours_tolerance', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_objects', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_dst', true); arg.setValue(true); args << arg\n\n return args\n end", "title": "" }, { "docid": "249a231bd26b4f930e7973acf9914ccb", "score": "0.7268222", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make a choice argument for model objects\n roof_structure_display_names = OpenStudio::StringVector.new\n roof_structure_display_names << Constants.RoofStructureTrussCantilever\n roof_structure_display_names << Constants.RoofStructureRafter\n\t\n #make a choice argument for roof type\n roof_structure = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"roof_structure\", roof_structure_display_names, true)\n roof_structure.setDisplayName(\"Roof Structure\")\n roof_structure.setDescription(\"The roof structure of the building.\")\n roof_structure.setDefaultValue(Constants.RoofStructureTrussCantilever)\n args << roof_structure\t\n\t\n #make a choice argument for eaves depth\n eaves_depth = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"eaves_depth\", true)\n eaves_depth.setDisplayName(\"Eaves Depth\")\n eaves_depth.setUnits(\"ft\")\n eaves_depth.setDescription(\"The eaves depth of the roof.\")\n eaves_depth.setDefaultValue(2.0)\n args << eaves_depth \n \n return args\n end", "title": "" }, { "docid": "e7e39f5bcf18c97d2eda810b72781b51", "score": "0.7268121", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n \n\t#TODO: New argument for demand response for dws (alternate schedules if automatic DR control is specified)\n\t\n\t#make an integer argument for number of place settings\n\tnum_settings = OpenStudio::Measure::OSArgument::makeIntegerArgument(\"num_settings\",true)\n\tnum_settings.setDisplayName(\"Number of Place Settings\")\n\tnum_settings.setUnits(\"#\")\n\tnum_settings.setDescription(\"The number of place settings for the unit. Data obtained from manufacturer's literature.\")\n\tnum_settings.setDefaultValue(12)\n\targs << num_settings\n\t\n\t#make a double argument for rated annual consumption\n\tdw_E = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"dw_E\",true)\n\tdw_E.setDisplayName(\"Rated Annual Consumption\")\n\tdw_E.setUnits(\"kWh\")\n\tdw_E.setDescription(\"The annual energy consumed by the dishwasher, as rated, obtained from the EnergyGuide label. This includes both the appliance electricity consumption and the energy required for water heating.\")\n\tdw_E.setDefaultValue(290)\n\targs << dw_E\n\t\n\t#make a bool argument for internal heater adjustment\n\tint_htr = OpenStudio::Measure::OSArgument::makeBoolArgument(\"int_htr\",true)\n\tint_htr.setDisplayName(\"Internal Heater Adjustment\")\n\tint_htr.setDescription(\"Does the system use an internal electric heater to adjust water temperature? Input obtained from manufacturer's literature.\")\n\tint_htr.setDefaultValue(\"true\")\n\targs << int_htr\n\n\t#make a bool argument for cold water inlet only\n\tcold_inlet = OpenStudio::Measure::OSArgument::makeBoolArgument(\"cold_inlet\",true)\n\tcold_inlet.setDisplayName(\"Cold Water Inlet Only\")\n\tcold_inlet.setDescription(\"Does the dishwasher use a cold water connection only. Input obtained from manufacturer's literature.\")\n\tcold_inlet.setDefaultValue(\"false\")\n\targs << cold_inlet\n\t\n\t#make a double argument for cold water connection use\n\tcold_use = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cold_use\",true)\n\tcold_use.setDisplayName(\"Cold Water Conn Use Per Cycle\")\n\tcold_use.setUnits(\"gal/cycle\")\n\tcold_use.setDescription(\"Volume of water per cycle used if there is only a cold water inlet connection, for the dishwasher. Input obtained from manufacturer's literature.\")\n\tcold_use.setDefaultValue(0)\n\targs << cold_use\n\n\t#make an integer argument for energy guide date\n\teg_date = OpenStudio::Measure::OSArgument::makeIntegerArgument(\"eg_date\",true)\n\teg_date.setDisplayName(\"Energy Guide Date\")\n\teg_date.setDescription(\"Energy Guide test date.\")\n\teg_date.setDefaultValue(2007)\n\targs << eg_date\n\t\n\t#make a double argument for energy guide annual gas cost\n\teg_gas_cost = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"eg_gas_cost\",true)\n\teg_gas_cost.setDisplayName(\"Energy Guide Annual Gas Cost\")\n\teg_gas_cost.setUnits(\"$/yr\")\n\teg_gas_cost.setDescription(\"Annual cost of gas, as rated. Obtained from the EnergyGuide label.\")\n\teg_gas_cost.setDefaultValue(23)\n\targs << eg_gas_cost\n\t\n\t#make a double argument for occupancy energy multiplier\n\tmult_e = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mult_e\",true)\n\tmult_e.setDisplayName(\"Occupancy Energy Multiplier\")\n\tmult_e.setDescription(\"Appliance energy use is multiplied by this factor to account for occupancy usage that differs from the national average.\")\n\tmult_e.setDefaultValue(1)\n\targs << mult_e\n\n\t#make a double argument for occupancy water multiplier\n\tmult_hw = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mult_hw\",true)\n\tmult_hw.setDisplayName(\"Occupancy Hot Water Multiplier\")\n\tmult_hw.setDescription(\"Appliance hot water use is multiplied by this factor to account for occupancy usage that differs from the national average. This should generally be equal to the Occupancy Energy Multiplier.\")\n\tmult_hw.setDefaultValue(1)\n\targs << mult_hw\n\t\n #make a choice argument for space\n spaces = Geometry.get_all_unit_spaces(model)\n if spaces.nil?\n spaces = []\n end\n space_args = OpenStudio::StringVector.new\n space_args << Constants.Auto\n spaces.each do |space|\n space_args << space.name.to_s\n end\n space = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"space\", space_args, true)\n space.setDisplayName(\"Location\")\n space.setDescription(\"Select the space where the dishwasher is located. '#{Constants.Auto}' will choose the lowest above-grade finished space available (e.g., first story living space), or a below-grade finished space as last resort. For multifamily buildings, '#{Constants.Auto}' will choose a space for each unit of the building.\")\n space.setDefaultValue(Constants.Auto)\n args << space\n \n #make a choice argument for plant loop\n plant_loops = model.getPlantLoops\n plant_loop_args = OpenStudio::StringVector.new\n plant_loop_args << Constants.Auto\n plant_loops.each do |plant_loop|\n plant_loop_args << plant_loop.name.to_s\n end\n plant_loop = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"plant_loop\", plant_loop_args, true)\n plant_loop.setDisplayName(\"Plant Loop\")\n plant_loop.setDescription(\"Select the plant loop for the dishwasher. '#{Constants.Auto}' will try to choose the plant loop associated with the specified space. For multifamily buildings, '#{Constants.Auto}' will choose the plant loop for each unit of the building.\")\n plant_loop.setDefaultValue(Constants.Auto)\n\targs << plant_loop\n\n return args\n end", "title": "" }, { "docid": "d9b1841870fb2a24266ae15cc832bcf4", "score": "0.7267455", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n arg = OpenStudio::Ruleset::OSArgument.makeStringArgument('weather_directory', true)\n arg.setDisplayName(\"Weather Directory\")\n #arg.setDescription(\"Relative directory to weather files from analysis directory\")\n #arg.setUnits(nil)\n args << arg\n\n arg2 = OpenStudio::Ruleset::OSArgument.makeStringArgument('weather_file_name', true)\n arg2.setDisplayName(\"Weather File Name\")\n #arg.setDescription(\"Name of the weather file to change to. This is the filename with the extension (e.g. NewWeather.epw)\")\n args << arg2\n\n args\n end", "title": "" }, { "docid": "c37bc5c36de86a7da583b7b522412535", "score": "0.7264536", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument insulation R-value\n r_value_mult = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"r_value_mult\",true)\n r_value_mult.setDisplayName(\"Roof total R-value multiplier\")\n r_value_mult.setDefaultValue(1)\n args << r_value_mult\n\n solar_abs_mult = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"solar_abs_mult\",true)\n solar_abs_mult.setDisplayName(\"Roof solar absorptance multiplier\")\n solar_abs_mult.setDefaultValue(1)\n args << solar_abs_mult\n\n thermal_mass_mult = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"thermal_mass_mult\",true)\n thermal_mass_mult.setDisplayName(\"Roof thermal mass multiplier\")\n thermal_mass_mult.setDefaultValue(1)\n args << thermal_mass_mult\n\n return args\n end", "title": "" }, { "docid": "d4d3a1dd319142deb5a263a69c2ed376", "score": "0.72636914", "text": "def arguments(model)\n # create arguments\n # need to include double and integer args so method to check doesnt fail,\n # try to dynamically create these in the future\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2016'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('system_type', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_delivery_type', ['Forced Air'], true); arg.setValue('Forced Air'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('htg_src', ['NaturalGas'], true); arg.setValue('NaturalGas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('clg_src', ['Electricity'], true); arg.setValue('Electricity'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('swh_src', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('kitchen_makeup', ['Adjacent'], true); arg.setValue('Adjacent'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('exterior_lighting_zone', ['3 - All Other Areas'], true); arg.setValue('3 - All Other Areas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_constructions', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_space_type_loads', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_elevators', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_internal_mass', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exterior_lights', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('onsite_parking_fraction', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exhaust', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_swh', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_thermostat', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_hvac', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_refrigeration', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wkdy_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wknd_op_hrs', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('unmet_hours_tolerance', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_objects', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_dst', true); arg.setValue(true); args << arg\n\n return args\n end", "title": "" }, { "docid": "238a7e25d47d30d5a65a96e2a1257c3c", "score": "0.72617245", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a double argument for nominal R-value of the icf insulation\n icf_r = OpenStudio::Measure::OSArgument::makeDoubleArgument('icf_r', true)\n icf_r.setDisplayName('Nominal Insulation R-value')\n icf_r.setUnits('hr-ft^2-R/Btu')\n icf_r.setDescription('R-value of each insulating layer of the form.')\n icf_r.setDefaultValue(10.0)\n args << icf_r\n\n # make a double argument for thickness of the icf insulation\n ins_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument('ins_thick_in', true)\n ins_thick_in.setDisplayName('Insulation Thickness')\n ins_thick_in.setUnits('in')\n ins_thick_in.setDescription('Thickness of each insulating layer of the form.')\n ins_thick_in.setDefaultValue(2.0)\n args << ins_thick_in\n\n # make a double argument for thickness of the concrete\n concrete_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument('concrete_thick_in', true)\n concrete_thick_in.setDisplayName('Concrete Thickness')\n concrete_thick_in.setUnits('in')\n concrete_thick_in.setDescription('The thickness of the concrete core of the ICF.')\n concrete_thick_in.setDefaultValue(4.0)\n args << concrete_thick_in\n\n # make a double argument for framing factor\n framing_factor = OpenStudio::Measure::OSArgument::makeDoubleArgument('framing_factor', true)\n framing_factor.setDisplayName('Framing Factor')\n framing_factor.setUnits('frac')\n framing_factor.setDescription('Total fraction of the wall that is framing for windows or doors.')\n framing_factor.setDefaultValue(0.076)\n args << framing_factor\n\n # make a double argument for drywall thickness\n drywall_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument('drywall_thick_in', true)\n drywall_thick_in.setDisplayName('Drywall Thickness')\n drywall_thick_in.setUnits('in')\n drywall_thick_in.setDescription('Thickness of the drywall material.')\n drywall_thick_in.setDefaultValue(0.5)\n args << drywall_thick_in\n\n # make a double argument for OSB/Plywood Thickness\n osb_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument('osb_thick_in', true)\n osb_thick_in.setDisplayName('OSB/Plywood Thickness')\n osb_thick_in.setUnits('in')\n osb_thick_in.setDescription(\"Specifies the thickness of the walls' OSB/plywood sheathing. Enter 0 for no sheathing (if the wall has other means to handle the shear load on the wall such as cross-bracing).\")\n osb_thick_in.setDefaultValue(0.5)\n args << osb_thick_in\n\n # make a double argument for Rigid Insulation R-value\n rigid_r = OpenStudio::Measure::OSArgument::makeDoubleArgument('rigid_r', true)\n rigid_r.setDisplayName('Continuous Insulation Nominal R-value')\n rigid_r.setUnits('h-ft^2-R/Btu')\n rigid_r.setDescription('The R-value of the continuous insulation.')\n rigid_r.setDefaultValue(0.0)\n args << rigid_r\n\n # make a choice argument for exterior finish material\n finishes = OpenStudio::StringVector.new\n WallConstructions.get_exterior_finish_materials.each do |mat|\n finishes << mat.name\n end\n exterior_finish = OpenStudio::Measure::OSArgument::makeChoiceArgument('exterior_finish', finishes, true)\n exterior_finish.setDisplayName('Exterior Finish')\n exterior_finish.setDescription('The exterior finish material.')\n exterior_finish.setDefaultValue(Material.ExtFinishVinylLight.name)\n args << exterior_finish\n\n return args\n end", "title": "" }, { "docid": "abc0987e7262c99fd5e27c16d8553966", "score": "0.72601175", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n # make a required argument with no default, osw should run without validating that\n r_value = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"r_value\",true)\n r_value.setDisplayName(\"Percentage Increase of R-value for Roof Insulation.\")\n args << r_value\n\n choices = OpenStudio::StringVector.new\n choices << \"MessagePack\"\n choices << \"CSV\"\n choices << \"Both\"\n output_format = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"output_format\", choices, true)\n output_format.setDisplayName(\"Output Format\")\n args << output_format \n \n return args\n end", "title": "" }, { "docid": "17ed8879c01efb0504364a492d659e45", "score": "0.7247139", "text": "def arguments(model) # rubocop:disable Lint/UnusedMethodArgument\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # add double argument for space infiltration target\n flow_per_area = OpenStudio::Measure::OSArgument.makeDoubleArgument('flow_per_area', true)\n flow_per_area.setDisplayName('Flow per Exterior Surface Area.')\n flow_per_area.setUnits('CFM/ft^2')\n flow_per_area.setDefaultValue(0.05)\n args << flow_per_area\n\n # add choice argument for exterior surfaces vs. just walls\n choices = OpenStudio::StringVector.new\n choices << 'ExteriorArea'\n choices << 'ExteriorWallArea'\n ext_surf_cat = OpenStudio::Measure::OSArgument.makeChoiceArgument('ext_surf_cat', choices, true)\n ext_surf_cat.setDisplayName('Exterior surfaces to include')\n ext_surf_cat.setDefaultValue('ExteriorArea')\n args << ext_surf_cat\n\n return args\n end", "title": "" }, { "docid": "f649fcd71a6d68265ae58ecf5b7d53c1", "score": "0.7244755", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument(\"weather_directory\", true)\n arg.setDisplayName(\"Weather Directory\")\n arg.setDescription(\"Absolute (or relative) directory to weather files.\")\n arg.setDefaultValue(\"./resources\")\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument(\"weather_file_name\", true)\n arg.setDisplayName(\"Weather File Name\")\n arg.setDescription(\"Name of the EPW weather file to assign. The corresponding DDY file must also be in the same directory.\")\n arg.setDefaultValue(\"USA_CO_Denver_Intl_AP_725650_TMY3.epw\")\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument(\"dst_start_date\", true)\n arg.setDisplayName(\"Daylight Saving Start Date\")\n arg.setDescription(\"Set to 'NA' if no daylight saving.\")\n arg.setDefaultValue(\"April 7\")\n args << arg\n \n arg = OpenStudio::Measure::OSArgument.makeStringArgument(\"dst_end_date\", true)\n arg.setDisplayName(\"Daylight Saving End Date\")\n arg.setDescription(\"Set to 'NA' if no daylight saving.\")\n arg.setDefaultValue(\"October 26\")\n args << arg \n \n return args\n end", "title": "" }, { "docid": "7a36e13a2f26cecc877194fba80f500a", "score": "0.72427225", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #make an argument for hot water loop name\n hw_loop_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"hw_loop_name\",true)\n hw_loop_name.setDisplayName(\"Name of the hot water loop\")\n args << hw_loop_name \n\n #make an argument for air loop name\n air_loop_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"air_loop_name\",true)\n air_loop_name.setDisplayName(\"Name of the hot water loop\")\n args << air_loop_name \n\n return args\n end", "title": "" }, { "docid": "8a99aa26fe777f84093ce3850cfbed24", "score": "0.7230976", "text": "def arguments(model)\n # create arguments\n # need to include double and integer args so method to check doesnt fail,\n # try to dynamically create these in the future\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2019'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('system_type', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_delivery_type', ['Forced Air'], true); arg.setValue('Forced Air'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('htg_src', ['NaturalGas'], true); arg.setValue('NaturalGas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('clg_src', ['Electricity'], true); arg.setValue('Electricity'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('swh_src', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('kitchen_makeup', ['Adjacent'], true); arg.setValue('Adjacent'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('exterior_lighting_zone', ['3 - All Other Areas'], true); arg.setValue('3 - All Other Areas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_constructions', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_space_type_loads', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_elevators', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_internal_mass', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exterior_lights', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('onsite_parking_fraction', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exhaust', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_swh', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_thermostat', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_hvac', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_refrigeration', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wkdy_op_hrs', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wknd_op_hrs', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('hoo_var_method', true); arg.setValue('fractional'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('unmet_hours_tolerance', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_objects', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_dst', true); arg.setValue(true); args << arg\n\n # new optional method argument that measures can add if they want load and use haystakc JSOn file\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('haystack_file', true); arg.setValue('SmallOffice_model.json'); args << arg\n\n return args\n end", "title": "" }, { "docid": "f7fd59a843d2f960fef82aa8df06cb73", "score": "0.7230976", "text": "def arguments(model)\n # create arguments\n # need to include double and integer args so method to check doesnt fail,\n # try to dynamically create these in the future\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2019'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('system_type', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('hvac_delivery_type', ['Forced Air'], true); arg.setValue('Forced Air'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('htg_src', ['NaturalGas'], true); arg.setValue('NaturalGas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('clg_src', ['Electricity'], true); arg.setValue('Electricity'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('swh_src', ['Inferred'], true); arg.setValue('Inferred'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('kitchen_makeup', ['Adjacent'], true); arg.setValue('Adjacent'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('exterior_lighting_zone', ['3 - All Other Areas'], true); arg.setValue('3 - All Other Areas'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_constructions', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_space_type_loads', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_elevators', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_internal_mass', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exterior_lights', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('onsite_parking_fraction', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_exhaust', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_swh', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_thermostat', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_hvac', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('add_refrigeration', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wkdy_op_hrs', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wkdy_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('modify_wknd_op_hrs', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_start_time', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wknd_op_hrs_duration', true); arg.setValue(8.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('unmet_hours_tolerance', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('remove_objects', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_dst', true); arg.setValue(true); args << arg\n\n # new optional method argument that measures can add if they want load and use haystakc JSOn file\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('haystack_file', true); arg.setValue('SmallOffice_model.json'); args << arg\n\n return args\n end", "title": "" }, { "docid": "babd4e6ca4ff4418d9cd3c14db41d1dd", "score": "0.723093", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('hpxml_path', true)\n arg.setDisplayName('HPXML File Path')\n arg.setDescription('Absolute (or relative) path of the HPXML file.')\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('weather_dir', true)\n arg.setDisplayName('Weather Directory')\n arg.setDescription('Absolute path of the weather directory.')\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('schemas_dir', false)\n arg.setDisplayName('HPXML Schemas Directory')\n arg.setDescription('Absolute path of the hpxml schemas directory.')\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('epw_output_path', false)\n arg.setDisplayName('EPW Output File Path')\n arg.setDescription('Absolute (or relative) path of the output EPW file.')\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('osm_output_path', false)\n arg.setDisplayName('OSM Output File Path')\n arg.setDescription('Absolute (or relative) path of the output OSM file.')\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('skip_validation', true)\n arg.setDisplayName('Skip HPXML validation')\n arg.setDescription('If true, only checks for and reports HPXML validation issues if an error occurs during processing. Used for faster runtime.')\n arg.setDefaultValue(false)\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('map_tsv_dir', false)\n arg.setDisplayName('Map TSV Directory')\n arg.setDescription('Creates TSV files in the specified directory that map some HPXML object names to EnergyPlus object names. Required for ERI calculation.')\n args << arg\n\n return args\n end", "title": "" }, { "docid": "5220b13f412770f1acc166039c53215f", "score": "0.7227914", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for wall continuous insulation R-value\n wall_rigid_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"wall_rigid_r\", true)\n wall_rigid_r.setDisplayName(\"Wall Continuous Insulation Nominal R-value\")\n\twall_rigid_r.setUnits(\"hr-ft^2-R/Btu\")\n\twall_rigid_r.setDescription(\"The R-value of the continuous insulation.\")\n wall_rigid_r.setDefaultValue(10.0)\n args << wall_rigid_r\n\n #make a double argument for wall continuous insulation thickness\n wall_rigid_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"wall_rigid_thick_in\", true)\n wall_rigid_thick_in.setDisplayName(\"Wall Continuous Insulation Thickness\")\n\twall_rigid_thick_in.setUnits(\"in\")\n\twall_rigid_thick_in.setDescription(\"The thickness of the continuous insulation.\")\n wall_rigid_thick_in.setDefaultValue(2.0)\n args << wall_rigid_thick_in\n\n #make a double argument for ceiling cavity R-value\n ceil_cavity_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"ceil_cavity_r\", true)\n ceil_cavity_r.setDisplayName(\"Ceiling Cavity Insulation Nominal R-value\")\n\tceil_cavity_r.setUnits(\"h-ft^2-R/Btu\")\n\tceil_cavity_r.setDescription(\"Refers to the R-value of the cavity insulation and not the overall R-value of the assembly.\")\n ceil_cavity_r.setDefaultValue(0)\n args << ceil_cavity_r\n\n\t#make a choice argument for ceiling cavity insulation installation grade\n installgrade_display_names = OpenStudio::StringVector.new\n installgrade_display_names << \"I\"\n installgrade_display_names << \"II\"\n installgrade_display_names << \"III\"\n\tceil_cavity_grade = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"ceil_cavity_grade\", installgrade_display_names, true)\n\tceil_cavity_grade.setDisplayName(\"Ceiling Cavity Install Grade\")\n\tceil_cavity_grade.setDescription(\"Installation grade as defined by RESNET standard. 5% of the cavity is considered missing insulation for Grade 3, 2% for Grade 2, and 0% for Grade 1.\")\n ceil_cavity_grade.setDefaultValue(\"I\")\n\targs << ceil_cavity_grade\n\n\t#make a choice argument for ceiling framing factor\n\tceil_ff = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"ceil_ff\", true)\n ceil_ff.setDisplayName(\"Ceiling Framing Factor\")\n\tceil_ff.setUnits(\"frac\")\n\tceil_ff.setDescription(\"Fraction of ceiling that is framing.\")\n ceil_ff.setDefaultValue(0.13)\n\targs << ceil_ff\n\n\t#make a choice argument for ceiling joist height\n\tceil_joist_height = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"ceil_joist_height\", true)\n\tceil_joist_height.setDisplayName(\"Ceiling Joist Height\")\n\tceil_joist_height.setUnits(\"in\")\n\tceil_joist_height.setDescription(\"Height of the joist member.\")\n\tceil_joist_height.setDefaultValue(9.25)\n\targs << ceil_joist_height\t\n \n #make a string argument for exposed perimeter\n exposed_perim = OpenStudio::Measure::OSArgument::makeStringArgument(\"exposed_perim\", true)\n\texposed_perim.setDisplayName(\"Exposed Perimeter\")\n\texposed_perim.setUnits(\"ft\")\n\texposed_perim.setDescription(\"Total length of the crawlspace's perimeter that is on the exterior of the building's footprint.\")\n\texposed_perim.setDefaultValue(Constants.Auto)\n\targs << exposed_perim\t\n \n return args\n end", "title": "" }, { "docid": "8b198503cb901f5bc937b8f1376ec01f", "score": "0.72251666", "text": "def meaningful_arguments(task_model = self.model)\n task_model.meaningful_arguments(arguments)\n\tend", "title": "" }, { "docid": "7c334154f40376009c87340a95dd62a8", "score": "0.72209203", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n \n\t#make a double argument for Fuel Type\n fuel_display_names = OpenStudio::StringVector.new\n fuel_display_names << Constants.FuelTypeGas\n fuel_display_names << Constants.FuelTypePropane\n fuel_type = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"fuel_type\", fuel_display_names, true)\n fuel_type.setDisplayName(\"Fuel Type\")\n fuel_type.setDescription(\"Type of fuel used by the cooking range.\")\n fuel_type.setDefaultValue(Constants.FuelTypeGas)\n args << fuel_type\n\n\t#make a double argument for cooktop EF\n\tc_ef = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"c_ef\", true)\n\tc_ef.setDisplayName(\"Cooktop Energy Factor\")\n\tc_ef.setDescription(\"Cooktop energy factor determined by DOE test procedures for cooking appliances (DOE 1997).\")\n\tc_ef.setDefaultValue(0.4)\n\targs << c_ef\n\n\t#make a double argument for oven EF\n\to_ef = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"o_ef\", true)\n\to_ef.setDisplayName(\"Oven Energy Factor\")\n\to_ef.setDescription(\"Oven energy factor determined by DOE test procedures for cooking appliances (DOE 1997).\")\n\to_ef.setDefaultValue(0.058)\n\targs << o_ef\n\t\n\t#make a boolean argument for has electric ignition\n\te_ignition = OpenStudio::Measure::OSArgument::makeBoolArgument(\"e_ignition\", true)\n\te_ignition.setDisplayName(\"Has Electronic Ignition\")\n\te_ignition.setDescription(\"For fuel cooking ranges with electronic ignition, an extra (40 + 13.3x(#BR)) kWh/yr of electricity will be included.\")\n\te_ignition.setDefaultValue(true)\n\targs << e_ignition\n\n\t#make a double argument for Occupancy Energy Multiplier\n\tmult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mult\", true)\n\tmult.setDisplayName(\"Occupancy Energy Multiplier\")\n\tmult.setDescription(\"Appliance energy use is multiplied by this factor to account for occupancy usage that differs from the national average.\")\n\tmult.setDefaultValue(1)\n\targs << mult\n\n\t#Make a string argument for 24 weekday schedule values\n\tweekday_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekday_sch\", true)\n\tweekday_sch.setDisplayName(\"Weekday schedule\")\n\tweekday_sch.setDescription(\"Specify the 24-hour weekday schedule.\")\n\tweekday_sch.setDefaultValue(\"0.007, 0.007, 0.004, 0.004, 0.007, 0.011, 0.025, 0.042, 0.046, 0.048, 0.042, 0.050, 0.057, 0.046, 0.057, 0.044, 0.092, 0.150, 0.117, 0.060, 0.035, 0.025, 0.016, 0.011\")\n\targs << weekday_sch\n \n\t#Make a string argument for 24 weekend schedule values\n\tweekend_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekend_sch\", true)\n\tweekend_sch.setDisplayName(\"Weekend schedule\")\n\tweekend_sch.setDescription(\"Specify the 24-hour weekend schedule.\")\n\tweekend_sch.setDefaultValue(\"0.007, 0.007, 0.004, 0.004, 0.007, 0.011, 0.025, 0.042, 0.046, 0.048, 0.042, 0.050, 0.057, 0.046, 0.057, 0.044, 0.092, 0.150, 0.117, 0.060, 0.035, 0.025, 0.016, 0.011\")\n\targs << weekend_sch\n\n\t#Make a string argument for 12 monthly schedule values\n\tmonthly_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"monthly_sch\", true)\n\tmonthly_sch.setDisplayName(\"Month schedule\")\n\tmonthly_sch.setDescription(\"Specify the 12-month schedule.\")\n\tmonthly_sch.setDefaultValue(\"1.097, 1.097, 0.991, 0.987, 0.991, 0.890, 0.896, 0.896, 0.890, 1.085, 1.085, 1.097\")\n\targs << monthly_sch\n\n #make a choice argument for space\n spaces = Geometry.get_all_unit_spaces(model)\n if spaces.nil?\n spaces = []\n end\n space_args = OpenStudio::StringVector.new\n space_args << Constants.Auto\n spaces.each do |space|\n space_args << space.name.to_s\n end\n space = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"space\", space_args, true)\n space.setDisplayName(\"Location\")\n space.setDescription(\"Select the space where the cooking range is located. '#{Constants.Auto}' will choose the lowest above-grade finished space available (e.g., first story living space), or a below-grade finished space as last resort. For multifamily buildings, '#{Constants.Auto}' will choose a space for each unit of the building.\")\n space.setDefaultValue(Constants.Auto)\n args << space\n\n return args\n end", "title": "" }, { "docid": "48125d38ae2ad63a51b4d5f1a293c16d", "score": "0.7215069", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a double argument for finished roof insulation R-value\n cavity_r = OpenStudio::Measure::OSArgument::makeDoubleArgument('cavity_r', true)\n cavity_r.setDisplayName('Cavity Insulation Installed R-value')\n cavity_r.setUnits('hr-ft^2-R/Btu')\n cavity_r.setDescription('Refers to the R-value of the cavity insulation and not the overall R-value of the assembly. If batt insulation must be compressed to fit within the cavity (e.g., R19 in a 5.5\" 2x6 cavity), use an R-value that accounts for this effect (see HUD Mobile Home Construction and Safety Standards 3280.509 for reference).')\n cavity_r.setDefaultValue(30.0)\n args << cavity_r\n\n # make a choice argument for wall cavity insulation installation grade\n installgrade_display_names = OpenStudio::StringVector.new\n installgrade_display_names << '1'\n installgrade_display_names << '2'\n installgrade_display_names << '3'\n install_grade = OpenStudio::Measure::OSArgument::makeChoiceArgument('install_grade', installgrade_display_names, true)\n install_grade.setDisplayName('Cavity Install Grade')\n install_grade.setDescription('Installation grade as defined by RESNET standard. 5% of the cavity is considered missing insulation for Grade 3, 2% for Grade 2, and 0% for Grade 1.')\n install_grade.setDefaultValue('1')\n args << install_grade\n\n # make a double argument for wall cavity depth\n cavity_depth = OpenStudio::Measure::OSArgument::makeDoubleArgument('cavity_depth', true)\n cavity_depth.setDisplayName('Cavity Depth')\n cavity_depth.setUnits('in')\n cavity_depth.setDescription('Depth of the roof cavity. 3.5\" for 2x4s, 5.5\" for 2x6s, etc.')\n cavity_depth.setDefaultValue(9.25)\n args << cavity_depth\n\n # make a bool argument for whether the cavity insulation fills the cavity\n filled_cavity = OpenStudio::Measure::OSArgument::makeBoolArgument('filled_cavity', true)\n filled_cavity.setDisplayName('Insulation Fills Cavity')\n filled_cavity.setDescription('When the insulation does not completely fill the depth of the cavity, air film resistances are added to the insulation R-value.')\n filled_cavity.setDefaultValue(false)\n args << filled_cavity\n\n # make a choice argument for finished roof framing factor\n framing_factor = OpenStudio::Measure::OSArgument::makeDoubleArgument('framing_factor', true)\n framing_factor.setDisplayName('Framing Factor')\n framing_factor.setUnits('frac')\n framing_factor.setDescription('The framing factor of the finished roof.')\n framing_factor.setDefaultValue(0.07)\n args << framing_factor\n\n # make a double argument for roof drywall thickness\n drywall_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument('drywall_thick_in', true)\n drywall_thick_in.setDisplayName('Drywall Thickness')\n drywall_thick_in.setUnits('in')\n drywall_thick_in.setDescription('Thickness of the drywall material.')\n drywall_thick_in.setDefaultValue(0.5)\n args << drywall_thick_in\n\n # make a double argument for roof osb/plywood thickness\n osb_thick_in = OpenStudio::Measure::OSArgument::makeDoubleArgument('osb_thick_in', true)\n osb_thick_in.setDisplayName('Roof OSB/Plywood Thickness')\n osb_thick_in.setUnits('in')\n osb_thick_in.setDescription('Specifies the thickness of the roof OSB/plywood sheathing. Enter 0 for no sheathing.')\n osb_thick_in.setDefaultValue(0.75)\n args << osb_thick_in\n\n # make a double argument for roof rigid insulation r-value\n rigid_r = OpenStudio::Measure::OSArgument::makeDoubleArgument('rigid_r', true)\n rigid_r.setDisplayName('Roof Continuous Insulation Nominal R-value')\n rigid_r.setUnits('h-ft^2-R/Btu')\n rigid_r.setDescription('The R-value of the roof continuous insulation.')\n rigid_r.setDefaultValue(0.0)\n args << rigid_r\n\n # make a choice argument for roofing material\n roofings = OpenStudio::StringVector.new\n RoofConstructions.get_roofing_materials.each do |mat|\n roofings << mat.name\n end\n roofing_material = OpenStudio::Measure::OSArgument::makeChoiceArgument('roofing_material', roofings, true)\n roofing_material.setDisplayName('Roofing Material')\n roofing_material.setDescription('The roofing material.')\n roofing_material.setDefaultValue(Material.RoofingAsphaltShinglesMed.name)\n args << roofing_material\n\n return args\n end", "title": "" }, { "docid": "aef6fc51847d9dd474b394a5e7d43d71", "score": "0.7215015", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n weather_file_name = OpenStudio::Measure::OSArgument.makeStringArgument('weather_file_name', true)\n weather_file_name.setDisplayName('Weather File Name')\n weather_file_name.setDescription('Name of the weather file to change to. This is the filename with the extension (e.g. NewWeather.epw). Optionally this can inclucde the full file path, but for most use cases should just be file name.')\n args << weather_file_name\n\n # make choice argument for climate zone\n choices = OpenStudio::StringVector.new\n choices << '1A'\n choices << '1B'\n choices << '2A'\n choices << '2B'\n choices << '3A'\n choices << '3B'\n choices << '3C'\n choices << '4A'\n choices << '4B'\n choices << '4C'\n choices << '5A'\n choices << '5B'\n choices << '5C'\n choices << '6A'\n choices << '6B'\n choices << '7'\n choices << '8'\n choices << 'Lookup From Stat File'\n climate_zone = OpenStudio::Measure::OSArgument.makeChoiceArgument('climate_zone', choices, true)\n climate_zone.setDisplayName('Climate Zone.')\n climate_zone.setDefaultValue('Lookup From Stat File')\n args << climate_zone\n\n # make an argument for use_upstream_args\n use_upstream_args = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true)\n use_upstream_args.setDisplayName('Use Upstream Argument Values')\n use_upstream_args.setDescription('When true this will look for arguments or registerValues in upstream measures that match arguments from this measure, and will use the value from the upstream measure in place of what is entered for this measure.')\n use_upstream_args.setDefaultValue(true)\n args << use_upstream_args\n\n args\n end", "title": "" }, { "docid": "1c246b8eb1a803a6bb821735f4d17ad3", "score": "0.72130185", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Make integer arg to run measure [1 is run, 0 is no run]\n run_measure = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"run_measure\",true)\n run_measure.setDisplayName(\"Run Measure\")\n run_measure.setDescription(\"integer argument to run measure [1 is run, 0 is no run]\")\n run_measure.setDefaultValue(1)\n args << run_measure \n\n # Make an argument for reduction percentage\n occ_threshold = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"occ_threshold\",true)\n occ_threshold.setDisplayName(\"Occupancy Threshold For Setback\")\n occ_threshold.setUnits(\"%\")\n occ_threshold.setDefaultValue(10.0)\n args << occ_threshold \n \n return args\n end", "title": "" }, { "docid": "0b3b12aedb1ae6372ebf4da63b1e091e", "score": "0.7211452", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # define CHW pump control\n\t\n\tchw_pump_control = OpenStudio::StringVector.new\n chw_pump_control << \"intermittent\"\n\tchw_pump_control << \"continuous\"\n chw_pump_control = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('chw_pump_control',chw_pump_control, true)\n chw_pump_control.setDisplayName(\"Choose CHW pump control type.\")\n chw_pump_control.setDefaultValue(\"intermittent\")\n args << chw_pump_control\n\t\n\t# set CHW design setpoint (F)\n\tchw_design_setpoint = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('chw_design_setpoint', false)\n chw_design_setpoint.setDisplayName(\"Chilled water design setpoint in Fahrenheit\")\n chw_design_setpoint.setDefaultValue(44.996)\n args << chw_design_setpoint\n\t\n\t# CHW pump type/configuration\n\t\n\tchw_pump_type = OpenStudio::StringVector.new\n chw_pump_type << \"ConstantPrimaryNoSecondary\"\n\tchw_pump_type << \"ConstantPrimaryVariableSecondary\"\n chw_pump_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('chw_pump_type', chw_pump_type, true)\n chw_pump_type.setDisplayName(\"Choose CHW pump type and configuration.\")\n chw_pump_type.setDefaultValue(\"ConstantPrimaryNoSecondary\")\n args << chw_pump_type\n\t\t\n\t# Loop design delta T (F)\n\tchw_design_deltaT = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('chw_design_deltaT', false)\n chw_design_deltaT.setDisplayName(\"Chilled water design deltaT in Fahrenheit\")\n chw_design_deltaT.setDefaultValue(12)\n args << chw_design_deltaT\n\t\n return args\n end", "title": "" }, { "docid": "b3ded9a2aa053c40b262118618ae3342", "score": "0.72065264", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Make integer arg to run measure [1 is run, 0 is no run]\n run_measure = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"run_measure\",true)\n run_measure.setDisplayName(\"Run Measure\")\n run_measure.setDescription(\"integer argument to run measure [1 is run, 0 is no run]\")\n run_measure.setDefaultValue(1)\n args << run_measure \n\n # Make an argument for reduction percentage\n lighting_power_reduction_percent = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"lighting_power_reduction_percent\",true)\n lighting_power_reduction_percent.setDisplayName(\"Lighting Power Reduction Percentage\")\n lighting_power_reduction_percent.setUnits(\"%\")\n lighting_power_reduction_percent.setDefaultValue(20.0)\n args << lighting_power_reduction_percent\n\n return args\n end", "title": "" }, { "docid": "c3ef557092ff2cff3f2a594dd9c0e603", "score": "0.72039074", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument(\"weather_directory\", true)\n arg.setDisplayName(\"Weather Directory\")\n arg.setDescription(\"Absolute (or relative) directory to weather files.\")\n arg.setDefaultValue(\"../HPXMLtoOpenStudio/weather\")\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument(\"weather_file_name\", true)\n arg.setDisplayName(\"Weather File Name\")\n arg.setDescription(\"Name of the EPW weather file to assign. The corresponding DDY file must also be in the same directory.\")\n arg.setDefaultValue(\"USA_CO_Denver.Intl.AP.725650_TMY3.epw\")\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument(\"dst_start_date\", true)\n arg.setDisplayName(\"Daylight Saving Start Date\")\n arg.setDescription(\"Set to 'NA' if no daylight saving.\")\n arg.setDefaultValue(\"April 7\")\n args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeStringArgument(\"dst_end_date\", true)\n arg.setDisplayName(\"Daylight Saving End Date\")\n arg.setDescription(\"Set to 'NA' if no daylight saving.\")\n arg.setDefaultValue(\"October 26\")\n args << arg\n\n return args\n end", "title": "" }, { "docid": "08b4feeba6e100ed14d211fa257392ef", "score": "0.7203386", "text": "def arguments(model)\n # create arguments`\n args = OpenStudio::Measure::OSArgumentVector.new\n # all but 4-5 of these to have defaults so full set of arguments\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_a', get_doe_building_types, true); arg.setValue('Courthouse'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_b', get_doe_building_types, true); arg.setValue('SmallOffice'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_c', get_doe_building_types, true); arg.setValue('SmallOffice'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_d', get_doe_building_types, true); arg.setValue('SmallOffice'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_b_fract_bldg_area', true); arg.setValue(0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_c_fract_bldg_area', true); arg.setValue(0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_d_fract_bldg_area', true); arg.setValue(0); args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2010'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('total_bldg_floor_area', true); arg.setValue(50000.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('single_floor_area', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('floor_height', true); arg.setValue(10.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('num_stories_above_grade', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('num_stories_below_grade', true); arg.setValue(0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('building_rotation', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('ns_to_ew_ratio', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('perim_mult', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bar_width', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bar_sep_dist_mult', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wwr', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('party_wall_fraction', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('party_wall_stories_north', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('party_wall_stories_south', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('party_wall_stories_east', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('party_wall_stories_west', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('custom_height_bar', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('bottom_story_ground_exposed_floor', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('top_story_exterior_exposed_roof', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('make_mid_story_surfaces_adiabatic', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('story_multiplier', true); arg.setValue('None'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('bar_division_method', true); arg.setValue('Multiple Space Types - Individual Stories Sliced'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('double_loaded_corridor', true); arg.setValue('Primary Space Type'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('space_type_sort_logic', true); arg.setValue('Building Type > Size'); args << arg\n\n return args\n end", "title": "" }, { "docid": "0c2e0dbfe00fa71ce1236ed91b4f70e4", "score": "0.7201876", "text": "def arguments(model)\r\n args = OpenStudio::Measure::OSArgumentVector.new\r\n\r\n # make an argument for setting heating sizing factor\r\n\r\n heating_sizing_factor = OpenStudio::Measure::OSArgument.makeDoubleArgument('heating sizing factor', true)\r\n\r\n heating_sizing_factor.setDisplayName('Heating sizing factor')\r\n heating_sizing_factor.setDescription('A global sizing factor for calculating zone design heating load .')\r\n heating_sizing_factor.setDefaultValue(1.2)\r\n args << heating_sizing_factor\r\n\r\n # make an argument for setting cooling sizing factor\r\n\r\n cooling_sizing_factor = OpenStudio::Measure::OSArgument.makeDoubleArgument('cooling sizing factor', true)\r\n\r\n cooling_sizing_factor.setDisplayName('Cooling sizing factor')\r\n cooling_sizing_factor.setDescription('A global sizing factor for calculating zone design cooling load .')\r\n cooling_sizing_factor.setDefaultValue(1.2)\r\n args << cooling_sizing_factor\r\n return args\r\n end", "title": "" }, { "docid": "09b4b0d6f36835d30bfcbd00f38d0fb9", "score": "0.7201394", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a double argument for infiltration of living space\n living_ach50 = OpenStudio::Measure::OSArgument::makeDoubleArgument('living_ach50', true)\n living_ach50.setDisplayName('Air Leakage: Above-Grade Living ACH50')\n living_ach50.setUnits('1/hr')\n living_ach50.setDescription('Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for above-grade living space (including finished attic).')\n living_ach50.setDefaultValue(7)\n args << living_ach50\n\n # make a double argument for infiltration of garage\n garage_ach50 = OpenStudio::Measure::OSArgument::makeDoubleArgument('garage_ach50', true)\n garage_ach50.setDisplayName('Air Leakage: Garage ACH50')\n garage_ach50.setUnits('1/hr')\n garage_ach50.setDescription('Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the garage.')\n garage_ach50.setDefaultValue(7)\n args << garage_ach50\n\n # make a double argument for infiltration of finished basement\n finished_basement_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument('finished_basement_ach', true)\n finished_basement_ach.setDisplayName('Air Leakage: Finished Basement Constant ACH')\n finished_basement_ach.setUnits('1/hr')\n finished_basement_ach.setDescription('Constant air exchange rate, in Air Changes per Hour (ACH), for the finished basement.')\n finished_basement_ach.setDefaultValue(0.0)\n args << finished_basement_ach\n\n # make a double argument for infiltration of unfinished basement\n unfinished_basement_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument('unfinished_basement_ach', true)\n unfinished_basement_ach.setDisplayName('Air Leakage: Unfinished Basement Constant ACH')\n unfinished_basement_ach.setUnits('1/hr')\n unfinished_basement_ach.setDescription('Constant air exchange rate, in Air Changes per Hour (ACH), for the unfinished basement. A value of 0.10 ACH or greater is recommended for modeling Heat Pump Water Heaters in unfinished basements.')\n unfinished_basement_ach.setDefaultValue(0.1)\n args << unfinished_basement_ach\n\n # make a double argument for infiltration of crawlspace\n crawl_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument('crawl_ach', true)\n crawl_ach.setDisplayName('Air Leakage: Crawlspace Constant ACH')\n crawl_ach.setUnits('1/hr')\n crawl_ach.setDescription('Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the crawlspace.')\n crawl_ach.setDefaultValue(0.0)\n args << crawl_ach\n\n # make a double argument for infiltration of pier & beam\n pier_beam_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument('pier_beam_ach', true)\n pier_beam_ach.setDisplayName('Air Leakage: Pier & Beam Constant ACH')\n pier_beam_ach.setUnits('1/hr')\n pier_beam_ach.setDescription('Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the pier & beam foundation.')\n pier_beam_ach.setDefaultValue(100.0)\n args << pier_beam_ach\n\n # make a double argument for infiltration of unfinished attic\n unfinished_attic_sla = OpenStudio::Measure::OSArgument::makeDoubleArgument('unfinished_attic_sla', true)\n unfinished_attic_sla.setDisplayName('Air Leakage: Unfinished Attic SLA')\n unfinished_attic_sla.setDescription('Ratio of the effective leakage area (infiltration and/or ventilation) in the unfinished attic to the total floor area of the attic.')\n unfinished_attic_sla.setDefaultValue(0.00333)\n args << unfinished_attic_sla\n\n # make a double argument for shelter coefficient\n shelter_coef = OpenStudio::Measure::OSArgument::makeStringArgument('shelter_coef', true)\n shelter_coef.setDisplayName('Air Leakage: Shelter Coefficient')\n shelter_coef.setDescription('The local shelter coefficient (AIM-2 infiltration model) accounts for nearby buildings, trees and obstructions.')\n shelter_coef.setDefaultValue('auto')\n args << shelter_coef\n\n # make a choice arguments for terrain type\n terrain_types_names = OpenStudio::StringVector.new\n terrain_types_names << Constants.TerrainOcean\n terrain_types_names << Constants.TerrainPlains\n terrain_types_names << Constants.TerrainRural\n terrain_types_names << Constants.TerrainSuburban\n terrain_types_names << Constants.TerrainCity\n terrain = OpenStudio::Measure::OSArgument::makeChoiceArgument('terrain', terrain_types_names, true)\n terrain.setDisplayName('Air Leakage: Site Terrain')\n terrain.setDescription('The terrain of the site.')\n terrain.setDefaultValue(Constants.TerrainSuburban)\n args << terrain\n\n # make a choice argument for ventilation type\n ventilation_types_names = OpenStudio::StringVector.new\n ventilation_types_names << Constants.VentTypeNone\n ventilation_types_names << Constants.VentTypeExhaust\n ventilation_types_names << Constants.VentTypeSupply\n ventilation_types_names << Constants.VentTypeCFIS\n ventilation_types_names << Constants.VentTypeBalanced\n mech_vent_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('mech_vent_type', ventilation_types_names, true)\n mech_vent_type.setDisplayName('Mechanical Ventilation: Ventilation Type')\n mech_vent_type.setDescription('Whole house ventilation strategy used.')\n mech_vent_type.setDefaultValue(Constants.VentTypeExhaust)\n args << mech_vent_type\n\n # make a double argument for house fan power\n mech_vent_fan_power = OpenStudio::Measure::OSArgument::makeDoubleArgument('mech_vent_fan_power', true)\n mech_vent_fan_power.setDisplayName('Mechanical Ventilation: Fan Power')\n mech_vent_fan_power.setUnits('W/cfm')\n mech_vent_fan_power.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of fan(s) providing whole house ventilation. If the house uses a balanced ventilation system there is assumed to be two fans operating at this efficiency. Not used for #{Constants.VentTypeCFIS} systems.\")\n mech_vent_fan_power.setDefaultValue(0.15)\n args << mech_vent_fan_power\n\n # make a double argument for total efficiency\n mech_vent_total_efficiency = OpenStudio::Measure::OSArgument::makeDoubleArgument('mech_vent_total_efficiency', true)\n mech_vent_total_efficiency.setDisplayName('Mechanical Ventilation: Total Recovery Efficiency')\n mech_vent_total_efficiency.setDescription(\"The net total energy (sensible plus latent, also called enthalpy) recovered by the supply airstream adjusted by electric consumption, case heat loss or heat gain, air leakage and airflow mass imbalance between the two airstreams, as a percent of the potential total energy that could be recovered plus the exhaust fan energy. Only used for #{Constants.VentTypeBalanced} systems.\")\n mech_vent_total_efficiency.setDefaultValue(0)\n args << mech_vent_total_efficiency\n\n # make a double argument for sensible efficiency\n mech_vent_sensible_efficiency = OpenStudio::Measure::OSArgument::makeDoubleArgument('mech_vent_sensible_efficiency', true)\n mech_vent_sensible_efficiency.setDisplayName('Mechanical Ventilation: Sensible Recovery Efficiency')\n mech_vent_sensible_efficiency.setDescription(\"The net sensible energy recovered by the supply airstream as adjusted by electric consumption, case heat loss or heat gain, air leakage, airflow mass imbalance between the two airstreams and the energy used for defrost (when running the Very Low Temperature Test), as a percent of the potential sensible energy that could be recovered plus the exhaust fan energy. Only used for #{Constants.VentTypeBalanced} systems.\")\n mech_vent_sensible_efficiency.setDefaultValue(0)\n args << mech_vent_sensible_efficiency\n\n # make a double argument for cfis open time\n mech_vent_cfis_open_time = OpenStudio::Measure::OSArgument::makeDoubleArgument('mech_vent_cfis_open_time', true)\n mech_vent_cfis_open_time.setDisplayName('Mechanical Ventilation: CFIS Damper Open Time')\n mech_vent_cfis_open_time.setDescription(\"Minimum damper open time for a #{Constants.VentTypeCFIS} system.\")\n mech_vent_cfis_open_time.setDefaultValue(20.0)\n args << mech_vent_cfis_open_time\n\n # make a double argument for cfis airflow fraction\n mech_vent_cfis_airflow_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument('mech_vent_cfis_airflow_frac', true)\n mech_vent_cfis_airflow_frac.setDisplayName('Mechanical Ventilation: CFIS Ventilation Mode Airflow Fraction')\n mech_vent_cfis_airflow_frac.setDescription(\"Blower airflow rate, when the #{Constants.VentTypeCFIS} system is operating in ventilation mode, as a fraction of maximum blower airflow rate.\")\n mech_vent_cfis_airflow_frac.setDefaultValue(1.0)\n args << mech_vent_cfis_airflow_frac\n\n # make an integer argument for hour of range spot ventilation\n range_exhaust_hour = OpenStudio::Measure::OSArgument::makeIntegerArgument('range_exhaust_hour', true)\n range_exhaust_hour.setDisplayName('Spot Ventilation: Hour of range spot ventilation')\n range_exhaust_hour.setDescription('Hour in which range spot ventilation occurs. Values indicate the time of spot ventilation, which lasts for 1 hour.')\n range_exhaust_hour.setDefaultValue(16)\n args << range_exhaust_hour\n\n # make an integer argument for hour of bathroom spot ventilation\n bathroom_exhaust_hour = OpenStudio::Measure::OSArgument::makeIntegerArgument('bathroom_exhaust_hour', true)\n bathroom_exhaust_hour.setDisplayName('Spot Ventilation: Hour of bathroom spot ventilation')\n bathroom_exhaust_hour.setDescription('Hour in which bathroom spot ventilation occurs. Values indicate the time of spot ventilation, which lasts for 1 hour.')\n bathroom_exhaust_hour.setDefaultValue(5)\n args << bathroom_exhaust_hour\n\n # make a double argument for dryer exhaust\n clothes_dryer_exhaust = OpenStudio::Measure::OSArgument::makeDoubleArgument('clothes_dryer_exhaust', true)\n clothes_dryer_exhaust.setDisplayName('Clothes Dryer: Exhaust')\n clothes_dryer_exhaust.setUnits('cfm')\n clothes_dryer_exhaust.setDescription('Rated flow capacity of the clothes dryer exhaust. This fan is assumed to run after any clothes dryer events.')\n clothes_dryer_exhaust.setDefaultValue(100.0)\n args << clothes_dryer_exhaust\n\n # make a double argument for heating season setpoint offset\n nat_vent_htg_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument('nat_vent_htg_offset', true)\n nat_vent_htg_offset.setDisplayName('Natural Ventilation: Heating Season Setpoint Offset')\n nat_vent_htg_offset.setUnits('degrees F')\n nat_vent_htg_offset.setDescription('The temperature offset below the hourly cooling setpoint, to which the living space is allowed to cool during months that are only in the heating season.')\n nat_vent_htg_offset.setDefaultValue(1.0)\n args << nat_vent_htg_offset\n\n # make a double argument for cooling season setpoint offset\n nat_vent_clg_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument('nat_vent_clg_offset', true)\n nat_vent_clg_offset.setDisplayName('Natural Ventilation: Cooling Season Setpoint Offset')\n nat_vent_clg_offset.setUnits('degrees F')\n nat_vent_clg_offset.setDescription('The temperature offset above the hourly heating setpoint, to which the living space is allowed to cool during months that are only in the cooling season.')\n nat_vent_clg_offset.setDefaultValue(1.0)\n args << nat_vent_clg_offset\n\n # make a double argument for overlap season setpoint offset\n nat_vent_ovlp_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument('nat_vent_ovlp_offset', true)\n nat_vent_ovlp_offset.setDisplayName('Natural Ventilation: Overlap Season Setpoint Offset')\n nat_vent_ovlp_offset.setUnits('degrees F')\n nat_vent_ovlp_offset.setDescription('The temperature offset above the maximum heating setpoint, to which the living space is allowed to cool during months that are in both the heating season and cooling season.')\n nat_vent_ovlp_offset.setDefaultValue(1.0)\n args << nat_vent_ovlp_offset\n\n # make a bool argument for heating season\n nat_vent_htg_season = OpenStudio::Measure::OSArgument::makeBoolArgument('nat_vent_htg_season', true)\n nat_vent_htg_season.setDisplayName('Natural Ventilation: Heating Season')\n nat_vent_htg_season.setDescription('True if windows are allowed to be opened during months that are only in the heating season.')\n nat_vent_htg_season.setDefaultValue(true)\n args << nat_vent_htg_season\n\n # make a bool argument for cooling season\n nat_vent_clg_season = OpenStudio::Measure::OSArgument::makeBoolArgument('nat_vent_clg_season', true)\n nat_vent_clg_season.setDisplayName('Natural Ventilation: Cooling Season')\n nat_vent_clg_season.setDescription('True if windows are allowed to be opened during months that are only in the cooling season.')\n nat_vent_clg_season.setDefaultValue(true)\n args << nat_vent_clg_season\n\n # make a bool argument for overlap season\n nat_vent_ovlp_season = OpenStudio::Measure::OSArgument::makeBoolArgument('nat_vent_ovlp_season', true)\n nat_vent_ovlp_season.setDisplayName('Natural Ventilation: Overlap Season')\n nat_vent_ovlp_season.setDescription('True if windows are allowed to be opened during months that are in both the heating season and cooling season.')\n nat_vent_ovlp_season.setDefaultValue(true)\n args << nat_vent_ovlp_season\n\n # make a double argument for number weekdays\n nat_vent_num_weekdays = OpenStudio::Measure::OSArgument::makeIntegerArgument('nat_vent_num_weekdays', true)\n nat_vent_num_weekdays.setDisplayName('Natural Ventilation: Number Weekdays')\n nat_vent_num_weekdays.setDescription('Number of weekdays in the week that natural ventilation can occur.')\n nat_vent_num_weekdays.setDefaultValue(3)\n args << nat_vent_num_weekdays\n\n # make a double argument for number weekend days\n nat_vent_num_weekends = OpenStudio::Measure::OSArgument::makeIntegerArgument('nat_vent_num_weekends', true)\n nat_vent_num_weekends.setDisplayName('Natural Ventilation: Number Weekend Days')\n nat_vent_num_weekends.setDescription('Number of weekend days in the week that natural ventilation can occur.')\n nat_vent_num_weekends.setDefaultValue(0)\n args << nat_vent_num_weekends\n\n # make a double argument for fraction of windows open\n nat_vent_frac_windows_open = OpenStudio::Measure::OSArgument::makeDoubleArgument('nat_vent_frac_windows_open', true)\n nat_vent_frac_windows_open.setDisplayName('Natural Ventilation: Fraction of Openable Windows Open')\n nat_vent_frac_windows_open.setUnits('frac')\n nat_vent_frac_windows_open.setDescription('Specifies the fraction of the total openable window area in the building that is opened for ventilation.')\n nat_vent_frac_windows_open.setDefaultValue(0.33)\n args << nat_vent_frac_windows_open\n\n # make a double argument for fraction of window area open\n nat_vent_frac_window_area_openable = OpenStudio::Measure::OSArgument::makeDoubleArgument('nat_vent_frac_window_area_openable', true)\n nat_vent_frac_window_area_openable.setDisplayName('Natural Ventilation: Fraction Window Area Openable')\n nat_vent_frac_window_area_openable.setUnits('frac')\n nat_vent_frac_window_area_openable.setDescription('Specifies the fraction of total window area in the home that can be opened (e.g. typical sliding windows can be opened to half of their area).')\n nat_vent_frac_window_area_openable.setDefaultValue(0.2)\n args << nat_vent_frac_window_area_openable\n\n # make a double argument for humidity ratio\n nat_vent_max_oa_hr = OpenStudio::Measure::OSArgument::makeDoubleArgument('nat_vent_max_oa_hr', true)\n nat_vent_max_oa_hr.setDisplayName('Natural Ventilation: Max OA Humidity Ratio')\n nat_vent_max_oa_hr.setUnits('frac')\n nat_vent_max_oa_hr.setDescription('Outdoor air humidity ratio above which windows will not open for natural ventilation.')\n nat_vent_max_oa_hr.setDefaultValue(0.0115)\n args << nat_vent_max_oa_hr\n\n # make a double argument for relative humidity ratio\n nat_vent_max_oa_rh = OpenStudio::Measure::OSArgument::makeDoubleArgument('nat_vent_max_oa_rh', true)\n nat_vent_max_oa_rh.setDisplayName('Natural Ventilation: Max OA Relative Humidity')\n nat_vent_max_oa_rh.setUnits('frac')\n nat_vent_max_oa_rh.setDescription('Outdoor air relative humidity (0-1) above which windows will not open for natural ventilation.')\n nat_vent_max_oa_rh.setDefaultValue(0.7)\n args << nat_vent_max_oa_rh\n\n # make a choice arguments for duct location\n location_args = OpenStudio::StringVector.new\n location_args << 'none'\n location_args << Constants.Auto\n Geometry.get_model_locations(model).each do |loc|\n location_args << loc\n end\n duct_location = OpenStudio::Measure::OSArgument::makeChoiceArgument('duct_location', location_args, true, true)\n duct_location.setDisplayName('Ducts: Location')\n duct_location.setDescription('The primary location of ducts.')\n duct_location.setDefaultValue(Constants.Auto)\n args << duct_location\n\n # make a double argument for total leakage\n duct_total_leakage = OpenStudio::Measure::OSArgument::makeDoubleArgument('duct_total_leakage', true)\n duct_total_leakage.setDisplayName('Ducts: Total Leakage')\n duct_total_leakage.setUnits('frac')\n duct_total_leakage.setDescription('The total amount of air flow leakage expressed as a fraction of the total air flow rate.')\n duct_total_leakage.setDefaultValue(0.3)\n args << duct_total_leakage\n\n # make a double argument for supply leakage fraction of total\n duct_supply_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument('duct_supply_frac', true)\n duct_supply_frac.setDisplayName('Ducts: Supply Leakage Fraction of Total')\n duct_supply_frac.setUnits('frac')\n duct_supply_frac.setDescription('The amount of air flow leakage leaking out from the supply duct expressed as a fraction of the total duct leakage.')\n duct_supply_frac.setDefaultValue(0.6)\n args << duct_supply_frac\n\n # make a double argument for return leakage fraction of total\n duct_return_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument('duct_return_frac', true)\n duct_return_frac.setDisplayName('Ducts: Return Leakage Fraction of Total')\n duct_return_frac.setUnits('frac')\n duct_return_frac.setDescription('The amount of air flow leakage leaking into the return duct expressed as a fraction of the total duct leakage.')\n duct_return_frac.setDefaultValue(0.067)\n args << duct_return_frac\n\n # make a double argument for supply AH leakage fraction of total\n duct_ah_supply_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument('duct_ah_supply_frac', true)\n duct_ah_supply_frac.setDisplayName('Ducts: Supply Air Handler Leakage Fraction of Total')\n duct_ah_supply_frac.setUnits('frac')\n duct_ah_supply_frac.setDescription('The amount of air flow leakage leaking out from the supply-side of the air handler expressed as a fraction of the total duct leakage.')\n duct_ah_supply_frac.setDefaultValue(0.067)\n args << duct_ah_supply_frac\n\n # make a double argument for return AH leakage fraction of total\n duct_ah_return_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument('duct_ah_return_frac', true)\n duct_ah_return_frac.setDisplayName('Ducts: Return Air Handler Leakage Fraction of Total')\n duct_ah_return_frac.setUnits('frac')\n duct_ah_return_frac.setDescription('The amount of air flow leakage leaking out from the return-side of the air handler expressed as a fraction of the total duct leakage.')\n duct_ah_return_frac.setDefaultValue(0.267)\n args << duct_ah_return_frac\n\n # #make a string argument for norm leakage to outside\n # duct_norm_leakage_25pa = OpenStudio::Measure::OSArgument::makeStringArgument(\"duct_norm_leakage_25pa\", true)\n # duct_norm_leakage_25pa.setDisplayName(\"Ducts: Leakage to Outside at 25Pa\")\n # duct_norm_leakage_25pa.setUnits(\"cfm/100 ft^2 Finished Floor\")\n # duct_norm_leakage_25pa.setDescription(\"Normalized leakage to the outside when tested at a pressure differential of 25 Pascals (0.1 inches w.g.) across the system.\")\n # duct_norm_leakage_25pa.setDefaultValue(\"NA\")\n # args << duct_norm_leakage_25pa\n\n # make a string argument for duct location frac\n duct_location_frac = OpenStudio::Measure::OSArgument::makeStringArgument('duct_location_frac', true)\n duct_location_frac.setDisplayName('Ducts: Location Fraction')\n duct_location_frac.setUnits('frac')\n duct_location_frac.setDescription('Fraction of supply ducts in the specified Duct Location; the remainder of supply ducts will be located in above-grade conditioned space.')\n duct_location_frac.setDefaultValue(Constants.Auto)\n args << duct_location_frac\n\n # make a string argument for duct num returns\n duct_num_returns = OpenStudio::Measure::OSArgument::makeStringArgument('duct_num_returns', true)\n duct_num_returns.setDisplayName('Ducts: Number of Returns')\n duct_num_returns.setUnits('#')\n duct_num_returns.setDescription('The number of duct returns.')\n duct_num_returns.setDefaultValue(Constants.Auto)\n args << duct_num_returns\n\n # make a double argument for supply surface area multiplier\n duct_supply_area_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument('duct_supply_area_mult', true)\n duct_supply_area_mult.setDisplayName('Ducts: Supply Surface Area Multiplier')\n duct_supply_area_mult.setUnits('mult')\n duct_supply_area_mult.setDescription('Values specify a fraction of the Building America Benchmark supply duct surface area.')\n duct_supply_area_mult.setDefaultValue(1.0)\n args << duct_supply_area_mult\n\n # make a double argument for return surface area multiplier\n duct_return_area_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument('duct_return_area_mult', true)\n duct_return_area_mult.setDisplayName('Ducts: Return Surface Area Multiplier')\n duct_return_area_mult.setUnits('mult')\n duct_return_area_mult.setDescription('Values specify a fraction of the Building America Benchmark return duct surface area.')\n duct_return_area_mult.setDefaultValue(1.0)\n args << duct_return_area_mult\n\n # make a double argument for duct unconditioned r value\n duct_r = OpenStudio::Measure::OSArgument::makeDoubleArgument('duct_r', true)\n duct_r.setDisplayName('Ducts: Insulation Nominal R-Value')\n duct_r.setUnits('h-ft^2-R/Btu')\n duct_r.setDescription('The nominal R-value for duct insulation.')\n duct_r.setDefaultValue(0.0)\n args << duct_r\n\n return args\n end", "title": "" }, { "docid": "1bdabf0947475a46359e82ab3f71b1bb", "score": "0.71914023", "text": "def arguments(model)\n\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # argument for string\n\t\tstring = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"string\", true)\n\t\tstring.setDisplayName(\"Set inputs for equipment containing the string (case sensitive, enter *.* for all):\")\n string.setDefaultValue(\"*.*\")\n\t\targs << string\n'\n # argument for autosize\n autosize = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"autosize\", false)\n autosize.setDisplayName(\"Autosize all fields?\")\n autosize.setDefaultValue(false)\n args << autosize\n'\n # WSHP Inputs\n'\nZoneHVAC:WaterToAirHeatPump,\n , !- Name\n , !- Availability Schedule Name\n , !- Air Inlet Node Name\n , !- Air Outlet Node Name\n , !- Outdoor Air Mixer Object Type\n , !- Outdoor Air Mixer Name\n , !- Supply Air Flow Rate During Cooling Operation {m3/s}\n , !- Supply Air Flow Rate During Heating Operation {m3/s}\n , !- Supply Air Flow Rate When No Cooling or Heating is Needed {m3/s}\n , !- Outdoor Air Flow Rate During Cooling Operation {m3/s}\n , !- Outdoor Air Flow Rate During Heating Operation {m3/s}\n , !- Outdoor Air Flow Rate When No Cooling or Heating is Needed {m3/s}\n , !- Supply Air Fan Object Type\n , !- Supply Air Fan Name\n , !- Heating Coil Object Type\n , !- Heating Coil Name\n , !- Cooling Coil Object Type\n , !- Cooling Coil Name\n 2.5, !- Maximum Cycling Rate {cycles/hr}\n 60.0, !- Heat Pump Time Constant {s}\n 0.01, !- Fraction of On-Cycle Power Use\n 60, !- Heat Pump Fan Delay Time {s}\n , !- Supplemental Heating Coil Object Type\n , !- Supplemental Heating Coil Name\n , !- Maximum Supply Air Temperature from Supplemental Heater {C}\n 21.0, !- Maximum Outdoor Dry-Bulb Temperature for Supplemental Heater Operation {C}\n , !- Outdoor Dry-Bulb Temperature Sensor Node Name\n BlowThrough, !- Fan Placement\n , !- Supply Air Fan Operating Mode Schedule Name\n , !- Availability Manager List Name\n Cycling; !- Heat Pump Coil Water Flow Mode\n\n'\n wshp_flow_clg = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('wshp_flow_clg', true)\n wshp_flow_clg.setDisplayName(\"WSHP: Supply Air Flow Rate During Cooling Operation {ft3/min}\")\n wshp_flow_clg.setDefaultValue(-1)\n args << wshp_flow_clg\n\n wshp_flow_htg = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('wshp_flow_htg', true)\n wshp_flow_htg.setDisplayName(\"WSHP: Supply Air Flow Rate During Heating Operation {ft3/min}\")\n wshp_flow_htg.setDefaultValue(-1)\n args << wshp_flow_htg\n\n wshp_flow_no_clg_or_htg = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('wshp_flow_no_clg_or_htg', true)\n wshp_flow_no_clg_or_htg.setDisplayName(\"WSHP: Supply Air Flow Rate When No Cooling or Heating is Needed {ft3/min}\")\n wshp_flow_no_clg_or_htg.setDefaultValue(-1)\n args << wshp_flow_no_clg_or_htg\n\n wshp_oa_clg = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('wshp_oa_clg', true)\n wshp_oa_clg.setDisplayName(\"WSHP: Outdoor Air Flow Rate During Cooling Operation {ft3/min}\")\n wshp_oa_clg.setDefaultValue(-1)\n args << wshp_oa_clg\n\n wshp_oa_htg = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('wshp_oa_htg', true)\n wshp_oa_htg.setDisplayName(\"WSHP: Outdoor Air Flow Rate During Heating Operation {ft3/min}\")\n wshp_oa_htg.setDefaultValue(-1)\n args << wshp_oa_htg\n\n wshp_oa_no_clg_or_htg = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('wshp_oa_no_clg_or_htg', true)\n wshp_oa_no_clg_or_htg.setDisplayName(\"WSHP: Outdoor Air Flow Rate When No Cooling or Heating is Needed {ft3/min}\")\n wshp_oa_no_clg_or_htg.setDefaultValue(-1)\n args << wshp_oa_no_clg_or_htg\n\n # fan schedule TODO see PTAC measure\n\n # FanOnOff inputs\n'\nFan:OnOff,\n , !- Name\n , !- Availability Schedule Name\n 0.6, !- Fan Total Efficiency\n , !- Pressure Rise {Pa}\n , !- Maximum Flow Rate {m3/s}\n 0.8, !- Motor Efficiency\n 1.0, !- Motor In Airstream Fraction\n , !- Air Inlet Node Name\n , !- Air Outlet Node Name\n , !- Fan Power Ratio Function of Speed Ratio Curve Name\n , !- Fan Efficiency Ratio Function of Speed Ratio Curve Name\n General; !- End-Use Subcategory\n'\n fan_eff_tot = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('fan_eff_tot', true)\n fan_eff_tot.setDisplayName(\"Fan: Fan Total Efficiency\")\n fan_eff_tot.setDefaultValue(-1)\n args << fan_eff_tot\n\n fan_rise = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('fan_rise', true)\n fan_rise.setDisplayName(\"Fan: Pressure Rise {inH2O}\")\n fan_rise.setDefaultValue(-1)\n args << fan_rise\n\n fan_flow = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('fan_flow', true)\n fan_flow.setDisplayName(\"Fan: Maximum Flow Rate {ft3/min}\")\n fan_flow.setDefaultValue(-1)\n args << fan_flow\n\n fan_eff_mot = OpenStudio::Ruleset::OSArgument::makeDoubleArgument('fan_eff_mot', true)\n fan_eff_mot.setDisplayName(\"Fan: Motor Efficiency\")\n fan_eff_mot.setDefaultValue(-1)\n args << fan_eff_mot\n'\nCoil:Heating:WaterToAirHeatPump:EquationFit,\n , !- Name\n , !- Water Inlet Node Name\n , !- Water Outlet Node Name\n , !- Air Inlet Node Name\n , !- Air Outlet Node Name\n , !- Rated Air Flow Rate {m3/s}\n , !- Rated Water Flow Rate {m3/s}\n , !- Gross Rated Heating Capacity {W}\n , !- Gross Rated Heating COP\n , !- Heating Capacity Coefficient 1\n , !- Heating Capacity Coefficient 2\n , !- Heating Capacity Coefficient 3\n , !- Heating Capacity Coefficient 4\n , !- Heating Capacity Coefficient 5\n , !- Heating Power Consumption Coefficient 1\n , !- Heating Power Consumption Coefficient 2\n , !- Heating Power Consumption Coefficient 3\n , !- Heating Power Consumption Coefficient 4\n 1; !- Heating Power Consumption Coefficient 5\n'\n # Htg Coil inputs\n\n hc_air_flow = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"hc_air_flow\", false)\n hc_air_flow.setDisplayName(\"Htg Coil: Rated Air Flow Rate {ft3/min}\")\n hc_air_flow.setDefaultValue(-1)\n args << hc_air_flow\n\n hc_wtr_flow = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"hc_wtr_flow\", false)\n hc_wtr_flow.setDisplayName(\"Htg Coil: Rated Water Flow Rate {ft3/min}\")\n hc_wtr_flow.setDefaultValue(-1)\n args << hc_wtr_flow\n\n hc_cap = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"hc_cap\", false)\n hc_cap.setDisplayName(\"Htg Coil: Gross Rated Heating Capacity {Btu/h}\")\n hc_cap.setDefaultValue(-1)\n args << hc_cap\n\n hc_cop = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"hc_cop\", false)\n hc_cop.setDisplayName(\"Htg Coil: Gross Rated Heating COP\")\n hc_cop.setDefaultValue(-1)\n args << hc_cop\n'\nCoil:Cooling:WaterToAirHeatPump:EquationFit,\n , !- Name\n , !- Water Inlet Node Name\n , !- Water Outlet Node Name\n , !- Air Inlet Node Name\n , !- Air Outlet Node Name\n , !- Rated Air Flow Rate {m3/s}\n , !- Rated Water Flow Rate {m3/s}\n , !- Gross Rated Total Cooling Capacity {W}\n , !- Gross Rated Sensible Cooling Capacity {W}\n , !- Gross Rated Cooling COP\n , !- Total Cooling Capacity Coefficient 1\n , !- Total Cooling Capacity Coefficient 2\n , !- Total Cooling Capacity Coefficient 3\n , !- Total Cooling Capacity Coefficient 4\n , !- Total Cooling Capacity Coefficient 5\n , !- Sensible Cooling Capacity Coefficient 1\n , !- Sensible Cooling Capacity Coefficient 2\n , !- Sensible Cooling Capacity Coefficient 3\n , !- Sensible Cooling Capacity Coefficient 4\n , !- Sensible Cooling Capacity Coefficient 5\n , !- Sensible Cooling Capacity Coefficient 6\n , !- Cooling Power Consumption Coefficient 1\n , !- Cooling Power Consumption Coefficient 2\n , !- Cooling Power Consumption Coefficient 3\n , !- Cooling Power Consumption Coefficient 4\n , !- Cooling Power Consumption Coefficient 5\n 0.0, !- Nominal Time for Condensate Removal to Begin {s}\n 0.0; !- Ratio of Initial Moisture Evaporation Rate and Steady State Latent Capacity {dimensionless}\n'\n # Clg Coil inputs\n\n cc_air_flow = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cc_air_flow\", false)\n cc_air_flow.setDisplayName(\"Clg Coil: Rated Air Flow Rate {ft3/min}\")\n cc_air_flow.setDefaultValue(-1)\n args << cc_air_flow\n\n cc_wtr_flow = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cc_wtr_flow\", false)\n cc_wtr_flow.setDisplayName(\"Clg Coil: Rated Water Flow Rate {ft3/min}\")\n cc_wtr_flow.setDefaultValue(-1)\n args << cc_wtr_flow\n\n cc_cap = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cc_cap\", false)\n cc_cap.setDisplayName(\"Clg Coil: Gross Rated Cooling Capacity {Btu/h}\")\n cc_cap.setDefaultValue(-1)\n args << cc_cap\n\n cc_sen_cap = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cc_sen_cap\", false)\n cc_sen_cap.setDisplayName(\"Clg Coil: Gross Rated Sensible Cooling Capacity {Btu/h}\")\n cc_sen_cap.setDefaultValue(-1)\n args << cc_sen_cap\n\n cc_cop = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cc_cop\", false)\n cc_cop.setDisplayName(\"Clg Coil: Gross Rated Cooling COP\")\n cc_cop.setDefaultValue(-1)\n args << cc_cop\n\n return args\n\n end", "title": "" }, { "docid": "0c5be003bcb39b6299812cbdbab9c694", "score": "0.7189563", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n\t#TODO: New argument for demand response for dws (alternate schedules if automatic DR control is specified)\n\t\n\t#make an integer argument for number of place settings\n\tnum_settings = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"num_settings\",true)\n\tnum_settings.setDisplayName(\"Number of Place Settings\")\n\tnum_settings.setUnits(\"#\")\n\tnum_settings.setDescription(\"The number of place settings for the unit. Data obtained from manufacturer's literature.\")\n\tnum_settings.setDefaultValue(12)\n\targs << num_settings\n\t\n\t#make a double argument for rated annual consumption\n\tdw_E = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"dw_E\",true)\n\tdw_E.setDisplayName(\"Rated Annual Consumption\")\n\tdw_E.setUnits(\"kWh\")\n\tdw_E.setDescription(\"The annual energy consumed by the dishwasher, as rated, obtained from the EnergyGuide label. This includes both the appliance electricity consumption and the energy required for water heating.\")\n\tdw_E.setDefaultValue(290)\n\targs << dw_E\n\t\n\t#make a bool argument for internal heater adjustment\n\tint_htr = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"int_htr\",true)\n\tint_htr.setDisplayName(\"Internal Heater Adjustment\")\n\tint_htr.setDescription(\"Does the system use an internal electric heater to adjust water temperature? Input obtained from manufacturer's literature.\")\n\tint_htr.setDefaultValue(\"true\")\n\targs << int_htr\n\n\t#make a bool argument for cold water inlet only\n\tcold_inlet = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"cold_inlet\",true)\n\tcold_inlet.setDisplayName(\"Cold Water Inlet Only\")\n\tcold_inlet.setDescription(\"Does the dishwasher use a cold water connection only. Input obtained from manufacturer's literature.\")\n\tcold_inlet.setDefaultValue(\"false\")\n\targs << cold_inlet\n\t\n\t#make a double argument for cold water connection use\n\tcold_use = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cold_use\",true)\n\tcold_use.setDisplayName(\"Cold Water Conn Use Per Cycle\")\n\tcold_use.setUnits(\"gal/cycle\")\n\tcold_use.setDescription(\"Volume of water per cycle used if there is only a cold water inlet connection, for the dishwasher. Input obtained from manufacturer's literature.\")\n\tcold_use.setDefaultValue(0)\n\targs << cold_use\n\n\t#make an integer argument for energy guide date\n\teg_date = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"eg_date\",true)\n\teg_date.setDisplayName(\"Energy Guide Date\")\n\teg_date.setDescription(\"Energy Guide test date.\")\n\teg_date.setDefaultValue(2007)\n\targs << eg_date\n\t\n\t#make a double argument for energy guide annual gas cost\n\teg_gas_cost = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"eg_gas_cost\",true)\n\teg_gas_cost.setDisplayName(\"Energy Guide Annual Gas Cost\")\n\teg_gas_cost.setUnits(\"$/yr\")\n\teg_gas_cost.setDescription(\"Annual cost of gas, as rated. Obtained from the EnergyGuide label.\")\n\teg_gas_cost.setDefaultValue(23)\n\targs << eg_gas_cost\n\t\n\t#make a double argument for occupancy energy multiplier\n\tmult_e = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"mult_e\",true)\n\tmult_e.setDisplayName(\"Occupancy Energy Multiplier\")\n\tmult_e.setDescription(\"Appliance energy use is multiplied by this factor to account for occupancy usage that differs from the national average.\")\n\tmult_e.setDefaultValue(1)\n\targs << mult_e\n\n\t#make a double argument for occupancy water multiplier\n\tmult_hw = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"mult_hw\",true)\n\tmult_hw.setDisplayName(\"Occupancy Hot Water Multiplier\")\n\tmult_hw.setDescription(\"Appliance hot water use is multiplied by this factor to account for occupancy usage that differs from the national average. This should generally be equal to the Occupancy Energy Multiplier.\")\n\tmult_hw.setDefaultValue(1)\n\targs << mult_hw\n\t\n #make a choice argument for space\n spaces = model.getSpaces\n space_args = OpenStudio::StringVector.new\n spaces.each do |space|\n space_args << space.name.to_s\n end\n if space_args.empty?\n space_args << Constants.LivingSpace(1)\n end\n space = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"space\", space_args, true)\n space.setDisplayName(\"Location\")\n space.setDescription(\"Select the space where the dishwasher is located\")\n if space_args.include?(Constants.LivingSpace(1))\n space.setDefaultValue(Constants.LivingSpace(1))\n end\n args << space\n \n #make a choice argument for plant loop\n plant_loops = model.getPlantLoops\n plant_loop_args = OpenStudio::StringVector.new\n plant_loops.each do |plant_loop|\n plant_loop_args << plant_loop.name.to_s\n end\n if plant_loop_args.empty?\n plant_loop_args << Constants.PlantLoopDomesticWater\n end\n plant_loop = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"plant_loop\", plant_loop_args, true)\n plant_loop.setDisplayName(\"Plant Loop\")\n plant_loop.setDescription(\"Select the plant loop for the dishwasher\")\n if plant_loop_args.include?(Constants.PlantLoopDomesticWater)\n plant_loop.setDefaultValue(Constants.PlantLoopDomesticWater)\n end\n\targs << plant_loop\n\n return args\n end", "title": "" }, { "docid": "00ef0df6cb63bfcdfd4a96a590247b5a", "score": "0.7186117", "text": "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #make an argument for material and installation cost\r\n material_cost_insulation_increase_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"material_cost_insulation_increase_ip\",true)\r\n material_cost_insulation_increase_ip.setDisplayName(\"Increase Cost per Area of Construction Where Insulation was Improved ($/ft^2).\")\r\n material_cost_insulation_increase_ip.setDefaultValue(0.0)\r\n args << material_cost_insulation_increase_ip\r\n\r\n #make an argument for material and installation cost\r\n material_cost_sri_increase_ip = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"material_cost_sri_increase_ip\",true)\r\n material_cost_sri_increase_ip.setDisplayName(\"Increase Cost per Area of Construction Where Solar Reflectance Index (SRI) was Improved. ($/ft^2).\")\r\n material_cost_sri_increase_ip.setDefaultValue(0.0)\r\n args << material_cost_sri_increase_ip \r\n \r\n return args\r\n end", "title": "" }, { "docid": "7658fa83503b4266f771e9dd0ed607c5", "score": "0.71854526", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Make integer arg to run measure [1 is run, 0 is no run]\n run_measure = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"run_measure\",true)\n run_measure.setDisplayName(\"Run Measure\")\n run_measure.setDescription(\"integer argument to run measure [1 is run, 0 is no run]\")\n run_measure.setDefaultValue(1)\n args << run_measure \n \n # Make an argument for the percent pressure drop reduction\n pressure_drop_reduction_inh2o = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"pressure_drop_reduction_inh2o\",true)\n pressure_drop_reduction_inh2o.setDisplayName(\"Pressure Drop Reduction\")\n pressure_drop_reduction_inh2o.setUnits(\"in W.C.\")\n pressure_drop_reduction_inh2o.setDefaultValue(0.5)\n args << pressure_drop_reduction_inh2o\n\n return args\n end", "title": "" }, { "docid": "0a307febe111a8eb9c9c2544d3bf602c", "score": "0.7182269", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name')\n args << variable_name\n\n # make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'detailed'\n reporting_frequency_chs << 'timestep'\n reporting_frequency_chs << 'hourly'\n reporting_frequency_chs << 'daily'\n reporting_frequency_chs << 'monthly'\n reporting_frequency_chs << 'runperiod'\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency')\n reporting_frequency.setDefaultValue('hourly')\n args << reporting_frequency\n\n # make an argument for the key_value\n key_value = OpenStudio::Measure::OSArgument.makeStringArgument('key_value', true)\n key_value.setDisplayName('Enter Key Name')\n key_value.setDescription('Enter * for all objects or the full name of a specific object to.')\n key_value.setDefaultValue('*')\n args << key_value\n\n # export to BCVTB\n export_bcvtb_chs = OpenStudio::StringVector.new\n export_bcvtb_chs << 'False'\n export_bcvtb_chs << 'True'\n export_bcvtb = OpenStudio::Measure::OSArgument.makeChoiceArgument('export_bcvtb', export_bcvtb_chs, true)\n export_bcvtb.setDisplayName('Export to BCVTB')\n export_bcvtb.setDefaultValue('False')\n args << export_bcvtb\n\n return args\n end", "title": "" }, { "docid": "240f9317682e17bf0a2d01a1ac0a63ed", "score": "0.7179923", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n \t#Make a string argument for 24 weekday heating set point values\n htg_wkdy = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"htg_wkdy\", false)\n htg_wkdy.setDisplayName(\"Weekday Setpoint\")\n htg_wkdy.setDescription(\"Specify a single heating setpoint or a 24-hour heating schedule for the weekdays.\")\n htg_wkdy.setUnits(\"degrees F\")\n htg_wkdy.setDefaultValue(\"71\")\n args << htg_wkdy\n\n \t#Make a string argument for 24 weekend heating set point values\n htg_wked = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"htg_wked\", false)\n htg_wked.setDisplayName(\"Weekend Setpoint\")\n htg_wked.setDescription(\"Specify a single heating setpoint or a 24-hour heating schedule for the weekend.\")\n htg_wked.setUnits(\"degrees F\")\n htg_wked.setDefaultValue(\"71\")\n args << htg_wked\n\t\n return args\n end", "title": "" }, { "docid": "3087ef15eeebaa9adfadcdf76923ba87", "score": "0.7178497", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a double argument for Fuel Type\n fuel_display_names = OpenStudio::StringVector.new\n fuel_display_names << Constants.FuelTypeGas\n fuel_display_names << Constants.FuelTypePropane\n fuel_display_names << Constants.FuelTypeElectric\n fuel_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('fuel_type', fuel_display_names, true)\n fuel_type.setDisplayName('Fuel Type')\n fuel_type.setDescription('Type of fuel used by the cooking range.')\n fuel_type.setDefaultValue(Constants.FuelTypeGas)\n args << fuel_type\n\n # make a double argument for cooktop EF\n cooktop_ef = OpenStudio::Measure::OSArgument::makeDoubleArgument('cooktop_ef', true)\n cooktop_ef.setDisplayName('Cooktop Energy Factor')\n cooktop_ef.setDescription('Cooktop energy factor determined by DOE test procedures for cooking appliances (DOE 1997).')\n cooktop_ef.setDefaultValue(0.4)\n args << cooktop_ef\n\n # make a double argument for oven EF\n oven_ef = OpenStudio::Measure::OSArgument::makeDoubleArgument('oven_ef', true)\n oven_ef.setDisplayName('Oven Energy Factor')\n oven_ef.setDescription('Oven energy factor determined by DOE test procedures for cooking appliances (DOE 1997).')\n oven_ef.setDefaultValue(0.058)\n args << oven_ef\n\n # make a boolean argument for has electric ignition\n has_elec_ignition = OpenStudio::Measure::OSArgument::makeBoolArgument('has_elec_ignition', true)\n has_elec_ignition.setDisplayName('Has Electronic Ignition')\n has_elec_ignition.setDescription('For fuel cooking ranges with electronic ignition, an extra (40 + 13.3x(#BR)) kWh/yr of electricity will be included. Only used for non-electric ranges.')\n has_elec_ignition.setDefaultValue(true)\n args << has_elec_ignition\n\n # make a double argument for Occupancy Energy Multiplier\n mult = OpenStudio::Measure::OSArgument::makeDoubleArgument('mult', true)\n mult.setDisplayName('Occupancy Energy Multiplier')\n mult.setDescription('Appliance energy use is multiplied by this factor to account for occupancy usage that differs from the national average.')\n mult.setDefaultValue(1)\n args << mult\n\n # make a choice argument for location\n location_args = OpenStudio::StringVector.new\n location_args << Constants.Auto\n Geometry.get_model_locations(model).each do |loc|\n location_args << loc\n end\n location = OpenStudio::Measure::OSArgument::makeChoiceArgument('location', location_args, true, true)\n location.setDisplayName('Location')\n location.setDescription(\"The space type for the location. '#{Constants.Auto}' will automatically choose a space type based on the space types found in the model.\")\n location.setDefaultValue(Constants.Auto)\n args << location\n\n return args\n end", "title": "" }, { "docid": "a2c894170f2a8b2e5797ac8a9449f676", "score": "0.7177518", "text": "def arguments(model)\n # create arguments`\n args = OpenStudio::Measure::OSArgumentVector.new\n # all but 4-5 of these to have defaults so full set of arguments\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_a', get_doe_building_types, true); arg.setValue('College'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_b', get_doe_building_types, true); arg.setValue('SmallOffice'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_c', get_doe_building_types, true); arg.setValue('SmallOffice'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('bldg_type_d', get_doe_building_types, true); arg.setValue('SmallOffice'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_b_fract_bldg_area', true); arg.setValue(0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_c_fract_bldg_area', true); arg.setValue(0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bldg_type_d_fract_bldg_area', true); arg.setValue(0); args << arg\n\n arg = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_doe_templates(true), true); arg.setValue('90.1-2004'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('total_bldg_floor_area', true); arg.setValue(45000.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('single_floor_area', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('floor_height', true); arg.setValue(10.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('num_stories_above_grade', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('num_stories_below_grade', true); arg.setValue(0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('building_rotation', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('ns_to_ew_ratio', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('perim_mult', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bar_width', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('bar_sep_dist_mult', true); arg.setValue(1.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('wwr', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeDoubleArgument('party_wall_fraction', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('party_wall_stories_north', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('party_wall_stories_south', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('party_wall_stories_east', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeIntegerArgument('party_wall_stories_west', true); arg.setValue(0.0); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('custom_height_bar', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('bottom_story_ground_exposed_floor', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('top_story_exterior_exposed_roof', true); arg.setValue(true); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('make_mid_story_surfaces_adiabatic', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument('use_upstream_args', true); arg.setValue(false); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('story_multiplier', true); arg.setValue('None'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('bar_division_method', true); arg.setValue('Multiple Space Types - Individual Stories Sliced'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('double_loaded_corridor', true); arg.setValue('Primary Space Type'); args << arg\n arg = OpenStudio::Measure::OSArgument.makeStringArgument('space_type_sort_logic', true); arg.setValue('Building Type > Size'); args << arg\n\n return args\n end", "title": "" }, { "docid": "dc3a81ced5a7bcf909e2e8a97af9a488", "score": "0.71722203", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make a string argument for ashp installed seer\n ashpInstalledSEER = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpInstalledSEER\", true)\n ashpInstalledSEER.setDisplayName(\"Installed SEER\")\n ashpInstalledSEER.setUnits(\"Btu/W-h\")\n ashpInstalledSEER.setDescription(\"The installed Seasonal Energy Efficiency Ratio (SEER) of the heat pump, and the installed Heating Seasonal Performance Factor (HSPF) of the heat pump.\")\n ashpInstalledSEER.setDefaultValue(13.0)\n args << ashpInstalledSEER\n \n #make a string argument for ashp installed hspf\n ashpInstalledHSPF = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpInstalledHSPF\", true)\n ashpInstalledHSPF.setDisplayName(\"Installed HSPF\")\n ashpInstalledHSPF.setUnits(\"Btu/W-h\")\n ashpInstalledHSPF.setDescription(\"The installed Seasonal Energy Efficiency Ratio (SEER) of the heat pump, and the installed Heating Seasonal Performance Factor (HSPF) of the heat pump.\")\n ashpInstalledHSPF.setDefaultValue(7.7)\n args << ashpInstalledHSPF\n \n #make a double argument for ashp number of speeds\n ashpNumberSpeeds = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpNumberSpeeds\", true)\n ashpNumberSpeeds.setDisplayName(\"Number of Speeds\")\n ashpNumberSpeeds.setUnits(\"frac\")\n ashpNumberSpeeds.setDescription(\"Number of speeds of the compressor.\")\n ashpNumberSpeeds.setDefaultValue(1.0)\n args << ashpNumberSpeeds\n\n #make a double argument for ashp eer\n ashpEER = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ashpEER\", true)\n ashpEER.setDisplayName(\"EER\")\n ashpEER.setUnits(\"kBtu/kWh\")\n ashpEER.setDescription(\"EER (net) from the A test (95 ODB/80 EDB/67 EWB) for each of the compressor speeds.\")\n ashpEER.setDefaultValue(\"11.4\")\n args << ashpEER\n \n #make a double argument for ashp cop\n ashpCOP = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ashpCOP\", true)\n ashpCOP.setDisplayName(\"COP\")\n ashpCOP.setUnits(\"Wh/Wh\")\n ashpCOP.setDescription(\"COP (net) at 47 ODB/70 EDB/60 EWB (AHRI rated conditions) for each of the compressor speeds.\")\n ashpCOP.setDefaultValue(\"3.05\")\n args << ashpCOP \n \n #make a double argument for ashp rated shr\n ashpSHRRated = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ashpSHRRated\", true)\n ashpSHRRated.setDisplayName(\"Rated SHR\")\n ashpSHRRated.setDescription(\"The sensible heat ratio (ratio of the sensible portion of the load to the total load) at the nominal rated capacity for each of the compressor speeds.\")\n ashpSHRRated.setDefaultValue(\"0.73\")\n args << ashpSHRRated\n\n #make a double argument for ashp capacity ratio\n ashpCapacityRatio = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ashpCapacityRatio\", true)\n ashpCapacityRatio.setDisplayName(\"Capacity Ratio\")\n ashpCapacityRatio.setDescription(\"Capacity divided by rated capacity for each of the compressor speeds.\")\n ashpCapacityRatio.setDefaultValue(\"1.0\")\n args << ashpCapacityRatio\n\n #make a double argument for ashp rated air flow rate cooling\n ashpRatedAirFlowRateCooling = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpRatedAirFlowRateCooling\", true)\n ashpRatedAirFlowRateCooling.setDisplayName(\"Rated Air Flow Rate, Cooling\")\n ashpRatedAirFlowRateCooling.setUnits(\"cfm/ton\")\n ashpRatedAirFlowRateCooling.setDescription(\"Air flow rate (cfm) per ton of rated capacity, in cooling mode.\")\n ashpRatedAirFlowRateCooling.setDefaultValue(394.2)\n args << ashpRatedAirFlowRateCooling \n \n #make a double argument for ashp rated air flow rate heating\n ashpRatedAirFlowRateHeating = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpRatedAirFlowRateHeating\", true)\n ashpRatedAirFlowRateHeating.setDisplayName(\"Rated Air Flow Rate, Heating\")\n ashpRatedAirFlowRateHeating.setUnits(\"cfm/ton\")\n ashpRatedAirFlowRateHeating.setDescription(\"Air flow rate (cfm) per ton of rated capacity, in heating mode.\")\n ashpRatedAirFlowRateHeating.setDefaultValue(384.1)\n args << ashpRatedAirFlowRateHeating\n\n #make a double argument for ashp fan speed ratio cooling\n ashpFanspeedRatioCooling = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ashpFanspeedRatioCooling\", true)\n ashpFanspeedRatioCooling.setDisplayName(\"Fan Speed Ratio Cooling\")\n ashpFanspeedRatioCooling.setDescription(\"Cooling fan speed divided by fan speed at the compressor speed for which Capacity Ratio = 1.0 for each of the compressor speeds.\")\n ashpFanspeedRatioCooling.setDefaultValue(\"1.0\")\n args << ashpFanspeedRatioCooling\n \n #make a double argument for ashp fan speed ratio heating\n ashpFanspeedRatioHeating = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ashpFanspeedRatioHeating\", true)\n ashpFanspeedRatioHeating.setDisplayName(\"Fan Speed Ratio Heating\")\n ashpFanspeedRatioHeating.setDescription(\"Heating fan speed divided by fan speed at the compressor speed for which Capacity Ratio = 1.0 for each of the compressor speeds.\")\n ashpFanspeedRatioHeating.setDefaultValue(\"1.0\")\n args << ashpFanspeedRatioHeating \n\n #make a double argument for ashp rated supply fan power\n ashpSupplyFanPowerRated = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpSupplyFanPowerRated\", true)\n ashpSupplyFanPowerRated.setDisplayName(\"Rated Supply Fan Power\")\n ashpSupplyFanPowerRated.setUnits(\"W/cfm\")\n ashpSupplyFanPowerRated.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of the outdoor fan under conditions prescribed by AHRI Standard 210/240 for SEER testing.\")\n ashpSupplyFanPowerRated.setDefaultValue(0.365)\n args << ashpSupplyFanPowerRated\n \n #make a double argument for ashp installed supply fan power\n ashpSupplyFanPowerInstalled = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpSupplyFanPowerInstalled\", true)\n ashpSupplyFanPowerInstalled.setDisplayName(\"Installed Supply Fan Power\")\n ashpSupplyFanPowerInstalled.setUnits(\"W/cfm\")\n ashpSupplyFanPowerInstalled.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of the outdoor fan for the maximum fan speed under actual operating conditions.\")\n ashpSupplyFanPowerInstalled.setDefaultValue(0.5)\n args << ashpSupplyFanPowerInstalled \n \n #make a double argument for ashp condenser type\n ashpCondenserType = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"ashpCondenserType\", true)\n ashpCondenserType.setDisplayName(\"Condenser Type\")\n ashpCondenserType.setDescription(\"For evaporatively cooled units, the performance curves are a function of outdoor wetbulb (not drybulb) and entering wetbulb.\")\n ashpCondenserType.setDefaultValue(\"aircooled\")\n args << ashpCondenserType \n \n #make a double argument for ashp min t\n ashpMinTemp = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpMinTemp\", true)\n ashpMinTemp.setDisplayName(\"Min Temp\")\n ashpMinTemp.setUnits(\"degrees F\")\n ashpMinTemp.setDescription(\"Outdoor dry-bulb temperature below which compressor turns off.\")\n ashpMinTemp.setDefaultValue(0.0)\n args << ashpMinTemp \n \n #make a double argument for central ac crankcase\n ashpCrankcase = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpCrankcase\", true)\n ashpCrankcase.setDisplayName(\"Crankcase\")\n ashpCrankcase.setUnits(\"kW\")\n ashpCrankcase.setDescription(\"Capacity of the crankcase heater for the compressor.\")\n ashpCrankcase.setDefaultValue(0.02)\n args << ashpCrankcase\n\n #make a double argument for ashp crankcase max t\n ashpCrankcaseMaxT = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpCrankcaseMaxT\", true)\n ashpCrankcaseMaxT.setDisplayName(\"Crankcase Max Temp\")\n ashpCrankcaseMaxT.setUnits(\"degrees F\")\n ashpCrankcaseMaxT.setDescription(\"Outdoor dry-bulb temperature above which compressor crankcase heating is disabled.\")\n ashpCrankcaseMaxT.setDefaultValue(55.0)\n args << ashpCrankcaseMaxT\n \n #make a double argument for ashp 1.5 ton eer capacity derate\n ashpEERCapacityDerateFactor1ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpEERCapacityDerateFactor1ton\", true)\n ashpEERCapacityDerateFactor1ton.setDisplayName(\"1.5 Ton EER Capacity Derate\")\n ashpEERCapacityDerateFactor1ton.setDescription(\"EER multiplier for 1.5 ton air-conditioners.\")\n ashpEERCapacityDerateFactor1ton.setDefaultValue(1.0)\n args << ashpEERCapacityDerateFactor1ton\n \n #make a double argument for central ac 2 ton eer capacity derate\n ashpEERCapacityDerateFactor2ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpEERCapacityDerateFactor2ton\", true)\n ashpEERCapacityDerateFactor2ton.setDisplayName(\"2 Ton EER Capacity Derate\")\n ashpEERCapacityDerateFactor2ton.setDescription(\"EER multiplier for 2 ton air-conditioners.\")\n ashpEERCapacityDerateFactor2ton.setDefaultValue(1.0)\n args << ashpEERCapacityDerateFactor2ton\n\n #make a double argument for central ac 3 ton eer capacity derate\n ashpEERCapacityDerateFactor3ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpEERCapacityDerateFactor3ton\", true)\n ashpEERCapacityDerateFactor3ton.setDisplayName(\"3 Ton EER Capacity Derate\")\n ashpEERCapacityDerateFactor3ton.setDescription(\"EER multiplier for 3 ton air-conditioners.\")\n ashpEERCapacityDerateFactor3ton.setDefaultValue(1.0)\n args << ashpEERCapacityDerateFactor3ton\n\n #make a double argument for central ac 4 ton eer capacity derate\n ashpEERCapacityDerateFactor4ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpEERCapacityDerateFactor4ton\", true)\n ashpEERCapacityDerateFactor4ton.setDisplayName(\"4 Ton EER Capacity Derate\")\n ashpEERCapacityDerateFactor4ton.setDescription(\"EER multiplier for 4 ton air-conditioners.\")\n ashpEERCapacityDerateFactor4ton.setDefaultValue(1.0)\n args << ashpEERCapacityDerateFactor4ton\n\n #make a double argument for central ac 5 ton eer capacity derate\n ashpEERCapacityDerateFactor5ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpEERCapacityDerateFactor5ton\", true)\n ashpEERCapacityDerateFactor5ton.setDisplayName(\"5 Ton EER Capacity Derate\")\n ashpEERCapacityDerateFactor5ton.setDescription(\"EER multiplier for 5 ton air-conditioners.\")\n ashpEERCapacityDerateFactor5ton.setDefaultValue(1.0)\n args << ashpEERCapacityDerateFactor5ton\n \n #make a double argument for ashp 1.5 ton cop capacity derate\n ashpCOPCapacityDerateFactor1ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpCOPCapacityDerateFactor1ton\", true)\n ashpCOPCapacityDerateFactor1ton.setDisplayName(\"1.5 Ton COP Capacity Derate\")\n ashpCOPCapacityDerateFactor1ton.setDescription(\"COP multiplier for 1.5 ton air-conditioners.\")\n ashpCOPCapacityDerateFactor1ton.setDefaultValue(1.0)\n args << ashpCOPCapacityDerateFactor1ton\n \n #make a double argument for ashp 2 ton cop capacity derate\n ashpCOPCapacityDerateFactor2ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpCOPCapacityDerateFactor2ton\", true)\n ashpCOPCapacityDerateFactor2ton.setDisplayName(\"2 Ton COP Capacity Derate\")\n ashpCOPCapacityDerateFactor2ton.setDescription(\"COP multiplier for 2 ton air-conditioners.\")\n ashpCOPCapacityDerateFactor2ton.setDefaultValue(1.0)\n args << ashpCOPCapacityDerateFactor2ton\n\n #make a double argument for ashp 3 ton cop capacity derate\n ashpCOPCapacityDerateFactor3ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpCOPCapacityDerateFactor3ton\", true)\n ashpCOPCapacityDerateFactor3ton.setDisplayName(\"3 Ton COP Capacity Derate\")\n ashpCOPCapacityDerateFactor3ton.setDescription(\"COP multiplier for 3 ton air-conditioners.\")\n ashpCOPCapacityDerateFactor3ton.setDefaultValue(1.0)\n args << ashpCOPCapacityDerateFactor3ton\n\n #make a double argument for ashp 4 ton cop capacity derate\n ashpCOPCapacityDerateFactor4ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpCOPCapacityDerateFactor4ton\", true)\n ashpCOPCapacityDerateFactor4ton.setDisplayName(\"4 Ton COP Capacity Derate\")\n ashpCOPCapacityDerateFactor4ton.setDescription(\"COP multiplier for 4 ton air-conditioners.\")\n ashpCOPCapacityDerateFactor4ton.setDefaultValue(1.0)\n args << ashpCOPCapacityDerateFactor4ton\n\n #make a double argument for ashp 5 ton cop capacity derate\n ashpCOPCapacityDerateFactor5ton = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"ashpCOPCapacityDerateFactor5ton\", true)\n ashpCOPCapacityDerateFactor5ton.setDisplayName(\"5 Ton COP Capacity Derate\")\n ashpCOPCapacityDerateFactor5ton.setDescription(\"COP multiplier for 5 ton air-conditioners.\")\n ashpCOPCapacityDerateFactor5ton.setDefaultValue(1.0)\n args << ashpCOPCapacityDerateFactor5ton \n \n #make a bool argument for whether the ashp is cold climate\n ashpIsColdClimate = OpenStudio::Ruleset::OSArgument::makeBoolArgument(\"ashpIsColdClimate\", true)\n ashpIsColdClimate.setDisplayName(\"Is Cold Climate\")\n ashpIsColdClimate.setDescription(\"Specifies whether the heat pump is a so called 'cold climate heat pump'.\")\n ashpIsColdClimate.setDefaultValue(false)\n args << ashpIsColdClimate \n \n #make a choice argument for ashp cooling/heating output capacity\n cap_display_names = OpenStudio::StringVector.new\n cap_display_names << Constants.SizingAuto\n (0.5..10.0).step(0.5) do |tons|\n cap_display_names << \"#{tons} tons\"\n end\n\n #make a string argument for ashp cooling/heating output capacity\n selected_hpcap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"selectedhpcap\", cap_display_names, true)\n selected_hpcap.setDisplayName(\"Cooling/Heating Output Capacity\")\n selected_hpcap.setDefaultValue(Constants.SizingAuto)\n args << selected_hpcap\n\n #make a choice argument for supplemental heating output capacity\n cap_display_names = OpenStudio::StringVector.new\n cap_display_names << Constants.SizingAuto\n (5..150).step(5) do |kbtu|\n cap_display_names << \"#{kbtu} kBtu/hr\"\n end\n\n #make a string argument for supplemental heating output capacity\n selected_supcap = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"selectedsupcap\", cap_display_names, true)\n selected_supcap.setDisplayName(\"Supplemental Heating Output Capacity\")\n selected_supcap.setDefaultValue(Constants.SizingAuto)\n args << selected_supcap \n \n return args\n end", "title": "" }, { "docid": "22d706b8c9311b12a69aa39105253000", "score": "0.7167319", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Make integer arg to run measure [1 is run, 0 is no run]\n run_measure = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(\"run_measure\",true)\n run_measure.setDisplayName(\"Run Measure\")\n run_measure.setDescription(\"integer argument to run measure [1 is run, 0 is no run]\")\n run_measure.setDefaultValue(1)\n args << run_measure \n \n # Make an argument for the percent pressure drop reduction\n pressure_drop_reduction_pct = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"pressure_drop_reduction_pct\",true)\n pressure_drop_reduction_pct.setDisplayName(\"Pressure Drop Reduction Percent\")\n pressure_drop_reduction_pct.setUnits(\"%\")\n pressure_drop_reduction_pct.setDefaultValue(10.0)\n args << pressure_drop_reduction_pct\n\n return args\n end", "title": "" }, { "docid": "9497cf734510e138719f673b7ed5582b", "score": "0.7166601", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for total floor area\n total_bldg_area_ip = OpenStudio::Measure::OSArgument.makeDoubleArgument('total_bldg_area_ip', true)\n total_bldg_area_ip.setDisplayName('Total Building Floor Area (ft^2).')\n total_bldg_area_ip.setDefaultValue(10000.0)\n args << total_bldg_area_ip\n\n # make an argument for aspect ratio\n ns_to_ew_ratio = OpenStudio::Measure::OSArgument.makeDoubleArgument('ns_to_ew_ratio', true)\n ns_to_ew_ratio.setDisplayName('Ratio of North/South Facade Length Relative to East/West Facade Length.')\n ns_to_ew_ratio.setDefaultValue(2.0)\n args << ns_to_ew_ratio\n\n # make an argument for number of floors\n num_floors = OpenStudio::Measure::OSArgument.makeIntegerArgument('num_floors', true)\n num_floors.setDisplayName('Number of Floors.')\n num_floors.setDefaultValue(2)\n args << num_floors\n\n # make an argument for floor height\n floor_to_floor_height_ip = OpenStudio::Measure::OSArgument.makeDoubleArgument('floor_to_floor_height_ip', true)\n floor_to_floor_height_ip.setDisplayName('Floor to Floor Height (ft).')\n floor_to_floor_height_ip.setDefaultValue(10.0)\n args << floor_to_floor_height_ip\n\n # make an argument for the meter name\n spaceTypeHashString = OpenStudio::Measure::OSArgument.makeStringArgument('spaceTypeHashString', true)\n spaceTypeHashString.setDisplayName('Hash of Space Types with Name as Key and Fraction as value.')\n args << spaceTypeHashString\n\n return args\n end", "title": "" }, { "docid": "e6d4fc2b155c811c987e4db808bda4ea", "score": "0.7160062", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n scenario_name = OpenStudio::Measure::OSArgument.makeStringArgument('scenario_name', false)\n scenario_name.setDisplayName('scenario_name')\n scenario_name.setDefaultValue('highefficiency_scenario')\n args << scenario_name\n \n id = OpenStudio::Measure::OSArgument.makeIntegerArgument('feature_id', false)\n id.setDisplayName('Feature unique identifier')\n id.setDefaultValue('1')\n args << id\n \n output_name_chs = OpenStudio::StringVector.new \n output_name_chs << 'total_site_energy'\n output_name_chs << 'total_source_energy'\n output_name_chs << 'net_site_energy'\n output_name_chs << 'net_source_energy'\n output_name_chs << 'electricity'\n output_name_chs << 'natural_gas'\n output_name_chs << 'additional_fuel'\n output_name_chs << 'district_cooling'\n output_name_chs << 'district_heating'\n output_name_chs << 'water'\n output_name_chs << 'electricity_produced'\n \n output_name = OpenStudio::Measure::OSArgument.makeChoiceArgument('output_name', output_name_chs, true)\n output_name.setDisplayName('output_name')\n output_name.setDefaultValue('total_site_energy')\n args << output_name\n\n \n return args\n end", "title": "" }, { "docid": "11af3457109c88529b659f8d2d57e05c", "score": "0.7153961", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n\n primary_chiller_name = OpenStudio::Measure::OSArgument.makeStringArgument(\"primary_chiller_name\", true)\n primary_chiller_name.setDisplayName(\"Name of Existing Chiller\")\n primary_chiller_name.setDefaultValue(\"90.1-2004 WaterCooled Centrifugal Chiller 0\")\n args << primary_chiller_name\n\n condenser_loop_name = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects(\"condenser_loop_name\",\"OS_PlantLoop\".to_IddObjectType,model,true)\n condenser_loop_name.setDescription(\"The condenser loop to connect the new charging chiller to\")\n condenser_loop_name.setDisplayName(\"Condenser Loop Name\")\n condenser_loop_name.setDefaultValue(\"Condenser Water Loop\")\n args << condenser_loop_name\n\n auto_date = OpenStudio::Measure::OSArgument.makeBoolArgument('auto_date', true)\n auto_date.setDisplayName('Enable Climate-specific Periods Setting ?')\n auto_date.setDefaultValue(true)\n args << auto_date\n\n return args\n end", "title": "" }, { "docid": "612c53f0530383c73109fc13c96d5b87", "score": "0.71517676", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a string argument for coverage\n coverage = OpenStudio::Measure::OSArgument::makeStringArgument(\"coverage\", true)\n coverage.setDisplayName(\"Coverage\")\n coverage.setUnits(\"frac\")\n coverage.setDescription(\"Fraction of house conditioned by fans where # fans = (above-grade finished floor area)/(% coverage)/300.\")\n coverage.setDefaultValue(\"NA\")\n args << coverage\n\n #make a string argument for specified number\n specified_num = OpenStudio::Measure::OSArgument::makeStringArgument(\"specified_num\", true)\n specified_num.setDisplayName(\"Specified Number\")\n specified_num.setUnits(\"#/unit\")\n specified_num.setDescription(\"Total number of fans.\")\n specified_num.setDefaultValue(\"1\")\n args << specified_num\n \n #make a double argument for power\n power = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"power\", true)\n power.setDisplayName(\"Power\")\n power.setUnits(\"W\")\n power.setDescription(\"Power consumption per fan assuming it runs at medium speed.\")\n power.setDefaultValue(45.0)\n args << power\n \n #make choice arguments for control\n control_names = OpenStudio::StringVector.new\n control_names << Constants.CeilingFanControlTypical\n control_names << Constants.CeilingFanControlSmart\n control = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"control\", control_names, true)\n control.setDisplayName(\"Control\")\n control.setDescription(\"'typical' indicates half of the fans will be on whenever the interior temperature is above the cooling setpoint; 'smart' indicates 50% of the energy consumption of 'typical.'\")\n control.setDefaultValue(Constants.CeilingFanControlTypical)\n args << control \n \n #make a bool argument for using benchmark energy\n use_benchmark_energy = OpenStudio::Measure::OSArgument::makeBoolArgument(\"use_benchmark_energy\", true)\n use_benchmark_energy.setDisplayName(\"Use Benchmark Energy\")\n use_benchmark_energy.setDescription(\"Use the energy value specified in the BA Benchmark: 77.3 + 0.0403 x FFA kWh/yr, where FFA is Finished Floor Area.\")\n use_benchmark_energy.setDefaultValue(true)\n args << use_benchmark_energy\n \n #make a double argument for BA Benchamrk multiplier\n mult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mult\")\n mult.setDisplayName(\"Building America Benchmark Multiplier\")\n mult.setDefaultValue(1)\n mult.setDescription(\"A multiplier on the national average energy use. Only applies if 'Use Benchmark Energy' is set to True.\")\n args << mult\n \n #make a double argument for cooling setpoint offset\n cooling_setpoint_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cooling_setpoint_offset\", true)\n cooling_setpoint_offset.setDisplayName(\"Cooling Setpoint Offset\")\n cooling_setpoint_offset.setUnits(\"degrees F\")\n cooling_setpoint_offset.setDescription(\"Increase in cooling set point due to fan usage.\")\n cooling_setpoint_offset.setDefaultValue(0)\n args << cooling_setpoint_offset \n \n #Make a string argument for 24 weekday schedule values\n weekday_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekday_sch\", true)\n weekday_sch.setDisplayName(\"Weekday schedule\")\n weekday_sch.setDescription(\"Specify the 24-hour weekday schedule.\")\n weekday_sch.setDefaultValue(\"0.04, 0.037, 0.037, 0.036, 0.033, 0.036, 0.043, 0.047, 0.034, 0.023, 0.024, 0.025, 0.024, 0.028, 0.031, 0.032, 0.039, 0.053, 0.063, 0.067, 0.071, 0.069, 0.059, 0.05\")\n args << weekday_sch\n \n #Make a string argument for 24 weekend schedule values\n weekend_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"weekend_sch\", true)\n weekend_sch.setDisplayName(\"Weekend schedule\")\n weekend_sch.setDescription(\"Specify the 24-hour weekend schedule.\")\n weekend_sch.setDefaultValue(\"0.04, 0.037, 0.037, 0.036, 0.033, 0.036, 0.043, 0.047, 0.034, 0.023, 0.024, 0.025, 0.024, 0.028, 0.031, 0.032, 0.039, 0.053, 0.063, 0.067, 0.071, 0.069, 0.059, 0.05\")\n args << weekend_sch\n\n #Make a string argument for 12 monthly schedule values\n monthly_sch = OpenStudio::Measure::OSArgument::makeStringArgument(\"monthly_sch\", true)\n monthly_sch.setDisplayName(\"Month schedule\")\n monthly_sch.setDescription(\"Specify the 12-month schedule.\")\n monthly_sch.setDefaultValue(\"1.248, 1.257, 0.993, 0.989, 0.993, 0.827, 0.821, 0.821, 0.827, 0.99, 0.987, 1.248\")\n args << monthly_sch \n \n return args\n end", "title": "" }, { "docid": "20c5cd5cc381eade2e2faa167d7ab463", "score": "0.715147", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for external model\n external_model_name = OpenStudio::Measure::OSArgument::makeStringArgument(\"external_model_name\",true)\n external_model_name.setDisplayName(\"External OSM File Name\")\n external_model_name.setDescription(\"Name of the model to replalace current model. This is the filename with the extension (e.g. MyModel.osm). Optionally this can inclucde the full file path, but for most use cases should just be file name.\")\n args << external_model_name\n\n return args\n end", "title": "" }, { "docid": "b99290c8c134c9983211456182cab36a", "score": "0.7151366", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for entering front window u-factor\n window_ufactor = OpenStudio::Measure::OSArgument::makeDoubleArgument('window_ufactor', true)\n window_ufactor.setDisplayName('Windows: U-Factor')\n window_ufactor.setUnits('Btu/hr-ft^2-R')\n window_ufactor.setDescription('The heat transfer coefficient of the windows.')\n window_ufactor.setDefaultValue(0.37)\n args << window_ufactor\n\n # make an argument for entering front window shgc\n window_shgc = OpenStudio::Measure::OSArgument::makeDoubleArgument('window_shgc', true)\n window_shgc.setDisplayName('Windows: SHGC')\n window_shgc.setDescription('The ratio of solar heat gain through a glazing system compared to that of an unobstructed opening, for windows.')\n window_shgc.setDefaultValue(0.3)\n args << window_shgc\n\n # make an argument for entering heating shade multiplier\n window_heat_shade_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument('window_heat_shade_mult', true)\n window_heat_shade_mult.setDisplayName('Windows: Heating Shade Multiplier')\n window_heat_shade_mult.setDescription('Interior shading multiplier for heating season. 1.0 indicates no reduction in solar gain, 0.85 indicates 15% reduction, etc.')\n window_heat_shade_mult.setDefaultValue(0.7)\n args << window_heat_shade_mult\n\n # make an argument for entering cooling shade multiplier\n window_cool_shade_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument('window_cool_shade_mult', true)\n window_cool_shade_mult.setDisplayName('Windows: Cooling Shade Multiplier')\n window_cool_shade_mult.setDescription('Interior shading multiplier for cooling season. 1.0 indicates no reduction in solar gain, 0.85 indicates 15% reduction, etc.')\n window_cool_shade_mult.setDefaultValue(0.7)\n args << window_cool_shade_mult\n\n # make an argument for entering front window u-factor\n skylight_ufactor = OpenStudio::Measure::OSArgument::makeDoubleArgument('skylight_ufactor', true)\n skylight_ufactor.setDisplayName('Skylights: U-Factor')\n skylight_ufactor.setUnits('Btu/hr-ft^2-R')\n skylight_ufactor.setDescription('The heat transfer coefficient of the skylights.')\n skylight_ufactor.setDefaultValue(0.33)\n args << skylight_ufactor\n\n # make an argument for entering front window shgc\n skylight_shgc = OpenStudio::Measure::OSArgument::makeDoubleArgument('skylight_shgc', true)\n skylight_shgc.setDisplayName('Skylights: SHGC')\n skylight_shgc.setDescription('The ratio of solar heat gain through a glazing system compared to that of an unobstructed opening, for skylights.')\n skylight_shgc.setDefaultValue(0.45)\n args << skylight_shgc\n\n # make an argument for entering heating shade multiplier\n skylight_heat_shade_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument('skylight_heat_shade_mult', true)\n skylight_heat_shade_mult.setDisplayName('Skylights: Heating Shade Multiplier')\n skylight_heat_shade_mult.setDescription('Interior shading multiplier for heating season. 1.0 indicates no reduction in solar gain, 0.85 indicates 15% reduction, etc.')\n skylight_heat_shade_mult.setDefaultValue(1.0)\n args << skylight_heat_shade_mult\n\n # make an argument for entering cooling shade multiplier\n skylight_cool_shade_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument('skylight_cool_shade_mult', true)\n skylight_cool_shade_mult.setDisplayName('Skylights: Cooling Shade Multiplier')\n skylight_cool_shade_mult.setDescription('Interior shading multiplier for cooling season. 1.0 indicates no reduction in solar gain, 0.85 indicates 15% reduction, etc.')\n skylight_cool_shade_mult.setDefaultValue(1.0)\n args << skylight_cool_shade_mult\n\n return args\n end", "title": "" }, { "docid": "fd372a9b79908764ca6d95c6f7c6de36", "score": "0.7149515", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make a double argument for infiltration of living space\n living_ach50 = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"living_ach50\", false)\n living_ach50.setDisplayName(\"Air Leakage: Above-Grade Living Space ACH50\")\n living_ach50.setUnits(\"1/hr\")\n living_ach50.setDescription(\"Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for above-grade living space (including finished attic).\")\n living_ach50.setDefaultValue(7)\n args << living_ach50\n\n #make a double argument for infiltration of garage\n garage_ach50 = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"garage_ach50\", false)\n garage_ach50.setDisplayName(\"Garage: ACH50\")\n garage_ach50.setUnits(\"1/hr\")\n garage_ach50.setDescription(\"Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the garage.\")\n garage_ach50.setDefaultValue(7)\n args << garage_ach50\n\n #make a double argument for infiltration of finished basement\n finished_basement_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"finished_basement_ach\", false)\n finished_basement_ach.setDisplayName(\"Finished Basement: Constant ACH\")\n finished_basement_ach.setUnits(\"1/hr\")\n finished_basement_ach.setDescription(\"Constant air exchange rate, in Air Changes per Hour (ACH), for the finished basement.\")\n finished_basement_ach.setDefaultValue(0.0)\n args << finished_basement_ach\n\t\n #make a double argument for infiltration of unfinished basement\n unfinished_basement_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"unfinished_basement_ach\", false)\n unfinished_basement_ach.setDisplayName(\"Unfinished Basement: Constant ACH\")\n unfinished_basement_ach.setUnits(\"1/hr\")\n unfinished_basement_ach.setDescription(\"Constant air exchange rate, in Air Changes per Hour (ACH), for the unfinished basement. A value of 0.10 ACH or greater is recommended for modeling Heat Pump Water Heaters in unfinished basements.\")\n unfinished_basement_ach.setDefaultValue(0.1)\n args << unfinished_basement_ach\n\t\n #make a double argument for infiltration of crawlspace\n crawl_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"crawl_ach\", false)\n crawl_ach.setDisplayName(\"Crawlspace: Constant ACH\")\n crawl_ach.setUnits(\"1/hr\")\n crawl_ach.setDescription(\"Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the crawlspace.\")\n crawl_ach.setDefaultValue(0.0)\n args << crawl_ach\n\n #make a double argument for infiltration of pier & beam\n pier_beam_ach = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"pier_beam_ach\", false)\n pier_beam_ach.setDisplayName(\"Pier & Beam: Constant ACH\")\n pier_beam_ach.setUnits(\"1/hr\")\n pier_beam_ach.setDescription(\"Air exchange rate, in Air Changes per Hour at 50 Pascals (ACH50), for the pier & beam foundation.\")\n pier_beam_ach.setDefaultValue(100.0)\n args << pier_beam_ach\n\n #make a double argument for infiltration of unfinished attic\n unfinished_attic_sla = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"unfinished_attic_sla\", false)\n unfinished_attic_sla.setDisplayName(\"Unfinished Attic: SLA\")\n unfinished_attic_sla.setDescription(\"Ratio of the effective leakage area (infiltration and/or ventilation) in the unfinished attic to the total floor area of the attic.\")\n unfinished_attic_sla.setDefaultValue(0.00333)\n args << unfinished_attic_sla\n\n #make a double argument for shelter coefficient\n shelter_coef = OpenStudio::Measure::OSArgument::makeStringArgument(\"shelter_coef\", false)\n shelter_coef.setDisplayName(\"Air Leakage: Shelter Coefficient\")\n shelter_coef.setDescription(\"The local shelter coefficient (AIM-2 infiltration model) accounts for nearby buildings, trees and obstructions.\")\n shelter_coef.setDefaultValue(\"auto\")\n args << shelter_coef\n \n #make a double argument for open hvac flue\n has_hvac_flue = OpenStudio::Measure::OSArgument::makeBoolArgument(\"has_hvac_flue\", false)\n has_hvac_flue.setDisplayName(\"Air Leakage: Has Open HVAC Flue\")\n has_hvac_flue.setDescription(\"Specifies whether the building has an open flue associated with the HVAC system.\")\n has_hvac_flue.setDefaultValue(false)\n args << has_hvac_flue \n\n #make a double argument for open water heater flue\n has_water_heater_flue = OpenStudio::Measure::OSArgument::makeBoolArgument(\"has_water_heater_flue\", false)\n has_water_heater_flue.setDisplayName(\"Air Leakage: Has Open Water Heater Flue\")\n has_water_heater_flue.setDescription(\"Specifies whether the building has an open flue associated with the water heater.\")\n has_water_heater_flue.setDefaultValue(false)\n args << has_water_heater_flue \n\n #make a double argument for open fireplace chimney\n has_fireplace_chimney = OpenStudio::Measure::OSArgument::makeBoolArgument(\"has_fireplace_chimney\", false)\n has_fireplace_chimney.setDisplayName(\"Air Leakage: Has Open HVAC Flue\")\n has_fireplace_chimney.setDescription(\"Specifies whether the building has an open chimney associated with a fireplace.\")\n has_fireplace_chimney.setDefaultValue(false)\n args << has_fireplace_chimney \n\n #make a choice arguments for terrain type\n terrain_types_names = OpenStudio::StringVector.new\n terrain_types_names << Constants.TerrainOcean\n terrain_types_names << Constants.TerrainPlains\n terrain_types_names << Constants.TerrainRural\n terrain_types_names << Constants.TerrainSuburban\n terrain_types_names << Constants.TerrainCity\n terrain = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"terrain\", terrain_types_names, true)\n terrain.setDisplayName(\"Air Leakage: Site Terrain\")\n terrain.setDescription(\"The terrain of the site.\")\n terrain.setDefaultValue(Constants.TerrainSuburban)\n args << terrain\n\n #make a choice argument for ventilation type\n ventilation_types_names = OpenStudio::StringVector.new\n ventilation_types_names << Constants.VentTypeNone\n ventilation_types_names << Constants.VentTypeExhaust\n ventilation_types_names << Constants.VentTypeSupply\n ventilation_types_names << Constants.VentTypeBalanced\n mech_vent_type = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"mech_vent_type\", ventilation_types_names, false)\n mech_vent_type.setDisplayName(\"Mechanical Ventilation: Ventilation Type\")\n mech_vent_type.setDescription(\"Whole house ventilation strategy used.\")\n mech_vent_type.setDefaultValue(Constants.VentTypeExhaust)\n args << mech_vent_type\n\n #make a double argument for total efficiency\n mech_vent_total_efficiency = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mech_vent_total_efficiency\",false)\n mech_vent_total_efficiency.setDisplayName(\"Mechanical Ventilation: Total Recovery Efficiency\")\n mech_vent_total_efficiency.setDescription(\"The net total energy (sensible plus latent, also called enthalpy) recovered by the supply airstream adjusted by electric consumption, case heat loss or heat gain, air leakage and airflow mass imbalance between the two airstreams, as a percent of the potential total energy that could be recovered plus the exhaust fan energy.\")\n mech_vent_total_efficiency.setDefaultValue(0)\n args << mech_vent_total_efficiency\n\n #make a double argument for sensible efficiency\n mech_vent_sensible_efficiency = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mech_vent_sensible_efficiency\",false)\n mech_vent_sensible_efficiency.setDisplayName(\"Mechanical Ventilation: Sensible Recovery Efficiency\")\n mech_vent_sensible_efficiency.setDescription(\"The net sensible energy recovered by the supply airstream as adjusted by electric consumption, case heat loss or heat gain, air leakage, airflow mass imbalance between the two airstreams and the energy used for defrost (when running the Very Low Temperature Test), as a percent of the potential sensible energy that could be recovered plus the exhaust fan energy.\")\n mech_vent_sensible_efficiency.setDefaultValue(0)\n args << mech_vent_sensible_efficiency\n\n #make a double argument for house fan power\n mech_vent_fan_power = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mech_vent_fan_power\",false)\n mech_vent_fan_power.setDisplayName(\"Mechanical Ventilation: Fan Power\")\n mech_vent_fan_power.setUnits(\"W/cfm\")\n mech_vent_fan_power.setDescription(\"Fan power (in W) per delivered airflow rate (in cfm) of fan(s) providing whole house ventilation. If the house uses a balanced ventilation system there is assumed to be two fans operating at this efficiency.\")\n mech_vent_fan_power.setDefaultValue(0.3)\n args << mech_vent_fan_power\n\n #make a double argument for fraction of ashrae\n mech_vent_frac_62_2 = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mech_vent_frac_62_2\",false)\n mech_vent_frac_62_2.setDisplayName(\"Mechanical Ventilation: Fraction of ASHRAE 62.2\")\n mech_vent_frac_62_2.setUnits(\"frac\")\n mech_vent_frac_62_2.setDescription(\"Fraction of the ventilation rate (including any infiltration credit) specified by ASHRAE 62.2 that is desired in the building.\")\n mech_vent_frac_62_2.setDefaultValue(1.0)\n args << mech_vent_frac_62_2\n\n #make a choice argument for ashrae standard\n standard_types_names = OpenStudio::StringVector.new\n standard_types_names << \"2010\"\n standard_types_names << \"2013\"\n\t\n #make a double argument for ashrae standard\n mech_vent_ashrae_std = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"mech_vent_ashrae_std\", standard_types_names, false)\n mech_vent_ashrae_std.setDisplayName(\"Mechanical Ventilation: ASHRAE 62.2 Standard\")\n mech_vent_ashrae_std.setDescription(\"Specifies which version (year) of the ASHRAE 62.2 Standard should be used.\")\n mech_vent_ashrae_std.setDefaultValue(\"2010\")\n args << mech_vent_ashrae_std\t\n\n #make a bool argument for infiltration credit\n mech_vent_infil_credit = OpenStudio::Measure::OSArgument::makeBoolArgument(\"mech_vent_infil_credit\",false)\n mech_vent_infil_credit.setDisplayName(\"Mechanical Ventilation: Allow Infiltration Credit\")\n mech_vent_infil_credit.setDescription(\"Defines whether the infiltration credit allowed per the ASHRAE 62.2 Standard will be included in the calculation of the mechanical ventilation rate. If True, the infiltration credit will apply 1) to new/existing single-family detached homes for 2013 ASHRAE 62.2, or 2) to existing single-family detached or multi-family homes for 2010 ASHRAE 62.2.\")\n mech_vent_infil_credit.setDefaultValue(true)\n args << mech_vent_infil_credit\n\n #make a boolean argument for if an existing home\n is_existing_home = OpenStudio::Measure::OSArgument::makeBoolArgument(\"is_existing_home\", true)\n is_existing_home.setDisplayName(\"Mechanical Ventilation: Is Existing Home\")\n is_existing_home.setDescription(\"Specifies whether the building is an existing home or new construction.\")\n is_existing_home.setDefaultValue(false)\n args << is_existing_home\n \n #make a double argument for dryer exhaust\n clothes_dryer_exhaust = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"clothes_dryer_exhaust\",false)\n clothes_dryer_exhaust.setDisplayName(\"Clothes Dryer: Exhaust\")\n clothes_dryer_exhaust.setUnits(\"cfm\")\n clothes_dryer_exhaust.setDescription(\"Rated flow capacity of the clothes dryer exhaust. This fan is assumed to run 60 min/day between 11am and 12pm.\")\n clothes_dryer_exhaust.setDefaultValue(100.0)\n args << clothes_dryer_exhaust\n\n #make a double argument for heating season setpoint offset\n nat_vent_htg_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_htg_offset\",false)\n nat_vent_htg_offset.setDisplayName(\"Natural Ventilation: Heating Season Setpoint Offset\")\n nat_vent_htg_offset.setUnits(\"degrees F\")\n nat_vent_htg_offset.setDescription(\"The temperature offset below the hourly cooling setpoint, to which the living space is allowed to cool during months that are only in the heating season.\")\n nat_vent_htg_offset.setDefaultValue(1.0)\n args << nat_vent_htg_offset\n\n #make a double argument for cooling season setpoint offset\n nat_vent_clg_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_clg_offset\",false)\n nat_vent_clg_offset.setDisplayName(\"Natural Ventilation: Cooling Season Setpoint Offset\")\n nat_vent_clg_offset.setUnits(\"degrees F\")\n nat_vent_clg_offset.setDescription(\"The temperature offset above the hourly heating setpoint, to which the living space is allowed to cool during months that are only in the cooling season.\")\n nat_vent_clg_offset.setDefaultValue(1.0)\n args << nat_vent_clg_offset\n\n #make a double argument for overlap season setpoint offset\n nat_vent_ovlp_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_ovlp_offset\",false)\n nat_vent_ovlp_offset.setDisplayName(\"Natural Ventilation: Overlap Season Setpoint Offset\")\n nat_vent_ovlp_offset.setUnits(\"degrees F\")\n nat_vent_ovlp_offset.setDescription(\"The temperature offset above the maximum heating setpoint, to which the living space is allowed to cool during months that are in both the heating season and cooling season.\")\n nat_vent_ovlp_offset.setDefaultValue(1.0)\n args << nat_vent_ovlp_offset\n\n #make a bool argument for heating season\n nat_vent_htg_season = OpenStudio::Measure::OSArgument::makeBoolArgument(\"nat_vent_htg_season\",false)\n nat_vent_htg_season.setDisplayName(\"Natural Ventilation: Heating Season\")\n nat_vent_htg_season.setDescription(\"True if windows are allowed to be opened during months that are only in the heating season.\")\n nat_vent_htg_season.setDefaultValue(true)\n args << nat_vent_htg_season\n\n #make a bool argument for cooling season\n nat_vent_clg_season = OpenStudio::Measure::OSArgument::makeBoolArgument(\"nat_vent_clg_season\",false)\n nat_vent_clg_season.setDisplayName(\"Natural Ventilation: Cooling Season\")\n nat_vent_clg_season.setDescription(\"True if windows are allowed to be opened during months that are only in the cooling season.\")\n nat_vent_clg_season.setDefaultValue(true)\n args << nat_vent_clg_season\n\n #make a bool argument for overlap season\n nat_vent_ovlp_season = OpenStudio::Measure::OSArgument::makeBoolArgument(\"nat_vent_ovlp_season\",false)\n nat_vent_ovlp_season.setDisplayName(\"Natural Ventilation: Overlap Season\")\n nat_vent_ovlp_season.setDescription(\"True if windows are allowed to be opened during months that are in both the heating season and cooling season.\")\n nat_vent_ovlp_season.setDefaultValue(true)\n args << nat_vent_ovlp_season\n\n #make a double argument for number weekdays\n nat_vent_num_weekdays = OpenStudio::Measure::OSArgument::makeIntegerArgument(\"nat_vent_num_weekdays\",false)\n nat_vent_num_weekdays.setDisplayName(\"Natural Ventilation: Number Weekdays\")\n nat_vent_num_weekdays.setDescription(\"Number of weekdays in the week that natural ventilation can occur.\")\n nat_vent_num_weekdays.setDefaultValue(3)\n args << nat_vent_num_weekdays\n\n #make a double argument for number weekend days\n nat_vent_num_weekends = OpenStudio::Measure::OSArgument::makeIntegerArgument(\"nat_vent_num_weekends\",false)\n nat_vent_num_weekends.setDisplayName(\"Natural Ventilation: Number Weekend Days\")\n nat_vent_num_weekends.setDescription(\"Number of weekend days in the week that natural ventilation can occur.\")\n nat_vent_num_weekends.setDefaultValue(0)\n args << nat_vent_num_weekends\n\n #make a double argument for fraction of windows open\n nat_vent_frac_windows_open = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_frac_windows_open\",false)\n nat_vent_frac_windows_open.setDisplayName(\"Natural Ventilation: Fraction of Openable Windows Open\")\n nat_vent_frac_windows_open.setUnits(\"frac\")\n nat_vent_frac_windows_open.setDescription(\"Specifies the fraction of the total openable window area in the building that is opened for ventilation.\")\n nat_vent_frac_windows_open.setDefaultValue(0.33)\n args << nat_vent_frac_windows_open\n\n #make a double argument for fraction of window area open\n nat_vent_frac_window_area_openable = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_frac_window_area_openable\",false)\n nat_vent_frac_window_area_openable.setDisplayName(\"Natural Ventilation: Fraction Window Area Openable\")\n nat_vent_frac_window_area_openable.setUnits(\"frac\")\n nat_vent_frac_window_area_openable.setDescription(\"Specifies the fraction of total window area in the home that can be opened (e.g. typical sliding windows can be opened to half of their area).\")\n nat_vent_frac_window_area_openable.setDefaultValue(0.2)\n args << nat_vent_frac_window_area_openable\n\n #make a double argument for humidity ratio\n nat_vent_max_oa_hr = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_max_oa_hr\",false)\n nat_vent_max_oa_hr.setDisplayName(\"Natural Ventilation: Max OA Humidity Ratio\")\n nat_vent_max_oa_hr.setUnits(\"frac\")\n nat_vent_max_oa_hr.setDescription(\"Outdoor air humidity ratio above which windows will not open for natural ventilation.\")\n nat_vent_max_oa_hr.setDefaultValue(0.0115)\n args << nat_vent_max_oa_hr\n\n #make a double argument for relative humidity ratio\n nat_vent_max_oa_rh = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"nat_vent_max_oa_rh\",false)\n nat_vent_max_oa_rh.setDisplayName(\"Natural Ventilation: Max OA Relative Humidity\")\n nat_vent_max_oa_rh.setUnits(\"frac\")\n nat_vent_max_oa_rh.setDescription(\"Outdoor air relative humidity (0-1) above which windows will not open for natural ventilation.\")\n nat_vent_max_oa_rh.setDefaultValue(0.7)\n args << nat_vent_max_oa_rh\n\t\n #make a choice arguments for duct location\n duct_locations = OpenStudio::StringVector.new\n duct_locations << \"none\"\n duct_locations << Constants.Auto\n duct_locations << Constants.LivingZone\n duct_locations << Constants.AtticZone\n duct_locations << Constants.FinishedAtticZone\n duct_locations << Constants.UnfinishedAtticZone\n duct_locations << Constants.BasementZone\n duct_locations << Constants.FinishedBasementZone\n duct_locations << Constants.UnfinishedBasementZone\n duct_locations << Constants.CrawlZone\n duct_locations << Constants.PierBeamZone\n duct_locations << Constants.GarageZone\n duct_location = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"duct_location\", duct_locations, true)\n duct_location.setDisplayName(\"Ducts: Location\")\n duct_location.setDescription(\"The space with the primary location of ducts.\")\n duct_location.setDefaultValue(Constants.Auto)\n args << duct_location\n \n #make a double argument for total leakage\n duct_total_leakage = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_total_leakage\", false)\n duct_total_leakage.setDisplayName(\"Ducts: Total Leakage\")\n duct_total_leakage.setUnits(\"frac\")\n duct_total_leakage.setDescription(\"The total amount of air flow leakage expressed as a fraction of the total air flow rate.\")\n duct_total_leakage.setDefaultValue(0.3)\n args << duct_total_leakage\n\n #make a double argument for supply leakage fraction of total\n duct_supply_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_supply_frac\", false)\n duct_supply_frac.setDisplayName(\"Ducts: Supply Leakage Fraction of Total\")\n duct_supply_frac.setUnits(\"frac\")\n duct_supply_frac.setDescription(\"The amount of air flow leakage leaking out from the supply duct expressed as a fraction of the total duct leakage.\")\n duct_supply_frac.setDefaultValue(0.6)\n args << duct_supply_frac\n\n #make a double argument for return leakage fraction of total\n duct_return_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_return_frac\", false)\n duct_return_frac.setDisplayName(\"Ducts: Return Leakage Fraction of Total\")\n duct_return_frac.setUnits(\"frac\")\n duct_return_frac.setDescription(\"The amount of air flow leakage leaking into the return duct expressed as a fraction of the total duct leakage.\")\n duct_return_frac.setDefaultValue(0.067)\n args << duct_return_frac \n\n #make a double argument for supply AH leakage fraction of total\n duct_ah_supply_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_ah_supply_frac\", false)\n duct_ah_supply_frac.setDisplayName(\"Ducts: Supply Air Handler Leakage Fraction of Total\")\n duct_ah_supply_frac.setUnits(\"frac\")\n duct_ah_supply_frac.setDescription(\"The amount of air flow leakage leaking out from the supply-side of the air handler expressed as a fraction of the total duct leakage.\")\n duct_ah_supply_frac.setDefaultValue(0.067)\n args << duct_ah_supply_frac \n\n #make a double argument for return AH leakage fraction of total\n duct_ah_return_frac = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_ah_return_frac\", false)\n duct_ah_return_frac.setDisplayName(\"Ducts: Return Air Handler Leakage Fraction of Total\")\n duct_ah_return_frac.setUnits(\"frac\")\n duct_ah_return_frac.setDescription(\"The amount of air flow leakage leaking out from the return-side of the air handler expressed as a fraction of the total duct leakage.\")\n duct_ah_return_frac.setDefaultValue(0.267)\n args << duct_ah_return_frac\n \n # #make a string argument for norm leakage to outside\n # duct_norm_leakage_25pa = OpenStudio::Measure::OSArgument::makeStringArgument(\"duct_norm_leakage_25pa\", false)\n # duct_norm_leakage_25pa.setDisplayName(\"Ducts: Leakage to Outside at 25Pa\")\n # duct_norm_leakage_25pa.setUnits(\"cfm/100 ft^2 Finished Floor\")\n # duct_norm_leakage_25pa.setDescription(\"Normalized leakage to the outside when tested at a pressure differential of 25 Pascals (0.1 inches w.g.) across the system.\")\n # duct_norm_leakage_25pa.setDefaultValue(\"NA\")\n # args << duct_norm_leakage_25pa\n \n #make a string argument for duct location frac \n duct_location_frac = OpenStudio::Measure::OSArgument::makeStringArgument(\"duct_location_frac\", true)\n duct_location_frac.setDisplayName(\"Ducts: Location Fraction\")\n duct_location_frac.setUnits(\"frac\")\n duct_location_frac.setDescription(\"Fraction of supply ducts in the space specified by Duct Location; the remainder of supply ducts will be located in above-grade conditioned space.\")\n duct_location_frac.setDefaultValue(Constants.Auto)\n args << duct_location_frac\n\n #make a string argument for duct num returns\n duct_num_returns = OpenStudio::Measure::OSArgument::makeStringArgument(\"duct_num_returns\", true)\n duct_num_returns.setDisplayName(\"Ducts: Number of Returns\")\n duct_num_returns.setUnits(\"#\")\n duct_num_returns.setDescription(\"The number of duct returns.\")\n duct_num_returns.setDefaultValue(Constants.Auto)\n args << duct_num_returns \n \n #make a double argument for supply surface area multiplier\n duct_supply_area_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_supply_area_mult\", true)\n duct_supply_area_mult.setDisplayName(\"Ducts: Supply Surface Area Multiplier\")\n duct_supply_area_mult.setUnits(\"mult\")\n duct_supply_area_mult.setDescription(\"Values specify a fraction of the Building America Benchmark supply duct surface area.\")\n duct_supply_area_mult.setDefaultValue(1.0)\n args << duct_supply_area_mult\n\n #make a double argument for return surface area multiplier\n duct_return_area_mult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_return_area_mult\", true)\n duct_return_area_mult.setDisplayName(\"Ducts: Return Surface Area Multiplier\")\n duct_return_area_mult.setUnits(\"mult\")\n duct_return_area_mult.setDescription(\"Values specify a fraction of the Building America Benchmark return duct surface area.\")\n duct_return_area_mult.setDefaultValue(1.0)\n args << duct_return_area_mult\n \n #make a double argument for duct unconditioned r value\n duct_unconditioned_r = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"duct_unconditioned_r\", true)\n duct_unconditioned_r.setDisplayName(\"Ducts: Insulation Nominal R-Value\")\n duct_unconditioned_r.setUnits(\"h-ft^2-R/Btu\")\n duct_unconditioned_r.setDescription(\"The nominal R-value for duct insulation.\")\n duct_unconditioned_r.setDefaultValue(0.0)\n args << duct_unconditioned_r\n \n # #make a string argument for distribution system efficiency\n # dist_system_eff = OpenStudio::Measure::OSArgument::makeStringArgument(\"dist_system_eff\", false)\n # dist_system_eff.setDisplayName(\"Ducts: Distribution System Efficiency\")\n # dist_system_eff.setDescription(\"A system efficiency factor, not included in manufacturer's equipment performance ratings for heating and cooling equipment, that adjusts for the energy losses associated with the delivery of energy from the equipment to the source of the load.\")\n # dist_system_eff.setDefaultValue(\"NA\")\n # args << dist_system_eff \n\n return args\n end", "title": "" }, { "docid": "52349a72f2aafccb7dde4f524aae8101", "score": "0.7149212", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a string argument for coverage\n coverage = OpenStudio::Measure::OSArgument::makeStringArgument(\"coverage\", true)\n coverage.setDisplayName(\"Coverage\")\n coverage.setUnits(\"frac\")\n coverage.setDescription(\"Fraction of house conditioned by fans where # fans = (above-grade finished floor area)/(% coverage)/300.\")\n coverage.setDefaultValue(\"NA\")\n args << coverage\n\n # make a string argument for specified number\n specified_num = OpenStudio::Measure::OSArgument::makeStringArgument(\"specified_num\", true)\n specified_num.setDisplayName(\"Specified Number\")\n specified_num.setUnits(\"#/unit\")\n specified_num.setDescription(\"Total number of fans.\")\n specified_num.setDefaultValue(\"1\")\n args << specified_num\n\n # make a double argument for power\n power = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"power\", true)\n power.setDisplayName(\"Power\")\n power.setUnits(\"W\")\n power.setDescription(\"Power consumption per fan assuming it runs at medium speed.\")\n power.setDefaultValue(45.0)\n args << power\n\n # make choice arguments for control\n control_names = OpenStudio::StringVector.new\n control_names << Constants.CeilingFanControlTypical\n control_names << Constants.CeilingFanControlSmart\n control = OpenStudio::Measure::OSArgument::makeChoiceArgument(\"control\", control_names, true)\n control.setDisplayName(\"Control\")\n control.setDescription(\"'typical' indicates half of the fans will be on whenever the interior temperature is above the cooling setpoint; 'smart' indicates 50% of the energy consumption of 'typical.'\")\n control.setDefaultValue(Constants.CeilingFanControlTypical)\n args << control\n\n # make a bool argument for using benchmark energy\n use_benchmark_energy = OpenStudio::Measure::OSArgument::makeBoolArgument(\"use_benchmark_energy\", true)\n use_benchmark_energy.setDisplayName(\"Use Benchmark Energy\")\n use_benchmark_energy.setDescription(\"Use the energy value specified in the BA Benchmark: 77.3 + 0.0403 x FFA kWh/yr, where FFA is Finished Floor Area.\")\n use_benchmark_energy.setDefaultValue(true)\n args << use_benchmark_energy\n\n # make a double argument for BA Benchamrk multiplier\n mult = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"mult\")\n mult.setDisplayName(\"Building America Benchmark Multiplier\")\n mult.setDefaultValue(1)\n mult.setDescription(\"A multiplier on the national average energy use. Only applies if 'Use Benchmark Energy' is set to True.\")\n args << mult\n\n # make a double argument for cooling setpoint offset\n cooling_setpoint_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument(\"cooling_setpoint_offset\", true)\n cooling_setpoint_offset.setDisplayName(\"Cooling Setpoint Offset\")\n cooling_setpoint_offset.setUnits(\"degrees F\")\n cooling_setpoint_offset.setDescription(\"Increase in cooling set point due to fan usage.\")\n cooling_setpoint_offset.setDefaultValue(0)\n args << cooling_setpoint_offset\n\n return args\n end", "title": "" }, { "docid": "ae5219fbad4e64907b665c32f447f5e9", "score": "0.7148428", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # Make arrays of space type names and handles\n space_type_handles = OpenStudio::StringVector.new\n space_type_display_names = OpenStudio::StringVector.new\n model.getSpaceTypes.each do |space_type|\n # Only include if space type is used in the model\n if space_type.spaces.size > 0\n space_type_handles << space_type.handle.to_s\n space_type_display_names << space_type.name.to_s\n end\n end\n \n # Make a choice argument for space type or entire building\n space_type_object = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"space_type_object\", space_type_handles, space_type_display_names,true)\n space_type_object.setDisplayName(\"Apply the Measure to a Specific Space Type\")\n args << space_type_object\n\t\n # Make arrays of schedule names and handles\n schedule_handles = OpenStudio::StringVector.new\n schedule_display_names = OpenStudio::StringVector.new \n model.getSchedules.each do |schedule|\n schedule_handles << schedule.handle.to_s\n schedule_display_names << schedule.name.to_s\n end\n \n # Make a choice argument for lighting schedule\n schedule_object = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"schedule_object\", schedule_handles, schedule_display_names,true)\n schedule_object.setDisplayName(\"Replace the lighting schedule in the space type with the following schedule\")\n args << schedule_object\n\n # Make an argument for material and installation cost\n cost_increase = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"cost_increase\",true)\n cost_increase.setDisplayName(\"Increase in Material and Installation Costs ($).\")\n cost_increase.setDefaultValue(0.0)\n args << cost_increase\n \n \n return args\n end", "title": "" }, { "docid": "a9fb6d1a2cf5dbb8ec9fe53a8e957481", "score": "0.71442705", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make a double argument for shw collector area\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('collector_area', true)\n arg.setDisplayName('Collector Area')\n arg.setUnits('ft^2/unit')\n arg.setDescription('Area of the collector array for each unit of the building.')\n arg.setDefaultValue(40.0)\n args << arg\n\n # make a double argument for shw FRta\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('frta', true)\n arg.setDisplayName('FRta')\n arg.setDescription('Optical gain coefficient in Hottel-Willier-Bliss (HWB) equation.')\n arg.setDefaultValue(0.77)\n args << arg\n\n # make a double argument for shw FRUL\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('frul', true)\n arg.setDisplayName('FRUL')\n arg.setUnits('Btu/hr-ft^2-R')\n arg.setDescription('Thermal loss coefficient in the Hottel-Willier-Bliss (HWB) equation.')\n arg.setDefaultValue(0.793)\n args << arg\n\n # make a double argument for shw IAM\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('iam', true)\n arg.setDisplayName('IAM')\n arg.setDescription('The incident angle modifier coefficient.')\n arg.setDefaultValue(0.1)\n args << arg\n\n # make a string argument for shw tank storage volume\n arg = OpenStudio::Measure::OSArgument::makeStringArgument('storage_vol', true)\n arg.setDisplayName('Tank Storage Volume')\n arg.setUnits('gal')\n arg.setDescription(\"The volume of the solar storage tank. If set to 'auto', the tank storage volume will be 1.5 gal for every sqft of collector area.\")\n arg.setDefaultValue(Constants.Auto)\n args << arg\n\n # make a double argument for shw tank r-value\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('tank_r', true)\n arg.setDisplayName('Tank R-Value')\n arg.setUnits('hr-ft^2-R/Btu')\n arg.setDescription('The insulation level of the solar storage tank.')\n arg.setDefaultValue(10.0)\n args << arg\n\n # make a choice argument for shw fluid type\n fluid_display_names = OpenStudio::StringVector.new\n fluid_display_names << Constants.FluidPropyleneGlycol\n fluid_display_names << Constants.FluidWater\n arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('fluid_type', fluid_display_names, true)\n arg.setDisplayName('Fluid Type')\n arg.setDescription(\"The solar system's heat transfer fluid.\")\n arg.setDefaultValue(Constants.FluidPropyleneGlycol)\n args << arg\n\n # make a double argument for shw heat exchanger effectiveness\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('heat_ex_eff', true)\n arg.setDisplayName('Heat Exchanger Effectiveness')\n arg.setDescription('Heat exchanger effectiveness, where the effectiveness e, is defined as e = (Tcold-out - Tcold-in) / (Thot-in - Tcold-in).')\n arg.setDefaultValue(0.7)\n args << arg\n\n # make a double argument for shw pump power\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('pump_power', true)\n arg.setDisplayName('Pump Power')\n arg.setUnits('W/ft^2')\n arg.setDescription('Total pump energy consumption in Watts per sqft of collector area.')\n arg.setDefaultValue(0.8)\n args << arg\n\n # make a choice arguments for azimuth type\n azimuth_types_names = OpenStudio::StringVector.new\n azimuth_types_names << Constants.CoordRelative\n azimuth_types_names << Constants.CoordAbsolute\n arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('azimuth_type', azimuth_types_names, true)\n arg.setDisplayName('Azimuth Type')\n arg.setDescription('Relative azimuth angle is measured clockwise from the front of the house. Absolute azimuth angle is measured clockwise from due south.')\n arg.setDefaultValue(Constants.CoordRelative)\n args << arg\n\n # make a double argument for azimuth\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('azimuth', true)\n arg.setDisplayName('Azimuth')\n arg.setUnits('degrees')\n arg.setDescription('The azimuth angle is measured clockwise.')\n arg.setDefaultValue(180.0)\n args << arg\n\n # make a choice arguments for tilt type\n tilt_types_names = OpenStudio::StringVector.new\n tilt_types_names << Constants.TiltPitch\n tilt_types_names << Constants.CoordAbsolute\n tilt_types_names << Constants.TiltLatitude\n arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('tilt_type', tilt_types_names, true)\n arg.setDisplayName('Tilt Type')\n arg.setDescription('Type of tilt angle referenced.')\n arg.setDefaultValue(Constants.TiltPitch)\n args << arg\n\n # make a double argument for tilt\n arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('tilt', true)\n arg.setDisplayName('Tilt')\n arg.setUnits('degrees')\n arg.setDescription('Angle of the tilt.')\n arg.setDefaultValue(0)\n args << arg\n\n return args\n end", "title": "" }, { "docid": "f0752b84d366f611a4a14ea0dc6484c5", "score": "0.7142395", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # Make an argument for the building type\n building_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('building_type', get_deer_building_types, true)\n building_type.setDisplayName('Building Type.')\n building_type.setDefaultValue('SmallOffice')\n args << building_type\n\n # Make an argument for the template\n template = OpenStudio::Measure::OSArgument.makeChoiceArgument('template', get_deer_templates, true)\n template.setDisplayName('Template.')\n template.setDefaultValue('90.1-2010')\n args << template\n\n # Make an argument for the climate zone\n climate_zone = OpenStudio::Measure::OSArgument.makeChoiceArgument('climate_zone', get_deer_climate_zones, true)\n climate_zone.setDisplayName('Climate Zone.')\n climate_zone.setDefaultValue('ASHRAE 169-2013-2A')\n args << climate_zone\n\n # make an argument to add new space types\n create_space_types = OpenStudio::Measure::OSArgument.makeBoolArgument('create_space_types', true)\n create_space_types.setDisplayName('Create Space Types?')\n create_space_types.setDefaultValue(true)\n args << create_space_types\n\n # make an argument to add new construction set\n create_construction_set = OpenStudio::Measure::OSArgument.makeBoolArgument('create_construction_set', true)\n create_construction_set.setDisplayName('Create Construction Set?')\n create_construction_set.setDefaultValue(true)\n args << create_construction_set\n\n # make an argument to determine if building defaults should be set\n set_building_defaults = OpenStudio::Measure::OSArgument.makeBoolArgument('set_building_defaults', true)\n set_building_defaults.setDisplayName('Set Building Defaults Using New Objects?')\n set_building_defaults.setDefaultValue(true)\n args << set_building_defaults\n\n return args\n end", "title": "" }, { "docid": "b733660951a57e57c2cbc2f301001fca", "score": "0.7137707", "text": "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # Path argument\r\n file_path = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"file_path\", true)\r\n file_path.setDisplayName(\"Enter the path to the file\")\r\n file_path.setDescription(\"Example: 'C:\\\\Projects\\\\output_variables.csv'\")\r\n args << file_path\r\n\r\n return args\r\n end", "title": "" }, { "docid": "a7acf8d163d02f53f426dc0b80608ac8", "score": "0.7136393", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n cooling_tower_type = OpenStudio::StringVector.new\n cooling_tower_type << \"SingleSpeed\"\n\tcooling_tower_type << \"TwoSpeed\"\n cooling_tower_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('cooling_tower_type', cooling_tower_type, true)\n cooling_tower_type.setDisplayName(\"Choose cooling tower type.\")\n cooling_tower_type.setDefaultValue(\"SingleSpeed\")\n args << cooling_tower_type\n return args\n end", "title": "" }, { "docid": "33cc230f7b6a2dad0c4573741e2da37e", "score": "0.7135453", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for total living space floor area\n total_ffa = OpenStudio::Measure::OSArgument::makeDoubleArgument('total_ffa', true)\n total_ffa.setDisplayName('Total Finished Floor Area')\n total_ffa.setUnits('ft^2')\n total_ffa.setDescription('The total floor area of the finished space (including any finished basement floor area).')\n total_ffa.setDefaultValue(2000.0)\n args << total_ffa\n\n # make an argument for living space height\n wall_height = OpenStudio::Measure::OSArgument::makeDoubleArgument('wall_height', true)\n wall_height.setDisplayName('Wall Height (Per Floor)')\n wall_height.setUnits('ft')\n wall_height.setDescription('The height of the living space (and garage) walls.')\n wall_height.setDefaultValue(8.0)\n args << wall_height\n\n # make an argument for number of floors\n num_floors = OpenStudio::Measure::OSArgument::makeIntegerArgument('num_floors', true)\n num_floors.setDisplayName('Number of Floors')\n num_floors.setUnits('#')\n num_floors.setDescription('The number of floors above grade. Finished attics are included.')\n num_floors.setDefaultValue(2)\n args << num_floors\n\n # make an argument for aspect ratio\n aspect_ratio = OpenStudio::Measure::OSArgument::makeDoubleArgument('aspect_ratio', true)\n aspect_ratio.setDisplayName('Aspect Ratio')\n aspect_ratio.setUnits('FB/LR')\n aspect_ratio.setDescription('The ratio of the front/back wall length to the left/right wall length, excluding any protruding garage wall area.')\n aspect_ratio.setDefaultValue(2.0)\n args << aspect_ratio\n\n # make a double argument for garage area\n garage_width = OpenStudio::Measure::OSArgument::makeDoubleArgument('garage_width', true)\n garage_width.setDisplayName('Garage Width')\n garage_width.setUnits('ft')\n garage_width.setDescription('The width of the garage.')\n garage_width.setDefaultValue(0.0)\n args << garage_width\n\n # make a double argument for garage height\n garage_depth = OpenStudio::Measure::OSArgument::makeDoubleArgument('garage_depth', true)\n garage_depth.setDisplayName('Garage Depth')\n garage_depth.setUnits('ft')\n garage_depth.setDescription('The depth of the garage.')\n garage_depth.setDefaultValue(20.0)\n args << garage_depth\n\n # make a double argument for garage protrusion\n garage_protrusion = OpenStudio::Measure::OSArgument::makeDoubleArgument('garage_protrusion', true)\n garage_protrusion.setDisplayName('Garage Protrusion')\n garage_protrusion.setUnits('frac')\n garage_protrusion.setDescription('The fraction of the garage that is protruding from the living space.')\n garage_protrusion.setDefaultValue(0.0)\n args << garage_protrusion\n\n # make a choice argument for model objects\n garage_position_display_names = OpenStudio::StringVector.new\n garage_position_display_names << 'Right'\n garage_position_display_names << 'Left'\n\n # make a choice argument for garage position\n garage_position = OpenStudio::Measure::OSArgument::makeChoiceArgument('garage_position', garage_position_display_names, true)\n garage_position.setDisplayName('Garage Position')\n garage_position.setDescription('The position of the garage.')\n garage_position.setDefaultValue('Right')\n args << garage_position\n\n # make a choice argument for model objects\n foundation_display_names = OpenStudio::StringVector.new\n foundation_display_names << 'slab'\n foundation_display_names << 'crawlspace'\n foundation_display_names << 'unfinished basement'\n foundation_display_names << 'finished basement'\n foundation_display_names << 'pier and beam'\n\n # make a choice argument for foundation type\n foundation_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('foundation_type', foundation_display_names, true)\n foundation_type.setDisplayName('Foundation Type')\n foundation_type.setDescription('The foundation type of the building.')\n foundation_type.setDefaultValue('slab')\n args << foundation_type\n\n # make an argument for crawlspace height\n foundation_height = OpenStudio::Measure::OSArgument::makeDoubleArgument('foundation_height', true)\n foundation_height.setDisplayName('Foundation Height')\n foundation_height.setUnits('ft')\n foundation_height.setDescription('The height of the foundation (e.g., 3ft for crawlspace, 8ft for basement).')\n foundation_height.setDefaultValue(3.0)\n args << foundation_height\n\n # make a choice argument for model objects\n attic_type_display_names = OpenStudio::StringVector.new\n attic_type_display_names << 'unfinished attic'\n attic_type_display_names << 'finished attic'\n\n # make a choice argument for attic type\n attic_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('attic_type', attic_type_display_names, true)\n attic_type.setDisplayName('Attic Type')\n attic_type.setDescription('The attic type of the building. Ignored if the building has a flat roof.')\n attic_type.setDefaultValue('unfinished attic')\n args << attic_type\n\n # make a choice argument for model objects\n roof_type_display_names = OpenStudio::StringVector.new\n roof_type_display_names << Constants.RoofTypeGable\n roof_type_display_names << Constants.RoofTypeHip\n roof_type_display_names << Constants.RoofTypeFlat\n\n # make a choice argument for roof type\n roof_type = OpenStudio::Measure::OSArgument::makeChoiceArgument('roof_type', roof_type_display_names, true)\n roof_type.setDisplayName('Roof Type')\n roof_type.setDescription('The roof type of the building.')\n roof_type.setDefaultValue(Constants.RoofTypeGable)\n args << roof_type\n\n # make a choice argument for model objects\n roof_pitch_display_names = OpenStudio::StringVector.new\n roof_pitch_display_names << '1:12'\n roof_pitch_display_names << '2:12'\n roof_pitch_display_names << '3:12'\n roof_pitch_display_names << '4:12'\n roof_pitch_display_names << '5:12'\n roof_pitch_display_names << '6:12'\n roof_pitch_display_names << '7:12'\n roof_pitch_display_names << '8:12'\n roof_pitch_display_names << '9:12'\n roof_pitch_display_names << '10:12'\n roof_pitch_display_names << '11:12'\n roof_pitch_display_names << '12:12'\n\n # make a choice argument for roof pitch\n roof_pitch = OpenStudio::Measure::OSArgument::makeChoiceArgument('roof_pitch', roof_pitch_display_names, true)\n roof_pitch.setDisplayName('Roof Pitch')\n roof_pitch.setDescription('The roof pitch of the attic. Ignored if the building has a flat roof.')\n roof_pitch.setDefaultValue('6:12')\n args << roof_pitch\n\n # make a choice argument for model objects\n roof_structure_display_names = OpenStudio::StringVector.new\n roof_structure_display_names << Constants.RoofStructureTrussCantilever\n roof_structure_display_names << Constants.RoofStructureRafter\n\n # make a choice argument for roof type\n roof_structure = OpenStudio::Measure::OSArgument::makeChoiceArgument('roof_structure', roof_structure_display_names, true)\n roof_structure.setDisplayName('Roof Structure')\n roof_structure.setDescription('The roof structure of the building.')\n roof_structure.setDefaultValue(Constants.RoofStructureTrussCantilever)\n args << roof_structure\n\n # make a choice argument for eaves depth\n eaves_depth = OpenStudio::Measure::OSArgument::makeDoubleArgument('eaves_depth', true)\n eaves_depth.setDisplayName('Eaves Depth')\n eaves_depth.setUnits('ft')\n eaves_depth.setDescription('The eaves depth of the roof.')\n eaves_depth.setDefaultValue(2.0)\n args << eaves_depth\n\n # make a string argument for number of bedrooms\n num_br = OpenStudio::Measure::OSArgument::makeStringArgument('num_bedrooms', true)\n num_br.setDisplayName('Number of Bedrooms')\n num_br.setDescription('Specify the number of bedrooms. Used to determine the energy usage of appliances and plug loads, hot water usage, mechanical ventilation rate, etc.')\n num_br.setDefaultValue('3')\n args << num_br\n\n # make a string argument for number of bathrooms\n num_ba = OpenStudio::Measure::OSArgument::makeStringArgument('num_bathrooms', true)\n num_ba.setDisplayName('Number of Bathrooms')\n num_ba.setDescription('Specify the number of bathrooms. Used to determine the hot water usage, etc.')\n num_ba.setDefaultValue('2')\n args << num_ba\n\n # make a double argument for left neighbor offset\n neighbor_left_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument('neighbor_left_offset', true)\n neighbor_left_offset.setDisplayName('Neighbor Left Offset')\n neighbor_left_offset.setUnits('ft')\n neighbor_left_offset.setDescription('The minimum distance between the simulated house and the neighboring house to the left (not including eaves). A value of zero indicates no neighbors.')\n neighbor_left_offset.setDefaultValue(10.0)\n args << neighbor_left_offset\n\n # make a double argument for right neighbor offset\n neighbor_right_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument('neighbor_right_offset', true)\n neighbor_right_offset.setDisplayName('Neighbor Right Offset')\n neighbor_right_offset.setUnits('ft')\n neighbor_right_offset.setDescription('The minimum distance between the simulated house and the neighboring house to the right (not including eaves). A value of zero indicates no neighbors.')\n neighbor_right_offset.setDefaultValue(10.0)\n args << neighbor_right_offset\n\n # make a double argument for back neighbor offset\n neighbor_back_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument('neighbor_back_offset', true)\n neighbor_back_offset.setDisplayName('Neighbor Back Offset')\n neighbor_back_offset.setUnits('ft')\n neighbor_back_offset.setDescription('The minimum distance between the simulated house and the neighboring house to the back (not including eaves). A value of zero indicates no neighbors.')\n neighbor_back_offset.setDefaultValue(0.0)\n args << neighbor_back_offset\n\n # make a double argument for front neighbor offset\n neighbor_front_offset = OpenStudio::Measure::OSArgument::makeDoubleArgument('neighbor_front_offset', true)\n neighbor_front_offset.setDisplayName('Neighbor Front Offset')\n neighbor_front_offset.setUnits('ft')\n neighbor_front_offset.setDescription('The minimum distance between the simulated house and the neighboring house to the front (not including eaves). A value of zero indicates no neighbors.')\n neighbor_front_offset.setDefaultValue(0.0)\n args << neighbor_front_offset\n\n # make a double argument for orientation\n orientation = OpenStudio::Measure::OSArgument::makeDoubleArgument('orientation', true)\n orientation.setDisplayName('Azimuth')\n orientation.setUnits('degrees')\n orientation.setDescription(\"The house's azimuth is measured clockwise from due south when viewed from above (e.g., South=0, West=90, North=180, East=270).\")\n orientation.setDefaultValue(180.0)\n args << orientation\n\n return args\n end", "title": "" }, { "docid": "894624caa1a21637338e9d6e651dd956", "score": "0.71299785", "text": "def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #Fraction Radiant of Lights\r\n\tlightFract = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"lightsFractRad\",false)\r\n\tlightFract.setDisplayName(\"Lights Fraction Radiant\")\r\n\tlightFract.setDefaultValue(0.0)\r\n\targs << lightFract\r\n\t\r\n\t#Fraction Radiant of Equipment\r\n\tequipFract = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"equipFractRad\",false)\r\n\tequipFract.setDisplayName(\"Equipment Fraction Radiant\")\r\n\tequipFract.setDefaultValue(0.0)\r\n\targs << equipFract\r\n\t\r\n\t#Fraction Radiant of People\r\n\tpeopleFract = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(\"peopleFractRad\",false)\r\n\tpeopleFract.setDisplayName(\"People Fraction Radiant\")\r\n\tpeopleFract.setDefaultValue(0.0)\r\n\targs << peopleFract\r\n\r\n return args\r\n end", "title": "" } ]
4ee2174c6d0642c80b7d070beedbff03
All ObjectCodeObject attributes are obtained and returned
[ { "docid": "2c7c73434fd2d2557110c7a414237085", "score": "0.0", "text": "def get_random_object_code_object(object_sub_type_code='')\n get_kuali_business_object('KFS-COA', 'ObjectCode', \"universityFiscalYear=#{get_aft_parameter_value(ParameterConstants::CURRENT_FISCAL_YEAR)}&chartOfAccountsCode=#{get_aft_parameter_value(ParameterConstants::DEFAULT_CHART_CODE)}&financialObjectSubTypeCode=#{object_sub_type_code}&active=Y\")\n end", "title": "" } ]
[ { "docid": "f6b7256ff19b979aafb9b47f2a3d7aee", "score": "0.6530292", "text": "def available_selectable_object_attribute(business_object_code=nil)\n object_attributes =[]\n if business_object_code\n object_attributes = Irm::ObjectAttribute.selectable_column.query_by_status_code(\"ENABLED\").multilingual.query_by_business_object_code(business_object_code)\n end\n object_attributes.collect{|i|[i.attribute_name,i.attribute_name,{:attribute_name=>i.attribute_name}]}\n end", "title": "" }, { "docid": "2c3943f00fd23f011309dcf074840c5c", "score": "0.65299493", "text": "def object_attributes(object_id, object_type)\n\t\t\t\treturn AttributeValue.eager_load(:label_attribute).where(object_id: object_id, object_type: object_type)\n\t\t\tend", "title": "" }, { "docid": "90b2703ce9ccb96f3826f6494b8a6922", "score": "0.6271742", "text": "def attributes()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "90b2703ce9ccb96f3826f6494b8a6922", "score": "0.6271742", "text": "def attributes()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "64c85fa2d007ebab817ada793c6c1c95", "score": "0.6265775", "text": "def inspect_object_attributs(object_to_inspect)\n puts \"- Instance attributs :\"\n object_to_inspect.instance_variables.each do |attribute|\n value = object_to_inspect.instance_eval attribute.to_s\n puts \"\\t- Name : #{attribute}\"\n puts \"\\t\\t- Type : #{value.class}\"\n puts \"\\t\\t- Value : #{value.inspect}\"\n end\n puts \"#{Util::get_line_separator}\"\n end", "title": "" }, { "docid": "fb8bb5731207bc60b8f2a998cfc312ba", "score": "0.6252775", "text": "def attributes\n return @attributes if @attributes\n\n @attributes = {}\n @win32ole_object.properties_.each do |prop|\n name = prop.name\n name = 'IpAddress' if name == 'IPAddress'\n value = @win32ole_object.send(name)\n value = if prop.cimtype == 101 && value\n Time.parse_swbem_date_time(value)\n else\n value\n end\n @attributes[underscore(name)] = value\n end\n @attributes\n end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.6170038", "text": "def attributes; end", "title": "" } ]
d32cbf8cc1ce214e848abe68fd0efde7
returns the intersection with another object
[ { "docid": "16b9de22d5c13eb83b2bcba3826b5abe", "score": "0.67951757", "text": "def intersect obj\n obj.intersectVerticalLine(self)\n end", "title": "" } ]
[ { "docid": "35d848cf018ac511e2632bea10c0265d", "score": "0.8296638", "text": "def __intersect__(object); object; end", "title": "" }, { "docid": "adaebc3ac9dd7f54e0745d7921209104", "score": "0.8240694", "text": "def __intersect__(object)\n object.__intersect_from_object__(self)\n end", "title": "" }, { "docid": "cf84d5ab9580d6d79dfde9c89ca6fb46", "score": "0.8152397", "text": "def intersect(other)\n end", "title": "" }, { "docid": "57a884f852f248ef1b07631a4a35f35b", "score": "0.80447257", "text": "def intersection(another) \n self & another \n end", "title": "" }, { "docid": "9a9fd97d83a83ba04ddf162199b1b1d5", "score": "0.80216044", "text": "def &(other) intersection(other) end", "title": "" }, { "docid": "eb3baf34ee6adce2a8c3d70183862313", "score": "0.78944147", "text": "def __intersect_from_object__(object)\n Array(object) & Array(self)\n end", "title": "" }, { "docid": "d0fde3b3b8f09d4922953509a090eb41", "score": "0.77601284", "text": "def intersect obj\n obj.intersectPoint self \n end", "title": "" }, { "docid": "7805734402b3d02f76bcd568e11a77a0", "score": "0.77457976", "text": "def intersect\n use(:__intersect__)\n end", "title": "" }, { "docid": "1c34fd714e1eb4816104cab07f53acdb", "score": "0.7708153", "text": "def intersect\n use(:__intersect__)\n end", "title": "" }, { "docid": "92beef99886995805c97b770d79beda4", "score": "0.7656218", "text": "def intersect(instance)\n end", "title": "" }, { "docid": "a60325705ed59b53c43456427d60bb6c", "score": "0.7644795", "text": "def intersect(other)\n new(to_ary & other)\n end", "title": "" }, { "docid": "4390aeccb315f07e9869f24a8ca2a635", "score": "0.7536878", "text": "def intersect obj\n obj.intersectLine(self)\n end", "title": "" }, { "docid": "cd84bcc4cd141aebe46c1010e168df67", "score": "0.7524233", "text": "def intersection(other)\n Rangops::Set.intersection(self, other)\n end", "title": "" }, { "docid": "8195074d851efae0c0a072ac2cc22841", "score": "0.7473871", "text": "def intersection other\n postgis_calculate(:intersection, [self, other])\n end", "title": "" }, { "docid": "e42a84c8ad0349fd29cda9c56e184613", "score": "0.7441648", "text": "def intersection(target_object)\r\n\t\t#make a clone of the smaller set\r\n\t\tif self.set.length > target_object.set.length\r\n\t\t\tset1 = target_object.set.clone()\r\n\t\t\tset2 = self.set.clone()\r\n\t\telse\r\n\t\t\tset1 = self.set.clone()\r\n\t\t\tset2 = target_object.set.clone()\r\n\t\tend\r\n\t\tintersected_set = {} #create an empty hash that will be used to store all common subscribers between the two sets\r\n\r\n\t\t#find the common ID numbers\r\n\t\tset1.each do |id, subscriber| #iterate through the smaller set\r\n\t\t\tif (set2.key?(id)) #if the key of the first is also present in the second, then add that key+value to a third set\r\n\t\t\t\tintersected_set[id] = subscriber\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\toutput_set = Set.new(intersected_set) #create the resultant set\r\n\r\n\t\treturn output_set #return the resultant set\r\n\tend", "title": "" }, { "docid": "4c2d4a3bd3830a404a71ab415f3b2292", "score": "0.73541045", "text": "def intersection(other)\n case other\n when Range\n intersection_range(other)\n when IntervalSet\n intersection_interval_set(other)\n else\n IntervalSet.unexpected_object(other)\n end\n end", "title": "" }, { "docid": "58e821800e55a3b5bba9798d3d72de96", "score": "0.7308565", "text": "def intersect(*args)\n new(:intersect, *args)\n end", "title": "" }, { "docid": "501c7124a1522d2ebe08083e1971839d", "score": "0.7300632", "text": "def intersect(other)\n binary_operation(__method__, other, Algebra::Intersection)\n end", "title": "" }, { "docid": "88a41d6c9e20554f1d821fd99e3d9211", "score": "0.72256684", "text": "def intersection(*args)\n ary = self\n args.each do |x|\n ary = ary & x\n end\n ary\n end", "title": "" }, { "docid": "7f0bcf2f494599377cdc6b69914afc01", "score": "0.7187542", "text": "def intersection(other)\n Operation.new(:and, dup, other.dup).minimize\n end", "title": "" }, { "docid": "bfcb43109f418bfc6376395284f1ed45", "score": "0.71772873", "text": "def intersection(other)\n if other.size < @trie.size\n if other.is_a?(Immutable::Set)\n trie = other.instance_variable_get(:@trie).select { |key, _| include?(key) }\n else\n trie = Trie.new(0)\n other.each { |obj| trie.put!(obj, nil) if include?(obj) }\n end\n else\n trie = @trie.select { |key, _| other.include?(key) }\n end\n new_trie(trie)\n end", "title": "" }, { "docid": "e071e1260e151b269affc2dcf2ecbb45", "score": "0.7165717", "text": "def intersect\n inject([]){|inj,x| inj & x.to_a }\n end", "title": "" }, { "docid": "0016c4958c25769363b19ad8b9164417", "score": "0.7116901", "text": "def intersection(b)\n\t\tx_intersection(b) * y_intersection(b)\n\tend", "title": "" }, { "docid": "1ffd79b0040b5024ac8985b322e22806", "score": "0.7102642", "text": "def intersect other\n other.send(\"intersect#{@dispatch}\", self) \n end", "title": "" }, { "docid": "b6d7bb5bf19c68c968d7805f6272edf7", "score": "0.7102459", "text": "def intersect?(other); end", "title": "" }, { "docid": "b6d7bb5bf19c68c968d7805f6272edf7", "score": "0.7102459", "text": "def intersect?(other); end", "title": "" }, { "docid": "b4e4903ad75aa58c166acfa5d14bb962", "score": "0.70377105", "text": "def intersection(other)\n self.class.alloc(@node.keep_only(other))\n end", "title": "" }, { "docid": "73aff1fc4d97d867ec555aaa7e1ff5cc", "score": "0.7017257", "text": "def intersect(x,y)\n x & y\n end", "title": "" }, { "docid": "5d09ead5dab373747b09ca1f6d8436a6", "score": "0.7008271", "text": "def intersect(other)\n case other\n when Range\n intersect_range(other)\n when IntervalSet\n intersect_interval_set(other)\n else\n IntervalSet.unexpected_object(other)\n end\n end", "title": "" }, { "docid": "5db6838511df8d8facd07b227e0fa368", "score": "0.70045704", "text": "def intersect(other_bounding_box)\n end", "title": "" }, { "docid": "89125b3717a4bd37ad2967b90bb623a2", "score": "0.69885904", "text": "def intersect other\n other.intersectLineSegment(self)\n end", "title": "" }, { "docid": "84b9ee843e63feb6d9c3a5a5de20b842", "score": "0.69741607", "text": "def intersection(list1, list2)\n intersect = Hash[*list1.collect{ |a| [a, 0] }.flatten] # hash first list\n i_array = [] # return object\n\n list2.each do |b|\n if intersect.has_key?(b)\n i_array << b # shovel if found\n end\n end\n\n return i_array\nend", "title": "" }, { "docid": "1930c5c519a5028dff2941be95e416b7", "score": "0.696581", "text": "def intersection(keys)\n intersection_recursive(self, keys)\n end", "title": "" }, { "docid": "97cad006b47668cb8f9f8ee04cc23c40", "score": "0.69300145", "text": "def intersection(s,p=nil,o=nil,r=nil) \n tmp = @result\n if s.instance_of? SemanticExpression \n tmp = s.result \n #Intersection, Intersection and Difference are operation over sets.\n elsif s.instance_of? Array \n tmp = s \n #Intersection, Intersection and Difference are operation over sets. \n elsif Thread.current[:application].is_set?(s)\n #returns all set of resources\n if r != nil && r!= :s\n tmp = SemanticExpression.new.spo(Thread.current[:application].get(s).elements.collect{|s,p,o| eval(r.to_s)}.uniq,:p,:o).result\n else\n tmp = Thread.current[:application].get(s).elements\n end\n #Intersection method, passed as parameter a triple expression\n else\n tmp = query(s,p,o,r)\n end\n #@result = @result & tmp - The intersection is between the subjects and it is not between triples.\n \n a = tmp.collect{|s,p,o| s}\n \n @result = @result.collect { |s,p,o| [s,p,o] if a.include?(s) } \n \n self\n end", "title": "" }, { "docid": "7e866c9f2556548e9135282b7a486385", "score": "0.69167554", "text": "def intersect(other)\n other = coerce(other)\n attributes = to_ary & other\n new(attributes, keys: (keys | other.keys).project(attributes))\n end", "title": "" }, { "docid": "143ab976ca61787650ef9a8a316d2161", "score": "0.6882379", "text": "def intersect(group)\n end", "title": "" }, { "docid": "6555ba78741bffb35059179ef9f2b9d0", "score": "0.6881038", "text": "def intersection(other, out = nil)\n out ||= self.class.new\n max_top = [top, other.top].max\n max_left = [left, other.left].max\n out.set(\n max_left,\n max_top,\n [right, other.right].min - max_left,\n [bottom, other.bottom].min - max_top\n )\n end", "title": "" }, { "docid": "868825478ffdcf35076a17ef1436489c", "score": "0.6853209", "text": "def intersection(nums1, nums2)\n nums1 & nums2\nend", "title": "" }, { "docid": "868825478ffdcf35076a17ef1436489c", "score": "0.6853209", "text": "def intersection(nums1, nums2)\n nums1 & nums2\nend", "title": "" }, { "docid": "446139815f2eccd31c32cfd0da7d5de2", "score": "0.6848111", "text": "def intersect(other)\n result = []\n each do |itm|\n result << itm if other.include?(itm)\n end\n result\n end", "title": "" }, { "docid": "f39bc303b60dc3d5b2fddd2757c8cdab", "score": "0.68223894", "text": "def intersect(nodes)\n chain_set_operation(Intersect.new, nodes)\n end", "title": "" }, { "docid": "75f2e37122547bd3dcb515e2d5d95884", "score": "0.68214405", "text": "def intersect? ; @intersect ; end", "title": "" }, { "docid": "ebf698c3098b66ac4b6b96fba3678b9b", "score": "0.6820222", "text": "def intersect other\n res = Set.new\n @list.each do |nd| \n res.insert(nd.value) if other.contains?(nd.value)\n end\n res\nend", "title": "" }, { "docid": "9a6bde3600e3151582cebdf455f8a458", "score": "0.6813019", "text": "def intersection a, b\n c = Clipper::Clipper.new\n \n c.add_subject_polygon a.map(&:to_a)\n c.add_clip_polygon b.map(&:to_a)\n c.intersection(:non_zero, :non_zero)[0].map{|pnt| Point.new(*pnt)}\n end", "title": "" }, { "docid": "fb3071d6cb91506df884794820e4041f", "score": "0.67768574", "text": "def intersection(other)\n return nil unless intersects?(other)\n\n Solid.new(nil,\n ([@x.min, other.x.min].max..[@x.max, other.x.max].min),\n ([@y.min, other.y.min].max..[@y.max, other.y.max].min),\n ([@z.min, other.z.min].max..[@z.max, other.z.max].min))\n end", "title": "" }, { "docid": "a8db653a5f0b2a366609908b6b18326a", "score": "0.67328674", "text": "def optimize\n left.intersect(right)\n end", "title": "" }, { "docid": "afc2c45c71fe1c0163a21202bb3095f4", "score": "0.6729157", "text": "def intersect a, b\n\t\treturn [] if a.count == 0 || b.count == 0\n\t\tnewSet = Array.new\n\t\ta.each do |x|\n\t\t\tnewSet << x if b.include? x\n\t\tend\n\t\tnewSet\n\tend", "title": "" }, { "docid": "d00eea07c2579db24c63f07b674954f3", "score": "0.6721679", "text": "def intersection(*args)\n other = coerce_zone(*args)\n\n vt = vt_range.intersection(other.vt_range)\n tt = tt_range.intersection(other.tt_range)\n vt && tt && self.class.new( vt, tt )\n end", "title": "" }, { "docid": "3d7c0c5e45925e5237990f8a81a522a6", "score": "0.66787505", "text": "def intersection(other)\n return Interval.create(Math.max(@a, other.attr_a), Math.min(@b, other.attr_b))\n end", "title": "" }, { "docid": "1ed29ded471d6da5e7ec05f2ac8e2609", "score": "0.6582965", "text": "def rec_intersection(rect1, rect2)\nend", "title": "" }, { "docid": "d09124bfa30e741dc093178d19c35ad6", "score": "0.65697676", "text": "def intersection(reset)\n reset = Reset.new(reset) unless reset.instance_of? Reset\n Reset.new(@values.select { |elem| reset.include? elem })\n end", "title": "" }, { "docid": "68376442d31909c60181440990fc8a16", "score": "0.6564144", "text": "def find_intersection(arr1, arr2)\n set = Set[*arr1]\n filtered_set = Set.new( arr2.select { |x| set.include?(x) } )\n return [*filtered_set]\nend", "title": "" }, { "docid": "2756bdc95dbb10a15b1b27f429fc3cd0", "score": "0.65527886", "text": "def intersection(otherset,name)\n #intitializes empty set, and creates new set object to hold intersection set\n setinit =[]\n interset = Set.new(setinit, name)\n\n #two for loops to cycle through each element of both sets and compare them\n i=0\n j=0\n #first loop cycles through the setarray \n for i in [email protected]\n tempid1=@setarray[i].id\n tempname1=@setarray[i].name\n #nested for loop cycles through the other set's setarray\n for j in 0..otherset.setarray.length-1\n tempid2=otherset.setarray[j].id\n tempname2=otherset.setarray[j].name\n \n #compares the current subscriber of setarray with the current subscriber of the other set's setarray\n if (tempid1 == tempid2) && (tempname1 == tempname2)\n #as long as the subscriber isn't already inside the new intersection set, it adds\n unless interset.contains?(@setarray[i],0,interset.length-1)\n interset.setarray.push(otherset.setarray[j])\n end\n end\n\n end\n end\n #sorts the array so it can be manipulated further\n interset.setarray.sort_by!(&:id)\n #returns the new intersection set\n return interset\n end", "title": "" }, { "docid": "dd6486e0ddd17e9ba1e7c9717489ea8e", "score": "0.65518856", "text": "def intersect(ray)\n t = {}\n @objs.each do |obj|\n intersect = obj.intersect(ray)\n t[intersect] = obj if intersect\n end\n return nil if t.length == 0\n first = t.min\n return first.reverse\n end", "title": "" }, { "docid": "b92f7716b4b8887f751b68d5076ac69c", "score": "0.6528866", "text": "def intersect(select)\n add_set_op('intersect', select)\n end", "title": "" }, { "docid": "f6b8e4f306c957c1c09552dac1634662", "score": "0.6522329", "text": "def list_intersect\n intersect\n\n from = options[:from]\n limit = stop == -1 ? stop : stop - start + 1\n\n ids = if from.present? && from[:direction] == 'up'\n Hari.redis.zrevrangebyscore intersect_key, '+inf', from[:score], limit: [start, limit]\n elsif from.present? && from[:direction] == 'down'\n Hari.redis.zrevrangebyscore intersect_key, from[:score], '-inf', limit: [start, limit]\n else\n Hari.redis.zrevrange intersect_key, start, stop\n end\n\n Hari.redis.del intersect_key\n\n property.entity.find_many ids\n end", "title": "" }, { "docid": "7b8edd11c80c54439ff2973c53da2b8e", "score": "0.6515882", "text": "def &(transaction_set)\n merge_with 'intersection', transaction_set\n end", "title": "" }, { "docid": "761e08900e72b01e870f938acae540d1", "score": "0.65095025", "text": "def intersection(array1, array2)\n raise NotImplementedError\nend", "title": "" }, { "docid": "020bcf554cbed1e678717eded0703379", "score": "0.6491622", "text": "def intersection(set1, set2)\n\t# set1 and set2 are arrays\n # return the intersection\n \n inter= []\n\n if set1.length > set2.length\n set1.map {|x| set2.include?(x) ? inter.push(x) : nil}\n else \n set2.map {|x| set1.include?(x) ? inter.push(x) : nil}\n end\n return inter\n\nend", "title": "" }, { "docid": "a8ae10cf20404e6f1064144b303d1399", "score": "0.6483377", "text": "def intersect(other)\r\n start = self.start + other.start\r\n finals = self.finals.to_a.product(other.finals.to_a).map{|a,b| a + b}.to_set\r\n product = self.graph.product(other.graph)\r\n graph = product.key_value_map do |(state1, state2), (transitions1, transitions2)|\r\n common_symbols = transitions1.keys & transitions2.keys\r\n transitions = common_symbols.map do |symbol|\r\n states = transitions1[symbol].to_a.product(transitions2[symbol].to_a).map{|a, b| a + b}\r\n [symbol, states]\r\n end.to_h\r\n [state1 + state2, transitions]\r\n end\r\n self.class.new(start, finals, graph).prune\r\n end", "title": "" }, { "docid": "9871d772d3b0a3c9bb4f896caa177e4c", "score": "0.64784694", "text": "def intersection(array_1, array_2)\n puts \"NOT IMPLEMENTED\"\n return []\nend", "title": "" }, { "docid": "3464694578784fd0f4476868de25b1ce", "score": "0.6471872", "text": "def intersection3(arr1, arr2)\n intersection = []\n set_1 = arr1.to_set\n arr2.each do |el|\n intersection << el if set_1[el]\n end\n\n intersection\nend", "title": "" }, { "docid": "7e573b76768ba06d951ca10238f6f6c4", "score": "0.64657855", "text": "def custom_intersection(arr1, arr2)\n final = []\n arr1.each { |value| final << value if (arr2.include?(value) && !final.include?(value)) }\n final\nend", "title": "" }, { "docid": "7501c5ac846ab21d47d499275d1539fa", "score": "0.6458019", "text": "def intersection arrays\n arrays.inject &:&\n end", "title": "" }, { "docid": "2a860f53f697e88f7c6a673645a4b638", "score": "0.6424665", "text": "def intersection(set2)\r\n puts \"The intersection of the two sets is :\"\r\n set3 = @hashname.keep_if {|k, v| set2.hashname.key? k}\r\n pp set3\r\n end", "title": "" }, { "docid": "1cdc69daebeabfa027ac51e8ba44b146", "score": "0.64211106", "text": "def intersect(ray)\n nil\n end", "title": "" }, { "docid": "08bb28a8eaad9b80b66fb860557d868a", "score": "0.642052", "text": "def intersection3(arr1, arr2)\n intersection = []\n set_1 = arr1.to_set\n arr2.each do |el|\n intersection << el if set_1.include?(el)\n end\n\n intersection\nend", "title": "" }, { "docid": "68975cc252e09c4d381fc524baf599f9", "score": "0.6407282", "text": "def |(filter)\n self.class.intersect(self, filter)\n end", "title": "" }, { "docid": "219f7228d16ad6ff9899ec204429a33e", "score": "0.6403183", "text": "def intersection(nums1, nums2)\n nums1_uniq = nums1.uniq\n nums2_uniq = nums2.uniq\n \n nums1_uniq.select { |n| nums2_uniq.include?(n) }\nend", "title": "" }, { "docid": "7827f2ae29ff3b36e0feefab7437c242", "score": "0.64031076", "text": "def intersection arrays\n arrays.inject &:&\n end", "title": "" }, { "docid": "7827f2ae29ff3b36e0feefab7437c242", "score": "0.64031076", "text": "def intersection arrays\n arrays.inject &:&\n end", "title": "" }, { "docid": "735c34c25631e993f15886190e649843", "score": "0.63944155", "text": "def intersection\n return nil unless @grpc.intersection\n @grpc.intersection.rules.map do |gc_rule_grpc|\n self.class.from_grpc gc_rule_grpc\n end\n end", "title": "" }, { "docid": "8659c45642d4c4c73cb77327332f7ea6", "score": "0.63667953", "text": "def intersection(*sets)\n redis.sinter(key, *keys_from_objects(sets)).map{|v| unmarshal(v)}\n end", "title": "" }, { "docid": "5297e28adecd6008e6c9546bb1c5d69d", "score": "0.63628334", "text": "def intersection(nums1, nums2)\n s1 = arr_to_hash nums1\n s2 = arr_to_hash nums2\n\n result = []\n\n s1.each do |k, v|\n result << k if s2[k]\n end\n\n result\nend", "title": "" }, { "docid": "5182e07266415e9b03c443e3ecf73869", "score": "0.6350143", "text": "def __intersect__(criterion, operator)\n with_strategy(:__intersect__, criterion, operator)\n end", "title": "" }, { "docid": "5f9675fdb67090d86369a20adb415534", "score": "0.6332218", "text": "def intersection(array1, array2)\n intersect = []\n return intersect if !array1 || !array2\n array1 = merge_sort(array1)\n array2.each do |elem|\n intersect << elem if binary_search(array1, elem)\n end\n return intersect\nend", "title": "" }, { "docid": "4338341a3722a7f3515ed28089a4ec10", "score": "0.6322273", "text": "def array_intersection(array1, array2)\n return array1 & array2\nend", "title": "" }, { "docid": "5cfe35d4b1c1342e018ea2f4d332a226", "score": "0.63153684", "text": "def __intersect__(criterion, operator)\n with_strategy(:__intersect__, criterion, operator)\n end", "title": "" }, { "docid": "0d4e3caea1983973a025f40fa84d3095", "score": "0.6310112", "text": "def intersect(intersections)\n result = Array(intersections).each_with_object([]) do |intersection, memo|\n memo.concat(intersect_with_time_interval(intersection))\n end\n\n Collection.new(result)\n end", "title": "" }, { "docid": "d999e1be985a9f5b453960da38adfa35", "score": "0.6308888", "text": "def intersection(my_hash1, my_hash2)\n #Used to iterate through my_hash1\n i = 0\n #Used to iterate through my_hash2\n j = 0\n #New Hash to store intersected values\n my_hash3 = Hash.new\n while i < my_hash1.length\n\n \t\t#iterates through both hashes to see if the elements equal each other\n \t\t#If they do, it is added to my_hash3 from my_hash1\n if my_hash1.keys[i] == my_hash2.keys[j]\n my_hash3[my_hash1.keys[i]] = my_hash1.values[i]\n i += 1\n j = 0\n \t#If they're not equal, the object in my_hash1 will be compared to\n \t#all of the objects in hash2 until an equal is fone\n elsif j == my_hash2.length - 1\n \t#If we reach the end of my_hash2, we start again and compare the next object of\n \t#my_hash1 to all of the objects in my_hash2 and repeat the process\n i += 1\n j = 0\n else\n j+=1\n end\n \n end\n #displays intersection\n displaySet(my_hash3)\n\n\n end", "title": "" }, { "docid": "e6c9cbcd1ecdfa54e3b7eabb949ec6fb", "score": "0.62843", "text": "def intersection(other, dest: nil)\n destination = coerce_destination(dest)\n results = if destination.nil?\n ::Set.new(self.connection.sinter(@key, other.key))\n else\n self.connection.sinterstore(destination.key, @key, other.key)\n end\n\n return results\n end", "title": "" }, { "docid": "1518f53f0adc09a1b0436537486d6cee", "score": "0.6275724", "text": "def intersect?(other)\n Rangops::Set.intersect(self, other)\n end", "title": "" }, { "docid": "9d994c7f171cca392650d121acb1622f", "score": "0.6274502", "text": "def intersection(list1, list2)\n return nil unless list1 && list2\n\n intersection_helper(list1, list1.count, list2, list2.count)\nend", "title": "" }, { "docid": "fa5036b4329ed6dc290301ad08371510", "score": "0.62725335", "text": "def intersect(ent_a,ent_b)\n if @movies[ent_a] && @movies[ent_b]\n return find_intersections(ent_a,ent_b,\"movies\")\n elsif @actors[ent_a] && @actors[ent_b]\n return find_intersections(ent_a,ent_b,\"actors\")\n elsif @actors[ent_a] || @actors[ent_b] && @movies[ent_a] || @movies[ent_b]\n return \"ERROR: BOTH ENTITIES MUST BE MOVIES OR ACTORS, OR ATLEAST 1 ENTITY DOESN'T EXIST\"\n else\n return \"ERROR: ONE ENTITY DOESN'T EXIST\"\n end\n end", "title": "" }, { "docid": "35f83e79db26725c33d04878049f8365", "score": "0.6268188", "text": "def intersection(another_transmembrane_domain_defintion)\n res = (@start..@stop).to_a & (another_transmembrane_domain_defintion.start..another_transmembrane_domain_defintion.stop).to_a\n res.empty? ? nil : (res.first..res.last)\n end", "title": "" }, { "docid": "3cd254265e2b965b98b456182d9ca002", "score": "0.6262984", "text": "def fast_intersection(array_one, array_two)\n\nend", "title": "" }, { "docid": "3cd254265e2b965b98b456182d9ca002", "score": "0.6262984", "text": "def fast_intersection(array_one, array_two)\n\nend", "title": "" }, { "docid": "5d9354f582e1e5cbebbb7e5905db25e2", "score": "0.62599164", "text": "def intersection(other)\n if ((other).nil? || (other.size).equal?(0) || (size).equal?(0))\n return nil\n end\n inter = HashSet.new\n this_keys = @attributes.key_set\n it = this_keys.iterator\n while it.has_next\n key = it.next_\n if (!(other.attr_attributes.get(key)).nil?)\n inter.add(key)\n end\n end\n if ((inter.size).equal?(0))\n return nil\n end\n return inter\n end", "title": "" }, { "docid": "0ff209d66104e9e82f8855224d4ab678", "score": "0.62594575", "text": "def intersection(list1, list2)\n \n array = list1.concat(list2)\n hash = {}\n result = []\n\n array.each do |item|\n if hash[item].nil?\n hash[item] = true\n else\n result << item\n end\n end\n\n return result\nend", "title": "" }, { "docid": "0b67d1698939714188552afe974a42d5", "score": "0.6253842", "text": "def intersection(other)\n return nil unless overlaps?(other)\n\n ([min, other.min].max..[max, other.max].min)\n end", "title": "" }, { "docid": "fcfc52efbb4fe49a027131e7c2645597", "score": "0.62507004", "text": "def &(other)\n compose(other, Intersection)\n end", "title": "" }, { "docid": "8ab51b87e1fe2c0c05dd87b9e8dce9a6", "score": "0.62502414", "text": "def intersect(attrs = {})\n self.class.new(@backend, @initial_set, @associated_class, self,\n ::Zermelo::Filters::Steps::IntersectStep.new({}, attrs))\n end", "title": "" }, { "docid": "fad33aee96d086d459c341ac309743d7", "score": "0.6245518", "text": "def find_shared_interests(other)\n # considered a single query with INTERSECT but couldn't figure out how to do it with AR and Arel and didn't\n # think it was worth constructing the query manually. am happy to revisit this choice.\n interests & other.interests\n end", "title": "" }, { "docid": "fe876303ce25b5da639bfa14feefaa2a", "score": "0.6242714", "text": "def intersects_with_for(ary)\n store = []\n if size > ary.length then\n a1 = self\n a2 = ary\n else\n a1 = ary\n a2 = self\n end\n for i in 0..a1.size\n store << a1[i] if a2.include?(a1[i])\n end\n store.uniq\n end", "title": "" }, { "docid": "efce5222f1c18ffd030e4e10230b9bab", "score": "0.62191355", "text": "def ray_intersect(ray)\n @entities.select do |ent|\n next if ent.entity == self\n next unless ent.bounding_box\n\n ray.intersect?(ent.bounding_box)\n end\n end", "title": "" }, { "docid": "5d7a73144351fab4a212ad29f51b80ae", "score": "0.62144387", "text": "def intersection1(arr1, arr2)\n arr1.uniq.select { |el| arr2.include?(el) }\nend", "title": "" }, { "docid": "88dcf706e0e1d2f000214b59debf0509", "score": "0.621421", "text": "def intersection(nums1, nums2)\n result = []\n nums1.each do |num|\n result.push(num) if (!result.include?(num) && nums2.include?(num))\n end\n result\nend", "title": "" }, { "docid": "d06bafe901c6d68e53937a3757b4656f", "score": "0.6208966", "text": "def intersection(ray)\n b = ray.d.dot(@n)\n return nil if b == 0.0\n\n a = @p.sub(ray.o).dot(@n)\n t = a / b\n\n return nil if t < ray.tmin || t > ray.tmax\n ray[t]\n\n { t: t, p: ray[t], n: @n, shape: self }\n end", "title": "" }, { "docid": "571dae13c4331bb3dbf3080aa627485d", "score": "0.6208884", "text": "def hash_intersection(h1,h2)\n intersection = { }\n h1.each do |k,v|\n intersection[k] = v if h2.keys.include?(k) && h2.values.include?(v)\n end\n intersection\nend", "title": "" }, { "docid": "b89807191d02a2ffcbafe8027c3592c9", "score": "0.6208581", "text": "def intersection(list1, list2)\n\n hash = Hash.new\n\n list1.each do |value|\n hash[value] = 1\n end\n\n new_list = Array.new\n list2.each do |element|\n if hash[element] == 1\n new_list << element\n end\n end\n\n return new_list\nend", "title": "" } ]
920249648ba99fdfbc3de94c93d6f84d
GET /business_cards GET /business_cards.json
[ { "docid": "8ebb736983887008c4dc07082b8ca0b0", "score": "0.7524042", "text": "def index\n @business_cards = BusinessCard.all\n end", "title": "" } ]
[ { "docid": "3c5d761456c8c1dc36e25a735869382e", "score": "0.7093244", "text": "def show\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bizcard }\n end\n end", "title": "" }, { "docid": "846266430ccc873a1229727d420bd503", "score": "0.706445", "text": "def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end", "title": "" }, { "docid": "78022b117a8beef9a4adfc31deed0057", "score": "0.69715124", "text": "def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bcard }\n end\n end", "title": "" }, { "docid": "b4aba272f1e12c0ec9824e358b04d6ca", "score": "0.68646055", "text": "def show\n \tif(!params[:id].nil?)\n if(CompanyCard.exists?(params[:id]))\n card = CompanyCard.find(params[:id])\n render status: 200, json: {\n company_cards: card\n }.to_json\n \n else\n render status: 422, json: {\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n else\n render status: 422, json: {\n message: \"Unable to process your request of the server.\"\n }.to_json\n end\n end", "title": "" }, { "docid": "9c226f9e25f598c1b2881c6a1762257d", "score": "0.68634546", "text": "def show\n @business_card = current_user.business_cards.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "9a0171a2d6443256c8637798af871433", "score": "0.6850131", "text": "def index\n @cards = Card.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @cards }\n end\n end", "title": "" }, { "docid": "b37a7c568c3f40622f6cde7e5d4476e3", "score": "0.6816337", "text": "def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end", "title": "" }, { "docid": "88dff8a846394d88dcb9770c1714f790", "score": "0.6743246", "text": "def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n data['datosSalidaTarjetas']['tarjetas'].map{ |data| build_card(data) }\n end", "title": "" }, { "docid": "04c9bd169aad70570503965b148faf3a", "score": "0.6739488", "text": "def index\n @cards = Card.page(params[:page]).per(7)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cards }\n end\n end", "title": "" }, { "docid": "15ec0f8a0ee38bfd7b4a5665eec55ebc", "score": "0.66026026", "text": "def show\n render json: @card\n end", "title": "" }, { "docid": "15ec0f8a0ee38bfd7b4a5665eec55ebc", "score": "0.66026026", "text": "def show\n render json: @card\n end", "title": "" }, { "docid": "b6fd24582a676f100e47669016539c5e", "score": "0.654258", "text": "def show\n render json: @card, status: :ok\n end", "title": "" }, { "docid": "098aca3c4b0b62ad28f1a245f49e83dd", "score": "0.6486492", "text": "def creditCardIndex\n render json: Approved.allCreditCard\n end", "title": "" }, { "docid": "8a243f0cd9c8bc5dcef70416d8fb5de5", "score": "0.6445331", "text": "def index\n @company_cards = CompanyCard.all\n end", "title": "" }, { "docid": "b2b436b28fd0600f7371cdd659f1efc6", "score": "0.64221966", "text": "def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end", "title": "" }, { "docid": "96d963aa2eae911198a7a61ae5da5d4a", "score": "0.64089745", "text": "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "96d963aa2eae911198a7a61ae5da5d4a", "score": "0.64089745", "text": "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "96d963aa2eae911198a7a61ae5da5d4a", "score": "0.64089745", "text": "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "96d963aa2eae911198a7a61ae5da5d4a", "score": "0.64089745", "text": "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "96d963aa2eae911198a7a61ae5da5d4a", "score": "0.64089745", "text": "def show\n @card = Card.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "869c521530fe813d1c4c6d2d1331c227", "score": "0.6398723", "text": "def cardsByUser\n results = HTTParty.get(\"http://192.168.99.104:3003/credit_cards/user?id=\"+ @current_user[\"id\"].to_s)\n render json: results.parsed_response, status: results.code\n end", "title": "" }, { "docid": "e6520d8ed0ada8afb6a0e72ab5daf7e7", "score": "0.63966906", "text": "def show\n @card = PkCard.find(params[:id])\n render json: @card\n end", "title": "" }, { "docid": "f4be07cc70ef86ecd5e8319221af7adb", "score": "0.639366", "text": "def new\n @bizcard = Bizcard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bizcard }\n end\n end", "title": "" }, { "docid": "bfc49969158210b38e8616654bf42dd2", "score": "0.6349024", "text": "def show\n set_match\n profile_info\n\n @bdcard = Bdcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bdcard }\n end\n end", "title": "" }, { "docid": "284d84ea296ee5af868dfb6eebd00c61", "score": "0.6345967", "text": "def index\n @blog_cards = Blog::Card.all\n end", "title": "" }, { "docid": "d6d40ac0173160ecbb14ded1f33b6e28", "score": "0.63418907", "text": "def show\n respond_to do |format|\n format.html {}\n format.json do\n\n hash_card = {\n name: @card.name,\n desc: @card.oracle_text,\n url: card_path(@card)\n }\n\n render json: hash_card\n end\n end\n end", "title": "" }, { "docid": "c01140418442c4e3ddaa69bf1e92bebf", "score": "0.63259727", "text": "def index\n # @cards = Card.all INSTEAD, order cards by most recent card created:\n @cards = Card.order('updated_at DESC')\n render json: @cards\n end", "title": "" }, { "docid": "d62cfb4d20264820a023fba5838b9f1d", "score": "0.63087153", "text": "def show\n # @card = Card.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @card }\n # end\n end", "title": "" }, { "docid": "f2b4dce9aa8164c2b8c380c6c26793c7", "score": "0.63084036", "text": "def show\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @businessbook }\n end\n end", "title": "" }, { "docid": "a2f5c45ea0ead9b41c14c8163ed00f02", "score": "0.62874645", "text": "def cards\n @cards ||= @client.resource['creditCards']\n end", "title": "" }, { "docid": "34e6c01a2c107210aac16e6f44c1ee9d", "score": "0.62663627", "text": "def show\n @mtb_card = MtbCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mtb_card }\n end\n end", "title": "" }, { "docid": "0f7da78ff7467041983fb0fb125cea86", "score": "0.62625176", "text": "def show\n # @card = current_user.cards.find(params[:id])\n @card = Card.all.find(params[:id])\n respond_to do |format|\n format.html\n format.json {\n render json: { \"data\": { \"card\": @card.as_json(include: [:book, :user]) } },\n status: :ok\n }\n end\n end", "title": "" }, { "docid": "fc7d94a9ea57209c20402a39d9b05ffa", "score": "0.6259903", "text": "def get_all_client_cards_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardApi.get_all_client_cards_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/card/cardholder_overview'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\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 => 'PageClientBusinessCardVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardApi#get_all_client_cards_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a6d030ef40b6f472874260d2a87db7ca", "score": "0.62480015", "text": "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end", "title": "" }, { "docid": "a6d030ef40b6f472874260d2a87db7ca", "score": "0.62480015", "text": "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end", "title": "" }, { "docid": "a6d030ef40b6f472874260d2a87db7ca", "score": "0.62480015", "text": "def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end", "title": "" }, { "docid": "5b2cb5adec5fe17dadd063ec02fbab7a", "score": "0.62471074", "text": "def index\n @banks = Bank.all\n render json: @banks\n end", "title": "" }, { "docid": "31e5821f35cc5ea78180f77244f5809d", "score": "0.6208893", "text": "def new\n @bcard = Bcard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bcard }\n end\n end", "title": "" }, { "docid": "6ccf5ab591b292072a23b8b1c83b6731", "score": "0.6177705", "text": "def index\n #@cards = Card.all\n end", "title": "" }, { "docid": "b478e50bcf27145eb63f1b94e6cba26e", "score": "0.61683756", "text": "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end", "title": "" }, { "docid": "dbb80fd5561a561f49ea034869b839b7", "score": "0.6162162", "text": "def show\n @business_sector = BusinessSector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business_sector }\n end\n end", "title": "" }, { "docid": "29c877b265942e4f0abcd5ee4a6d3d50", "score": "0.61615425", "text": "def show\n @card_number = CardNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_number }\n end\n end", "title": "" }, { "docid": "5389c17328ff5c603072e93229c8607e", "score": "0.615567", "text": "def show\n @mtb_among_card_type = MtbAmongCardType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mtb_among_card_type }\n end\n end", "title": "" }, { "docid": "65e2a43a9e4e327272f0ff442c418e55", "score": "0.61489224", "text": "def index\n add_breadcrumb \"<i class='fa fa-info-circle'></i> #{I18n.t(\"activerecord.models.card_type\", count: 2)}\".html_safe, card_types_path\n @card_types = CardType.all\n respond_to do |format|\n format.html\n format.json {\n render json: {head: :no_content}\n }\n end\n end", "title": "" }, { "docid": "e496a1b62e90d00f680560c2b397d4a8", "score": "0.6148199", "text": "def index\n @cards = Card.all\n end", "title": "" }, { "docid": "e496a1b62e90d00f680560c2b397d4a8", "score": "0.6148199", "text": "def index\n @cards = Card.all\n end", "title": "" }, { "docid": "e496a1b62e90d00f680560c2b397d4a8", "score": "0.6148199", "text": "def index\n @cards = Card.all\n end", "title": "" }, { "docid": "e496a1b62e90d00f680560c2b397d4a8", "score": "0.6148199", "text": "def index\n @cards = Card.all\n end", "title": "" }, { "docid": "5da87061bce74f9c47e797ce959e3e70", "score": "0.61261636", "text": "def get_resource_cards(all=false)\n presenter = ResourcesPresenter.new(@cms_site, all)\n _resources = presenter.resources\n\n _resources[:url] = get_cms_url(_resources[:url])\n _resources[:cards].map! do |c|\n page = c[:page]\n file = cms_fragment_render(:file, page)\n link = cms_fragment_render(:link, page)\n url = file.present? || link.present? ? nil : get_cms_url(page.full_path)\n\n c.merge(\n date: DateTime.parse(cms_fragment_render(:published_date, page)).strftime('%d %B %y'),\n url: url,\n summary: cms_fragment_render(:summary, page),\n fileUrl: file,\n linkUrl: link,\n linktTile: cms_fragment_render(:link_title, page)\n )\n end\n\n @items = _resources\n end", "title": "" }, { "docid": "3205a973a4e7c52819150fc3804460f7", "score": "0.61079973", "text": "def index\n @graphic_cards = GraphicCard.all\n end", "title": "" }, { "docid": "bde3d7349720c066426ce1b8b6e8f9c9", "score": "0.61074984", "text": "def get_cards\n \tif (!stripe_customer_id.nil?)\n\t customer = Stripe::Customer.retrieve(stripe_customer_id)\n\t puts customer.cards\n\t return customer.cards\n\telse\n\t\treturn nil\n\tend\n end", "title": "" }, { "docid": "544a4496f7b750ab41dd39a7e6eb63c1", "score": "0.60987586", "text": "def show\n render json: @business\n end", "title": "" }, { "docid": "036794fa51eaa3e54bc28ec5f80fbcef", "score": "0.6094393", "text": "def show\n @black_list = BlackList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @black_list }\n end\n end", "title": "" }, { "docid": "a15fe1d99134d0dfa8d53e70b56cae76", "score": "0.6091559", "text": "def index\n @businesses = Business.all.offset(offset).limit(limit)\n render json: @businesses\n end", "title": "" }, { "docid": "1d2618f482be4b062723002c722543d6", "score": "0.60895795", "text": "def show\n @social_contract = SocialContract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @social_contract }\n end\n end", "title": "" }, { "docid": "bf3730f6ee33f4bf0297b43f0c4bbfc5", "score": "0.6063417", "text": "def search\n @flash_cards = FlashCard.search(params[:query])\n @summary_array = @flash_cards.collect do |card|\n { :text => card.front, :id => card.id }\n end\n\n respond_to do |format|\n format.json { render :json => @summary_array }\n end\n end", "title": "" }, { "docid": "797449a7c2b6ef29bcf82b46350439c1", "score": "0.6061421", "text": "def get_card_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardApi.get_card_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/card'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\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 => 'PageCard')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardApi#get_card_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "4a2b45925a115751df0545dedf8f60b6", "score": "0.60613257", "text": "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "title": "" }, { "docid": "88c839b716e19fc7a7b55cd6b2340b38", "score": "0.6060504", "text": "def index\n respond_with GameProcess.new(session[:game_session]).get_deck_cards\n end", "title": "" }, { "docid": "738339695afcbacbdfe4604bb9c0198a", "score": "0.60482275", "text": "def index\n pagination = pagination_params\n filter = filter_params\n\n @cards = Card.filter_query(filter).page(pagination[:page]).per(pagination[:quantity]).ordered\n end", "title": "" }, { "docid": "324ae055b5439c2dfa3f852413b1e822", "score": "0.60408384", "text": "def show\n @breadcrumb = 'read'\n @bank = Bank.find(params[:id])\n @bank_offices = @bank.bank_offices.order(\"code\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "title": "" }, { "docid": "bccc7e08ca1ca9800639333e57e0f4f2", "score": "0.60344726", "text": "def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end", "title": "" }, { "docid": "0723a9c38c24e0382f83ba698c3db1ad", "score": "0.60340005", "text": "def index\n @feeling_cards = FeelingCard.all\n end", "title": "" }, { "docid": "f5dac88fc30fda68d1246b55a22af0ca", "score": "0.60316426", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @safety_cards }\n end\n end", "title": "" }, { "docid": "318b23e7b8ab7f9422b88c889f331c9e", "score": "0.60120285", "text": "def set_business_card\n @business_card = BusinessCard.find(params[:id])\n end", "title": "" }, { "docid": "7d5842dc6c7621ed6f97d44d6c83dd29", "score": "0.6011797", "text": "def show\n @cruno_card = CrunoCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cruno_card }\n end\n end", "title": "" }, { "docid": "d48e70485a256a9481c8f3b35f157b3a", "score": "0.601017", "text": "def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bcard }\n end\n end", "title": "" }, { "docid": "b587a634b36454dd220aa8613f21219a", "score": "0.60076964", "text": "def index\n @greeting_cards = GreetingCard.all\n end", "title": "" }, { "docid": "499db5c4b83b97a1affdb00344ce7118", "score": "0.600687", "text": "def show\n respond_to do |format|\n format.html {}\n format.json { render json: {id: @card.id, name: @card.name} }\n end\n end", "title": "" }, { "docid": "b087a62ee0eb57b52a966ede269b6c1b", "score": "0.6003948", "text": "def index\n @shop_fb_credit_offers = Shop::FbCreditOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_fb_credit_offers }\n end\n end", "title": "" }, { "docid": "e9413ff1dae33269ab703b26cd952fa6", "score": "0.60010207", "text": "def index\n @scorecards = Scorecard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scorecards }\n end\n end", "title": "" }, { "docid": "30ce86bc57a13a8516fe27429ba55618", "score": "0.5999988", "text": "def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end", "title": "" }, { "docid": "cfe68fac10ca003d1c0c1f50f46e8b59", "score": "0.5998936", "text": "def show\n @card = Card.find_by_access_token!(params[:id])\n @destination = @card.destination\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @card }\n end\n end", "title": "" }, { "docid": "f0e06b1dc6c00613fcc81507743c760b", "score": "0.599263", "text": "def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end", "title": "" }, { "docid": "aded80d4bdf017157ee79b4afa01fbb2", "score": "0.5982349", "text": "def show\n @card_set = CardSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_set }\n end\n end", "title": "" }, { "docid": "82a91c0dc074b3585675abbbd9b12680", "score": "0.5981835", "text": "def index\n @job_cards = JobCard.all\n end", "title": "" }, { "docid": "708ceff3ac2f8fc3f1b9fbf5ec291ac9", "score": "0.5980593", "text": "def show\n @biz_company = BizCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @biz_company }\n end\n end", "title": "" }, { "docid": "c40e0bb153086f2ce1e21b786b75df8d", "score": "0.5980537", "text": "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "title": "" }, { "docid": "3bce2a56ea949c4099ca3fe55b5165a3", "score": "0.59779555", "text": "def show\n render json: @bank\n end", "title": "" }, { "docid": "88c85e3f0b89634b66c2c9446d066df9", "score": "0.59724146", "text": "def index\n @credit_cards = CreditCard.all\n end", "title": "" }, { "docid": "41df32e0cdc1ab26bcb777a41ae2cd91", "score": "0.5972057", "text": "def show\n @team = Team.find(params[:id])\n @cards = @team.cards :all, :limit => 10\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @team }\n end\n end", "title": "" }, { "docid": "fd9096825c955e0e9d207bdec528ef7e", "score": "0.59611064", "text": "def show\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "title": "" }, { "docid": "5cba4b4da749e31aefeb57b155d3dca2", "score": "0.59590626", "text": "def index\n @m_cards = MCard.all\n end", "title": "" }, { "docid": "f57c587fb52700586d523936a5e12b6f", "score": "0.59575903", "text": "def index\n @cabines = Cabine.all\n render json: @cabines\n end", "title": "" }, { "docid": "6344313714ecb8bcd034bcb6f40f9a04", "score": "0.5955411", "text": "def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end", "title": "" }, { "docid": "b65bfab325f34622b424db8a126868df", "score": "0.5943788", "text": "def index\n cards_per_page = 12\n\n @boards = Board.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n format.js\n end\n end", "title": "" }, { "docid": "6526feebc55f0506352603f84247b905", "score": "0.59436333", "text": "def index\n @paymentcashes = Paymentcash.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paymentcashes }\n end\n end", "title": "" }, { "docid": "5ee16e92f412218172c45e3e942049a0", "score": "0.59387165", "text": "def show\n @reg_card = RegCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reg_card }\n end\n end", "title": "" }, { "docid": "1819b673d2a4de543e065dc2ce21d300", "score": "0.59340805", "text": "def show\n @bank_card = BankCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bank_card }\n end\n end", "title": "" }, { "docid": "2d1ae097967286723bef6e3fb3331cde", "score": "0.593281", "text": "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "title": "" }, { "docid": "008d452eae681728d3b30e5b5ee52adf", "score": "0.5929672", "text": "def index\n @banners = Banner.where('active =?', true).order(:display_order)\n\n render json: @banners\n end", "title": "" }, { "docid": "9ca301364ddb66759e9cd4c642801086", "score": "0.59201723", "text": "def show\n @billcategory = Billcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billcategory }\n end\n end", "title": "" }, { "docid": "03271c1fae39b51fef6054fc6adfe316", "score": "0.59171367", "text": "def index\n @card_pages = CardPage.all\n end", "title": "" }, { "docid": "52d2768cb645890a27c5a17b32c55792", "score": "0.5913036", "text": "def index\n @flash_card_sets = FlashCardSet.all\n\n render :index, status: 200\n end", "title": "" }, { "docid": "f4b052c57eab5e83cd14385f893083cf", "score": "0.5911464", "text": "def new\n @business_card = BusinessCard.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "title": "" }, { "docid": "06674b7ce0284f6099cbb2975ad9e15e", "score": "0.589628", "text": "def index\n @bank_card_types = BankCardType.all\n end", "title": "" }, { "docid": "4a4855304f5e432d193fed216ffa64c2", "score": "0.5895169", "text": "def show\n @banking_detail = BankingDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banking_detail }\n end\n end", "title": "" }, { "docid": "aad8eb27997804b9c8c99de7fe88bea9", "score": "0.58927554", "text": "def index\n @creditcards = Creditcard.all\n end", "title": "" }, { "docid": "748dcb29586fb38fbd8c10cf94e0a73e", "score": "0.5887017", "text": "def show \n mtgcard = Mtgcard.find(params[:id])\n render json: mtgcard\n end", "title": "" }, { "docid": "a4a9c442bec56e503b3286249f1f83fc", "score": "0.5884941", "text": "def index\n @cards = @deck.cards.all\n end", "title": "" } ]
6c508a7c3385860cf45197caac874441
sources: [:file|:attachement] default is :file
[ { "docid": "27f13b97f6b3e3d75c836f2b419085d1", "score": "0.0", "text": "def rename_paperclip_file(model, new_filename, source=:file)\r\n unless paperclip_local_storage?\r\n config_warn \"Paperclip 'rename' requires using the local 'filesystem'. Not renaming from #{model.file_file_name.inspect} to #{new_filename.inspect}.\", config\r\n return\r\n end\r\n path = model.send(source).path\r\n config_error \"Paperclip 'rename' model path is blank #{model.inspect}.\", config if path.blank?\r\n config_error \"Paperclip rename file file #{path.inspect} is not a file #{model.inspect}.\", config unless File.file?(path)\r\n file = File.basename(path)\r\n dir = File.dirname(path)\r\n config_error \"Paperclip rename file directory #{dir.inspect} is not a directory #{model.inspect}.\", config unless File.directory?(dir)\r\n Dir.chdir dir do\r\n File.rename(file, new_filename)\r\n end\r\n model.send(\"#{source}_file_name=\", new_filename)\r\n save_model(model)\r\n end", "title": "" } ]
[ { "docid": "3157c17c9a87b24113e376060ac444dc", "score": "0.74111235", "text": "def source_files; end", "title": "" }, { "docid": "5b9475e992be5b6404931eb5150edce9", "score": "0.73778105", "text": "def sources; end", "title": "" }, { "docid": "c6c670bedc5c721f5eabd3bf3bcdeed4", "score": "0.7250541", "text": "def source(src)\n end", "title": "" }, { "docid": "d208efe40a33fa61f1f3de59db4b63e5", "score": "0.72500944", "text": "def source_file(*files)\n @sources ||= []\n @sources += files.map {|f| {file: f}} unless files.empty?\n @sources\n end", "title": "" }, { "docid": "d1c4bf0dc055b104e65019c54db566b2", "score": "0.7195764", "text": "def sources=(_arg0); end", "title": "" }, { "docid": "52757a27003aed69bea40b7ecb8b836e", "score": "0.70479786", "text": "def source(*sources)\r\n @sources.include sources\r\n end", "title": "" }, { "docid": "f27f37953a30a8e94eb5e96f3ad04320", "score": "0.68591404", "text": "def source(file); end", "title": "" }, { "docid": "e7e757b07279a30baf10a25ffce748b5", "score": "0.6850968", "text": "def file; @sourcefile; end", "title": "" }, { "docid": "33959de0205b170dfb8797a96d7e5178", "score": "0.67874587", "text": "def source_files\n @source_files ||= []\n end", "title": "" }, { "docid": "c23c6772cb2a278bd4a7111fa60aa563", "score": "0.6709365", "text": "def sources\n full_path(normalize(@source))\n end", "title": "" }, { "docid": "753fdbaff0f4efc3dcd8acc131b1b5db", "score": "0.66981196", "text": "def sources\n source.sources\n end", "title": "" }, { "docid": "e3f4afa8fc9c8dcde974762974c625d2", "score": "0.66886145", "text": "def sources\n load_sources if @_sources.nil?\n @_sources\n end", "title": "" }, { "docid": "e3f4afa8fc9c8dcde974762974c625d2", "score": "0.66886145", "text": "def sources\n load_sources if @_sources.nil?\n @_sources\n end", "title": "" }, { "docid": "2e8d2ba16d92262db2ae9e138aaec405", "score": "0.6677966", "text": "def source(options = {})\r\n #fp = '/media/saladi/iiif/' + context['identifier']\r\n # raise fp\r\n # File.file?(fp) ? 'FilesystemSource' : 'HttpSource'\r\n end", "title": "" }, { "docid": "715bdfb482391d2d6c2eb663197bd01e", "score": "0.6648977", "text": "def sources\n @sources ||= []\n end", "title": "" }, { "docid": "715bdfb482391d2d6c2eb663197bd01e", "score": "0.6648977", "text": "def sources\n @sources ||= []\n end", "title": "" }, { "docid": "715bdfb482391d2d6c2eb663197bd01e", "score": "0.6648977", "text": "def sources\n @sources ||= []\n end", "title": "" }, { "docid": "030009fc0e2ec2bcf80e8fb04dc59d9c", "score": "0.65881747", "text": "def src; end", "title": "" }, { "docid": "030009fc0e2ec2bcf80e8fb04dc59d9c", "score": "0.65881747", "text": "def src; end", "title": "" }, { "docid": "030009fc0e2ec2bcf80e8fb04dc59d9c", "score": "0.65881747", "text": "def src; end", "title": "" }, { "docid": "030009fc0e2ec2bcf80e8fb04dc59d9c", "score": "0.65881747", "text": "def src; end", "title": "" }, { "docid": "030009fc0e2ec2bcf80e8fb04dc59d9c", "score": "0.65881747", "text": "def src; end", "title": "" }, { "docid": "030009fc0e2ec2bcf80e8fb04dc59d9c", "score": "0.65881747", "text": "def src; end", "title": "" }, { "docid": "e6c5e305c482a56dcd25053610feb1a4", "score": "0.6582907", "text": "def sources\n fetch(:sources)\n end", "title": "" }, { "docid": "059a6d3c978fd0d436d7d5bd500712dc", "score": "0.6573865", "text": "def source_files\n @source_files ||= FileList[\"#{@ext_dir}/#{@source_pattern}\"]\n end", "title": "" }, { "docid": "a22ad5138c9a9cc29136ae35268871e0", "score": "0.6530385", "text": "def source_files\n @source_files ||= Container.new\n end", "title": "" }, { "docid": "56bf19dbfd3862c9f52bb6d8d561ef2f", "score": "0.6511351", "text": "def source_path; end", "title": "" }, { "docid": "56bf19dbfd3862c9f52bb6d8d561ef2f", "score": "0.6511351", "text": "def source_path; end", "title": "" }, { "docid": "ce0935ee9a306ec1c0a10db421c4b112", "score": "0.6501982", "text": "def prepend_sources(*args)\r\n write_inheritable_array(:sources, args.flatten + sources)\r\n invalidate_cache!\r\n end", "title": "" }, { "docid": "f4c95cfb3879d89f528033f7d8241424", "score": "0.64935833", "text": "def source=(source)\n if source.respond_to?(:source_descriptors)\n descriptors = source.source_descriptors\n @source = descriptors[:path]\n\n descriptors[:tags].each { |t| tag(t) }\n\n [:file, :line].each do |param|\n next unless descriptors[param]\n send(param.to_s + \"=\", descriptors[param])\n end\n else\n @source = source.to_s\n end\n end", "title": "" }, { "docid": "26fbfc6078ff321bbf45ad14aad06d10", "score": "0.64767975", "text": "def source\n end", "title": "" }, { "docid": "2ebc08e6511a63f5ba89cd1c74e4e0c7", "score": "0.64597166", "text": "def source_file\n source[:file]\n end", "title": "" }, { "docid": "f11f9684563bfa2f8b0adbd1998bbf57", "score": "0.64560175", "text": "def sources\n @sources ||= YAML.load(File.read(@sources_file))\n end", "title": "" }, { "docid": "2008e2722eeeeecdff2d83a1530cad81", "score": "0.6452607", "text": "def sources\n @sources.collect {|s| \"'#{s}'\"}\n end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "f2703cf5fb8818dd9734fe8bc6cf576d", "score": "0.6451715", "text": "def source; end", "title": "" }, { "docid": "5abfe98f7a0766cbdad5fcb05f2dbf6a", "score": "0.6451012", "text": "def sources\n package.sources.map do |x| \n Source.new(:label => x['name'], :resource => x['web'])\n end\n end", "title": "" }, { "docid": "eb94fb5ae44ff4d28b3195a35fd08265", "score": "0.6444957", "text": "def sources\n load_sources if @_sources.nil?\n @_sources\n end", "title": "" }, { "docid": "ef8b1110ac35d9fbc25484c177557f98", "score": "0.6437155", "text": "def source_file=(src)\n @source_file = src\n end", "title": "" }, { "docid": "b82e1f6dbf72fe384958936f2fb06e69", "score": "0.64312136", "text": "def support_multiple_source?; end", "title": "" }, { "docid": "664757f76b99d4f06c9d306bf76c6bb2", "score": "0.64297736", "text": "def available_sources(format = false)\n path_root = File.expand_path(File.dirname(__FILE__))\n sources = Dir[path_root+\"/sources/*.rb\"].map{ |s|\n name = s.split(\"/\").last.gsub(/\\.rb/, \"\")\n name\n }\n\n # Remove arguments (Hack?) We don't want anybody to touch tihs one.\n sources.delete(\"arguments\")\n if format\n # Add a star to denote enabled sources\n format_sources(sources)\n else\n sources\n end\n end", "title": "" }, { "docid": "dfc04498678cbb73d629d4a2e7079f30", "score": "0.64229435", "text": "def sources\n self[:sources]\n end", "title": "" }, { "docid": "36fa55fa5406c1dc757000e3391c2568", "score": "0.64210904", "text": "def src_for(filename)\n filename = File.expand_path filename\n @sources.src_for(filename, @env)\n end", "title": "" }, { "docid": "184562259f373ad4fb704dd659d47fd0", "score": "0.64092344", "text": "def source(options = {})\r\n end", "title": "" }, { "docid": "75783cff66cc4f5a2d72d260128f3af3", "score": "0.6405027", "text": "def add_sources(prj_fileid); end", "title": "" }, { "docid": "033b639c0973b5851fc4eecd635794f4", "score": "0.6403987", "text": "def link_file(source, *args); end", "title": "" }, { "docid": "28011353a6ccba9eaa683f8acc95494e", "score": "0.63985014", "text": "def sources\n @sources\n end", "title": "" }, { "docid": "811045954a961744e46dc62140fcefd4", "score": "0.6381336", "text": "def source_files\n @source_files ||= begin\n @sources\n .select { |file| File.file?(file) }\n .flat_map { |file| source_file_comments(file) }\n .map do |comment, file|\n Licensee::ProjectFiles::LicenseFile.new(comment, file)\n end\n end\n end", "title": "" }, { "docid": "16b8c8a0e5323cbb2e55bf8caa249df1", "score": "0.63738245", "text": "def scan_sources(source_files)\n end", "title": "" }, { "docid": "711f67e212516da125236b01f40e9660", "score": "0.63323444", "text": "def sources=(value)\n @sources = value\n end", "title": "" }, { "docid": "711f67e212516da125236b01f40e9660", "score": "0.63323444", "text": "def sources=(value)\n @sources = value\n end", "title": "" }, { "docid": "8b170a489ec1d7cfe69283516bca5b4e", "score": "0.6330204", "text": "def sources\n @config[\"sources\"].map { |d| File.expand_path(d) }\n end", "title": "" }, { "docid": "8a55ea6dfcd0cbf622c3321614a8009f", "score": "0.6327676", "text": "def sources\n (metadata['sources'] || []).map do |x| \n Source.new(:label => x['name'], :resource => x['web'])\n end\n end", "title": "" }, { "docid": "b3692fed91bf228f7cad8da7e22c6114", "score": "0.6327589", "text": "def sources=(new_value) # :nodoc:\n @sources = new_value\n end", "title": "" }, { "docid": "6ff7779f6ee9e423e83c4ed4b265f6b1", "score": "0.63246155", "text": "def append_sources(*args)\r\n sources.concat(args.flatten)\r\n invalidate_cache!\r\n end", "title": "" }, { "docid": "36aae599e8d5b4a70a3f34d35e870829", "score": "0.63006496", "text": "def source?; end", "title": "" }, { "docid": "36aae599e8d5b4a70a3f34d35e870829", "score": "0.63006496", "text": "def source?; end", "title": "" }, { "docid": "36aae599e8d5b4a70a3f34d35e870829", "score": "0.63006496", "text": "def source?; end", "title": "" }, { "docid": "36aae599e8d5b4a70a3f34d35e870829", "score": "0.63006496", "text": "def source?; end", "title": "" }, { "docid": "ef7f3012891e32569257caaafa572be1", "score": "0.63000375", "text": "def get_sources\n @sources\n end", "title": "" }, { "docid": "9311a88ebbca7ec6a886e4509bd7c9fa", "score": "0.6282024", "text": "def sources_from(source, progressor = nil, base_url=nil)\n reader = self.new(source)\n reader.base_file_url = base_url if(base_url)\n reader.progressor = progressor\n reader.sources\n end", "title": "" }, { "docid": "07734e5e6cc4ee2849de790e1b0b6e06", "score": "0.6273368", "text": "def sources\n @sources ||= Sources.new(raw_sources)\n end", "title": "" }, { "docid": "590eef27c6bd80da49e7fac846ee0377", "score": "0.62576824", "text": "def allow_sources(*sources)\n @config = { **config, allowed_sources: sources }\n end", "title": "" }, { "docid": "b464de721d614f04e5603a69e8c848c4", "score": "0.6252423", "text": "def source_paths; end", "title": "" }, { "docid": "b464de721d614f04e5603a69e8c848c4", "score": "0.6252423", "text": "def source_paths; end", "title": "" }, { "docid": "cd4b304e53a94726e1362078c6e8f6a4", "score": "0.6249295", "text": "def source_tag_urls\n urls 'source', 'src'\n end", "title": "" }, { "docid": "d03fd22267752d6ce0201493fae199ad", "score": "0.62338597", "text": "def sources\n [:ref, :set_stage, :working, :current, :in]\n end", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "a327a918e5b0d60f4cde4be780a2e8b7", "score": "0.0", "text": "def tablature_params\n params.permit(:name, :url, :description, :composer, :skill)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.69483954", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6902367", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6733912", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6717838", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6687021", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6676254", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.66612333", "text": "def filtered_parameters; end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6555296", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "7ac5f60df8240f27d24d1e305f0e5acb", "score": "0.6527056", "text": "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.6456324", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6450841", "text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.6450127", "text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6447226", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6434961", "text": "def valid_params?; end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.64121825", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "16e18668139bdf8d5ccdbff12c98bd25", "score": "0.64121825", "text": "def permitted_params\n declared(params, include_missing: false)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.63913447", "text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.63804525", "text": "def filter_parameters; end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.6373396", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.6360051", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6355191", "text": "def check_params; true; end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.62856233", "text": "def valid_params_request?; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.627813", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.62451434", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.6228103", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.6224965", "text": "def check_params\n true\n end", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.6222941", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.6210244", "text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "title": "" }, { "docid": "ff55cf04e6038378f431391ce6314e27", "score": "0.62077755", "text": "def additional_permitted_params\n []\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.61762565", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "0d980fc60b69d03c48270d2cd44e279f", "score": "0.61711127", "text": "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.6168448", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.6160164", "text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.61446255", "text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.6134175", "text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6120522", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "76d85c76686ef87239ba8207d6d631e4", "score": "0.6106709", "text": "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.60981655", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "2b19f8222e09c2518b0d19b4bf1f69d3", "score": "0.6076113", "text": "def list_params\n params.permit(:list_name)\n end", "title": "" }, { "docid": "aabfd0cce84d7f71b1ccd2df6a6af7c3", "score": "0.60534036", "text": "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "title": "" }, { "docid": "4f20d784611d82c07d49cf1cf0d6cb7e", "score": "0.60410434", "text": "def all_params; end", "title": "" }, { "docid": "5a96718b851794fc3e4409f6270f18fa", "score": "0.6034582", "text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "title": "" }, { "docid": "ff7bc2f09784ed0b4563cfc89b19831d", "score": "0.6029977", "text": "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "title": "" }, { "docid": "6c615e4d8eed17e54fc23adca0027043", "score": "0.6019861", "text": "def user_params\n end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "7402112b5e653d343b91b6d38c203c59", "score": "0.6019158", "text": "def params; end", "title": "" }, { "docid": "2032edd5ab9475d59be84bdf5595f23a", "score": "0.60184896", "text": "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "title": "" }, { "docid": "c59ec134c641678085e086ab2a66a95f", "score": "0.60157263", "text": "def permitted_params\n @wfd_edit_parameters\n end", "title": "" }, { "docid": "a8faf8deb0b4ac1bcdd8164744985176", "score": "0.6005857", "text": "def user_params\r\n end", "title": "" }, { "docid": "b98f58d2b73eac4825675c97acd39470", "score": "0.6003803", "text": "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.60012573", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.59955895", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.5994598", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.5993604", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "e4c37054b31112a727e3816e94f7be8a", "score": "0.5983824", "text": "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.5983166", "text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5977431", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "4d77abbae6d3557081c88dad60c735d0", "score": "0.597591", "text": "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "title": "" }, { "docid": "55d8ddbada3cd083b5328c1b41694282", "score": "0.5968824", "text": "def params_permit\n params.permit(:id)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.5965953", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.59647584", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.59647584", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "4e758c3a3572d7cdd76c8e68fed567e0", "score": "0.59566855", "text": "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "title": "" }, { "docid": "3154b9c9e3cd7f0b297f900f73df5d83", "score": "0.59506303", "text": "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "title": "" }, { "docid": "b48f61fbb31be4114df234fa7b166587", "score": "0.5950375", "text": "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "title": "" }, { "docid": "c4802950f28649fdaed7f35882118f20", "score": "0.59485626", "text": "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "5d64cb26ce1e82126dd5ec44e905341c", "score": "0.59440875", "text": "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.5930872", "text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "title": "" }, { "docid": "da4f66ce4e8c9997953249c3ff03114e", "score": "0.5930206", "text": "def argument_params\n params.require(:argument).permit(:name)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5925668", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.59235454", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "be01bb66d94aef3c355e139205253351", "score": "0.5917905", "text": "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.59164816", "text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "title": "" }, { "docid": "d6bf948034a6c8adc660df172dd7ec6e", "score": "0.5913821", "text": "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "title": "" }, { "docid": "eb5b91d56901f0f20f58d574d155c0e6", "score": "0.59128743", "text": "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "title": "" }, { "docid": "c6a96927a6fdc0d2db944c79d520cd99", "score": "0.5906617", "text": "def parameters\n nil\n end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.59053683", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "a743e25503f1cc85a98a35edce120055", "score": "0.59052664", "text": "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "title": "" }, { "docid": "533048be574efe2ed1b3c3c83a25d689", "score": "0.5901591", "text": "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "title": "" }, { "docid": "02a61b27f286a50802d652930fee6782", "score": "0.58987755", "text": "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.5897456", "text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "title": "" }, { "docid": "238705c4afebc0ee201cc51adddec10a", "score": "0.58970183", "text": "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.58942604", "text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "title": "" } ]
c46db66703aaaca363d593ee7c77c93d
Checks upper sign restrictions for all x items (if index not supplied) or just ind restriction for given item
[ { "docid": "45caf619354008b5a159f7b32d2b6d45", "score": "0.6538582", "text": "def upper_sign_restriction_apply?(x = plan.x, ind = nil)\n return x.to_f.lte? up_restr[ind] if ind\n x.to_a.flatten.zip(up_restr).all? do |x_item, restr_item|\n x_item.to_f.lte? restr_item\n end\n end", "title": "" } ]
[ { "docid": "326b1b4c91138d306d1b3ffe2af23510", "score": "0.5672331", "text": "def lower_sign_restriction_apply?(x = plan.x, ind = nil)\n return x.to_f.gte? low_restr[ind] if ind\n x.to_a.flatten.zip(low_restr).all? do |x_item, restr_item|\n x_item.to_f.gte? restr_item\n end\n end", "title": "" }, { "docid": "714d5a3b8888102788132427dc16fad4", "score": "0.54932034", "text": "def sign_restrictions_apply?(x = plan.x, ind = nil)\n lower_sign_restriction_apply?(x, ind) && upper_sign_restriction_apply?(x, ind)\n end", "title": "" }, { "docid": "6656031af8aa3c4227852ba03d784c70", "score": "0.54929715", "text": "def valid_index?(*index)\n index.all? do |ind| \n ([email protected]).include?(ind)\n end\n end", "title": "" }, { "docid": "3900880738b63a9eb8fc13e83814ee35", "score": "0.5478261", "text": "def validate_indices(item, indices)\n indices.each do |index|\n validate_index(item, index)\n end\n end", "title": "" }, { "docid": "2beb0fb9daabd9a3f42df078d1c126a1", "score": "0.5460318", "text": "def validate_item( x )\n raise InternalError.new( \"#{self.class}.validate_item() not implemented!\" )\n end", "title": "" }, { "docid": "bfd799fda2b0e01c95195a6f1c66b43c", "score": "0.545617", "text": "def check_index(index)\n end", "title": "" }, { "docid": "bfd799fda2b0e01c95195a6f1c66b43c", "score": "0.545617", "text": "def check_index(index)\n end", "title": "" }, { "docid": "da9fdeb21177af0731ab9b04ddb1e806", "score": "0.5454251", "text": "def unmatched_actual_indexes=(_); end", "title": "" }, { "docid": "04c3a4436a459ed90fa1f5c63ada8a13", "score": "0.5434878", "text": "def allowed; index; end", "title": "" }, { "docid": "4127cf91c57c9e13dba43c07410a16fe", "score": "0.54220456", "text": "def __assert_bounds(i, j)\n\t\tif i < 0 || i >= @row_count || j < 0 || j >= @column_count\n\t\t\traise IndexError.new(\"index out of bounds for #{@row_count}x#{@column_count}: #{i},#{j}\")\n\t\tend\n\t\treturn\n\tend", "title": "" }, { "docid": "49ab7e134c34f2ed66c034c91ca1ec71", "score": "0.5347656", "text": "def unmatched_expected_indexes=(_); end", "title": "" }, { "docid": "e01d62f6d3c05415c676a88e74f069bb", "score": "0.5342028", "text": "def valid_index?(index)\n ([email protected]).include?(index)\n end", "title": "" }, { "docid": "697c5e6190d54c4df22c1c6dfc5ec5d7", "score": "0.5327959", "text": "def solution(items, index, default_value)\n items.count >= index.abs ? items[index] : default_value\nend", "title": "" }, { "docid": "0c007fc7d8832c8bb53962aa8e25d838", "score": "0.5291181", "text": "def validate_items(entered_items)\n wrong_items = entered_items.keys - BASE_ITEM_PRICES.keys\n raise \"Item(s) #{wrong_items} are invalid. Please try again.\" unless wrong_items.empty?\nend", "title": "" }, { "docid": "e2c9f29c9b9a49be0d88883fcf0a8536", "score": "0.52341574", "text": "def check_index(index)\n raise \"index out of bounds\" unless index >=0 && index < @length\n end", "title": "" }, { "docid": "c90c01043fd12ce6aff85c817a01f6f5", "score": "0.5217095", "text": "def invalid_items\n return @invalid_items if @invalid_items\n\n items = @input.select { |k, v| validate_invalid?(k, v) if all_items.include?(k) }\n case @called_method\n when :entry_tran, :re_exec_tran, :change_tran\n unless (1..9_999_999).include?(@input[:amount].to_i + @input[:tax].to_i)\n items[:amount] = @input[:amount] if @input[:amount]\n items[:tax] = @input[:tax] if @input[:tax]\n end\n when :entry_tran_btc\n unless (1..300_000).include?(@input[:amount].to_i + @input[:tax].to_i)\n items[:amount] = @input[:amount] if @input[:amount]\n items[:tax] = @input[:tax] if @input[:tax]\n end\n end\n @invalid_items = items\n end", "title": "" }, { "docid": "acd570bbc417bcf8059700fe786a1e49", "score": "0.5213993", "text": "def indexes_satisfy_conditions(arr, lower, upper, indexL, indexU)\n ((0 <= indexL) and (indexL <= indexU) and (indexU <= (arr.length-1))) and\n ((lower <= arr[indexL]) and (arr[indexL] <= arr[indexU]) and (arr[indexU] <= upper))\nend", "title": "" }, { "docid": "ad85e2fa8c207f6b09fcaf28006bcc96", "score": "0.5191033", "text": "def upper_or_smaller(index)\n if (index >= 65 && index <= 90) \n return 1\n elsif (index >= 97 && index <= 122)\n return 2\n else\n return 3\n end\nend", "title": "" }, { "docid": "6aabbea812a3125341a1ba0658dc0f38", "score": "0.5150888", "text": "def valid_index?(index)\n return true if index < self.items.length\n false\n end", "title": "" }, { "docid": "9b4ca028877f202de1e9ff77b7918676", "score": "0.5115371", "text": "def check_index(index)\n unless (index >= 0) && (index < length)\n raise \"index out of bounds\"\n end\n end", "title": "" }, { "docid": "c88d3e16f7aa49978b4b7ea8435b7c5d", "score": "0.5109616", "text": "def position_taken?(arr, ind)\n if(arr[ind]==\"X\"||arr[ind]==\"O\")\n true\n else\n false\n end\nend", "title": "" }, { "docid": "8ea6270b5a6a5c6f8fdcd7f4739f2524", "score": "0.5074666", "text": "def valid_index?(index)\n index >= 0 && index < self.length\n end", "title": "" }, { "docid": "07f2995871388a5a540c17b5a108def8", "score": "0.50718004", "text": "def reduce_item?\n position.negative? # Either -1 or -2\n end", "title": "" }, { "docid": "ed869959595283b70b3d629b95b12f63", "score": "0.5065054", "text": "def unmatched_actual_indexes; end", "title": "" }, { "docid": "728539a543264f569ef448c47210c7dd", "score": "0.5061519", "text": "def implcRule(busIdx, cNets, allGridArr, acceptSizArr, allPairHashArr)\n tmpCNetCellID = -1;\n for i in 0..allGridArr[busIdx].size-1\n for j in 0..allGridArr[busIdx][i].size-1\n if i >= acceptSizArr[busIdx] && allPairHashArr[busIdx].has_key?(i)\n $hardClauseBuffer << \"-#{allGridArr[busIdx][i][j]} #{cNets[busIdx][allPairHashArr[busIdx][i]+1][0]} 0\\n\";\n $hardClauseCounter += 1;\n tmpCNetCellID = cNets[busIdx][allPairHashArr[busIdx][i]+1][0];\n elsif i >= acceptSizArr[busIdx]\n $hardClauseBuffer << \"-#{allGridArr[busIdx][i][j]} #{cNets[busIdx][i+1][0]} 0\\n\";\n $hardClauseCounter += 1;\n tmpCNetCellID = cNets[busIdx][i+1][0];\n end\n if j > acceptSizArr[busIdx] && allPairHashArr[busIdx].has_key?(j-1) && tmpCNetCellID != cNets[busIdx][allPairHashArr[busIdx][j-1]+1][0]\n $hardClauseBuffer << \"-#{allGridArr[busIdx][i][j]} #{cNets[busIdx][allPairHashArr[busIdx][j-1]+1][0]} 0\\n\";\n $hardClauseCounter += 1;\n elsif j > acceptSizArr[busIdx] && tmpCNetCellID != cNets[busIdx][j][0]\n $hardClauseBuffer << \"-#{allGridArr[busIdx][i][j]} #{cNets[busIdx][j][0]} 0\\n\";\n $hardClauseCounter += 1;\n end\n end\n end\nend", "title": "" }, { "docid": "242999b51e3c7aa47f298222749344e8", "score": "0.50592566", "text": "def check_row_index(i)\n unless 0 <= i and i < rows\n raise IndexError, \"column index out of bounds\"\n end\n end", "title": "" }, { "docid": "32cd8560ec1f6f4ba4d46f45600ab111", "score": "0.5059096", "text": "def bounds_check(index)\n\t\traise \"Sorry, there's nothing in our Linked List\" if @size == 0\n\t\traise \"Sorry, the index you provided is invalid\" if index < 0 || index > @size\n\tend", "title": "" }, { "docid": "bba3862a4ae21353e1e31c34d78102dc", "score": "0.5031734", "text": "def item_rule(item)\n index.search('material-type' => item.material_type.id,\n 'loan-type' => item.loan_type.id,\n 'location-institution' => item.effective_location.institution.id,\n 'location-campus' => item.effective_location.campus.id,\n 'location-library' => item.effective_location.library.id,\n 'location-location' => item.effective_location.id)\n end", "title": "" }, { "docid": "633045593bba277fdc0bbc9b5a1199da", "score": "0.5005929", "text": "def indeterminate_expected_indexes=(_); end", "title": "" }, { "docid": "8350514fdef7e14c10ab9997d9be8ec4", "score": "0.49379313", "text": "def range_correct_index( at )\n index = at\n# index = self.length + at if at < 0\n raise \"index not integer #{at.class}\" unless at.is_a?(::Integer)\n raise \"index must be positive , not #{at}\" if (index < 0)\n raise \"index too large #{at} > #{self.length}\" if (index >= self.length )\n return index + Word.type_length * 4\n end", "title": "" }, { "docid": "cb658b2dfbcf872f646c6545e4be15e9", "score": "0.4930312", "text": "def test_050_each_with_index()\n return unless (BitString.new.respond_to?(:each_with_index))\n TestVals.each do |sVal|\n #\n # Unbounded first..\n #\n bs = BitString.new(sVal)\n bs.each_with_index do |val,pos|\n assert_equal(sVal[-1-pos,1],\n val.to_s,\n \"Test unbounded '#{sVal}'.each_with_index\" +\n \"(#{val},#{pos}) == #{sVal[-1-pos,1]}\")\n end\n #\n # Now bounded strings.\n #\n bs = BitString.new(sVal, sVal.length)\n bs.each_with_index do |val,pos|\n assert_equal(sVal[-1-pos,1],\n val.to_s,\n \"Test bounded '#{sVal}'.each_with_index\" +\n \"(#{val},#{pos}) == #{sVal[-1-pos,1]}\")\n end\n end\n end", "title": "" }, { "docid": "2eba910762f6df0bc2db4bc10e6bc677", "score": "0.49296415", "text": "def validate_index(item, index)\n unless valid_index?(item, index)\n raise \"Missing digest field #{index.capitalize}\"\n end\n end", "title": "" }, { "docid": "595644d4ff3d94bd6d6fdf68c9aec10a", "score": "0.49225274", "text": "def check_column_index(i)\n unless 0 <= i and i < columns\n raise IndexError, \"column index out of bounds\"\n end\n end", "title": "" }, { "docid": "49d12158f86e5992ae8dbde075e8d8cb", "score": "0.49172166", "text": "def conform input_indexes\n return self if input_indexes[0].is_a? Range\n drop_left_level input_indexes.size\n end", "title": "" }, { "docid": "49d12158f86e5992ae8dbde075e8d8cb", "score": "0.49172166", "text": "def conform input_indexes\n return self if input_indexes[0].is_a? Range\n drop_left_level input_indexes.size\n end", "title": "" }, { "docid": "49d12158f86e5992ae8dbde075e8d8cb", "score": "0.49172166", "text": "def conform input_indexes\n return self if input_indexes[0].is_a? Range\n drop_left_level input_indexes.size\n end", "title": "" }, { "docid": "34e551cd91629baa9b6b1293bcca4a23", "score": "0.48882434", "text": "def check_victory\n\t\tset_nonrows\n\t\tvic_array = [@a, @b, @c, @col1, @col2, @col3, @diag1, @diag2]\n\t\tvic_array.each { |arr| (@victory = true if arr.min == arr.max) unless arr.include? \"_\" }\n\tend", "title": "" }, { "docid": "9c3af01f1648db801e6c9817b6ea2a1d", "score": "0.48707458", "text": "def index_exist(item_no)\n @items.length >= item_no\n end", "title": "" }, { "docid": "f0a87acf2f47068dc8c57299056d9fe6", "score": "0.4868069", "text": "def check_presence(item, position, code, remaining_code_items)\n return 'x' unless remaining_code_items.include?(item)\n\n actual_position = code.find_index(item)\n position == actual_position ? '+' : '-'\n end", "title": "" }, { "docid": "68a6a863f3ffe983febf88de32c10484", "score": "0.48663542", "text": "def check_spelling\n check_range(*bounds)\n end", "title": "" }, { "docid": "59789091920bd814b8756c7132d7648a", "score": "0.4866209", "text": "def allowed(index)\n bits = 511\n coordinate_systems.each do |c|\n axis_index = first_axis_index(index)\n bits &= axis_missing(axis_index, c)\n end\n bits\n end", "title": "" }, { "docid": "ef9cc33943d240ac76a986c153745481", "score": "0.4860181", "text": "def solution(items, index, d=default_value)\n if index < items.length-1 && index >= 0\n items[index]\n elsif (index < 0) && (index >= items.length * -1)\n items[index]\n else\n d\n end\nend", "title": "" }, { "docid": "ba83892ff90629ce36da24b75bf8a65a", "score": "0.48557475", "text": "def check_for_menu_items(columns,orders)\n\n columns = columns.map{|col| col.strip.downcase }\n if (columns[2,columns.size-2] & orders).size > 0\n store_item_info(columns.first,columns[1],columns[2,columns.size-2])\n end\n\n end", "title": "" }, { "docid": "7afbda94f42a5adb11d4e110aba5005f", "score": "0.48547724", "text": "def check_index_elements_calculated!\n unless index_elements.size > 0\n raise \"primary access rights not calculated. instantiate by calling '.parse(xml, forindex = true)'.\"\n end\n end", "title": "" }, { "docid": "0698083bc4a4639bee49d03b0c4817ce", "score": "0.48527035", "text": "def is_within_bounds(x)\n i = 2\n CSV.foreach(x, headers: true) do |row|\n j = 1\n if !row['Instructor Email'].nil? and row['Instructor Email'].length >=255\n flash[:alert] = \"String too big for Instructor Email. Row: \" + i.to_s \n false\n return\n end\n for value in row do\n if value[1].nil? \n elsif value[1].instance_of?(String)\n if value[1].match(/^(\\d)+$/)\n if value[1].to_i > 2147483646\n flash[:alert] = \"Number out of bounds Row: \" + i.to_s + \" Columnn:\" + j.to_s\n false\n return \n end\n else\n if value[1].length > 30000\n flash[:alert] = \"String too big Row: \" + i.to_s + \" Columnn:\" + j.to_s\n false\n return\n end \n end\n else\n flash[:alert] = \"Can't read Row: \" + i.to_s + \" Columnn:\" + j.to_s\n false\n return\n end\n j= j + 1\n end\n i = i + 1\n end\n\n true\n end", "title": "" }, { "docid": "a8c74f6dd78785bb0585713da973f1fa", "score": "0.48509768", "text": "def preconditions\n !index.unique\n end", "title": "" }, { "docid": "5d0387aa352e4a621fbea0584c11fb02", "score": "0.48432314", "text": "def index_rogue\n @alt_items = []\n VALID_SLOTS.each do |i|\n @alt_items += Item.where(:\"properties.equip_location\" => i, :item_level.gte => 530).desc(:item_level).all\n end\n\n # This is really haxy, but it's flexible.\n bad_keys = %w\"intellect spell_power spirit parry dodge bonus_armor\"\n bad_classes = %w\"Plate Mail\"\n @alt_items.reject! {|item| !(item.properties['stats'].keys & bad_keys).empty? }\n # don't reject trinkets with empty stats\n @alt_items.reject! {|item| item.properties['stats'].empty? and item.properties['equip_location'] != 12}\n # Reject plate and mail items altogether\n @alt_items.reject! {|item| bad_classes.include? item.properties['armor_class'] }\n # only allow cloth items in back slots (16 is the slot in API data for backs)\n @alt_items.reject! {|item| item.properties['armor_class'] == \"Cloth\" && item.properties['equip_location'] != 16 }\n # reject items which are upgraded versions but are not allowed\n @alt_items.reject! {|item| !item.properties['upgradable'] and [1,2,3,4,5,6].include? item.properties['upgrade_level'] }\n # reject blue items with an upgrade level >= 2\n @alt_items.reject! {|item| item.properties['quality'] == 3 and [2,3,4,5,6].include? item.properties['upgrade_level'] }\n\n # Get all gems, enchants, talents, and artifact relics\n @gems = Item.where(:is_gem => true, :item_level.gt => 87).all\n @gems.reject! {|g| !(g.properties['stats'].keys & bad_keys).empty? }\n @enchants = Enchant.all\n @talents = Talent.all\n @relics = Relic.all\n @artifacts = Artifact.all\n\n @relic_items = Item.where(:is_gem => true, :item_level.gt => 87, :\"properties.gem_slot\".ne => \"Prismatic\").all\n\n @item_bonuses = WowArmory::Item.item_bonuses\n @item_descriptions = WowArmory::Item.item_name_description\n @rand_prop_points = rand_prop_points\n end", "title": "" }, { "docid": "02c94612e87b91728ee2a5d735ee1d1e", "score": "0.48426333", "text": "def valid? *indexes\n indexes.all? { |i| to_a.include?(i) || (i.is_a?(Numeric) && i < size) }\n end", "title": "" }, { "docid": "02c94612e87b91728ee2a5d735ee1d1e", "score": "0.48426333", "text": "def valid? *indexes\n indexes.all? { |i| to_a.include?(i) || (i.is_a?(Numeric) && i < size) }\n end", "title": "" }, { "docid": "65c8c4628be05bae66b2d401eec8c8c5", "score": "0.48361254", "text": "def out_of_bounds?; end", "title": "" }, { "docid": "cd423bc2e4b3e07a677140a347cd5184", "score": "0.48299617", "text": "def unmatched_expected_indexes; end", "title": "" }, { "docid": "bfff5e64bcef7abf5add8b7578e44cb9", "score": "0.48279643", "text": "def check_options(index)\n options = @choices.dup\n row = calculate_row(index)\n column = calculate_column(index)\n box = calculate_box(index) \n options - [\".\"] - @rows[row] - @columns[column] - @boxes[box] \n end", "title": "" }, { "docid": "5949aa98f1dd42021c845790c9080b1c", "score": "0.48177817", "text": "def check_index(index)\n return true if index >= @length\n end", "title": "" }, { "docid": "0e7ab5fbbd1f6bc9ed1bfc548c420fe3", "score": "0.48161837", "text": "def unfit_kappas_with_indices\n @unfit_kappas_with_indices ||= kappa_b_ary.zip_indices.find_all do |a, ind|\n !sign_restrictions_apply?(a, basis_indexes[ind]) #ind now is index of basis var in basis; should be var number\n end\n end", "title": "" }, { "docid": "2fbc323bce6a335f060878d72f8af0db", "score": "0.4809172", "text": "def score_is_double(idx)\n (idx >= 21 and idx <= 40) or idx == 62\nend", "title": "" }, { "docid": "c2d4341b76df0712b981b4a6f1bd7e8e", "score": "0.48072755", "text": "def outside_x_bounds?(x, w)\n\t\tx + w < 0 || x > @width\n\tend", "title": "" }, { "docid": "b423d32e5a02cfe0383bac408b4207ad", "score": "0.4804912", "text": "def test_item_at\n assert_equal(@todo1, @list.item_at(0))\n assert_equal(@todo2, @list.item_at(1))\n assert_equal(@todo3, @list.item_at(2))\n assert_raises(IndexError) { @list.item_at(1000) }\n end", "title": "" }, { "docid": "04015fd8c5c1d73a4708756487297c6d", "score": "0.480441", "text": "def aged_brie_or_backstage_passes_items(item)\r\n modify_quality(item, true, 1)\r\n\r\n if item.name.downcase == \"Backstage passes to a TAFKAL80ETC concert\".downcase\r\n if item.sell_in < 11\r\n modify_quality(item, true, 1)\r\n end\r\n \r\n if item.sell_in < 6\r\n modify_quality(item, true, 1)\r\n end\r\n end\r\n\r\n update_sell_in_value(item)\r\n end", "title": "" }, { "docid": "2c7c0ad40811e1aff33dd1deae2801cb", "score": "0.47834653", "text": "def check_limits(start_index, end_index, limit)\n check_upper_limit(start_index, limit)\n check_upper_limit(start_index, end_index)\n check_upper_limit(end_index, limit + 1)\n end", "title": "" }, { "docid": "0de1cb931ad1a812e6bf38c851edbd02", "score": "0.47601762", "text": "def position_taken?(array, index_number)\n if array[index_number] == \"X\" || array[index_number] == \"O\"\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "af99cf922bcee52bc05258b69fb37363", "score": "0.474993", "text": "def valid_index?(index)\n\t\t\tindex = index.to_i\n\t\t\tindex.between?(1,cells.length)\n\t\tend", "title": "" }, { "docid": "8540f9c6c06e2177c94c86ba145bba8c", "score": "0.4749128", "text": "def valid_index(idx)\n\t\tidx = 0 if idx < 0 \n\t\tidx = @list.size -1 if idx >= @list.size\n\t\treturn idx\n\tend", "title": "" }, { "docid": "a778f8ded68361f7c6f623a3b40523cf", "score": "0.47395605", "text": "def allowed?(item)\n true\n end", "title": "" }, { "docid": "737f160a2f7dca291712b6d78974b5df", "score": "0.47372162", "text": "def position_taken?(board,index)\n board[index].upcase == \"X\" || board[index].upcase == \"O\"\nend", "title": "" }, { "docid": "dc25b2f548d1dafbe11b356d80a5e830", "score": "0.47353455", "text": "def check_index_permission\n raise ExceptionTypes::UnauthorizedError.new(\"You do not have permission to view all organizations\") unless current_user.super_admin?\n end", "title": "" }, { "docid": "983387b71df3a976702c3edb2b60f916", "score": "0.47347304", "text": "def position_taken?(array, index)\n if (array[index] == 'X' || array[index] == 'O')\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "b69e88a2b8ccae909a0810b193c74543", "score": "0.4721936", "text": "def can_i_sell?(item, amount)\n (list[item.to_sym].to_i - amount >= 0)\n end", "title": "" }, { "docid": "a751282b7bbc195d60eb255c4b5eaf13", "score": "0.47202852", "text": "def check_range_parameters(meta_data, indices)\n first_lesser_second?(indices)\n\n parameter_in_meta_range?(meta_data, indices)\n end", "title": "" }, { "docid": "7877cd15b08ee079d3b7cafaacee8022", "score": "0.4716609", "text": "def bounds_check\n r,c = rowcol\n @current_index = 0 if @current_index < 0\n @current_index = @content_rows-1 if @current_index > @content_rows-1\n $status_message.value = \"visible #{@prow} , #{@current_index} \"\n unless is_visible? @current_index\n if @prow > @current_index\n $status_message.value = \"1 #{@prow} > #{@current_index} \"\n @prow -= 1\n else\n end\n end\n #end\n check_prow\n $log.debug \"XXX: PAD BOUNDS ci:#{@current_index} , old #{@oldrow},pr #{@prow}, max #{@maxrow} \"\n @crow = @current_index + r - @prow\n @crow = r if @crow < r\n # 2 depends on whetehr suppressborders\n @crow = @row + @height -2 if @crow >= r + @height -2\n setrowcol @crow, nil\n if @oldrow != @prow || @oldcol != @pcol\n @repaint_required = true\n end\n end", "title": "" }, { "docid": "0c4ae6239906993c17453174d1b39880", "score": "0.47126693", "text": "def valid_index?(index)\n return false if index<0 || index>=self.size\n return true\n end", "title": "" }, { "docid": "e8f2db34b7ffab4f72346048c2e9b8cc", "score": "0.47089002", "text": "def check_irregularities(args)\n stem = args[:stem]\n if stem.match(irregular_adverbs)\n args[:irregular_adverb] = true\n new_stem = select_adverb_stem($1)\n add(create_stem(:adverb, args.merge(stem: new_stem)))\n end\n end", "title": "" }, { "docid": "7c41d8e12fa15e0bf192aca2ef82abd4", "score": "0.47034302", "text": "def validate_between(item, lower_bound, upper_bound)\n\t\titem = item.to_i\n\t\tif (item < lower_bound) || (item > upper_bound)\n\t\t\traise ActionController::RoutingError, 'Not Found'\n\t\tend\n\t\titem\n\tend", "title": "" }, { "docid": "f95534b4eca2434367bedc3abe4bf055", "score": "0.47008395", "text": "def check_field\n reset_cursor\n subject = BattleManager.actor\n item = subject.input.item\n scopes = item.scopes\n @range_type = scopes[:range_type]\n @range_item = scopes[:range]\n @area_type = scopes[:area_type] ? scopes[:area_type] : :single\n @area_size = scopes[:area_size]\n e_array = $game_temp.grid[0].collect {|tile| tile.get_unit}\n origin = subject.last_position\n #CHECK RESTRICTIONS\n @item_range = 0 if scopes[:target_conditions].include?(:self_only)\n @selectable_region = Grid.base_region(origin,@range_type,@range_item,@area_type,@area_size)\n scopes[:target_conditions].each {|condition|\n case condition\n when :position_selectable\n @position_selectable = true\n when :self_only\n @self_only = true\n when :not_self\n @not_self = true\n when :dead_only\n @dead_only = true\n when :alive_only\n @alive_only = true\n when :no_cursor\n @no_cursor = true\n when :edge_limited\n @restrict[0] = true\n when :row_block\n @row_block = true\n greyout_blockers\n when :front_only\n @selectable_region = cut_behind(@selectable_region)\n end\n } #~ each condition\n if scopes[:target_conditions].include?(:team_unlimited)\n @restrict[1] = true if item.for_friend?\n @restrict[2] = true if item.for_opponent?\n else\n #@total_range_region = @selectable_region.dup\n @selectable_region -= Grid.ally_spaces if item.for_opponent?\n @selectable_region -= Grid.enemy_spaces if item.for_friend?\n end\n @restrict[1] = true if @range_type == :allies\n @restrict[2] = true if @range_type == :enemies\n #Change \"origin\" to enemy position if for enemy\n if item.for_opponent?\n origin = @selectable_region[0]\n @selectable_region.each do |tile| \n origin = tile ; break if $game_temp.grid[0][tile].get_unit\n end\n end\n optimal_types = [:row,:col,:expand,:cross,:x,:row_back]\n if optimal_types.include?(@area_type) && item.for_opponent?\n origin = get_optimal_origin(@selectable_region,@area_type,@area_size)\n end\n Grid.hide_outside_region(@selectable_region)\n make_area_field(origin)\n check_targeting\n blink_selected_units\n @grid_arrow.hide_indicator\n @help_window.show\n set_help_window\n @grid_arrow.show_arrow unless @no_cursor\n end", "title": "" }, { "docid": "f609cf4a9b4a17876a4a5719779be98c", "score": "0.4700591", "text": "def inbounds?(sqr)\n sqr[0] >= 0 && sqr[1] >= 0 && sqr[0] < @seats.length && sqr[1] < @seats[0].length\n end", "title": "" }, { "docid": "6a2d90fa058605142853af384109c101", "score": "0.46929714", "text": "def conforming_item?(item)\n present_and_empty?(item[1]) ||\n present_not_empty_but_first_empty?(item[1]) ||\n present_not_empty_and_not_custom?(item[1])\n end", "title": "" }, { "docid": "8e79e5072d768f6a3c49eed0e260261d", "score": "0.4690739", "text": "def validation_of_user_input\n if @element.between?(1,9) && @row.between?(1,9) && @column.between?(1,9)\n return 1\n else\n return 0\n end\n end", "title": "" }, { "docid": "7c4714676bc89def69883e4eda4393e0", "score": "0.46892914", "text": "def noninteger_vars_with_indices(current_plan)\n current_plan.x_ary.each_with_index.find_all do |value, idx| \n integer_restrictions.include?(idx) && !value.int?\n end\n end", "title": "" }, { "docid": "372a2c66e422fc97389e413c789da46e", "score": "0.46838194", "text": "def item_check(item)\n if item.is_a?(Integer) then\n if item >= @min_item\n if item <= @max_item\n return true\n end\n end\n end\n return false\n end", "title": "" }, { "docid": "e62be2c0f88bcfab4947729c677fe2c3", "score": "0.46672356", "text": "def is_normal_item(item)\n return item.name != AGED_BRIE && item.name != BACKSTAGE && item.name != SULFURAS && item.name != CONJURED\n end", "title": "" }, { "docid": "8977c54a1ac0a637476bd49d81bf1578", "score": "0.4662384", "text": "def check_bounds(val)\n !(val > UPPER_BOUND || val < LOWER_BOUND)\n end", "title": "" }, { "docid": "20382a3d5e08d502a07b5c6d5bde60fc", "score": "0.46590564", "text": "def assert_x!(x)\n unless include_x?(x)\n raise ChunkyPNG::OutOfBounds, \"Column index #{x} out of bounds!\"\n end\n true\n end", "title": "" }, { "docid": "dcbe44758b7325fecfda13ba652fa961", "score": "0.46449316", "text": "def position_taken?(array, index)\n if array[index] == 'X' || array[index] == 'O'\n true\n elsif array[index] == nil\n false\n elsif array[index] == \" \" || array[index] == \"\"\n false\n end\nend", "title": "" }, { "docid": "4da3883c3896fa4c283ee149bc61f9cd", "score": "0.46363336", "text": "def position_taken?(array, position)\n array[position] == \"X\" || array[position] == \"O\"\nend", "title": "" }, { "docid": "d95184019b3b16d9dac683e3988bbacd", "score": "0.4634481", "text": "def conform input_indexes\n self\n end", "title": "" }, { "docid": "24aba7218231e232ddb9de9349cd50fe", "score": "0.46307826", "text": "def violateBoxConstraint (t, i, j, value)\n\tviolate = false\n\tif ((i < 3) && (j < 3))\n\t\t# top left block\n\t\tfor p in 0..2\n\t\t\tfor q in 0..2\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telsif ((i < 3) && (j >= 3) && (j < 6))\n\t\t# top middle block\n\t\tfor p in 0..2\n\t\t\tfor q in 3..5\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telsif ((i < 3) && (j >= 6))\n\t\t# top right block\n\t\tfor p in 0..2\n\t\t\tfor q in 6..8\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telsif ((i >= 3) && (i < 6) && (j < 3))\n\t\t# middle left block\n\t\tfor p in 3..5\n\t\t\tfor q in 0..2\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telsif ((i >= 3) && (i < 6) && (j >= 3) && (j < 6))\n\t\t# middle middle block\n\t\tfor p in 3..5\n\t\t\tfor q in 3..5\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telsif ((i >= 3) && (i < 6) && (j >= 6))\n\t\t# middle right block\n\t\tfor p in 3..5\n\t\t\tfor q in 6..8\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telsif ((i >= 6) && (j < 3))\n\t\t# bottom left block\n\t\tfor p in 6..8\n\t\t\tfor q in 0..2\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telsif ((i >= 6) && (j >= 3) && (j < 6))\n\t\t# bottom middle block\n\t\tfor p in 6..8\n\t\t\tfor q in 3..5\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telsif ((i >= 6) && (j >= 6))\n\t\t# bottom right block\n\t\tfor p in 6..8\n\t\t\tfor q in 6..8\n\t\t\t\tif (((p != i) || (q != j)) && (t[p][q] == value))\n\t\t\t\t\tviolate = true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tviolate\nend", "title": "" }, { "docid": "2414552641db0e6884c478f2e545957f", "score": "0.46271583", "text": "def check_bounds(start_block, block_count)\n raise \"Negative starting block\" if start_block < 0\n raise \"Non-positive block count\" if block_count <= 0\n raise \"Out of bounds\" if self.block_count < start_block + block_count \n end", "title": "" }, { "docid": "4726e0e5917a8a958796f1b93f3497d8", "score": "0.46266127", "text": "def indeterminate_actual_indexes=(_); end", "title": "" }, { "docid": "02b7e5fb45ac1e0ccf58fc7c907ddeee", "score": "0.46250606", "text": "def ignore? index\r\n return NO_MATCH if index == NO_MATCH # allow users to not check results of a sequence\r\n return index if @ignoring || ignore_productions.nil?\r\n @ignoring = true\r\n ignore_productions.each do |prod|\r\n index = allow? prod, index\r\n end\r\n @ignoring = nil\r\n index\r\n end", "title": "" }, { "docid": "847e3a2bb69ef19b644a321a0e39c501", "score": "0.46224344", "text": "def get_valid_ipos_for_boundary(index)\n i_pos = positive_array_index_checked(index, @array)\n raise ArgumentError, \"Index #{index} specified was for Para, which should be for Boundary.\" if index_para?(i_pos, accept_negative: false)\n (i_pos > size - 1) ? nil : i_pos\n end", "title": "" }, { "docid": "9c981fb86f56aaa2e82d872a9e3e375e", "score": "0.46202514", "text": "def mark_should_not_be_negative_except_na_and_absent\n hsh = mark_columns_with_subject_ids\n hsh.each do |sub_id, col_name|\n val = self.send(col_name)\n if val && (val != NA_MARK_NUM) && (val != ABSENT_MARK_NUM) && (val < 0)\n errors.add(col_name, \"no negatives\") \t\n end\n end \t\n end", "title": "" }, { "docid": "913d1a245bb8624acfce15e6474b014b", "score": "0.46179864", "text": "def position_taken?(array,index)\n if array[index] == \"\" || array[index] == \" \" || array[index] == nil\n return false\n elsif array[index] == \"X\" || array[index] == \"O\"\n return true\n end\nend", "title": "" }, { "docid": "914665f46424acdeb13580d3683d90bb", "score": "0.46163043", "text": "def index_adjust(new_index)\n\tif new_index > 25\n\t\treturn new_index - 26\n\telsif new_index < 0\n\t\treturn new_index + 26\n\telse\n\t\treturn new_index\n\tend \nend", "title": "" }, { "docid": "f759d806b257df517f2f3c0ca1983ef9", "score": "0.4615555", "text": "def negative_index?\n index && index < 0\n end", "title": "" }, { "docid": "3f9d35e76aa3c1322f8c726ef8e40ea5", "score": "0.46139598", "text": "def _normalize_index(ix)\n ix += self.size if ix<0\n ix\n end", "title": "" }, { "docid": "fcc5836c66e34514868635373853f603", "score": "0.4610188", "text": "def validate_cell_u(v); end", "title": "" }, { "docid": "fcccf15ae1acf5ebe62487852aa855f2", "score": "0.46098113", "text": "def has_item(item)\n inventory.each_with_index do |couple, index|\n if (couple.first.name.casecmp(item.to_s) == 0)\n return index\n end\n end\n\n return\n end", "title": "" }, { "docid": "e25f77ac815991d0f172867d467ef96c", "score": "0.4602681", "text": "def absolute_index(index)\n (index>0)? \n ((index > 25)? absolute_index(index-=26): index) : \n ((index < -26)? absolute_index(index+=26): index)\n \nend", "title": "" }, { "docid": "221c29bfbf90ebf0db6126213c2d9785", "score": "0.45967957", "text": "def item_check(left, item, right)\n return item if left.nil?\n item + item_check(*left) - item_check(*right)\nend", "title": "" }, { "docid": "221c29bfbf90ebf0db6126213c2d9785", "score": "0.45967957", "text": "def item_check(left, item, right)\n return item if left.nil?\n item + item_check(*left) - item_check(*right)\nend", "title": "" }, { "docid": "7b269cea70e05a10ebba4b1ef22e8dcf", "score": "0.45954892", "text": "def is_indexed?(key)\n key.include?('materials') && key.length > 9 || key.include?('opening_hours') && key.length > 13\n end", "title": "" } ]
d69661c8bd4775ccec5c9c84f84ad13e
GET /weight_events GET /weight_events.json
[ { "docid": "78d6422e84ca88a83e26429511d3467c", "score": "0.7246602", "text": "def index\n @page = (params[:page].to_i > 0) ? params[:page].to_i : 1\n @per = (params[:per].to_i == 0) ? 100 : params[:per].to_i.clamp(1, 1000)\n\n @weight_events = WeightEvent.order(id: :desc).limit(@per).offset((@page - 1) * @per).all\n end", "title": "" } ]
[ { "docid": "5d24a46f570324fd5a4c29144b000b42", "score": "0.6273222", "text": "def set_weight_event\n @weight_event = WeightEvent.find(params[:id])\n end", "title": "" }, { "docid": "68ed11088389be43b322d4f0dc75f7d6", "score": "0.6131962", "text": "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "title": "" }, { "docid": "426874b51dde2b13de300f9ffa24469a", "score": "0.6120338", "text": "def index\n number = request.query_parameters.first[1].to_i\n respond_with Event.where(date_time: Date.current..(Date.current + number.days))\n end", "title": "" }, { "docid": "18bd811522c25a902f9e9f1f69d1e027", "score": "0.61111885", "text": "def weight_event_params\n params.require(:weight_event).permit(:label, :source, :value)\n end", "title": "" }, { "docid": "96bb6da8d10f13308701a0e794890e69", "score": "0.6054194", "text": "def update\n respond_to do |format|\n if @weight_event.update(weight_event_params)\n format.html { redirect_to @weight_event, notice: 'Weight event was successfully updated.' }\n format.json { render :show, status: :ok, location: @weight_event }\n else\n format.html { render :edit }\n format.json { render json: @weight_event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8405b7d2856e4c2ccb3468fff322c994", "score": "0.60075206", "text": "def index\n @event_type_answer_weights = EventTypeAnswerWeight.all\n end", "title": "" }, { "docid": "9f168aad32317f62155e352ff8af072a", "score": "0.6001821", "text": "def weight_on_date(date)\n get_call(\"/1/user/#{@user_id}/body/log/weight/date/#{format_date(date)}.json\")\n end", "title": "" }, { "docid": "9239035dd61578a2fd481f956e909f2e", "score": "0.5992801", "text": "def index\n @weight_logs = current_user.weight_logs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weight_logs }\n end\n end", "title": "" }, { "docid": "16a591b9783030049e51efb2002c53e2", "score": "0.59908706", "text": "def get_event_stats ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/stats\"\n end", "title": "" }, { "docid": "1441e7ef4d7d06ff6fd75c78aa82a3f8", "score": "0.5936397", "text": "def index\n @events = Event.all\n\n render json: @events, include: :talks\n end", "title": "" }, { "docid": "463f20e31c4c213c6cc985bc0c68be92", "score": "0.59284717", "text": "def index\n @weather_events = WeatherEvent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weather_events }\n end\n end", "title": "" }, { "docid": "3963988a2e369ae69d3e2e5e5e64680b", "score": "0.58745563", "text": "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "f49e5c498dd19a73abbea8842b47d303", "score": "0.5861524", "text": "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "f49e5c498dd19a73abbea8842b47d303", "score": "0.5861524", "text": "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "503c52c8507e6cd5116f3c85d6259631", "score": "0.582743", "text": "def index\n @event = Event.all\n render json: @event\n end", "title": "" }, { "docid": "a55e043fac5bb2a09e374ec2b2abec0e", "score": "0.5811687", "text": "def index\n @events = {\n total_number_events: Event.count,\n total_number_charges: EventCharge.count,\n total_cents_charges: EventCharge.total,\n own_events: EventDecorator.decorate(Event.active.where(owner: current_user)),\n joined_events: current_user.joined_events.active,\n trashed_events: current_user.events.trashed\n }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "2af3244b949e0148538956aee5580e4a", "score": "0.57581306", "text": "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event, methods: [:talks] }\n end\n end", "title": "" }, { "docid": "51a33f9ea7b832668c8ece8ff2026601", "score": "0.57534724", "text": "def show\n @event = Event.find(params[:id])\n\n render json: @event, include: :talks\n end", "title": "" }, { "docid": "89f1661868d77cc9f743b39a8863b415", "score": "0.5751671", "text": "def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "title": "" }, { "docid": "0b7c3e89c4b68b06c2b05ee624907497", "score": "0.57516646", "text": "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end", "title": "" }, { "docid": "35d7b8f5a7775953e3b9f42807a37054", "score": "0.57419145", "text": "def index\n @potluck_items = @event.potluck_items\n\n respond_to do |format|\n format.html { render :layout => false }# index.html.erb\n format.json { render json: @event.get_potluck_items_for_guests.to_json }\n end\n end", "title": "" }, { "docid": "2bdaa9476f459d05fdb7080f25fe0657", "score": "0.5741562", "text": "def index\n @events = Event.all\n render json: @events, status: 200\n end", "title": "" }, { "docid": "10ee303fefbc8ca03f13fd685a69231c", "score": "0.5736512", "text": "def show\n @event = Event.find(params[:id])\n @activities = Activity.where(:event_id => params[:id])\n @act_totals = Activity.where(:event_id => params[:id]).sum(\"distance\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "04b1a5a70f53f056cdc67f164f9201dd", "score": "0.5734589", "text": "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "title": "" }, { "docid": "f11648c794af92249fad9c2c3afa09fc", "score": "0.5715802", "text": "def index\n event_id = current_event.id\n event_id = params[:event_id] if params.has_key?(:event_id)\n @vehicle_classes = VehicleClass.all(:conditions => \"event_id = #{event_id}\", :order => \"max_speed ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_classes }\n end\n end", "title": "" }, { "docid": "0cb07fae40541c7dd3a427783470b2b7", "score": "0.57142246", "text": "def http_message\n {\n data: {\n type: \"events\",\n id: event.id,\n attributes: {\n updated_at: event.updated_at,\n }\n }\n }.to_json\n end", "title": "" }, { "docid": "30abc7ae4ca20aae4e8b4cf39f0e15d7", "score": "0.5712822", "text": "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "title": "" }, { "docid": "cadb01f018a744e64738122bd3b9e9a6", "score": "0.5704537", "text": "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "title": "" }, { "docid": "66cec9200352931dc624c60aa268ea93", "score": "0.57010543", "text": "def index\n @events = Event.all\n render json: @events\n end", "title": "" }, { "docid": "6f8bb0d26e9d5c9f722d69903c5b6d1a", "score": "0.5695196", "text": "def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end", "title": "" }, { "docid": "039d907486dd3765ff7f603f4c7f5b8a", "score": "0.56872153", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "6dfa825090a0345739db26145778532e", "score": "0.56855893", "text": "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "title": "" }, { "docid": "34bc376eb1c2fa035b0cf4580823ee94", "score": "0.56823283", "text": "def index\n @weights = current_user.weights.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weights }\n end\n end", "title": "" }, { "docid": "831625ad3437c99223738a7273964a0e", "score": "0.56774384", "text": "def index\n @events = Event.all\n\n render json: @events\n end", "title": "" }, { "docid": "8f86c1c2d3110226e2c3d57c46e03196", "score": "0.5671623", "text": "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "title": "" }, { "docid": "9a92fb4eeb25a829b330537e6b7df70b", "score": "0.56707364", "text": "def event(event, options = {})\n get \"events/#{event}\", options\n end", "title": "" }, { "docid": "4f5d0e118792c84c74dcb9beec4eddfb", "score": "0.56552964", "text": "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.5652579", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "d8f59faeb53641b7dc6b43e0e1b567e3", "score": "0.56378996", "text": "def user_event_inforamtion\n @user_events = UserEvent.where(event_id: params[:event_id])\n\n render json: @user_events, root: \"user_event_information\", each_serializer: Web::V1::UserEventInformationSerializer\n end", "title": "" }, { "docid": "c920f694973b8f492fc9196243d7dfa2", "score": "0.5621915", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "title": "" }, { "docid": "87ee4657f02aa24eebe69168205d14cd", "score": "0.5617644", "text": "def index\n event_id = current_event.id\n event_id = params[:event_id] if params.has_key?(:event_id)\n @entrants = Entrant.all(:conditions => \"event_id = #{event_id}\",\n :order => \"number ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entrants }\n end\n end", "title": "" }, { "docid": "1f7ed6fb1461d70b6576532863640e4a", "score": "0.5612282", "text": "def index\n @events = Event.where(start: params[:start]..params[:end])\n render json: @events\n end", "title": "" }, { "docid": "15bee648e3c9fd29650280a31cf4dae2", "score": "0.5605236", "text": "def show\n @weight_log = WeightLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weight_log }\n end\n end", "title": "" }, { "docid": "c23c8b7fbd2763578fdc166b9f4489e1", "score": "0.56051403", "text": "def index\n respond_with(@events)\n end", "title": "" }, { "docid": "296e2a539efa8ad70fd680bd14f3e4b4", "score": "0.5601237", "text": "def index\n # byebug\n @ratings = Rating.all\n @event = Event.find(params[:event_id])\n end", "title": "" }, { "docid": "cc9e82559bebc955c5af8abd56761c87", "score": "0.56007063", "text": "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "title": "" }, { "docid": "60c7b5cc4c5452b28038bf98224c81bb", "score": "0.55967885", "text": "def events\n data[\"events\"]\n end", "title": "" }, { "docid": "560d74a779cccf860b46fa2caa9c6234", "score": "0.55891424", "text": "def index\n render json: Event.all, status: :ok\n end", "title": "" }, { "docid": "8e364f5d4993561ae74ea5e8a4b72f1e", "score": "0.5580055", "text": "def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end", "title": "" }, { "docid": "28a43f6cc4abe1602c1a1738efe9e64c", "score": "0.5577654", "text": "def index\n begin\n events = Event.all\n render :json => {events: ActiveModel::ArraySerializer.new(events, each_serializer: EventsSerializer), :code => 200}, status: :ok\n rescue Exception => e\n logger.error {\"Error while populating list of events. ErrorMessage: #{e.message}, Params: #{params.inspect}\"}\n render json: {error: e.message, code: 500}\n end\n end", "title": "" }, { "docid": "855048cc3c10fd4a5d397620f19a6cda", "score": "0.55689484", "text": "def show\n render json: format_event(@event)\n end", "title": "" }, { "docid": "3dd51ce5d5a86f19e3bcf7fca2a44490", "score": "0.5539908", "text": "def show\n @weather_event = WeatherEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather_event }\n end\n end", "title": "" }, { "docid": "7a6f547e3ee8c23c92b8f5931ad239d9", "score": "0.5537364", "text": "def index\n @events = Event.all(:conditions => ['status like ? ', true])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "4c025e2f2b05d843333120a356b65942", "score": "0.55362934", "text": "def index\n party_results = Event.party(params[:event], params[:location],\n params[:time], params[:category])\n @results = JSON.parse(party_results)\n\n # twitter_results = Event.twitter_search(params[:event])\n # @twitter_results = Event.twitter_search(response)\n # Event.create\n end", "title": "" }, { "docid": "2dc02213f9b056316d5b460423c103e7", "score": "0.55301553", "text": "def index\n @events = Event.where(\"date >= ?\", Date.today).order(:date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "ee396818bec3bc5ec055ad45a538621a", "score": "0.552294", "text": "def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end", "title": "" }, { "docid": "e89ff72b149e65373b234956aff7b2fc", "score": "0.55221194", "text": "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "title": "" }, { "docid": "ff4e2cc2e13225694ab86d042a1a4be6", "score": "0.5520043", "text": "def events *args\n Xmlstats::Endpoints::Events.fetch *args\n end", "title": "" }, { "docid": "28fdf37fc14db6a5058012fd5f012fb1", "score": "0.5503", "text": "def index\n respond_to do |format|\n format.html { set_events }\n format.js { set_events }\n format.json {}\n end\n end", "title": "" }, { "docid": "fb8e7cb0c76e56ef352feb0c32077da7", "score": "0.55008495", "text": "def index\n respond_to do |format|\n format.html do\n load_html_events\n end\n format.xml do\n load_data_events\n render :xml => @events\n end\n format.json do\n load_data_events\n render :json => @events\n end\n end\n end", "title": "" }, { "docid": "00ac6e704bd8b9c0004fdf65ed78c27a", "score": "0.54910654", "text": "def index\n if params[:event_id]\n @event = Event.find(params[:event_id])\n @rounds = Round.where(\"event_id = ?\", params[:event_id])\n else\n @rounds = Round.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rounds }\n end\n end", "title": "" }, { "docid": "e231dd9cb81b650e9ce6b8a7848baf7f", "score": "0.547725", "text": "def show\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myevent }\n end\n end", "title": "" }, { "docid": "086eb31418e72209b32e4c109ee6a9da", "score": "0.547656", "text": "def stats\n @stats = {\n total_distance: CyclingEvent.sum(:distance),\n total_time: CyclingEvent.sum(:finish_time),\n average_speed: CyclingEvent.sum(:distance).to_f / CyclingEvent.sum(:finish_time).to_f\n }\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: @stats, callback: params[:callback] }\n format.xml { render xml: @stats }\n end\n end", "title": "" }, { "docid": "7d4e016f658d1ada57b50906680c9360", "score": "0.5470329", "text": "def show\n render json: @event\n end", "title": "" }, { "docid": "7d4e016f658d1ada57b50906680c9360", "score": "0.5470329", "text": "def show\n render json: @event\n end", "title": "" }, { "docid": "7d4e016f658d1ada57b50906680c9360", "score": "0.5470329", "text": "def show\n render json: @event\n end", "title": "" }, { "docid": "7d4e016f658d1ada57b50906680c9360", "score": "0.5470329", "text": "def show\n render json: @event\n end", "title": "" }, { "docid": "7d4e016f658d1ada57b50906680c9360", "score": "0.5470329", "text": "def show\n render json: @event\n end", "title": "" }, { "docid": "830019c5f7317793059d2804515cf663", "score": "0.54691833", "text": "def index\n\n if params[\"search\"].present?\n @conn = Faraday.new(url: \"http://api.eventful.com\")\n search_term = params[\"search\"]\n location = params[\"location\"]\n stop = params[\"stop_time\"]\n start = params[\"start_time\"]\n venue_url = params[\"venue_url\"]\n\n response = @conn.get do |req|\n req.url \"/rest/events/search?location=#{location}&keywords=#{search_term}&app_key=ZFL4M9WfctW6Sv8G\"\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = Hash.from_xml(response.body).to_json\n \n # @ events is an array of event hashes\n if JSON.parse(data).first[1][\"events\"] == nil\n @events = \"No events Found\"\n else\n @events = JSON.parse(data).first[1][\"events\"][\"event\"]\n\n @hash = Gmaps4rails.build_markers(@events) do |event, marker|\n marker.lat event[\"latitude\"]\n marker.lng event[\"longitude\"]\n if event[\"title\"]&& event[\"venue_address\"].present?\n marker.infowindow \"<h3>\" + event[\"title\"] + \"</h3><p>\" + event[\"venue_address\"] + \"</p>\"\n else\n marker.infowindow \"<h3>\" + event[\"title\"] + \"</h3><p>\" + \"No address found\" + \"</p>\"\n marker.title event[\"title\"]\n end\n end\n end\n end\nend", "title": "" }, { "docid": "f6c242ab68f50d06b5cdb469ad87ef85", "score": "0.5462921", "text": "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "title": "" }, { "docid": "52799a942496aefe673ab0fe4d9abfad", "score": "0.54623073", "text": "def create\n @event_type_answer_weight = EventTypeAnswerWeight.new(event_type_answer_weight_params)\n\n respond_to do |format|\n if @event_type_answer_weight.save\n format.html { redirect_to @event_type_answer_weight, notice: 'Event type answer weight was successfully created.' }\n format.json { render :show, status: :created, location: @event_type_answer_weight }\n else\n format.html { render :new }\n format.json { render json: @event_type_answer_weight.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f8829616313ba2e255ab6b5ea3f792c", "score": "0.54606926", "text": "def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "45f4241fd628990309f29d1328fbbee3", "score": "0.54573053", "text": "def show\n @event = Event.find_all_by_id_and_playerid(params[:id], params[:playerid])[0]\n\[email protected] = 1\n\[email protected]\n\t\n\t@notification = Notification.find_all_by_notificationid_and_notification(@event.id, 'events')\n\t@notification[0].read = 1\n\t@notification[0].bulb = 0\n\t@notification[0].save\n\t\n\t@bulbs = Notification.where('playerid = ?' , params[:playerid]).sum('bulb')\n\t@event[\"total_bulbs\"] = @bulbs\n\[email protected]\n\t\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "5efb98be625fef64cecbf88a6bcf22a9", "score": "0.5453061", "text": "def index\n @events = Event.all\n @json = Event.all.to_gmaps4rails\n @event = Event.paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "title": "" }, { "docid": "69da1f3e3a70a7f027d1ccd90e818785", "score": "0.5452561", "text": "def index\n @events = @category.events\n render json: @events \n end", "title": "" }, { "docid": "0a9a4067d7c60adb2d1e3623bed1ee9f", "score": "0.54509985", "text": "def index\n @verbindung = Verbindung.find(params[:verbindung_id])\n @events = Event.where(:verbindung_id => @verbindung.id).where(\"date >= ?\", Date.today).order(\"date\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "f2444e288c75eb695c3ab473656d0458", "score": "0.54508364", "text": "def index\n @events = current_user.events\n\n render json: @events\n end", "title": "" }, { "docid": "5dc63496ec6579ff32c5e1b7834621ba", "score": "0.5450202", "text": "def show\n render json: @event, status: :ok\n end", "title": "" }, { "docid": "2ec41f5c08d2f549099119e684b83644", "score": "0.5449674", "text": "def index\n @cycling_events = CyclingEvent.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cycling_events, callback: params[:callback] }\n format.xml { render xml: @cycling_events }\n end\n end", "title": "" }, { "docid": "550937c640199d56c02a1601a1241676", "score": "0.5449542", "text": "def show\n @event = Event.find(params[:id])\n @event.increment!(:views_count)\n @attendance = current_user.attendance(@event) if current_user\n @gmaps_json = @event.to_gmaps4rails\n @attenders = @event.attenders\n @weather = @event.weather\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @event }\n end\n end", "title": "" }, { "docid": "5febda362ddaf472b8c6c6319cecc36f", "score": "0.5447416", "text": "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "title": "" }, { "docid": "28b7580ef4f7ac543e36e7eb6ef9e2a8", "score": "0.5446479", "text": "def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weight }\n end\n end", "title": "" }, { "docid": "b4093d02a566d163fa739142400f7500", "score": "0.54462516", "text": "def handle_get(event)\n make_response(200, get_scores)\nend", "title": "" }, { "docid": "95a254b159267510ae7fadd8a1cef2e3", "score": "0.54450387", "text": "def index\n @booths = Booth.all\n @event = Event.find(params[:event_id])\n redirect_to event_path\n end", "title": "" }, { "docid": "7e322b7e5a5b8fb445de875a5bf8d168", "score": "0.544342", "text": "def index\n @event_requirements = EventRequirement.all\n\n render json: @event_requirements\n end", "title": "" }, { "docid": "356491f9a7223dbc58effe14eece54f9", "score": "0.5438755", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "356491f9a7223dbc58effe14eece54f9", "score": "0.5438755", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "5a2083fd1b5f8b6929edcc62ae379a6e", "score": "0.5422488", "text": "def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend", "title": "" }, { "docid": "414b76331c876771745dda9cab076752", "score": "0.54173726", "text": "def event_type_answer_weight_params\n params.require(:event_type_answer_weight).permit(:potential_answer_id, :event_type_id, :weight)\n end", "title": "" }, { "docid": "414b76331c876771745dda9cab076752", "score": "0.54173726", "text": "def event_type_answer_weight_params\n params.require(:event_type_answer_weight).permit(:potential_answer_id, :event_type_id, :weight)\n end", "title": "" }, { "docid": "b915baf4a044fba3e32a2d99c59dda88", "score": "0.5416267", "text": "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" } ]
69009f929300654187b50f511fe0580e
NOTE: Facebook issues separate IDs to each application, so these can't be matched directly against Kitsu Facebook IDs, and need to be matched using the ids_for_business edge in the FB Graph API.
[ { "docid": "283c8d3c6e70c66169bc90f35ab97302", "score": "0.0", "text": "def facebook_id\n @data.dig('_auth_data_facebook', 'id')\n end", "title": "" } ]
[ { "docid": "6c836cecc837a9778d4b8a06a2b8d239", "score": "0.6327377", "text": "def applications\n results = @tropo_client.get(\"applications\")\n result_with_ids = []\n results.each do |app|\n result_with_ids << app.merge!({ :application_id => get_element(app.href) })\n end\n result_with_ids\n end", "title": "" }, { "docid": "c661517e26be385676b9c3a7efd119d1", "score": "0.62735355", "text": "def app_ids\n return [] unless current_user\n\n object.app_series.jobs.where(user: current_user).select(:app_id).distinct.map(&:app_id)\n end", "title": "" }, { "docid": "c661517e26be385676b9c3a7efd119d1", "score": "0.62735355", "text": "def app_ids\n return [] unless current_user\n\n object.app_series.jobs.where(user: current_user).select(:app_id).distinct.map(&:app_id)\n end", "title": "" }, { "docid": "5c0a2e74481dd742459698ff5c057f78", "score": "0.6148743", "text": "def map_id(app)\n {id: app.app_id, key: app.key, secret: app.secret, webhook_url: app.webhook_url, nb_message_limit: app.nb_message_limit, connection_limit: app.connection_limit}\n end", "title": "" }, { "docid": "6090691fe3ce00624a0af4696232b4f2", "score": "0.6008541", "text": "def facebook_app_id(value=nil)\n rw_config(:facebook_app_id, value, default_config.app_id)\n end", "title": "" }, { "docid": "8fa22de52754fe3ef87668d5dad24017", "score": "0.60077554", "text": "def app_id\n @app['id']\n end", "title": "" }, { "docid": "9bb10759703474652cdc4bc4dd6e0033", "score": "0.5976703", "text": "def load_supported_application_type_ids\n topology_app_name = \"/insights/platform/topological-inventory\"\n\n each_application_type.select do |application_type|\n application_type[\"name\"] == topology_app_name || application_type[\"dependent_applications\"]&.include?(topology_app_name)\n end.map do |application_type|\n application_type[\"id\"]\n end\n end", "title": "" }, { "docid": "207ace34e139c8afda625aed51f355bb", "score": "0.5968082", "text": "def marketapp_ids\n array = Array.new\n\n self.each(\"MARKETPLACEAPPS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "title": "" }, { "docid": "d596c3e99da2f7d8690826a461742d79", "score": "0.5890702", "text": "def application_id\n # If we are a multi_application\n if @application_id.nil?\n if Settings.multi_application.downcase == 'false'\n @application_id = Settings.single_application_mode_id\n else\n if session[:client_id].nil?\n if (params[:client_id].nil? or params[:client_id].blank?) and (params[\"client_id\"].nil? or params[\"client_id\"].blank?)\n @application_id = local_app_id\n else\n @application_id = params[:client_id]\n end\n else\n @application_id = session[:client_id]\n end\n end\n end\n\n @application_id\n end", "title": "" }, { "docid": "f2aac175c5b38efe5e08fc86a1f1e2cd", "score": "0.58723676", "text": "def acceptable_app_ids\n @acceptable_app_ids ||= ENV.fetch('IOS_ATTESTATION_APP_IDS', '')&.split(',')\n end", "title": "" }, { "docid": "d00635adc81be37c81c9a48564f04a8e", "score": "0.58291924", "text": "def application_id\n return @application_id\n end", "title": "" }, { "docid": "d00635adc81be37c81c9a48564f04a8e", "score": "0.58291924", "text": "def application_id\n return @application_id\n end", "title": "" }, { "docid": "6df3cc31730243ef971defdb9b35023d", "score": "0.5824298", "text": "def application(application_id)\n app = @tropo_client.get(\"applications/#{application_id.to_s}\")\n if app.instance_of? Array\n href = app[0].href\n app[0].merge!({ :application_id => get_element(href) })\n else\n href = app.href\n app.merge!({ :application_id => get_element(href) })\n end\n end", "title": "" }, { "docid": "70f0fc2fabb99318f601c5228581f703", "score": "0.57977605", "text": "def app_id; end", "title": "" }, { "docid": "70f0fc2fabb99318f601c5228581f703", "score": "0.57977605", "text": "def app_id; end", "title": "" }, { "docid": "70f0fc2fabb99318f601c5228581f703", "score": "0.57977605", "text": "def app_id; end", "title": "" }, { "docid": "70f0fc2fabb99318f601c5228581f703", "score": "0.57977605", "text": "def app_id; end", "title": "" }, { "docid": "70f0fc2fabb99318f601c5228581f703", "score": "0.57977605", "text": "def app_id; end", "title": "" }, { "docid": "91feb319f2d548e217413dc19c961ce4", "score": "0.5777742", "text": "def app_id\n @attributes[:app_id]\n end", "title": "" }, { "docid": "6216c82bb9e89d5dea45b73ed3565f76", "score": "0.5777639", "text": "def app_id\n @app_id\n end", "title": "" }, { "docid": "1e35ba0fa1ee0fc90addd8acd29e2469", "score": "0.57469344", "text": "def app_id\n @messaging['message']['app_id']\n end", "title": "" }, { "docid": "d493a4467fe9d1e17bc4b75a54a6d218", "score": "0.5741838", "text": "def friend_ids(graph)\n fb_friends = get_fb_friends(graph)\n friend_fbids = fb_friends.map{|friend| friend[\"id\"]}\n friends = User.where(:uid => friend_fbids)\n friend_ids = friends.map{|friend| friend.id}\n return friend_ids\n end", "title": "" }, { "docid": "a5344d2f7275bc325066afa47e9c02ed", "score": "0.572832", "text": "def find_setsolver_fb_friends\n fb_friend_ids = fb_user.friends.map {|u| u.id }\n app_fb_ids = User.find(:all).select {|u| fb_friend_ids.include? u.facebook_id }\n end", "title": "" }, { "docid": "cf70affb3d39da1756918176e24b48c2", "score": "0.57222754", "text": "def get_background_app_list()\n current_node = @head\n app_list = []\n\n while current_node != nil\n app_list << current_node.data.app_id\n current_node = current_node.next\n end\n return app_list\n end", "title": "" }, { "docid": "494c2a76b2cbfe2cc3df0fc0d553e3e1", "score": "0.5721505", "text": "def app_id\n @dict['application-identifier']\n end", "title": "" }, { "docid": "89ceab48caae858f3fc58e5c4d5fa7a8", "score": "0.56898254", "text": "def fb_app_id\n ENV['facebook_app_id']\n end", "title": "" }, { "docid": "528fb94c3ae55bc5c05faef5d121c42b", "score": "0.56853366", "text": "def app_id\n @messaging.dig('message', 'app_id')\n end", "title": "" }, { "docid": "6ccc75c96e47eb5bff30bde1b931f935", "score": "0.5669636", "text": "def application_id=(value)\n @application_id = value\n end", "title": "" }, { "docid": "6ccc75c96e47eb5bff30bde1b931f935", "score": "0.5669636", "text": "def application_id=(value)\n @application_id = value\n end", "title": "" }, { "docid": "37c8da66aec7eedec54849067dea0a84", "score": "0.56664294", "text": "def u2f_app_id\n @attributes[:u2f_app_id]\n end", "title": "" }, { "docid": "cafce93911f23abbc3b8ed01af7ab083", "score": "0.5634865", "text": "def application_id=(id)\n @application_id = id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "2487aba7653c0e2bca5a22a86ad332ce", "score": "0.56168884", "text": "def app_id\n return @app_id\n end", "title": "" }, { "docid": "594e0a7a57554a2aca6f5743f11f6f4c", "score": "0.56106544", "text": "def application_id\n @variables[\"application\"][\"applicationId\"]\n end", "title": "" }, { "docid": "ed5d5c401f090eb47f30cc6b91718a0c", "score": "0.56070834", "text": "def userInstalledApps\n # current_resource_owner\n # p \"current_resource_owner:#{current_resource_owner}\"\n if params[:apps]\n appids = params[:apps].split(\",\")\n end\n if appids\n res = Userapp.find_by_sql(\"select * from userapps,oauth_applications where userapps.app=oauth_applications.id and userapps.uid=#{@current_uid} and userapps.app in (#{appids.join(',')})\")\n else\n res = Userapp.find_by_sql(\"select * from userapps,oauth_applications where userapps.app=oauth_applications.id and userapps.uid=#{@current_uid}\")\n end\n p \"res:#{res.to_json}\"\n render :text=>res.to_json\n end", "title": "" }, { "docid": "c476e981570518dcbe3483f59b2385aa", "score": "0.5588595", "text": "def get_app_list\n page = params[:page].blank? ? 1 : params[:page]\n apps = (FacebookAppList.search do \n fulltext \"\"\n paginate :page => page, :per_page => 12\n end).results\n next_page = apps.last_page? ? -1 : (page.to_i + 1)\n previous_page = apps.first_page? ? -1 : (page.to_i - 1)\n @response_data = ::Response::Data.new(:TotalPages => apps.num_pages, \n :Message => \"Successfully fetched #{apps.size} apps.\", \n :NextPage => next_page, \n :PreviousPage => previous_page, \n :CurrentPage => page, \n :Response => \"success\")\n @response_data.Data = ActiveSupport::JSON.decode(apps.to_json(:only => [:id, :app_name, :app_url]))\n render \"facebook/response\"\n end", "title": "" }, { "docid": "8c1b092e907ab9fd3cee1daaea41e9ea", "score": "0.5570893", "text": "def sent_from_chatwoot_app?\n app_id && app_id == GlobalConfigService.load('FB_APP_ID', '').to_i\n end", "title": "" }, { "docid": "b193c0199c3c124ea327bba338f3085c", "score": "0.5568505", "text": "def sub_app_list\n if batch_connect.sub_app_list.size == 1\n batch_connect.sub_app_list\n else\n batch_connect.sub_app_list.select { |app| app.sub_app == sub_app_name }\n end\n end", "title": "" }, { "docid": "9e58a04e8e5187719cb9d2882e4842ca", "score": "0.5552142", "text": "def get_app_ids(project, hockeyapp_app_ids)\n build_ids = Hash.new\n project_ids = JSON.parse(hockeyapp_app_ids)\n app_id = project_ids[project]\n hockeyapp_url =\"#{config.jira.hockeyapp_url}/#{app_id}/app_versions\"\n # Connect to HockeyApp\n c = Curl::Easy.new(hockeyapp_url)\n c.headers[\"X-HockeyAppToken\"] = config.jira.hockeyapp_token.to_s\n c.perform\n # Generate the app version list\n body_url = c.body_str\n app_versions = JSON.parse(body_url)['app_versions']\n # Get the latest app version\n latest_app_version = app_versions[0]['shortversion'].split(\".\")[0..2].join(\".\")\n all_current_build_id = Array.new\n app_versions.each do |version|\n short_version = version['shortversion'].split(\".\")[0..2].join(\".\")\n if short_version == latest_app_version\n all_current_build_id.push(version['id'])\n else\n break\n end\n end\n build_ids[app_id.to_s] = all_current_build_id.sort\n return build_ids\n end", "title": "" }, { "docid": "8bf788038215f818666ceb2b47b8e36c", "score": "0.55496633", "text": "def application_id(video_type)\n\t\tapps = self.applications \n\t\tapps.each do |app|\n\t\t\tif app.video_type == video_type\n\t\t\t\treturn app.app_id\n\t\t\telse\n\t\t\t\treturn 'not found'\n\n\t\t\tend\n\t\tend\n\n\tend", "title": "" }, { "docid": "dea524e9f7f95db34209219b88734aab", "score": "0.55460525", "text": "def applications\n self.object.applications.map do |app| {\n id: app.id,\n title: app.title,\n company: app.company,\n description: app.description,\n status: app.status,\n created_at: app.created_at,\n applied: app.applied,\n folder_items: app.folder_items\n }\n end\n end", "title": "" }, { "docid": "715cf19c11d3d59d68ef7faf0902ce98", "score": "0.5533592", "text": "def business_id\n variants.each do |variant|\n return variant.third_party_sku.business_id if variant.third_party_sku\n end\n fail \"Unable to find the business_id for product #{id}\"\n end", "title": "" }, { "docid": "8d103449e389facbf0ffa2c5f2036a4f", "score": "0.5530497", "text": "def application_identifier\n return @application_identifier\n end", "title": "" }, { "docid": "8784e9e139c149e93c0453d334361b4b", "score": "0.5527265", "text": "def get_fbpage_id(resource)\n fbn = facebook_searchify(resource)\n if fbn.present?\n results = @graph.get_object(\"search?q=#{fbn}&type=page\")\n if results\n venue_categories = [\"Arts/Entertainment/Nightlife\", \"Concert Venue\" , \"Nightlife\" , \"Restaurant\" , \"Company\" , \"Local Business\" , \"Bar\"]\n festival_categories = [\"Arts/Entertainment/Nightlife\", \"Community\" , \"Concert Venue\" , \"Nightlife\" , \"Music Award\" , \"Label\" , \"Company\" , \"Local Business\", \"Community Organization\"]\n promoter_categories = [\"Musician/band\", \"Arts/Entertainment/Nightlife\", \"Community\" , \"Concert Venue\" , \"Nightlife\" , \"Restaurant\" , \"Music Award\" , \"Label\" , \"Company\" , \"Local Business\" , \"Magazine\" , \"Bar\" , \"Community Organization\"]\n if results.first && category = results.first[\"category\"]\n resource.update(fbpage_id: results.first[\"id\"]) if resource.class.name == \"Venue\" && venue_categories.include?(category)\n resource.update(fbpage_id: results.first[\"id\"]) if resource.class.name == \"Promoter\" && promoter_categories.include?(category)\n resource.update(fbpage_id: results.first[\"id\"]) if resource.class.name == \"Festival\" && festival_categories.include?(category)\n # elsif results.second && results.second[\"category\"] == \"Musician/band\"\n # dj.update(fbpage_id: results.second[\"id\"])\n # elsif results[3] && results[3][\"category\"] == \"Musician/band\"\n # dj.update(fbpage_id: results[3][\"id\"])\n # elsif results[4] && results[4][\"category\"] == \"Musician/band\"\n # dj.update(fbpage_id: results[4][\"id\"])\n end\n end\n end \n end", "title": "" }, { "docid": "645c38c4fcb4300833fb27557fd705a9", "score": "0.5513822", "text": "def facebook_identifier\n @consumer.facebook_identifier\n end", "title": "" }, { "docid": "1794e0886d77ecf608d3834858105887", "score": "0.55111235", "text": "def compassion_fb_page_id\n \"583630311678418\"\n end", "title": "" }, { "docid": "6fe6df7f02011fed5ec9771e2e60bee1", "score": "0.5495386", "text": "def find_checkins_for_facebook_id_array(facebook_id = nil, facebook_id_array = nil, since = nil)\n if facebook_id_array.nil? then\n facebook_id_array = [@@peter_id, @@tom_id, @@james_id]\n #facebook_id_array = [\"102167\", \"107491\", \"202402\", \"202451\", \"206635\", \"210258\", \"221423\", \"222383\", \"223314\", \"300994\", \"404120\", \"407230\", \"837181\", \"1203891\", \"1204271\", \"1205313\", \"1206669\", \"1207467\", \"1209924\", \"1212462\", \"1214835\", \"1215870\", \"1217270\", \"1217767\", \"1218796\", \"1229612\", \"1237074\", \"1302698\", \"2203609\", \"2414683\", \"2420700\", \"2502195\", \"2502827\", \"2504814\", \"2539351\", \"2602152\", \"3001631\", \"3200308\", \"3200338\", \"3200785\", \"3201209\", \"3207713\", \"3213585\", \"3213871\", \"3213930\", \"3215015\", \"3223008\", \"3224819\", \"3225115\", \"3225501\", \"3302615\", \"3307216\", \"3308028\", \"3312026\", \"3318595\", \"3323295\", \"3400229\", \"3407534\", \"3409627\", \"3414242\", \"3430753\", \"3619557\", \"4804600\", \"4804606\", \"4804969\", \"4805917\", \"4807345\", \"4809933\", \"5505430\", \"6002685\", \"6006398\", \"6010421\", \"6817010\", \"7903099\", \"8620430\", \"8621075\", \"8639036\", \"10703701\", \"10710317\", \"10717536\", \"10718558\", \"10723087\", \"10729766\", \"10731869\", \"12438683\", \"12803642\", \"12805273\", \"12822783\", \"13004004\", \"13704812\", \"14900845\", \"67800652\", \"68600483\", \"77001082\", \"500031833\", \"500676063\", \"501591312\", \"503265413\", \"506408584\", \"510849527\", \"543612099\", \"547177528\", \"558377300\", \"573953756\", \"589860486\", \"590245157\", \"591070603\", \"593399035\", \"610978642\", \"624067894\", \"628447811\", \"629960217\", \"645750651\", \"666112048\", \"705063052\", \"707267501\", \"712743335\", \"720886950\", \"745245646\", \"745938780\", \"780624163\", \"802745284\", \"817333087\", \"847735037\", \"883200586\", \"1008514568\", \"1017673909\", \"1059468090\", \"1067580021\", \"1099524954\", \"1121490493\", \"1155635614\", \"1184055409\", \"1224771465\", \"1316730161\", \"1321571526\", \"1483053421\", \"1653886798\", \"100000049912171\", \"100000199684521\", \"100000576881557\", \"100000721817834\", \"100001483789469\", \"100001893113244\"]\n # facebook_id_array = [\"8963\", \"15500\", \"102167\", \"107491\", \"113140\", \"124718\", \"200408\", \"202451\", \"206635\", \"221423\", \"223984\", \"300994\", \"304753\", \"404120\", \"407230\", \"602380\", \"602908\", \"700411\", \"700640\", \"700913\", \"804962\", \"806533\", \"902398\", \"907578\", \"926017\", \"1104245\", \"1204213\", \"1205313\", \"1207135\", \"1209345\", \"1215870\", \"1217270\", \"1217767\", \"1232357\", \"1237074\", \"1238132\", \"1302148\", \"1302698\", \"1305225\", \"1317243\", \"1500280\", \"1503126\", \"1602207\", \"1900323\", \"1901630\", \"1946902\", \"2203649\", \"2204941\", \"2205136\", \"2260313\", \"2404878\", \"2420700\", \"2502195\", \"2502827\", \"2504814\", \"2511909\", \"2519703\", \"2520511\", \"2535681\", \"2535961\", \"2539351\", \"2602139\", \"2602152\", \"3001341\", \"3001631\", \"3102907\", \"3207046\", \"3207713\", \"3213871\", \"3214263\", \"3223008\", \"3225501\", \"3309147\", \"3312630\", \"3313694\", \"3318595\", \"3400229\", \"3405555\", \"3407534\", \"3409627\", \"3414242\", \"3422207\", \"3430753\", \"3431548\", \"3500262\", \"3601361\", \"3624841\", \"4200185\", \"4800419\", \"4800558\", \"4801645\", \"4801649\", \"4804600\", \"4804606\", \"4805917\", \"4807345\", \"4809933\", \"5311725\", \"5400602\", \"5401293\", \"5404625\", \"5505430\", \"5722387\", \"6000997\", \"6001293\", \"6002470\", \"6006398\", \"6006769\", \"6006817\", \"6007206\", \"6009423\", \"6010195\", \"6010421\", \"6013940\", \"6020556\", \"6029659\", \"6101740\", \"6103147\", \"6313486\", \"6403474\", \"6817010\", \"7903099\", \"7906450\", \"7944583\", \"8106362\", \"8504876\", \"8620430\", \"8621075\", \"8639036\", \"8819965\", \"9001569\", \"9219543\", \"9300454\", \"9351864\", \"10500882\", \"10701381\", \"10703701\", \"10703965\", \"10705786\", \"10706085\", \"10706823\", \"10707429\", \"10707911\", \"10708143\", \"10708824\", \"10710317\", \"10710655\", \"10712133\", \"10713943\", \"10714527\", \"10717536\", \"10718558\", \"10723087\", \"10723888\", \"10724566\", \"10727107\", \"10729538\", \"10729766\", \"10731869\", \"10732097\", \"10734785\", \"11509277\", \"11710692\", \"12409925\", \"12438683\", \"12801350\", \"12801778\", \"12803642\", \"12804385\", \"12805273\", \"12822783\", \"13004004\", \"13300908\", \"13309538\", \"13601113\", \"13704812\", \"13705330\", \"13710035\", \"13727874\", \"13748822\", \"14900845\", \"15100199\", \"15102941\", \"16103897\", \"16910989\", \"19900101\", \"23709354\", \"24004576\", \"27201382\", \"31900543\", \"32402049\", \"32502647\", \"44404928\", \"67800652\", \"68600483\", \"72606041\", \"77001082\", \"217600253\", \"500031833\", \"501523903\", \"503392346\", \"504450120\", \"505935283\", \"506408584\", \"506672906\", \"508035217\", \"510849527\", \"512078507\", \"512930451\", \"515116258\", \"515772011\", \"516423668\", \"517656034\", \"523260804\", \"523680072\", \"529385152\", \"529767396\", \"530761351\", \"531021788\", \"535022497\", \"539825468\", \"543612099\", \"544881151\", \"545678688\", \"546492587\", \"546542494\", \"546567064\", \"546572064\", \"546631962\", \"546690648\", \"547091873\", \"547098754\", \"547177528\", \"547187391\", \"547272532\", \"548430564\", \"549195732\", \"550827394\", \"554061179\", \"554407734\", \"558377300\", \"565240108\", \"565859853\", \"566189037\", \"566664300\", \"569265917\", \"572521995\", \"572956856\", \"573953756\", \"574953924\", \"580937949\", \"589860486\", \"590245157\", \"590940415\", \"591070603\", \"594160450\", \"594274171\", \"594452024\", \"603927580\", \"605520271\", \"606541139\", \"610604803\", \"610978642\", \"618042063\", \"619680540\", \"624845905\", \"628235176\", \"628976871\", \"629730750\", \"629820318\", \"629960217\", \"642175690\", \"643298081\", \"659752530\", \"664598837\", \"666112048\", \"684786997\", \"686280655\", \"688007999\", \"689596293\", \"698640330\", \"699393049\", \"703427587\", \"705063052\", \"707765263\", \"711951229\", \"712743335\", \"713240181\", \"715882796\", \"720350220\", \"720886950\", \"731347173\", \"742596203\", \"743369432\", \"751377782\", \"756051583\", \"761010312\", \"763045077\", \"764619434\", \"768184036\", \"777725173\", \"778870130\", \"780624163\", \"789287731\", \"794495829\", \"794671958\", \"821640386\", \"829932247\", \"843615575\", \"845320400\", \"847735037\", \"883200586\", \"1006483796\", \"1007143495\", \"1008514568\", \"1020813223\", \"1031074695\", \"1037187187\", \"1041450082\", \"1041510153\", \"1055790362\", \"1056240014\", \"1059468090\", \"1083946504\", \"1153131614\", \"1157346411\", \"1171782424\", \"1224771465\", \"1276494059\", \"1294779053\", \"1316730161\", \"1364641590\", \"1393300306\", \"1397027770\", \"1433341178\", \"1452930023\", \"1491100934\", \"1524000010\", \"1543103529\", \"1553881511\", \"1556625823\", \"1636489309\", \"1640227273\", \"1653886798\", \"1682880020\", \"1682880037\", \"1682880038\", \"1746680919\", \"1772072139\", \"1846550208\", \"100000049912171\", \"100000098807776\", \"100000160899544\", \"100000257177602\", \"100000353950542\", \"100000452740095\", \"100000480064561\", \"100000500324298\", \"100000631459780\", \"100000721817834\", \"100001152622932\", \"100001158537314\", \"100001483789469\", \"100001493170272\"];\n end\n\n if facebook_id.nil? then\n facebook_id = @@peter_id\n end\n\n puts \"START find checkins for facebook_id_array: #{facebook_id_array} with token: #{@access_token}\"\n\n # OLD STYLE BATCHED\n headers_hash = Hash.new\n headers_hash['Accept'] = 'application/json'\n\n params_hash = Hash.new\n params_hash['access_token'] = @access_token\n params_hash['fields'] = 'id,from,tags,place,message,likes,comments,application,created_time'\n params_hash['ids'] = facebook_id_array.join(',')\n params_hash['limit'] = 2000 # set this to a really high limit to get all results in one call\n if !since.nil? then\n params_hash['since'] = since.to_i\n end\n\n response = Typhoeus::Request.get(\"#{@@fb_host}/checkins\", :params => params_hash, :headers => headers_hash, :disable_ssl_peer_verification => true)\n \n # puts response.body\n\n parsed_response = self.check_facebook_response_for_errors(response)\n if parsed_response.nil?\n return false\n end\n \n place_id_array = Array.new\n\n # Parse checkins for each user\n parsed_keys = parsed_response.keys\n\n # Serialize checkins in bulk\n checkins_array = Array.new\n parsed_keys.each_with_index do |key,i|\n # if there are no recent checkins for this user, don't try to serialize it\n if parsed_response[key]['data'].empty?\n next\n end\n parsed_response[key]['data'].each do |checkin|\n checkins_array << checkin\n end\n end\n \n if !checkins_array.empty?\n place_id_array = self.serialize_checkin_bulk(checkins_array)\n end\n\n\n # Serialize unique list of place_ids\n if !place_id_array.empty?\n self.find_places_for_place_id_array(place_id_array.uniq)\n end\n \n # Update last_fetched_friends_checkins timestamp for user\n self.update_last_fetched_friends_checkins(facebook_id)\n\n puts \"END find checkins for facebook_id_array: #{facebook_id_array} with token: #{@access_token}\"\n \n return true\n end", "title": "" }, { "docid": "57044ce27046f63b42e2b387dd766bdd", "score": "0.54947835", "text": "def applications_with_addresses(application_id=nil)\n if application_id\n associate_addresses_to_application(application(application_id))\n else\n apps = []\n applications.each do |app|\n apps << associate_addresses_to_application(app)\n end\n apps\n end\n end", "title": "" }, { "docid": "daee7ef2c384878183fb99032738ba26", "score": "0.5492806", "text": "def index\n @admin_facebook_applications = Admin::FacebookApplication.all\n end", "title": "" }, { "docid": "e336621656b42edbf5be706f7ed8bcd4", "score": "0.5492015", "text": "def set_admin_facebook_application\n @admin_facebook_application = Admin::FacebookApplication.find(params[:id])\n end", "title": "" }, { "docid": "ca5a14a8a49bacb55834fdf95121ad4d", "score": "0.5486576", "text": "def rest_graph_storage_key\n \"rest_graph_fbs_#{rest_graph_oget(:app_id)}\"\n end", "title": "" }, { "docid": "fee28945759ecdcb045fad9e1c4dcc8d", "score": "0.5473814", "text": "def venue_event_slot_applications(slots, slot_apps)\n\n @slots = slots\n @slot_apps = slot_apps\n @waiting = []\n @slots.each do |slot|\n if slot.confirmed == false\n @slot_apps.each do |slot_app|\n if slot_app.slot_id == slot.id\n @waiting << slot_app.slot_id\n end\n end\n end\n end\n @waiting = @waiting.uniq\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "b11137e83326fa4bc89e1898cc818fab", "score": "0.54691625", "text": "def app_id=(value)\n @app_id = value\n end", "title": "" }, { "docid": "a89c6f3bfb0d4110a085915620ddda27", "score": "0.54659003", "text": "def facebook_id\n fb_user_id\n end", "title": "" }, { "docid": "85a07894cacc8c973e81ba9bc9fab13d", "score": "0.54435074", "text": "def application_id\n\t\t@applicationid = rand(36**8).to_s(36).upcase\n\t\tputs \"Your application id is #{@applicationid}\"\n\tend", "title": "" }, { "docid": "fbc1b0fd46597e9d0259e48c0f64a06d", "score": "0.5435838", "text": "def platform_ids(refresh=false)\n cached_value(\"game_ids\", {}, refresh) do |ids|\n search_doc = Hpricot(open(SEARCH_URL))\n search_doc.search(PLATFORMS_ID_PATH).each do |option|\n ids[option['label']] = option['value']\n end\n end\n end", "title": "" }, { "docid": "2980b8916e42f52f751df9ea59f7d446", "score": "0.54344946", "text": "def in_facebook_page_app_url\n \"http://www.facebook.com/#{FB_PAGE_NAME}?sk=app_#{FB_APP_ID}\"\n end", "title": "" }, { "docid": "4238635592c00934a4927ab2fa737bc0", "score": "0.54234266", "text": "def get_merchant_and_applications_by_organization_and_id(organization, id)\n HttpClient::Preconditions.assert_class('organization', organization, String)\n HttpClient::Preconditions.assert_class('id', id, String)\n r = @client.request(\"/#{CGI.escape(organization)}/merchant/applications/#{CGI.escape(id)}\").get\n ::Io::Flow::V0::Models::MerchantApplication.from_json(r)\n end", "title": "" }, { "docid": "bf50b6c9622cbf49aa623f13cc41db05", "score": "0.5416447", "text": "def find_fb_friends\n app_fb_ids = User.find(:all).map {|u| u.facebook_id }\n fb_user.friends.select {|friend| app_fb_ids.include? friend.id }\n end", "title": "" }, { "docid": "8d1e70b64e05bc057da298d917ce4dfd", "score": "0.5409775", "text": "def unused_fbapp\n # make sure our record is up to date\n self.reload\n\n # get all used Fbapps\n apps = self.fbapps\n \n if apps.empty?\n app = Fbapp.first\n else\n # get the first app that isn't in apps\n app = Fbapp.where('id not in (?)', apps).first\n\n # if we couldn't find one, raise exception\n raise Exceptions::TabLimitException if !app\n end\n app\n end", "title": "" }, { "docid": "a86cd17dce5574d0802fe54f0dd38ed1", "score": "0.54076505", "text": "def convert_app_id_to_app_name\n Rails.logger.debug \"#convert_app_id_to_app_name\"\n\n # Sub in an existing application if specified...\n return unless params[:tag] && params[:tag][:existing_application_id] && params[:tag][:application].blank?\n\n # FIXME use internal ids if available? string matching all the time is ghetto\n app = Visualization.find(params[:tag][:existing_application_id]) rescue nil\n params[:tag][:application] = app.name unless app.blank?\n end", "title": "" }, { "docid": "8cc9566f541fc0fd71d036a8abb04af2", "score": "0.54036945", "text": "def get_merchant_and_applications_by_organization(organization, incoming={})\n HttpClient::Preconditions.assert_class('organization', organization, String)\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),\n :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),\n :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),\n :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? \"-created_at\" : x), String)\n }.delete_if { |k, v| v.nil? }\n r = @client.request(\"/#{CGI.escape(organization)}/merchant/applications\").with_query(query).get\n r.map { |x| ::Io::Flow::V0::Models::MerchantApplication.from_json(x) }\n end", "title": "" }, { "docid": "c81914d2bf603d1384527a50032de918", "score": "0.5401688", "text": "def getAppId()\n @appId\n end", "title": "" }, { "docid": "86677d30d9fc52db068ccdfdaf38a9c0", "score": "0.53978217", "text": "def get_game_info(appids)\n # only fetch ids that are not in database already\n appids = appids - SteamApp.pluck(:steam_appid)\n ids = appids.join(',')\n\n # get the information to the games and parse the json\n if ids.size > 0\n uri = URI(\"https://store.steampowered.com/api/appdetails/?appids=#{ids}&cc=EE&l=english&v=1\")\n json = JSON.parse(Net::HTTP.get(uri))\n\n json.each do |app|\n if app.last.delete \"success\"\n data = app.last[\"data\"]\n data[\"steam_appid\"] = data[\"steam_appid\"].to_i\n SteamApp.create(data)\n end\n end\n end\n end", "title": "" }, { "docid": "0c2b3df74c7e9dc1b7ce37b20ddb5d07", "score": "0.53791404", "text": "def get_fb_id\n authorizations.first.uid\n end", "title": "" }, { "docid": "6b6d662c5f09f2eb4c0f71d813b3b9d8", "score": "0.53762096", "text": "def app_item_id\n read('app_item_id')\n end", "title": "" }, { "docid": "a2864a0928d5ab90abb4888bb81f1111", "score": "0.53707504", "text": "def app_ocid(app_name:, compartment_name:)\n apps(compartment_name: compartment_name)\n .select { |a| a.display_name == app_name }\n .fetch(0) { raise \"Could not find application #{app_name}\" }\n .id\nend", "title": "" }, { "docid": "c2d8daac60f04088ea8878e51c17656c", "score": "0.53259647", "text": "def applications\n return App.for_plan(self.id)\n end", "title": "" }, { "docid": "7db81c9f1564d641c8599ff9e11f13fe", "score": "0.5319942", "text": "def core_applications(application_name_or_id)\n core_client.applications.all(name: application_name_or_id).tap do |result|\n result << core_client.applications.get(application_name_or_id) if result.empty?\n end.to_a.compact\n end", "title": "" }, { "docid": "6a30d5861c25b07c781b891e95e4f865", "score": "0.5306734", "text": "def validate_ids(graph, fb_interest_ids)\n normalized_interests = normalize_array(fb_interest_ids)\n result = graph\n .get_object(:search, type: :adinterestvalid, interest_fbid_list: normalized_interests.to_s)\n .map(&:with_indifferent_access)\n\n missing_keys = normalized_interests.map(&:to_s) - result.map { |interest| interest[:id].to_s }\n result + missing_keys.map { |key| {id: key, valid: false}.with_indifferent_access }\n end", "title": "" }, { "docid": "348e1134119df2bd6055a60f5540632a", "score": "0.5292947", "text": "def setup_apps(user = nil, app_nids = [], opts = {})\n return [] unless user\n return [] unless (user.organizations.reload.count == 1)\n return [] unless (org = user.organizations.first)\n return [] unless MnoEnterprise::Ability.new(user).can?(:edit,org)\n\n results = []\n\n apps = MnoEnterprise::App.where('nid.in' => app_nids.compact)\n existing = org.app_instances.active.index_by(&:app_id)\n\n # For each app nid (which is not nil), try to find an existing instance or create one\n apps.each do |app|\n if (app_instance = existing[app.id])\n results << app_instance\n else\n # Provision instance and add to results\n app_instance = org.app_instances.create(product: app.nid)\n results << app_instance\n MnoEnterprise::EventLogger.info('app_add', user.id, 'App added', app_instance)\n end\n\n # Add oauth keyset if defined and app_instance is\n # oauth ready and does not have a valid set of oauth keys\n if app_instance && opts[:oauth_keyset].present? && !app_instance.oauth_keys_valid?\n app_instance.oauth_keys = { keyset: opts[:oauth_keyset] }\n app_instance.save\n end\n end\n return results\n end", "title": "" }, { "docid": "6779762a0beb6d672b2e1b82f28c8e20", "score": "0.52756125", "text": "def teams_app_id\n return @teams_app_id\n end", "title": "" }, { "docid": "ff990b3a859449212dfdec13a37fd223", "score": "0.5275435", "text": "def app_type \n @app['app_type_id']\n end", "title": "" }, { "docid": "0efc4dac1419bf7cc6671698c478d13c", "score": "0.5274831", "text": "def fetch_applicants\n @apps ||= @offering.application_for_offerings.with_status(:confirmed)\n @all ||= (@apps + @apps.collect(&:group_members)).flatten.compact\n # @applicants ||= @all.collect(&:person).flatten.compact.uniq\n end", "title": "" }, { "docid": "6779762a0beb6d672b2e1b82f28c8e20", "score": "0.52732897", "text": "def teams_app_id\n return @teams_app_id\n end", "title": "" }, { "docid": "6779762a0beb6d672b2e1b82f28c8e20", "score": "0.52732897", "text": "def teams_app_id\n return @teams_app_id\n end", "title": "" }, { "docid": "9cd29eca91be8c3c331b34a2726da752", "score": "0.5268258", "text": "def npq_applications\n NPQApplication.joins(:participant_identity).where(participant_identity: { user_id: id })\n end", "title": "" }, { "docid": "3e78d078cb0ddc4047f3b43c993a4bb8", "score": "0.5263754", "text": "def create\n @oauth_application = Doorkeeper::Application.new(oauth_application_params.except('user_ids'))\n @oauth_applications = OauthApplication.all.by_name\n @user_ids = oauth_application_params[:user_ids]\n respond_to do |format|\n if @oauth_application.save\n OauthApplication.find(@oauth_application.id).update_attributes('user_ids'=>oauth_application_params[:user_ids])\n format.html { redirect_to oauth_application_path(@oauth_application), notice: 'Oauth application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @oauth_application }\n else\n format.html { render action: 'new' }\n format.json { render json: @oauth_application.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9bb0ba88dad4338fb5496b8cf22e9fbf", "score": "0.5259252", "text": "def set_ApplicationID(value)\n set_input(\"ApplicationID\", value)\n end", "title": "" }, { "docid": "9bb0ba88dad4338fb5496b8cf22e9fbf", "score": "0.5259252", "text": "def set_ApplicationID(value)\n set_input(\"ApplicationID\", value)\n end", "title": "" }, { "docid": "9bb0ba88dad4338fb5496b8cf22e9fbf", "score": "0.5259252", "text": "def set_ApplicationID(value)\n set_input(\"ApplicationID\", value)\n end", "title": "" }, { "docid": "9bb0ba88dad4338fb5496b8cf22e9fbf", "score": "0.5259252", "text": "def set_ApplicationID(value)\n set_input(\"ApplicationID\", value)\n end", "title": "" }, { "docid": "9bb0ba88dad4338fb5496b8cf22e9fbf", "score": "0.5259252", "text": "def set_ApplicationID(value)\n set_input(\"ApplicationID\", value)\n end", "title": "" }, { "docid": "9bb0ba88dad4338fb5496b8cf22e9fbf", "score": "0.5259252", "text": "def set_ApplicationID(value)\n set_input(\"ApplicationID\", value)\n end", "title": "" }, { "docid": "9bb0ba88dad4338fb5496b8cf22e9fbf", "score": "0.5259252", "text": "def set_ApplicationID(value)\n set_input(\"ApplicationID\", value)\n end", "title": "" }, { "docid": "9bb0ba88dad4338fb5496b8cf22e9fbf", "score": "0.5259252", "text": "def set_ApplicationID(value)\n set_input(\"ApplicationID\", value)\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2c8de512eeee574e356b42319165a946", "score": "0.0", "text": "def set_media_history\n @media_history = MediaHistory.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.5946146", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.591683", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58349305", "text": "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.5776858", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.5652805", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.5621621", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54210985", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53402257", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.53394014", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.53321576", "text": "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.53124547", "text": "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.529654", "text": "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.5296262", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.52952296", "text": "def setup_handler\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.52600986", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.52442724", "text": "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.5232394", "text": "def workflow\n end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.523231", "text": "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5227454", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.52201617", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.5212327", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.52079266", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.52050185", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.51754695", "text": "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.51726824", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.5166172", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.5159343", "text": "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.51578903", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.51522785", "text": "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152022", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.51518047", "text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.51456624", "text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.5133759", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.5112076", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.5106169", "text": "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.509231", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.50873137", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5081088", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.508059", "text": "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50677156", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.50562143", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5050554", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50474834", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50474834", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.5036181", "text": "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5026331", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.5022976", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.5015441", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.50121695", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.5000944", "text": "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.5000019", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.4996878", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989888", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989888", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49864885", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.49797225", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49785787", "text": "def after_set_callback; end", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.4976161", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.49683493", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.4965126", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.4958034", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49559742", "text": "def release_actions; end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.4954353", "text": "def around_hooks; end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.49535993", "text": "def save_action; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.4952725", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.49467874", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.49423352", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.49325448", "text": "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.49282882", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49269363", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49269104", "text": "def default_action; end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49252945", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4923091", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49194667", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.49174926", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49173003", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.49171105", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.4915879", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49155936", "text": "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "title": "" } ]
87c143198eb382d7de7793413bd4b915
needs to return nil so minimax will work
[ { "docid": "ef415e26a317586f6a57dcd6110ec3e5", "score": "0.0", "text": "def winner?\n winner = (rows + columns + diagonals).find() do |sequence|\n sequence.first != :empty and sequence.all?{ |x| x == sequence.first }\n end\n winner ? winner.first : nil\n end", "title": "" } ]
[ { "docid": "1c79420d37308c4c7d9a289b1555cb2f", "score": "0.7483925", "text": "def minimize; end", "title": "" }, { "docid": "d409e9c1811ca85a80b664c377418e9a", "score": "0.74631363", "text": "def minimize\n end", "title": "" }, { "docid": "0800de86739c2c9a202e538f66b5a754", "score": "0.71686786", "text": "def minimax\t\t\t \n\t\treturn self.score if @game.over?\n\t\t# @depth += 1\n\t\tboard_state_before_change = @game.board.cells.clone\n\t\tscores = [] #An array of the scores\n\t\tmoves = [] #an array of the moves\n\t\t#Populate the scores array, recusing as needed\n\t\tavailable_moves = @game.get_available_moves\n\t\tavailable_moves.each do |move| \n\t\t\[email protected] = board_state_before_change.clone\n\t\t\tpossible_game = @game.get_new_state(move)\n\t\t\tscores << minimax\n\t\t\tmoves << move \n\t\tend\n\n\t\t @game.board.cells = board_state_before_change\n\t\t # Do the min or the max calculation\n\t\t if @game.current_player.token == @player\n\t\t # This is the max calculation\n\t\t max_score_index = scores.each_with_index.max[1]\n\t\t @choice = moves[max_score_index]\n\t\t return scores[max_score_index]\n\t\t else\n\t\t # This is the min calculation\n\t\t min_score_index = scores.each_with_index.min[1]\n\t\t @choice = moves[min_score_index]\n\t\t return scores[min_score_index]\n\t\t end\n\t end", "title": "" }, { "docid": "5d931a90d1c3a5f5e7170535c066e0c9", "score": "0.6918584", "text": "def tramplesMinimize?(_param=1); return false; end", "title": "" }, { "docid": "d4c14f546a1cf9bab352537f911a6b68", "score": "0.66775054", "text": "def minimax(board, ai, human, ai_turn=true)\n score = get_score(board, ai, human)\n return score unless score.nil?\n scores = []\n moves = []\n\n # ai's turn now\n empty_positions = board.each_index.select { |i| board[i] != 'X' && board[i] != 'O' }\n empty_positions.each do |move|\n board_after_move = board.dup\n board_after_move[move] = ai if ai_turn\n board_after_move[move] = human unless ai_turn\n # print_board(board_after_move)\n # puts\n score = minimax(board_after_move, ai, human, !ai_turn)\n scores.push(score)\n moves.push(move)\n # p \"Scores: #{scores}\"\n # p \"Moves: #{moves}\"\n end\n\n if ai_turn\n @best_move = moves[scores.index(scores.max)]\n return scores.max\n else\n return scores.min\n end\nend", "title": "" }, { "docid": "ec3a563e48ff9b9d24a7f36b12371760", "score": "0.6543854", "text": "def minimax(board: self.starting_board, mark: nil, minimax: nil, min_or_max: nil)\n return board if single_move?(board)\n\n mark = determine_mark(board) if mark.nil?\n # Swap min_or_max each level\n min_or_max = (min_or_max == :max ? :min : :max)\n\n if remaining_moves(board) > 0\n board = Quasifractal.new(board).nth_move!(remaining_moves(board))\n end\n\n return value(board: board, mark: mark) if leaf?(board: board)\n\n board.map! do |move|\n minimax(board: move, mark: mark, minimax: true, min_or_max: min_or_max)\n end\n\n if minimax.nil?\n # For outermost board, return an array;\n # don't condense to a single value\n return board\n else\n return (board.select {|el| el.is_a? Numeric}).send(min_or_max)\n end\n end", "title": "" }, { "docid": "c3fbb523f8094675acba1affaad87acb", "score": "0.65406346", "text": "def minimize!\n # I'll implement this when I need it\n end", "title": "" }, { "docid": "f35795f75ff6f2ceeeb9f8e11bbc3cc4", "score": "0.6538362", "text": "def min_x; end", "title": "" }, { "docid": "9e13de402ecc2ece1a5a3dd2195b3b5b", "score": "0.65185726", "text": "def maximize; end", "title": "" }, { "docid": "9e13de402ecc2ece1a5a3dd2195b3b5b", "score": "0.65185726", "text": "def maximize; end", "title": "" }, { "docid": "5a248642f3370ea8ce8f85fc91c7cea2", "score": "0.6512647", "text": "def minimax(new_board, player)\n empty_indexes = empty_indexes(new_board)\n\n if winning?(new_board, HUMAN) then return { score: -10 }\n elsif winning?(new_board, COMPUTER) then return { score: 10 }\n elsif empty_indexes.empty? then return { score: 0 }\n end\n\n moves = []\n empty_indexes.each do |idx|\n move = {}\n move[:index] = new_board[idx]\n new_board[idx] = player\n\n if player == COMPUTER\n result = minimax(new_board, HUMAN)\n move[:score] = result[:score]\n else\n result = minimax(new_board, COMPUTER)\n move[:score] = result[:score]\n end\n\n new_board[idx] = move[:index]\n\n moves << move\n end\n\n best_move = nil\n if player == COMPUTER\n best_score = -10_000\n moves.each_with_index do |move, idx|\n if move[:score] > best_score\n best_score = move[:score]\n best_move = idx\n end\n end\n else\n best_score = 10_000\n moves.each_with_index do |move, idx|\n if move[:score] < best_score\n best_score = move[:score]\n best_move = idx\n end\n end\n end\n moves[best_move]\nend", "title": "" }, { "docid": "2ef85ac8f15f702d4683e433740c9f88", "score": "0.6510491", "text": "def minimax board\n\n\t\t# Return the final score if the game is over\n\t\treturn score(board) if board.game_over\n\n\t\tscores = [] # Array to store possible scores\n\t\tmoves = [] # Array to store possible moves\n\n\t\t# Recursively get possible scores\n\t\tget_moves(board).each do |move|\n\t\t\t# Get a new instance of the board\n\t\t\tpossible = board.new_board\n\n\t\t\t# Add possible move to the board\n\t\t\tadd_possible_move(possible, move)\n\n\t\t\t# Store score and move\n\t\t\tscores.push minimax(possible)\n\t\t\tmoves.push move\n\t\tend\n\n\t\tif board.turn == \"CPU\" # Find and return the max score\n\t\t\tmaxScore = scores.each_with_index.max[1]\n\t\t\t@choice = moves[maxScore]\n\t\t\treturn scores[maxScore]\n\t\telse # Find and return the min score\n\t\t\tminScore = scores.each_with_index.min[1]\n\t\t\t@choice = moves[minScore]\n\t\t\treturn scores[minScore]\n\t\tend\n\n\tend", "title": "" }, { "docid": "501279de236e25150b2af2810c662e42", "score": "0.64679587", "text": "def minimax_indexing(current_node)\n if current_node.board.over?\n return current_node.cost = 1 if current_node.winning_node?(@player_mark) \n return current_node.cost = -1 if current_node.losing_node?(@player_mark)\n return current_node.cost = 0 if current_node.tied?\n end\n \n if current_node.mark == @player_mark #self's turn, find the max among children\n max_cost = -1\n current_node.children.each do |child|\n tmp = minimax_indexing(child) \n max_cost = tmp if tmp > max_cost\n end\n current_node.cost = max_cost\n return current_node.cost \n else #opponent's turn, find the min among children\n min_cost = 1\n current_node.children.each do |child|\n tmp = minimax_indexing(child) \n if tmp < min_cost\n min_cost = tmp\n end\n end\n current_node.cost = min_cost\n return current_node.cost\n end\n end", "title": "" }, { "docid": "80dd6d0ab651d3f91a2d6734e7aac1b4", "score": "0.6443866", "text": "def minimize symb \n Pareto.minimize( self, symb )\n end", "title": "" }, { "docid": "dad0fee2809a69db0b6960522788d4a0", "score": "0.6429918", "text": "def find_closest_unvisited()\r\n\r\nend", "title": "" }, { "docid": "a7d1c45aac5f79739764be1aacf6c734", "score": "0.64232713", "text": "def get_min()\n return nil if stack.length == 0\n stack.min\n end", "title": "" }, { "docid": "f4966a386063b5aaeb06d9994343cffd", "score": "0.6382637", "text": "def minimax(board, is_player)\r\n score = evaluate(board, player, opponent)\r\n\r\n # If player has won the game\r\n # return his evaluated score\r\n return score if score == 10\r\n\r\n # If opponent has won the game\r\n # return his evaluated score\r\n return score if score == -10\r\n\r\n # If there are no more moves and no winner\r\n # then it is a tie, else continue\r\n return 0 unless move?(board)\r\n\r\n # if this is player turn to move\r\n if is_player\r\n best = -1.0 / 0.0\r\n\r\n # looping on all board cells\r\n 3.times do |row|\r\n 3.times do |col|\r\n # Checking if the cell is empty\r\n next unless board[row][col] == '_'\r\n\r\n # Make the move\r\n board[row][col] = player\r\n\r\n # Call minimax recursively and choose\r\n # the maximum value\r\n best = max(best, minimax(board, !is_player))\r\n\r\n # Undo the move\r\n board[row][col] = '_'\r\n end\r\n end\r\n\r\n # if this is opponent turn to move\r\n else\r\n best = 1.0 / 0.0\r\n\r\n # looping on all board cells\r\n 3.times do |row|\r\n 3.times do |col|\r\n # Checking if the cell is empty\r\n next unless board[row][col] == '_'\r\n\r\n # Make the move\r\n board[row][col] = opponent\r\n\r\n # Call minimax recursively and choose\r\n # the maximum value\r\n best = min(best, minimax(board, !is_player))\r\n\r\n # Undo the move\r\n board[row][col] = '_'\r\n end\r\n end\r\n end\r\n best\r\n end", "title": "" }, { "docid": "2d7588c5e6944c4a9e93ebf5e1a7f2b4", "score": "0.63432765", "text": "def minimization_proc(&proc); @min_proc = proc; end", "title": "" }, { "docid": "710ccc076451e636a573efebe9c6c4b9", "score": "0.6342572", "text": "def maximize\n end", "title": "" }, { "docid": "4be792a2c6227e19f0443892ad13d93e", "score": "0.63284886", "text": "def minimax(brd, player)\n best_move = 0\n best_score = -10000 if player == 'Computer' # maximizing player\n best_score = 10000 if player == 'Player' # minimizing player\n empty_squares(brd).each do |empty_square|\n new_board = brd.dup\n puts \"player #{player}\"\n new_board[empty_square] = MARKERS[player]\n display_board(new_board)\n puts \"\"\n puts \"\"\n if someone_won?(new_board) || board_full?(new_board)\n score_current_move = evaluate_move(new_board)\n else\n score_current_move = minimax(new_board, alternate_player(player))[0]\n end\n puts \"score_current_move #{score_current_move}\"\n # maximizing player\n puts \" 111 player #{player}\"\n if player == 'Computer' && score_current_move >= best_score\n best_score = score_current_move\n best_move = empty_square\n # minimizing player\n elsif player == 'Player' && score_current_move <= best_score\n best_score = score_current_move\n best_move = empty_square\n end\n puts \"best_score #{best_score}\"\n puts \"best_move #{best_move}\"\n end\n [best_score, best_move]\nend", "title": "" }, { "docid": "0afcb402cf85e363c917b85e76c89927", "score": "0.63145995", "text": "def Minimax_tree_ab_pruning_player\n test_board = @display.board.dup\n best_move = nil\n best_value = -10000\n\n\n end", "title": "" }, { "docid": "ddbc981c7021be2a677d22fbcf14c2f2", "score": "0.63062555", "text": "def minimize!\n replace minimize\n end", "title": "" }, { "docid": "78b05093eb04a5094a29dac0abd2673e", "score": "0.62851197", "text": "def min\n return if @root.nil?\n _min(@root)\n end", "title": "" }, { "docid": "56ea8253427df89cb9e7c7378eb8b868", "score": "0.6270647", "text": "def mmin(n)\n end", "title": "" }, { "docid": "03027032803d5e8e47db659db71002dd", "score": "0.6207686", "text": "def minimax(game_state, depth, eval_fn = nil)\n @num_states_evaluated = 1\n best = nil\n\n # try each move\n @game_rules.legal_moves(game_state).each do |move|\n # g = game_state.dup\n g = game_state.apply_move(move)\n # evaluate the position and choose the best move\n # NOTE: the minimax function computes the value for the current\n # player which is the opponent so we need to invert the value\n val = -1 * minimax_value(g, depth, eval_fn)\n # update the best operator so far\n if best == nil or val > best[0]\n best = [val, move]\n end\n end\n \n best[1]\n end", "title": "" }, { "docid": "c562d08fcb2b527c0f02991692943345", "score": "0.61963147", "text": "def get_min()\n stack.min\n end", "title": "" }, { "docid": "c9dd118274621477ba7024115f83ba1d", "score": "0.6184122", "text": "def min; end", "title": "" }, { "docid": "c9dd118274621477ba7024115f83ba1d", "score": "0.6184122", "text": "def min; end", "title": "" }, { "docid": "c9dd118274621477ba7024115f83ba1d", "score": "0.6184122", "text": "def min; end", "title": "" }, { "docid": "c9dd118274621477ba7024115f83ba1d", "score": "0.6184122", "text": "def min; end", "title": "" }, { "docid": "e683e8507b4ee43e3de42c5da47ff570", "score": "0.6173595", "text": "def minimax(board, player)\n move_winners = []\n get_free_spaces(board).each do |row, column|\n board[row][column] = player\n @counter += 1\n if winner?(board)\n winner = player\n elsif get_free_spaces(board).empty?\n winner = 0 # tie\n else\n winner, _ = minimax(board, -player)\n end\n move_winners << [winner, [row, column]]\n board[row][column] = 0\n end\n\n if player == 1\n return move_winners.max\n else\n return move_winners.min\n end\n end", "title": "" }, { "docid": "91eaa515b3750bb1675543ae91bd25ba", "score": "0.61733353", "text": "def minimax(brd, depth, alpha, beta, is_maximizing, win_lines)\n if detect_winner(brd, win_lines) || depth >= 5\n return minimax_score(brd, win_lines, depth)\n end\n\n if is_maximizing\n maximizing(brd, depth, alpha, beta, win_lines)\n else\n minimizing(brd, depth, alpha, beta, win_lines)\n end\nend", "title": "" }, { "docid": "3d071a1979db5a10377b87c51195261a", "score": "0.61619186", "text": "def minimax(player)\n best_move = 0\n best_score = -10000 if player == COMPUTER_MARKER\n best_score = 10000 if player == human.marker\n board.unmarked_keys.each do |empty_square|\n board[empty_square] = player\n score_current_move = calculate_score_current_move(player)\n if player == COMPUTER_MARKER && score_current_move >= best_score\n best_score = score_current_move\n best_move = empty_square\n elsif player == human.marker && score_current_move <= best_score\n best_score = score_current_move\n best_move = empty_square\n end\n board[empty_square] = Square::INITIAL_MARKER\n end\n [best_score, best_move]\n end", "title": "" }, { "docid": "0794589128e1c2612c53f710096126d7", "score": "0.6134575", "text": "def find_best_move(brd)\n\n # Shortcircuit first move so 5 is always choosen\n return 5 if empty_squares(brd).count == 9\n\n\n best_val = -INFINITY\n best_move = nil\n\n brd.each do |cell, status|\n if status == INITIAL_MARKER\n brd[cell] = COMPUTER_MARKER\n move_val = minimax(brd, 0, 'player')\n brd[cell] = INITIAL_MARKER\n if move_val > best_val\n best_val = move_val\n best_move = cell\n end\n end\n end\n return best_move\nend", "title": "" }, { "docid": "01fca05b39d6547e8b39afc985f7ba67", "score": "0.6124509", "text": "def minimax(board, p_value, depth = 0, alpha = -10000, beta = 10000)\n return 0 if board.full?\n return -1000 + depth if board.win?\n return heuristic(board, p_value) if depth == @cutoff_depth\n\n board.legal_moves.each do |move|\n copy = Marshal.load(Marshal.dump(board))\n copy.make_move(move, p_value)\n score = -minimax(copy, -p_value, depth + 1, -beta, -alpha)\n return score if score >= beta\n\n alpha = score if score > alpha\n end\n\n alpha\n end", "title": "" }, { "docid": "38533e071b9c2659364ca38e132be753", "score": "0.61204374", "text": "def min_rep; end", "title": "" }, { "docid": "38533e071b9c2659364ca38e132be753", "score": "0.61204374", "text": "def min_rep; end", "title": "" }, { "docid": "38533e071b9c2659364ca38e132be753", "score": "0.61204374", "text": "def min_rep; end", "title": "" }, { "docid": "22708a69ba0f5cbf91f8105e8e71583b", "score": "0.6090407", "text": "def s_min\n return nil if @root.nil?\n\n current_node = @root\n current_node = current_node.left until current_node.left.nil?\n current_node.value\n end", "title": "" }, { "docid": "b8416a4895d0514d243e3e5f06707235", "score": "0.6089034", "text": "def minimax(board, p_value, cutoff_depth, depth = 0, alpha = -10000, beta = 10000)\n return 0 if board.full?\n return -1000 + depth if board.win?\n return heuristic(board, p_value) if depth == cutoff_depth\n\n board.legal_moves.each do |move|\n copy = Marshal.load(Marshal.dump(board))\n copy.move(move, p_value)\n score = -minimax(copy, -p_value, cutoff_depth, depth + 1, -beta, -alpha)\n return score if score >= beta\n\n alpha = score if score > alpha\n end\n\n alpha\n end", "title": "" }, { "docid": "8f7d02f80324538a4eb3cf19e4179e4f", "score": "0.6005649", "text": "def min\n\t w=@M[0][0]\n\t for i in(0..@alt)\n\t for j in(0..@anc)\n\t if(w > @M[i][j])\n\t\tw = @M[i][j]\n\t end\n\t end\n\t end\n\t w\n\tend", "title": "" }, { "docid": "27371fa7546a150af98467ffb1ccbb5b", "score": "0.59978276", "text": "def solve_lowest(arr, maze)\n\n #if there is only one array entry, the pairent node is a dead end and there\n #is no need to compare anything\n\n return arr[0] if arr.length == 1\n\n #we need to associate each name with the marked value of that node\n arr.map! do |node|\n value = maze[node][1]\n return node if value == \"EXIT\"\n [value, node]\n end\n\n # then we sort that array (so the lowest valued node is at the start) and\n # return the name from the first entry\n arr.sort_by{|x, y| x}[0][1]\n\nend", "title": "" }, { "docid": "a594a9b32421dd2b283691c82e6cd7d9", "score": "0.59761304", "text": "def apply_minimize\n @minimize=true\n end", "title": "" }, { "docid": "ac0625e696d1758c62bb0c24abe0a4ad", "score": "0.5973727", "text": "def minimized?\n end", "title": "" }, { "docid": "a055f7835d3c4081699e6ae83c3e9958", "score": "0.5949026", "text": "def min\n end", "title": "" }, { "docid": "88bcffdd34cbefc71e93bb598b2eb0fb", "score": "0.59404695", "text": "def extract_min\n return if is_empty?\n if size == 1\n @size = 0\n value = @root.val\n @root = nil\n return value\n end\n minimum = @root.val\n @size -= 1\n node = @leaf_set.get\n replaced_value = node.val\n @leaf_set.delete(node)\n @incomplete_set.delete(node)\n parent = node.parent\n parent.left == node ? parent.left = nil : parent.right = nil\n @leaf_set.delete(parent)\n @incomplete_set.delete(parent)\n node = nil\n @incomplete_set.insert(parent) if parent.is_incomplete?\n @leaf_set.insert(parent) if parent.is_leaf?\n\n @leaf_set.delete(@root)\n @incomplete_set.delete(@root)\n @root.val = replaced_value\n @incomplete_set.insert(@root) if @root.is_incomplete?\n @leaf_set.insert(@root) if @root.is_leaf?\n heapify(@root)\n return minimum\n end", "title": "" }, { "docid": "c36ccb63a31ed03f57e934d36ea0086f", "score": "0.5924299", "text": "def minimize\n Marshal.load(Marshal.dump(self)).minimize!\n end", "title": "" }, { "docid": "b8f9c0ab4b41b1ab50f24384ddb20802", "score": "0.59241724", "text": "def find_min\n @heap[1]\n end", "title": "" }, { "docid": "21b131ce63ef2431863cc7a0279a16ca", "score": "0.59190595", "text": "def when_to_minimax?(brd)\n empty_squares(brd).size < 12\nend", "title": "" }, { "docid": "d2d025ad64e50dfac2240da2dc6f0e21", "score": "0.5917773", "text": "def minimize\n r = FFI::minimize(faptr)\n raise Error if r < 0\n self\n end", "title": "" }, { "docid": "17f6cfe88a79220a58528321747a09ef", "score": "0.5914035", "text": "def min\r\n return @min_result if @min_result\r\n calc_minmax\r\n @min_result\r\n end", "title": "" }, { "docid": "0c22dad9e4b3e4b3743c70be39a7daf2", "score": "0.5904931", "text": "def find_min\n raise \"Empty heap\" if @list.nil?\n remove_min_tree.first.root\n end", "title": "" }, { "docid": "57961a71a8b7d170995a095a7aeec981", "score": "0.590047", "text": "def deviance\n return @optimization_result.f_minimum \n end", "title": "" }, { "docid": "c8718b01e9b7570d2e16bcd561a8438b", "score": "0.5893947", "text": "def get_best_move(board, depth, player, player_1_game_symbol, player_2_game_symbol)\n # Checks for a value of a move\n if new_gameboard.game_is_over(board, @player_1_game_symbol, @player_2_game_symbol)\n return move_assessment(depth, player, board, player_1_game_symbol, player_2_game_symbol) \n end\n\n # depth keeps numerical value of the moves until the game ends\n depth += 1\n\n # stores the scores from the move_assessment method\n scores = []\n\n # stores the possible moves\n moves = []\n \n # potnetial_turns array keeps track of turns inside of the minimax method\n @potential_turns.each do |move|\n # passes in potential_gameboard array to check for potential moves\n take_turn(potential_gameboard, player, move)\n\n # store potential_gameboard in outcome variable\n outcome = potential_gameboard\n\n # delete move from potential_turns array\n potential_turns.delete(move)\n\n # recursion of the get_best_move method occurs below and the result is pushed into the scores array\n scores.push(get_best_move(outcome, depth, player, player_1_game_symbol, player_2_game_symbol))\n\n # Collects moves\n moves.push(move)\n end\n\n # Based on player during each state, assigns the scores to winning scores or scores to prevent loss\n # It is here that I ran into trouble with the moves array running out of moves and one turn from each player\n # Also inside of this method I encountered the issues with pry in terminal\n if player == @player\n max_score_index = scores.each_with_index.max[1]\n @computer_move = moves[max_score_index]\n return scores[max_score_index]\n else\n min_score_index = scores.each_with_index.min[1]\n @computer_move = moves[min_score_index]\n return scores[min_score_index]\n end\n end", "title": "" }, { "docid": "82e3160cd4a13a4532c9db674dde53f4", "score": "0.5872394", "text": "def maximize symb\n Pareto.maximize( self, symb )\n end", "title": "" }, { "docid": "597a55db797fa69de5928b2d9d8357e6", "score": "0.58714604", "text": "def minimax(board, depth, player, alpha, beta)\r\n if won?(board) or (!won?(board) and board.full?)\r\n return evaluate(board, depth, player)\r\n end\r\n scores = []\r\n index_moves = []\r\n\r\n depth += 1\r\n board.empty_indices.each do |index|\r\n if player\r\n scores << minimax(board.create_newTemp_board(\"O\", index),\r\n depth, false, alpha, beta)\r\n index_moves << index\r\n else\r\n scores << minimax(board.create_newTemp_board(\"X\", index),\r\n depth, true, alpha, beta)\r\n index_moves << index\r\n end\r\n end\r\n\r\n if player\r\n max_index = scores.each_with_index.max[1]\r\n alpha = scores[max_index] > alpha ? scores[max_index] : alpha\r\n\r\n if beta > alpha\r\n @choices << index_moves[max_index]\r\n return alpha\r\n end\r\n\r\n else\r\n min_index = scores.each_with_index.min[1]\r\n beta = scores[min_index] < beta ? scores[min_index] : beta\r\n\r\n if beta > alpha\r\n @choices << index_moves[min_index]\r\n return beta\r\n end\r\n\r\n end\r\n end", "title": "" }, { "docid": "89f3df121c0aa259e35daf86130eff62", "score": "0.5863289", "text": "def min_distance(battlefield, source_square, target_square)\n battlefield.each &:reset\n\n queue = []\n source_square.distance = 0\n queue.push(source_square)\n\n until queue.empty?\n square = queue.shift\n return square.distance if square == target_square\n\n evaluate_square(battlefield.find { |other_square| other_square.x == square.x && other_square.y == square.y - 1 }, queue, square, target_square)\n evaluate_square(battlefield.find { |other_square| other_square.x == square.x - 1 && other_square.y == square.y }, queue, square, target_square)\n evaluate_square(battlefield.find { |other_square| other_square.x == square.x + 1 && other_square.y == square.y }, queue, square, target_square)\n evaluate_square(battlefield.find { |other_square| other_square.x == square.x && other_square.y == square.y + 1 }, queue, square, target_square)\n end\nend", "title": "" }, { "docid": "6f8dc04b22adbda1f2c8c3139a80db1e", "score": "0.5854927", "text": "def min\n end", "title": "" }, { "docid": "6f8dc04b22adbda1f2c8c3139a80db1e", "score": "0.5854927", "text": "def min\n end", "title": "" }, { "docid": "6f8dc04b22adbda1f2c8c3139a80db1e", "score": "0.5854927", "text": "def min\n end", "title": "" }, { "docid": "149e42d8077f0a072d18772b5745dea3", "score": "0.58514625", "text": "def minimax(game, board, player_symbol, depth, current_player_symbol)\n if game.game_is_over(board)\n return get_score(board, depth, game, current_player_symbol)\n end\n\n depth += 1\n scores = []\n moves = []\n board.available_spaces.each do |space|\n new_board = board.dup\n new_board[space.to_i] = player_symbol\n scores << minimax(game, new_board, opposite_player(player_symbol), depth, current_player_symbol) # if game over, store score in array to eventually pass up best score\n moves << space # store move that correlates to stored score above\n end\n \n if current_player_symbol == player_symbol\n # Max calculation\n max_score_index = scores.each_with_index.max[1]\n @spot = moves[max_score_index]\n return scores[max_score_index]\n else\n # Min calculation\n min_score_index = scores.each_with_index.min[1]\n @spot = moves[min_score_index]\n return scores[min_score_index]\n end\n end", "title": "" }, { "docid": "9385b3609ecf6479ffaff4bc61cba606", "score": "0.5848723", "text": "def minimax_value(game_state, depth, eval_fn = nil)\n @num_states_evaluated += 1\n\n # if we have reached the maximum depth, the utility is approximated\n # with the evaluation function\n if depth == 0 or @game_rules.is_over?(game_state)\n if eval_fn\n return eval_fn.call(game_state)\n else\n return game_state.score(position)\n end\n end\n \n best = nil\n \n # try each move\n @game_rules.legal_moves(game_state).each do |move|\n # g = game_state.dup\n g = game_state.apply_move(move)\n # evaluate the position and choose the best move\n # NOTE: the minimax function computes the value for the current\n # player which is the opponent so we need to invert the value\n val = -1 * minimax_value(g, depth-1, eval_fn)\n if best == nil or val > best\n best = val\n end\n end\n\n best\n end", "title": "" }, { "docid": "7a7cb27d1f71dc4dcf5467d2de4c8078", "score": "0.58472246", "text": "def base_min=(_arg0); end", "title": "" }, { "docid": "7a7cb27d1f71dc4dcf5467d2de4c8078", "score": "0.58472246", "text": "def base_min=(_arg0); end", "title": "" }, { "docid": "7a7cb27d1f71dc4dcf5467d2de4c8078", "score": "0.58472246", "text": "def base_min=(_arg0); end", "title": "" }, { "docid": "483b09547c32fc28408af89def8ad5d6", "score": "0.5844696", "text": "def minimo\n\t\tif @matriz.is_a? Array then\n\t\t\tmin = @matriz[0][0]\n\t\t for i in 0...@dimension\n\t\t for j in 0...@dimension\n\t\t if @matriz[i][j] < min\n\t\t min = @matriz[i][j]\n\t\t end\n\t\t end\n\t\t end\n\t\t min\n\t\telsif @matrix.is_a? Hash then\n\t \tmin = @matrix[@matrix.keys.first][@matrix[@matrix.keys.first].keys.first]\n\t \tfor i in @matrix.keys do\n\t \t\tfor j in @matrix[i].keys do\n\t \t\t\tif @matrix[i][j] < min && @matrix[i][j] != 0 then\n\t \t\t\t\tmin = @matrix[i][j]\n\t \t\t\tend\n\t \t\tend\n\t \tend\n\t \tmin\n\t end\n\tend", "title": "" }, { "docid": "22a887b10793176f926a64e835217864", "score": "0.5842689", "text": "def get_nearest_mush_weight\n @sequence[4][1]\n end", "title": "" }, { "docid": "5445e6755b16f65d89a5e1cf76b91859", "score": "0.5841063", "text": "def optimize\n\t\tcase @m\n\t\twhen 0\n\t\t\treturn @n+1\n\t\twhen 1\n\t\t\treturn @n+2\n\t\twhen 2\n\t\t\treturn 2*@n+3\n\t\twhen 3\n\t\t\treturn (2**(@n+3)) - 3\n\t\twhen 4\n\t\t\treturn tetration(2,(@n+3)) - 3\n\t\twhen 5\n\t\t\treturn pentation(2,(@n+3)) - 3\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "36554f27ab94ec935fae5181aabe5e8b", "score": "0.58336174", "text": "def minimax(board, current_player_instance)\n return score(board) if over? #need to build this function or figure out how to use game method\n @@scores ||= {} #collect scores for each position\n # For each available space on the board, loop through and apply min-max recursively\n empty?.each do |space|\n # Copy board so we don't mess up original (IMPORTANT)\n potential_board = board.dup\n # Move the current player to the space on the duplicate board\n potential_board.update(space, current_player_instance)\n # Recurse until the game is over\n # Switch players each time to mimic the rules of Tic-Tac-Toe\n scores[space] = minmax(potential_board, switch(current_player))#need to create switch\n end\n\n\n end", "title": "" }, { "docid": "aa31c3a0d4a29d5d51b7440ac3a4d731", "score": "0.583324", "text": "def minimal_waste(potion_size, bottles) # return integer value of min waste\n return nil if bottles == nil || potion_size == nil || bottles.count < 1\n return recursive_helper(0, bottles, potion_size, bottles.max)\nend", "title": "" }, { "docid": "46e3cd7f264319331fb9feec56d2f9cc", "score": "0.583037", "text": "def heuristic1\n end", "title": "" }, { "docid": "87f23362456e75f1f182052da6626504", "score": "0.58297575", "text": "def min!\n self.pop\n end", "title": "" }, { "docid": "87f23362456e75f1f182052da6626504", "score": "0.58297575", "text": "def min!\n self.pop\n end", "title": "" }, { "docid": "c98decf2b69a04d82616aafb97372988", "score": "0.58286405", "text": "def expedite_first_minimax_spot(board)\n if board.available_spaces.length == 9\n return board.corners[rand(0..3)]\n elsif board.available_spaces.length == 8\n if board.center_taken\n return board.corners[rand(0..3)]\n elsif board.corner_taken\n return 4\n elsif board.edge_taken\n return board.edge_first_minimax_moves[board.first_move]\n end\n end\n end", "title": "" }, { "docid": "ccea3f0ac26338fe1265f03f638e09df", "score": "0.58184254", "text": "def get_min()\n @min_stack[-1]\n end", "title": "" }, { "docid": "cf234730648f3ec5ea14779ba9ae5790", "score": "0.5807595", "text": "def minConflicts(board, xblks, yblks)\n\t\tif board[0][0].is_a?(Array)\n\t\t\tbestCell={:x=>0,:y=>0,:value=>board[0][0][0],:heuristicEvaluation=>numConflicts(board,0,0,board[0][0][0])};#first cell is currently the best option\n\t\telse\n\t\t\tbestCell={:x=>0,:y=>0,:heuristicEvaluation=>board[0].length()*board.length()+1};#this cell already has a value so set it as the current best one with a conflict value greater than a completly unassigned cell grouping(the count of the entire board +1 is greater than any possible minConflicts value)\n\t\tend\n\n\t\tfor row in 0...board.length()\n\t\t\tfor collumn in 0...board[0].length()\n\t\t\t\tif board[row][collumn].is_a?(Array) and board[row][collumn].length()>1\n\t\t\t\t\tboard[row][collumn].each{|possibleValue|\n\t\t\t\t\t\tevaluatedHeuristic=numConflicts(board,row,collumn,possibleValue, xblks, yblks);\n\t\t\t\t\t\tif evaluatedHeuristic<bestCell[:heuristicEvaluation]#new value is lower so its now the best\n\t\t\t\t\t\t\tbestCell[:x]=row;\n\t\t\t\t\t\t\tbestCell[:y]=collumn;\n\t\t\t\t\t\t\tbestCell[:heuristicEvaluation]=evaluatedHeuristic;\n\t\t\t\t\t\t\tbestCell[:value]=possibleValue;\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t#assigning best value to board\n\t\tnewBoard=Array.new(board.length());\n\t\tfor row in 0...board.length()\n\t\t\tnewBoard[row]=Array.new(board[0].length());\n\t\t\tfor collumn in 0...board[0].length()\n\t\t\t\tif board[row][collumn].is_a?(Array)\n\t\t\t\t\tnewBoard[row][collumn]=board[row][collumn].dup();\n\t\t\t\telse\n\t\t\t\t\tnewBoard[row][collumn]=board[row][collumn];\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#newBoard=board.dup();\n\t\tnewBoard[bestCell[:x]][bestCell[:y]]=bestCell[:value];\n\t\treturn newBoard;#below not run\n\tend", "title": "" }, { "docid": "45b26497c150f1fd22803fe31ee40a5a", "score": "0.5804443", "text": "def minmax(board, player)\n winner = determine_winner(board)\n\n if @iterations >= MAX_DEPTH || winner || tie?(board)\n score(winner)\n else\n @iterations += 1\n\n scores = {}\n\n board.each_with_index do |space, i|\n if space.nil?\n potential_board = board.dup\n potential_board[i] = player\n\n # Recurse\n scores[i] = minmax(potential_board, switch(player) )\n end\n end\n\n @best_choice, best_score = best_move(player, scores)\n\n best_score\n end\n end", "title": "" }, { "docid": "6fb091b0fe03d3fc6d39c9e7a116fabd", "score": "0.5798609", "text": "def best_move\n @best_move ||= possibilities.min_by { |_idx, nums| nums.length }\n end", "title": "" }, { "docid": "d87761335b4eaed81d8b341c603f4aab", "score": "0.5795758", "text": "def find_min\n return self unless self.left\n self.left.find_min\n end", "title": "" }, { "docid": "d76f812388f29333c91aa72df7bc91bb", "score": "0.57933956", "text": "def min\n full_peek[1]\n end", "title": "" }, { "docid": "d2a78c25324559276ec923625891f358", "score": "0.5790731", "text": "def min_rep=(_arg0); end", "title": "" }, { "docid": "d2a78c25324559276ec923625891f358", "score": "0.5790731", "text": "def min_rep=(_arg0); end", "title": "" }, { "docid": "d2a78c25324559276ec923625891f358", "score": "0.5790731", "text": "def min_rep=(_arg0); end", "title": "" }, { "docid": "4565ec0b9b218352e3abe14bfe75e281", "score": "0.57793206", "text": "def get_min\n @stack.first\n end", "title": "" }, { "docid": "ee8bf9352011a26d490c5f5d03fe6da8", "score": "0.57752496", "text": "def get_min()\n return @stack.min\n end", "title": "" }, { "docid": "6584ae39238301787d11ff18a76c5bc9", "score": "0.5772945", "text": "def get_best(chromosomes)\n chromosomes.min_by(&:fitness)\nend", "title": "" }, { "docid": "ec9837825d7a041a91a45a499206e11f", "score": "0.5766143", "text": "def find_and_pop_best\n min = @nodes[0]\n @nodes.each do |node|\n if node.f < min.f\n min = node\n end\n end\n pop(min)\n end", "title": "" }, { "docid": "0d290d0454cf4fae7634b17e9ad56573", "score": "0.5763591", "text": "def min()\n mins = []\n mins << in_stack.stack.stack.min unless in_stack.stack.stack.empty?\n mins << out_stack.stack.stack.min unless out_stack.stack.stack.empty?\n mins.min\n end", "title": "" }, { "docid": "9502607718486263247e0299821f0ac4", "score": "0.5763377", "text": "def evaluate_min_push(x)\n current_min = min_stack.last\n if current_min.nil? || x <= current_min\n min_stack.push(x)\n end\n end", "title": "" }, { "docid": "dbac7876f8bfa09894687eaac6a40ae6", "score": "0.57582784", "text": "def my_min_optimized(list)\n smallest = nil\n list.each do |el|\n smallest = el if smallest.nil? || el < smallest\n end\n smallest\nend", "title": "" }, { "docid": "a6b4f18f982d78041a37fbc0d3358576", "score": "0.5749127", "text": "def optimized_mwr(arr, w)\n queue = MinMaxStackQueue.new\n best_range = nil\n\n num_windows = arr.length + 1 - w\n\n arr.each { |n| queue.push(n) }\n\n queue.max\nend", "title": "" }, { "docid": "df3742fd7532de5a94dcec8e8cfeca90", "score": "0.5733512", "text": "def solve\n # @ending = [@map.width - 1, (@map.height - 1)*25]\n @infinity = @map.size * 10\n res = shortest_path_wg(@map.array)\n res.sum\n # prepare_cost_map\n end", "title": "" }, { "docid": "0cac9da70ffd94cf070fc91bdc96f549", "score": "0.5727996", "text": "def evaluate_min_pop()\n last_item = stack.last\n current_min = min_stack.last\n if last_item == current_min\n min_stack.pop\n end\n end", "title": "" }, { "docid": "956a5b434295defea02bc4e519ce46cf", "score": "0.5727101", "text": "def tree_successor(x)\n return if x.nil?\n return tree_minimum(x.right) unless x.right.nil?\n y = x.p\n while !y.nil? && x == y.right\n x = y\n y = y.p\n end\n y\n end", "title": "" }, { "docid": "74dbe80e2ca3c76dfa9d80754440c91f", "score": "0.5723333", "text": "def get_min_distance_in_fringe\n @fringe.reduce(Float::INFINITY) do |memo,node|\n if (node.destination_distance < memo)\n node.destination_distance\n else\n memo\n end\n end\n end", "title": "" }, { "docid": "9ea41a4a1055dc76d5cf3586d959bb66", "score": "0.5714656", "text": "def search_and_eval(state, alpha, beta, depth, minimizer)\n if depth == 0\n return @evaluator.evaluate(state)\n end\n\n @move_finder.find(state).each do |move|\n result = move.result\n eval = search_and_eval(result, alpha, beta, depth-1, !minimizer)\n\n if minimizer\n beta = min(beta, eval)\n else\n alpha = max(eval, alpha)\n end\n \n if beta <= alpha\n # the best move we found is already so good that the next level would not choose it\n break\n end\n end\n\n return (minimizer ? beta : alpha)\n end", "title": "" }, { "docid": "3a787a5b6a49ff5fd3071db31310a848", "score": "0.57130337", "text": "def get_min()\n @stack[-1][1]\n end", "title": "" }, { "docid": "ae7f5a6547cfc7a9e3254089496a1667", "score": "0.5710389", "text": "def min_rewards(array)\n \nend", "title": "" }, { "docid": "97c597bb11c02d23bf0c651ace21c4fa", "score": "0.5699139", "text": "def find_min_priced_restauarnt(list)\n @searchItems = []\n list.each do |name|\n @searchItems.push(@items[name])\n end\n #return the nil values\n @searchItems.compact!\n\n #check for empty array\n return nil if @searchItems.size == 0 || @searchItems.size < list.size\n\n\n #using dynamic programming to solve this problem\n #Using the multi stage graph approach. Consider each searchItem which is list of invertedIndex as a level with nodes.\n #If the last level(n) is destination, then find the mincost from every node in level(n-1) to level(n) , find the min price and store it in the attribute called minprice of invertedIndex class.\n # so now the we have minimimum cost from n-1 to n. Now similary construct it from n-2 level to n-1(which inturn is till nth level).\n # finally at level 1 we have all the elements with the all the cost. Sort them and return the min priced.\n\n if @searchItems.size > 1\n count = @searchItems.size\n\n @searchItems.reverse.each do |item|\n if count == @searchItems.size\n count = count - 1\n next\n end\n successorItem = @searchItems[count]\n item.each do |iIndex|\n cost = 9999999\n id = iIndex.id\n successorItem.each do |sItem|\n\n if sItem.addedIds.include?(iIndex.id)\n iIndex.minPrice = sItem.minPrice\n id = iIndex.id\n\n elsif cost > (sItem.price + iIndex.price)\n cost = sItem.price + iIndex.price\n iIndex.minprice = cost\n id = sItem.id\n end\n end\n iIndex.addedIds = iIndex.addedIds.concat([id])\n end\n end\n\n end\n #should find the min of this array\n temp = @searchItems[0].sort\n temp[0]\n end", "title": "" }, { "docid": "b5a7f2c96c8fe2fd8057fbab97e07620", "score": "0.5696511", "text": "def minimax(codeset, unused_codes)\n minmax = codeset.length + 1 # largest max possible\n codes = nil\n unused_codes.each do |i|\n g = Code.new(i)\n table = {} # table of feedback hits\n max = -1\n codeset.each do |j|\n c = Code.new(j)\n s = c.compare(g) # feedback from c compared with g\n table[s] = table.fetch(s, 0) + 1\n max = table[s] if table[s] > max\n end\n if max < minmax\n codes = [i] # add new minimax to empty list\n minmax = max\n elsif max == minmax\n codes << i # add solution to minimax list\n end\n end\n codes\n end", "title": "" }, { "docid": "a92a4aab666b5ba5f95c1c449eb5ce29", "score": "0.5692006", "text": "def self_move\n max_child = nil\n max_value = -1\n @game_tree.current_node.children.each do |child|\n if child.cost > max_value\n max_child = child\n max_value = child.cost\n end\n end\n #compare boards to find pos and update current_node in game_tree\n (0...3).each do |i|\n (0...3).each do |j|\n if @game_tree.current_node.board[[i,j]] != max_child.board[[i,j]]\n @game_tree.current_node = max_child\n return [i,j]\n end\n end\n end\n end", "title": "" } ]
913cd28d8e07dc1bfd047081d0c0b585
GET /writes/1 GET /writes/1.json
[ { "docid": "e65d5deaa6e805915c1c58820db85294", "score": "0.0", "text": "def show\n @comments = @write.comments\n @comment = Comment.new\n end", "title": "" } ]
[ { "docid": "7704c1b17cab74f48680749540613bef", "score": "0.67102385", "text": "def write(*args)\n get(*args)\n end", "title": "" }, { "docid": "ec497af2ae50b2f1dece510d7e6c323c", "score": "0.668588", "text": "def index\n @writes = Write.all\n end", "title": "" }, { "docid": "ec497af2ae50b2f1dece510d7e6c323c", "score": "0.668588", "text": "def index\n @writes = Write.all\n end", "title": "" }, { "docid": "ac485520a299a9fdeeb1eed05b5916a3", "score": "0.5824429", "text": "def write(request, response); end", "title": "" }, { "docid": "ac485520a299a9fdeeb1eed05b5916a3", "score": "0.5824429", "text": "def write(request, response); end", "title": "" }, { "docid": "4e46df3ef92ad5471d34672757e2ed94", "score": "0.5700633", "text": "def write\n\nend", "title": "" }, { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.56956065", "text": "def write; end", "title": "" }, { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.56956065", "text": "def write; end", "title": "" }, { "docid": "7b05a27fe0243a88a10b5f3f957bdd92", "score": "0.56956065", "text": "def write; end", "title": "" }, { "docid": "399aa6b1e5e493fab16622dd4e8113f0", "score": "0.56931233", "text": "def writers\n handle(@client.get(\"writers\")) { |result| result[\"writers\"] }\n end", "title": "" }, { "docid": "0cbde3742e9bf75db81cac523c8a94c2", "score": "0.56879425", "text": "def create\n @write = Write.new(write_params.merge(user: current_user))\n\n respond_to do |format|\n if @write.save\n format.html { redirect_to @write, notice: 'Write was successfully created.' }\n format.json { render :show, status: :created, location: @write }\n else\n format.html { render :new }\n format.json { render json: @write.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "629967686fccb4df3b6410a889fa474b", "score": "0.56773555", "text": "def written_resources\n find_related_frbr_objects( :writes, :which_resources?) \n end", "title": "" }, { "docid": "88d583e291ae96cf67ce99a9df5bb82b", "score": "0.56393594", "text": "def write_json(object); write object.to_json; end", "title": "" }, { "docid": "c5e5251f3572c621349996a67ed3a916", "score": "0.56122965", "text": "def on_write(response); end", "title": "" }, { "docid": "1a685453b1f62ee826f56ec750393a74", "score": "0.5575694", "text": "def write(*args)\n end", "title": "" }, { "docid": "313b01ae156cee7fc01d0d7f40e5b9c7", "score": "0.5570663", "text": "def writeJSON(filename, data)\n\twriteFile filename, JSON.fast_generate(data)\n\tputs filename\nend", "title": "" }, { "docid": "41c3cf929c4715533c453cde432c7a87", "score": "0.5441403", "text": "def write_data(output)\n IO.write( WRITE_FILE, JSON.pretty_generate(output))\nend", "title": "" }, { "docid": "2b6157eaaf9bd308c27b77ab628a1cad", "score": "0.5410231", "text": "def update\n respond_to do |format|\n if @write.update(write_params)\n format.html { redirect_to @write, notice: 'Write was successfully updated.' }\n format.json { render :show, status: :ok, location: @write }\n else\n format.html { render :edit }\n format.json { render json: @write.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43c0a5b18ac1fbf871735b5f44297280", "score": "0.5395856", "text": "def write!\n self if File.open(@full_name, 'a') { |f| f.write(JSON.generate(@report)) }\n end", "title": "" }, { "docid": "a1f4473955ea5c188db096a0a9eb048e", "score": "0.5380206", "text": "def write\n command :write\n end", "title": "" }, { "docid": "3dbb16804956109868e40e861150684e", "score": "0.5372998", "text": "def write\n write_pending\n end", "title": "" }, { "docid": "9b4550c3eecd81b0701963a3a0365a63", "score": "0.53361756", "text": "def rc_twitter_write_data_json\n rc_twitter_write_handler\n rc_twitter_write_session\n rc_twitter_write_cookies\n end", "title": "" }, { "docid": "04caffac569730ae477d99be9ffc8010", "score": "0.5328537", "text": "def save_file\n url_start = 'https://deadliefoe:[email protected]/v1/tournaments/showdowngg-ChurningTheButter_'\n url_end = '.json?include_participants=1&include_matches=1'\n\n (0..84).each do |num|\n url = url_start + num.to_s + url_end\n response = RestClient.get(url)\n\n open(\"../assets/tournament.json\",\"a\") do |f|\n f.puts(response)\n end\n puts response\n end\nend", "title": "" }, { "docid": "cbe956d4b5be5da720d5ea180cf37e39", "score": "0.5294129", "text": "def generate_report(json, file_name)\n File.open(\"public/#{file_name}.json\",\"w\") do |f|\n f.write(json)\n end \n end", "title": "" }, { "docid": "ffc165f5bd817c41c01849812260d157", "score": "0.5280437", "text": "def writeJSONToFile(b)\r\n count = 0\r\n File.open('data/all.json', 'w') do |json| \r\n json.puts b.getJSON(\"\\t\").chomp(\",\\n\")\r\n end\r\n end", "title": "" }, { "docid": "f17a7df0125c1385b1d274c34b04860f", "score": "0.5250496", "text": "def index\n @writes_a_references = WritesAReference.all\n end", "title": "" }, { "docid": "9037fd8626ac5821842fe2126c6ecf51", "score": "0.5250066", "text": "def write_json(object)\n write object.to_json\n end", "title": "" }, { "docid": "5d17c0afc24ebf435d379ec465462ac4", "score": "0.5247186", "text": "def write\n buf = data.to_json\n options.infile ? File.open(options.infile, 'w') { |f| f.write buf } : puts(buf)\n end", "title": "" }, { "docid": "95ea3f7bdc959d791157a2badfe36975", "score": "0.5230272", "text": "def written_file\n find_by_path(write_path)\n end", "title": "" }, { "docid": "c36d76d3f7dbff9603fb53cfb4ded84b", "score": "0.52266103", "text": "def page title, json\n page = json \n File.open(\"#{@destination}/#{slug(title)}\", 'w') do |file| \n file.write JSON.pretty_generate(page)\n #file.close\n end\nend", "title": "" }, { "docid": "3a5f240e6817a30e69afc9dff29f3fe8", "score": "0.5219556", "text": "def writers\n @artists = Artist.writers.uniq.search(params[:q])\n respond_with @artists.as_json(only: [:id, :name])\n end", "title": "" }, { "docid": "8abed3da7e49fa1318c3338ec048df6a", "score": "0.52145034", "text": "def written; end", "title": "" }, { "docid": "0c122e7ca4a7c3f1a22036c545e3608b", "score": "0.52039665", "text": "def write_requests\n path = output_folder\n FileUtils.makedirs(path)\n\n request_types = %w[errors sessions builds uploads logs sourcemaps traces invalid]\n\n request_types.each do |request_type|\n list = Maze::Server.list_for(request_type).all\n next if list.empty?\n\n filename = \"#{request_type}.log\"\n filepath = File.join(path, filename)\n\n counter = 1\n File.open(filepath, 'w+') do |file|\n list.each do |request|\n file.puts \"=== Request #{counter} of #{list.size} ===\"\n file.puts\n\n if request[:invalid]\n invalid_request = true\n uri = request[:request][:request_uri]\n headers = request[:request][:header]\n body = request[:request][:body]\n else\n invalid_request = false\n uri = request[:request].request_uri\n headers = request[:request].header\n body = request[:body]\n end\n\n file.puts \"URI: #{uri}\"\n file.puts\n\n # Request\n file.puts \"Request:\"\n headers.each do |key, values|\n file.puts \" #{key}: #{values.map {|v| \"'#{v}'\"}.join(' ')}\"\n end\n file.puts\n\n file.puts \"Request body:\"\n if !invalid_request && headers[\"content-type\"].first == 'application/json'\n file.puts JSON.pretty_generate(body)\n else\n file.puts body\n end\n file.puts\n if request.include?(:reason)\n file.puts \"REASON:\"\n file.puts request[:reason]\n file.puts\n end\n file.puts\n\n file.puts \"Request digests:\"\n file.puts JSON.pretty_generate(request[:digests])\n file.puts\n\n # Response\n response = request[:response]\n file.puts \"Response headers:\"\n file.puts JSON.pretty_generate(response.header)\n file.puts\n\n file.puts \"Response body: #{response.body}\"\n file.puts\n file.puts\n\n counter += 1\n end\n end\n end\n end", "title": "" }, { "docid": "34635a02d1deebb3411fc2808a5b436c", "score": "0.5202845", "text": "def set_write\n @write = Write.find(params[:id])\n end", "title": "" }, { "docid": "34635a02d1deebb3411fc2808a5b436c", "score": "0.5202845", "text": "def set_write\n @write = Write.find(params[:id])\n end", "title": "" }, { "docid": "fdd08d769e0f8caae48bcce334e2fd57", "score": "0.5200913", "text": "def status_writable\n @connection.get(endpoint: 'status/writable')\n end", "title": "" }, { "docid": "ac6c6099e7ead84cb4de5c4481939014", "score": "0.5198103", "text": "def write(path, &block)\n # get start time\n times = [Time.now]\n\n # build destination path\n abs_path = File.expand_path(path, @dir)\n\n # generate json\n json = JSON.unparse(block.call)\n\n # write json to destination file, get size\n size = File.write(abs_path, json)\n\n # get end time\n times << Time.now\n\n # add to list of output files\n @files << {\n path: path,\n size: size,\n time: times.last - times.first\n }\n end", "title": "" }, { "docid": "26bb5ed490810a5983f553bd496ab273", "score": "0.51896584", "text": "def write\n write_file\n end", "title": "" }, { "docid": "a7cd06bdb2a537cbdafd5b03f2ba1d99", "score": "0.5177974", "text": "def write\n return if PictureTag.config['disable_disk_cache']\n\n FileUtils.mkdir_p(File.join(base_directory, sub_directory))\n\n File.open(filename, 'w+') do |f|\n f.write JSON.generate(data)\n end\n end", "title": "" }, { "docid": "b20833e5e8b9b1b521a3bcef4739fa7b", "score": "0.51712495", "text": "def update\n respond_to do |format|\n if @write.update(write_params)\n format.html { redirect_to :back, notice: '更新が完了しました' }\n format.json { render :show, status: :ok, location: @write }\n else\n format.html { render :edit }\n format.json { render json: @write.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6f871d262fad2ab2c81aabf6722af094", "score": "0.51601756", "text": "def index\n @activity_writings = ActivityWriting.all\n end", "title": "" }, { "docid": "2396d94320be5542393a90b6dee9daec", "score": "0.51504487", "text": "def writeJson(output, outputFilePath)\n outFile = File.new(outputFilePath, \"w\");\n JSON.dump(output, outFile);\n outFile.close();\nend", "title": "" }, { "docid": "2374c30471b6b8b1928b16ae41a6d90b", "score": "0.51378995", "text": "def index\n @write_ins = WriteIn.all\n end", "title": "" }, { "docid": "f4fd64448d61fef902d1a78b75e9af82", "score": "0.5130004", "text": "def write\n begin\n unless File.exists? @fileLocation\n FS.cmd \"mkdir -p #{@fileLocation}\"\n end\n fileLoc = @fileLocation + \"/audit-\" +@type+ @ts.to_s + \".json\"\n #fileCurrent = @fileLocation + \"/audit-\" +@type+ \"-current\" + \".json\"\n if @list.length > 0\n Gitchefsync.logger.debug \"event_id=write_audit:file_loc=#{fileLoc}\"\n file = File.open(fileLoc, \"w\")\n list_hash = Array.new\n @list.each do |item|\n list_hash << item.to_hash\n end\n audit_hash = Hash.new\n audit_hash['host_ip'] = (FS.cmd \"hostname -I\").strip\n audit_hash['host_source'] = (FS.cmd \"hostname -f\").strip\n audit_hash['date'] = Time.now\n #time taken from time of start of audit process -construction, until it's writing (now)\n audit_hash['audit_written_secs'] = Time.now.to_i - @ts\n audit_hash['num_items'] = list_hash.length()\n audit_hash['items'] = list_hash\n json = JSON.generate(audit_hash)\n file.write(json)\n #create sym link to this file\n latest = @fileLocation+ \"/audit_\" + @type + \"_latest.json\"\n if File.exists? latest\n File.delete latest\n end\n File.symlink(file,latest)\n else\n Gitchefsync.logger.debug \"event_id=no_write_audit\"\n end\n rescue IOError => e\n raise e\n ensure\n file.close unless file.nil?\n end\n end", "title": "" }, { "docid": "1c821937565d41a6a0ff18f378b0fe26", "score": "0.5121943", "text": "def write\n actions << {\n 'type' => 'write'\n }\n self\n end", "title": "" }, { "docid": "15fb392725e0910d5552bfd6f6d7080c", "score": "0.5110365", "text": "def save\n json = {name: self.name, email: self.email, permissions: self.permissions}.to_json\n\n File.open('users.json', 'a') do |file|\n file.puts(json)\n end\n\n # The above block can be rewritten like so:\n # file = File.open('users.json', 'a')\n # file.puts(json)\n end", "title": "" }, { "docid": "a8c71f9f6e78835253c36a9482d5fbd6", "score": "0.51096845", "text": "def write(io); end", "title": "" }, { "docid": "a8c71f9f6e78835253c36a9482d5fbd6", "score": "0.51096845", "text": "def write(io); end", "title": "" }, { "docid": "022667b1a322864ec49c99f462d8b949", "score": "0.50883174", "text": "def generate_json(path)\n require \"json\"\n if path.respond_to?(:write) # STDOUT\n path.write JSON.pretty_generate(data)\n else\n File.open path, \"w\" do |f|\n f.write JSON.pretty_generate(data)\n end\n end\n end", "title": "" }, { "docid": "6603a2c596aa3cff7f9af78f0a986a1e", "score": "0.5074549", "text": "def as_json(*args)\n h = {}\n h[:read] = true if @read\n h[:write] = true if @write\n h.empty? ? nil : h.as_json\n end", "title": "" }, { "docid": "3bbb0dbfb4e6076e6c5e4f0245e5e8e9", "score": "0.5059832", "text": "def writings\n find_related_frbr_objects( :writes, :which_works?) \n end", "title": "" }, { "docid": "fb3dbeb4f6aab172246e8dbc0b8dd56b", "score": "0.50567377", "text": "def write_to_file(result)\n File.open(\"#{Rails.root}/stat_#{Time.now.to_s}\", 'w+') do |file|\n file << result.to_json\n end\n end", "title": "" }, { "docid": "2095b878ae3a2b329bcfed69dc311b85", "score": "0.5049042", "text": "def index\n @writers = Writer.order(\"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @writers }\n end\n end", "title": "" }, { "docid": "aa39dbb229ae17481f99ab1df2fa35b5", "score": "0.5042993", "text": "def save_as(name)\n File.open(\"#{name}.json\", 'w') { |file| file.write @json }\n end", "title": "" }, { "docid": "6d3764e3e955e8dc45926e0437c27b96", "score": "0.5034139", "text": "def write\n container.file.open(full_name, \"w\") do |m|\n m.puts JSON.pretty_generate(self)\n end\n\n stored\n end", "title": "" }, { "docid": "16758e2b1a669bcc38b227fd3287de6b", "score": "0.50254947", "text": "def epept_getoutput(uri, nodeType)\n puts @HOST + uri + '/' + nodeType;\n resp = @clnt.get(@HOST + uri + '/' + nodeType);\n jsonResp = JSON.parse(resp.content);\n jsonChild = jsonResp['children'];\n jsonChild.each() do |child|\n puts 'saving:' + child['name']\n fileResp = @clnt.get(@HOST + uri + '/' + nodeType + '/' + child['name']);\n open(@outpath +\"/\"+ @formName + \"_\" + child['name'], \"wb\") { |file|\n file.write(fileResp.content)\n }\n end\nend", "title": "" }, { "docid": "0eece30e5ad9dcfcd88df9db8a522daa", "score": "0.5024183", "text": "def write_out path = String.new\n writer = ::MARC::Writer.new(self.path)\n get_records.collect { |doc| writer.write marc_record_from_response_doc(doc) }\n writer.close\n end", "title": "" }, { "docid": "6fa3ce4758bbc88b95aafa426af66dd2", "score": "0.50237614", "text": "def write_rooms\n\n file_data = rooms.map do |current_room|\n {\n id_number: current_room.id_number,\n name: current_room.name,\n description: current_room.description,\n exits: current_room.exits\n }\n end\n File.write(WORLD_DATABASE, JSON.pretty_generate(file_data))\n\n end", "title": "" }, { "docid": "b2d7fbbe43291529ebe346a90a01a64f", "score": "0.5019428", "text": "def create\n @writer = Writer.create(writer_params)\n\n # respond_to do |format|\n if @writer.save\n # format.html { redirect_to outlets_path, notice: 'Writer was successfully created.' }\n render json: { notice: 'Writer was successfully created.', writer: @writer.as_json(:include => {:jobs => {only: [:outlet_id]}})}\n else\n # format.html { render :new }\n render json: { errors: @writer.errors, status: :unprocessable_entity }\n end\n # end\n end", "title": "" }, { "docid": "59af4bd4ccbdfe4a2edf510930e53e0b", "score": "0.5019274", "text": "def write_game(id = game_id)\n file = File.open(storage_path.join(fname_for(id)), 'w')\n file.write JSON.generate(game_data)\n file.close\n end", "title": "" }, { "docid": "4351e9b045c44ed06fa498c194996e7b", "score": "0.5016501", "text": "def write(path, value)\n if path.empty?\n @result = value\n elsif (write_target = @result)\n i = 0\n prefinal_steps = path.size - 1\n # Use `while` to avoid a closure\n while i < prefinal_steps\n path_part = path[i]\n i += 1\n write_target = write_target[path_part]\n end\n path_part = path[i]\n write_target[path_part] = value\n else\n # The response is completely nulled out\n end\n\n nil\n end", "title": "" }, { "docid": "d23d09a397917c1606bfeb91d8121922", "score": "0.50084066", "text": "def write(*args, &block)\n @io.write(*args, &block)\n end", "title": "" }, { "docid": "4054315ef7310fbbd333561e2481982b", "score": "0.5008242", "text": "def get!( name, stream=false ) \n file = nil\n response = CouchDB.get( uri_for( name, false ), true ) rescue nil\n data = response && response.respond_to?(:keys) ? Base64.decode64( response['data'] ) : nil\n if data || response\n file = Tempfile.new( CGI.escape( name.to_s ) ) \n file.binmode if file.respond_to?( :binmode )\n data ? file.write( data ) : file.write( response )\n file.rewind \n self[name] = file\n end \n stream ? file.read : file\n end", "title": "" }, { "docid": "30a1134346b9a0ae8dfaee1683bfaca4", "score": "0.5003493", "text": "def write(str)\n puts self.writings(str)\n end", "title": "" }, { "docid": "2a2e60d9073f1a9a44dabe8a5a93bc88", "score": "0.500335", "text": "def get_results(response)\n File.write(\"new_videos.json\",response.to_json)\n puts response.to_json\nend", "title": "" }, { "docid": "a6f6de5df29a806ae87d26b5959ec1e8", "score": "0.50022924", "text": "def write_json(opts)\n opts[:contents] = JSON.dump(opts[:contents])\n write(:json, opts)\n end", "title": "" }, { "docid": "38ab70282f2ef72296ee804e12c3d935", "score": "0.49969646", "text": "def set_writes_a_reference\n @writes_a_reference = WritesAReference.find(params[:id])\n end", "title": "" }, { "docid": "0adfc5697bae54f91a985472e56ab995", "score": "0.49943683", "text": "def written=(_arg0); end", "title": "" }, { "docid": "f7b78fdc189dacad97d5082098078dd9", "score": "0.49938813", "text": "def write(content)\n File.open(@filename, 'w') { |f| f.write(JSON.generate(content)) }\n end", "title": "" }, { "docid": "82e6e50d92c876c6385fdf6f58751ffe", "score": "0.49914882", "text": "def write_to_json(json_writer = nil)\n json_writer ||= Oj::StringWriter.new(mode: :rails)\n json_writer.push_array\n\n collection.each do |model|\n serializer.new(model, options).write_to_json(json_writer)\n end\n\n json_writer.pop\n json_writer\n end", "title": "" }, { "docid": "1c895cbe7562822359710e38fa395472", "score": "0.4987366", "text": "def write_to(io)\n end", "title": "" }, { "docid": "23a8ea7b3319896af8ab389fe362e58e", "score": "0.4977318", "text": "def write_json(body)\n File.write(\"#{ENV['HOME']}/Desktop/mock_analytics-#{Time.now.to_i}.json\", body)\n end", "title": "" }, { "docid": "0a0d28cfbee63e871b257502e10bcde5", "score": "0.49768704", "text": "def save_as_JSON(monsters)\n File.open(\"db/#{@key}.json\",\"w\") do |f|\n f.write(monsters.to_json)\n end\n end", "title": "" }, { "docid": "c199647e83bc7b56f404c2b3254ef35d", "score": "0.4972144", "text": "def write(data); end", "title": "" }, { "docid": "c199647e83bc7b56f404c2b3254ef35d", "score": "0.4972144", "text": "def write(data); end", "title": "" }, { "docid": "c199647e83bc7b56f404c2b3254ef35d", "score": "0.4972144", "text": "def write(data); end", "title": "" }, { "docid": "c199647e83bc7b56f404c2b3254ef35d", "score": "0.4972144", "text": "def write(data); end", "title": "" }, { "docid": "130cddcc4ed0969d45abd75b25e47962", "score": "0.49694762", "text": "def write_keys\n file_to_write = \"#{File.dirname(__FILE__)}/geo_srv_info\"\n\n File.open(file_to_write, 'w') do |file|\n check_keys\n file.write(@@keys.to_json)\n end\n end", "title": "" }, { "docid": "6f3297e47c52f13ec87106ac7cb51309", "score": "0.49642834", "text": "def write(key, data)\n @writers.each do |vault_server|\n Vault.with_retries(Vault::HTTPConnectionError, attempts: 5) do\n vault_server.logical.write(key, data)\n end\n end\n end", "title": "" }, { "docid": "4f219422057963d9fffa2b61a1819389", "score": "0.49627417", "text": "def write(data)\n end", "title": "" }, { "docid": "c42d424ee1dd0db6a7dfe43ffc732a0c", "score": "0.4948482", "text": "def sync!\n # bump the timestamp every time we sync\n @timestamp = Time.now.to_i\n\n File.write(path, JSON.pretty_generate(to_h))\n end", "title": "" }, { "docid": "d48093dc6b476845ffcd898894c64f16", "score": "0.49440747", "text": "def write\n File.write \"bower.json\", contents.to_json\n end", "title": "" }, { "docid": "0e75dfa0c12e9d838df50b23bd7a4986", "score": "0.49416646", "text": "def write\n raise 'Please define this in a subclass. Use the available @client member.'\n end", "title": "" }, { "docid": "08c9ac6191b2c7f5dfdf39ab1de3e44b", "score": "0.49416608", "text": "def get_outputs\n write format(MESSAGE_TYPE_GET_OUTPUTS)\n handle_response MESSAGE_TYPE_GET_OUTPUTS\n end", "title": "" }, { "docid": "751fd260c7fb79d8c0e5cce256307972", "score": "0.49350426", "text": "def write_json_file(path)\n json = {\n 'info' => 'some info',\n 'coordinates' => 1_000_000.times.map do\n {\n 'x' => rand,\n 'y' => rand,\n 'z' => rand,\n 'name' => ('a'..'z').to_a.shuffle[0..5].join + ' ' + rand(10000).to_s,\n 'opts' => {'1' => [1, true]},\n }\n end\n }\n\n File.open(path, 'w') {|f| JSON.dump(json, f) }\nend", "title": "" }, { "docid": "25c6bf4a608086aecc738cd09891d67f", "score": "0.4934648", "text": "def write_metrics_to_file(json_dataset)\n filename = @time_stamp_obj.utc.strftime('%Y%m%dT%H%M%SZ') + '.json'\n dirname = \"#{@metrics_dir}/#{@metric_type}/#{@hostname}\"\n file_path = \"#{dirname}/#{filename}\"\n FileUtils.mkdir_p(dirname) unless File.directory?(dirname)\n puts \"Creating json file: #{file_path}\" if @verbose\n File.write(file_path, json_dataset)\n end", "title": "" }, { "docid": "687fc799b43d3abb5863ff6f6a550591", "score": "0.49273962", "text": "def write_users_to_file\n return unless @changed_since_last_write\n\n File.write(@users_path, JSON.pretty_generate(@users))\n log 'Writing $users to file.'\n @changed_since_last_write = false\n end", "title": "" }, { "docid": "466eb05cb230512df9e04b8314e5553b", "score": "0.49255946", "text": "def index\n song = Song.find_by(id: params[:song_id])\n render json: song, include: :rewrites\n end", "title": "" }, { "docid": "201caa23b3a70beb3d35c10b582a882b", "score": "0.49249706", "text": "def save_sensordata(data, dir=\"./\")\n fname = sprintf(\"/Sensor-%s-%s.txt\", data[\"type\"], Time.now.strftime(\"%Y%m%d-%H%M%S\"))\n\n check_dir(dir) \n f = open(dir + fname, \"w\")\n f.puts(data.to_json)\n f.close\nend", "title": "" }, { "docid": "4ae5b3cf0da6c911af29451898bfe227", "score": "0.49216133", "text": "def write(url = nil, data = nil, list: nil, reload: true, urls: {})\n #\n # Parsed data from the Linked Data API has the following structure:\n # { url => {primary-object},\n # related-url1 => {related-object1}, ... }\n # where url => {primary-object} is the object referenced by the url\n # parameter, and the related URLs/objects are objects referenced by\n # the primary object and included in the API response.\n #\n # The primary and related objects are written to the caching before any\n # object references within the primary and related objects are followed.\n # This should reduce unnecessary duplication of API calls.\n #\n # Some objects with a linked data URL are not accessible through that\n # API(e.g. users /users/<user-id> are not accessible, but user notes\n # /users/<user-id>/notes<note-id> are accessible).\n #\n # Some objects with a linked data URL are accessible though the API but\n # do not return JSON-LD (e.g. events /events/<event-id> return regular\n # JSON rather than JSON-LD). These objects are cached but no attempt is\n # made to follow LD references within them.\n #\n # byebug if url.is_a?(String) && url.include?('34C1190E-F50E-35CB-94C9-F476963D69C0')\n # byebug if url.is_a?(Aspire::Caching::CacheEntry) && url.url.include?('34C1190E-F50E-35CB-94C9-F476963D69C0')\n entry = cache_entry(url, list)\n return unless entry && write?(entry, urls, list, reload)\n write_data(entry, urls, data, list, reload)\n rescue NotCacheable\n # cache.logger.debug(\"#{url} not cacheable\")\n rescue StandardError => e\n # Log the error and continue processing\n Raven.capture_exception(e)\n # cache.logger.error(\"#{e}\\n#{e.backtrace.join('\\n')}\")\n cache.logger.error(e.to_s)\n rescue Exception => e\n # Log the error and fail\n Raven.capture_exception(e)\n # cache.logger.fatal(\"#{e}\\n#{e.backtrace.join('\\n')}\")\n cache.logger.fatal(e.to_s)\n raise e\n end", "title": "" }, { "docid": "02da13596efde234b4f3d28cc5db5375", "score": "0.49208343", "text": "def index\n @writings = Writing.all\n @writing = Writing.new\n end", "title": "" }, { "docid": "68bbe26bd7404f488484737d49028c56", "score": "0.49157894", "text": "def write_json(user_hash)\n json = read_json()\n feedback = check_values(user_hash)\n # append user_hash array to json data (existing or empty), then write beautified data to user.json\n File.open(\"public/users.json\",\"w\") { |f| f.puts JSON.pretty_generate(json << user_hash) } if feedback == \"\"\nend", "title": "" }, { "docid": "7a80071dad6860ec52196c5477ceb523", "score": "0.49131998", "text": "def generate_json\n jsons = []\n boards.each do |board|\n board_path = user_dir.join(board['id'].to_s + '.json')\n File.write(board_path, board.to_json)\n jsons.push(board_path)\n end\n jsons\n end", "title": "" }, { "docid": "3fc13bbbb2af8cb0312e8359d78fda87", "score": "0.4911973", "text": "def write data\n send_data data\n end", "title": "" }, { "docid": "b44660c44002214a23424615890231a1", "score": "0.4909684", "text": "def write\n __ensure_path\n File.open(@path, 'w') do |f|\n f.write(JSON.generate(@hash))\n end\n end", "title": "" }, { "docid": "8e36bcd3d6c4ed5abab5cf517af36c74", "score": "0.49065676", "text": "def save_json(name, json)\n File.open(\"tmp/#{name}.json\", \"w\") { |file| file.write(JSON.pretty_generate(json)) }\n end", "title": "" }, { "docid": "8e36bcd3d6c4ed5abab5cf517af36c74", "score": "0.49065676", "text": "def save_json(name, json)\n File.open(\"tmp/#{name}.json\", \"w\") { |file| file.write(JSON.pretty_generate(json)) }\n end", "title": "" }, { "docid": "874d4557740e2457472371f287cc1735", "score": "0.49046984", "text": "def save\n File.open(filepath, 'w') do |file|\n file.write to_json + \"\\n\"\n end\n end", "title": "" }, { "docid": "84d7bd514fc375e44e1cced7e7cb5f9b", "score": "0.49002787", "text": "def create_json (responsebody)\n\n\topen('mydata.json','w') { |f|\n\t\tf.puts(responsebody)\n\t}\n\nend", "title": "" }, { "docid": "09d7d243662c3f7f334596127f3e2593", "score": "0.48987886", "text": "def refresh\n File.atomic_write('data/copy.json') do |file|\n file.write(copy_api_records)\n end\n render json: copy_api_records\n end", "title": "" }, { "docid": "0823a19c29c7ff1e9bcc067c425189db", "score": "0.48972878", "text": "def show\n @writes_ups = WriteUp.find(params[:id]) \n end", "title": "" } ]
88c63af9b01a8aaad07ac15af8c0feb1
POST /imes/d089hs POST /imes/d089hs.json
[ { "docid": "ed233d19bed5e66aff8cc2c7e6c384f1", "score": "0.64865583", "text": "def create\n @imes_d089h = Imes::D089h.new(imes_d089h_params)\n\n respond_to do |format|\n if @imes_d089h.save\n format.html { redirect_to @imes_d089h, notice: 'D089h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d089h }\n else\n format.html { render :new }\n format.json { render json: @imes_d089h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "7d77ff5d544b3539f60c355fd7b565b8", "score": "0.61983204", "text": "def create\n @imes_d888h = Imes::D888h.new(imes_d888h_params)\n\n respond_to do |format|\n if @imes_d888h.save\n format.html { redirect_to @imes_d888h, notice: 'D888h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d888h }\n else\n format.html { render :new }\n format.json { render json: @imes_d888h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c8a965f5f9d0e06db3f16be9e972690", "score": "0.6177935", "text": "def create\n @imes_d238h = Imes::D238h.new(imes_d238h_params)\n respond_to do |format|\n if @imes_d238h.save\n format.html { redirect_to @imes_d238h, notice: 'D238h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d238h }\n else\n format.html { render :new }\n format.json { render json: @imes_d238h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce8a17eab1f8a591f8f8146f65f7bede", "score": "0.6144362", "text": "def create\n @imes_d272h = Imes::D272h.new(imes_d272h_params)\n\n respond_to do |format|\n if @imes_d272h.save\n format.html { redirect_to @imes_d272h, notice: 'D272h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d272h }\n else\n format.html { render :new }\n format.json { render json: @imes_d272h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4c826131a9835f00b245c8a84dfa1f95", "score": "0.60880876", "text": "def create\n @imes_d309h = Imes::D309h.new(imes_d309h_params)\n\n respond_to do |format|\n if @imes_d309h.save\n format.html { redirect_to @imes_d309h, notice: 'D309h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d309h }\n else\n format.html { render :new }\n format.json { render json: @imes_d309h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3d1dd0af009494c38658f8c019505d63", "score": "0.602362", "text": "def create\n @imes_d600h = Imes::D600h.new(imes_d600h_params)\n\n respond_to do |format|\n if @imes_d600h.save\n format.html { redirect_to @imes_d600h, notice: 'D600h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d600h }\n else\n format.html { render :new }\n format.json { render json: @imes_d600h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b7c5af81e7ef85fb1c0db8b21c19ca57", "score": "0.58840233", "text": "def create\n @imes_d031h = Imes::D031h.new(imes_d031h_params)\n\n respond_to do |format|\n if @imes_d031h.save\n format.html { redirect_to @imes_d031h, notice: 'D031h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d031h }\n else\n format.html { render :new }\n format.json { render json: @imes_d031h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e76861d8eab9e1ad8daa11655355c08", "score": "0.58421284", "text": "def create\n @imes_q001h = Imes::Q001h.new(imes_q001h_params)\n\n respond_to do |format|\n if @imes_q001h.save\n format.html { redirect_to @imes_q001h, notice: 'Q001h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_q001h }\n else\n format.html { render :new }\n format.json { render json: @imes_q001h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a725850f84e1b47d12c9f4a9a848d6f", "score": "0.58063346", "text": "def create\n @play_field = PlayField.new(play_field_params)\n @play_field.user = current_user\n respond_to do |format|\n if @play_field.save\n for i in 0..23\n # binding.pry\n if params[:times] && params[:times][i.to_s]\n avail = true\n else\n avail = false\n end\n timeslot = Timeslot.new( { play_field: @play_field, at_hour: i, available: avail })\n timeslot.save\n end\n format.html { redirect_to @play_field, notice: 'Play field was successfully created.' }\n format.json { render :show, status: :created, location: @play_field }\n else\n format.html { render :new }\n format.json { render json: @play_field.errors, status: :unprocessable_entity }\n end\n end\n\n uri = URI.parse(\"http://45.55.30.36/api/canchas\")\n\n # Shortcut\n response = Net::HTTP.post_form(uri, { \"uuid\" => @play_field.id, \"name\" => @play_field.name, \"latitude\" => @play_field.geoloc.split(',')[0], \"longitude\" => @play_field.geoloc.split(',')[1] } )\n\n puts response\n # Full control\n # http = Net::HTTP.new(uri.host, uri.port)\n\n # request = Net::HTTP::Post.new(uri.request_uri)\n # request.set_form_data({\"q\" => \"My query\", \"per_page\" => \"50\"})\n\n # Tweak headers, removing this will default to application/x-www-form-urlencoded \n # request[\"Content-Type\"] = \"application/json\"\n\n # response = http.request(request)\n end", "title": "" }, { "docid": "0aa6ada5d98f986b424ee64d9a9f80d8", "score": "0.57776266", "text": "def create\n @imes_d300h = Imes::D300h.new(imes_d300h_params)\n\n respond_to do |format|\n if @imes_d300h.save\n format.html { redirect_to @imes_d300h, notice: 'D300h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d300h }\n else\n format.html { render :new }\n format.json { render json: @imes_d300h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "952dbdda660421a8408a8df37a7d860c", "score": "0.5754229", "text": "def create\n \n \tputs params.inspect\n \n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/days.json')\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n#\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n#\t\trequest.set_form_data(ActiveSupport::JSON.encode(params))\n#\t\trequest.set_form_data({:day => params['day']})\n\t\treq = ActiveSupport::JSON.encode(params);\n\t\tputs req\n\t\trequest.set_form_data(params)\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n \n=begin\n @day = Day.new(params[:day])\n\n respond_to do |format|\n if @day.save\n format.html { redirect_to @day, notice: 'Day was successfully created.' }\n format.json { render json: @day, status: :created, location: @day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "title": "" }, { "docid": "462e91c077542fc8ef939f687caceabf", "score": "0.56074125", "text": "def post_json(url, input_json)\n # we don't need the serial hash anymore so we\n # can reuse the serial json payload from the sensor\n input_json.delete \"hash\"\n\n # parse our input url\n uri = URI.parse(url)\n\n # make a new request\n req = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'})\n\n\n # have to format it as json again with .to_json to avoid a\n # undefined method 'bytesize' for #<Hash: ...\n # error message.\n req.body = input_json.to_json\n\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req)}\n puts \"Response #{response.code} #{response.message}: #{response.body}\"\nend", "title": "" }, { "docid": "3cd66e8669dc418c80e63c13c6ca1c45", "score": "0.55344075", "text": "def create\n @heart = Heart.new heart_params_with_datetime\n split_heart_by_minute(@heart).each(&:save!)\n render :json => { :hello => \"world\" }.to_json\n rescue Exception => e\n render :json => { :error => e.message }.to_json\n end", "title": "" }, { "docid": "70bbcc364e7b409f10e4e9511536431f", "score": "0.55179393", "text": "def post(rectype,attribs,http)\r\n endpoint=\"#{URL_PREFIX}/t#{rectype}s.json\"\r\n req = Net::HTTP::Post.new(endpoint,initheader = {'Content-Type' =>'application/json'})\r\n req.body = attribs.to_json\r\n http.request(req)\r\nend", "title": "" }, { "docid": "2e5e72f72b43b855b6712345503cf7d5", "score": "0.55128837", "text": "def create\n @imes_d302h = Imes::D302h.new(imes_d302h_params)\n\n respond_to do |format|\n if @imes_d302h.save\n format.html { redirect_to @imes_d302h, notice: 'D302h was successfully created.' }\n format.json { render :show, status: :created, location: @imes_d302h }\n else\n format.html { render :new }\n format.json { render json: @imes_d302h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a101637da0aa69820ef325c82c21eb35", "score": "0.55127144", "text": "def POST(api_url_m1)\n uri = URI(ENV['API_URL_M'] + api_url_m1)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri)\n request[\"Content-Type\"] = 'application/json'\n request[\"Authorization\"] = $bearerToken\n request[\"Cache-Control\"] = 'no-cache'\n request.body = \"{\\n device: 'string',\\n user_name: 'string',\\n team: 'string',\\n work_order: 'string',\\n planned_start_dt: '2018-07-05T20:20:07.819Z',\\n planned_end_dt: '2018-07-05T20:20:07.819Z',\\n time_zone: 'EST',\\n down_time: true,\\n description: 'test55',\\n title: 'test55',\\n cmp_number: 0,\\n url: 'jnj.mdsol.com'\\n}\"\n response = http.request(request)\n puts response.read_body\n $lastJsonResponse = JSON.parse($response.read_body)\nend", "title": "" }, { "docid": "5c167245016dc5008a8d3605265972ec", "score": "0.5509026", "text": "def createjson\n ignore = [\"id\", \"updated\", \"createdAt\",\"deleted\"]\n incident_params = params[:incident].except(*ignore)\n @incident = Incident.new(injured_parts: incident_params[:injuredParts], description: incident_params[:description], activity: incident_params[:activity], address: incident_params[:location], cause: incident_params[:cause], prevention: incident_params[:prevention])\n @incident.date_time = params[:dateTime]\n @incident.incidentcategory_id = params[:incidentCategory][:id]\n @incident.status = \"pending\"\n if @user\n @incident.user_id = @user.id\n end\n if @incident.save\n params[:witnesses].each do |record|\n victim = Witness.new(name: record[:name], remark: record[:remark], contact: record[:contact])\n victim.incident_id = @incident.id\n victim.save\n end\n\n params[:victims].each do |record|\n offender = Victim.new(name: record[:name], address: record[:address], remark: record[:remark], contact: record[:contact], role: record[:role], employee: record[:employee], supervisor: record[:supervisor], email: record[:email])\n offender.incident_id = @incident.id\n end\n new_incident_email(@incident)\n json_response(@incident)\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "166e3bf888520eb71951af1157142ad7", "score": "0.5482337", "text": "def create\n json_hash = params[:tph_register]\n \n ret_json = nil\n ret_sts = nil\n begin\n p_device = IotDevice.find_by(uname: json_hash['dsrc'])\n if p_device\n p_device.tph_records.create(dt: json_hash['dt'], t: json_hash['t'], p: json_hash['p'], h: json_hash['h'], loc: p_device.device_location.loc_ident)\n #tmp_d = TphData.new(dt: json_hash['dt'], t: json_hash['t'], p: json_hash['p'], h: json_hash['h'])\n #p_device.tph_datum << tmp_d\n #p_device.tph_datum.build( { dt: json_hash['dt'], t: json_hash['t'], p: json_hash['p'], h: json_hash['h'] } )\n \n ret_json = {status: 'SUCCESS'}\n ret_sts = :ok\n else\n logger.error(\"Couldn't find IotDevice. The data[dsrc=>#{json_hash['dsrc']}] sent by one device was invalid.\")\n \n ret_json = {status: 'FAILED'}\n ret_sts = 500\n end\n \n rescue ActiveRecord::RecordInvalid => ri_ex\n logger.error(ri_ex.record.errors.full_messages)\n \n ret_json = {status: 'FAILED'}\n ret_sts = 500\n rescue => ex\n logger.error(ex.message)\n \n ret_json = {status: 'FAILED'}\n ret_sts = 500\n end\n \n render json: ret_json, status: ret_sts\n end", "title": "" }, { "docid": "c94bdcab36827caf10c1bbeff9e61129", "score": "0.5448272", "text": "def set_imes_d089h\n @imes_d089h = Imes::D089h.find(params[:id])\n end", "title": "" }, { "docid": "22201f22e629399ac67e583badeab894", "score": "0.54181945", "text": "def post_users_json payload\n\tJSON.parse ( rest_client_request :post, HF_URL, payload ).body\nend", "title": "" }, { "docid": "09d615506e43277865611dffbe6e7b27", "score": "0.54127765", "text": "def create\n params[:human_resource][:question].each do |k, v|\n answer = Answer.new\n answer.user_id = params[:human_resource][:user_id]\n answer.question_id = k;\n answer.answer = v;\n answer.save\n end\n respond_to do |format|\n format.html { redirect_to answers_path, notice: 'Questionário criado com sucesso.' }\n format.json { render :index, status: :created, location: @answer }\n end\n end", "title": "" }, { "docid": "94cda75c818fa78d1e486faa9439eba5", "score": "0.5402701", "text": "def create\n time = Time.now\n machine = Machine.find_by_machine_ip(params[:machine_ip])\n if machine.present?\n \n mac_sig_value = MacroSignalOpened.where(signal: params[:signall], machine_id: machine.id)\n if mac_sig_value.present?\n data = mac_sig_value.first\n duration = time - data.update_date\n MacroSignal.create(signal: data.signal, machine_id: machine.id, update_date: data.update_date, value: data.value, end_date: time, time_stamp: duration)\n data.update(update_date: time, value: params[:value])\n\n render json: true\n else\n MacroSignalOpened.create(signal: params[:signall], machine_id: machine.id, update_date: time, value: params[:value])\n render json: true\n end\n else\n render json: \"Machine Not Present!!!\"\n # puts \"Machine Not Present!!!\"\n end\n end", "title": "" }, { "docid": "8169fdc396ef6a317b4b571c98c589e8", "score": "0.5380496", "text": "def create\n\n #Can also be created with:\n # => curl -X POST -H \"Content-Type: application/json; charset=UTF-8\" -d '{\"sensor_datum\": {\"ppm\": \"400\",\"device_id\": \"1\"}}' localhost:3000/sensor_data.json\n # => curl -X POST -H \"Content-Type: application/json; charset=UTF-8\" -d '{\"sensor_datum\": {\"ppm\": \"400\", \"device_address\": \"42\"}}' localhost:3000/sensor_data.json\n\n @sensor_datum = SensorDatum.new(sensor_datum_params)\n authorize @sensor_datum\n\n @sensor_datum.resolve_device_id\n @sensor_datum.resolve_experiment_id\n\n respond_to do |format|\n if @sensor_datum.save\n format.html { redirect_to @sensor_datum, notice: 'Sensor datum was successfully created.' }\n format.json { render :show, status: :created, location: @sensor_datum }\n else\n format.html { render :new }\n format.json { render json: @sensor_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00cbd2340293b82818280a2e1314246b", "score": "0.5374623", "text": "def seed_hospital_data\n hospital_data_string = RestClient.get(\"https://health.data.ny.gov/resource/7xgt-tyms.json\")\n hospital_data_hash = JSON.parse(hospital_data_string)\n hospital_data_hash.each do |key|\n Hospital.create(facility_name: key[\"facility_name\"],\n street: key[\"address1\"], city: key[\"city\"], state: key[\"cooperator_state\"],\n county: key[\"county\"], zip: key[\"fac_zip\"].to_i, phone: key['fac_phone'],\n description:key[\"description\"], latitude: key[\"latitude\"], longitude: key[\"longitude\"] )\n end\nend", "title": "" }, { "docid": "2fe03a12b9f10198b625fa3d4104aaf8", "score": "0.53714436", "text": "def hpost(path, data)\n\t\t\trequest = Net::HTTP::Post.new(\"#{@server.path}#{path}\")\n\t\t\trequest.add_field('Content-Type', 'application/json')\n\t\t\trequest.body = data.to_json\n\t\t\tresponse = @http.request(request)\n\t\t\treturn response.code.to_i\n\t\tend", "title": "" }, { "docid": "2fe03a12b9f10198b625fa3d4104aaf8", "score": "0.53714436", "text": "def hpost(path, data)\n\t\t\trequest = Net::HTTP::Post.new(\"#{@server.path}#{path}\")\n\t\t\trequest.add_field('Content-Type', 'application/json')\n\t\t\trequest.body = data.to_json\n\t\t\tresponse = @http.request(request)\n\t\t\treturn response.code.to_i\n\t\tend", "title": "" }, { "docid": "0f6b0178b722362c81934d2ca0de252a", "score": "0.536012", "text": "def post_expense_json(expense)\n header \"Content-Type\", \"application/json\" \n post '/expenses', JSON.generate(expense)\n expect(last_response.status).to eq(200)\n\n parsed = JSON.parse(last_response.body)\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\n expense.merge('id' => parsed['expense_id'])\nend", "title": "" }, { "docid": "e3968c000c8848635134b68de245226d", "score": "0.5356089", "text": "def update\n respond_to do |format|\n if @imes_d089h.update(imes_d089h_params)\n format.html { redirect_to @imes_d089h, notice: 'D089h was successfully updated.' }\n format.json { render :show, status: :ok, location: @imes_d089h }\n else\n format.html { render :edit }\n format.json { render json: @imes_d089h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef47bf5880cf74c06eab7aef817880fc", "score": "0.53501725", "text": "def create_by_json\n\n # Case 1: Hashcode is blank and error is rendered\n render :json => \"Hashcode blank\", :status => :unprocessable_entity and return if params[:time_entry][:hashcode].blank?\n\n # Case 2: TimeEntry exists and is rendered\n @time_entry = TimeEntry.find_by_hashcode(params[:time_entry][:hashcode])\n render :json => @time_entry, :status => :created, :location => @time_entry and return if !@time_entry.nil?\n\n # Case 3: TimeEntry does not exists and is created\n @gps_position = GpsPosition.new(params[:time_entry][:gps_position_data])\n params[:time_entry].delete :gps_position_data\n\n @time_entry = TimeEntry.new(params[:time_entry])\n @time_entry.gps_position = @gps_position;\n @time_entry.user = current_user\n \n render :json => @time_entry.errors, :status => :unprocessable_entity and return if !@time_entry.save\n render :json => @time_entry, :status => :created, :location => @time_entry\n end", "title": "" }, { "docid": "9a2b1dde4f7be785570150179636f5c0", "score": "0.53483206", "text": "def post_to_uispec_server( verb, command_hash )\n url = frank_url_for( verb )\n req = Net::HTTP::Post.new url.path\n req.body = command_hash.to_json\n\n make_http_request( url, req )\n end", "title": "" }, { "docid": "13d5a7ffc44e4814e5fc1680243a8184", "score": "0.534623", "text": "def create\n j = JSON.parse(request.raw_post)\n\n\n @grade = Grade.new\n @grade[:subject_id] = j['subject_id']\n @grade[:student_id] = j['student_id']\n @grade[:mark] = j['mark']\n @grade[:exam_date] = j['exam_date']\n @grade.save\n\n\n render :json => @grade , :status => 201\n end", "title": "" }, { "docid": "45b1018b346bf92011b7d8a9c07ca341", "score": "0.5339934", "text": "def create\n @dht = Dht.new(dht_params)\n\n respond_to do |format|\n if @dht.save\n #Convert telemetries to json format\n telemetries = dht_params.to_json(:methods => :get_created_at)\n Rails.logger.debug \"What does it look like:: #{telemetries} \"\n #send to azure event hub\n if eventHub.send_event(telemetries)\n Rails.logger.info 'Successfully sent payload to azure'\n format.html { redirect_to @dht, notice: 'Successfully created records and sent to AzureEventHub.' }\n format.json { render :show, status: :created, location: @dht }\n else\n format.html { redirect_to @dht, notice: 'Successfully created records but failed to send telemetries to AzureEventHub.' }\n format.json { render :show, status: :created, location: @dht }\n end\n else\n format.html { render :new }\n format.json { render json: @dht.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2b6b5e7868d4d0d5efba9e563292dcd", "score": "0.53245515", "text": "def create\n @extra_hour = ExtraHour.new(extra_hour_params)\n\n respond_to do |format|\n if @extra_hour.save\n format.html { redirect_to @extra_hour, notice: 'Extra hour was successfully created.' }\n format.json { render :show, status: :created, location: @extra_hour }\n else\n format.html { render :new }\n format.json { render json: @extra_hour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99507fa127c3d0d4bb9a42809b5601ab", "score": "0.5291685", "text": "def http_post_tangle(trytes_data)\n connection.post do |req|\n req.url SAVE_PATH\n req.headers['Content-Type'] = 'application/json'\n req.body = trytes_data\n end\n end", "title": "" }, { "docid": "618a6553744c9efa2f4b2918c1dc77ae", "score": "0.5289357", "text": "def imes_d089h_params\n params.fetch(:imes_d089h, {})\n end", "title": "" }, { "docid": "2aecd63a3df518b5d3bc1f983a26b1b9", "score": "0.5286555", "text": "def create(json, e) \n jstring = json \n unless json.is_a? String\n jstring = JSON.generate json\n end\n response = @http.post_json(e, jstring)\n msg response, Logger::DEBUG\n return response\n end", "title": "" }, { "docid": "14d246d819a5fe9eee1bee9e96d1c7a8", "score": "0.5274045", "text": "def imes_d888h_params\n params.fetch(:imes_d888h, {})\n end", "title": "" }, { "docid": "b4c23046ed9d2e9cdf0b15a34ed4570a", "score": "0.52687585", "text": "def create\n data = reload(get_series('body'), str(Date.strptime(params[:measurement].values.join(\"-\"))))\n saved = false\n get_series('body').each do |s|\n # get variable name from last part of series\n data[s].each do |day|\n @measurement = find_for(day['dateTime'])\n @measurement.send(s.rpartition('/')[2] + '=', day['value'])\n saved = @measurement.save\n end\n end\n\n respond_to do |format|\n if saved\n flash[:success] = 'Measurement was successfully created.'\n format.html { redirect_to @measurement }\n format.json { render :json => @measurement, :status => :created, :location => @measurement }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @measurement.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "195b0f81c412fb8eb5f517427446f7bf", "score": "0.52682954", "text": "def create\n @jigyosho = Jigyosho.new(jigyosho_params)\n\n respond_to do |format|\n if @jigyosho.save\n format.html { redirect_to @jigyosho, notice: 'Jigyosho was successfully created.' }\n format.json { render :show, status: :created, location: @jigyosho }\n else\n format.html { render :new }\n format.json { render json: @jigyosho.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "174ed97af5bafe526d35525f411f6e9f", "score": "0.5268287", "text": "def send_create_post(json)\n uri = URI.parse(\"https://services6.arcgis.com/QKzAuFxgK44hIfg6/arcgis/rest/services/Pollution_Reporter/FeatureServer/0/applyEdits\")\n res=Net::HTTP.post_form(uri, 'f' => 'json', 'adds' => json.to_json)\n\n raise \"Error: Failed POST to arcgis for pollution report: #{res.body}\" if !res.is_a?(Net::HTTPSuccess)\n # finds the object id from the return from arcgis\n res_json=JSON.parse(res.body)\n Rails.logger.debug \"arcgis CREATE POST successful\"\n id=res_json[\"addResults\"][0][\"objectId\"]\n end", "title": "" }, { "docid": "cb18992a11655f7ec1af613c7d371f6e", "score": "0.5258636", "text": "def create\n @hourly = Hourly.new(hourly_params)\n\n respond_to do |format|\n if @hourly.save\n format.html { redirect_to @hourly, notice: 'Hourly was successfully created.' }\n format.json { render :show, status: :created, location: @hourly }\n else\n format.html { render :new }\n format.json { render json: @hourly.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03d0a8f100b1ada921cd7080bf11edce", "score": "0.52570057", "text": "def create\n @ignitor_time = IgnitorTime.new(params[:ignitor_time])\n\n respond_to do |format|\n if @ignitor_time.save\n format.html { redirect_to @ignitor_time, notice: 'Ignitor time was successfully created.' }\n format.json { render json: @ignitor_time, status: :created, location: @ignitor_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ignitor_time.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc2361bb680355251a23bb0ab1af67e1", "score": "0.5254008", "text": "def create\n @iot_datum = IotDatum.new(iot_datum_params)\n\n respond_to do |format|\n if @iot_datum.save\n format.html { redirect_to @iot_datum, notice: \"Iot datum was successfully created.\" }\n format.json { render :show, status: :created, location: @iot_datum }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @iot_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "826f81b6f838dfc75cb5886c3bd16f61", "score": "0.52536637", "text": "def post_create_from_chain_request(version, data = {}.to_json)\n post :create_from_process_step, params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }\nend", "title": "" }, { "docid": "a808f5a0d98347e3587ecd9275d0f307", "score": "0.52457875", "text": "def create\n @atr_hst = AtrHst.new(params[:atr_hst])\n @atr_hst.atr=Atr.first\n @atr_hst.value='25000'\n @atr_hst.tstamp=Time.now.to_i\n respond_to do |format|\n if @atr_hst.save\n format.html { redirect_to @atr_hst, notice: 'Atr hst was successfully created.' }\n format.json { render json: @atr_hst, status: :created, location: @atr_hst }\n else\n format.html { render action: \"new\" }\n format.json { render json: @atr_hst.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ae04bf32d989228052c3d8dafa0ce6e", "score": "0.5237132", "text": "def create\n @simnumlog = Simnumlog.new(:sim_id => params[:simnumlog][:sim_id],:tnumber_id => params[:simnumlog][:tnumber_id])\n date = params[:simnumlog][\"simperiod_id(1i)\"] + '-'\n date = date + params[:simnumlog][\"simperiod_id(2i)\"].to_s + '-'\n date = date + params[:simnumlog][\"simperiod_id(3i)\"].to_s + ' '\n date = date + params[:simnumlog][\"simperiod_id(4i)\"].to_s + ':'\n date = date + params[:simnumlog][\"simperiod_id(5i)\"].to_s\n @simperiod = Simperiod.create(:datein => date) \n @simnumlog.simperiod_id = @simperiod.id\n respond_to do |format|\n if @simnumlog.save\n format.html { redirect_to @simnumlog, :notice => date}\n format.json { render :json => @simnumlog, :status => :created, :location => @simnumlog }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @simnumlog.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29e542076212e2199dc02dc0dcb4a7d3", "score": "0.52232176", "text": "def create\n @search = Animal.new(animal_params)\n auth = {:username => 'apikey', :password => ENV['LABKEY_API_KEY']}\n @participantId = animal_params[:participantId]\n @previous = HTTParty.get(\"http://pczt-win-lbk-a1.primate.ucdavis.edu:8080/labkey/query/CNPRC/selectRows.api?schemaName=study&query.queryName=housing&query.maxRows=1&query.participantid~eq=#{@participantId}\",:basic_auth => auth)\n @result = HTTParty.post(\"http://pczt-win-lbk-a1.primate.ucdavis.edu:8080/labkey/query/CNPRC/insertRows.api\",:basic_auth => auth,\n :body => {\"schemaName\": \"study\",\n \"queryName\": \"housing\",\n \"command\": \"update\",\n \"rowsAffected\": 1,\n \"rows\": [\n {\"participantId\": animal_params[:participantId],\n \"modifiedBy\": 1004,\n # \"date\": @previous['rows'][0]['enddate'],\n \"date\": animal_params[:date],\n \"room\": animal_params[:room],\n \"cage\": animal_params[:cage],\n \"reloc_seq\": @previous['rows'][0]['reloc_seq'].to_i + 1,\n \"Key\":SecureRandom.hex.to_s\n }\n ]\n }.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n puts @result\n if @search.save\n redirect_to animal_path(@search)\n else\n flash[:error] = @search.errors.full_messages.join(\", \")\n redirect_to :back\n end\n end", "title": "" }, { "docid": "9c9e9ec00fd07cdb12fc0b92356c553b", "score": "0.52203083", "text": "def create\n @big_time_entry = BigTimeEntry.new(big_time_entry_params)\n\n respond_to do |format|\n if @big_time_entry.save\n format.html { redirect_to @big_time_entry, notice: 'Big time entry was successfully created.' }\n format.json { render :show, status: :created, location: @big_time_entry }\n else\n format.html { render :new }\n format.json { render json: @big_time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bf1fd5fb11fbed6f8085727b8acef7ee", "score": "0.5200305", "text": "def add_time(ticket, opts)\n time_to_log = s2hm(opts[:seconds])\n puts \"Adding #{time_to_log} to worklog in #{ticket} on #{opts[:date]} ...\"\n response = Unirest.post(\n \"https://#{opts[:config]['server']}/rest/api/2/issue/#{ticket}/worklog\",\n headers: {\n 'Content-Type' => 'application/json',\n },\n auth: {\n :user => opts[:config]['username'],\n :password => opts[:config]['password'],\n },\n parameters: {\n 'comment' => opts[:comment],\n 'started' => opts[:date] + opts[:config]['time_string'],\n 'timeSpentSeconds' => opts[:seconds],\n }.to_json\n )\n\n unless response.code == 201\n write_state(opts[:state], opts[:state_file])\n raise \"Failed adding to worklog in #{ticket} for #{opts[:date]}:\" +\n \" returned #{response.code}: #{response.body.to_s}\"\n end\n\nend", "title": "" }, { "docid": "f1735b8f5c55e341f01f26cc249d228e", "score": "0.5200214", "text": "def create\n\n params['_json'].each do |entry|\n entry[\"LastRunTime\"] = DateTime.strptime(entry[\"LastRunTime\"], \"%m/%d/%Y %H:%M:%S %p\")\n entry[\"NextRunTime\"] = DateTime.strptime(entry[\"NextRunTime\"], \"%m/%d/%Y %H:%M:%S %p\")\n entry[\"LastTaskResult\"] = entry[\"LastTaskResult\"].to_i.abs\n\n @job = Job.new(entry)\n @job.save unless entry[\"NextRunTime\"].year < 1900\n end\n\n UserMailer.test_email(\"Team\").deliver\n# if @job.save\n# format.json { render json: @job, status: :created, location: @job}\n# else\n# format.html { render action: \"new\" }\n# format.json { render json: @job.errors, status: :unprocessable_entity }\n# end\n# end\n end", "title": "" }, { "docid": "9a48e2da5746623bf3ee2b733ceaec60", "score": "0.5196786", "text": "def set_imes_d888h\n @imes_d888h = Imes::D888h.find(params[:id])\n end", "title": "" }, { "docid": "3cc61908df92ff59298120487d29d955", "score": "0.5184181", "text": "def createWorkout\n data = workout_params\n user = User.find_by(id: params[:id])\n newWorkout = Workout.create\n newWorkout.user_id = params[:id]\n newWorkout.routine_type = data[:routine_type]\n newWorkout.workout_date = Time.now()\n newWorkout.save\n data[:exercises].map do |workoutExercise|\n exercise = Exercise.find_by(name: workoutExercise[:name])\n newWorkoutExercise = WorkoutExercise.create\n newWorkoutExercise.exercise_id = exercise.id\n newWorkoutExercise.workout_id = newWorkout.id\n newWorkoutExercise.tier = workoutExercise[:tier]\n newWorkoutExercise.weight = workoutExercise[:weight]\n newWorkoutExercise.reps = workoutExercise[:reps]\n newWorkoutExercise.numSets = workoutExercise[:numSets]\n newWorkoutExercise.setInfo = workoutExercise[:setInfo]\n newWorkoutExercise.save\n end\n render json: WorkoutSerializer.new(newWorkout)\n end", "title": "" }, { "docid": "a71d80c9cd8ee679b953f500aaa8f46f", "score": "0.51754504", "text": "def create\n @special_hour = SpecialHour.new(special_hour_params)\n respond_to do |format|\n if @special_hour.save\n success_str = 'Special hour was successfully created.'\n format.html { redirect_to @special_hour, success: success_str }\n format.json { render :show, status: :created, location: @special_hour }\n else\n format.html { render :new }\n format.json { render json: @special_hour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "974cfe84b78571763c4fdfd76af4fc24", "score": "0.51754165", "text": "def post_json(expected_statuses, timeout, path_components, entity, headers={})\n response = post(\n expected_statuses,\n timeout,\n path_components,\n Yajl::Encoder.encode(entity),\n headers.merge(\"Content-Type\" => \"application/json\")\n )\n create_json_response(response)\n end", "title": "" }, { "docid": "4f6e0510413b63833d7ecb0a95d058eb", "score": "0.5174768", "text": "def iot_datum_params\n params.require(:iot_datum).permit(:temp, :hum)\n end", "title": "" }, { "docid": "925824bd37af376b7b8205361914a7c5", "score": "0.5171192", "text": "def create\n @umidificador = Umidificador.new(umidificador_params)\n\n respond_to do |format|\n if @umidificador.save\n\n @data = Time.at(@umidificador[:created_at]).to_datetime\n @data_str = \"\\\"data\\\":\" << \"\\\"\" << @data.utc.strftime('%m/%d/%Y %H:%M %p') << \"\\\"\"\n @umidate_str = \"\\\"umidade\\\":\" << @umidificador[:umidade].to_s\n @novo_registro = \"{\" << @data_str << \",\" << @umidate_str << \"}\"\n \n @umidificador[:historico] << @novo_registro\n @umidificador.save\n\n format.html { redirect_to @umidificador, notice: 'Umidificador was successfully created.' }\n format.json { render :show, status: :created, location: @umidificador }\n else\n format.html { render :new }\n format.json { render json: @umidificador.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2780e8baf77dee30691f5ebfe8d137f8", "score": "0.51622397", "text": "def upload\n data = params[:json_data]\n\t\trecalls = JSON.parse(data)\n\t\trecalls.each do |recall|\n\t\t\t@recall = Recall.find_by_id(recall['id'])\n\t\t\tif @recall.nil?\n\t\t\t\t@recall = Recall.create(:id => recall['id'], :product_id => recall['product_id'], :reason => recall['reason'], :level_id => recall['level_id'], :region_id => recall['region_id'], :contact_id => recall['contact_id'], :date => recall['date'])\n\t\t\tend\n\t\tend\n\t\t\n respond_to do |format|\n format.html { redirect_to :controller => 'recalls', :action => 'index' }\n end\n \n end", "title": "" }, { "docid": "19b25c928193897a3c99deba919c47bb", "score": "0.5161928", "text": "def create\n\n params[:encounter][:monsters] = []\n params[:incmonster].each do |monster, value|\n next unless value == \"true\"\n (1..params[:nummonster][monster].to_i).each do\n params[:encounter][:monsters] << Monster.find(monster.to_i)\n end\n end\n\n @encounter = Encounter.new(params[:encounter])\n\n respond_to do |format|\n if @encounter.save\n format.html { redirect_to @encounter, notice: 'Encounter was successfully created.' }\n format.json { render json: @encounter, status: :created, location: @encounter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @encounter.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7acdb16652feaf175da3c582691caee5", "score": "0.5152598", "text": "def post_rest(path, json) \n run_request(:POST, create_url(path), json) \n end", "title": "" }, { "docid": "be2f73289bc5f36d8754f83de22f774a", "score": "0.51514846", "text": "def create\n @hours_entry = HoursEntry.new(hours_entry_params)\n\n respond_to do |format|\n if @hours_entry.save\n format.html { redirect_to @hours_entry, notice: 'Hours entry was successfully created.' }\n format.json { render :show, status: :created, location: @hours_entry }\n else\n format.html { render :new }\n format.json { render json: @hours_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "61e533088f2298e9fbd942c1a237212a", "score": "0.5146134", "text": "def post_data( requestPath, data )\n @request_counter += 1\n data[:counter] = @request_counter\n data[:time] = Time.now.strftime( '%Y/%m/%d %H:%M:%S' )\n do_request( requestPath, data )\n end", "title": "" }, { "docid": "dd38ec2b448fc01e27a276005273287f", "score": "0.51398766", "text": "def upload_floor_plan(args = {}) \n post(\"/files.json/floorplan/images\", args)\nend", "title": "" }, { "docid": "b355ba9bcb8bb229d8a02210e7ad03e9", "score": "0.5137154", "text": "def update\n respond_to do |format|\n if @imes_d888h.update(imes_d888h_params)\n format.html { redirect_to @imes_d888h, notice: 'D888h was successfully updated.' }\n format.json { render :show, status: :ok, location: @imes_d888h }\n else\n format.html { render :edit }\n format.json { render json: @imes_d888h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d847448fdc37c32c41514d3e53015fb", "score": "0.51365364", "text": "def testjson_params\n params.require(:testjson).permit(:title, :start, :end, :requestor)\n end", "title": "" }, { "docid": "e8f21c59b5914ae3e1c185e082605b2e", "score": "0.5129189", "text": "def imes_d309h_params\n params.fetch(:imes_d309h, {})\n end", "title": "" }, { "docid": "7e6c271829b9ba7790614ad4061ee41f", "score": "0.5121851", "text": "def create\n @hum_res_assistance = @adverse_event.hum_res_assistances.create(hum_res_assistance_params)\n\n respond_to do |format|\n if @hum_res_assistance.save\n format.html { redirect_to adverse_event_path(@adverse_event), notice: 'Recurso humano asistencial utilizado, ingresado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @hum_res_assistance }\n else\n format.html { render :new }\n format.json { render json: @hum_res_assistance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e2961404e44eb2132653b90512f87ec0", "score": "0.51182956", "text": "def create\n @work_hour = WorkHour.new(params[:work_hour])\n\n respond_to do |format|\n if @work_hour.save\n format.html { redirect_to @work_hour, notice: 'Work hour was successfully created.' }\n format.json { render json: @work_hour, status: :created, location: @work_hour }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_hour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94201a60466cc76c5993495d1a8ce0a1", "score": "0.51173574", "text": "def create\n now = params[:n]\n start = params[:s]\n inches = params[:d]\n csrf = session['_csrf_token']\n digest = params[:x]\n\n # if our validation hash and recalculated result match, we are good to go!\n if Leap.validate_digest( now, start, inches, csrf, digest )\n @leap = Leap.new( :inches => inches )\n\n respond_to do |format|\n if @leap.save\n format.html { render action: \"new\" }\n format.json { render json: { i: @leap.formatted_inches, t: Leap.formatted_total_inches }, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @leap.errors, status: :unprocessable_entity }\n end\n end\n else\n # toss an error!\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: \"EPIC FAILURE\", status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df118303e739f4c5612160445853d980", "score": "0.51029664", "text": "def create\n @experiment_hardware = ExperimentHardware.new(params[:experiment_hardware])\n\n respond_to do |format|\n if @experiment_hardware.save\n format.html { redirect_to @experiment_hardware, :notice => 'Experiment hardware was successfully created.' }\n format.json { render :json => @experiment_hardware, :status => :created, :location => @experiment_hardware }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @experiment_hardware.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc402ae409804b658032f2b5b2aa5727", "score": "0.50916976", "text": "def record_params_json\n params.permit(:teamid, :chalid, :name, :answer, :diy)\n end", "title": "" }, { "docid": "84aab35815e565a1056ed67c66dda253", "score": "0.50911963", "text": "def create\n @hye = Hye.new(params[:hye])\n\n respond_to do |format|\n if @hye.save\n format.html { redirect_to @hye, notice: 'Hye was successfully created.' }\n format.json { render json: @hye, status: :created, location: @hye }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hye.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d29e3f961726a8ec00807a1e2f728cd6", "score": "0.50882405", "text": "def post_json(path, data = {})\n client(path).post_json(path, data)\n end", "title": "" }, { "docid": "408af2d28ade9edca1b9ecd34537713f", "score": "0.5086758", "text": "def new\n @hour = Hour.new\n \n @days = Day.all\n @days_map = {}\n @days.each do |day|\n timetable = Timetable.find(day.TIMETABLE_ID)\n @days_map[day.NAME+\" \"+timetable.NAME] = day.ID\n end\n\n @subjects_map = {}\n Subject.all.each do |subject|\n @subjects_map[subject.NAME] = subject.ID\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hour }\n end\n end", "title": "" }, { "docid": "05c108ed58a3e081b70e65598694676b", "score": "0.50863004", "text": "def create\n @ad = Ad.new(ad_params)\n @ad.user_id=current_user.id\n \n\n respond_to do |format|\n if @ad.save\n format.html { redirect_to @ad, notice: 'Ad was successfully created.' }\n format.json { render :show, status: :created, location: @ad }\n quikr_str={:email => @ad.email, :remoteAddr => \"192.168.51.57\",:title => @ad.title, :description=> @ad.description,:subCategory => \"Mobile Phones\" ,:cityName=> @ad.cityName, :locations => \"Adyar\", :userMobile=> @ad.userMobile , :attributes => {:Ad_Type => @ad.ad_type ,:Brand_name=>@ad.brand_name ,:Condition=> @ad.condition, :You_are => @ad.you_are }}\n quikr_json= quikr_str.to_json\n puts quikr_json\n uri = URI('https://api.quikr.com/public/postAds')\n req=Net::HTTP::Post.new(uri,initheader={'X-Quikr-App-Id' => '521','X-Quikr-Token-Id'=>'3162496','X-Quikr-Signature'=>'f3fd6d7337d4c31726ff7d0138dbeb67ffddeb54'})\n req.body=quikr_json\n res = Net::HTTP.start(uri.hostname) do |http|\n \t http.request(req).to_json\n\tend\n\tputs res\n else\n format.html { render :new }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2513b1b0fe2464b87400368b32eccd2d", "score": "0.508517", "text": "def create\n @hh = Hh.new(hh_params)\n\n respond_to do |format|\n if @hh.save\n format.html { redirect_to @hh, notice: 'Hh was successfully created.' }\n format.json { render :show, status: :created, location: @hh }\n else\n format.html { render :new }\n format.json { render json: @hh.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c790c054107bda88001819065947ee1", "score": "0.50765395", "text": "def create\n @sm = Sm.new(sm_params)\n employees = Company.find(params[:sm][:to]).employees\n employees.each do |emp|\n url = generate_url(@sm, emp)\n Unirest.get url\n end\n respond_to do |format|\n if @sm.save\n format.html { redirect_to @sm, notice: 'Sm was successfully created.' }\n format.json { render :show, status: :created, location: @sm }\n else\n format.html { render :new }\n format.json { render json: @sm.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e68ef333075979faa0d4f875455959a5", "score": "0.5065819", "text": "def create\n params[:competitiveness][:question].each do |k, v|\n answer = Answer.new\n answer.user_id = params[:competitiveness][:user_id]\n answer.question_id = k;\n answer.answer = v;\n answer.save\n end\n respond_to do |format|\n format.html { redirect_to answers_path, notice: 'Questionário criado com sucesso.' }\n format.json { render :index, status: :created, location: @answer }\n end\n end", "title": "" }, { "docid": "b4ffad9e8367517189aab7265f9c2d16", "score": "0.5065138", "text": "def jigyosho_params\n params.require(:jigyosho).permit(:cd, :name, :ryakusho, :from_ymd, :to_ymd, :mail, :sort_num, :flg)\n end", "title": "" }, { "docid": "eb212a2541048649d897236132eae8be", "score": "0.50623596", "text": "def update\n respond_to do |format|\n if @imes_d600h.update(imes_d600h_params)\n format.html { redirect_to @imes_d600h, notice: 'D600h was successfully updated.' }\n format.json { render :show, status: :ok, location: @imes_d600h }\n else\n format.html { render :edit }\n format.json { render json: @imes_d600h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "01cebbd95091c4a5a87246c5c32e3d5e", "score": "0.50606257", "text": "def wi_mn_det_params\n params.require(:wi_mn_det).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w860)\n end", "title": "" }, { "docid": "ca55d91135093ae7098d3f6efdf8fc16", "score": "0.50592655", "text": "def create\n time_entry = current_user.time_entries.new(time_entry_params)\n # time_entry.user_id = current_user.id\n\n if time_entry.save\n render json: { entry: time_entry }, status: :ok\n else\n render json: { errors: time_entry.errors.full_messages }, status: :bad_request\n end\n end", "title": "" }, { "docid": "6da59822809697df805e56dab54c2531", "score": "0.50587726", "text": "def create\n encounter_id, obs_archetypes = params.require %i[encounter_id observations]\n\n encounter = Encounter.find(encounter_id)\n\n observations = obs_archetypes.collect do |archetype|\n obs, _child_obs = service.create_observation(encounter, archetype.permit!)\n obs\n end\n\n render json: observations, status: :created\n end", "title": "" }, { "docid": "089cc1b1def7be6e0ce6551775b7d57c", "score": "0.5058072", "text": "def set_imes_d309h\n @imes_d309h = Imes::D309h.find(params[:id])\n end", "title": "" }, { "docid": "03cacc326578cc8d3ccb5bda1bb5850b", "score": "0.5057751", "text": "def update\n respond_to do |format|\n if @imes_d031h.update(imes_d031h_params)\n format.html { redirect_to @imes_d031h, notice: 'D031h was successfully updated.' }\n format.json { render :show, status: :ok, location: @imes_d031h }\n else\n format.html { render :edit }\n format.json { render json: @imes_d031h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "527a7278139628c360ea1bc1e8d30187", "score": "0.5055982", "text": "def create\n Rails.logger.info \"==========================\"\n Rails.logger.info request.raw_post\n Rails.logger.info \"==========================\"\n data = JSON.parse(request.raw_post).symbolize_keys\n ignore = [\"victims\", \"offenders\", \"attachments\"]\n incident_params = data[:incident]\n incident_params = incident_params.except(*ignore)\n @incident = Incident.new(incident_params)\n @incident.status = \"pending\"\n @incident.offender = \"N/A\"\n if @user\n @incident.user_id = @user.id\n end\n if @incident.save\n data[:incident][\"victims\"].each do |record|\n victim = Victim.new(record)\n victim.incident_id = @incident.id\n victim.save\n end\n data[:incident][\"offenders\"].each do |record|\n offender = Offender.new(record)\n offender.incident_id = @incident.id\n oc = Offendercategory.find_by_id(offender.offendercategory_id)\n if !oc\n Offendercategory.create(name: \"General\",id: offender.offendercategory_id)\n end\n offender.save\n end\n json_response(@incident)\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "7b15d13518a8729262788d6e93411d72", "score": "0.50517195", "text": "def create\n @ihateerb = Ihateerb.new(params[:ihateerb])\n\n respond_to do |format|\n if @ihateerb.save\n format.html { redirect_to @ihateerb, :notice => 'Ihateerb was successfully created.' }\n format.json { render :json => @ihateerb, :status => :created, :location => @ihateerb }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ihateerb.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1cfd20aec061bfef28813a08608f22f", "score": "0.5049554", "text": "def create\n itinerary = current_user.itineraries.create!(itinerary_params)\n itinerary_id = current_user.itineraries.last\n \n events = params[:events]\n events.each do |event|\n itinerary_id = current_user.itineraries.last[:id]\n EventsItinerary.create(itinerary_id: itinerary_id, event_id: event[\"id\"])\n end\n render json: itinerary, status: 201 # , location: [:api, itineraries]\n end", "title": "" }, { "docid": "9c7a66c3501a5d32225efec41879ee58", "score": "0.50477356", "text": "def create\n megam_rest.post_boltdefn(to_hash)\n end", "title": "" }, { "docid": "2a099628dbd093c32e619ed14593ade0", "score": "0.50468445", "text": "def export_record_in_fhir_json\n return unless current_user.admin?\n user = User.find_by(first_name: 'Example', last_name: 'Certifier')\n certifier_id = user.id\n death_record = DeathRecord.find_by(id: params[:format])\n response = RestClient.post \"#{VrdrHelper.get_host}/json\", death_record.contents.to_json, {content_type: 'application/nightingale'}\n send_data response.body, disposition: 'attachment', filename: params[:format] + '_nightingale_record.json'\n end", "title": "" }, { "docid": "a60bfa2d4e2d56b291f8a5af765d2917", "score": "0.5043271", "text": "def create\n @type = params[:type]\n item = params.require(:item)\n @mac = item.require(:machine)\n machine = Machine.check(@mac.permit(:mac))\n\n data = item.require(:data)\n @result = Array.new\n data.each do |d|\n @result << machine.surveys.create(d.permit(:distance, :date, :beginning))\n end\n\n render :status => :created\n end", "title": "" }, { "docid": "ac21ac0f48bd90a9f5be7471a970c6c0", "score": "0.5041532", "text": "def upload_json! base_path, scope: false\n s = \"data/outsourcing-paradise-parasite/\"\n s << scope << \"/\" if scope\n s << \"erosion-machine-timeline.json\"\n\n json = File.read(s).gsub(\"HOST_NAME\", fetch(:outsourcing_paradise_host_name)).gsub(/\"EROSION_DELAY\"/, fetch(:outsourcing_paradise_erosion_delay).to_s)\n\n d = \"#{base_path}/data/outsourcing-paradise-parasite/\"\n d << scope << \"/\" if scope\n d << \"erosion-machine-timeline.json\"\n\n upload! StringIO.new(json), d\n\n execute :chmod, '644', d\n end", "title": "" }, { "docid": "b397abc064433c8aca296050631f1a9f", "score": "0.5041368", "text": "def create\n @shed = Shed.new(shed_params)\n\n if @shed.save\n render json: @shed, status: :created, location: @shed\n else\n render json: @shed.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "1be9a542638f99a3bc7a1a350d3136a9", "score": "0.5041306", "text": "def update\n respond_to do |format|\n if @imes_d272h.update(imes_d272h_params)\n format.html { redirect_to @imes_d272h, notice: 'D272h was successfully updated.' }\n format.json { render :show, status: :ok, location: @imes_d272h }\n else\n format.html { render :edit }\n format.json { render json: @imes_d272h.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b171dba714cd2cae2e180a7674bf2f22", "score": "0.5040408", "text": "def create\n kiwoomApi = KiwoomApi.new();\n kiwoomApi.get_opt10085(ENV['ACCOUNT_NUMBER'])\n respond_to do |format|\n format.html { redirect_to opt10085s_path, notice: 'Opt10085 was successfully created.' }\n format.json { render :show, status: :created, location: opt10085s_path }\n end\n end", "title": "" }, { "docid": "fc1b1ec6310335bb0bb41f1b2a99d21c", "score": "0.50401235", "text": "def create\n @song = Song.new(artist: song_params[:artist],title: song_params[:title], recommender: song_params[:recommender], color: song_params[:color] )\n\n\n respond_to do |format|\n if @song.save\n p @song \n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n HTTParty.post(\"https://maker.ifttt.com/trigger/recommend_song/with/key/#{ENV[\"IFTTT_SPOTIFY_KEY\"]}\",{ \n :body => { \"value1\" => \"#{@song.artist}\", \"value2\" => \"#{@song.title}\", \"value3\" => \"#{@song.recommender}\" }.to_json,\n :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}\n })\n HTTParty.post(\"https://maker.ifttt.com/trigger/change_color/with/key/#{IFTTT_HUE_KEY}\",{ \n :body => { \"value1\" => \"#{@song.color}\" }.to_json,\n :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}\n })\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d623833daff1aa00641e7106b3c604f", "score": "0.5036645", "text": "def create\n @when = When.new(params[:when])\n\n respond_to do |format|\n if @when.save\n format.html { redirect_to @when, notice: 'When was successfully created.' }\n format.json { render json: @when, status: :created, location: @when }\n else\n format.html { render action: \"new\" }\n format.json { render json: @when.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "30fc5638df58994cbb6de8e68624670f", "score": "0.5036517", "text": "def post_json(data, action)\n response = RestClient.post \"#{@url}/#{action}\", data.merge(@auth).to_json, :content_type => :json, :accept => :json\n response.body\n end", "title": "" }, { "docid": "e5082f716c70ab0c944eb9055257ac12", "score": "0.50357515", "text": "def create\n @hour = Hour.new(params[:hour])\n @user = current_user\n @hour = Hour.new(params[:hour])\n @job = Jobsite.find(@hour.jobsite_id)\n @hour.user_id = @user.id\n @user.hours << @hour\n @job.hours << @hour\n\n respond_to do |format|\n if @hour.save\n format.html { redirect_to @hour, notice: 'Hour was successfully created.' }\n format.json { render json: @hour, status: :created, location: @hour }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2fca608c16cbfc2669b9eed194c67e47", "score": "0.50340265", "text": "def create\n @hour_regime = HourRegime.new(hour_regime_params)\n\n respond_to do |format|\n if @hour_regime.save\n format.html { redirect_to @hour_regime, notice: 'Hour regime was successfully created.' }\n format.json { render :show, status: :created, location: @hour_regime }\n else\n format.html { render :new }\n format.json { render json: @hour_regime.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "096c8e055d6b1b5321f06f94cc72b23d", "score": "0.5032459", "text": "def create\n encounter_id, obs_archetypes = params.require %i[encounter_id observations]\n\n encounter = Encounter.find(encounter_id)\n\n observations = obs_archetypes.collect do |archetype|\n create_observation(archetype, encounter)[0]\n end\n\n render json: observations, status: :created\n end", "title": "" }, { "docid": "74b27b458fdc165a85b9fdf19a582ddb", "score": "0.503068", "text": "def dayhour\n days = {}\n Array(0..23).each do |a|\n days[a] = {}\n end\n @api_user.meta_logs.all.each do |poo|\n days[poo.time_of_passage.hour][poo.time_of_passage.wday] ||= 0 # init\n days[poo.time_of_passage.hour][poo.time_of_passage.wday] += 1 # increment\n end\n render json: days\n end", "title": "" } ]
2b5aa0e0af297b65580689bb230220fd
GET /issue_resources/1 GET /issue_resources/1.json
[ { "docid": "6d0698e6d70eed95a458197a80f0d98d", "score": "0.772797", "text": "def show\n @issue_resource = IssueResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue_resource }\n end\n end", "title": "" } ]
[ { "docid": "44042ea4ec1a4dae6507b48400117caa", "score": "0.71288764", "text": "def show\n @issue = Issue.find(params[:id])\n @resource = @issue\n @notes = @issue.notes\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "64ee58eef5034d152947e0267eb9724e", "score": "0.70431215", "text": "def new\n @issue_resource = IssueResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue_resource }\n end\n end", "title": "" }, { "docid": "3bafd036aff62ac30ab501a9b90e1729", "score": "0.66948724", "text": "def show\n respond_with(@issue) do |format|\n format.json { render json: @issue.to_json }\n end\n end", "title": "" }, { "docid": "a7627d59a18162d4375cee0e77a5a25f", "score": "0.6670632", "text": "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "a7627d59a18162d4375cee0e77a5a25f", "score": "0.6670632", "text": "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "a7627d59a18162d4375cee0e77a5a25f", "score": "0.6670632", "text": "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "8beed1844556070ba90dfdb4ab985c54", "score": "0.6643652", "text": "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @issue }\n end\n end", "title": "" }, { "docid": "47c4318d43dbba63d41d38d5bd4f5f52", "score": "0.66226554", "text": "def show\n @issue2 = Issue.find(params[:id])\n respond_to do |format|\n format.html\n format.json {render json: @issue2, status: :ok, serializer: IssuesSerializer}\n end\n end", "title": "" }, { "docid": "a28a338189bf4ce3da55f3fa150e32ab", "score": "0.6560373", "text": "def show\n\n respond_to do |format|\n format.html\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "1ce21fc588b60f7e5d08e0b7229f2867", "score": "0.6509495", "text": "def show\n @issue_list = IssueList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue_list }\n end\n end", "title": "" }, { "docid": "ab414139aa67df77d60a058e2c8cdbcc", "score": "0.6447448", "text": "def show\n respond_to do |format|\n format.html\n format.json {render json: @issue, status: :ok, serializer: IssueSerializer}\n end\n end", "title": "" }, { "docid": "f11faf478267522af5a3a1e56dadec69", "score": "0.6434483", "text": "def create\n @issue_resource = IssueResource.new(issue_resource_params)\n\n respond_to do |format|\n if @issue_resource.save\n format.html { redirect_to @issue_resource, notice: 'Issue resource was successfully created.' }\n format.json { render json: @issue_resource, status: :created, location: @issue_resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "749034a20c9ce13bb50102543c7f1657", "score": "0.64109397", "text": "def show\n @issue = current_user.organization.issues.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "ed3bd71d90b2337956778494946af220", "score": "0.6402721", "text": "def show\n @issue = Issue.where(\"published = ? AND id = ?\", true, params[:id])\n \n respond_to do |format|\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "6b390accec477ff4630ed3e2b4a6ec1e", "score": "0.6390786", "text": "def index \n # dont want all issues associated everywhere, just want the one associated with a specific project\n # first figure out the project, and then get that projects issues\n # since our issues are associated with a project, we can use that project to access those specific issues associated with that project\n \n @issues = @project.issues \n render json: @issues # saying render these issues as JSON\n # whatever we have here aka `@issues` is what will be ther responce in our fetch requests \n # aka this is what is sent back into our frontend after a fetch request is run \n # -------OR------------\n # @issues = Issue.all\n # render json: @issues\n # issues = Issue.order(\"created_at DESC\")\n end", "title": "" }, { "docid": "d4dd732170ddc2bb6ea9b46f311cf3df", "score": "0.6357224", "text": "def show\n @issue = Issue.where(issue_id: params[:id]).first\n rescue => error\n render json: {message: error.message}, status: :internal_server_error\n end", "title": "" }, { "docid": "21220c3217d611b1dfbb3389b9df9e95", "score": "0.63543516", "text": "def index\n i = params[:issue_id]\n @issue = Issue.choose_issue(i)\n @ideas = Idea.where(\"issue_id = ?\", @issue)\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @ideas }\n end\n end", "title": "" }, { "docid": "a969d695cb2f2560c3e6e925818ed578", "score": "0.63194954", "text": "def issues\n response = client.get(client.options[:rest_base_path] + \"/search?jql=project%3D'#{key}'\")\n json = self.class.parse_json(response.body)\n json['issues'].map do |issue|\n client.Issue.build(issue)\n end\n end", "title": "" }, { "docid": "f7c38f2c476517f24798ba3ffe708ca1", "score": "0.6315253", "text": "def index\n i = params[:issue_id]\n @issue = Issue.choose_issue(i)\n @submissions = Submission.where(\"issue_id = ?\", @issue)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submissions }\n end\n end", "title": "" }, { "docid": "b27b75ca349d95c19a4d7af0ebe3026d", "score": "0.63008434", "text": "def destroy\n @issue_resource = IssueResource.find(params[:id])\n @issue_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to issue_resources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "aca972dac431f38ccc6733118fd8c80b", "score": "0.62968063", "text": "def show\n @inventory_issue = InventoryIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_issue }\n end\n end", "title": "" }, { "docid": "8328afb9b5c75a05f3d125d9c8a7e2b9", "score": "0.6283237", "text": "def index\n @responses = @issue.reponses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responses }\n end\n end", "title": "" }, { "docid": "849dcd5c153104911f7f389157d6d44a", "score": "0.6273458", "text": "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @issues }\n end\n end", "title": "" }, { "docid": "5a1d27d3b73138d8044130de56ccaf6c", "score": "0.6240819", "text": "def show\n @unfix_issue = BaseIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @unfix_issue }\n end\n end", "title": "" }, { "docid": "9f52dadc1b0b4cd60ff5ac97be6e3b09", "score": "0.6240192", "text": "def issues\n id = 10000\n ISSUES.map do |i|\n id += 1\n i.merge(\n :id => id,\n :self => \"#{@jira_url}/rest/api/2/issue/#{id}\",\n :fields => i[:fields].merge(\n :status => i[:fields][:status].merge(\n :self => \"#{@jira_url}/rest/api/2/status/#{i[:fields][:status][:id]}\"\n )\n )\n )\n end\n end", "title": "" }, { "docid": "4b4b15452e5ff0827e21640478423a31", "score": "0.62336874", "text": "def create\n @issue = Issue.new(issue_params)\n create_resource_response(@issue)\n end", "title": "" }, { "docid": "9284c5f8d282b0eb468d3e8ed5bddfea", "score": "0.6223372", "text": "def index\n @issues = @jira_manager.fetch_issues\n rescue => error\n render json: {message: error.message}, status: :internal_server_error\n end", "title": "" }, { "docid": "88cc34cf3903f1acf9af9688571a9c35", "score": "0.6211733", "text": "def issues\n respond_with @article_issues_presenter do |format|\n format.json { render json: @article_issues_presenter.as_json(only: [:priority, :kind, :status, :summary, :description, :subscribed_emails]) }\n end\n end", "title": "" }, { "docid": "d7349d1dfb5dddacb4444616456a7f2b", "score": "0.6205424", "text": "def show\n @non_comp_issue = NonCompIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @non_comp_issue }\n end\n end", "title": "" }, { "docid": "4625e5852a91e5feccc1f408de823e62", "score": "0.6183877", "text": "def show\n @challenge = Challenge.find(params[:id])\n @resources = @challenge.resources\n end", "title": "" }, { "docid": "46f3b5752b2e91aaf5b118f2589de0d8", "score": "0.6176847", "text": "def show\n @response = @issue.responses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @response }\n end\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "65c8cf0952e122010c92b2a59ca8966f", "score": "0.6152023", "text": "def index\n @issues = Issue.all\n end", "title": "" }, { "docid": "7275c963e7ec3be5dfdd0d4ac52fdcd8", "score": "0.6150512", "text": "def show\n @issues = Issue.where(project: @project)\n end", "title": "" }, { "docid": "892d1ebc844eb1179cd0655436bf0356", "score": "0.61498785", "text": "def issues\n @projects = current_user.projects.all\n @user = current_user\n @issues = current_user.assigned_issues.opened.recent.page(params[:page]).per(20)\n @issues = @issues.includes(:author, :project)\n\n respond_to do |format|\n format.html\n format.atom { render layout: false }\n end\n end", "title": "" }, { "docid": "ae155e7739f19228ededcd40958aecd8", "score": "0.6139294", "text": "def update\n @issue_resource = IssueResource.find(params[:id])\n\n respond_to do |format|\n if @issue_resource.update_attributes(issue_resource_params)\n format.html { redirect_to @issue_resource, notice: 'Issue resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "61b1cd5f5380fa4ebc3265f62f9a66ea", "score": "0.61234653", "text": "def resources\n Resources.find(self.resources_id)\n end", "title": "" }, { "docid": "3652c6befc75a6740b6e278bdad49df2", "score": "0.61049974", "text": "def show\n @project = Project.find(params[:id])\n @issue = @project.issues.new\n end", "title": "" }, { "docid": "a301822fbe1d079022fa7529293c5db9", "score": "0.605442", "text": "def index\n a = URI.parse(\"https://api.github.com/repos/nnluukhtn/employment_bot/issues?state=all\").read\n @gitissue = JSON.parse(a)\n end", "title": "" }, { "docid": "c886d052018920dc738e025fa50cf73d", "score": "0.6051165", "text": "def issues\n return IssuesAPI.new(self)\n end", "title": "" }, { "docid": "69666cf58efc06c11bbb9330a6ea93be", "score": "0.60366154", "text": "def index\n\t\t@issues = Issue.all\n\tend", "title": "" }, { "docid": "2708f7341556549eafefb5a7e55fa659", "score": "0.6035976", "text": "def show\n session[:current_issue] = @issue\n @pages = @issue.pages.order(:id, 'desc')\n @pages = @issue.pages\n respond_to do |format|\n format.html\n format.json { render @issue }\n end\n end", "title": "" }, { "docid": "4c7f71ef1304137ac2477268b7ff9966", "score": "0.60167754", "text": "def list_issue(issue)\n payload = JSON.generate(gist_issue_1)\n uri = URI(\"https://github.com/stevefake/2016.03.28/issues/1\")\n req = Net::HTTP::Post.new(uri, {'Content-Type' =>'application/json'})\n req.basic_auth ENV['GITHUB_USER'], ENV['GITHUB_PASSWORD']\n req.body = payload\n http = Net::HTTP.new(uri.hostname, uri.port)\n http.use_ssl = true\n http.start\n response = http.request(req)\n return response\n end", "title": "" }, { "docid": "04d1dfab6745c13cba87245b2d19f5f0", "score": "0.6013144", "text": "def lookup_jira_issues\n # /rest/api/2/project/DP\n project = @jira.Project.find('DP')\n # /rest/api/2/search?jql=project%3D%22DP%22\n project.issues\n end", "title": "" }, { "docid": "0e4c591ec71651ef7abd33c707332851", "score": "0.60087186", "text": "def index\n @project_resources = ProjectResource.all\n render json: @project_resources, status: :ok\n end", "title": "" }, { "docid": "c954bc2a5aa0642ae1420178db971a52", "score": "0.5991799", "text": "def show\n @issue = @user.issues.find(params[:id])\n end", "title": "" }, { "docid": "1328c41edeb4fe2e6b11ca1312033b42", "score": "0.59905", "text": "def show\n respond_with(@issue)\n end", "title": "" }, { "docid": "14d571cd3b4e1f3df71e13ff9acb7dcd", "score": "0.59903395", "text": "def show\n @issue_request = IssueRequest.find(params[:id])\n end", "title": "" }, { "docid": "643f17fb81f6db9cb567df32e8a11538", "score": "0.5985332", "text": "def index\n @issue_relations = IssueRelation.all\n end", "title": "" }, { "docid": "70eefc36423cefa80bbf17e8fa9e9aac", "score": "0.59793067", "text": "def show\n @resource_item = ResourceItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_item }\n end\n end", "title": "" }, { "docid": "713cef7c953b7e7304c419e717c0b9dd", "score": "0.59767497", "text": "def actions\n require_parameters :issue\n issue_key = params[:issue]\n actions = Internal.issues.listActions(issue_key)\n render :json => jsonp(\n {\n :actions => actions.map { |t| t.key() }\n }\n )\n end", "title": "" }, { "docid": "8a8b965a91524fc97afb9f32a3dd16e4", "score": "0.5959031", "text": "def issues\n Bugly.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Bugly::Issue.new(i) }\n end", "title": "" }, { "docid": "4e2a37020044c14b0de629234b5388ca", "score": "0.5931034", "text": "def new\r\n @issue = Issue.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @issue }\r\n end\r\n end", "title": "" }, { "docid": "fae214dbbc919daee8d0dc41e9031fc2", "score": "0.5927279", "text": "def show\n @title = Title.find(params[:title_id])\n @issue_range = IssueRange.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue_range }\n end\n end", "title": "" }, { "docid": "57522ab78b98bbaf2cd0e03f94edd08f", "score": "0.59237623", "text": "def new\n # @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "056de54ed092ab0c5e118ecb17752ad7", "score": "0.59223384", "text": "def index\n @issueactions = Issueaction.all\n end", "title": "" }, { "docid": "2a2eeef044ea2c9617e49ae913b09200", "score": "0.5920633", "text": "def resources\n @json[:Resources].dup\n end", "title": "" }, { "docid": "2aee069bc07688da8ceea205b574d14a", "score": "0.5915757", "text": "def show\n @title = Title.find(params[:title_id])\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @title }\n end\n end", "title": "" }, { "docid": "af56e53d9176e313d41fc8cbb3779065", "score": "0.5914137", "text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "af56e53d9176e313d41fc8cbb3779065", "score": "0.5914137", "text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "af56e53d9176e313d41fc8cbb3779065", "score": "0.5914137", "text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "af56e53d9176e313d41fc8cbb3779065", "score": "0.5914137", "text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "af56e53d9176e313d41fc8cbb3779065", "score": "0.5914137", "text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "d7c5731e33d740201909decd8f300815", "score": "0.5910667", "text": "def show\n @validation_issue = ValidationIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @validation_issue }\n end\n end", "title": "" }, { "docid": "4acfd3d294b2784cd41af1ab9e2cf7f3", "score": "0.5898953", "text": "def show\n @issue = Issue.find(params[:id])\n @user_login_name = @issue.user.identities.first.login_name if @issue.gist_id\n @response = @issue.responses.build\n\n respond_to do |format|\n format.html { render :layout => 'response'}\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "e40ecc4fe8b961f085c247b30161419b", "score": "0.58961433", "text": "def get_issues(params)\n RestClient::Request.execute method: :post, url: \"#{@api_url}/issues/scan.json\",\n headers: @headers, payload: params do |response, request, result, &block|\n case response.code\n when 200\n JSON.parse(response.to_str, :symbolize_names => true)\n else\n { :errors => [response.code] }\n end\n end\n end", "title": "" }, { "docid": "e0dff010f48bedf0fe2da6de038a08e8", "score": "0.5893653", "text": "def fetch\n uri = URI(JIRA_BASE_URL + '/rest/api/2/issue/' + key)\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n fetched_issue = Issue.new(data[\"key\"], data[\"fields\"])\n yield fetched_issue if block_given?\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for issue \" + issue\n end\n fetched_issue\n end\n end", "title": "" }, { "docid": "452453651cc2260bc5ff3fc2a947edad", "score": "0.58798337", "text": "def update\n update_resource_response(@issue, issue_params)\n end", "title": "" }, { "docid": "701dd62d0d26b917e75b453cdf0d7019", "score": "0.5876537", "text": "def index\n if params[:format]\n session[:project_id] = params[:format]\n end\n @project = Project.find_by(id: session[:project_id])\n @issues = Issue.where(project_id: @project)\n end", "title": "" }, { "docid": "59cdcb47056cd4a7ff9a32372aee1df2", "score": "0.58737004", "text": "def show\n @web_issue = WebIssue.find(params[:id])\n @publications = Publication.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_issue }\n end\n end", "title": "" }, { "docid": "61490aca9702fd21892c8b1e2f95e09c", "score": "0.5869359", "text": "def show\n @resourceset = Resourceset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resourceset }\n end\n end", "title": "" }, { "docid": "2df5fc4572f6ae893fac60b3dbfec9da", "score": "0.5869036", "text": "def new\n @issue = Issue.new\n @clients = Client.all\n @doctors = Doctor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "34151795f55bad49a01975219fa71992", "score": "0.5844551", "text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "title": "" }, { "docid": "c29df8859902dd96e8afecc407e63490", "score": "0.58378315", "text": "def show\n @issue = Issue.find(params[:issue_id])\n @comment = @issue.comments.find(params[:id])\n respond_to do |format|\n format.json {render json: @comment, status: :ok, each_serializer: CommentSerializer}\n end\n end", "title": "" }, { "docid": "957bb31c52221ad11261f53cf7c365f9", "score": "0.5834468", "text": "def show\n @resource_list = ResourceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_list }\n end\n end", "title": "" }, { "docid": "25ac2f4929655d5e80acdb9493db2bab", "score": "0.5834248", "text": "def issues\n @user = current_user\n @issues = current_user.assigned_issues.opened\n @issues = @issues.of_group(@group).order(\"created_at DESC\").page(params[:page]).per(20)\n @issues = @issues.includes(:author, :project)\n\n respond_to do |format|\n format.html\n format.atom { render layout: false }\n end\n end", "title": "" }, { "docid": "3acd128c799541b583cc49189b49d8e5", "score": "0.58294713", "text": "def index\n if session[:ref].nil?\n #create reference\n #session[:ref] = Digest::SHA2.hexdigest(Time.now.to_s + 'ts')\n session[:ref] = session[:session_id]\n end\n if params[:ref]\n #get reference from url\n session[:ref] = params[:ref]\n end\n @issues = Issue.where(:ref=>session[:ref])\n\n if @issues.count==0\n flash[:notice] = \"You haven't issues. You can add them by pressing *New Issue*\"\n else\n flash[:notice] = nil\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "title": "" }, { "docid": "ba5f276929b8e1cd93a6c409a7b6d9ed", "score": "0.58178866", "text": "def show\n if @project_resource\n render json: @project_resource, status: :ok\n else\n render json: {error: \"No such assignment exists\"} , status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "98495b29e24899d2384685b6f3d70eb7", "score": "0.58160424", "text": "def show\n @dummy_resource = DummyResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dummy_resource }\n end\n end", "title": "" }, { "docid": "daf7b7b7345ad2982c019594a1c993d3", "score": "0.5814265", "text": "def show\n @comments = @issue.comments if @issue\n respond_to do |format|\n format.html\n format.json {render json: @issue, status: :ok, serializer: ShowIssueSerializer}\n end\n end", "title": "" }, { "docid": "718abd17e5b72aa57d52e6a61698efde", "score": "0.5812188", "text": "def index\n resources = find_resources.map { |resource| {:id => resource._id, :name => resource.name } }\n render json: resources\n end", "title": "" }, { "docid": "0da0211519726e0174e068bbbbb3de73", "score": "0.58086103", "text": "def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end", "title": "" }, { "docid": "58ac589f2a5e69b0a377613ea346fcbe", "score": "0.58008176", "text": "def fetch_resources_detail\n end", "title": "" }, { "docid": "7c8546a5abb317357891c6dd9da8acfb", "score": "0.5799139", "text": "def show\n @issue = Issue.find(params[:id])\n @opportunity = @issue.opportunity\n @notes = @issue.notes\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @issue }\n end\n end", "title": "" }, { "docid": "8c17cc1770b409ddcb499e6c255d87bb", "score": "0.5793123", "text": "def get_issue(issue_number)\n\n RestClient.proxy = @proxy\n\n url = @github_api_url + \"/repos\" + @github_repo + \"/issues/#{issue_number}\"\n headers = {:accept => :json, :content_type => :json, :authorization => \"Bearer #{@gitub_token}\"}\n\n r = RestClient.get url, headers\n\n issue = JSON.parse(r.body)\n return issue\n end", "title": "" }, { "docid": "57c4cd53257f6db071bd1953d4008340", "score": "0.57922095", "text": "def issue(key)\n if key.nil? || key.to_s.strip.empty?\n raise ArgumentError.new(\"Issue key is required\")\n end\n json = self.get \"issue/#{key}\"\n if json and (json.empty? or json['errorMessages'])\n raise IssueNotFound.new(\"Issue '#{key}' not found in Jira\")\n else\n return Issue.new(self, json)\n end\n end", "title": "" }, { "docid": "a8c424c65e33bcd947eff4015abd44b0", "score": "0.5791968", "text": "def issues_in_project project_id\n api Constant.url_for('ISSUES_IN_PROJECT', project_id)\n end", "title": "" }, { "docid": "477654b79f95344fb81ec0137366741a", "score": "0.5788775", "text": "def show\n @bundle = Bundle.find(params[:id])\n @resources = @bundle.resources\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bundle }\n end\n end", "title": "" }, { "docid": "0a78865dcc3382264931aba17864b45d", "score": "0.57885146", "text": "def issues(options = {})\n search_url = client.options[:rest_base_path] + '/search'\n query_params = { jql: \"project=\\\"#{key}\\\"\" }\n query_params.update Base.query_params_for_search(options)\n response = client.get(url_with_query_params(search_url, query_params))\n json = self.class.parse_json(response.body)\n json['issues'].map do |issue|\n client.Issue.build(issue)\n end\n end", "title": "" }, { "docid": "ba51e916b6875359562c2587adf9303f", "score": "0.5788038", "text": "def show\n repo = Repo.find_by_owner_name_and_name(params[:owner], params[:repo])\n\n @issue = Issue.find_by_repo_id_and_git_number(repo.id, params[:git_number])\n\n if !@issue\n flash[:error] = \"There is no issue number #{params[:git_number]} for #{params[:owner]}/#{params[:repo]}\"\n redirect_to :action => \"index\"\n else\n @difficulty = @issue.retrieve_difficulty(current_user) if current_user\n \n if current_user\n RefreshIssuesWorker.perform_async(@issue.id, current_user.token)\n end\n \n # if @issue.updated?(@issue.repo.octokit_id, @issue.git_number, octokit_client.client)\n # RefreshIssuesWorker.perform_async(@issue.id, current_user.token)\n # flash[:notice] = \"Updating issue from Github, please refresh\"\n # end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end\n end", "title": "" }, { "docid": "b922d6f812a47b6f2c3d07365aac0b9c", "score": "0.5787817", "text": "def show\n # @project = @user.projects.find(params[:id])\n # @project = set_project\n\n\n\n # @project_list = Issue.find_by project_id: @project\n # Issue.find_each do |issue|\n # pp issue[:item]\n # end\n\n # pp @project_list[:item]\n end", "title": "" } ]
bd4fefce30596fb13e58fd1a9bf9a95c
I worked on this challenge with: Sam Arkless, lasse sviland Our Refactored Solution
[ { "docid": "51e38aaa997cd203798c4b8e90360002", "score": "0.0", "text": "def bakery_num(num_of_people, fav_food) \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n food_qty = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n\n has_fave = false #creates new variable, has_fave, which is equal to the boolean, false. \n\n my_list.each_key do |k| # This loops through the my_list hash using the each_key method\n if k == fav_food # if the key is equal to fav_food, then has_fave is true and fav_food is equal to the key.\n has_fave = true \n fav_food = k\n end\n end\n \n if has_fave == false #This is saying that if the has_fave variable is false, it will raise a new argument error.\n raise ArgumentError.new(\"You can't make that food\")\n else\n #food_qty[fav_food] = my_list[fav_food][0]\n if num_of_people % my_list[fav_food] == 0 && num_of_people != 0\n num_of_food = num_of_people / my_list[fav_food]\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else \n my_list.each do |food, qty| \n if num_of_people != 0\n food_qty[food] = num_of_people / my_list[food]\n num_of_people = num_of_people % my_list[food] \n end\n end\n end\n return \"You need to make #{food_qty['pie']} pie(s), #{food_qty['cake']} cake(s), and #{food_qty['cookie']} cookie(s).\"\n end\nend", "title": "" } ]
[ { "docid": "af5213168e0ee82b120bec44b2735af5", "score": "0.66835123", "text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n leader_indices = []\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n end\n leader_indices << count\n end\n\n if count > (a.length/2)\n leader = candidate\n end\n\n leaders_count = 0\n\n if(leader != -1)\n (0..(a.length-1)).each do |i|\n a_1 = a[0..i]\n a_2 = a[(i+1)..(a.length-1)]\n\n count_2 = leader_indices[i]\n\n # puts \"count_2 #{count_2} , count #{a_1.length/2}\"\n # puts \"count_2 #{count_2} , (count-count_2) #{(count-count_2)}, count #{(a_2.length/2)}\"\n\n if count_2 > (a_1.length/2) && (count-count_2) > (a_2.length/2)\n leaders_count = leaders_count + 1\n end\n\n # puts leaders_count\n # puts\n end\n end\n\n leaders_count\nend", "title": "" }, { "docid": "6979036015fac47c519d3834b2c5c971", "score": "0.65638936", "text": "def sort_string(string)\r\n # your code here\r\n a = string.split(\" \")\r\n b = a.sort{|x,y| x.length <=> y.length}\r\n b[0]<<' '<<b[1]<<' '<<b[2]\r\nend\r\n\r\n\r\n# Select random elements from an array\r\n\r\ndef random_select(array, n)\r\n # your code here\r\n len = array.size\r\n result = []\r\n n.times do \r\n result = result << array[rand(len)] \r\n end\r\n return result\r\nend\r\n\r\n\r\n# Find the length of strings in an array\r\n\r\ndef length_finder(input_array)\r\n out_arr = []\r\n input_array.each do |i|\r\n out_arr = out_arr << i.length\r\n end\r\n return out_arr\r\nend\r\n\r\n\r\n# Hiring Programmers - Boolean Expressions in Ruby\r\n\r\nis_an_experienced_programmer = (\r\n (candidate.years_of_experience >= 2 || candidate.github_points >= 500) && candidate.languages_worked_with.include?(\"Ruby\") && candidate.age >= 15 && !candidate.applied_recently?\r\n )\r\n \r\n \r\n# Palindromes \r\n\r\ndef palindrome?(sentence)\r\n # Write your code here\r\n sentence = sentence.downcase.gsub(' ','')\r\n reverse = ''\r\n i = 1\r\n sentence.length.times do\r\n reverse = reverse << sentence[-i]\r\n i = i.next\r\n end\r\n return reverse == sentence\r\nend\r\n\r\n\r\n# Compute sum of cubes for given range\r\n\r\ndef sum_of_cubes(a, b)\r\n # Write your code here\r\n i = a\r\n result = i**3\r\n loop do\r\n if i == b \r\n break\r\n else\r\n i = i + 1\r\n result = result + i**3\r\n end\r\n end\r\n return result\r\nend\r\n \r\n \r\n# Find non-duplicate values in an Array\r\n\r\ndef non_duplicated_values(values)\r\n # Write your code here\r\n out_arr = values\r\n values.each do |x|\r\n n = values.select {|y| y == x}\r\n if n.length > 1\r\n out_arr.delete_if {|y| y == x}\r\n end\r\n end\r\n return out_arr\r\nend\r\n\r\n\r\n# Check if all elements in an array are Fixnum\r\n\r\ndef array_of_fixnums?(array)\r\n # Write your code here\r\n n = 0\r\n n = array.select {|x| x.is_a?(String) }\r\n if n.length == 0\r\n return true\r\n else \r\n return false\r\n end \r\nend\r\n\r\n\r\n# Kaprekar's Number\r\n\r\ndef kaprekar?(k)\r\n k2 = k**2\r\n n = \"#{k}\".length\r\n num_digits_k2 = \"#{k2}\".length\r\n right_n = k2 % (10**n)\r\n left = k2 / (10**n)\r\n k == (right_n + left)\r\nend\r\n\r\n\r\n# Number shuffle\r\n\r\ndef number_shuffle(number)\r\n # your code here\r\n len = \"#{number}\".length\r\n arr = []\r\n i = 0\r\n num = 1\r\n len.times do \r\n x = number % 10**(i+1)\r\n arr[i] = x / (10**i)\r\n i = i + 1\r\n num = num * i\r\n end\r\n result = []\r\n loop do \r\n if result.length == num\r\n break\r\n else\r\n x = arr.shuffle\r\n y = 0\r\n i = 10**(arr.length-1)\r\n x.each do |k|\r\n y = y + (k * i)\r\n i = i / 10\r\n end\r\n result.push(y)\r\n result = result.uniq\r\n end\r\n end\r\n return result.sort\r\nend\r\n\r\n\r\n# Time to run code\r\n\r\ndef exec_time(proc)\r\n # your code here\r\n h = Time.now\r\n puts proc.call\r\n n = Time.now\r\n return n - h \r\nend\t\r\n\r\n\r\n# Your sum\r\n\r\nclass MyArray\r\n attr_reader :array\r\n\r\n def initialize(array)\r\n @array = array\r\n end\r\n\r\n def sum(initial_value = 0)\r\n if block_given?\r\n res = initial_value\r\n array.each do |i|\r\n res = res + yield(i)\r\n end\r\n return res\r\n else\r\n res = initial_value\r\n array.each do |i|\r\n res = res + i\r\n end\r\n return res\r\n end\r\n end\r\nend\r\n\r\n\r\n# Orders and costs\r\n\r\nclass Restaurant\r\n def initialize(menu)\r\n @menu = menu\r\n end\r\n\r\n def cost(*orders)\r\n # your code here\r\n total = 0\r\n orders.each do |ord|\r\n ord.each do |i, q|\r\n p = @menu[i]\r\n c = p * q\r\n total = total + c\r\n end\r\n end\r\n return total\r\n end\r\nend\r\n\r\n\r\n# Enough Contrast?\r\n\r\nclass Color\r\n attr_reader :r, :g, :b\r\n def initialize(r, g, b)\r\n @r = r\r\n @g = g\r\n @b = b\r\n end\r\n\r\n def brightness_index\r\n # your code here\r\n return ( 299 * r + 587 * g + 114 * b) / 1000\r\n end\r\n\r\n def brightness_difference(another_color)\r\n #your code here\r\n return (brightness_index - another_color.brightness_index).abs\r\n end\r\n\r\n def hue_difference(another_color)\r\n #your code here\r\n return ((r - another_color::r).abs + (g - another_color::g).abs + (b - another_color::b).abs)\r\n end\r\n\r\n def enough_contrast?(another_color)\r\n # your code here\r\n if brightness_difference(another_color) > 125 && hue_difference(another_color) > 500 \r\n true\r\n else\r\n false\r\n end\r\n end\r\nend\r\n\r\n\r\n", "title": "" }, { "docid": "75140bd92377e07bd7367ec852f43d4d", "score": "0.64159703", "text": "def solution(arr) end", "title": "" }, { "docid": "4f7342b3592ec209d29fa49774767bb7", "score": "0.63853925", "text": "def solve\n d = %w(1 2 3 4 5 6 7 8 9).permutation.map {|i| i.join}.select {|i| i >= '918273645'}.reverse\n \n d.each do |i|\n 1.upto( 4 ) do |j|\n s = i[0, j]\n n = s.to_i\n\n 2.upto( 5 ) do |k|\n s += (k * n).to_s\n return i.to_i if i == s # puts \"%s (1..%d x %d)\" % [i, k, n]\n\n break if !i.start_with?( s )\n end\n end\n end\n end", "title": "" }, { "docid": "49552ab2769a4e7e83c75ae7c3fe0900", "score": "0.6359399", "text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n index = -1\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n index = i\n end\n end\n\n if count > (a.length/2)\n leader = candidate\n else\n index = -1\n end\n\n index\nend", "title": "" }, { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.63025266", "text": "def solution4(input)\n end", "title": "" }, { "docid": "e332393e33f7fc2992053e0a24864665", "score": "0.630054", "text": "def rps_tournament_winner(input_encoded)\n lookup_list=Hash[\"rr\"=>0,\"sr\"=>1,\"pr\"=>0,\"rs\"=>0,\"ss\"=>0,\"ps\"=>1,\"rp\"=>1,\"sp\"=>0,\"pp\"=>0]\n xx=input_encoded.flatten.each_slice(2).to_a.each_slice(2).to_a\n\n #d is the variable that holds the size of the flattened input array.\n #Since each entry in input array consists of two elements: Name and strategy\n #Iterations required are the output value of exp_value (d)-1\n\n d=input_encoded.flatten.size\n iteration=exp_value(d)-1\n for round in 0..(iteration-1)\n c=Array.new(xx.size)\n for i in 0..((xx.size)-1)\n input=xx[i]\n string_check=(\"#{input[0][1]}\"+\"#{input[1][1]}\").downcase\n c[i]=input[lookup_list[string_check]]\n end\n d=c.flatten.size\n xx=c.flatten.each_slice(2).to_a.each_slice(2).to_a\n end\n puts \"#{xx}\"\nend", "title": "" }, { "docid": "c3a6c4ddb76579e45e3cbe80fba426be", "score": "0.6299836", "text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n\r\n l=a.count-1\r\n arr=[]\r\n \r\n \r\n loop do\r\n arr[a[l]-1] = a[l]\r\n \r\n l-=1\r\n break if l<0\r\n end\r\n \r\n if arr.count == a.count\r\n return 1\r\n else\r\n return 0\r\n end\r\n \r\n \r\nend", "title": "" }, { "docid": "ae10f5e1641f5047aa611f426748fe1d", "score": "0.627834", "text": "def solution(s)\n # write your code in Ruby 2.2\n len = s.length\n return 0 if len == 1\n return -1 if len % 2 == 0\n \n mid = s.length / 2\n (0...mid).each do |i|\n j = len - 1 - i\n return -1 if s[i] != s[j]\n end \n \n mid\nend", "title": "" }, { "docid": "6c75c688a8c9abcf195476c507e9ea45", "score": "0.62739074", "text": "def solution(a)\n leader, count = array_leader(a)\n return 0 unless leader\n\n n = a.size\n head_count = 0\n total_equis = 0\n a.each_with_index do |e, i|\n head_count += 1 if e == leader\n tail_count = count - head_count\n\n if (head_count > (i + 1)/2) && (tail_count > (n - 1 - i)/2)\n total_equis += 1\n end\n end\n\n total_equis\nend", "title": "" }, { "docid": "b4cf37fd3cf4912a388c5df5860e3bb5", "score": "0.6254258", "text": "def solve( n = 30 )\n # Solving this with combinatorics quickly turned into a major headache.\n # Instead, tackle it inductively by considering how the total changes as\n # as each new day's trinary string is added one by one. By keeping track\n # of certain characteristics for a string of length m, we can then make\n # simple statements about how those characteristics changes when we in-\n # crease the string's length to m + 1.\n #\n # Given some (valid, \"prize\") string S to which we will prepend either L,\n # O, or A, we know the result will also be valid provided:\n #\n # o We prepend O\n # o We prepend L AND S doesn't contain L already\n # o We prepend A AND S doesn't already start with AA\n #\n # This gives us an idea of what characteristics might be helpful to record\n # for each n:\n #\n # U = count of prize S containing L\n # V = count of prize S starting with A\n # W = count of prize S starting with AA\n # X = count of U ∩ V (contains L and starts with A)\n # Y = count of U ∩ W (contains L and starts with AA)\n # Z = count of prize S\n #\n # Now we can formulate functions to take U, V, W, ... to U', V', W', etc.\n # as n increases. That is, given U_n, V_n, W_n, etc., how do we compute\n # U_(n+1), V_(n+1), W_(n+1), ...?\n #\n # Given U valid strings containing L, we know they'll remain valid after\n # we prepend O, so U' will be at least O. We also know that we can do the\n # same for A, as long as we skip S that start with AA, so we need to in-\n # crease U' by an additional U - Y. Similarly, we know we can create Z - U\n # new L strings by prepending it to existing prizes strings. So, U' will\n # be given by U' = U + (U - Y) + (Z - U) = U - Y + Z.\n #\n # To compute V', note that we will have added A to all strings except the\n # ones starting with AA, but the ones that had started with A shouldn't be\n # counted (since they will now start with AA). V' = Z - V - W.\n #\n # W' is simply the count of valid strings previously starting with A,\n # since those are the only ones that could conceivably now begin with AA.\n # W' = V. Similarly, Y' = X.\n #\n # X' must necessarily be less than U (since not all L strings will start\n # with A), and in fact, we must subtract members that had been counted,\n # since they will have had A prepended and now start with AA. Similarly,\n # we shouldn't count the Y strings toward X' either, since they will not\n # start with A now. X' = U - X - Y.\n #\n # With the first five quantities defined in terms of the previous values,\n # we can now derive a formula for the total number of valid prize strings.\n # For every valid string of length m, there will be corresponding strings\n # of length m + 1 such that:\n #\n # o it is identical except for a new leading L, except for strings that\n # already contain L (Z - U new items),\n # o it is identical except for a new leading O (Z new items), or\n # o it is identical except for a new leading A, except for strings that\n # already started with AA (Z - W new items)\n #\n # Therefore, Z' = Z - U + Z + Z - W = 3Z - U - W.\n u, v, w, x, y, z = 1, 1, 0, 0, 0, 3\n \n (n - 1).times do\n u, v, w, x, y, z = u - y + z, z - v - w, v, u - x - y, x, 3*z - u - w\n end\n\n z\n end", "title": "" }, { "docid": "4a21fd90da81a02895a7e32078bf0946", "score": "0.62047946", "text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n i=0;\r\n l=a.count\r\n arr=[]\r\n p=0\r\n loop do\r\n arr[a[i]-1] = a[i]\r\n i+=1\r\n \r\n if(i==l)\r\n k=1;\r\n \r\n for j in arr\r\n if(k!=j)\r\n p=k\r\n break\r\n end\r\n k+=1\r\n end\r\n \r\n break\r\n end\r\n end\r\n \r\n \r\n p\r\nend", "title": "" }, { "docid": "15a47b49e9abd1e4a0e1f3149d80bbf9", "score": "0.61770946", "text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n letters = { 'A' => 1, 'C' => 2, 'G' => 3, 'T' => 4 }\n n = s.size\n res = []\n\n p_sums = Hash.new { |k,v| k[v] = Array.new(n + 1, 0) }\n\n letters.keys.each do |letter|\n for i in 1..n do\n p_sums[letter][i] = p_sums[letter][i -1]\n p_sums[letter][i] += 1 if s[i-1] == letter\n end\n end\n # puts \"#{p_sums}\"\n\n i = 0\n for i in i..p.size-1 do\n # puts \"== #{i}\"\n letters.keys.each do |k|\n # puts \"#{k} | P: #{p[i]} Q: #{q[i]} | #{p_sums[k][p[i]]} #{p_sums[k][q[i]+1]}\"\n if p_sums[k][p[i]] != p_sums[k][q[i]+1]\n res << letters[k]\n break\n end\n end\n end\n res\n\n \nend", "title": "" }, { "docid": "8680c940dfaba755439e1e4ddbcde59d", "score": "0.61634827", "text": "def solution(s, p, q)\n\n stats_a = []\n stats_c = []\n stats_g = []\n\n minimals = []\n\n stats_a[0] = 0\n stats_c[0] = 0\n stats_g[0] = 0\n (1..(s.length)).each do |i|\n stats_a[i] = stats_a[i-1]\n stats_c[i] = stats_c[i-1]\n stats_g[i] = stats_g[i-1]\n\n if(s[i-1] == \"A\")\n stats_a[i] = stats_a[i] + 1\n elsif(s[i-1] == \"C\")\n stats_c[i] = stats_c[i] + 1\n elsif(s[i-1] == \"G\")\n stats_g[i] = stats_g[i] + 1\n end\n end\n\n (0..(p.length-1)).each do |j|\n start_index = p[j]\n end_index = q[j] + 1\n\n if(stats_a[end_index] - stats_a[start_index] > 0)\n minimals[j] = 1\n elsif(stats_c[end_index] - stats_c[start_index] > 0)\n minimals[j] = 2\n elsif(stats_g[end_index] - stats_g[start_index] > 0)\n minimals[j] = 3\n else\n minimals[j] = 4\n end\n end\n minimals\nend", "title": "" }, { "docid": "19bcd70b66be6f77d40897ae7a005569", "score": "0.6127416", "text": "def solution(a)\n east = 0\n passing = 0\n a.each { |v| \n case v\n when 0\n east += 1\n when 1\n passing += east\n return -1 if passing > 1_000_000_000\n end\n }\n passing\nend", "title": "" }, { "docid": "4871d41491c1924c30e4fb427988073d", "score": "0.6125465", "text": "def solution(s)\n result = 'Funny'\n s = s.codepoints\n r = s.reverse\n\n for i in (1..s.length - 1)\n sum1 = (s[i] - s[i-1]).abs\n sum2 = (r[i]- r[i-1]).abs\n if sum1 != sum2\n result = 'Not Funny'\n break\n end\n end\n\n result\nend", "title": "" }, { "docid": "cef825fbfb3afa754f79670aa333d6ef", "score": "0.61252093", "text": "def solution(a)\n east = 0\n west = 0\n passing = 0\n for i in a\n case i\n when 0\n east += 1\n when 1\n west += 1\n passing += east\n end\n return -1 if passing > 1_000_000_000\n end\n passing\nend", "title": "" }, { "docid": "1f0955975a10a26277bd0d9fb51a00f1", "score": "0.61124426", "text": "def solution(s)\n t = 0\n (s.length / 3).times do |i|\n slice = s[(3 * i)..(3 * i + 2)]\n t += 1 if slice[0] != 'S'\n t += 1 if slice[1] != 'O'\n t += 1 if slice[2] != 'S'\n end\n t\nend", "title": "" }, { "docid": "0e4cda0adbc8b5aecd2938d89a067613", "score": "0.6086229", "text": "def solution(s)\n\nend", "title": "" }, { "docid": "285d2e49c760ed24f2673411b06f6a8c", "score": "0.606354", "text": "def solve(arr)\n\n result = []\n\n arr.each do |i|\n if i < 38\n result << i\n else\n mg1 = i+1\n mg2 = i+2\n if mg1%5 == 0\n result << mg1\n elsif mg2%5 == 0\n result << mg2\n else\n result << i\n end\n end\n end\n\n result.each do |r|\n puts r\n end\n\nend", "title": "" }, { "docid": "e64ab9041d127fd863cb8cc14dea830e", "score": "0.60627353", "text": "def solve_challenge(input)\n sum = 0\n last_index = input.length - 1\n char1 = ''\n char2 = ''\n input.split('').each_with_index do |ch, i|\n char1 = ch\n # circle around list if index is at the end\n if i == last_index\n char2 = input[0]\n # otherwise just grab the next character\n else\n char2 = input[i+1]\n end\n # add to sum if the 2 characters match\n sum += char1.to_i if char1 == char2\n end\n sum\nend", "title": "" }, { "docid": "fcdc7a5e867d3db0a4e4c61dc4d4da37", "score": "0.6049589", "text": "def solution(a)\n # write your code in Ruby 1.9.3\n go_east = 0\n pass = 0\n a.each do |x|\n if x == 0\n go_east += 1\n else\n pass += go_east\n if pass > 100000\n return -1\n end\n end\n end\n\n return pass\n\nend", "title": "" }, { "docid": "afb7c27a8561349d77eac5d9bd751021", "score": "0.6047477", "text": "def solution(a)\n # write your code in Ruby 2.2\n east = 0\n pass = 0\n \n a.each do |dir|\n if dir == 0\n east += 1\n else\n pass += east\n return -1 if pass > 1000000000\n end\n end\n \n pass\nend", "title": "" }, { "docid": "c521b44b316f68b7464f276a8f17939d", "score": "0.60420996", "text": "def find_judge_imp(n, trust)\n return -1 if trust.length < n - 1\n return n if trust.empty?\n \n degree = Array.new(n+1, 0)\n trust.each do |t|\n degree[t[0]] -= 1\n degree[t[1]] += 1\n end \n \n (0..n).each do |i|\n return i if degree[i] == n-1\n end\n return -1\nend", "title": "" }, { "docid": "4ddb265e96896424132c7b9abe9713d5", "score": "0.6035808", "text": "def ArithGeo_2(arr)\n#test for arithmetic sequence first\n #sum from i = 1 to n, = n(n+1) / 2 for sum of 1 .. n\n #general sum of an arithmetic sequence\n #a[1] - a[0] = delta\n #a[0] = a\n #arr.size = n\n #sum = a * n + delta( n(n-1) / 2 )\n sum = arr.sum\n arith_sum = arr[0] * arr.size + (arr[1] - arr[0]) * ((arr.size - 1) * (arr.size) / 2 )\n return \"Arithmetic\" if sum == arith_sum\n\n#test for geometric sequence next\n #sum from i = 1 to n, = { (a * (1 - r ** n) ) / (1 - r) }\n r = arr[1] / arr[0]\n a = arr[0]\n n = arr.size\n geo_sum = (a * (1 - (r ** n)) ) / (1 - r) if r != 1\n if r == 1\n return \"-1\"\n end\n return \"Geometric\" if geo_sum == sum\n\n\n return \"-1\"\nend", "title": "" }, { "docid": "61a5aa5387d7586d627164f40eaf623a", "score": "0.6032503", "text": "def solution6(input)\n end", "title": "" }, { "docid": "4ad68ebce1b425c551899d5fbdae814f", "score": "0.60092324", "text": "def solution(arr)\n\nend", "title": "" }, { "docid": "d72ccae3f326a4e3222492869096fb16", "score": "0.5999131", "text": "def day_one_part_one(input)\n n = input.strip.split('')\n\n\n # ------- SOL 1 ------\n # puts \"n is #{n}\"\n # puts \"n.rotate(1) is #{n.rotate(1)}\"\n # puts \"n.zip(n.rotate(1)) is #{n.zip(n.rotate(1))}\"\n puts n.zip(n.rotate(1))\n .select { |x, y| x == y }\n .map(&:first)\n .map(&:to_i)\n .inject(:+)\n # ------- SOL 2 ------\n # puts \"n.each_cons(2).to_a is #{n.each_cons(2).to_a}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y } is #{n.each_cons(2).to_a.select { |x, y| x == y }}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first) is #{n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first)}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first).map(&:to_i) is #{n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first).map(&:to_i)}\"\n # n << n.first\n # puts n.each_cons(2).to_a\n # .select { |x, y| x == y }\n # .map(&:first)\n # .map(&:to_i)\n # .inject(:+)\n #\n # ------- SOL 3 ------\n # sum = 0\n # digits = input.strip.split('')\n # digits.each_index do |i|\n # if i == digits.size - 1\n # sum += digits.last.to_i if digits.last == digits.first\n # elsif digits[i] == digits[i + 1]\n # sum += digits[i].to_i\n # end\n # end\n # puts sum\nend", "title": "" }, { "docid": "2d1f5ffbab8c86bc000cce7ee42c2003", "score": "0.59887946", "text": "def solution(array)\n array.sort!\n return 0 if array.length == 1 && array.first != 1\n length = array.length\n start = 1\n length.times do |n|\n if array[start-1] != n + 1\n return 0\n end\n start += 1\n end\n return 1\nend", "title": "" }, { "docid": "dd37cbf0e30ea40cbc34d6ebf39feefe", "score": "0.5970929", "text": "def solve(s)\n letters = s.split(/[aeiou]/)\n alphabet = ('a'..'z')\n letters_and_numbers = Hash.new\n \n alphabet.each_with_index do |letter, index|\n letters_and_numbers[letter] = index + 1\n end\n \n letters.map! do |letter|\n if letter.length.eql?(1)\n letters_and_numbers[letter.downcase]\n else\n letter.chars.map do |split_letter|\n letters_and_numbers[split_letter]\n end.sum\n end\n end\n \n letters.sort.pop\n \nend", "title": "" }, { "docid": "56e2f4c229d68e9d667cf5f5fe1d2177", "score": "0.5961767", "text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #a[0] = 1 [-1..1]\r\n #a[1] = 5 [-4..6]\r\n #a[2] = 2 [0..4]\r\n #a[3] = 1 [2..4]\r\n #a[4] = 4 [0..8]\r\n #a[5] = 0 [0]\r\n\r\n i=0\r\n arr=[]\r\n while(i<a.count) do\r\n \r\n arr[i] = (i-a[i].. i+a[i]).to_a\r\n i+=1 \r\n end\r\n \r\n \r\n \r\n l=arr.count\r\n i=0\r\n n=0\r\n while(i<l) do\r\n \r\n \r\n j=i+1\r\n while(j<l) do\r\n if(arr[i] != arr[j])\r\n \r\n if((arr[i] & arr[j]).empty? == false)\r\n n+=1\r\n end\r\n end\r\n j+=1\r\n end \r\n i+=1\r\n end\r\n n\r\nend", "title": "" }, { "docid": "4b2b30e235e0baf41954bc8fd2f8997e", "score": "0.5961282", "text": "def solution(s)\n s = s.codepoints\n r = s.reverse\n ops = 0\n for i in 0..s.length - 1\n if s[i] != r[i]\n ops += (s[i] - r[i]).abs\n break if s == s.reverse\n end\n end\n\n ops / 2\nend", "title": "" }, { "docid": "3f940bd70b6e1507faf06d772bcfd75a", "score": "0.5959247", "text": "def solution(a)\n stack_top = nil\n stack_size = 0\n a.each { |v| \n if stack_size == 0\n stack_top = v\n stack_size += 1\n else\n if stack_top == v\n stack_size += 1\n else\n stack_size -= 1\n end\n end\n }\n candidate = stack_top\n \n equi_leaders = 0\n if stack_size > 0\n total_candidates = a.count { |v| v == candidate }\n count_candidates = 0\n a.each_with_index { |v, i|\n count_candidates += 1 if v == candidate\n if count_candidates > (i + 1) / 2\n equi_leaders += 1 if (total_candidates - count_candidates) > (a.count - i - 1) / 2\n end\n }\n end\n equi_leaders\nend", "title": "" }, { "docid": "578a4c2088c4d8ec64fbe2465745ad9e", "score": "0.5953514", "text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #0 -east\r\n #1 - west\r\n \r\n\r\n\r\n arr=[]\r\n n=0\r\n a.each_with_index{|el,i|\r\n \r\n if(el==0)\r\n j=i\r\n loop do\r\n if (a[j] == 1)\r\n n+=1\r\n end\r\n \r\n j+=1 \r\n break if j==a.count \r\n end\r\n \r\n end\r\n \r\n }\r\n \r\n n\r\nend", "title": "" }, { "docid": "1e78c5171c06d1bd31c085ddb824db39", "score": "0.5941892", "text": "def solve_cipher(input, shift = -3)\n\n auxArray = Array.new()\n solutionArray = Array.new()\n solution = String.new()\n\n alphabet = ('a'..'z').to_a # => Array del alfabeto para obtener la longitug.\n\n # => La idea aquí, después de probar con muchas opciones, es sacar el modulo\n # => del shift con la longitud del alfabeto. Así funcionaría con cualquier\n # => shift. Si queremos darle mil vueltas al alfabeto hacia atrás (-2600) y\n # => movernos 3 casillas (-2603), con el modulo obtendremos el numero de\n # => posiciones a mover despues de dar todas las vueltas necesarias.\n if shift < 0\n shift = shift % (alphabet.length * -1)\n else\n shift = shift % alphabet.length\n end\n\n input.each_char do |c|\n auxArray.push(c) # => introduzco los caracteres en un Array.\n end\n\n auxArray.each {|x| # => Loop para cada caracter del Array\n\n if x.match(/\\p{Upper}/) # => Mayúsculas?\n if (x.ord + shift) < 65 # => Menor que la primera letra\n solutionArray.push(\n (91 - 65 % (x.ord + shift))\n )\n elsif (x.ord + shift) > 90 # => Mayor que la última letra\n solutionArray.push(\n (64 - 90 % -(x.ord + shift))\n )\n else\n solutionArray.push(x.ord + shift)\n end\n elsif x.match(/\\p{Lower}/) # => Minúsculas?\n if (x.ord + shift) < 97\n solutionArray.push(\n (123 - 97 % (x.ord + shift))\n )\n elsif (x.ord + shift) > 122\n solutionArray.push(\n (96 - 122 % -(x.ord + shift))\n )\n else\n solutionArray.push(x.ord + shift)\n end\n else\n solutionArray.push(x.ord) # => No es una letra\n end\n\n }\n\n solutionArray.each{|x|\n solution += x.chr\n }\n\n puts solution\nend", "title": "" }, { "docid": "69696aa2a624b4ca18ebf88d4181f524", "score": "0.59398097", "text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n factor = nil\n arr = []\n i = 0\n res = []\n \n for i in 0...s.length do \n case s[i]\n when 'A'\n arr << 1\n when 'C'\n arr << 2\n when 'G'\n arr << 3\n when 'T'\n arr << 4\n end\n end\n \n #puts \"#{arr.to_s} #{s} #{p.to_s} #{q.to_s}\"\n \n i = 0\n for i in 0...p.size do\n tmp = arr.slice(p[i],q[i] - p[i] + 1)\n #puts \"#{tmp}\"\n res << tmp.min\n end\n #puts \"#{res}\"\n \n res\n \nend", "title": "" }, { "docid": "6f367f283462dbe1cd9f98c60df8033e", "score": "0.5937381", "text": "def solution(a)\n return [] if a.empty?\n target = -zero_sum(a)\n output = a\n sum = 0\n i = 0\n while sum != target\n if (target - sum) % (-2) ** i != 0\n output << 1\n sum +=1\n else\n\n end\n end\nend", "title": "" }, { "docid": "24f189fd6b3cfc4aaa92f93d03441d85", "score": "0.5936068", "text": "def solution(a)\n zeroes = 0\n passes = 0\n a.each do |c|\n zeroes += 1 if c == 0\n passes += zeroes if c == 1\n return -1 if passes > 1000000000\n end\n passes\nend", "title": "" }, { "docid": "eda747fe4aa95ca303208ac6cbacfbab", "score": "0.59353125", "text": "def solution\n\n d8_10s = []\n d7_10s = []\n d6_10s = []\n d5_10s = []\n d4_10s = []\n d3_10s = []\n d2_10s = []\n d1_10s = []\n 17.step(987, 17) do |n| \n n = n.to_s.split(\"\").to_a\n n = [\"0\"] + n if n.count == 2\n d8_10s << n if n.count == n.uniq.count\n end\n \n d8_10s.uniq.each do |d8_10|\n d8_10[0..1].join.to_i.step(987, 100) do |n|\n d7 = (n/100).to_s\n if n % 13 == 0 && !d8_10.include?(d7)\n d7_10s << [d7] + d8_10\n end\n end\n end\n\n \n d7_10s.uniq.each do |d7_10|\n d7_10[0..1].join.to_i.step(987, 100) do |n|\n d6 = (n/100).to_s\n if n % 11 == 0 && !d7_10.include?(d6)\n d6_10s << [d6] + d7_10\n end\n end\n end\n \n d6_10s.uniq.each do |d6_10|\n d6_10[0..1].join.to_i.step(987, 100) do |n|\n d5 = (n/100).to_s\n if n % 7 == 0 && !d6_10.include?(d5)\n d5_10s << [d5] + d6_10\n end\n end\n end\n \n d5_10s.uniq.each do |d5_10|\n d5_10[0..1].join.to_i.step(987, 100) do |n|\n d4 = (n/100).to_s\n if n % 5 == 0 && !d5_10.include?(d4)\n d4_10s << [d4] + d5_10\n end\n end\n end\n \n d4_10s.uniq.each do |d4_10|\n d4_10[0..1].join.to_i.step(987, 100) do |n|\n d3 = (n/100).to_s\n if n % 3 == 0 && !d4_10.include?(d3)\n d3_10s << [d3] + d4_10\n end\n end\n end\n \n d3_10s.uniq.each do |d3_10|\n d3_10[0..1].join.to_i.step(987, 100) do |n|\n d2 = (n/100).to_s\n if n % 2 == 0 && !d3_10.include?(d2)\n d2_10s << [d2] + d3_10\n end\n end\n end\n\n d2_10s.uniq.each do |d2_10|\n 10.times do |d1|\n if !d2_10.include?(d1.to_s)\n d1_10s << ([d1] + d2_10).join.to_i\n end\n end\n end\n \n d1_10s\nend", "title": "" }, { "docid": "7e3293e591c6f76d4007108fd07f0ec8", "score": "0.5932167", "text": "def problem_95\n longest = [0,0]\n max = 1_000_000\n chain = [1,1]\n s_of_d = Integer.sum_of_divisors_upto(max)\n (1...max).each do |n|\n if c = chain[n]\n# puts \"#{n} has chain of #{c}\"\n next \n end\n if n.prime? # Goes to '1'\n chain[n] = 1\n# puts \"#{n} is prime => 1\"\n next\n end\n\n m = n\n nums = [m]\n loop do\n #m = m.sum_of_divisors\n m = s_of_d[m]\n# puts \"loop for #{m} #{nums.inspect}\"\n if m >= max\n # Set all numbers to '0'\n nums.each { |i| chain[i] = 0 }\n break;\n end\n# puts \"#{n} => #{chain[m] || 'unknown' }\"\n if chain[m] # We know what happens\n v = chain[m]\n if v == -1 # We seen our-self\n i = nums.rindex(m)\n v = nums.length - i\n if v >= longest[0]\n lchain = nums[i,nums.length]\n min = lchain.min\n if min != longest[1]\n longest = [v,min,lchain] \n puts \"new long chain #{longest.inspect}\"\n end\n# puts \"-1 hit #{n} => #{v} #{nums.inspect}\"\n end\n end\n nums.each { |i| chain[i] = v }\n# puts \"#{n} has loop of #{v}\" if v > 2\n# puts \"#{n} => #{v} #{nums.inspect}\"\n break\n else\n # loop detect\n nums << m\n chain[m] = -1\n end\n end\n end\n longest[1]\nend", "title": "" }, { "docid": "72bb3b989efb9ec765190d8962bff157", "score": "0.5929323", "text": "def solution(a)\n # write your code in Ruby 1.9.3\n count = Array.new(a.length,0)\n a.each do |e|\n return 0 if e > a.length\n count[e-1] += 1 \n end\n \n (1..count.length-1).each do |i|\n return 0 if count[i]!=1 || count[i] > 1\n end\n \n return 1\nend", "title": "" }, { "docid": "f8b13ae90c3f70410bf86714d6d49eef", "score": "0.59289825", "text": "def solution(n)\n # write your code in Ruby 2.2\n s = n.to_s(2) \n zeroes = s.split('1') \n zeroes.pop if !n.odd? \n return 0 if zeroes.empty? \n zeroes.map { |x| x.length}.max\nend", "title": "" }, { "docid": "07a10d2fcc160a93377ffbd3e8801775", "score": "0.59282696", "text": "def solve(input)\n numbers = input.to_s.split(\"\").map(&:to_i)\n length = numbers.size\n first = numbers[0]\n\n total = 0\n\n step = length / 2\n numbers.each_with_index do |number, index|\n next_position = (index + step) % length\n if numbers[next_position] == number\n total += number\n end\n end\n\n total\nend", "title": "" }, { "docid": "945d26025ca635366dded77fb4a751f6", "score": "0.5927598", "text": "def solution(a)\n len = a.length\n\n i, j, count = 0, len - 1, 0\n while i <= j do\n l, r = a[i].abs, a[j].abs\n\n if l < r\n while j > 0 and r == a[j].abs\n j -= 1\n end\n elsif l > r\n while i < len and l == a[i].abs\n i += 1\n end\n elsif l == r\n while j > 0 and r == a[j].abs\n j -= 1\n end\n\n while i < len and l == a[i].abs\n i += 1\n end\n end\n\n count += 1\n end\n\n count\nend", "title": "" }, { "docid": "0c40912338cea9d25c8dbd1af5828b87", "score": "0.59263074", "text": "def algorithm(name)\n\n vowels=\"aeiou\"\n #alpha with no vowels\n alpha=\"bcdfghjklmnpqrstvwxyz\"\n\n name_split=name.split(\"\")\n new_name=[ ]\n\n #maps out each splitted letter similar to the example in 5.5\n name_split.map! {|letter|\n if vowels.include?(letter)\n new_name << vowels[vowels.index(letter)+1]\n elsif alpha.include?(letter)\n new_name << alpha[alpha.index(letter)+1]\n elsif letter == \"z\" #edge case for consonants\n new_name << \"b\"\n elsif letter == \"u\" #edge case for vowels\n new_name << \"a\"\n elsif letter == \" \"\n new_name << \" \"\n end }\n new_name.join(\"\").split.map{|letter| letter.capitalize}.join(\" \")\nend", "title": "" }, { "docid": "354acc44d23902170d18ef50bb27f5b1", "score": "0.59234303", "text": "def dynamic_programming(sorted)\n acc = { sorted.length - 1 => 1 }\n result = 1\n (2..sorted.length).each do |offset|\n (sorted.length - offset + 2...sorted.length).each do |index|\n break unless sorted[index] - sorted[sorted.length - offset] <= 3\n\n result += acc[index]\n end\n acc[sorted.length - offset] = result\n end\n result\nend", "title": "" }, { "docid": "184978b34707e2c9d190e35b6305dd56", "score": "0.59175396", "text": "def solution(n)\n a = n.to_s(2).split('')\n count, start, store = 0,0,0\n a.each do |i|\n start = 1 if i == '1' && count == 0\n count +=1 if i == '0' && start ==1\n if i=='1' && count > 0\n store = count if count > store\n count = 0\n end\n end\n store\nend", "title": "" }, { "docid": "95c5d00f6fd8f5d6f4b7368744a1a4b6", "score": "0.59055394", "text": "def solution2(input)\n end", "title": "" }, { "docid": "95c5d00f6fd8f5d6f4b7368744a1a4b6", "score": "0.59055394", "text": "def solution2(input)\n end", "title": "" }, { "docid": "7836df19a99ee978a005375604e7f649", "score": "0.59020865", "text": "def longest_sluggish(fishes)\n longest = nil\n fishes.each_with_index do |fish1, i|\n fishes.each_with_index do |fish2, j|\n next if j <= i\n if fish2.length > fish1.length\n longest = fish2\n else\n longest = fish1\n end\n end\n longest\nend\n\n# Dominant Octopus\n# Find the longest fish in O(n log n) time. Hint: You saw a sorting algorithm that runs in O(n log n) in the Sorting Complexity Demo. Accessing this on GitHub? Use this link. Remember that Big O is classified by the dominant term.\ndef longest_dominant(fishes)\n sorted_fishes = quicksort(fishes)\n sorted_fishes.last\nend\n\ndef quicksort(fishes)\n return fishes if fishes.size < 2\n pivot = fishes.first\n left = fishes[1..-1].select { |fish| fish.length <= pivot.length }\n right = fishes[1..-1].select { |fish| fish.length > pivot.length }\n\n sorted_left = quicksort (left)\n sorted_right = quicksort(right)\n sorted = sorted_left + [pivot] + sorted_right\n sorted \nend\n\n# Clever Octopus\n# Find the longest fish in O(n) time. The octopus can hold on to the longest fish that you have found so far while stepping through the array only once.\n\ndef longest_clever(fishes)\n\nend", "title": "" }, { "docid": "5fa31432c898a629d0fe43ee49b8c8d0", "score": "0.59014046", "text": "def solution(a)\n length = a.length\n i = 0\n a = a.sort\n smalest = 1\n while(i < length-1) do\n current_val = a[i]\n if current_val < 0\n i+=1\n next\n end\n next_val = a[i+1]\n if next_val - current_val > 1\n smalest = current_val + 1\n break\n elsif i == length-2\n smalest = next_val + 1\n break\n end\n i+= 1\n end\n smalest\nend", "title": "" }, { "docid": "ba45c54e0e93b61df11a30895aba7b72", "score": "0.5896575", "text": "def sluggish_octopus(arr) #finding the longest fish in O(n^2) time\r\n longest_fish = \"\"\r\n arr.each do |fish|\r\n arr.each do |fish2|\r\n longest_fish = fish2 if fish2.length >= fish.length && fish2.length >= longest_fish.length\r\n end\r\n end\r\n longest_fish\r\nend", "title": "" }, { "docid": "b9be2ae19752fdba688db247d65af0fa", "score": "0.58954495", "text": "def solution(s, p, q)\n # prefix sums\n n = s.length\n prefix_sums = Array.new(n) {Array.new(DNA.size, 0)}\n (0..n).each do |i|\n next if i == 0\n prefix_sums[i] = prefix_sums[i-1].dup\n prefix_sums[i][DNA[s[i-1]] - 1] += 1\n end\n\n answers = []\n m = p.size\n \n (0...m).each do |i|\n diff_sums = prefix_sums[q[i] + 1].map.with_index {|e, j| e - prefix_sums[p[i]][j]}\n diff_sums.each_with_index do |v, k|\n if v > 0\n answers << DNA[DNA.key(k + 1)]\n break\n end\n end\n end\n \n answers\nend", "title": "" }, { "docid": "e4f5a6838347a91f813d9ae88d659d38", "score": "0.5894963", "text": "def find_back_centric_larger_to_smaller_palindromic_words\n back_centric_larger_to_smaller_palindromic_words = []\n @original_words_reverse_keys.keys.each do |working_word_reversed|\n working_word = working_word_reversed.reverse\n if working_word.length > 3\n all_words_containing_word_palindromically = find_all_words_reverse_starting_with(working_word)\n if all_words_containing_word_palindromically != nil\n all_words_containing_word_palindromically.each do |array_word|\n suffix = array_word[working_word.length, array_word.length - working_word.length]\n if find_all_words_starting_with(suffix) != nil\n # puts \"Palindromically: Reversed: #{working_word_reversed}, Word: #{working_word}, Container: #{array_word}, Original(w): #{@original_words_reverse_keys[working_word_reversed]}, Original(c): #{@original_words_reverse_keys[array_word]}, Suffix: #{suffix}\"\n back_centric_larger_to_smaller_palindromic_words << {:working_word => working_word_reversed, :working_word_reversed => working_word,\n :container_word => array_word, :original_word => @original_words_reverse_keys[working_word_reversed],\n :original_container => @original_words_reverse_keys[array_word], :suffix => suffix\n }\n end\n end\n end\n end\n end\n back_centric_larger_to_smaller_palindromic_words\n end", "title": "" }, { "docid": "e9585cb8107ddba30dfb3d587cce2182", "score": "0.58948636", "text": "def is_typo this, of_that\n # ignore 1 letter variables\n if this.length == 1 or of_that.length == 1\n return false\n end\n\n # ignore difference bigger than 4 letters\n if (this.length - of_that.length).abs > 4\n return false\n end\n\n # cost[i][j] = the cost to transform the first i characters \n # of this in to the first j characters of of_that\n # cost[i][0] = 0\n # cost[0][j] = 0\n # cost[i][j] = 1 + cost[i-1][j-1] if this[i] == this[j]\n\n n = this.length \n m = of_that.length\n\n cost = Array.new(n + 1) {\n Array.new(m + 1, 0)\n }\n \n\n for i in 1..n\n cost[i][0] = i * TYPE_COST\n end\n\n for j in 1..m\n cost[0][j] = j * TYPE_COST\n end\n\n for i in 1..n\n for j in 1..m\n x = this[i-1].downcase\n y = of_that[j-1].downcase\n\n cost[i][j] = [\n cost[i-1][j] + TYPE_COST,\n cost[i][j-1] + TYPE_COST,\n cost[i-1][j-1] + TYPO_COST[x][y]\n ].min\n end\n end\n\n # puts cost[n][m]\n\n return cost[n][m] <= 18\nend", "title": "" }, { "docid": "d9f4dc31e32a146b09c44f50c1e8fe5d", "score": "0.5886846", "text": "def solution(a, s)\nsum_array = []\n a.sort!\n a.each_with_index do |e,i|\n each_array = []\n each_array.push(e)\n j = i + 1\n while(j<a.count)\n \n each_array.push(a[j])\n sum1 = each_array.inject(&:+)\n ave = sum1.to_f/each_array.count\n break if ave > s\n if s == ave\n sum_array.push(each_array) unless each_array.count == a.count\n end\n j+=1\n end\n end\n p sum_array\nend", "title": "" }, { "docid": "fa20c37c26ee8e5ef6a6984feae4e61d", "score": "0.58842987", "text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n table = {\n 'A' => 1,\n 'C' => 2,\n 'G' => 3,\n 'T' => 4\n }\n \n p.each_with_index.map do |start, i|\n finish = q[i]\n s[start..finish].chars.uniq.map do |c|\n table[c]\n end.min\n end\nend", "title": "" }, { "docid": "7a007b872ce37620e3363cea2761da98", "score": "0.58791023", "text": "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(0, :+)\n n = a.length\n expected = n * (n+1)/2\n diff = sum - expected\n missing = n + 1 - diff\nend", "title": "" }, { "docid": "b4c469af764e6ffb1894f38ad0c3396c", "score": "0.58714896", "text": "def n_squared_longest_fish(arr)\n\n #why is this n^2? how many steps in the worst case scenario?\n #how many steps? n * n.\n\n longest = arr[0]\n\n arr.each_index do |idx|\n test_arr = arr[0...idx] + arr[idx+1..-1]\n\n test_arr.each do |test_fish|\n longest = test_fish if test_fish.length > longest.length\n end\n end\n\n longest\n\nend", "title": "" }, { "docid": "3f0b67819d2d89164741586a25635d60", "score": "0.5868127", "text": "def return_base_candidate(base_char, base_counter, target_char_arr)\n base_candidate = []\n target_counter = 0\n target_char_arr.each do |target_char|\n verdict = base_char == target_char\n base_candidate << (base_counter - target_counter).abs if verdict\n target_counter += 1\n end\n base_candidate\nend", "title": "" }, { "docid": "d126b794382588618d12438a5e46269e", "score": "0.5867849", "text": "def solution(a)\n a.sort!\n triplets = 0\n a.each_with_index do |p, i|\n k = i + 2\n a[i+1..-1].each_with_index do |q, j|\n k += 1 while k < a.length && p + q > a[k]\n triplets += k - j - i - 2\n end\n end\n triplets\nend", "title": "" }, { "docid": "f8c5a632b40d696f07315ee81b737834", "score": "0.5866369", "text": "def phasea_phase_two(group)\n #TODO implement for phase 2 in like manner\n wilds = ['AH', 'AD', 'AC', 'AS']\n c_counter = 0\n wilds_counter = 0\n card_num = nil\n\n group.each do |x|\n if wilds.include?(x)\n wilds_counter += 1\n elsif card_num.nil?\n card_num = x[1]\n c_counter += 1\n elsif x[1] == card_num\n c_counter += 1\n end\n end\n\n if group.length == 7 && c_counter >= 2 && (c_counter + wilds_counter == 7)\n 2\n else\n nil\n end\nend", "title": "" }, { "docid": "cac98559ca8f0df3931c4ffcabb41db7", "score": "0.5864028", "text": "def solution(s)\n if s.size.odd?\n s.scan(/../) + [s[-1]+'_'] # .. returns an array that each element is 2 chars of string\n else\n s.scan(/../)\n end\nend", "title": "" }, { "docid": "1c498ff5848b8ea7cad89ed3ead7eed4", "score": "0.5851534", "text": "def solution(a)\n max = a.length + 1\n (1 + max) * max / 2 - a.inject(0, &:+)\nend", "title": "" }, { "docid": "c3cb3e948c27b241ea4299b2df1fa4b3", "score": "0.5847828", "text": "def solution5(input)\n end", "title": "" }, { "docid": "c3cb3e948c27b241ea4299b2df1fa4b3", "score": "0.5847828", "text": "def solution5(input)\n end", "title": "" }, { "docid": "0b7a616cc7822be314b767ef2b841fa3", "score": "0.5845828", "text": "def solution3(input)\n end", "title": "" }, { "docid": "68cb65f0d9f26ccc0e3880b6a4e1d2d2", "score": "0.58423936", "text": "def find_front_centric_larger_to_smaller_palindromic_words\n front_centric_larger_to_smaller_palindromic_words = []\n @original_words.keys.each do |working_word|\n working_word_reversed = working_word.reverse\n if working_word_reversed.length > 3\n all_words_containing_word_palindromically = find_all_words_starting_with(working_word_reversed)\n if all_words_containing_word_palindromically != nil\n all_words_containing_word_palindromically.each do |array_word|\n suffix = array_word[working_word_reversed.length, array_word.length - working_word_reversed.length]\n if find_all_words_reverse_starting_with(suffix) != nil\n # puts \"Palindromically: Word: #{working_word}, Reversed: #{working_word_reversed}, Container: #{array_word}, Original(w):#{@original_words[working_word]}, Original(c): #{@original_words[array_word]}, Suffix: #{suffix}\"\n front_centric_larger_to_smaller_palindromic_words << {:working_word => working_word, :working_word_reversed => working_word_reversed,\n :container_word => array_word, :original_word => @original_words[working_word], :original_container => @original_words[array_word], :suffix => suffix\n }\n end\n end\n end\n end\n end\n front_centric_larger_to_smaller_palindromic_words\n end", "title": "" }, { "docid": "07819e3afdf5a27c3cfb64e3e0f2ce3a", "score": "0.58393425", "text": "def problem33\n num, den = 1, 1\n 10.upto(98) do |x|\n (x+1).upto(99) do |y|\n if (((simplestTerms(x,y)<=>simplestTerms((n = (a = x.to_s)[0].to_i), (d = (b = y.to_s)[1].to_i))) == 0 && a[1] == b[0]) ||\n ((simplestTerms(x,y)<=>simplestTerms((n = a[1].to_i), (d = b[0].to_i))) == 0 && a[0] == b[1]) &&\n (a[0] != b[0] && a[1] != b[1] && a[0] != a[1] && b[0] != b[1]))\n num, den = num * n, den * d\n puts \"#{x}/#{y} == #{n}/#{d}\"\n end\n end\n end\n puts \"#{(r = simplestTerms(num,den))[0]}/#{r[1]}\"\nend", "title": "" }, { "docid": "f2bd12ce2ba67e77384063e3049bba61", "score": "0.58321995", "text": "def solution(s, p, q)\n values = {'A' => 1, 'C' => 2, 'G' => 3, 'T' => 4}\n s = s.split('').map { |c| values[c] }\n\n a_map = s.reduce([-1]) { |a, c| c == 1 ? a.push(a.size - 1) : a.push(a[-1]) }[1..-1]\n c_map = s.reduce([-1]) { |a, c| c == 2 ? a.push(a.size - 1) : a.push(a[-1]) }[1..-1]\n g_map = s.reduce([-1]) { |a, c| c == 3 ? a.push(a.size - 1) : a.push(a[-1]) }[1..-1]\n t_map = s.reduce([-1]) { |a, c| c == 4 ? a.push(a.size - 1) : a.push(a[-1]) }[1..-1]\n\n p.zip(q).reduce([]) do |result, i|\n r = 5\n r = 4 if t_map[i[1]] > t_map[i[0]]\n r = 3 if g_map[i[1]] > g_map[i[0]]\n r = 2 if c_map[i[1]] > c_map[i[0]]\n r = 1 if a_map[i[1]] > a_map[i[0]]\n r = [r, s[i[0]], s[i[1]]].min()\n result.push(r) \n end\nend", "title": "" }, { "docid": "fdc30d52c9adc32c82e291f2f3bc3b99", "score": "0.582992", "text": "def problem206\n Math.sqrt(1020304050607080900).floor.upto(m = Math.sqrt(1929394959697989990).ceil) do |x|\n if (s = x.to_s)[s.length - 1].to_i % 2 == 0\n puts \"#{x} of #{m}\"\n q = x**2\n if(s = q.to_s)[18].to_i == 0 && s[16].to_i == 9 && s[14].to_i == 8 && s[12].to_i == 7 && s[10].to_i == 6 && s[8].to_i == 5 && s[6].to_i == 4 && s[4].to_i == 3 && s[2].to_i == 2\n puts s\n break\n end\n end\n end\nend", "title": "" }, { "docid": "48f6ccd13854a541bfcb18ff7c741f02", "score": "0.58282954", "text": "def part1(input)\n twos = threes = 0\n\n # For each ID, bucket each char and count their instances within the ID.\n # Originally, I'd tried to sort the chars and use a regex, but getting\n # around the awkwardness of backtracking and detecting the twos that aren't\n # also threes (or more) wasn't worth the effort on this exercise.\n input.each do |id|\n counts = id.chars.group_by(&:to_s).values.map(&:size)\n\n twos += 1 if counts.include?(2)\n threes += 1 if counts.include? (3)\n end\n\n return twos * threes\nend", "title": "" }, { "docid": "4744a769cc5b296ad0df6899e089b4e7", "score": "0.582807", "text": "def solution(s) \n result = []\n 0.step(s.size-1, 2) do |start_index|\n result << s[start_index, 2]\n end\n result[-1] += '_' if result.last.size < 2\n result \nend", "title": "" }, { "docid": "d198ce6530d8641577166dd071790bfa", "score": "0.5825676", "text": "def hard(string)\n sum = 0\n steps = string.length / 2\n string.length.times do |i|\n j = (i + steps) % string.length\n sum += check(string[i], string[j])\n end\n sum\nend", "title": "" }, { "docid": "28af4f93a91e45878228e29d0c8229c2", "score": "0.58183944", "text": "def solution(str)\n b = str.split(\"\")\n n = 0\n c = []\n\n p b\n\n if b.count.even?\n for i in 0..str.length/2\n c << b[i*2].to_s + b[i*2+1].to_s\n end\n else\n b << \"_\"\n b.each do |x|\n c << b[n].to_s + b[n+1].to_s\n n = n + 2\n end\n end\nc.delete(\"\")\nreturn c\nend", "title": "" }, { "docid": "fd65d1f145815f32f434c3a3931d3c93", "score": "0.5812253", "text": "def solution(a)\n a1 = []\n a2 = []\n len = a.length\n count = 0\n \n a.each_with_index do |el, i|\n a1 << i-el\n a2 << i+el\n end\n \n a1.sort\n a2.sort\n \n (len-1).downto(0) do |i|\n position = a2.find_index(a1[i])\n if position && position >= 0\n while ((position < len) && (a2[position] == a1[i])) do\n position += 1\n end\n count += position \n else\n insertion_point = -(position+1)\n count += insertion_point\n end\n end\n \n sub = len*((len+1)/2)\n \n return -1 if (count > 10000000)\n \n count\nend", "title": "" }, { "docid": "be9ba48e3471cdeea55b3fa3acff13c0", "score": "0.58044434", "text": "def pivot_index(nums)\n def pivot_index(nums)\n nums.each_with_index do |n, idx|\n return idx if idx == 0 && nums[idx+1...nums.length].inject(:+) == 0\n return idx if nums[0...idx].inject(:+) == nums[idx+1...nums.length].inject(:+)\n return idx if idx == nums.length - 1 && nums[0...idx].inject(:+) == 0\n end\n -1\n end\nend", "title": "" }, { "docid": "7c89b4b7aba1befe09b838aaf0f6814e", "score": "0.5804024", "text": "def solve(str)\n sub_strings_arr = sub_strings(str)\n odds = []\n sub_strings_arr.each do |string|\n odds << string if string.to_i.odd?\n end\n odds.size\nend", "title": "" }, { "docid": "75943e7e1b55e14809f4131bedde12a3", "score": "0.57981443", "text": "def rank(st, we, n)\n return \"No participants\" if st.empty?\n return \"Not enough participants\" if n > st.split(\",\").count\np n\n letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']\n answer = st.split(\",\").each_with_object([]).with_index do |(item, arr), index|\n value = 0\n item.split(\"\").each {|x| value += (letters.index(x.downcase) + 1)}\n value += item.length\n arr << value * we[index]\n end\n p answer_hash = st.split(\",\").each_with_object({}).with_index {|(item, h), index| h[item] = answer[index]}.sort_by{|k,v| [v,k]}.reverse.to_h\n p answer_hash = st.split(\",\").each_with_object({}).with_index {|(item, h), index| h[item] = answer[index]}.sort_by{|k,v| [v,k]}.reverse.to_h.keys[n-1]\n# .select {|k,v| v == answer.sort.reverse[n-1]}\n# .sort_by{|k,v| k}.to_h\n# .reverse.to_h\n# p answer.sort.reverse[n-1]\n# test = answer_hash.dup\n# p answer_hash.invert.keys\n# p test\n# p final = test.select {|k,v| v == answer.sort.reverse[n-1]}.sort_by\n# p answer_hash.keys\n# p answer_hash.keys[n-1]\nend", "title": "" }, { "docid": "b2d1c4efb0ce3d7f6e9ed6262fcfe11a", "score": "0.57970786", "text": "def solve(a)\n # Complete this function\n $sum_1=0\n for i in (0..a.size/2-1)\n \t#puts \"a->#{a[i]}\"\n \t$sum_1=$sum_1+a[i]\n\n end\n #puts $sum\n $sum_2=0\n for i in (a.size/2..a.size-1)\n \t#puts \"b->#{a[i]}\"\n $sum_2=$sum_2+a[i]\n end\n #puts $sum\n $temp=$sum_1-$sum_2\n if $temp < 0\n \treturn $temp*-1\n else\n \treturn $temp\n end\n\nend", "title": "" }, { "docid": "6ace53412e223a7cadb271b9885c6eba", "score": "0.57934713", "text": "def solution(a)\n s = a.select { |z| z >= 0 }.sort\n return 0 if s.length < 3\n (s.length - 1).downto(0) do |r|\n return 0 if r <= 0\n (r - 1).downto(0) do |q|\n break if q <= 0\n (q - 1).downto(0) do |p|\n # p \"#{p} #{q} #{r}\"\n # p \"#{s[p]} #{s[q]} #{s[r]}\"\n break if (s[p] + s[q] <= s[r]) || (s[q] + s[r] <= s[p]) || (s[r] + s[p] <= s[q]) || p < 0\n return 1 if (s[p] + s[q] > s[r]) && (s[q] + s[r] > s[p]) && (s[r] + s[p] > s[q])\n end\n end\n end\n 0\nend", "title": "" }, { "docid": "6f7ab602fd6a695074a558b7d768d1bf", "score": "0.5793069", "text": "def check(board, input)\r\n # to put board into 1 same array\r\n big_array = []\r\n board.each do |item|\r\n item.each do |nested_item|\r\n big_array << nested_item.sub(/\\s+/, \"\")\r\n end\r\n end\r\n \r\n # to get all the matched char (coordinate) in the input from the board\r\n # something like [[0,1],[1,2]]\r\n index_array = []\r\n i = 0\r\n while i < input.length do\r\n temp_array = []\r\n j = 0\r\n while j < big_array.length do\r\n if big_array[j] === input[i]\r\n temp_array << j\r\n end\r\n j += 1\r\n end\r\n index_array << temp_array\r\n i += 1\r\n end\r\n\r\n # to join to become specificset of number that represent the number of the input\r\n # something line [[0,1],[0,2],[1,1],[1,2]]\r\n first_array = []\r\n temporary_array = []\r\n k = 0\r\n counter = true\r\n while k < index_array.length do\r\n update_array = []\r\n l = 0\r\n # only first time run this\r\n if counter === true\r\n while l < index_array[0].length do\r\n temporary_array << index_array[0][l]\r\n first_array << temporary_array\r\n temporary_array = []\r\n l += 1\r\n end\r\n counter = false\r\n elsif counter === false\r\n # need ti clone the element before continue, if not error\r\n m = 0\r\n while m < index_array[0].length do\r\n first_array.each do |element|\r\n update_array << element.clone\r\n end\r\n m += 1\r\n end\r\n n = 0\r\n while l < index_array[0].length do\r\n times = 0\r\n while n < update_array.length do\r\n if times < first_array.length\r\n update_array[n] << index_array[0][l]\r\n times += 1\r\n temp = n + 1\r\n end\r\n n += 1\r\n end\r\n n = temp\r\n l += 1\r\n end\r\n first_array = update_array\r\n end\r\n # remove the element when done\r\n index_array.shift\r\n end\r\n\r\n word_length = first_array[0].length\r\n new_array = []\r\n new_single_array = []\r\n iterator = 0\r\n while iterator < first_array.length do\r\n iterator_2 = 0\r\n # continue check until all char in input used\r\n while iterator_2 < word_length - 1 do\r\n # check the second number is not besides the first number\r\n if first_array[0][iterator_2] === 0 && (first_array[0][iterator_2] + 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 5 === first_array[0][iterator_2 + 1])\r\n # if does, push to an array\r\n new_single_array << first_array[0][iterator_2].clone\r\n # if the char test is last char, push the whole word into a new array\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n elsif first_array[0][iterator_2] === 3 && (first_array[0][iterator_2] - 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 3 === first_array[0][iterator_2 + 1])\r\n new_single_array << first_array[0][iterator_2].clone\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n elsif first_array[0][iterator_2] === 12 && (first_array[0][iterator_2] + 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 3 === first_array[0][iterator_2 + 1])\r\n new_single_array << first_array[0][iterator_2].clone\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n elsif first_array[0][iterator_2] === 15 && (first_array[0][iterator_2] - 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 5 === first_array[0][iterator_2 + 1])\r\n new_single_array << first_array[0][iterator_2].clone\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n elsif (first_array[0][iterator_2] === 1 || first_array[0][iterator_2] === 2) && (first_array[0][iterator_2] - 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 3 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 5 === first_array[0][iterator_2 + 1])\r\n new_single_array << first_array[0][iterator_2].clone\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n elsif (first_array[0][iterator_2] === 4 || first_array[0][iterator_2] === 8) && (first_array[0][iterator_2] - 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 3 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 5 === first_array[0][iterator_2 + 1])\r\n new_single_array << first_array[0][iterator_2].clone\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n elsif (first_array[0][iterator_2] === 7 || first_array[0][iterator_2] === 11) && (first_array[0][iterator_2] - 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 3 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 5 === first_array[0][iterator_2 + 1])\r\n new_single_array << first_array[0][iterator_2].clone\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n elsif (first_array[0][iterator_2] === 13 || first_array[0][iterator_2] === 14) && (first_array[0][iterator_2] - 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 3 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 5 === first_array[0][iterator_2 + 1])\r\n new_single_array << first_array[0][iterator_2].clone\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n elsif (first_array[0][iterator_2] === 5 || first_array[0][iterator_2] === 6 || first_array[0][iterator_2] === 9 || first_array[0][iterator_2] === 10) && (first_array[0][iterator_2] + 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 1 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 4 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 3 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 3 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] + 5 === first_array[0][iterator_2 + 1] || first_array[0][iterator_2] - 5 === first_array[0][iterator_2 + 1])\r\n new_single_array << first_array[0][iterator_2].clone\r\n if iterator_2 === word_length - 2\r\n new_single_array << first_array[0][-1]\r\n new_array << new_single_array.clone\r\n new_single_array = []\r\n first_array.shift\r\n end\r\n iterator_2 += 1\r\n else\r\n first_array.shift\r\n iterator_2 = word_length\r\n new_single_array = []\r\n end\r\n end\r\n end\r\n # if word found match with the input, return true\r\n if new_array.length >= 1\r\n puts \"\\n\"\r\n puts \"The word is valid\"\r\n puts \"\\n\"\r\n return true\r\n else\r\n puts \"\\n\"\r\n puts \"The word is invalid\"\r\n puts \"\\n\"\r\n return false\r\n end\r\nend", "title": "" }, { "docid": "1364b1c9898f78882b2472ed81327101", "score": "0.57923967", "text": "def solution(s)\n str = s.gsub(/\\D+/, '')\n len = str.size\n threes = len / 3\n threes -= 1 if len % 3 == 1\n \n counts = ([3] * threes) + ([2] * ((len - (3 * threes)) / 2))\n pos = 0\n return counts.map do |count|\n temp = str.slice(pos, count)\n pos += count\n temp\n end.join('-')\nend", "title": "" }, { "docid": "32a0ef79e59e9f9547a01b3fcc7312dd", "score": "0.57918394", "text": "def solution(a)\n acc = 0\n sum = 0\n\n a.each do |n|\n if n == 0\n acc += 1\n else\n sum += acc\n end\n\n return -1 if sum > 1000000000\n end\n\n sum\nend", "title": "" }, { "docid": "b588a9712ad0aea7636e46312d5b2e6c", "score": "0.579152", "text": "def solution(a)\n a.sort!\n (0...a.count - 2).each { |i| \n return 1 if a[i] + a[i + 1] > a[i + 2]\n }\n return 0\nend", "title": "" }, { "docid": "4648c334d2c9f8d5a8ebb6448f4f4ae6", "score": "0.578542", "text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n chm = { 'A' => 1, 'C' => 2, 'G' => 3, 'T' => 4 }\n acc = { 'A' => 0, 'C' => 0, 'G' => 0, 'T' => 0 }\n map = { 'A' => [], 'C' => [], 'G' => [], 'T' => [] }\n\n # make prefix_sum\n s.each_char.with_index do |ch, i|\n n = chm[ch]\n acc[ch] += n\n chm.keys.each { |c| map[c][i] = acc[c] }\n end\n\n # puts map.inspect\n\n # detect minimal charectre in range(p, q)\n p.zip(q).map do |i, j|\n next chm[s[i]] if i == j\n\n c = chm['T']\n chm.keys.each do |ch|\n lhs = (i-1 >= 0) ? map[ch][i-1] : 0\n if lhs < map[ch][j]\n c = chm[ch]\n break\n end\n end\n c\n end\nend", "title": "" }, { "docid": "e2bd40c8e8e96a24f7c5942dfe8a4e02", "score": "0.57826525", "text": "def solution(str)\n arr = str.split(\"\")\n new_arr = []\n if arr.length % 2 == 0\n z = arr.length / 2\n for x in (0...z) do\n new_arr << arr.shift(2).join\n end\n else\n z = arr.length / 2\n for x in (0...z) do\n new_arr << arr.shift(2).join\n end\n new_arr << \"#{arr[0]}_\"\n end\n new_arr\nend", "title": "" }, { "docid": "d642eb9fe304f9368c54cc6a03a8d67f", "score": "0.57804644", "text": "def garland(input) \n inputLength = input.length\n ((inputLength/2)+1).times do |x|\n #headString = input[0, (inputLength/2+1)-x]\n #tailString = input[inputLength/2+x, inputLength]\n if input[0, (inputLength/2+1)-x] == input[inputLength/2+x, inputLength]\n return inputLength/2+1-x\n end\n end\n 0 # return here when string has garland-degree of 0\nend", "title": "" }, { "docid": "f4c96d4100313827a8ea1055015b143b", "score": "0.5778339", "text": "def processLine\n $solution = 0\n i = 0\n while $numbers[i] == 0\n i += 1\n end\n if i == $numbers.length-1 || i == $numbers.length-2\n $solution = 0 #=>all are zero\n puts $solution\n else\n k = $numbers.length-1\n while $numbers[k] == 0\n k -= 1\n end\n if i == k || i == k-1\n $solution = 0\n puts $solution\n else\n $solution = 0\n while i < k\n while $numbers[i+1].to_i >= $numbers[i].to_i\n i += 1\n end\n break if i == k || i == k-1\n counter = 1\n j = i\n while $numbers[j+2] < $numbers[i]\n break if j+2 == k\n j += 1\n counter += 1\n end\n $solution = $solution + ([$numbers[i], $numbers[j+2]].min * counter) \n for m in (i+1)..(j+1)\n $solution = $solution - $numbers[m]\n end\n i = j+2\n end\n puts $solution\n end \n end\nend", "title": "" }, { "docid": "a6297b156d8e6a8eb671461d66a761f5", "score": "0.5776878", "text": "def algo4(a, e)\n b = 10\n kt = 4 # Of k <= 4, return to basecase. kt MUST be >= 3\n\n # See above\n def convert_trunc(y0, k, n)\n b = 10\n\n # Choose FP value alpha <= log_2(b)\n alpha = Math.log(b)/Math.log(2)\n\n y = []\n y[0] = y0\n\n # Write nn(i) for n - floor(i*a)\n def nn(i, n, alpha)\n n - (i*alpha).to_i\n end\n\n # Truncate p bits\n def bdiv(z, p)\n z/2**p\n end\n\n s = []\n t = []\n z = []\n (1..k).each do |i|\n t[i] = b*y[i-1]\n #puts \" t[#{i}] = #{t[i]}\"\n\n s[k-i] = t[i] / 2**nn(i-1, n, alpha)\n #puts \" s[#{k-i}] = #{s[k-i]}\"\n\n z[i] = t[i] % 2**nn(i-1, n, alpha)\n #puts \" z[#{i}] = #{z[i]}\"\n\n y[i] = bdiv(z[i], nn(i-1, n, alpha) - nn(i, n, alpha))\n #puts \" y[#{i}] = #{y[i]}\"\n end\n\n return s\n end\n\n def convert_rec(k, y, n, g)\n kt = 4 # Of k <= 4, return to basecase. kt MUST be >= 3\n b = 10\n\n if(k <= kt)\n s = convert_trunc(y, k, n)\n return s\n else\n kh = (k+1)/2\n kl = k - kh + 1\n # Choose nh such that 4*g*b**(kh) < 2**nh\n nh = 0\n while 4*g*b**kh >= 2**nh\n nh+=1\n end\n\n # Choose nl such that 4*g*b**kl < 2**nl\n nl = 1\n while 4*g*b**kl >= 2**nl\n nl+=1\n end\n\n # yh <- floor y*2^(nh-n)\n yh = y/2**(n-nh)\n yl = bdiv(b**(k-kl)*y % 2**n, n-nl)\n\n sh = convert_rec(kh, yh, nh, g)\n sl = convert_rec(kl, yl, nl, g)\n\n def carry(s)\n add(s, [1])\n end\n\n def shiftdown(s)\n s[1..-1]\n end\n\n def shiftup(s, p)\n [0]*p + s\n end\n\n def add(s1,s2)\n l = [s1.length, s2.length].max\n\n val = (s1.reverse.join(\"\").to_i + s2.reverse.join(\"\").to_i)\n str = \"%0#{l}d\" % val\n str.chars.reverse.map(&:to_i)\n end\n\n def a_to_s(a, k)\n (\"%0#{k}d\" % a).chars.map(&:to_i).reverse\n end\n\n\n\n # if the trailing digit of sh is b-1 and the leading digit of sl is 0\n if(sh[0] == b-1 && sl[-1] == 0)\n sh = carry(sh)\n end\n\n # FIXME: Does this ever happen?\n # if the trailing digit of sh is 0 and the leading digit of sl is b-1\n if(sh[0] == 0 && sl[-1] == b-1)\n sl = [0] * kl\n end\n\n # Breaks if bug\n #byebug if sh != a_to_s(ah, kh)\n #byebug if sl != a_to_s(al, kl)\n # fill upper\n # sh = sh[1..-1]\n #\n ret = add(shiftup(shiftdown(sh), kl), sl)\n #byebug if ret != a_to_s(a, k)\n\n #??? floor(sh/b)*b^(kl) + sl\n return ret\n end\n end\n\n n = -e\n k = (n*Math.log(2)/Math.log(10)).ceil - 2 # Anz garantiert korrekte Ziffern in Basis 10\n g = [(Math.log(k)/Math.log(2)).ceil + 1, kt].max\n y = a\n\n s = convert_rec(k, y, n, g)\n puts \"#{k} digits\"\n return s\nend", "title": "" }, { "docid": "17e6bd05bb37ca20b6b7512aeac0ac0a", "score": "0.5774922", "text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n \n mapping = {\n 'A' => 1, \n 'C' => 2,\n 'G' => 3,\n 'T' => 4\n }\n n = s.size\n dna = s.split('').map {|e| mapping[e]}\n occurrences = Hash.new {|h,k| h[k] = Array.new(n+1, 0)}\n \n mapping.values.each do |value|\n for i in 1..n\n occurrences[value][i] = occurrences[value][i - 1]\n occurrences[value][i] += 1 if dna[i-1] == value\n end\n end\n \n result = []\n p.zip(q).each do |from, to|\n mapping.values.each do |value|\n if occurrences[value][from] != occurrences[value][to + 1]\n result << value\n break\n end\n end\n end\n result\nend", "title": "" }, { "docid": "7c341432fa7294e71154b72e87bcc162", "score": "0.57717836", "text": "def problem_75\n p3 = lambda do |m,n|\n raise \"bad value\" if m == n\n m,n = n,m if m < n\n mm = m*m\n nn = n*n\n [mm - nn, 2*m*n, mm + nn]\n end\n\n max = 1_500_000\n upto = Math.sqrt(max/2).to_i\n# upto = max\n hits = Hash.new\n\n (1..upto).each do |x|\n hit = 0\n y = x + 1\n ((x+1)..(upto+1)).each do |y|\n next unless (x+y).odd?\n a,b,c = p3.call(x,y).sort\n d = a+b+c\n if d <= max\n k = 1\n begin\n hits[d*k] ||= {}\n hits[d*k][[a*k,b*k,c*k].sort.join(\"-\")] = true\n hit += 1\n k += 1\n end while d*k <= max\n else\n break\n end\n end\n puts \"for x = #{x}, #{hit} hits\"\n end\n puts hits.length\n h = hits.select {|k,v| v.length == 1}\n h.length\nend", "title": "" }, { "docid": "08fde3cd0f8d93fdc1cda3060c4f5885", "score": "0.5769082", "text": "def greedy_canoe_a(w, max_load)\n skinny, fat = [], []\n\n # Divide w into 2 arrays: skinny, fat\n w.size.times do |i|\n if w[i] + w[-1] <= max_load\n skinny << w[i]\n else\n fat << w[i]\n end\n end\n\n # fat << w[-1] <---mistake in Codility 14-GreedyAlgorithms PDF?\n canoes = 0\n\n while skinny.any? || fat.any?\n puts \"Skinny: #{skinny}, Fat: #{fat}\"\n # put heaviest skinny guy w/ heaviest fat guy\n s = skinny.any? ? skinny.pop : ''\n f = fat.pop\n puts \"Put #{s}, #{f} in 1 canoe\"\n canoes += 1\n\n # after enmptying \"fat\", move heaviest skinny guy back to \"fat\"\n if skinny.any? && fat.empty?\n fat << skinny.pop\n end\n\n # if lightest + heaviest fat guys can fit in canoe,\n # move lightest fat guy to \"skinny,\" so next loop pairs them\n while fat.size > 1 && fat[0] + fat[-1] <= max_load\n skinny << fat.shift\n end\n end\n puts \"Total canoes: #{canoes}\"\n canoes\nend", "title": "" }, { "docid": "082f71904c5f076c9ac9f24d2e615d6e", "score": "0.5767805", "text": "def find(digits)\n # Generated by gen14.rb\n # 371010124515891677925107\n prefixes = [\n [3, 1, 1, 4, 9], # 0\n [7, 5, 6, 0], # 1\n [1, 1, 1, 4, 9], # 2\n [0, 1, 1, 4, 9], # 3\n [1, 1, 4, 9], # 4\n [0, 1, 4, 9], # 5\n [1, 4, 9], # 6\n [2, 1, 8, 1], # 7\n [4, 9], # 8\n [5, 6, 0], # 9\n ].map(&:freeze).freeze\n suffix = [7]\n\n # first starts at 4\n first_on_suffix = false\n first_track = prefixes[0]\n first_pos = 1\n # second starts at 13\n second_on_suffix = false\n second_track = prefixes[0]\n second_pos = 4\n\n size = 24\n next_write = 31\n\n # state_transitions: good_digits -> new_digit -> Integer (new_good_digits)\n # It's expected that we'll then index into state_transitions with new_good_digits.\n #\n # Let's skip that extra indexing and precompute it, with:\n # next_state: good_digits -> new_digit -> Array (new_digit -> Array)\n #\n # As can be seen, this will be a self-referential structure.\n # When the result is nil, we have all the digits.\n next_state = Array.new(digits.size) { [] }\n next_state.zip(state_transitions(digits)) { |dst, src|\n src.each_with_index { |new_good_digits, i|\n dst[i] = next_state[new_good_digits]\n }\n }\n next_state.each(&:freeze).freeze\n state = next_state[0]\n\n score1 = first_track[first_pos]\n score2 = second_track[second_pos]\n\n # while true is faster than loop\n # https://github.com/JuanitoFatas/fast-ruby#loop-vs-while-true-code\n while true\n new_score = score1 + score2\n\n # Normally, you'd write new_scores = new_score >= 10 ? new_score.divmod(10) : [new_score]\n # and then iterate over new_scores.\n # Instead, here we manually unroll that loop.\n # Unfortunately, the fastest way was code duplication.\n\n if new_score >= 10\n new_score -= 10\n return size + 1 - digits.size unless (state = state[1])\n if size == next_write\n suffix << 1\n next_write += 2\n end\n size += 1\n end\n\n return size + 1 - digits.size unless (state = state[new_score])\n if size == next_write\n suffix << new_score\n next_write += 1 + new_score\n end\n size += 1\n\n unless (score1 = first_track[first_pos += 1])\n first_pos = 0\n if first_on_suffix\n first_track = prefixes[next_write - size]\n first_on_suffix = false\n else\n first_track = suffix\n first_on_suffix = true\n end\n score1 = first_track[0]\n end\n unless (score2 = second_track[second_pos += 1])\n second_pos = 0\n if second_on_suffix\n second_track = prefixes[next_write - size]\n second_on_suffix = false\n else\n second_track = suffix\n second_on_suffix = true\n end\n score2 = second_track[0]\n end\n end\nend", "title": "" }, { "docid": "d2a29f1143b43686a809cdad7dcb8be3", "score": "0.5764081", "text": "def lcs(x, y)\n first_sequence_array = x.split(\"\")\n second_sequence_array = y.split(\"\")\n common_sequence_array = []\n\n common_elements = first_sequence_array & second_sequence_array #check if the arrays have common elements\n if common_elements.empty? #if the array is empty, no common elements\n return \"\"\n else #there are common elements\n while second_sequence_array.length > 0 || first_sequence_array.length > 0\n\n if first_sequence_array[first_sequence_array.length-1] == second_sequence_array[second_sequence_array.length-1]\n common_sequence_array.push(first_sequence_array[first_sequence_array.length-1])\n first_sequence_array.slice!(-1)\n second_sequence_array.slice!(-1)\n\n elsif first_sequence_array.count(second_sequence_array[-1]) == 0 && second_sequence_array.count(first_sequence_array[-1]) == 0\n first_sequence_array.slice!(-1)\n second_sequence_array.slice!(-1)\n\n elsif second_sequence_array.count(first_sequence_array[-1]) == 0\n first_sequence_array.slice!(-1)\n\n elsif first_sequence_array.count(second_sequence_array[-1]) == 0\n second_sequence_array.slice!(-1)\n\n elsif first_sequence_array[-1] < second_sequence_array[-1]\n first_sequence_array.slice!(-1)\n else\n second_sequence_array.slice!(-1)\n\n end\n end\n return common_sequence_array.reverse.join()\n end\nend", "title": "" }, { "docid": "74564264f1686bcc41e20e21a5010b08", "score": "0.5763814", "text": "def solution(a)\n s = 0\n e = 1\n a.each { |v| \n s += v * e\n e *= -2\n }\n\n s = -s\n\n x = 0xAAAAAAAA\n r = (s + x) ^ x\n r = (\"%b\" % r).reverse.split(//).map { |b| b.to_i }\n r == [0] ? [] : r\nend", "title": "" }, { "docid": "b8ddeb9ad1e7543e50f26119b0b5db78", "score": "0.57607585", "text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n hash = { 'A'=> 1, 'C'=> 2, 'G'=> 3, 'T'=> 4 }\n array = []\n p.each_with_index do |e, i|\n low = 4\n cut = s[p[i]..q[i]]\n cut.each_char { |c| low = hash[c] if hash[c] < low }\n array.push(low)\n end\n array\nend", "title": "" }, { "docid": "c47af476a1c9c548b894a4c7c45b09cc", "score": "0.5759297", "text": "def solution(a)\n # write your code in Ruby 2.2\n return a[0] if a.length == 1\n\n for i in 0..a.length\n unpaired = a[i + 2] if a[i+2] && a[i] != a[i+2] && a[i+2] % 2 == 0\n end\n\n return unpaired\nend", "title": "" }, { "docid": "fbbbcb3b0e2fef3847603a76fc2312d6", "score": "0.57565415", "text": "def day_1_part_2(sequence)\n sequence_digits = sequence.chars.map(&:to_i)\n sequence_digits_reference = sequence_digits * 2\n\n sum = 0\n\n sequence_digits.each.with_index do |digit, i|\n sum += digit if digit == sequence_digits_reference[i + sequence.length / 2]\n end\n\n sum\nend", "title": "" }, { "docid": "4f9d772d412ede6e97aa9177f6104706", "score": "0.5754512", "text": "def marsExploration(s)\n arr = []\n while s.length > 0\n arr << s[0..2]\n s = s[3..s.length]\n end\n \n res = 0\n arr.each do |a|\n res += 1 unless a[0] == 'S'\n res += 1 unless a[1] == 'O'\n res += 1 unless a[2] == 'S'\n end\n res\nend", "title": "" }, { "docid": "3001dd8908758968f816ea16834a6262", "score": "0.5754435", "text": "def solution(a, b)\n\n s = []\n\n (0..(a.length-1)).each do |i|\n fish_size = a[i]\n fish_direction = b[i]\n\n if(s.length == 0)\n s.unshift(i)\n next\n end\n\n\n while(s.length > 0 && fish_direction - b[s[0]] == -1 && a[s[0]] < fish_size)\n s.shift()\n end\n\n if((s.length == 0)||(s.length > 0 && fish_direction - b[s[0]] != -1))\n s.unshift(i)\n end\n end\n\n s.length\nend", "title": "" } ]
5620c83ec0f2e751be4557936085ea09
Class accessor for the license builder
[ { "docid": "bf3b4ede90fc7dd892ce2d05b312adc0", "score": "0.78364754", "text": "def license_builder\n ManifestBuilder::LicenseBuilder\n end", "title": "" } ]
[ { "docid": "1d03ccf08ce27bae5ec5b4e3d3680809", "score": "0.7683413", "text": "def license\n return @license\n end", "title": "" }, { "docid": "7ec3449682ef5d3a1c27c0213773ba5f", "score": "0.74736965", "text": "def license\n read_property 'License'\n end", "title": "" }, { "docid": "c80e0b55f078d0d5d8bebf9f3699392a", "score": "0.74086946", "text": "def license_info\n self.dig_for_array(\"licenseInfo\")\n end", "title": "" }, { "docid": "7776dad7eb4af1b9efb226551bb794fa", "score": "0.73679966", "text": "def new\n @license = License.new\n end", "title": "" }, { "docid": "04f172b9749a67b430a4d24094554b95", "score": "0.7332891", "text": "def license\n return self.licenses.first\n end", "title": "" }, { "docid": "0252a6f89b04a2d251b6cc7e5e1de8e4", "score": "0.73008776", "text": "def license=(value)\n @license = value\n end", "title": "" }, { "docid": "4b140cd3a1d7d879cafaf796ffa5b063", "score": "0.7216745", "text": "def license\n licenses.first\n end", "title": "" }, { "docid": "e76bd6b31bd64778933422ec7318b62d", "score": "0.7197069", "text": "def license name\n self.licenses << name.to_s\n end", "title": "" }, { "docid": "106085d8e852632a542d4026201df89d", "score": "0.7185932", "text": "def license_type\n return @license_type\n end", "title": "" }, { "docid": "fd3f9fd8cadfc9ea269c8da97567facb", "score": "0.71674067", "text": "def license\n @header.license\n end", "title": "" }, { "docid": "75da6baf73d49d5295525d0b31bf1e0e", "score": "0.7164622", "text": "def license\n @licenses.first\n end", "title": "" }, { "docid": "dd64a47b675fdd484041857742815c90", "score": "0.71555585", "text": "def license(name=nil)\n if name\n self.license = name\n else\n if copryrights.first\n copyrights.first.license\n end\n end\n end", "title": "" }, { "docid": "87281198feb0198b15e855d815007133", "score": "0.71544355", "text": "def license_model\n data[:license_model]\n end", "title": "" }, { "docid": "9ebc2b09c5665c2d4dea609bbe1b2a24", "score": "0.7082155", "text": "def license\n conf['license'] || proj.license\n end", "title": "" }, { "docid": "e9c083d76c2de00ae5a2b6cdfe6dd5b4", "score": "0.7080429", "text": "def get_license_type\n return Rails.application.config.x.license_types.key(self.copyright_license)\n end", "title": "" }, { "docid": "2f6f14c20f7213358c138c3b8b2009b2", "score": "0.7066544", "text": "def getsfLma__LicenseObjName\r\n\t\t\treturn \"sfLma__License__c\"\r\n\t\tend", "title": "" }, { "docid": "a33893be84e3534246898675a17d1e91", "score": "0.69756436", "text": "def license=(o)\n self.licenses = [o]\n end", "title": "" }, { "docid": "f7c75acff08ae886e6abef5f6c1571eb", "score": "0.6941547", "text": "def license_model\n @dbi.license_model\n end", "title": "" }, { "docid": "f7c75acff08ae886e6abef5f6c1571eb", "score": "0.6941547", "text": "def license_model\n @dbi.license_model\n end", "title": "" }, { "docid": "8cf931373b78c1535945d0504ba498d9", "score": "0.6921569", "text": "def license(arg = nil)\n set_or_return(:license, arg, kind_of: [String])\n end", "title": "" }, { "docid": "26d3285c14ae6360d11fc2c59a2eed96", "score": "0.6846489", "text": "def license(path)\n Licensee.project(path).license\n end", "title": "" }, { "docid": "3697ddd64c2c8e843d069204fbddc4e4", "score": "0.6839422", "text": "def license(arg = nil)\n set_or_return(\n :license,\n arg,\n kind_of: [ String ]\n )\n end", "title": "" }, { "docid": "9bb33a5c774d1cb84b5036bd721a06b1", "score": "0.6828089", "text": "def licenses\n @licenses ||= []\n end", "title": "" }, { "docid": "b293f0070f9ca82762ef14ace9aff4cc", "score": "0.6786857", "text": "def license_key\n config.license_key ||= create_license_key\n end", "title": "" }, { "docid": "7bc4b189cf91a3c0d838f21b1016ee51", "score": "0.67098457", "text": "def licenses\n data[:licenses]\n end", "title": "" }, { "docid": "8e1c18e5c4050c8eb703c28b2c1ef172", "score": "0.6702386", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" }, { "docid": "8e1c18e5c4050c8eb703c28b2c1ef172", "score": "0.6702386", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" }, { "docid": "8e1c18e5c4050c8eb703c28b2c1ef172", "score": "0.6702386", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" }, { "docid": "fc4c1ee13231c0adaf31e4468217aaa7", "score": "0.66981333", "text": "def license\n if ladnn?\n [\"https://creativecommons.org/licenses/by/4.0/\"]\n else\n # If it's populated, DLCS uses MARC IDs, not labels, so we don't need to map like w/ resource_type\n map_field(:license)\n end\n end", "title": "" }, { "docid": "63a809d62a9e43da8e9b4525bcb34b2a", "score": "0.66748697", "text": "def set_license\n @license = License.find(params[:id])\n end", "title": "" }, { "docid": "3f31e73ab81bf117a78ae57d0a585ac9", "score": "0.66612303", "text": "def license_object(infos)\n {\n name: infos.delete(:license),\n url: infos.delete(:license_url)\n }.delete_if { |_, value| value.blank? }\n end", "title": "" }, { "docid": "c5ff16d74184f34155ffb3373c47ed74", "score": "0.6612312", "text": "def customized_licenses\n @research_output.plan.template.licenses.map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\n end", "title": "" }, { "docid": "c1ee12b64de0d3f431c42083fe8bec77", "score": "0.65856004", "text": "def set_license\n @license = License.find(params[:license_id])\n end", "title": "" }, { "docid": "2ed3bf83c7bbfd850c559693ca177fbb", "score": "0.65824074", "text": "def licenses *names\n names.to_strings.each do |name| \n begin\n module_name = \"#{name.camelize}License\"\n clazz = module_name.constantize\n clazz.new(self).enforce!\n rescue\n raise \"License #{module_name} not found\"\n end\n end\n end", "title": "" }, { "docid": "037f97806d2442a531b460cbc58898f7", "score": "0.6548192", "text": "def show_license(license)\n # Checks if lang is nil and we want to show the license\n if license && SHOW_LICENSE\n %Q(\n <section class=\"gh-card-license\">\n <p class=\"text-grey\">#{license}</p>\n <svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 14 16\" width=\"14\"><path fill-rule=\"evenodd\" d=\"M7 4c-.83 0-1.5-.67-1.5-1.5S6.17 1 7 1s1.5.67 1.5 1.5S7.83 4 7 4zm7 6c0 1.11-.89 2-2 2h-1c-1.11 0-2-.89-2-2l2-4h-1c-.55 0-1-.45-1-1H8v8c.42 0 1 .45 1 1h1c.42 0 1 .45 1 1H3c0-.55.58-1 1-1h1c0-.55.58-1 1-1h.03L6 5H5c0 .55-.45 1-1 1H3l2 4c0 1.11-.89 2-2 2H2c-1.11 0-2-.89-2-2l2-4H1V5h3c0-.55.45-1 1-1h4c.55 0 1 .45 1 1h3v1h-1l2 4zM2.5 7L1 10h3L2.5 7zM13 10l-1.5-3-1.5 3h3z\"></path></svg>\n </section>)\n end\n end", "title": "" }, { "docid": "8f6d28aad47d8ba1f514cec4ea8d7f6f", "score": "0.6541485", "text": "def license(value)\n _license(value) or fail ArgumentError, \"Unknown value for license: #{value}\"\n end", "title": "" }, { "docid": "068ef9d520b59ce2dd6320e609397b27", "score": "0.6536643", "text": "def new\n @license = License.new\n respond_with(@license)\n end", "title": "" }, { "docid": "df967b6e531e090b64845e8e38f4904e", "score": "0.6522127", "text": "def license\n File.read file_path('LICENSE') if license?\n end", "title": "" }, { "docid": "af2be855415d9e368068235f468381e1", "score": "0.6515608", "text": "def license_url\n case self.license\n when \"cc-by-sa-3.0\"\n \"http://creativecommons.org/licenses/by-sa/3.0/\"\n when \"cc-by-nc-sa-2.0-uk\"\n \"http://creativecommons.org/licenses/by-nc-sa/2.0/uk\"\n end\n end", "title": "" }, { "docid": "8917a47f63a4aa0ffd7b387d6e71bc39", "score": "0.648003", "text": "def license_type=(value)\n @license_type = value\n end", "title": "" }, { "docid": "0f0320efc80be25374a03d3370631f8a", "score": "0.6464108", "text": "def license_url\n get_url(:license)\n end", "title": "" }, { "docid": "ca6d67e047f6a761446a3c0e1f31ed37", "score": "0.6443098", "text": "def render_license\n return '' unless @document\n return '' unless @document[:license_tesim]\n license = @document[:license_tesim].first\n if license.match?(/creativecommons.org/)\n data = license_markup\n data.html_safe\n else\n license\n end\n end", "title": "" }, { "docid": "f432286c4608bd12f9f237302f26538c", "score": "0.6422241", "text": "def license\n @flickr.photos.licenses[self.license_id]\n end", "title": "" }, { "docid": "d18cbdf47450e2dbe8c51c9466376caf", "score": "0.64037645", "text": "def licenses\r\n LicensesController.instance\r\n end", "title": "" }, { "docid": "e7a5d207d2db7f1bf7ecbaa4e7c492b8", "score": "0.6401412", "text": "def licenses *names\n names.to_strings.each do |name| \n begin\n module_name = \"#{name.camelize}License\"\n clazz = module_name.constantize\n rescue\n raise \"License #{module_name} is not defined\"\n end\n\n begin\n clazz.new(self).enforce!\n rescue\n raise \"License #{clazz} could not be enforced using #{self.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "2c032066d01562501f05456e6b32d189", "score": "0.6393542", "text": "def license_title\n case self.license\n when \"cc-by-sa-3.0\"\n \"Creative Commons Attribution ShareAlike 3.0\"\n when \"cc-by-nc-sa-2.0-uk\"\n \"Creative Commons Attribution-NonCommerical-ShareAlike 2.0 UK: England & Wales\"\n end\n end", "title": "" }, { "docid": "9527efd9d23e9f9a2a46ed29247f1683", "score": "0.6389574", "text": "def license\n last_commit = @ref.target\n license = @repo.blob_at(last_commit.oid, 'LICENSE') || @repo.blob_at(last_commit.oid, 'LICENSE.txt')\n\n if license.nil?\n 'N/A'\n else\n license_text = license.text\n\n case license_text\n when /Apache License/\n 'Apache'\n when /GNU GENERAL PUBLIC LICENSE/\n 'GPL'\n when /GNU LESSER GENERAL PUBLIC LICENSE/\n 'LGPL'\n when /Permission is hereby granted, free of charge,/\n 'MIT'\n when /Redistribution and use in source and binary forms/\n 'BSD'\n else\n 'N/A'\n end\n end\n end", "title": "" }, { "docid": "01829d966d06cfb006b1960b34873f45", "score": "0.63883436", "text": "def northern_irish_driving_licence; end", "title": "" }, { "docid": "69f0ffd88fa8fcfbbf022edecac26a65", "score": "0.6370831", "text": "def create\n megam_rest.post_license(to_hash)\n end", "title": "" }, { "docid": "4ed565d8a2f32c1e5003539f06d0c296", "score": "0.6364807", "text": "def license_plate\r\n\t\t\t@license ||= json['licensePlate'].gsub(' ', '')\r\n\t\tend", "title": "" }, { "docid": "90b1e73734570f4098f1a13e9fde8147", "score": "0.6325669", "text": "def set_driver_license\n @driver_license = DriverLicense.find(params[:id])\n end", "title": "" }, { "docid": "c8ac502736ea17774014922305bf323b", "score": "0.63135904", "text": "def render_license\n return 'No license recorded' unless @document\n return 'No license recorded' unless @document[:license_tesim]\n license = @document[:license_tesim].first\n if license.match?(/creativecommons.org/)\n data = license_markup\n data.html_safe # rubocop:disable Rails/OutputSafety\n else\n license\n end\n end", "title": "" }, { "docid": "dfe9f29dfcfd2c7472f6fa02a7db6056", "score": "0.6285857", "text": "def create\n @license = current_user.licenses.new(license_params)\n set_license_key\n \n respond_to do |format|\n if @license.save\n format.html { redirect_to @license, notice: 'License was successfully created.' }\n format.json { render :show, status: :created, location: @license }\n else\n format.html { render :new }\n format.json { render json: @license.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e00e7a3af0bf35e542568c6ecc44d8a", "score": "0.6263578", "text": "def add_licenses\n return @add_licenses\n end", "title": "" }, { "docid": "204138c2301cab9316e022a6f48ce966", "score": "0.6217793", "text": "def set_distributor_license\n @distributor_license = DistributorLicense.find(params[:id])\n end", "title": "" }, { "docid": "422ab6d6ffa581228c083344851becee", "score": "0.6205849", "text": "def set_createlicense\n @createlicense = Createlicense.find(params[:id])\n end", "title": "" }, { "docid": "3a06cd79f793fab9d98c8c8eec9e2d75", "score": "0.6175923", "text": "def license\n FFI::GDAL.GDALVersionInfo('LICENSE')\n end", "title": "" }, { "docid": "1ff34605d8c10f754f49880f6fbc73fe", "score": "0.6153933", "text": "def set_license\n License.where(name: params[:name]).exists? ? @license = License.find_by(name: params[:name]) : @license = License.find(params[:name])\n end", "title": "" }, { "docid": "4692b9b01c34eef5f6e414897d3a684a", "score": "0.6113874", "text": "def set_license_plate\n @license_plate = LicensePlate.find(params[:id])\n end", "title": "" }, { "docid": "8a053172b68160c9ff6fe1e2a5f00e1d", "score": "0.61018205", "text": "def get_license_info(token)\n licenses = Hash.new\n licenses[\"cc-by\"] = { :name => 'Attribution', :url => 'https://creativecommons.org/licenses/by/4.0' }\n licenses[\"cc-by-nd\"] = { :name => 'Attribution-NoDerivs', :url => 'https://creativecommons.org/licenses/by-nd/4.0' }\n licenses[\"cc-by-sa\"] = { :name => 'Attribution-ShareAlike', :url => 'https://creativecommons.org/licenses/by-sa/4.0' }\n licenses[\"cc-by-nc\"] = { :name => 'Attribution-NonCommercial', :url => 'https://creativecommons.org/licenses/by-nc/4.0' }\n licenses[\"cc-by-nc-sa\"] = { :name => 'Attribution-NonCommercial-ShareAlike', :url => 'https://creativecommons.org/licenses/by-nc-sa/4.0' }\n licenses[\"cc-by-nc-nd\"] = { :name => 'Attribution-NonCommercial-NoDerivs', :url => 'https://creativecommons.org/licenses/by-nc-nd/4.0' }\n license_info = licenses[token]\nend", "title": "" }, { "docid": "3420cbcb4437bf9602cf2dceaea81bf9", "score": "0.608854", "text": "def project_license_content\n project.license_file.nil? ? \"\" : IO.read(File.join(Config.project_root,project.license_file))\n end", "title": "" }, { "docid": "b8ec2526653b11f81d71c3664c230034", "score": "0.6084525", "text": "def licenses=(licenses)\n @licenses = Array licenses\n end", "title": "" }, { "docid": "7470a94d921d2c8c9bd6064779c63c5b", "score": "0.6075053", "text": "def licensed?\n end", "title": "" }, { "docid": "333fc989956497f7d2eb9be8288450f4", "score": "0.60704535", "text": "def has_license?\n !license.nil?\n end", "title": "" }, { "docid": "b63e420bc22de6f6a306b2602c9411b4", "score": "0.605832", "text": "def add_licenses=(value)\n @add_licenses = value\n end", "title": "" }, { "docid": "4f04829e798da635c00cf0f61b391acc", "score": "0.60429525", "text": "def license_params\n params.require(:license).permit(:software_id, :expiration_date, :is_active, :email)\n end", "title": "" }, { "docid": "c9aee740cea5ca3bae3fa08748d55605", "score": "0.6041662", "text": "def licenses(top, output_file = nil, prv_release = nil, cur_release = nil)\n api_licenses = CLicenseModuleInfo.new(top, \"MESA\")\n\n license_options = Hash.new()\n license_options[:release_version_prv] = prv_release\n license_options[:release_version_cur] = cur_release\n\n license_options[:hdr_pre] = \"This file provides a summary of the licenses included in or used by the MESA\\n\"\n license_options[:hdr_pre] += \"sources, along with the raw licenses for each package.\\n\"\n license_options[:hdr_pre] += \"\\n\"\n license_options[:hdr_pre] += \"Notice: The MESA package includes pre-built binary firmware images. These\\n\"\n license_options[:hdr_pre] += \" images consist of the binary MESA artifacts appended to a BSP.\\n\"\n license_options[:hdr_pre] += \" The combined set of licenses for these images can be found in\\n\"\n license_options[:hdr_pre] += \" ./bin/<preset>/licenses.txt\\n\"\n license_options[:hdr_pre] += \"\\n\"\n\n license_options[:hdr_post] = \"\\n\"\n license_options[:hdr_post] += \"To obtain the source, please contact sales/marketing\\n\\n\"\n license_options[:hdr_post] += \"\\n\"\n\n licenses = CLicenseCollection.new(\"MESA\", license_options)\n licenses.concat(api_licenses)\n if output_file\n File.open(output_file, \"w\") do |lic|\n licenses.write(lic)\n end\n else\n licenses.write()\n end\nend", "title": "" }, { "docid": "f03438f5b126ef7b8b7bf46a7817265b", "score": "0.6023827", "text": "def licenses=(new_licenses)\n @licenses = new_licenses\n end", "title": "" }, { "docid": "56fdde3e01b390113641013b0cd262b7", "score": "0.5999067", "text": "def set_diriving_license\n @diriving_license = DirivingLicense.friendly.find(params[:id])\n end", "title": "" }, { "docid": "baa87c464d979d4b39721c562fe9a286", "score": "0.59753704", "text": "def project_license_content\n project.license_file.nil? ? \"\" : IO.read(File.join(Config.project_root, project.license_file))\n end", "title": "" }, { "docid": "2eff0856ddededf593d4261223e39baa", "score": "0.5959624", "text": "def license_as_uri\n # no mapping for `license_text` as this gets checked and ingested as a `rights` field in Fedora Item\n return nil if license == 'license_text'\n\n code = LICENSE_TO_URI_CODE.fetch(license.to_sym)\n CONTROLLED_VOCABULARIES[:license].send(code)\n end", "title": "" }, { "docid": "506738c3cebdd6ae4e2f611ca30daecc", "score": "0.5949105", "text": "def retrieve_license(url)\n (@licenses ||= {})[url] ||= Net::HTTP.get(URI(url))\n end", "title": "" }, { "docid": "633d989c639a8ac1c2f1dbe2dab94c5b", "score": "0.59118843", "text": "def licenses\n licenses = []\n uris = metadata[dataset_uri][dct.license.to_s]\n if uris.nil?\n []\n else\n uris.each do |uri|\n l = metadata[uri]\n licenses << License.new(:uri => uri, :name => l[dct.title.to_s])\n end\n return licenses\n end\n rescue\n []\n end", "title": "" }, { "docid": "ae2c01f8498635a9c7a7084986eef4a4", "score": "0.5902424", "text": "def display_license\n return _('None specified') if @research_output.license.blank?\n\n @research_output.license.name\n end", "title": "" }, { "docid": "a332ef59646627fb3c1babe975335765", "score": "0.5886918", "text": "def license_params\n params.permit(:name, :addres, :license_count, :license_restrict, :term_of_license, :description, :key)\n end", "title": "" }, { "docid": "25e19d1f23e0103fc02e47796428cf17", "score": "0.5864984", "text": "def set_license_result\n @license_result = LicenseResult.find(params[:id])\n end", "title": "" }, { "docid": "fb180a743dd208c66b14a1bf7386901b", "score": "0.5858805", "text": "def license(*args)\n arguments(args, required: [:user, :repo])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/license\", arguments.params)\n end", "title": "" }, { "docid": "3867f5508cb2fb196b2df4358f9891db", "score": "0.5857685", "text": "def licenses(options = {})\n Licensee::License.all(options)\n end", "title": "" }, { "docid": "4d7ae3b748a5ef0dd46bc305dce33af2", "score": "0.58079106", "text": "def show\n authorize @sims_biga_license\n end", "title": "" }, { "docid": "6162d25c0d412146584c0ae15f8ad8a9", "score": "0.5800327", "text": "def licenses\n if @licenses.nil?\n @licenses = self.links.select do |link|\n link.rel == \"license\"\n end\n end\n return @licenses\n end", "title": "" }, { "docid": "8ad3241c5d1eceb744c03f69d0de74c7", "score": "0.5796475", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"license\", @license)\n writer.write_enum_value(\"licenseType\", @license_type)\n writer.write_string_value(\"productKey\", @product_key)\n writer.write_enum_value(\"targetEdition\", @target_edition)\n end", "title": "" }, { "docid": "330386279cdbdaeea06ffb20e271ee95", "score": "0.5791027", "text": "def check_license()\n return true\n end", "title": "" }, { "docid": "72c6fa6bdc8cd91218f88003a7c741e9", "score": "0.5782754", "text": "def edit_license\n publisher_id = current_user.id\n @license = PowerChip.where(:id=>params[:id], :publisher_id=>publisher_id).first\n @license.start_date = @license.start_date*1000\n @license.end_date = @license.end_date*1000\n end", "title": "" }, { "docid": "57c1c3c1e8877bc46be606b63a3187ba", "score": "0.57688385", "text": "def uk_driving_licence(*args); end", "title": "" }, { "docid": "45e362552149942ab6471257579940f7", "score": "0.57655364", "text": "def primary_terms\n [:title, :creator, :description, :license]\n end", "title": "" }, { "docid": "fd291f99ae9b36b7d61fb4e0df40f33a", "score": "0.5763227", "text": "def create\n @license = License.new(params[:license])\n @license.save\n respond_with(@license)\n end", "title": "" }, { "docid": "5117867a9cf4bdc2b6956341287e0a60", "score": "0.5758548", "text": "def new\n @license = License.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @license }\n end\n end", "title": "" }, { "docid": "329cc461ee2e5f2f82dad448df2afb90", "score": "0.5752469", "text": "def licenseable\n object.user.id == current_user.id\n end", "title": "" }, { "docid": "285497f45581eeb378419e550449b1fe", "score": "0.5752291", "text": "def set_license_to\n @license_to = LicenseTo.find(params[:id])\n end", "title": "" }, { "docid": "0dab42f13474527ace01c320a94a185e", "score": "0.5732798", "text": "def setMediaLicense(media, license)\n # Set the asset license window\n media['license']['start'] = license[:start]\n media['license']['end'] = license[:end]\n end", "title": "" }, { "docid": "fcc928d779f21abf0ae50a1ddbf9c3b8", "score": "0.5729994", "text": "def license_params\n params.require(:license).permit(:description, :source, :organization_id)\n end", "title": "" }, { "docid": "bedba8154f185fa922911bcf6af8e417", "score": "0.5729886", "text": "def license_params\n params.require(:license).permit(:user_id, :product_id, :price, :expiration_date, :address, :accept)\n end", "title": "" }, { "docid": "5c654deac1d112f4acbb6897714d1161", "score": "0.5728373", "text": "def new\n @license = License.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @license }\n end\n end", "title": "" }, { "docid": "67fb85dabc179afab0952670e0858162", "score": "0.57064956", "text": "def create\n\t\t@license = License.new(license_params)\n\n\t\tif @license.save\n\t\t\trender \"show\", :status => :created\n\t\telse\n\t\t\tinvalid_response(@license)\n\t\tend\t\t\n\tend", "title": "" }, { "docid": "38ceb8b9f0447806e2658f8ea1252490", "score": "0.56845176", "text": "def submodule_licenses\n @@submodule_licenses ||= begin\n submodules = {}\n submodule_paths.each { |submodule| submodules[submodule] = submodule_license(submodule) }\n submodules\n end\n end", "title": "" }, { "docid": "517c693964a130ecf376a36d319d57c3", "score": "0.5674951", "text": "def get_license_info(account_license, device_license)\r\n account_license.map do |acc|\r\n {\r\n license_id: acc[:license_id],\r\n app_name: acc[:app_name],\r\n sku: acc[:sku],\r\n type: acc[:type],\r\n grant_date: acc[:grant_date],\r\n device_info: device_license.select { |license| license[:package_name] == acc[:app_name] }\r\n }\r\n end\r\n end", "title": "" }, { "docid": "9ce86f5cc72eb272fe9b4910c31eef6c", "score": "0.5665775", "text": "def get_license_info(account_license, device_license)\n account_license.map do |acc|\n {\n license_id: acc[:license_id],\n app_name: acc[:app_name],\n sku: acc[:sku],\n type: acc[:type],\n grant_date: acc[:grant_date],\n device_info: device_license.select { |license| license[:package_name] == acc[:app_name] }\n }\n end\n end", "title": "" }, { "docid": "48a244df85d7f99f4782a54989563021", "score": "0.5662582", "text": "def with_licenses(licenses)\n @licenses.concat licenses\n self\n end", "title": "" }, { "docid": "81b12468724942920ba8f4b55b8c99dd", "score": "0.56611985", "text": "def license_items\n license_id = unsafe_params[\"license_id\"]\n unless license_id.is_a?(Numeric) && (license_id.to_i == license_id) ||\n license_id.is_a?(String) && license_id.to_i.positive?\n raise \"License license_id needs to be an Integer\"\n end\n\n # Check if the license exists and is editable by the user. Throw 404 if otherwise.\n License.editable_by(@context).find(license_id)\n\n items_to_license = unsafe_params[\"items_to_license\"]\n if items_to_license.is_a?(String)\n items_to_license = [items_to_license]\n elsif items_to_license.is_a?(Array) && items_to_license.any? { |item| item.is_a?(String) }\n raise \"License items_o_license needs to be an Array of Strings\"\n end\n\n items_licensed = []\n LicensedItem.transaction do\n items_to_license.each do |item_uid|\n item = item_from_uid(item_uid)\n if item.editable_by?(@context) && %w(asset file).include?(item.klass)\n items_licensed << LicensedItem.find_or_create_by(license_id: license_id,\n licenseable: item).id\n end\n end\n end\n\n render json: { license_id: license_id, items_licensed: items_licensed }\n end", "title": "" }, { "docid": "4fb81b9951f5ad934040860d7494410c", "score": "0.566036", "text": "def create\n @license = License.new(license_params)\n\n if @license.save\n render :show, status: :created, location: @license\n else\n render json: @license.errors, status: :unprocessable_entity\n end\n end", "title": "" } ]
62dbb76f0665b3682adc340d1aa8febf
Get a particular service attachment. Returns detailed Attachment information for a given service attachment.
[ { "docid": "4e9fb0b8e1ce9f2f4df556b4ef650e96", "score": "0.73098195", "text": "def get_service_attachment_with_http_info(service_attachment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServicesApi.get_service_attachment ...\"\n end\n # verify the required parameter 'service_attachment_id' is set\n if @api_client.config.client_side_validation && service_attachment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_attachment_id' when calling ServicesApi.get_service_attachment\"\n end\n # resource path\n local_var_path = \"/serviceinsertion/service-attachments/{service-attachment-id}\".sub('{' + 'service-attachment-id' + '}', service_attachment_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'ServiceAttachment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicesApi#get_service_attachment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "eec928f02abeeaa0fb9c7382885391ee", "score": "0.7943766", "text": "def get_service_attachment(service_attachment_id, opts = {})\n data, _status_code, _headers = get_service_attachment_with_http_info(service_attachment_id, opts)\n data\n end", "title": "" }, { "docid": "50f44659ad19c034da79cd03f6e84d07", "score": "0.7861136", "text": "def get_service_attachment(service_attachment_id, opts = {})\n data, _status_code, _headers = get_service_attachment_with_http_info(service_attachment_id, opts)\n return data\n end", "title": "" }, { "docid": "a5de957a83299d5e82e15106f25720dd", "score": "0.71005315", "text": "def get_service_attachment_with_http_info(service_attachment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesServiceInsertionApi.get_service_attachment ...'\n end\n # verify the required parameter 'service_attachment_id' is set\n if @api_client.config.client_side_validation && service_attachment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_attachment_id' when calling ManagementPlaneApiServicesServiceInsertionApi.get_service_attachment\"\n end\n # resource path\n local_var_path = '/serviceinsertion/service-attachments/{service-attachment-id}'.sub('{' + 'service-attachment-id' + '}', service_attachment_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'ServiceAttachment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesServiceInsertionApi#get_service_attachment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "653b863e2dd1127283d33bb2e52cdc55", "score": "0.7042513", "text": "def get_attachment(attachment_id)\n params = {'key' => @api_key}\n RestClient.get(\"#{@base_url}/attachments/#{attachment_id}\", {:params => params}).body\n end", "title": "" }, { "docid": "e81a8857790d2c0739082a3020019e7a", "score": "0.69530976", "text": "def attachment(attachment, options = {})\n get \"attachments/#{attachment}\", options\n end", "title": "" }, { "docid": "103daf945cfeb772ab04ebc797c6714b", "score": "0.6945651", "text": "def get_attachment(opts)\n opts = opts.clone\n [:attachment_ids].each do |k|\n validate_param(opts, k, true)\n end\n req = build_soap! do |type, builder|\n if(type == :header)\n else\n builder.nbuild.GetAttachment {|x|\n builder.nbuild.parent.default_namespace = @default_ns\n builder.attachment_ids!(opts[:attachment_ids])\n }\n end\n end\n do_soap_request(req)\n end", "title": "" }, { "docid": "936f16aa728649c13dfa89e4e959a2e5", "score": "0.6919993", "text": "def attachment(id, options = {})\n get attachment_endpoint(\"/attachment/#{id}\", options)\n end", "title": "" }, { "docid": "5289c24ab2080e760c07cbe57b56876b", "score": "0.67943645", "text": "def attachment(product_id, attachment_id)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/attachments/#{attachment_id}\")\n\n handle_response(response, status)\n end", "title": "" }, { "docid": "4795ee2014edc2cb3e2d354448f24536", "score": "0.6759621", "text": "def get_attachment(message_id, attachment_id)\n path = \"message/#{message_id}/attachment/#{attachment_id}\"\n\n response = perform(:get, path, nil, token_headers)\n filename = response.response_headers['content-disposition'].gsub(CONTENT_DISPOSITION, '').gsub(/%22|\"/, '')\n { body: response.body, filename: }\n end", "title": "" }, { "docid": "e8ff5f97b5dd6d7ebc2c501b889bc9cd", "score": "0.66822714", "text": "def get_attachment(attachment_ids)\n action = \"#{SOAP_ACTION_PREFIX}/GetAttachment\"\n resp = invoke(\"#{NS_EWS_MESSAGES}:GetAttachment\", action) do |root|\n build!(root) do\n attachment_shape!(root)\n attachment_ids!(root, attachment_ids)\n end\n end\n parse!(resp)\n end", "title": "" }, { "docid": "f0b561544188967264298a6498225a7a", "score": "0.66577524", "text": "def attachment(attachment)\n get(\"inbox/attachments/#{attachment}\").pop\n end", "title": "" }, { "docid": "bf1e08332fdf505cac11e221620653e2", "score": "0.6569952", "text": "def get_attachment(attachment_id, opts = {})\n data, _status_code, _headers = get_attachment_with_http_info(attachment_id, opts)\n data\n end", "title": "" }, { "docid": "3d0241ef8eab7313c360fbd5a19666c4", "score": "0.6556602", "text": "def attachment\n @attachment\n end", "title": "" }, { "docid": "d065a0208dd70021b56c90309986181b", "score": "0.6535571", "text": "def get_attachment(token, message_id, attachment_id, fields = nil)\n request_url = \"/api/v2.0/me/messages/#{message_id}/attachments/#{attachment_id}\"\n request_params = nil\n\n unless fields.nil?\n request_params = { '$select' => fields.join(',') }\n end\n\n get_message_response = make_api_call \"GET\", request_url, token, request_params\n\n JSON.parse(get_message_response)\n end", "title": "" }, { "docid": "f0c4eb851713722756aff41550038c39", "score": "0.6516595", "text": "def get_timeline_attachment(timeline_item_id, attachment_id)\n @client.execute!(\n api_method: @mirror.timeline.attachments.get,\n parameters: {\n itemId: timeline_item_id,\n attachmentId: attachment_id\n }\n ).data\n end", "title": "" }, { "docid": "199d7aad48aec7711e18e9617f207240", "score": "0.65150875", "text": "def attachment_service(id)\n DiskAttachmentService.new(self, id)\n end", "title": "" }, { "docid": "8679a26e848487822f306503a286ae9f", "score": "0.650732", "text": "def attachment\n data[:attachment]\n end", "title": "" }, { "docid": "ba97b5fe3e8e57052de3748554bdb788", "score": "0.6457921", "text": "def attachment(aid)\n resp = @server[\"ticket/1/attachments/#{aid}/\"].get\n return process_response(resp, 's', true) \n end", "title": "" }, { "docid": "6b6dbe901661fcffbb6cc8946c10567b", "score": "0.64135516", "text": "def find_attachment\n @attachment = Adapt::Attachment.find_by_id(params[:id])\n @study = @attachment.study if @attachment\n end", "title": "" }, { "docid": "bb9852a2bde4ecf45af8eed53ff85308", "score": "0.6399783", "text": "def attachment_service(id)\n StorageDomainVmDiskAttachmentService.new(self, id)\n end", "title": "" }, { "docid": "2dfc876ecb4688426fb9d22f82837f56", "score": "0.6391722", "text": "def show\n @attachment = Attachment.find(params[:id])\n end", "title": "" }, { "docid": "8aec64f13e849783835ba944f0c21b6c", "score": "0.6367614", "text": "def attachment\n @attachment ||= ActiveStorage::Attachment.find_by(record_gid: record.to_gid.to_s, name: name)\n end", "title": "" }, { "docid": "f58563722527f29d16a476923a52ea5b", "score": "0.6344393", "text": "def list_service_attachments_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServicesApi.list_service_attachments ...\"\n end\n # resource path\n local_var_path = \"/serviceinsertion/service-attachments\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'ServiceAttachmentListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicesApi#list_service_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "78cd9dbfa227039c301f456dc461ecd8", "score": "0.6343017", "text": "def public_api_get_contact_attachment(contact_id, attachment_id, api_key, opts = {})\n data, _status_code, _headers = public_api_get_contact_attachment_with_http_info(contact_id, attachment_id, api_key, opts)\n return data\n end", "title": "" }, { "docid": "81b3de0d46b52fd93e6e145978687754", "score": "0.6334734", "text": "def add_service_attachment_with_http_info(service_attachment, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServicesApi.add_service_attachment ...\"\n end\n # verify the required parameter 'service_attachment' is set\n if @api_client.config.client_side_validation && service_attachment.nil?\n fail ArgumentError, \"Missing the required parameter 'service_attachment' when calling ServicesApi.add_service_attachment\"\n end\n # resource path\n local_var_path = \"/serviceinsertion/service-attachments\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(service_attachment)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'ServiceAttachment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicesApi#add_service_attachment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "06d2c5780492ede930e23e91cac83ad0", "score": "0.63167673", "text": "def get_Attachment()\n \t return @outputs[\"Attachment\"]\n \tend", "title": "" }, { "docid": "06d2c5780492ede930e23e91cac83ad0", "score": "0.63167673", "text": "def get_Attachment()\n \t return @outputs[\"Attachment\"]\n \tend", "title": "" }, { "docid": "5a3493a24c1efae62984a3d487d1f578", "score": "0.6315047", "text": "def attachment\n data.attachment\n end", "title": "" }, { "docid": "c860e18ae59152acf05d65cb02853fd5", "score": "0.62721044", "text": "def attachment_service(id)\n NetworkAttachmentService.new(self, id)\n end", "title": "" }, { "docid": "91e13df5d1eac58e4c9dc42dd394fcbc", "score": "0.6255038", "text": "def get_attachment_by_id(id, t_instance_id, attachment_id, opts = {})\n data, _status_code, _headers = get_attachment_by_id_with_http_info(id, t_instance_id, attachment_id, opts)\n return data\n end", "title": "" }, { "docid": "2cbaf92fcb348ff2b922e9cefb7ed3af", "score": "0.6240599", "text": "def attachment_service(id)\n TemplateDiskAttachmentService.new(self, id)\n end", "title": "" }, { "docid": "6f4429d20c801c4480d1bc33c2fd8fca", "score": "0.62190396", "text": "def get_attachment_metadata(id)\n response = @client.get(\"/attachments/#{id}\")\n Api.verify_get_response(response)\n Attachment.new(Api.parse(response))\n end", "title": "" }, { "docid": "ca623f501f78d862d9367617e1854801", "score": "0.6207221", "text": "def get_attachment\n Log.add_info(request, params.inspect)\n\n attach = Attachment.find(params[:id])\n if attach.nil?\n redirect_to(THETIS_RELATIVE_URL_ROOT + '/404.html')\n return\n end\n\n parent_item = (attach.item || ((attach.comment.nil?) ? nil : attach.comment.item))\n if parent_item.nil? or !parent_item.check_user_auth(@login_user, 'r', true)\n Log.add_check(request, '[Item.check_user_auth]'+request.to_s)\n redirect_to(:controller => 'frames', :action => 'http_error', :id => '401')\n return\n end\n\n attach_name = attach.name\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n ie_ver = nil\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n attach_name = CGI::escape(attach_name) unless ie_ver.nil?\n end\n\n begin\n attach_location = attach.location\n rescue\n attach_location = Attachment::LOCATION_DB # for lower versions\n end\n\n if attach_location == Attachment::LOCATION_DIR\n\n filepath = AttachmentsHelper.get_path(attach)\n\n send_file(filepath, :filename => attach_name, :stream => true, :disposition => 'attachment')\n else\n send_data(attach.content, :type => (attach.content_type || 'application/octet-stream')+';charset=UTF-8', :disposition => 'attachment;filename=\"'+attach_name+'\"')\n end\n end", "title": "" }, { "docid": "ce200a8a9c7328386fbf1089b0030445", "score": "0.617817", "text": "def attachment_file\n @attributes[:attachment_file]\n end", "title": "" }, { "docid": "ce200a8a9c7328386fbf1089b0030445", "score": "0.617817", "text": "def attachment_file\n @attributes[:attachment_file]\n end", "title": "" }, { "docid": "b2882913ac38f96c53d7c27daec6e9e1", "score": "0.6154973", "text": "def attachment\n @attachment = content_class.find(params[:id])\n end", "title": "" }, { "docid": "04ecfbbe2f670c599de5f27a95bbae35", "score": "0.61541605", "text": "def get_attachment_with_http_info(attachment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.get_attachment ...'\n end\n # verify the required parameter 'attachment_id' is set\n if @api_client.config.client_side_validation && attachment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'attachment_id' when calling AttachmentControllerApi.get_attachment\"\n end\n # resource path\n local_var_path = '/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'AttachmentEntity' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AttachmentControllerApi#get_attachment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ccadeddc78919557dc58212bb508b815", "score": "0.61521524", "text": "def get_resource(options = {})\n options = argument_cleaner(required_params: %i( entityid path ), optional_params: %i( version packagetype attachment class ), options: options )\n authenticated_get cmd: \"getresource\", **options\n end", "title": "" }, { "docid": "49e811ad4a41aff8a26cbd9ed8448ab4", "score": "0.6144343", "text": "def attachment\n object.attachment.try(:url)\n end", "title": "" }, { "docid": "6b115ea24af62cda9056c2fc3b7321b9", "score": "0.6143453", "text": "def attachment\n main_attachments ? main_attachments[0] : nil\n end", "title": "" }, { "docid": "6b115ea24af62cda9056c2fc3b7321b9", "score": "0.6143453", "text": "def attachment\n main_attachments ? main_attachments[0] : nil\n end", "title": "" }, { "docid": "c62a7138d878f1dbb257d90ebed5b7bd", "score": "0.6130036", "text": "def get_attachment_info(attachment_id, opts = {})\n data, _status_code, _headers = get_attachment_info_with_http_info(attachment_id, opts)\n data\n end", "title": "" }, { "docid": "8cf3d923d9effe7a97f132bae3330e9f", "score": "0.61147565", "text": "def list_service_attachments(opts = {})\n data, _status_code, _headers = list_service_attachments_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "c8cbc77e34b8ec64915be80420549da3", "score": "0.60855675", "text": "def list_service_attachments_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesServiceInsertionApi.list_service_attachments ...'\n end\n # resource path\n local_var_path = '/serviceinsertion/service-attachments'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'ServiceAttachmentListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesServiceInsertionApi#list_service_attachments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "2e9cf8f101e371251f38c4864300aa52", "score": "0.6083302", "text": "def list_service_attachments(opts = {})\n data, _status_code, _headers = list_service_attachments_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "59c591fdd04e87756ec01117d2503376", "score": "0.6073013", "text": "def add_service_attachment(service_attachment, opts = {})\n data, _status_code, _headers = add_service_attachment_with_http_info(service_attachment, opts)\n return data\n end", "title": "" }, { "docid": "0a0a04c8e2ea6cfcb8f2c099f4cef900", "score": "0.6060669", "text": "def attachment\n if mail.has_attachments?\n mail.attachments.find{|a| a.content_type == \"application/edi-consent\"}\n else\n mail\n end\n end", "title": "" }, { "docid": "104a3dd68bce1d4e73dc3e5512a2a677", "score": "0.601902", "text": "def load_attachment # :doc:\n @attachment = self.class.attachment_model.find params[:id]\n rescue\n raise ActionController::RoutingError.new('Not Found')\n end", "title": "" }, { "docid": "839c0b883fba5c3fee17bec58d23ffc8", "score": "0.6017762", "text": "def add_service_attachment_with_http_info(service_attachment, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesServiceInsertionApi.add_service_attachment ...'\n end\n # verify the required parameter 'service_attachment' is set\n if @api_client.config.client_side_validation && service_attachment.nil?\n fail ArgumentError, \"Missing the required parameter 'service_attachment' when calling ManagementPlaneApiServicesServiceInsertionApi.add_service_attachment\"\n end\n # resource path\n local_var_path = '/serviceinsertion/service-attachments'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(service_attachment)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, 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 => 'ServiceAttachment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesServiceInsertionApi#add_service_attachment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a6eafc465bcccf56859cc90d2b483a30", "score": "0.59623307", "text": "def get_contact_attachment_by_id(xero_tenant_id, contact_id, attachment_id, content_type, opts = {})\n data, _status_code, _headers = get_contact_attachment_by_id_with_http_info(xero_tenant_id, contact_id, attachment_id, content_type, opts)\n data\n end", "title": "" }, { "docid": "60f2a974d38d0987932fbbeb87ad80ea", "score": "0.5955787", "text": "def show\n @attachment = Attachment.find(params[:id])\n @budget = @attachment.budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end", "title": "" }, { "docid": "efc951ddb370ce95822d38662a5a1696", "score": "0.59448445", "text": "def delete_service_attachment_with_http_info(service_attachment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ServicesApi.delete_service_attachment ...\"\n end\n # verify the required parameter 'service_attachment_id' is set\n if @api_client.config.client_side_validation && service_attachment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_attachment_id' when calling ServicesApi.delete_service_attachment\"\n end\n # resource path\n local_var_path = \"/serviceinsertion/service-attachments/{service-attachment-id}\".sub('{' + 'service-attachment-id' + '}', service_attachment_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicesApi#delete_service_attachment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "fa90a2852f0e1dc57fa4af90bd86a688", "score": "0.59389246", "text": "def show \n @attachment = get_attachment(@solicitud.archivo_id)\n end", "title": "" }, { "docid": "ff49ad8cdfcc1981240d1760ae573481", "score": "0.5938896", "text": "def attachment_data\n attachment\n end", "title": "" }, { "docid": "0616214f7cbcde7c572fbb512ada098a", "score": "0.59354055", "text": "def show\n @attachment = Attachment.viewable_attachments(current_user).find(params[:id])\n end", "title": "" }, { "docid": "7cc744b42888c42b75d7fcbfe39600fd", "score": "0.59320664", "text": "def public_api_get_account_attachment(company_id, attachment_id, api_key, opts = {})\n data, _status_code, _headers = public_api_get_account_attachment_with_http_info(company_id, attachment_id, api_key, opts)\n return data\n end", "title": "" }, { "docid": "a7d82aa6154225dffec9dcc7607649f1", "score": "0.5923312", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return attachment_service(path)\n end\n return attachment_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "a7d82aa6154225dffec9dcc7607649f1", "score": "0.5923312", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return attachment_service(path)\n end\n return attachment_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "a7d82aa6154225dffec9dcc7607649f1", "score": "0.5923166", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return attachment_service(path)\n end\n return attachment_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "a7d82aa6154225dffec9dcc7607649f1", "score": "0.5923166", "text": "def service(path)\n if path.nil? || path == ''\n return self\n end\n index = path.index('/')\n if index.nil?\n return attachment_service(path)\n end\n return attachment_service(path[0..(index - 1)]).service(path[(index + 1)..-1])\n end", "title": "" }, { "docid": "19b4080805df69192a92c2c00bec14b4", "score": "0.592233", "text": "def add_service_attachment(service_attachment, opts = {})\n data, _status_code, _headers = add_service_attachment_with_http_info(service_attachment, opts)\n data\n end", "title": "" }, { "docid": "64c3c95b677e79c4addd874eabb528d2", "score": "0.589905", "text": "def show\n @attachment = Attachment.find(params[:id])\n respond_to do |format|\n format.json { render json: @attachment.as_json(methods: [:file_url, *AttachableWithMetadata::ATTACHMENT_METADATA_FIELDS.map { |m| \"file_#{m}\"}]) }\n end\n end", "title": "" }, { "docid": "0115f80180107c865a149d4470ec4112", "score": "0.58749676", "text": "def read_attachment(args)\n query_str = build_attachment_query(args)\n \n @conn.query({url_path: query_str, method: :get})\n end", "title": "" }, { "docid": "cf9c4c1d74ea1f8748aa3991ea381d66", "score": "0.5874453", "text": "def attachment_data\n return @attachment_data if @attachment_data\n \n filename = full_filename\n File.open(filename, 'rb') do |file|\n @attachment_data = file.read\n end if File.file?(filename)\n @attachment_data\n end", "title": "" }, { "docid": "cf9c4c1d74ea1f8748aa3991ea381d66", "score": "0.5874453", "text": "def attachment_data\n return @attachment_data if @attachment_data\n \n filename = full_filename\n File.open(filename, 'rb') do |file|\n @attachment_data = file.read\n end if File.file?(filename)\n @attachment_data\n end", "title": "" }, { "docid": "7db1307deaabd54bf3e5cf3bf409d319", "score": "0.5869902", "text": "def document_attachments_read_with_http_info(uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocumentAttachmentsApi.document_attachments_read ...'\n end\n # verify the required parameter 'uuid' is set\n if @api_client.config.client_side_validation && uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'uuid' when calling DocumentAttachmentsApi.document_attachments_read\"\n end\n # resource path\n local_var_path = '/document-attachments/{uuid}/'.sub('{' + 'uuid' + '}', uuid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\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 => 'DocumentAttachment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocumentAttachmentsApi#document_attachments_read\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c1e15fab840b0bb268ef33920fa91169", "score": "0.58622867", "text": "def get_email_attachment(name, attach_name, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: EmailApi#get_email_attachment ...\"\n end\n \n # verify the required parameter 'name' is set\n fail \"Missing the required parameter 'name' when calling get_email_attachment\" if name.nil?\n \n # verify the required parameter 'attach_name' is set\n fail \"Missing the required parameter 'attach_name' when calling get_email_attachment\" if attach_name.nil?\n \n # resource path\n path = \"/email/{name}/attachments/{attachName}\".sub('{format}','json').sub('{' + 'name' + '}', name.to_s).sub('{' + 'attachName' + '}', attach_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if opts[:'storage']\n query_params[:'folder'] = opts[:'folder'] if opts[:'folder']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:GET, 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 => 'File')\n if Configuration.debugging\n Configuration.logger.debug \"API called: EmailApi#get_email_attachment. Result: #{result.inspect}\"\n end\n return result\n end", "title": "" }, { "docid": "c6ce2b732d6abf10b89d2d66b4132e32", "score": "0.5854346", "text": "def public_api_get_contact_attachment_with_http_info(contact_id, attachment_id, api_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.public_api_get_contact_attachment ...\"\n end\n # verify the required parameter 'contact_id' is set\n if @api_client.config.client_side_validation && contact_id.nil?\n fail ArgumentError, \"Missing the required parameter 'contact_id' when calling ContactsApi.public_api_get_contact_attachment\"\n end\n # verify the required parameter 'attachment_id' is set\n if @api_client.config.client_side_validation && attachment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'attachment_id' when calling ContactsApi.public_api_get_contact_attachment\"\n end\n # verify the required parameter 'api_key' is set\n if @api_client.config.client_side_validation && api_key.nil?\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling ContactsApi.public_api_get_contact_attachment\"\n end\n # resource path\n local_var_path = \"/api/pub/v1/contacts/{contactId}/attachments/{attachmentId}\".sub('{' + 'contactId' + '}', contact_id.to_s).sub('{' + 'attachmentId' + '}', attachment_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'api_key'] = api_key\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'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#public_api_get_contact_attachment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d62715e7318ab0808f33b212db516894", "score": "0.5817818", "text": "def disk_attachments_service\n @disk_attachments_service ||= DiskAttachmentsService.new(self, 'diskattachments')\n end", "title": "" }, { "docid": "19a518d026b46be01c29f24b3966a5ef", "score": "0.58024865", "text": "def attachment_id\n @properties[\"attachmentId\"]\n end", "title": "" }, { "docid": "b9f4fb9b6893eed36becfeb9f86bbc6d", "score": "0.5800377", "text": "def find_attachment\n @attachment = [params['id'], params['format']].compact.join '.'\n @attachment_name = @attachment.split('/').last\n @attachment_path = \"#{Rails.root}/public\" + @attachment\n end", "title": "" }, { "docid": "4cb01d0221b3a8f7b5dca21f4a04b81a", "score": "0.57971716", "text": "def get_attachment_meta_data(email_id, attachment_id, opts = {})\n data, _status_code, _headers = get_attachment_meta_data_with_http_info(email_id, attachment_id, opts)\n data\n end", "title": "" }, { "docid": "884dcb70fec8da1c47989a6e5026d9b8", "score": "0.57916147", "text": "def info(addon_attachment_id)\n @client.addon_attachment.info(addon_attachment_id)\n end", "title": "" }, { "docid": "a24e4ecbc379d812fb55d39ac5d7a378", "score": "0.57844245", "text": "def get_attachment(opts = {})\n if opts[:port] && opts[:device]\n @attachments.detect { |a| a[:port] == opts[:port] &&\n a[:device] == opts[:device] }\n elsif opts[:uuid]\n @attachments.detect { |a| a[:uuid] == opts[:uuid] }\n end\n end", "title": "" }, { "docid": "98551fd36c5c6b7050bcaf52408dd21f", "score": "0.57671016", "text": "def find_attachment; end", "title": "" }, { "docid": "e5912a12230d0a5a5ade487ee7953a72", "score": "0.5760247", "text": "def get(\n id,\n deadline: nil\n )\n req = V1::AccountAttachmentGetRequest.new()\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"AccountAttachments.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = AccountAttachmentGetResponse.new()\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.account_attachment = Plumbing::convert_account_attachment_to_porcelain(plumbing_response.account_attachment)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end", "title": "" }, { "docid": "c0a2410109686bfb5618ae1886010cab", "score": "0.5759695", "text": "def get_report_document_by_id(document_id)\n blob = self.report_files.blobs.find_signed(document_id)\n\n unless blob.nil?\n return self.report_files.attachments.where({blob_id: blob.id}).first\n end\n return nil\n end", "title": "" }, { "docid": "52adaf21e2e19393f1c6eaa964808519", "score": "0.5749436", "text": "def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end", "title": "" }, { "docid": "52adaf21e2e19393f1c6eaa964808519", "score": "0.5749436", "text": "def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end", "title": "" }, { "docid": "52adaf21e2e19393f1c6eaa964808519", "score": "0.5749436", "text": "def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end", "title": "" }, { "docid": "52adaf21e2e19393f1c6eaa964808519", "score": "0.5749436", "text": "def show\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attachment }\n end\n end", "title": "" }, { "docid": "696b550e54b941be012954955afb02d7", "score": "0.57305217", "text": "def get_attachment(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.get_attachment(struct)\n rt = nil\n val\n end", "title": "" }, { "docid": "18462c0873c6c7b28510ddbb2d784ad0", "score": "0.5728896", "text": "def delete_service_attachment(service_attachment_id, opts = {})\n delete_service_attachment_with_http_info(service_attachment_id, opts)\n nil\n end", "title": "" }, { "docid": "f4e61c447a3034dc7525693e95f96f57", "score": "0.5721623", "text": "def show\n @section_attachment = SectionAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @section_attachment }\n end\n end", "title": "" }, { "docid": "779e4737ef2330f5ef47b21b20ec2b84", "score": "0.5703797", "text": "def get_receipt_attachment_by_id(xero_tenant_id, receipt_id, attachment_id, content_type, opts = {})\n data, _status_code, _headers = get_receipt_attachment_by_id_with_http_info(xero_tenant_id, receipt_id, attachment_id, content_type, opts)\n data\n end", "title": "" }, { "docid": "9048773d1f8d2943502c92bc63ae7bfe", "score": "0.5696996", "text": "def current_attachment\n attachment_versions.first\n end", "title": "" }, { "docid": "85242ea176b36257e794a8aeb3dafd4a", "score": "0.56953067", "text": "def fetch_attachment(doc, name)\n uri = url_for_attachment(doc, name)\n CouchRest.get uri, :raw => true\n end", "title": "" }, { "docid": "00196287617ae2b99e9611be10ca4497", "score": "0.5691364", "text": "def get_attachment_info_with_http_info(attachment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.get_attachment_info ...'\n end\n # verify the required parameter 'attachment_id' is set\n if @api_client.config.client_side_validation && attachment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'attachment_id' when calling AttachmentControllerApi.get_attachment_info\"\n end\n # resource path\n local_var_path = '/attachments/{attachmentId}/metadata'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'AttachmentMetaData' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AttachmentControllerApi#get_attachment_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "387eaf08afde2b4f320c3427ed7857cd", "score": "0.5686107", "text": "def delete_service_attachment_with_http_info(service_attachment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesServiceInsertionApi.delete_service_attachment ...'\n end\n # verify the required parameter 'service_attachment_id' is set\n if @api_client.config.client_side_validation && service_attachment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_attachment_id' when calling ManagementPlaneApiServicesServiceInsertionApi.delete_service_attachment\"\n end\n # resource path\n local_var_path = '/serviceinsertion/service-attachments/{service-attachment-id}'.sub('{' + 'service-attachment-id' + '}', service_attachment_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesServiceInsertionApi#delete_service_attachment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "8d4e41aead59bd448a43bdea6582da33", "score": "0.56853306", "text": "def get_file_data(attachment_name)\n @_files_mgr.get_file_data(self, attachment_name)\n #current_node_doc = self.class.get(self['_id'])\n #att_doc_id = current_node_doc['attachment_doc_id']\n #current_node_attachment_doc = self.class.user_attachClass.get(att_doc_id)\n #current_node_attachment_doc.read_attachment(attachment_name)\n end", "title": "" }, { "docid": "b81d6ca00cb1fd48e4d6fbef85c91518", "score": "0.5683584", "text": "def show\n @item_attachment = ItemAttachment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_attachment }\n end\n end", "title": "" }, { "docid": "eb66898b314e0fe949d58d5dafa9959b", "score": "0.5676808", "text": "def attached_file\n @attached_file ||= FoxYam::AttachedFile.find_by_id attached_file_id\n end", "title": "" }, { "docid": "c415e30eaa236cdfba536507d926b940", "score": "0.566271", "text": "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/attachments/#{id}\", options: options)).first, client: client)\n end", "title": "" }, { "docid": "9e0268fce18c7c6f013b8fa2e921f846", "score": "0.56514376", "text": "def download_attachment(email_id, attachment_id, opts = {})\n data, _status_code, _headers = download_attachment_with_http_info(email_id, attachment_id, opts)\n data\n end", "title": "" }, { "docid": "2aa8945d9e748cb08673d7321e18e3db", "score": "0.5637506", "text": "def attachment_endpoint(resource, options = {})\n estate = options.fetch(:estate)\n estate_attachment_endpoint(estate, resource, options)\n end", "title": "" }, { "docid": "b25be5babe59eef9af8e0b34781f4949", "score": "0.5636026", "text": "def read(attname)\n\n attname = attname.to_s\n\n extname = File.extname(attname)\n attname = attachments.find { |a| a.match(/^#{attname}/) } if extname == ''\n\n return nil if attname == nil\n\n db.get(\"#{@h['_id']}/#{attname}\")\n end", "title": "" }, { "docid": "b6829631d5798304353b21efc88407ee", "score": "0.56279325", "text": "def find_case_media_attachment(attachment)\n\t\t@attachment = CaseMediaAttachment.find(attachment)\n\tend", "title": "" }, { "docid": "0ce50dbcfeced4f8ebcda44a97ab3559", "score": "0.5624297", "text": "def attached_file\n #since this could be used in an AR class that is using carrierwave\n # or in a Reform form, we have different ways of getting to the\n # attached file.\n return file.file if file.respond_to?(:file) # file is carrierwave uploader\n file # file is just a file, which is the case in the reform object\n end", "title": "" }, { "docid": "3327608407bc414b8bb5e078f9c68a69", "score": "0.56203556", "text": "def get_attachment(url)\n resource = RestClient::Resource.new(url, 'api', $MAILGUN_API)\n resource.get\nend", "title": "" }, { "docid": "ba95146a9521b711eb884fd3abedd966", "score": "0.5614696", "text": "def attachment\n record.public_send(\"#{name}_attachment\")\n end", "title": "" } ]
7dc8d8734879209405b71a90311cb1a8
Return the next sequence ID
[ { "docid": "25e26a9a31fc50a70a22e147f21c5063", "score": "0.8347065", "text": "def next_seq_id\n @tx_seq_id += 1\n end", "title": "" } ]
[ { "docid": "4a25a894a4378ad4eb27a94f5f336c03", "score": "0.81901276", "text": "def next_sequence\n @sequence.to_i + 1\n end", "title": "" }, { "docid": "28fb1254a716aec95344d5c280b3b5f9", "score": "0.8094886", "text": "def next_id\n id = @next_id\n @next_id += 1\n id\n end", "title": "" }, { "docid": "4c4ed41594736b136e17a6cb407d270a", "score": "0.8061376", "text": "def next_id\n @next_id ||= -1\n @next_id += 1\n end", "title": "" }, { "docid": "a15aabf85b2e92ea25ac86962f9c16be", "score": "0.79256546", "text": "def next_sequence_value(sequence_name)\n execute(\"SELECT #{sequence_name}.NEXTVAL id FROM DUMMY\").first['id'].to_i\n end", "title": "" }, { "docid": "2a1d88d87f0b7ef833cf1026693d1321", "score": "0.7887551", "text": "def get_next_id\n\t\t@counter ||= 0\n\t\t@counter += 1\n\tend", "title": "" }, { "docid": "61cad9de7fed4f026cd33945b475048d", "score": "0.7877998", "text": "def next_id\n @id ||= 0\n @id += 1\n end", "title": "" }, { "docid": "d8517809cc4e3d2b52239d3903770fe1", "score": "0.7797456", "text": "def next_id\n (@curr_id +=1).to_s\n end", "title": "" }, { "docid": "6192da93c5eebcf7086f6da6b766a3b6", "score": "0.77937895", "text": "def next_id\n @current_id = @current_id + 1\n @current_id\n end", "title": "" }, { "docid": "f358d4cee4626c9e50e74c79e67aaa06", "score": "0.77706146", "text": "def nextseq\n @sequence = (@sequence || 0) + 1\n end", "title": "" }, { "docid": "b8a7e4398ec21e59365204be1c4224bd", "score": "0.7726185", "text": "def next_session_id\n sql = \"SELECT nextval('session_id_seq');\"\n result = query(sql)\n result.field_values(\"nextval\").first.to_i\n end", "title": "" }, { "docid": "554f24970dccb9dcf4d731056261dcbc", "score": "0.7718154", "text": "def next_id #nodoc\n @_next_id\n end", "title": "" }, { "docid": "c70df21de4f5d969162f8597acf07c71", "score": "0.7700659", "text": "def next_id\n @id_counter ||= 10000\n @id_counter += 1\n end", "title": "" }, { "docid": "a4ccc4eb921481b3d5c82ec583a490f1", "score": "0.76840717", "text": "def next_sequence_value\n reload!\n info.sequence.to_i + 1\n end", "title": "" }, { "docid": "5343b948a43666d5319e65821823a675", "score": "0.7682843", "text": "def next_id\n id = nil\n MinterState.transaction do\n locked = instance\n minter = ::Noid::Minter.new(deserialize(locked))\n id = minter.mint\n serialize(locked, minter)\n end\n id\n end", "title": "" }, { "docid": "35b9ff4b18dbc32a04f83f5a2f25d44f", "score": "0.7664386", "text": "def next_sequence_value; end", "title": "" }, { "docid": "95ad02d876f39fb13e13d5d746de1786", "score": "0.7664368", "text": "def next_id\n @id_counter ||= 10000\n @id_counter += 1\n end", "title": "" }, { "docid": "f8398a8b4638c0536e2ee958fef51ffc", "score": "0.7628068", "text": "def _next_id #nodoc\n @_next_id\n end", "title": "" }, { "docid": "bef64eb94451d5539f3d43e6b79f2365", "score": "0.7602738", "text": "def next_id\n id = File.read(ID).to_i + 1\n save_id(id)\n id\n end", "title": "" }, { "docid": "8fdad44c64456ff8392c0539068d9a6b", "score": "0.7598991", "text": "def next_id\n @next_id -= 1\n end", "title": "" }, { "docid": "d66be5aa0023dc24533976d520e76e93", "score": "0.75630873", "text": "def next_sequence_value(sequence_name)\n select_one(\"SELECT GEN_ID(#{sequence_name}, 1) FROM RDB$DATABASE\", nil, :array).first\n end", "title": "" }, { "docid": "77b0d4f8f1907ec4acf3111c48ee7115", "score": "0.75582516", "text": "def next_sequence_value\n connection.next_sequence_value(sequence_name)\n end", "title": "" }, { "docid": "1ada0faf03d16ed001ed0695f47b49c0", "score": "0.7537858", "text": "def next_id\n @@last_id += 1\n @@last_id.to_s.encode(Encoding::UTF_8)\n end", "title": "" }, { "docid": "e8178cff29bd9acb48525026b943d77f", "score": "0.7497202", "text": "def mint_id\n r = execute \"SELECT nextval('obj_sequence');\"\n r[0][0].to_i\n end", "title": "" }, { "docid": "44dd9a499702340dd5853343da6e4131", "score": "0.7467373", "text": "def _next_id\n @@id -= 1\n @@id\n end", "title": "" }, { "docid": "a110641d5683b1d5ee51d512715c31e3", "score": "0.7462596", "text": "def next_sequence_value(sequence_name)\n @connection.query(\"SELECT NEXT VALUE FOR #{sequence_name} FROM RDB$DATABASE\")[0][0]\n end", "title": "" }, { "docid": "9c61814f74c3ddcea99c4c923ea76792", "score": "0.7456802", "text": "def generateSequenceNumber\n\n @sequenceNumber = ((@sequenceNumber + 1) & 0xFFFFFFFF)\n end", "title": "" }, { "docid": "17993494180b99909bc112a3355f5dd2", "score": "0.74268055", "text": "def _next_id\n @@id -= 1\n @@id\n end", "title": "" }, { "docid": "7a85d192b0640bc118db7d2956df8065", "score": "0.73964596", "text": "def next_id\n @id ||= 0\n @id -= 1\nend", "title": "" }, { "docid": "a843d89dbf5182c9864ec7d51cefc063", "score": "0.73938805", "text": "def next_id(type)\n last_id(type).to_i.next\n end", "title": "" }, { "docid": "40dda03d703609845ef7a38fedcab54b", "score": "0.73798543", "text": "def next_id=(value)\n @_next_id = value\n end", "title": "" }, { "docid": "0475b473bc96aadcba8a97b4b2531748", "score": "0.7358424", "text": "def next_id(als)\n # try the next in the sequence\n id = entries(als).length\n \n # if that already exists, go for a random id\n while find(als, id)\n id = rand(id * 10000)\n end\n \n id\n end", "title": "" }, { "docid": "f7bea4dc4a587282f086b57ac2875038", "score": "0.7355317", "text": "def number\n return @sequence_id\n end", "title": "" }, { "docid": "25b5c2fb3300ddecd769f8fe264128d8", "score": "0.7256807", "text": "def next_sequence_value(sequence_name)\n unique = select_value(\"SELECT UNIQUE FROM #{sequence_name}\",\"Next Sequence Value\")\n # The test cases cannot handle a zero primary key\n unique.zero? ? select_value(\"SELECT UNIQUE FROM #{sequence_name}\",\"Next Sequence Value\") : unique\n end", "title": "" }, { "docid": "5bc7768bcb1cbc531e7aa619d7b1d17e", "score": "0.7240178", "text": "def next_id\n BulkIdManager.next_id_for(\"cache_tx_generator\", 1)\nend", "title": "" }, { "docid": "fb0e113fb839faa929bdd2344263e8f0", "score": "0.7219287", "text": "def seq_id\n 1\n end", "title": "" }, { "docid": "1d02cf1058d445fdbfd58ae65558299a", "score": "0.71543884", "text": "def next_sequence_value(sequence_name)\n # if sequence_name is set to :autogenerated then it means that primary key will be populated by trigger\n return nil if sequence_name == AUTOGENERATED_SEQUENCE_NAME\n sequence_name = quote_table_name(sequence_name)\n sql = \"SELECT #{sequence_name}.NEXTVAL id FROM dual\"\n log(sql, 'SQL') { @connection.next_sequence_value(sequence_name) }\n end", "title": "" }, { "docid": "6865ce5c40734c8815bf68576d8b5428", "score": "0.71523076", "text": "def next_sequence\n return get_next_seq(@gzf_bin)\n end", "title": "" }, { "docid": "0f6706d6768b412075b76ffec3c494c2", "score": "0.71319985", "text": "def sequence_id\n return @sequence_id\n end", "title": "" }, { "docid": "f6b1a0146645847510a3f581797ff6b4", "score": "0.71302974", "text": "def next_id\n return 0 if @index.count == 0\n @index.values.map(&:id).max + 1\n end", "title": "" }, { "docid": "9d71aa52a06f5ac7320249984a5567fc", "score": "0.71233416", "text": "def get_and_increment_sequence!\n s = nil\n Mutex.new.synchronize do\n s = @seq\n @seq += 1\n end\n return s\n end", "title": "" }, { "docid": "982f293b20cfbce3e7e66e4d6d18f803", "score": "0.71207565", "text": "def next_id=(value) #nodoc\n @_next_id = value\n end", "title": "" }, { "docid": "29f02a4fc934caaf567965bc887da6b0", "score": "0.7110213", "text": "def next_sequence_number\n abs.\n to_s.\n chars.\n chunk { |char| char }.\n map { |number, ary| [ary.length, number] }.\n join.\n to_i\n end", "title": "" }, { "docid": "78073cfe4a119d94f1d86fb429cc284e", "score": "0.71083915", "text": "def next_val_sequence(name)\n self.execute(\"SELECT nextval('%s');\" % name).entries.first['nextval'].to_i\n end", "title": "" }, { "docid": "f8b406286df551f65a7c8508ec8e81ee", "score": "0.71072125", "text": "def next_transaction_id\n if (last_transaction = Payment.order(\"data->>'transaction_id' DESC\").select(:data).first)\n if (id = last_transaction.transaction_id)\n index = id[-5..-1].to_i + 1\n return transaction_id_for(index)\n end\n end\n\n transaction_id_for(1)\n end", "title": "" }, { "docid": "4e9de8022b7b2b0ebbb78addcd880e69", "score": "0.7104927", "text": "def next_id\n @last_id += 1 while @nodes_by_id.keys.include?(@last_id + 1)\n @last_id += 1\n end", "title": "" }, { "docid": "23ea9639b812ed75e61790b50204843d", "score": "0.70983225", "text": "def next_id\n return Utils.next_id unless Datadog.configuration.tracing.trace_id_128_bit_generation_enabled\n\n concatenate(\n Core::Utils::Time.now.to_i << 32,\n Utils.next_id\n )\n end", "title": "" }, { "docid": "2fb2287281e0006cd27778bd15fcbe5d", "score": "0.7086809", "text": "def allocate_next_seq\n retries = 20\n while true\n reload\n seq = send(seq_column)\n case r = self.class.base_class.update_all(\n [\"#{seq_column}=?\",seq+1],\n [\"#{self.class.base_class.primary_key}=? and #{seq_column}=?\",id,seq])\n when 0\n retries -= 1\n raise ActiveRecordError, \"Unable to allocate from #{seq_column}\" if retries <= 0\n sleep rand(0.5)\n when 1\n return seq\n else\n raise ActiveRecordError, \"Unexpected update result #{r.inspect} in allocate_next_seq\"\n end\n end\n end", "title": "" }, { "docid": "92dd77311dd9bdc843c814e51bc7bec0", "score": "0.7078799", "text": "def sequence_id\n @sequence_id\n end", "title": "" }, { "docid": "6ebb2096d12ac297b8d8a55f987aa1a8", "score": "0.7071737", "text": "def next_id(reserved_count)\n the_id = 0 # need this here since used in\n # lock scope\n range_lock.synchronize do\n if @next == 0 || (@next + reserved_count > @last)\n # time for a new range\n# BulkIdGenerator.transaction do\n get_new_range(reserved_count)\n# end\n end\n the_id = @next\n @next += reserved_count # for next time around\n end\n\n return the_id\n end", "title": "" }, { "docid": "3b02cd7aa17edde05533941b23987723", "score": "0.70311666", "text": "def next_id\n sequencer.next_alert_mgr_id\n end", "title": "" }, { "docid": "711cdb7d6550b1d58c68672b571d1306", "score": "0.70296156", "text": "def next_seq_num\n (User.unexpired.map { |u| u.seq_num || 0 }.max || 0)+ 1\n end", "title": "" }, { "docid": "23f456e24bece347a3398112131d27b6", "score": "0.701976", "text": "def next\n now = @clock.now\n usecs = now.to_i * 1_000_000 + now.usec\n if @last_usecs && @last_usecs - @sequence <= usecs && usecs <= @last_usecs\n @sequence += 1\n elsif @last_usecs && @last_usecs > usecs\n @sequence = 0\n @clock_id = rand(2**16)\n else\n @sequence = 0\n end\n @last_usecs = usecs + @sequence\n from_usecs(@last_usecs)\n end", "title": "" }, { "docid": "1042c1562b2636e894a081f7a2fcda12", "score": "0.69749784", "text": "def assign_seq_num\n self.seq_num = next_seq_num\n end", "title": "" }, { "docid": "daf77009299b92745bb9247daec4c8ef", "score": "0.6963904", "text": "def next_id\n (map { |key, values| values.id}.max || 0) + 1\n end", "title": "" }, { "docid": "ad2862980c708def4a61db4dd5a77dbb", "score": "0.6951514", "text": "def get_next_patid\n\t\tself.class.maximum(:patid).to_i + 1\n#\n#\tWhat happens if/when this goes over 4 digits? \n#\tThe database field is only 4 chars.\n#\n\tend", "title": "" }, { "docid": "5347746c48cea9d8be18a6441b0dc49b", "score": "0.6948632", "text": "def gen_seq_number\n 0x0001\n end", "title": "" }, { "docid": "4d604957c2654703e1f312128d344bf6", "score": "0.6948496", "text": "def next_pid\n current_pid_generator_sequence = nil\n\n # Put a read lock on the row, and reload the pid_generator row from the db\n with_lock do\n # Get the current sequence value\n current_pid_generator_sequence = self.sequence\n # Increment the sequence so this number will never be used for generating another PID\n increment(:sequence)\n save\n end\n\n begin\n pid_minter = Noid::Minter.new(template: namespace + ':' + template)\n rescue\n raise 'PID Generator ' + namespace + ' has run out of unique ids. Please use a different PID Generator for future Digital Objects.'\n end\n\n # Use existing seed to generate a new pid\n pid_minter.seed(seed.to_i, current_pid_generator_sequence)\n newly_minted_pid = pid_minter.mint\n\n raise 'Unexpected error during PID generation. Value of pid is nil.' if newly_minted_pid.nil?\n\n newly_minted_pid\n end", "title": "" }, { "docid": "4c97f729d891ad8cd73d5c78f7304ad1", "score": "0.6921801", "text": "def current_seq_id\n @tx_seq_id\n end", "title": "" }, { "docid": "4c97f729d891ad8cd73d5c78f7304ad1", "score": "0.6921801", "text": "def current_seq_id\n @tx_seq_id\n end", "title": "" }, { "docid": "e7000d3f88b302e40fe5994ffcf4f6cd", "score": "0.69114447", "text": "def next_team_number\n # This returns a PGresult object\n # [http://rubydoc.info/github/ged/ruby-pg/master/PGresult]\n result = Team.connection.execute(\"SELECT nextval('team_number_seq')\")\n result[0]['nextval']\n end", "title": "" }, { "docid": "28bd54fef50bdde9812ccd5df7d6167f", "score": "0.6901547", "text": "def next_val_sequence(name)\n val = self.insert_sql(\"INSERT INTO %s_sequence VALUES(NULL)\" % name)\n # In jdbcsqlite, insert_sql is not implemented\n val ||= last_insert_id(\"#{name}_sequence\", nil) rescue nil\n end", "title": "" }, { "docid": "6842cda9b9a9a6da5795c81ffda348a4", "score": "0.6885498", "text": "def fnext_id\n @fnext_id ||= -1\n @fnext_id += 1\n end", "title": "" }, { "docid": "68ae59e318ee198f9054e2f478e67e1e", "score": "0.68738914", "text": "def next\n current_year_prefix = Time.now.strftime(\"%y\")\n number = \"#{ current_year_prefix }001\"\n if self.last[:year_prefix] == current_year_prefix\n number = (self.last[:id].to_i + 1).to_s\n end\n return number\n end", "title": "" }, { "docid": "31bf3fce2c4571d8c683b503f25462ae", "score": "0.6868111", "text": "def get_next_membership_number\n self.class.connection.execute(\"SELECT nextval('membership_number_seq')\").getvalue(0, 0).to_s\n end", "title": "" }, { "docid": "0528ccf66e5055b2e675fb09cb018a61", "score": "0.6844915", "text": "def next_pseudo_random_key_sequence_value\n ActiveRecord::Base.uncached do\n ActiveRecord::Base.connection.select_value(%(SELECT nextval('pseudo_random_key_sequence');)).to_i\n end\n end", "title": "" }, { "docid": "76c964a06e57c32c719a189c7878bc0c", "score": "0.6816422", "text": "def last_insert_id(sequence_name) #:nodoc:\n r = exec_query(\"SELECT currval('#{sequence_name}')\", 'SQL')\n Integer(r.rows.first.first)\n end", "title": "" }, { "docid": "559c24cf967c3adcf5c3b25c95e4fb2e", "score": "0.6784333", "text": "def next_pseudo_random_key_id\n while true\n id = encrypt_integer(next_pseudo_random_key_sequence_value)\n return id unless id < 0\n end\n end", "title": "" }, { "docid": "03dcd9c9604dc6315a995ef300ffd955", "score": "0.6772062", "text": "def next_id\n original = SourceFile.find id, :revs => true\n ids = original[\"_revisions\"][\"ids\"]\n start = self['_revisions']['start']\n index = ids.size - (start + 1)\n \"#{start + 1}-#{ids[index]}\" if index >= 0\n end", "title": "" }, { "docid": "4f4881178273bb3ac8613a6c4e21d1b9", "score": "0.6751226", "text": "def next_job_id\n redis.incr(:next_job_id)\n end", "title": "" }, { "docid": "bc4cc5f54c26165ffdeea88b6b539e08", "score": "0.6737001", "text": "def generate_serial(current_serial)\n current_serial + 1\n end", "title": "" }, { "docid": "9d032750c8a0ff9a8546ebd47d060812", "score": "0.673514", "text": "def next_id(dir)\n local = local_id(dir)\n id = File.readlines(Syctask::ID)[0] if File.exists? Syctask::ID\n id = id ? id.to_i + 1 : 1\n STDERR.puts \"Warning: global id < local id\" if id < local\n id = [id, local].max\n File.open(Syctask::ID, 'w') {|f| f.puts id}\n id \n end", "title": "" }, { "docid": "ac8278d3d4fc8f855a5bd53e4c0f83b8", "score": "0.6726488", "text": "def next\n @next_id += 1\n \"#{@prefix}#{@next_id}\"\n end", "title": "" }, { "docid": "89ee61b1b8ca7b74e115944a711019bd", "score": "0.671586", "text": "def nextFrameID()\n\n\t\t@iNextFrameID += 1\n\n\t\t# if rollover\n\t\t@iNextFrameID = 7 if (222 < @iNextFrameID)\n\n\t\treturn @iNextFrameID\n\n\tend", "title": "" }, { "docid": "e7501716a9ba7acbe20cf3d5dc62869d", "score": "0.6708751", "text": "def seqid\n @seqid\n end", "title": "" }, { "docid": "f9a3d0c6a651895552acd0a4dde79870", "score": "0.67063373", "text": "def next_id(options = {}) \n options.assert_valid_keys(:table)\n table_name = options.delete :table\n\n create_field_or_ensure_type_integer_for(table_name)\n atomic_increment!(table_name)\n end", "title": "" }, { "docid": "da1a525050875b8ea99181384f27c580", "score": "0.67059374", "text": "def next_tracking_id()\n # Using Banksimplistic approach...\n # UUIDTools::UUID.timestamp_create.to_s\n end", "title": "" }, { "docid": "fb3880ad4a089509078609bca768bd7e", "score": "0.67053205", "text": "def next_id\n xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n end", "title": "" }, { "docid": "ed8d45bf7965a41e87de32fe1991b807", "score": "0.6700758", "text": "def next_message_id\n \"%d\" % (Time.now.to_f * 1000)\n end", "title": "" }, { "docid": "a213d2dee66ec7058aaf40e1a13b385f", "score": "0.66928655", "text": "def next_uid\n\t\t\tkey = \"#{@name}/next\"\n\t\t\t@mail_store.next_uid key\n\t\tend", "title": "" }, { "docid": "22210d925b3ab8a3a2e1a22383487be6", "score": "0.6681407", "text": "def increment_id #nodoc\n @_next_id += 1\n end", "title": "" }, { "docid": "22210d925b3ab8a3a2e1a22383487be6", "score": "0.6681407", "text": "def increment_id #nodoc\n @_next_id += 1\n end", "title": "" }, { "docid": "d760911284b8ed99b484b3163900b852", "score": "0.6653285", "text": "def next_stream_id\n\t\t\t\tid = @local_stream_id\n\t\t\t\t\n\t\t\t\t@local_stream_id += 2\n\t\t\t\t\n\t\t\t\treturn id\n\t\t\tend", "title": "" }, { "docid": "426f7768f92761d1528abb423a12ac9f", "score": "0.66497844", "text": "def next_uuid\n @uuids.next\n end", "title": "" }, { "docid": "426f7768f92761d1528abb423a12ac9f", "score": "0.66497844", "text": "def next_uuid\n @uuids.next\n end", "title": "" }, { "docid": "7614f4f8602c39d6ff0d9da20e95eb80", "score": "0.6648155", "text": "def generate_id\n @_last_id ||= 0\n @_last_id += 1\n end", "title": "" }, { "docid": "ae54514e5ffc0e29dc30ea8897a78a2a", "score": "0.6637704", "text": "def next_request_id\n @reqid += 1\n\n # Ensure no larger than uint32_t which is used in xs_wire.h\n @reqid %= MAX_UINT\n end", "title": "" }, { "docid": "2df0f9021b73269ec506d7fc3854afa2", "score": "0.6635502", "text": "def get_next_childid\n\t\tself.class.maximum(:childid).to_i + 1\n\tend", "title": "" }, { "docid": "46988a408249ae9e5c3f312420b78890", "score": "0.66238385", "text": "def next_temp_id\n @id ||= 0\n @id -= 1\nend", "title": "" }, { "docid": "587ca99932829f7ef049d0d94aff34b7", "score": "0.6602345", "text": "def next\n Torid::UUID.new( clock.tick, node_id )\n end", "title": "" }, { "docid": "f233b5cbc8862394b2a6cb37362e916b", "score": "0.6600707", "text": "def nextval\n @schema.select_one \"SELECT \\\"#{@schema_name}\\\".\\\"#{@sequence_name}\\\".NEXTVAL FROM dual\"\n end", "title": "" }, { "docid": "037e48b7d5d8a1ee9ec0b2297e86e119", "score": "0.6592541", "text": "def last_insert_id(table, sequence_name) #:nodoc:\n Integer(select_value(\"SELECT currval('#{sequence_name}')\"))\n end", "title": "" }, { "docid": "c7042b226348960cd464d2a46039aa5a", "score": "0.6586206", "text": "def increment_sequence\n self.sequence += 1\n end", "title": "" }, { "docid": "f6fe7104449d233f5525142331921b1e", "score": "0.65852505", "text": "def next_serial(prefix=nil)\n mutex.synchronize do\n @next_serial_sequence ||= 0\n @next_serial_sequence += 1\n @next_serial_sequence.to_s\n end\n end", "title": "" }, { "docid": "0f5a5cbdd27421f8790ea19c10b5e7c3", "score": "0.657378", "text": "def sequence\n @sequence.to_i\n end", "title": "" }, { "docid": "125f7e955a9c4320c37002ea484b6cf9", "score": "0.65685457", "text": "def next\n @identity = (@identity[0]+1).chr\n end", "title": "" }, { "docid": "5b7f59820f3b62b9b21f01729b2001ee", "score": "0.65632606", "text": "def next_local_id\n @counter ||= 0\n @counter += 1\n # Protect this with a mutex or queue if other threads need it, or\n # use the atomic gem. It's ok in a multiprocess app without mutex,\n # because each process has its own copy.\nend", "title": "" }, { "docid": "fcf0ea236112ed86f1f2a344510a2a83", "score": "0.65572274", "text": "def sequence\n id.to_s.parse_friendly_id(friendly_id_config.sequence_separator)[1]\n end", "title": "" }, { "docid": "45334b63860b2f06010f79bb405ac1f8", "score": "0.654651", "text": "def get_id\n @unique_id = (@unique_id || 0) + 1\n end", "title": "" }, { "docid": "ede9d8422d8484b2b1f16b2356a41bd4", "score": "0.6543976", "text": "def next_id(todos)\n max = todos.map { |todo| todo[:id] }.max || 0\n max + 1\nend", "title": "" } ]
482d5abf0a2a3cce034323fd422888c9
method to determine the raid type
[ { "docid": "38ebcedd0c4b101f70c3d854b59ed3b1", "score": "0.7657814", "text": "def getRaidType\n\t#begin exception handling for method\n\tbegin\n #tries hpacucli command and cleans the output of leading/trailing whitelines\n #and empty elements\n @@raidTypeArray = `sudo hpacucli ctrl slot=0 pd all show status`\n @@raidTypeArray.each do |i|\n @@cleanRaidTypeArray.push(i.strip)\n @@cleanRaidTypeArray.delete_if { |x| x.empty? }\n end\n #check if raid type is HP by checking the first element of array\n #(right now it only checks for HP later checks for different raid type will be added in the future)\n if @@cleanRaidTypeArray[0] =~ /physicaldrive 1I:1:1/ then\n\t #declare HP raid array match\n\t return \"hpacucli\"\n\telse\n\t return \"Raid type not recognized!\"\n\tend\n \n rescue\n\t puts \"Something went wrong in CheckRaidType.getRaidType\\n\\n\\n\"\n\t puts exception.backtrace\n\t raise\n\tend\n end", "title": "" } ]
[ { "docid": "27eccd53398d1f19814a07a7a29cd4bb", "score": "0.787869", "text": "def getRaidType\n require \"CheckRaidType\"\n raidType = CheckRaidType.new\n\treturn raidType.getRaidType\n end", "title": "" }, { "docid": "7891951b09a78b00e9e4f1020270632e", "score": "0.685526", "text": "def raidzarity\n @resource[:raid_parity] ? @resource[:raid_parity] : \"raidz1\"\n end", "title": "" }, { "docid": "c03b23d02acbfc49af902c2928960ccd", "score": "0.6455943", "text": "def ris_type(resource_type)\n case resource_type.first\n when 'Archival and manuscript material'\n 'MANSCPT'\n when 'Audiobook'\n 'SOUND'\n when 'Book'\n 'BOOK'\n when 'Database'\n 'DBASE'\n when 'Dataset -- Statistical'\n 'DATA'\n when 'Dataset -- Geospatial'\n 'DATA'\n when 'Game'\n 'GEN'\n when 'Government publication'\n 'GOVDOC'\n when 'Image'\n 'GEN'\n when 'Journal, Magazine, or Periodical'\n 'SER'\n when 'Kit'\n 'GEN'\n when 'Map'\n 'MAP'\n when 'Music recording'\n 'SOUND'\n when 'Music score'\n 'MUSIC'\n when 'Newspaper'\n 'NEWS'\n when 'Non-musical sound recording'\n 'SOUND'\n when 'Object'\n 'GEN'\n when 'Software/multimedia'\n 'COMP'\n when 'Thesis/Dissertation'\n 'THES'\n when 'Video'\n 'VIDEO'\n when 'Web page or site'\n 'ELEC'\n else\n 'GEN'\n end\n end", "title": "" }, { "docid": "cb22ca79cb661c8a75c4e32c35ed6aab", "score": "0.63239104", "text": "def type_name\n return 'Armor'\n end", "title": "" }, { "docid": "81f0d95de3ed888df58e2f7aae65591f", "score": "0.63204527", "text": "def is_raid_capable\n super\n end", "title": "" }, { "docid": "4257d575f18fe0a7a58875db728478aa", "score": "0.61586595", "text": "def device_ror_type\n self[:type]\n end", "title": "" }, { "docid": "b1c1d7947d4248e8ea0e8b98f84217e2", "score": "0.6055506", "text": "def device_type\n self[:type]\n end", "title": "" }, { "docid": "5729988828091597746bc9e264abe059", "score": "0.6032153", "text": "def determine_lease_type\n return \"user\" if self.inherited_read_users.present?\n group = self.inherited_read_groups.first\n return nil if group.nil?\n return \"ip\" if IPAddr.new(group) rescue false\n return \"local\" if Admin::Group.exists? group\n return \"external\"\n end", "title": "" }, { "docid": "7eb578325ea2ca149c4c1b2e4e16e567", "score": "0.5984384", "text": "def rink_type\n read_attribute(:rink_type).to_sym\n end", "title": "" }, { "docid": "809b795bfb4417f7fbfa05f4687dd0e6", "score": "0.5981753", "text": "def get_type(records)\n # rhd means Remote HD the first product of the Airserver people\n if records.has_key?(\"rhd\")\n :airserver\n else\n :apple_tv\n end\n end", "title": "" }, { "docid": "ef107f75996c49d4b318c71d2c9545b2", "score": "0.5970998", "text": "def device_type\n self[:type]\n end", "title": "" }, { "docid": "25998b7b411fde5a1f747be45af65f3c", "score": "0.596109", "text": "def type(name)\r\n if name =~ /(Arm|Arms|Grimoire|Primary Tool)/i\r\n return \"weapon\"\r\n elsif name =~ /Shield/i\r\n return \"shield\"\r\n elsif name.eql?(\"Ring\")\r\n return \"ring#{ring_inc}\"\r\n else\r\n return Helper.replace_downcase(name)\r\n end\r\n end", "title": "" }, { "docid": "86fded94102444ba62dcf808051d0c59", "score": "0.5934861", "text": "def ntype\n 'Ai4r'\n end", "title": "" }, { "docid": "d759709df84e9dc04faaffd5ba083891", "score": "0.5918635", "text": "def device_type\n self[:type]\n end", "title": "" }, { "docid": "cf4162cce01f92917149254a4dfd3cdf", "score": "0.5897307", "text": "def rase_type\n unit_cards.first.rase_type if deck_cards.any?\n end", "title": "" }, { "docid": "eb59183a5c6b98cbfd3e1e5d5dbf1d85", "score": "0.58906674", "text": "def system_type()\n case identifier\n when \"pine64-pinephone\", \"pine64-pinetab\", \"pine64-pinephonepro\"\n return \"u-boot\"\n when \"lenovo-krane\", \"lenovo-wormdingler\", \"asus-dumo\"\n return \"depthcharge\"\n end\n\n # Safe~ish default\n return \"uefi\" if is_uefi\n\n raise \"Aborting: Unknown system type....\"\n end", "title": "" }, { "docid": "5ee9e7e5ce4edba4ac57d2e79a2030a8", "score": "0.58848023", "text": "def card_type\n length_of_card = @card_number.length()\n if length_of_card == 15 && @card_number =~ /^(34|37)/\n card_type = \"AMEX:\"\n elsif length_of_card == 16 && @card_number =~ /^6011/\n card_type = \"Discover:\"\n elsif length_of_card == 16 && @card_number =~ /^5[1-5]/\n card_type = \"MasterCard:\"\n elsif (length_of_card == 13 || length_of_card == 16) && @card_number =~ /^4/\n card_type = \"VISA:\"\n else\n card_type = \"Unknown:\"\n end\n card_type\n end", "title": "" }, { "docid": "323ad05211897209b2d4342078ec948d", "score": "0.5883168", "text": "def ami(type)\n case type\n when 'm1.small_base' then AMI32_BASE\n when 'm1.large_base' then AMI64_BASE\n when 'm1.small' || 'c1.medium' then AMI32\n else AMI64\n end\nend", "title": "" }, { "docid": "35c1023a9ff6198b9eba1adadc776326", "score": "0.5873844", "text": "def sim_card_type\n self[:type]\n end", "title": "" }, { "docid": "8f8246850f941d1610043d6e2ddcd36a", "score": "0.5821947", "text": "def armor?\n @type_id == 2\n end", "title": "" }, { "docid": "62be90cfdaa8dce0c01dd9b340bbe456", "score": "0.5819082", "text": "def ia_rec_type\n case @sierra.bcode1\n when 's', 'b'\n 'serial'\n when 'a', 'c', 'm'\n 'mono'\n end\n end", "title": "" }, { "docid": "edeb5d256bbb9d5d8278a4c8d62294f2", "score": "0.5783724", "text": "def jid_type( jid )\n type = @helpers[:roster].jid_type( jid )\n if ! type\n muc = @mucs[ jid.strip ]\n if ! muc.nil?\n if jid.strip == jid\n type = :muc\n \t elsif muc.role(jid.resource) == :moderator \n type = :admin\n else\n type = :bot\n end\n end\n end\n type = :unknown if ! type\n type\n end", "title": "" }, { "docid": "7a121259217d6443dd54d901f0fc5718", "score": "0.5766465", "text": "def fuel_type; 'R' end", "title": "" }, { "docid": "a70bce97b578d7a45f6c3c7e7dfe9652", "score": "0.5764726", "text": "def item_type(item)\n case item.class\n when RPG::Item\n 1\n when RPG::Weapon\n 2\n when RPG::Armor\n 3\n when RPG::Fake_Item\n 1\n else\n 0\n end\n end", "title": "" }, { "docid": "2c75b856f3cfa9746c26fdcdbf6e56c9", "score": "0.57391244", "text": "def type\n DEVICE_TYPE.key(@data['deviceType'])\n end", "title": "" }, { "docid": "06712dfaa3dd15545b0512283050d14c", "score": "0.57189757", "text": "def convert_type(type)\n case type.downcase\n when \"file\" then return \"hdd\"\n when \"block\" then return \"hdd\"\n when \"swap\" then return \"hdd\"\n when \"cdrom\" then return \"dvddrive\"\n else return \"hdd\"\n end\n end", "title": "" }, { "docid": "b2ad8d0d5f1dd8221c381897432f2f44", "score": "0.57066226", "text": "def assign_type\n if @player1.deck.rank_of_card_at(0) != @player2.deck.rank_of_card_at(0)\n return :basic\n elsif @player1.deck.rank_of_card_at(2) != @player2.deck.rank_of_card_at(2)\n return :war\n else\n return :mutually_assured_destruction\n end\n end", "title": "" }, { "docid": "883af21d7c606f2cdd3f6c66e545e20e", "score": "0.5705716", "text": "def armor_class\r\n value = stat(:armor_class)\r\n if @base_armor_class\r\n value += @base_armor_class\r\n end\r\n return value\r\n end", "title": "" }, { "docid": "f8e18ce33826101d2dcfe397ae790d2a", "score": "0.5701272", "text": "def materialType\n end", "title": "" }, { "docid": "d8b29ed2ed268d8c960ff722de8820b1", "score": "0.56954104", "text": "def type(srtype)\n self.find { |s_r| s_r.type==srtype}\n end", "title": "" }, { "docid": "d8b29ed2ed268d8c960ff722de8820b1", "score": "0.5694487", "text": "def type(srtype)\n self.find { |s_r| s_r.type==srtype}\n end", "title": "" }, { "docid": "5226e47d4464d462b03c74e2c94aa404", "score": "0.56900537", "text": "def carica_armor_tipo\n $data_armors.each {|armor|\n next if armor == nil\n armor.load_skill_requirements\n }\n end", "title": "" }, { "docid": "d123154bf2a23a44a0c2f6fabffb1fc0", "score": "0.56810015", "text": "def get_type\n\t\treturn @type\n\tend", "title": "" }, { "docid": "d123154bf2a23a44a0c2f6fabffb1fc0", "score": "0.56810015", "text": "def get_type\n\t\treturn @type\n\tend", "title": "" }, { "docid": "98f2359683cb356bec0b645dad344b98", "score": "0.56771976", "text": "def material_type\n attributes['material_type']\n end", "title": "" }, { "docid": "a2ba286cadb78307cc1f0a9decfac6f5", "score": "0.56768703", "text": "def type\n if @player1.deck.rank_of_card_at(0) != @player2.deck.rank_of_card_at(0)\n :basic\n elsif @player1.deck.rank_of_card_at(0) == @player2.deck.rank_of_card_at(0) && @player1.deck.rank_of_card_at(2) == @player2.deck.rank_of_card_at(2)\n :mutually_assured_destruction\n elsif @player1.deck.rank_of_card_at(0) == @player2.deck.rank_of_card_at(0)\n :war\n end\n end", "title": "" }, { "docid": "0c43743edcc801e2a53cda87647e8f49", "score": "0.5675733", "text": "def person_type\n person_type = 'member' if former_mp?\n person_type = 'lord' if former_lord?\n person_type = 'member' if current_mp?\n person_type = 'lord' if current_lord?\n person_type\n end", "title": "" }, { "docid": "8b13ab73ad80c6c8d9ab9eb611fe99b2", "score": "0.56648743", "text": "def type\n \"ROOK\"\n end", "title": "" }, { "docid": "16062f13e36988462c8cd41d5e80b3a1", "score": "0.56590426", "text": "def type\n if @rank == 'K' || @rank == 'Q' || @rank == 'J'\n :face\n elsif @rank == 'A'\n :ace\n else\n :number\n end\n end", "title": "" }, { "docid": "785fedf73ee6aae5649de462b5cd5a6f", "score": "0.56586117", "text": "def get_type\n @type\n end", "title": "" }, { "docid": "03acc8f24a5521f5dbc795bf36153004", "score": "0.56532896", "text": "def lldp_chassis_id_type; self[:lldp_chassis_id_type].to_i; end", "title": "" }, { "docid": "738f5a012cee1c063dbd0c2a227c5234", "score": "0.56461066", "text": "def rhizome_type_name\n 'rims'\n end", "title": "" }, { "docid": "2884f100bc71878b6f8e3a592ba44a73", "score": "0.5632103", "text": "def determine_storage_type(id)\n return 'system' if id =~ /^.*-S-\\d\\d\\d\\d/\n return 'data' if id =~ /^.*-D-\\d\\d\\d\\d/\n return 'unknown'\n end", "title": "" }, { "docid": "26ba79a68ea5779fb8617a0b41b59b24", "score": "0.5630351", "text": "def type\n return 'regional' if (self.name.downcase.include?('regional'))\n return 'district' if (self.name.downcase.include?('district'))\n return 'local' if (self.name.downcase.include?('local'))\n return 'none'\n end", "title": "" }, { "docid": "44977e73de9dcf2f19a1886850328a0b", "score": "0.5628902", "text": "def get_type\r\n @classification\r\n end", "title": "" }, { "docid": "eda50264bb6b3955240602126b829692", "score": "0.5622002", "text": "def node_type\n @cluster.node_type\n end", "title": "" }, { "docid": "880426e558905d1bc9bb68c65b42629f", "score": "0.5621111", "text": "def gettype\n\t\treturn @type\n\tend", "title": "" }, { "docid": "a8a53697a1d67a3242486cdaf18575d5", "score": "0.56189406", "text": "def type\n @info[9]\n end", "title": "" }, { "docid": "1553d22acbe03503773b20f449a2084a", "score": "0.56129616", "text": "def type\n\t\t@type\n\tend", "title": "" }, { "docid": "1553d22acbe03503773b20f449a2084a", "score": "0.56129616", "text": "def type\n\t\t@type\n\tend", "title": "" }, { "docid": "db2d29d4f3e2c581ddefd66e0dca417e", "score": "0.5611066", "text": "def type_of(id)\n id = id.to_sym\n DATA_NOEUDS[id][:type]\nend", "title": "" }, { "docid": "2543688eb350e84489725e2419b607f8", "score": "0.5609077", "text": "def type_class\n case @type\n when :item then Game_IItem\n when :weapon then Game_IWeapon\n when :armor then Game_IArmor\n end\n end", "title": "" }, { "docid": "eca533da8735ee45fda03ef6d511855b", "score": "0.5603861", "text": "def instruction_type\n\t\[email protected]_mnem(@ea)\n\t\[email protected]\n\tend", "title": "" }, { "docid": "a77880842ad712e0dc883dd06cb644a9", "score": "0.5599131", "text": "def draw_etype_detail\n @item.is_a?(RPG::Weapon) ? draw_weapon_type : draw_armor_type\n end", "title": "" }, { "docid": "1a7410f079d9baaa9be6d9944fca6de4", "score": "0.55966055", "text": "def type\n read_attribute(:type)\n end", "title": "" }, { "docid": "5eed0ca3530cc77dcdb1fe63d40b25c2", "score": "0.55948216", "text": "def card_type\n return 'AMEX' if is_amex_card?\n return 'Discover' if is_discover_card?\n return 'MasterCard' if is_mastercard_card?\n return 'VISA' if is_visa_card?\n 'Unknown'\n end", "title": "" }, { "docid": "e5869b0d2e7ecd116744b6dbc3a79d45", "score": "0.55874205", "text": "def primary_device_type_name\n if primary_device_id.present?\n Logan::Application.config.device_mappings.rassoc(primary_device_id)[0].to_s\n end\n end", "title": "" }, { "docid": "9eab445969d552b83ece9d366e61b8b3", "score": "0.5581074", "text": "def type\n if @node.include? 'aips'\n 'aip'\n else\n 'dip'\n end\n end", "title": "" }, { "docid": "9eab445969d552b83ece9d366e61b8b3", "score": "0.5581074", "text": "def type\n if @node.include? 'aips'\n 'aip'\n else\n 'dip'\n end\n end", "title": "" }, { "docid": "2f08921728e74de36d7f5e48a66591df", "score": "0.55801386", "text": "def type\n\n if (@player1.deck.rank_of_card_at(0) && @player1.deck.rank_of_card_at(2)) == (@player2.deck.rank_of_card_at(0) && @player2.deck.rank_of_card_at(2))\n :mutually_assured_destruction\n\n elsif (@player1.deck.rank_of_card_at(0) == @player2.deck.rank_of_card_at(0))\n :war\n\n elsif (@player1.deck.rank_of_card_at(0) != @player2.deck.rank_of_card_at(0))\n :basic\n end\n end", "title": "" }, { "docid": "3d123439377a638191297107496815bf", "score": "0.55784595", "text": "def create_type\n\t\t#randomly room's type decided.\n\t\tnumber = @@counter %3\n\t\tif number == 0\n\t\t\t@type = \"forager\"\n\t\telsif number == 1\n\t\t\t@type = \"builder\"\n\t\telse\n\t\t\t@type = \"warrior\"\n\t\tend\n\t\t\t\n\t\t@@counter += 1\n\tend", "title": "" }, { "docid": "16fb9f81c213656fc6fc41787a091124", "score": "0.55784506", "text": "def lcd_type\n return @lcd_type unless @lcd_type.nil?\n\n # Request LCD module type\n send_command( 0x37 )\n\n # Read back one byte\n type = getc\n if TYPEMAP.has_key?(type)\n @lcd_type = TYPEMAP[type]\n else\n @lcd_type = \"Unknown-#{type}\"\n end\n end", "title": "" }, { "docid": "c0b39cb4a52913f8f150261b1ad6b189", "score": "0.5573741", "text": "def human_device_type_name(device_id)\n Logan::Application.config.device_mappings.rassoc(device_id)[0].to_s; rescue; 'Unknown/No selection'\n end", "title": "" }, { "docid": "4c0679f98744429a9c33e5c9fc89218d", "score": "0.5570416", "text": "def roomtype\n return number + \" - \" + room_type.name + \" # \" + room_type.baserate.to_s\n end", "title": "" }, { "docid": "9e9e822bb94189453b7bf5811129e052", "score": "0.5564077", "text": "def get_game_type\n if :survivor.to_s == self.game_type\n return :survivor\n elsif :anti_survivor.to_s == self.game_type\n return :anti_survivor\n elsif :high_roller.to_s == self.game_type\n return :high_roller\n elsif :second_chance.to_s == self.game_type\n return :second_chance\n else\n return nil\n end\n end", "title": "" }, { "docid": "435d557d316982f17f4e4a9f7be82ed7", "score": "0.5546423", "text": "def type\n \"gom\"\n end", "title": "" }, { "docid": "1694389342ef11cbacafe9a3688cfdbc", "score": "0.55463034", "text": "def process_subtype(name)\n if name == \"Energy\"\n name = \"Special Energy\"\n elsif name == \"Special\"\n name = \"Ace-Spec\"\n end\n\n return name\nend", "title": "" }, { "docid": "4951b05ab4dd82f75f44c91c46800b8f", "score": "0.55459607", "text": "def get_rec_area(raid)\n sraid = raid.to_s\n unless @rec_areas.has_key?(sraid)\n ra = ridb.get_rec_area(sraid)\n return nil if ra.nil?\n @rec_areas[sraid] = ra\n end\n\n @rec_areas[sraid]\n end", "title": "" }, { "docid": "1cd79fa28f2e04ec168f41a2450267de", "score": "0.55424416", "text": "def human_device_type_name(device_id)\n Cohorts::Application.config.device_mappings.rassoc(device_id)[0].to_s; rescue; 'Unknown/No selection'\n end", "title": "" }, { "docid": "353c502559f081a981b7a6b5b0c59418", "score": "0.5526577", "text": "def chamber_type\n self[:type]\n end", "title": "" }, { "docid": "e7a501916154ff4de01b59121573e458", "score": "0.5525026", "text": "def resource_type\n return self.get(\"type_of_resource_ssm\")\n end", "title": "" }, { "docid": "d76e30d43e3789764a5b5297c8ae046e", "score": "0.55146855", "text": "def type\n return @type\n end", "title": "" }, { "docid": "7edd1ee000d89d8d05138eb0769d882e", "score": "0.55008787", "text": "def type_of_node_as_code\n %w[STANDALONE_MNT_NODE ACTIVE_MNT_NODE BACKUP_MNT_NODE NOT_AN_MNT_NODE][@type_of_node.to_i] ||= \"Unknown node value of #{@type_of_node}\"\n end", "title": "" }, { "docid": "b55cdf2610a00b795fc06ded66aab02a", "score": "0.54964125", "text": "def record_type(marc)\n type = marc.leader[6,1]\n blvl = marc.leader[7,1]\n valid_types = ['a','t','g','k','r','o','p','e','f','c','d','i','j','m']\n rec_types = {\n 'BKS' => { :type => /[at]{1}/,\t:blvl => /[acdm]{1}/ },\n 'SER' => { :type => /[a]{1}/,\t:blvl => /[bs]{1}/ },\n 'VIS' => { :type => /[gkro]{1}/,\t:blvl => /[abcdms]{1}/ },\n 'MIX' => { :type => /[p]{1}/,\t:blvl => /[cd]{1}/ },\n 'MAP' => { :type => /[ef]{1}/,\t:blvl => /[abcdms]{1}/ },\n 'SCO' => { :type => /[cd]{1}/,\t:blvl => /[abcdms]{1}/ },\n 'REC' => { :type => /[ij]{1}/,\t:blvl => /[abcdms]{1}/ },\n 'COM' => { :type => /[m]{1}/,\t:blvl => /[abcdms]{1}/ }\n } \n \n rec_types.each_key do | rec_type |\n return rec_type if type.match(rec_types[rec_type][:type]) and blvl.match(rec_types[rec_type][:blvl])\n end \n end", "title": "" }, { "docid": "4762d7d7c083ab2319f9aeabcc666476", "score": "0.5493128", "text": "def role4api\n self.type.to_s\n end", "title": "" }, { "docid": "f81b7b1f1af622340628af14f6450210", "score": "0.5492488", "text": "def draw_armor_type\n name = Vocab::EQ_TYPE\n value = $data_system.armor_types[@item.atype_id]\n draw_detail(value, name)\n end", "title": "" }, { "docid": "302e884435b1aba696b413a06501d6dd", "score": "0.54912424", "text": "def type\n @type ||= self.class.to_s.downcase.sub( /account/, '' )\n end", "title": "" }, { "docid": "9f3b62d61517bd33b5c74a2da16a1e4e", "score": "0.5484618", "text": "def type\n @type ||= self.class.to_s.downcase.sub( /resource/, '' )\n end", "title": "" }, { "docid": "64f74fe1064a41b514e8727f4805022f", "score": "0.5478469", "text": "def type()\n\t\t\treturn @type\n\t\tend", "title": "" }, { "docid": "e4bcdf63b3f9b523382389e0caf69a33", "score": "0.5477548", "text": "def resourceType\n 'SubstanceNucleicAcid'\n end", "title": "" }, { "docid": "968ac2dd7bd3b9a49f4eea5c3deb5448", "score": "0.5474744", "text": "def getType\n\t\tend", "title": "" }, { "docid": "1973bd13a97e86446df957a58725b4e8", "score": "0.54744667", "text": "def raid_level=(raid_level)\n validator = EnumAttributeValidator.new('String', [\"N/A\", \"RAID1\", \"RAID5\", \"RAID6\"])\n unless validator.valid?(raid_level)\n fail ArgumentError, \"invalid value for \\\"raid_level\\\", must be one of #{validator.allowable_values}.\"\n end\n @raid_level = raid_level\n end", "title": "" }, { "docid": "8a4af664aec223af9f1f0cb8f1d79081", "score": "0.5473253", "text": "def type\n\t\treturn @type\n\tend", "title": "" }, { "docid": "f6ebe35023b6f6205d1eb710eeb47f3e", "score": "0.5472164", "text": "def get_record_type(line)\n return nil if line.nil?\n return nil if line.strip.empty?\n if @record_type_labels.is_a?(Hash)\n matching_pair = @record_type_labels.find do |_, value|\n discriminator = value[:discriminator]\n position = value[:position] - 1\n line[position..-1].start_with?(discriminator)\n end\n if matching_pair\n matching_pair[0]\n else\n nil\n end\n else\n @record_type_labels\n end\n end", "title": "" }, { "docid": "2c97bda0139b8f92d4beec4b6ca1f55a", "score": "0.54715025", "text": "def primary_device_type_name\n if primary_device_id.present?\n Cohorts::Application.config.device_mappings.rassoc(primary_device_id)[0].to_s\n end\n end", "title": "" }, { "docid": "e31de6ee9bcc7856f26e689cbfda8382", "score": "0.547091", "text": "def get_item_type\n base_name = type_line\n G_BASE_NAMES.each_pair do |categorie, types|\n types.each_pair do |type, base_names|\n if base_names.find { |bn| base_name.include?(bn) }\n log type\n return type.classify\n end\n end\n end\n nil\n end", "title": "" }, { "docid": "36f2b9a3cca5f95ce5342ea4dbd601bf", "score": "0.5469491", "text": "def type\n\t\t\tend", "title": "" }, { "docid": "8c17f122b5da60a4d1dcf65ca38c6bbf", "score": "0.5466225", "text": "def membership_type\r\n case ((platform.nil?) ? '' : platform.slug.to_s)\r\n when 'ps4', 'ps3'\r\n 2\r\n when 'xbox360', 'xboxone'\r\n 1\r\n else\r\n 254\r\n end\r\n end", "title": "" }, { "docid": "ee0a7fb32d3a9ce1de0263a52a88c8d6", "score": "0.5464051", "text": "def get_type\n return \"misc\" if basedir =~ /\\/misc\\// || basedir =~ /\\/misc$/\n return \"nature\" if basedir =~ /\\/nature\\//\n return \"podcasts\" if basedir =~ /\\/podcasts\\//\n return \"soundtracks\" if basedir =~ /\\/soundtracks\\//\n return \"music\"\n end", "title": "" }, { "docid": "d2e3d3fcc558e1dfe6f465402b9b3844", "score": "0.5463314", "text": "def resource_type\n data.resource_type\n end", "title": "" }, { "docid": "d2e3d3fcc558e1dfe6f465402b9b3844", "score": "0.5463314", "text": "def resource_type\n data.resource_type\n end", "title": "" }, { "docid": "bcf49f03ace2e118a43272adb6d330e5", "score": "0.5462555", "text": "def check_type\n\t\tcase self.piece\n\t\twhen \"♖\",\"♜\"\n\t\t\t@type=\"rook\"\n\t\t\treturn \"rook\"\n\t\twhen \"♝\",\"♗\"\n\t\t\t@type=\"bishop\"\n\t\t\treturn \"bishop\"\n\t\twhen \"♘\",\"♞\"\n\t\t\t@type=\"knight\"\t\n\t\t\treturn \"knight\"\n\t\twhen \"♕\",\"♛\"\n\t\t\t@type=\"king\"\n\t\t\treturn \"king\"\n\t\twhen \"♔\",\"♚\"\n\t\t\t@type=\"queen\"\n\t\t\treturn \"queen\"\n\t\twhen \"♙\",\"♟\"\n\t\t\t@type=\"pawn\"\n\t\t\treturn \"pawn\"\n\t\t\n\t\telse\n\t\t\treturn \"empty\"\n\t\tend\n\tend", "title": "" }, { "docid": "2a8c41b9659470f0da072c9e9da387a7", "score": "0.5459474", "text": "def random_type\n # Type is randomly selected given the approximate distribution of types:\n type_random_sample = rand\n if type_random_sample > 0.67\n :heavy\n elsif type_random_sample <= 0.67 && type_random_sample > 0.21\n :large\n else\n :small\n end\n end", "title": "" }, { "docid": "526f35f13b5102a6f07471afb0fffbd3", "score": "0.5455242", "text": "def family\n read_attribute(:type)\n end", "title": "" }, { "docid": "8c5f8555bb08e91af6e0c76127b1ab45", "score": "0.545484", "text": "def transaction_type(patron_group, item_type)\n if internal_patron_groups.include?(patron_group)\n 'internal'\n elsif scsb_item_types.include?(item_type)\n 'scsb_borrow'\n elsif scsb_patron_groups.include?(patron_group)\n 'scsb_lend'\n elsif local_edd_patron_groups.include?(patron_group)\n 'local_edd'\n elsif scsb_edd_patron_groups.include?(patron_group)\n 'scsb_edd'\n elsif bd_item_types.include?(item_type)\n 'bd_borrow'\n elsif bd_patron_groups.include?(patron_group)\n 'bd_lend'\n elsif ill_patron_groups.include?(patron_group)\n 'ill_lend'\n else\n 'local'\n end\nend", "title": "" }, { "docid": "e6740281d46cca4214ed75ac029b023f", "score": "0.54544306", "text": "def tier_type\n tier_class.kind if tier_class\n end", "title": "" }, { "docid": "5f6687307e6827e868e9763333ebbbc1", "score": "0.54530907", "text": "def dwc_type_status\n type_materials.all.collect{|t|\n ApplicationController.helpers.label_for_type_material(t)\n }.join(CollectionObject::DWC_DELIMITER).presence\n end", "title": "" }, { "docid": "80b59b56e65bf8b8ecfdda60c21c0707", "score": "0.5449537", "text": "def device_ror_type=(s)\n self[:type] = s\n end", "title": "" }, { "docid": "b72b3d7735383e803cb7f532c72fbdc5", "score": "0.54431146", "text": "def card_type\n remainder = self.card_number%13\n case remainder\n when 1\n 'Ace'\n when 11\n 'Jack'\n when 12\n 'Queen'\n when 0\n 'King'\n else\n remainder.to_s\n end\n end", "title": "" }, { "docid": "bd570f6ae9db9c0baf176b3f36ff289a", "score": "0.544", "text": "def set_dungeon_type\n @dungeon_type = DungeonType.find(params[:id])\n end", "title": "" } ]
202a2544e24fe015ff3545358889bdf4
verify_file > true or false Verifies if input or output file matches the provided MD5 Hash
[ { "docid": "77af61a20c4895ea2beb4a0490c5bc1c", "score": "0.7086279", "text": "def verify_file(mode, header_hash)\n # Select mode\n case mode\n when :IN\n hash_hex = header_hash['OH'].dup\n file_handle = open_in_file @file_in_path\n file_handle.seek FILE_HEADER_BYTES\n when :OUT\n hash_hex = header_hash['FH'].dup\n file_handle = open_in_file @file_out_path\n else\n raise StandardError.new 'Unsupported file type. Must be :IN or :OUT'\n end\n\n # Endianess?\n 1.upto(15) do |i|\n hash_hex[2*i] = hash_hex[3*i]\n hash_hex[2*i+1] = hash_hex[3*i+1]\n end\n hash_hex = hash_hex[0..31]\n\n # Read file and hash it\n md5 = Digest::MD5.new\n begin\n while (data = file_handle.readpartial(BUFFER_SIZE))\n md5 << data\n end\n rescue EOFError\n # Okay, read to the end\n ensure\n file_handle.close\n end\n hash_hex == md5.hexdigest.upcase\n end", "title": "" } ]
[ { "docid": "a824d76c3decd89920ba0539f9952cbc", "score": "0.7232748", "text": "def verify_checksum(filename)\n if options[:sha256]\n verify_sha256_hash(filename, options[:sha256])\n elsif options[:sha1]\n verify_sha1_hash(filename, options[:sha1])\n end\n end", "title": "" }, { "docid": "ac94d0eac97db9e1e81b4ef5ec337ddd", "score": "0.7232125", "text": "def verifyMD5sum\n\n oldMD5sum = ''\n \n self.audioMD5sum if ! @audioMD5sum # compute MD5sum if it's not computed yet\n\n base = @basename.sub( /(.)\\.[^.]+$/ , '\\1') # remove suffix from audio-file\n base += '.md5' # add new suffix .md5\n md5name = File.join(@dirname,base)\n \n # if a MD5-file doesn't exist, we should create one and return TRUE ...\n if File.exists?(md5name)\n File.open( md5name ,\"r\") { |f| \n oldname,oldMD5sum = f.readline.split # read old MD5-sum\n }\n else\n oldMD5sum = self.writeMD5sum # create MD5-file and return true..\n end\n @audioMD5sum == oldMD5sum\n \n end", "title": "" }, { "docid": "f7ddd4f71f6b2937d804d471d7768846", "score": "0.7040518", "text": "def check_for_correct_output\n\t\tif Digest::MD5.hexdigest(File.read(OUTFILE)) == CORRECT_MD5\n\t\t\tputs 'Output is correct!'\n\t\telse\n\t\t\tputs 'Output is incorrect. Continue debugging.'\n\t\tend\n\tend", "title": "" }, { "docid": "f34a8658181170da242a8bd27da241b2", "score": "0.68566316", "text": "def validate_image_md5sum\n result = true\n if upload_md5sum.present? && save_to_temp_file\n sum = File.open(upload_temp_file) do |f|\n Digest::MD5.hexdigest(f.read)\n end\n if sum == upload_md5sum\n result = true\n else\n errors.add(:image, :validate_image_md5_mismatch.\n t(actual: sum.split.first, expect: upload_md5sum))\n result = false\n end\n end\n result\n end", "title": "" }, { "docid": "5fdd79fc023e3946efd5206639f24756", "score": "0.6850892", "text": "def digestmd5(file2md5)\n if not ::File.exists?(file2md5)\n raise \"File #{file2md5} does not exists!\"\n else\n require 'digest/md5'\n chksum = nil\n chksum = Digest::MD5.hexdigest(::File.open(file2md5, 'rb') { |f| f.read })\n return chksum\n end\n end", "title": "" }, { "docid": "102132bb9e6bbde16031f4884deceb62", "score": "0.67434037", "text": "def md5_check(file_path, file_md5)\n m = Digest::MD5.file(file_path)\n return true if m.hexdigest == file_md5\n false\n end", "title": "" }, { "docid": "89b551901caf91e33327b4f70404c24f", "score": "0.66671306", "text": "def file_remote_digestmd5(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::MD5.hexdigest(data)\n end\n return chksum\n end", "title": "" }, { "docid": "f9d08d2db4e379c294d4f3e3afa624bc", "score": "0.6601199", "text": "def verify_out_file\n header_hash = get_header\n verify_file(:OUT, header_hash)\n end", "title": "" }, { "docid": "33ad8681dfbda9b3124a571824dd9e80", "score": "0.6476842", "text": "def validate_downloaded_file(file_path:, checksum:)\n return false unless file_path.present? && checksum.present? && File.exist?(file_path)\n\n puts 'Validating file against expected checksum...'\n\n checksum = checksum[4..] if checksum.starts_with?('md5:')\n\n actual_checksum = Digest::MD5.file(file_path).to_s\n actual_checksum == checksum\n end", "title": "" }, { "docid": "fb7ac66277927a4b08f4f88abe138e63", "score": "0.6414819", "text": "def quick_verify\n cached_md5 == remote_md5 and remote_md5 == md5\n end", "title": "" }, { "docid": "5114179a741e15f47c7d01c765eb0b0f", "score": "0.6376902", "text": "def verify_md5_hash?(url, expected_hash, secret_key)\n url_no_hash = \"#{url[ 0..-33 ]}#{secret_key}\"\n actual_hash = Digest::MD5.hexdigest(url_no_hash)\n\n return (expected_hash == actual_hash)\n end", "title": "" }, { "docid": "a429abc0306b35d255aedc5c99276be3", "score": "0.6369836", "text": "def file_verified?(path, expected_digest, digest_type=:md5)\n return false unless file_exists?(path)\n raise \"Unknown disgest type: #{digest_type}\" unless can?(\"digest_#{digest_type}\")\n digest = self.send(\"digest_#{digest_type}\", path).first\n info \"#{digest_type} (#{path}) = #{digest}\"\n digest.to_s == expected_digest.to_s\n end", "title": "" }, { "docid": "ec13fb879ba604da16b835c8701a1e8c", "score": "0.63457996", "text": "def verify_update_file\n @log.info('Beginning integrity check of downloaded file .')\n @file_sha1 = Digest::SHA1.file(@update_file.path).hexdigest\n\n @log.info('Verifying integrity of downloaded file.')\n\n if download_remote_sha1 == @file_sha1\n @log.info('Integrity verified.')\n true\n else\n abort('File was not downloaded correctly. Please try again.')\n end\n end", "title": "" }, { "docid": "6bf61892d774ec260f433b620087fca3", "score": "0.633614", "text": "def verify( file, against = nil )\n return ( against ? against.verify( file ) : true )\n end", "title": "" }, { "docid": "22a18e1f599c73b088b1b5775fbdf0f8", "score": "0.6323721", "text": "def validateMD5Hash(data, hash)\n\t\tnewhash = self.createMD5Hash(data)\n\t\tif newhash == hash\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "a9b3be69663dbe0b49b647854e4fbe52", "score": "0.6295918", "text": "def verify_sha1_hash(filename, hash)\n require 'digest/sha1'\n compare_hash(filename, Digest::SHA1, hash)\n end", "title": "" }, { "docid": "545466fe9c94a5a29454396a50400e9b", "score": "0.62955785", "text": "def file_outdated?(path, expected_md5sum)\n return true unless File.exist?(path)\n\n md5 = Digest::MD5.new\n File.open(path, \"r\") do |file|\n while (chunk = file.read(1024))\n md5.update chunk\n end\n end\n md5.to_s != expected_md5sum\n end", "title": "" }, { "docid": "98e06422db28f597bb2113d61c83abe8", "score": "0.6291448", "text": "def verify_hash_action_notify( file )\n hash = @hasher.generate_hash( file )\n res = @dbase.search_hashes( file ) \n\n unless hash.to_s.eql?( res[\"hash\"] ) \n \n puts \"Host:\\t\\t#{res[\"host\"]}\"\n puts \"File:\\t\\t#{file}\"\n puts \"Database date:\\t#{res[\"date\"]}\"\n puts \"Current date:\\t#{Time.now}\"\n puts \"Old hash:\\t#{res[\"algo\"]},\\t#{res[\"hash\"]}\"\n puts \"New hash:\\t#{@hasher.algo},\\t#{hash.to_s}\"\n puts \"\"\n \n end\nend", "title": "" }, { "docid": "f8945483b7d7efdb70472bbd2d61842a", "score": "0.6232532", "text": "def verify_checksum!\n log.info(log_key) { \"Verifying checksum\" }\n\n expected = checksum\n actual = digest(downloaded_file, digest_type)\n\n if expected != actual\n raise ChecksumMismatch.new(self, expected, actual)\n end\n end", "title": "" }, { "docid": "f10f00823a7e2c9ff0991725909f4c7c", "score": "0.62096274", "text": "def verify_file(path, mac, key)\n hmac = OpenSSL::HMAC.new(key, OpenSSL::Digest::SHA256.new)\n file_chunks(path, @salt_len, @mac_len).each do |chunk|\n hmac.update chunk\n end\n unless constant_time_comparison(mac, hmac.digest)\n raise ArgumentError, 'MAC check failed!'\n end\n end", "title": "" }, { "docid": "2a001a821fd0fa83122e08a041e30ebf", "score": "0.6173512", "text": "def validate_checksum(file_to_check)\n # desired = fetch_checksum\n desired = ::File.read(\"#{Chef::Config['file_cache_path']}/#{new_resource.tarball_name}.md5\").split.last\n actual = Digest::MD5.hexdigest(::File.read(file_to_check))\n\n if desired == actual\n true\n else\n Chef::Log.fatal(\"The checksum of the splunk tarball on disk (#{actual}) does not match the checksum provided from the mirror (#{desired}). Renaming to #{::File.basename(file_to_check)}.bad\")\n ::File.rename(file_to_check, \"#{file_to_check}.bad\")\n raise\n end\n end", "title": "" }, { "docid": "27ee6c4f9195f8645032efdb30ad2de8", "score": "0.61508924", "text": "def file_remote_digestsha2(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA256.hexdigest(data)\n end\n return chksum\n end", "title": "" }, { "docid": "97190ae4e3faaddcc399c8353118e45c", "score": "0.61446023", "text": "def verify_in_file\n header_hash = get_header\n verify_file(:IN, header_hash)\n end", "title": "" }, { "docid": "62e2703d8f33c8f13588fa9bc561a508", "score": "0.6083075", "text": "def verify_sha256_hash(filename, hash)\n require 'digest/sha2'\n compare_hash(filename, Digest::SHA2, hash)\n end", "title": "" }, { "docid": "c88e56863fc7be4ae876bad1458ad3b6", "score": "0.6032656", "text": "def check_hash(file, hash)\n if !hash.nil? && File.file?(file)\n computed_h = Digest::SHA256.file(file)\n true if hash.casecmp(computed_h.hexdigest).zero?\n else\n false\n end\n end", "title": "" }, { "docid": "282dced8513989dbfa4cc3864b9ac267", "score": "0.6024161", "text": "def hash(handle, offset, length, block_size=0)\n if block_size != 0 && block_size < 255\n block_size = 256\n end\n send_request(FXP_EXTENDED, :string, \"check-file-handle\", :string, handle, :string, \"md5,sha256,sha384,sha512\", :int64, offset, :int64, length, :long, block_size)\n end", "title": "" }, { "docid": "f2ccfade6bfc0e84c9fbb5deef2a77bf", "score": "0.6000619", "text": "def check_digests(streamer_response:, file_model:)\n out = streamer_response\n upload = file_model\n if out[:response].nil? || out[:response][:checksum].nil?\n raise FileError, \"Error streaming file to Zenodo. No md5 digest returned:\\n#{out[:response]}\\nFile:#{upload.inspect}\"\n end\n\n if out[:response][:checksum] != \"md5:#{out[:digests]['md5']}\"\n raise FileError, \"Error MD5 digest doesn't match zenodo:\\nResponse: #{out[:response][:checksum]}\\nCalculated: md5:#{out[:digests]['md5']}\"\n end\n\n return unless upload.digest_type.present? && upload.digest.present? && out[:digests][upload.digest_type] != upload.digest\n\n raise FileError, \"Error #{upload.digest_type} digest doesn't match database value:\\nCalculated:#{out[:digests][upload.digest_type]}\\n\" \\\n \"Database: #{upload.digest}\"\n end", "title": "" }, { "docid": "634f8dbc93fc2d46fa4821e4f6a99cbf", "score": "0.5969105", "text": "def needs_md5sums\n false\n end", "title": "" }, { "docid": "386a148d86638d52801f824b3be69382", "score": "0.5960082", "text": "def md5; Digest::MD5.file(fname).hexdigest; end", "title": "" }, { "docid": "3cfa4e06e43c9065c8b6a2a7dabc7d95", "score": "0.59575427", "text": "def remote_file_content_same_as?(full_path, content)\n Digest::MD5.hexdigest(content) == capture(\"md5sum #{full_path} | awk '{ print $1 }'\").strip\n end", "title": "" }, { "docid": "523c8e75da73d0d52fbfb4d5303f7e97", "score": "0.5951573", "text": "def file_remote_digestsha1(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA1.hexdigest(data)\n end\n return chksum\n end", "title": "" }, { "docid": "0509973691baa6fab9f4ed1eda49d580", "score": "0.59475094", "text": "def grab_md5_from_file(file_path, cfile)\n Helpers::log(\"Checking #{file_path} for #{cfile} md5sum\")\n if File.exist?(file_path)\n md5 = \"\"\n File.open(file_path).each do |f|\n if /#{cfile}/.match(f)\n md5 = f\n end\n end\n md5\n else\n File.new(file_path,\"w\")\n \"\"\n end\n end", "title": "" }, { "docid": "24f0056b9fb5eb79973338aabe669d0e", "score": "0.59315383", "text": "def checksum_valid?\n Digest::SHA256.file(path).hexdigest == sha256sum\n end", "title": "" }, { "docid": "eeeec4c90c8b2590cc0a199d4c69f494", "score": "0.5929436", "text": "def md5sum_file(file)\n return `md5sum #{file}`\n end", "title": "" }, { "docid": "fa475a54e1a64229c1ac948501e86cd6", "score": "0.5920756", "text": "def get_md5(fname)\n Digest::MD5.hexdigest(File.read(fname))\nend", "title": "" }, { "docid": "3adbec47a1d911e42f5fd1d552f49441", "score": "0.58789176", "text": "def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend", "title": "" }, { "docid": "2719261dccbf1c2a86f2e0b9a6eed691", "score": "0.5875203", "text": "def has_fingerprint(file, fingerprint)\n File.size?(file) && File.open(file) {|f| f.readline} =~ /#{fingerprint}/\n end", "title": "" }, { "docid": "c41adebed718f3cd9cea002cf158a141", "score": "0.58692086", "text": "def verify(file)\n begin\n @logger.debug(\"Verifying #{file}\")\n load(file, true)\n return(true)\n rescue => error\n @logger.error(\"Failed to verify #{file}: #{error.to_s}\")\n error.backtrace.each { |l| @logger.error(\" #{l}\") }\n end\n end", "title": "" }, { "docid": "53e12e2aba270c2ca6cfaea98eee65f4", "score": "0.5858905", "text": "def regenerate_hash\n path = tempfile_path\n unless File.exist?(path)\n path = file_path\n end\n\n unless File.exist?(path)\n errors.add(:file, \"not found\")\n return false\n end\n\n hashes = Moebooru::Hasher.compute(path, [:crc32, :md5])\n\n self.md5 = hashes[:md5]\n self.crc32 = hashes[:crc32]\n end", "title": "" }, { "docid": "df99b7f6d4d1641fec80f02343abdf8c", "score": "0.5855302", "text": "def compare(file_path, hash_class, _bit_size, hash)\n # Check if the file exists\n ## \"file_state\" if the result of the compared hash and file\n if File.file? file_path\n # Always try to check file permissions\n begin\n # When the file is not corrupted\n if checksum(file_path, hash_class, _bit_size) == hash\n file_state = \"SECURE ------------ \"\n else\n # When the file is corrupted\n file_state = \"CORRUPTED --------- \"\n end\n rescue => error\n puts error\n # When we can't access to it\n file_state = \"ACCESSDENIED --- \"\n end\n else\n # When we can't find the file with the path provided\n # Usually the file was deleted but also returns it can be moved\n file_state = \"NOTEXISTS/MOVED - \"\n end\n puts \"#{file_state}#{file_path}\"\nend", "title": "" }, { "docid": "e9813cded375639a10625bbb3bbbaf7d", "score": "0.5849654", "text": "def check_sha1(filename, sha1_hash)\n actual_hash = Digest::SHA1.hexdigest(::IO.binread(filename))\n return actual_hash == sha1_hash\n end", "title": "" }, { "docid": "54756baeb8995b13fcc3327f728a36a0", "score": "0.58474785", "text": "def create_md5(file, new_file)\n stdout = `md5 -q \"#{file}\" > \"#{new_file}.tif.md5\"`\n puts stdout\nend", "title": "" }, { "docid": "80ea6e0fa097b0c4a22540f3f7f500bc", "score": "0.5811933", "text": "def get_md5sum(file)\n get_sum(file, 'md5')\n end", "title": "" }, { "docid": "2c9272982cf588ac4d0439ec90d42948", "score": "0.58102727", "text": "def valid_checksums?\n \n p = package_path\n files.each do |f|\n file_path = File.join(p, f[:path])\n \n if File.exist?(file_path)\n digest = Digest::SHA1.hexdigest(File.read(file_path))\n errors.add :checksum_validity, \"Digest for #{file_path} in AIP does \" +\n \"not match\" unless digest == f[:sha_1]\n end \n \n end\n \n errors.on(:checksum_validity).nil?\n \n end", "title": "" }, { "docid": "62aeb3918ee4abc93b20fd82518d5fcb", "score": "0.5770749", "text": "def validate_downloaded_file(file_path:, checksum:)\n return false unless file_path.present? && checksum.present? && File.exist?(file_path)\n\n possible_checksums = [\n Digest::SHA1.file(file_path).to_s,\n Digest::SHA256.file(file_path).to_s,\n Digest::SHA512.file(file_path).to_s,\n Digest::MD5.file(file_path).to_s\n ]\n possible_checksums.include?(checksum)\n end", "title": "" }, { "docid": "932a983a8a81880f9c36e398eb58a6c8", "score": "0.5763385", "text": "def check_hash=(flag)\r\n @conf[:use_md5_digest] = flag\r\n end", "title": "" }, { "docid": "ca88f904c3a25f4cbe25af7cb18f020e", "score": "0.5762181", "text": "def compare_hashes_handler(hash_, file_, hash_class, _bit_size)\n # noinspection RubyStringKeysInHashInspection,RubyResolve\n hash_class_reference = {1 => Digest::SHA1, 2 => Digest::SHA2, 5 => Digest::MD5}\n # Check if hash_ is a raw hash or a csv db\n if File.file? hash_\n # hash_ is a csv database with hashes to check\n # Handler for databse\n file_object = File.open hash_, 'r'\n # All the lines of the db\n lines = file_object.readlines\n # Close the file because we don't need it anymore\n file_object.close\n # Fist line of this file is the configuration line that is the function and its bit size (if is sha2)\n hash_class, _bit_size = lines[0].strip.split('-')\n # Has_class can be transformed to int corresponding to its number\n hash_class = {\"SHA1\" => 1, \"SHA2\" => 2, \"MD5\" => 5}[hash_class]\n # When a bit size was specified transform it to int\n if _bit_size.is_a? String\n _bit_size = _bit_size.to_i\n end\n # Parameters for the setup of the hash_function\n hash_class = hash_class_reference[hash_class]\n\n #puts hash_class, chunk_size\n lines = lines[1..]\n lines.each do |line|\n file_path, hash = line.strip.split(',')\n compare file_path, hash_class, _bit_size, hash\n end\n else\n # hash_ variable is a raw hash\n # Get the hash class from the string provided\n hash_class = hash_class_reference[hash_class]\n # Compare the raw hash (hash_) with the file provided\n compare file_,hash_class, _bit_size, hash_\n end\nend", "title": "" }, { "docid": "679bba49c8b4d50260a45a588bd04c5f", "score": "0.5749061", "text": "def verify(testmode=false)\n @changeset.clear\n\n # Read checksums from file\n checksums = Hash.new\n File.open(checksum_fqn, \"r\") do |file|\n checksums = JSON.load(file)\n end\n\n checksums.each_pair do |k,v|\n if [email protected]? k\n \tDir.chdir(@install_dir) do |path|\n\t if sha1sum(k) != v\n\t extract_file(k, testmode)\n\t end\n \tend\n end\n end\n\n return @changeset\n end", "title": "" }, { "docid": "114ad70aaf1b8e3ded473d2a54ab6a5a", "score": "0.572555", "text": "def calculate_checksum(file)\n @lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file, mode: \"rb\")) rescue \"\"\n end", "title": "" }, { "docid": "233c8e733c23b49727adc7fd1d909ebe", "score": "0.5690633", "text": "def file_different?\n if @name && File.exist?( @name )\n Digest::MD5.hexdigest(\n @lines.join( \"\\n\" )\n ) != Digest::MD5.hexdigest(\n File.read( @name )\n )\n else\n true\n end\n end", "title": "" }, { "docid": "bbbb6fb0e03d4aa3f2a53e9b43b0f5da", "score": "0.5689662", "text": "def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end", "title": "" }, { "docid": "622014d92907a74203987c22be74e97e", "score": "0.5676774", "text": "def digest\n Digest::MD5.file(file).hexdigest\n end", "title": "" }, { "docid": "874f15a42e22fe132e8247288e4963c2", "score": "0.5674246", "text": "def content_file_checksums_match?\n checksum_failures = \"\"\n described_datafiles.each do |datafile|\n info = datafile.checksum_info\n\n if File.exists?(datafile.datapath) == false\n checksum_failures << \"#{datafile['sip-path']} - missing; \"\n elsif info[0] != info[1]\n checksum_failures << \"#{datafile['sip-path']} - expected: #{info[0]} computed: #{info[1]}; \"\n else\n next\n end\n end\n\n if checksum_failures.length > 0\n metadata[\"checksum_failures\"] = checksum_failures\n return false\n else\n return true\n end\n end", "title": "" }, { "docid": "6132a492b7792e1e3a1b2822622265f5", "score": "0.56732607", "text": "def verify(file)\n # Read YAML file and comment\n data = YAML.load(File.open(file + SIGEXT))\n raise KeyfileError, \"Invalid file #{file + SIGEXT} content\" unless data && data.is_a?(Hash)\n\n puts \"Signature in file: #{file + SIGEXT}\" if @options[:verbose]\n clearsg = !File.file?(file)\n\n # Hash data\n start = Time.now\n sha = if clearsg\n raise VerificationError, \"File #{file} does not exist, no signed data\" if data[:data].nil?\n Digest::SHA512.new\n else\n puts \"⚠ Warning: clear sign data found but ignored\" if data.has_key?(:data)\n Digest::SHA512.file(file)\n end\n sha << \"\\0x00\" + data[:comment] unless data[:comment].nil?\n sha << \"\\0x00\" + data[:datetime].to_s\n sha << \"\\0x00\" + data[:data] if clearsg\n\n # Control data\n ctn = Enc.decode(data[:signature])\n pub = Ed25519::VerifyKey.new Enc.decode_key(data[:verifykey])\n puts \"Signed with key: #{abbrev_key(data[:verifykey])}\" if @options[:verbose]\n t = get_trusted_keys.include?(data[:verifykey]) ? \"with trusted key\" :\n \"but the verify key is ✖ not trusted\\n (#{data[:verifykey]})\"\n pub.verify(ctn, sha.digest) || raise(VerificationError, \"BAD signature\")\n if clearsg\n $stderr.puts \"✔ Good signature #{t}\\n signed on #{Time.at(data[:datetime])}\"\n $stdout.print data[:data]\n $stderr.puts \"Comment: #{data[:comment]}\\n\" unless data[:comment].nil?\n else\n puts \"✔ Good signature #{t}\\n signed on #{Time.at(data[:datetime])}\"\n puts \"(⏲ #{'%.2f' % ((Time.now - start) * 1000)} ms)\" if @options[:verbose]\n puts \"Comment: #{data[:comment]}\\n\" unless data[:comment].nil?\n end\nend", "title": "" }, { "docid": "974da63f1039323c6260cb092f6426a4", "score": "0.5670842", "text": "def digest_md5(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::MD5.hexdigest(File.read(file)) : nil\n }\n end", "title": "" }, { "docid": "d4d4271ab89288543ccfc3edc658bb1c", "score": "0.56670886", "text": "def validate_file(file_list, timestamp, prev_hash)\n acc_balances = {}\n acc_balances.default = 0\n prepared_hashes = PreHash.new\n file_list.each_with_index do |line, line_no|\n parsed_lines = split_line line, line_no\n check_block_number parsed_lines[0], line_no\n verify_previous_hash prev_hash, parsed_lines[1], line_no\n timestamp = verify_and_return_datetime timestamp, parsed_lines[3], line_no\n verify_transactions parsed_lines[2], line_no, acc_balances\n hash_string = \"#{parsed_lines[0]}|#{parsed_lines[1]}|#{parsed_lines[2]}|#{parsed_lines[3]}\"\n prev_hash = verify_current_hash hash_string, parsed_lines[4], line_no, prepared_hashes\n end\n print_balances acc_balances\n true\nend", "title": "" }, { "docid": "174d553ed22e9153e7e283f560d0a41e", "score": "0.5663933", "text": "def checksum_valid?\n require 'digest'\n\n Chef::Log.info \"Validating the checkum\"\n\n if new_resource.checksum.to_s==''\n Chef::Log.info \"Skipping as no checksum is provided\"\n return true\n end\n\n if Chef::Artifact.from_nexus?(new_resource.location)\n Digest::SHA1.file(new_resource.name).hexdigest == Chef::Artifact.get_artifact_sha(node, new_resource.location)\n else\n if new_resource.checksum\n Digest::SHA1.file(new_resource.name).hexdigest == new_resource.checksum\n else\n Chef::Log.info \"[artifact_file] No checksum provided for artifact_file, not verifying against downloaded file.\"\n true\n end\n end\nend", "title": "" }, { "docid": "cd6aa56c271730df6cd0d9bddd0c24d5", "score": "0.5637319", "text": "def cram_md5_challenge; end", "title": "" }, { "docid": "b4c099986ac7225043b5f7b677579c2f", "score": "0.55997723", "text": "def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end", "title": "" }, { "docid": "64ffdeba40b8ad74018cf791a4012012", "score": "0.5552966", "text": "def file_md5\n Digest::MD5.file(self).hexdigest\n end", "title": "" }, { "docid": "1a68d3ec3c20f2c59b37c421a0c2d7a1", "score": "0.5550484", "text": "def check( chksum_manifest )\n new_chksum_manifest = create_chksum_manifest\n changed = []\n chksum_manifest.each do |file,chksum|\n changed << file if chksum != new_chksum_manifest[file]\n end\n if changed.empty?\n chksum_manifest = new_chksum_manifest\n else\n raise ChecksumError, changed\n end\n end", "title": "" }, { "docid": "3cb10afef3fc39f0ff3fc092c64e9747", "score": "0.55333835", "text": "def verify\n\t\tunless (@options && @options[:path] && @options[:target])\n\t\t\traise OptionParser::InvalidArgument, \"Missing arguments for 'verify'.\"\n\t\tend\n\t\t$log.debug(\"@options = #{@options.inspect}\")\n\t\tsource_dir = @options[:path]\n\t\tunless (source_dir[0] == ?/)\n\t\t\traise OptionParser::InvalidArgument, \"Paths must be absolute.\"\n\t\tend\n\t\t# Point to the root volume if :path points to the secret restore path.\n\t\tif (source_dir == SECRET_DIR)\n\t\t\tsource_dir = \"\"\n\t\tend\n\t\t# Bail if the restore file is not present.\n\t\tarchive_dir = self.backupDir\n\t\tdump_file = \"#{source_dir}#{archive_dir}/#{BACKUP_FILE}\"\n\t\tunless File.file?(\"#{dump_file}\")\n\t\t\traise RuntimeError, \"Backup file not present in source volume.\"\n\t\tend\n\t\ttarget = @options[:target]\n\t\tunless (target == \"/\")\n\t\t\traise RuntimeError, \"Backups can only be verified against a running service.\"\n\t\tend\n\t\tdigest_disk = Digest::SHA256.file(\"#{dump_file}\")\n\t\tdigest_live = Digest::SHA256.new\n\t\topen(\"|/usr/bin/sudo -u _postgres /usr/bin/pg_dumpall | /usr/bin/gzip\") do |f|\n\t\t\tbuf = \"\"\n\t\t\twhile f.read(16384, buf)\n\t\t\t\tdigest_live << buf\n\t\t\tend\n\t\tend\n\t\treturn (digest_disk == digest_live)\n\tend", "title": "" }, { "docid": "248a82a5257facc69cdc6f52be484b36", "score": "0.55237013", "text": "def validate_checksum\n raise Puppet::Error.new \"Inconsistent checksums. Checksum of fetched file is #{calculated_checksum}. You specified #{specified_checksum}\" if calculated_checksum != specified_checksum\n end", "title": "" }, { "docid": "fae6b64edc43371f3af050ceabd5e045", "score": "0.55172735", "text": "def main\n # Arguments base to be use for reference\n args = {:hash_function => 1,:compare => false, :debugmode => false, :samefolder => false, :hash => nil, :file => nil, :output_file => nil}\n # Options to be parsed\n opt = OptionParser.new\n opt.banner = \"Checksum handler; Usage: checksum.rb <options> FILE\"\n opt.on(\"-c\", \"--compare HASH/HASHDB\", \"Set the mode to compare an input hash with the FILE or to compare all hashes of the with all file inside it\") do |value|\n args[:compare] = value\n end\n opt.on('-v', '--verbose', 'Verbose mode ON') do\n args[:debugmode] = true\n end\n opt.on('-s', '--same-folder', 'Change the target file path to ./ as this script was working in the same folder; useful shareable files') do\n args[:samefolder] = true\n end\n opt.on(\"-o\", \"--output-file FILENAME\", \"Output file for the checksum (csv)\") do |value|\n args[:output_file] = value\n end\n opt.on('-5', \"--md5\", \"Use MD5 algorithm\") do\n args[:hash_function] = 5\n end\n opt.on('-1', '--sha1', 'Use SHA1 algorithm (Set by default)') do\n args[:hash_function] = 1\n end\n opt.on('-2', '--sha2 BITSLENGTH', 'Use SHA2 algorithm with your specific bit lenth can be 256, 384 or 512') do |bit_size|\n # SHA2 can have different bit sizes like 224, 256, 384, 512\n if [256, 384, 512].find bit_size.to_i\n args[:bit_size] = bit_size.to_i\n end\n args[:hash_function] = 2\n end\n opt.on('-h', '--help') do\n puts opt\n return\n end.parse!\n # Get the FILE variable\n args[:file] = ARGV.pop\n # When no target is specified\n unless args[:file]\n # iif compare mode isn't enabled\n unless args[:compare]\n puts opt\n end\n\n end\n begin\n # If the mode is set to compare\n if args[:compare]\n compare_hashes_handler args[:compare], args[:file], args[:hash_function], args[:bit_size]\n else\n # Get check sum from file\n checksum_handler args[:file], args[:output_file], args[:hash_function], args[:bit_size],args[:debugmode], args[:samefolder]\n end\n rescue => error\n # For debugging\n puts error\n # Print options\n puts opt\n end\nend", "title": "" }, { "docid": "cfbfaec8f6c49d8097e6b90563a72393", "score": "0.55080605", "text": "def md5?; @md5; end", "title": "" }, { "docid": "26eb8e30a434dc9fc32025b8bed8fa9d", "score": "0.55075324", "text": "def ssh_md5sum_file(file)\n df = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n df = ssh.exec! \"md5sum #{file}\"\n end\n df\n end", "title": "" }, { "docid": "3aefe29cbcd83bdefc20414d5573a4b9", "score": "0.5489629", "text": "def verify_hash\r\n raise \"Line #{total_block_number}: hash was incorrectly calculated\" unless @current_hash == @computed_hash\r\n\r\n true\r\n end", "title": "" }, { "docid": "8a50853fc145570c7da6d14b8db4a4cd", "score": "0.54823625", "text": "def same_files?(*files)\n images = files.map { |fname| Digest::MD5.digest(File.binread(fname)) }\n images.all? { |img| img == images[0] }\nend", "title": "" }, { "docid": "64be836c56a7c69b61b8be23d6a2cc39", "score": "0.54568535", "text": "def test_transform(f1,f2,hashpass,salt,iteration,option)\n succes = nil\n begin\n datastring = \"\"\n File.open(f1).each do |line|\n datastring = datastring + line.gsub(\"a\",\"4\")\n end\n\n file2 = File.new(f2,\"w\")\n file2.write(datastring)\n file2.close\n counter = 1\n lines = File.foreach(f2).count\n File.open(f2).each do |line|\n if option == \"-v\"\n fr = counter * (100.0/lines)\n printf(\"\\r%15s: [%-100s]\",\"#{line.chomp}\", \"=\" * (fr))\n end\n if cracked?(hashpass, line.chomp,salt,iteration,option)\n return succes = line\n end\n counter +=1\n end\n puts \"\"\n succes\n\n rescue => err\n puts \"Exception: #{err}\"\n end\nend", "title": "" }, { "docid": "8f6eed81043b80f65bd7761891705aaf", "score": "0.543636", "text": "def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end", "title": "" }, { "docid": "84a90425d2d8d9166982427825312cc4", "score": "0.53890556", "text": "def checksum(file_path, hash_class, _bit_size)\n # Size of each chunk\n chunk_size = 2048\n # Hash that is the checksum function\n # when a bitsize was specified\n if _bit_size\n hash = hash_class.new(_bit_size)\n else\n hash = hash_class.new\n end\n # File handler\n file_object = File.open(file_path, 'r')\n # loop to update the hash\n while true\n content = file_object.read chunk_size\n # Break the loop if we don't get any byte\n unless content\n return hash.hexdigest\n end\n # Update the hash\n hash.update content\n end\nend", "title": "" }, { "docid": "fc5be37a9b1843e4067dc4b2aec42ee7", "score": "0.5382911", "text": "def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend", "title": "" }, { "docid": "6024868a929f022fd5958a6eec52d8ce", "score": "0.5381232", "text": "def checksum_file(digest_class, path)\n digester = digest_class.new\n digester.file(path)\n digester.hexdigest\n end", "title": "" }, { "docid": "11f1fb4fdc2a872e6d151548c60505be", "score": "0.5371802", "text": "def checksum_handler(file_path, hash_db, hash_class, _bit_size, debugmode, samefolder)\n # Reference for hash banner to notice wat function is using\n reference_banner = {1 => \"SHA1\", 2 => \"SHA2-#{_bit_size}\", 5 => \"MD5\"}[hash_class]\n # returns path as the script was in the same folder\n if samefolder\n samefolder = getfolder file_path\n end\n # Puts hash class that is really a hash function that is going to be used\n if debugmode\n puts reference_banner\n end\n # Write to target if is stablished\n if hash_db.is_a? String\n # Handler for the next writes\n file_object = File.open hash_db, 'w'\n # Write the banner; useful for compare mode\n file_object.write \"#{reference_banner}\\n\"\n else\n # When not file is set\n file_object = nil\n end\n # Stablish the hash class\n hash_class = {1 => Digest::SHA1, 2 => Digest::SHA2, 5 => Digest::MD5}[hash_class]\n # Recursive mode also works with files\n recursive_checksum file_path, hash_class, _bit_size, file_object, debugmode, samefolder\n # If we are redirecting the hashes to a file finally close it\n if file_object\n file_object.close\n end\nend", "title": "" }, { "docid": "623e5c4e27e53be149f676582aa3bacd", "score": "0.5371054", "text": "def md5onlinenet_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Fill out form and run search for hash\n page = agent.get('http://md5online.net') # Get page\n search_form = page.form_with(:action => 'http://md5online.net/') # find form to fill out\n search_form.pass = hash_to_find # set hash to find value\n page = agent.submit(search_form, search_form.buttons.first) # submit form and return new page\n if page.body =~ /<center><p>md5 :<b>#{hash_to_find}<\\/b> <br>pass : <b>(.+)<\\/b><\\/p><\\/table>/\n plain_jane = $1.to_s.strip.chomp\n if verbose\n print_good(\"Match Found: md5online.net\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: md5online.net\") if verbose\n return nil\n end\n print_error(\"No Results from: md5online.net\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: md5online.net\") if verbose\n return nil\n end\n end", "title": "" }, { "docid": "17a2067d0303090a163fcf3caaf66790", "score": "0.5365581", "text": "def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end", "title": "" }, { "docid": "17a2067d0303090a163fcf3caaf66790", "score": "0.5365581", "text": "def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end", "title": "" }, { "docid": "e2b85562b6b7b6951691d72f060514bf", "score": "0.53500843", "text": "def verify_checksum(res)\n msg, chksum = res.match(/^\\$(.*)#(\\h{2})$/)[1..2]\n checksum(msg) == chksum\n end", "title": "" }, { "docid": "276f4e9dbb434dc518650b54c82d51d3", "score": "0.5348485", "text": "def verify_ged_file(file)\n @output.puts \"Verifying file ...\"\n\n file.each_line do |line|\n if /^\\d+ +(@[A-Z0-9]+@|[A-Z]{3,4})/.match(line) == nil and line.strip != \"\"\n @output.puts \"File isn't properly formatted: error on line #{file.lineno}\"\n exit\n end\n end\n\n @output.puts \"File looks good ...\"\n\n file.rewind\n file\n end", "title": "" }, { "docid": "1882680f35867df7905d2cd39bc97585", "score": "0.53318685", "text": "def file_checksum(file_path)\n Digest::SHA256.file(file_path).hexdigest\n end", "title": "" }, { "docid": "1a03bdec38e6174f2cc75ee641d64f63", "score": "0.5325954", "text": "def verify_tag_file(path)\n self.update_if_manifest(path)\n self.update_if_tag_manifest(path)\n self.verify_if_fetch(path)\n containing_tag_manifests = self.tag_manifests.select { |tag_manifest| tag_manifest.tag_manifest_files.first(path: path) }\n bad_checksum_tag_manifest = containing_tag_manifests.detect do |tag_manifest|\n tag_manifest.digest(path) != tag_manifest.tag_manifest_files.first(path: path).checksum\n end\n raise IncorrectChecksumException if bad_checksum_tag_manifest\n true\n end", "title": "" }, { "docid": "fdfc9f5a5986e0871dd4c9b76bc3dc49", "score": "0.5297674", "text": "def rm_md5_from_file(file_path, cfile)\n Helpers::log(\"#{cfile} md5sum doesn't match instrument. Removing from \" +\n \"#{file_path}.\")\n File.rename(file_path, \"#{file_path}.old\")\n file = File.open(file_path,\"w\")\n File.open(\"#{file_path}.old\").each do |f|\n next if /#{cfile}/.match(f)\n file.puts(f)\n end\n file.close\n File.delete(\"#{file_path}.old\")\n end", "title": "" }, { "docid": "4df975bd67ad578ac5877c36ec8f145a", "score": "0.52916914", "text": "def md5file(file, task_ext, task_dep)\n task :this_task do\n if File.exists?(\"#{file}.tmp\")\n old_sum = File.read(\"#{file}.tmp\").chomp\n else\n old_sum = \"\"\n end\n new_sum = `md5sum #{file}`.chomp\n if old_sum != new_sum\n Rake::Task[task_dep].invoke\n File.open(\"#{file}.tmp\", \"w\") {|f| f.write(new_sum)}\n end\n end\n task task_ext => :this_task \nend", "title": "" }, { "docid": "27b7f879405ca5e50d0c7c6ef39aab84", "score": "0.5287544", "text": "def test_existing_file\n assert verify_parameters(['verifier_tests.rb'])\n end", "title": "" }, { "docid": "f20cc5ef05053866f9dd44bf4358c2f7", "score": "0.5278256", "text": "def consistent?\n\n manifest_files.each do |mf|\n\n # get the algorithm implementation\n File.basename(mf) =~ /^manifest-(.+).txt$/\n\n algo = case $1\n when /sha1/i\n Digest::SHA1\n when /md5/i\n Digest::MD5\n else\n :unknown\n end\n\n # Check every file in the manifest\n open(mf) do |io|\n\n io.each_line do |line|\n expected, path = line.chomp.split /\\s+/, 2\n file = File.join(bag_dir, path)\n\n if File.exist? file\n actual = algo.file(file).hexdigest\n\n if expected != actual\n errors.add :consistency, \"expected #{file} to have #{algo}: #{expected}, actual is #{actual}\"\n end\n\n end\n end\n\n end\n\n end\n\n errors.on(:consistency).nil?\n end", "title": "" }, { "docid": "f1d9e35ad14f8e8125b0f9a7e4a2147a", "score": "0.52664626", "text": "def file_check(filename, delete=true, &block)\n ext = File.extname(filename)\n base = filename.chomp(ext)\n checkfile = base + \".CHECK\" + ext\n File.exist?(filename).should be_true\n fstring = IO.read(filename)\n cstring = IO.read(checkfile)\n if block\n (fstring, cstring) = [fstring, cstring].map do |string|\n block.call(string)\n end\n end\n fstring.should == cstring\n File.unlink(filename) if delete\nend", "title": "" }, { "docid": "ce18315391cef135ab0f3c4ee49b541d", "score": "0.52629006", "text": "def verify_signature(result); end", "title": "" }, { "docid": "87c92f73fa34ccf042c2c6f46e4b4282", "score": "0.5262548", "text": "def update\n respond_to do |format|\n\n if @file_upload.update(file_upload_params)\n format.html { redirect_to user_file_upload_path, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_upload }\n @md5 = Digest::MD5.file(@file_upload.attachment.path).hexdigest \n @file_upload[:hash_val]=@md5\n @file_upload.save\n else\n format.html { render :edit }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "629761881dad391507bfc589596905a0", "score": "0.5231183", "text": "def create_chksum_manifest\n chksum_manifest = {}\n files = Dir['*'].select{ |f| File.file? f }\n files.each do |file|\n chksum_manifest[file] = Digest::MD5.file(file).hexdigest\n end\n chksum_manifest\n end", "title": "" }, { "docid": "4a93f9cb11b47ccb4c06972b51767362", "score": "0.52283645", "text": "def fetch_md5\n # Create a hash digest for the current file.\n digest = Digest::MD5.new\n File.open(@path, 'r') do |handle|\n while buffer = handle.read(1024)\n digest << buffer\n end\n end\n digest\n end", "title": "" }, { "docid": "3f8d1fcb4a080a2817ce71cb4b81467d", "score": "0.5227913", "text": "def netmd5crack_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n res = @http.get(\"http://www.netmd5crack.com/cgi-bin/Crack.py?InputHash=#{hash_to_find}\")\n if res[0] =~ /<tr><td class=\"border\">[a-fA-F\\d]{32}<\\/td><td class=\"border\">(.+)<\\/td><\\/tr><\\/table>/\n plain_jane = $1.to_s.strip.chomp\n if plain_jane =~ /Sorry, we don't have that hash in our database/\n print_error(\"No Results from: netmd5crack.com\") if verbose\n return nil\n end\n if verbose\n print_good(\"Match Found: netmd5crack.com\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n else\n print_error(\"No Results from: netmd5crack.com\") if verbose\n return nil\n end\n else\n print_error(\"#{@hash_type} not supported for: netmd5crack.com\") if verbose\n return nil\n end\n end", "title": "" }, { "docid": "44b5db791941d0355d7651f7b3083ebf", "score": "0.52260983", "text": "def check_read(file, bytes); end", "title": "" }, { "docid": "44b5db791941d0355d7651f7b3083ebf", "score": "0.52260983", "text": "def check_read(file, bytes); end", "title": "" }, { "docid": "fbdf5458644bf502b6ec9f1bd9ba8993", "score": "0.52035815", "text": "def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end", "title": "" }, { "docid": "599892d372a7c248a1e8cd05be81c944", "score": "0.518927", "text": "def hmac_matches?\n OrokuSaki.secure_compare(calculated_hmac, file.hmac)\n end", "title": "" }, { "docid": "72c4945545ef9a54aa8313532025bcb0", "score": "0.51814985", "text": "def can_validate_checksums?\n true\n end", "title": "" }, { "docid": "c32ac8774757ba9460d134804604a6b5", "score": "0.5171108", "text": "def verify_signatures?; end", "title": "" }, { "docid": "c3fed4667c6b9155a321afebc2cd78f4", "score": "0.51675504", "text": "def verify_data_file(path)\n containing_manifests = self.manifests.select { |manifest| manifest.manifest_files.first(path: path) }\n raise FileNotInManifestException unless containing_manifests.size > 0\n bad_checksum_manifest = containing_manifests.detect do |manifest|\n manifest.digest(path) != manifest.manifest_files.first(path: path).checksum\n end\n raise IncorrectChecksumException if bad_checksum_manifest\n true\n end", "title": "" }, { "docid": "5fb70f58d7c4b15e454e86b1faac3f29", "score": "0.51625586", "text": "def checksum?\n self.checksum == compute_checksum\n end", "title": "" }, { "docid": "e6b146f01f67d174cbef4aa410806f0f", "score": "0.51574934", "text": "def file_match(file)\n end", "title": "" } ]
2306f4603b8b51e702e502b228559b76
Parse the tokens using reverse polish notation and return the whole algorithm corrected in a way we can easily evaluate over
[ { "docid": "ddf84625c6fb99f97a5b258e004293f4", "score": "0.5988622", "text": "def parse()\n @stack = []\n @rpn = []\n\n @tokens.each do |symbol|\n shunt(symbol)\n end\n\n return @rpn.concat(@stack.reverse)\n end", "title": "" } ]
[ { "docid": "ab24da96dc0d558b7f6ac960dbb7dc9e", "score": "0.63108325", "text": "def parse(tokens)\n working = parse_parens(tokens)\n fail \"Something broke: len = #{working.length}\" if (working.length % 2) == 0\n working = parse_ops(working, /^d$/) if working.length > 1\n fail \"Something broke: len = #{working.length}\" if (working.length % 2) == 0\n working = parse_ops(working, /^[*\\/]$/) if working.length > 1\n fail \"Something broke: len = #{working.length}\" if (working.length % 2) == 0\n working = parse_ops(working, /^[+-]$/) if working.length > 1\n fail \"Something broke: len = #{working.length}\" if working.length != 1\n return working[0]\n end", "title": "" }, { "docid": "ffe6c90e90dc95609b392bd99c58b178", "score": "0.6163828", "text": "def polynom_parser(str)\n copy_str = str.clone\n sgn_array = [] # Array of signs\n if copy_str[0] != '-'\n sgn_array.push('+')\n else\n sgn_array.push('-')\n copy_str[0] = ''\n end\n token = copy_str.split(/[-+]/)\n (0..copy_str.size-1).each do |i|\n sgn_array.push(copy_str[i]) if copy_str[i] == '-' || copy_str[i] == '+'\n end\n size = token.size - 1\n coeff = [] # Array of coefficients\n (0..size).each do |i|\n degree = token[i].split('*') # Split by '*' to get coefficient and degree\n degree[0] == 'x' ? coeff[i] = 1.0 : coeff[i] = degree[0].to_f\n coeff[i] *= -1 if sgn_array[i] == '-'\n end\n coeff\n end", "title": "" }, { "docid": "838b7eb10cba3f6e51fc220977738c3b", "score": "0.61598223", "text": "def reverse_s_exp_rec(exp_to_reverse)\n\n #Parse the input string to an array\n parsed_expression = parse(exp_to_reverse)\n\n #Check if the parsed array is valid\n if parsed_expression.is_a? Array\n\n #Parse every element of the array\n parsed_expression.each do |expression|\n\n #Recursive call\n pretty(reverse_s_exp_rec(pretty(expression)))\n end\n\n #Reverse the expression then return it pretty printed\n return pretty(parsed_expression.reverse)\n\n #parsed_expression is not an array (end of parse)\n else\n\n #Return the input string\n return exp_to_reverse\n\n end\nend", "title": "" }, { "docid": "4a46f8bcf6c36486984cd4dc689580d8", "score": "0.61217624", "text": "def parse_tokens(tokens)\n parse_str = ''\n last_type = ''\n modifier = ''\n num_args = 0\n _class = 0\n _classary = [1]\n args = tokens.dup\n # A note about the class modifiers used below. In general the class,\n # \"reference\" or \"value\", of a function is applied to all of its operands.\n # However, in certain circumstances the operands can have mixed classes,\n # e.g. =VLOOKUP with external references. These will eventually be dealt\n # with by the parser. However, as a workaround the class type of a token\n # can be changed via the repeat_formula interface. Thus, a _ref2d token can\n # be changed by the user to _ref2dA or _ref2dR to change its token class.\n #\n while (!args.empty?)\n token = args.shift\n\n if (token == '_arg')\n num_args = args.shift\n elsif (token == '_class')\n token = args.shift\n _class = @functions[token][2]\n # If _class is undef then it means that the function isn't valid.\n exit \"Unknown function #{token}() in formula\\n\" if _class.nil?\n _classary.push(_class)\n elsif (token == '_vol')\n parse_str += convert_volatile()\n elsif (token == 'ptgBool')\n token = args.shift\n parse_str += convert_bool(token)\n elsif (token == '_num')\n token = args.shift\n parse_str += convert_number(token)\n elsif (token == '_str')\n token = args.shift\n parse_str += convert_string(token)\n elsif (token =~ /^_ref2d/)\n modifier = token.sub(/_ref2d/, '')\n _class = _classary[-1]\n _class = 0 if modifier == 'R'\n _class = 1 if modifier == 'V'\n token = args.shift\n parse_str += convert_ref2d(token, _class)\n elsif (token =~ /^_ref3d/)\n modifier = token.sub(/_ref3d/,'')\n _class = _classary[-1]\n _class = 0 if modifier == 'R'\n _class = 1 if modifier == 'V'\n token = args.shift\n parse_str += convert_ref3d(token, _class)\n elsif (token =~ /^_range2d/)\n modifier = token.sub(/_range2d/,'')\n _class = _classary[-1]\n _class = 0 if modifier == 'R'\n _class = 1 if modifier == 'V'\n token = args.shift\n parse_str += convert_range2d(token, _class)\n elsif (token =~ /^_range3d/)\n modifier = token.sub(/_range3d/,'')\n _class = _classary[-1]\n _class = 0 if modifier == 'R'\n _class = 1 if modifier == 'V'\n token = args.shift\n parse_str += convert_range3d(token, _class)\n elsif (token =~ /^_name/)\n modifier = token.sub(/_name/, '')\n _class = _classary[-1]\n _class = 0 if modifier == 'R'\n _class = 1 if modifier == 'V'\n token = args.shift\n parse_str += convert_name(token, _class)\n elsif (token == '_func')\n token = args.shift\n parse_str += convert_function(token, num_args.to_i)\n _classary.pop\n num_args = 0 # Reset after use\n elsif @ptg[token]\n parse_str += [@ptg[token]].pack(\"C\")\n else\n # Unrecognised token\n return nil\n end\n end\n\n parse_str\n end", "title": "" }, { "docid": "5bbc82e47eddd56e4eca370dcfc204eb", "score": "0.60844696", "text": "def tokens_rpn\n output = []\n operators = []\n\n @tokens.each do |token|\n case token.type\n when :value\n output.push(token)\n when :logical_operator\n output.push(operators.pop) while token.lexeme.consume?(operators.last&.lexeme)\n\n operators.push(token)\n when :parenthesis_open\n operators.push(token)\n when :parenthesis_close\n output.push(operators.pop) while token.lexeme.consume?(operators.last&.lexeme)\n\n raise ParseError, 'Unmatched parenthesis' unless operators.last\n\n operators.pop if operators.last.lexeme.type == :parenthesis_open\n end\n end\n\n output.concat(operators.reverse)\n end", "title": "" }, { "docid": "a07678807f18ff67810b65e7f334c629", "score": "0.60757643", "text": "def reverse_s_exp(exp_to_reverse)\n\n #Parse the expression and apply .reverse to the returned array\n reversed_expression = parse(exp_to_reverse).reverse\n\n #return a pretty string\n return pretty(reversed_expression)\n\nend", "title": "" }, { "docid": "3dea5d5096eb99d343b216ba4c97e048", "score": "0.6069683", "text": "def polishize(lexemes)\n operators = []\n operands = []\n \n operators.push('StartSym')\n \n lexemes.reverse!\n \n while lexeme = lexemes.pop\n if @@operators.member?(lexeme)\n compare_precedence(lexeme, operators, operands)\n else\n operands.push(lexeme)\n end\n end\n \n return atomize(operands)\n end", "title": "" }, { "docid": "af789b54a3162c21f1bf8d54a7324850", "score": "0.6024697", "text": "def pop_token(input)\n # can't use ^ since it matches line beginnings in mid-string\n token = case input\n when /\\A(\\s|;.*$)/ # ignore whitespace and comments\n @@lines += Regexp.last_match[1].count(\"\\n\")\n input[0 .. Regexp.last_match[1].length - 1] = ''\n return pop_token(input)\n when /\\A(\\(|\\))/ # parens\n Regexp.last_match[1].intern\n when /\\A#\\(/ # vector\n input.shift 2\n return [:'(', :vector.sym, tokenize(input)]\n when /\\A'/ # single-quote\n input.shift\n return [:'(', :quote.sym,\n if input[0 ... 1] == '('\n tokenize(input)\n else\n pop_token(input)\n end,\n :')']\n when /\\A(-?\\+?[0-9]*\\.[0-9]+)/ # float\n Regexp.last_match[1].to_f\n when /\\A(\\.)/ # dot (for pair notation), comes after float to pick up any dots that float doesn't accept\n :'.'\n when /\\A(-?[0-9]+)/ # integer\n Regexp.last_match[1].to_i\n when /\\A(\"(.*?)\")/m # string\n Regexp.last_match[2]\n when /\\A#\\\\(.)/ # Character literal\n char = Regexp.last_match[1]\n input.shift 2\n return parse_character_literal(input, char)\n when /\\A(\\/(.*?)\\/)/m # Regex\n Regexp.new(Regexp.escape(Regexp.last_match[2]))\n when /\\A([^ \\n\\)]+)/ # symbols\n # puts \"#{Regexp.last_match[1]} - #{@@lines}\"\n # cannot begin with a character that may begin a number\n sym = Regexp.last_match[1].sym\n sym.file, sym.line = [BusScheme.loaded_files.last, @@lines]\n raise ParseError, \"Invalid identifier: #{sym}\" if INVALID_IDENTIFER_BEGIN.include? sym[0 .. 0] and sym.size > 1\n sym\n else\n raise ParseError if input =~ /[^\\s ]/\n end\n\n # Remove the matched part from the string\n input[0 .. Regexp.last_match[1].length - 1] = '' if token\n return token\n end", "title": "" }, { "docid": "53651ddb914737ade6858e4b6def5b29", "score": "0.59909177", "text": "def parse\n # Séparation de l'equation\n splitted_equation = @equation.split(\" =\")\n\n # Le coté le plus long a gauche\n if splitted_equation.first.length > splitted_equation.last.length\n left = splitted_equation.first\n right = splitted_equation.last\n else\n left = splitted_equation.last\n right = splitted_equation.first\n end\n\n # On split en tableau chaque termes grace au signe +\n left = left.split('')\n left.each_with_index do |letter, i|\n if left[i] == \"-\" and left[i + 1] == \" \"\n left[i] = \"+\"\n left[i + 1] = \"-\"\n end\n end\n left = left.join('').split(' +')\n\n right = right.split('')\n right.each_with_index do |letter, i|\n if right[i] == \"-\" and right[i + 1] == \" \"\n right[i] = \"+\"\n right[i + 1] = \"-\"\n end\n end\n right = right.join('').split(' +')\n\n # Creation des hash grace a @max\n left.each do |term|\n value = term.split(\" \").first.to_f\n @max.times do |i|\n if term.include? \"X^#{i}\"\n @hash_left[\"X^#{i}\"] = value unless value == 0.0\n end\n end\n end\n\n right.each do |term|\n value = term.split(\" \").first.to_f\n @max.times do |i|\n if term.include? \"X^#{i}\"\n @hash_right[\"X^#{i}\"] = value unless value == 0.0\n end\n end\n end\n\n # On rajoute la petite constante = 0 a gauche si elle a disparu pendant la reduction\n unless @hash_left[\"X^0\"]\n @hash_left[\"X^0\"] = 0.0\n end\n\n # Inversion des hash si necessaire, on veut le plus court a droite\n if @hash_left.count < @hash_right.count\n tmp = @hash_left\n @hash_left = @hash_right\n @hash_right = tmp\n end\n\n end", "title": "" }, { "docid": "e3f341026ce262265544a3149d737968", "score": "0.5985976", "text": "def parse(rawInputString)\n @@block.clear\n tokensSimple = splitIntoTokens(rawInputString)\n tokensWithEqualOps = insertDefaultEqualOperators(tokensSimple)\n tokensComplete = insertDefaultAndOperators(tokensWithEqualOps)\n \n indx = 0\n tmpStr = \"\"\n while(indx < tokensComplete.length) do\n tmpStr = tmpStr + tokensComplete[indx] + \", \"\n indx = indx + 1\n end \n tokensPostfix = convertToPostfix(tokensComplete) \n finalHash = evaluate(tokensPostfix) \n finalHash\n end", "title": "" }, { "docid": "9f345c8de076ffb12c4d73de64e3b30b", "score": "0.5978303", "text": "def eval_rpn(tokens)\n tokens.inject([]) { |acc, x|\n case x\n when \"*\", \"-\", \"/\", \"+\"\n evaluate(acc, x)\n else\n acc << x.to_i\n end\n \n acc\n }.pop\nend", "title": "" }, { "docid": "6f7b375740ddaf8337ef7541ff5e2912", "score": "0.59757566", "text": "def token!\n # at line 1:8: ( PLUS | MINUS | MULT | DIV | LPAR | RPAR | LKEY | RKEY | GRTH | LSTH | GRTHE | LSTHE | EXEQ | AND | OR | EQLS | QTS | PROGRAM | IF | ELSE | WHILE | OUT | OUTS | IN | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | BOOL | NUMBER | FLOAT | ID | STRING | WS )\n alt_9 = 36\n alt_9 = @dfa9.predict( @input )\n case alt_9\n when 1\n # at line 1:10: PLUS\n plus!\n\n when 2\n # at line 1:15: MINUS\n minus!\n\n when 3\n # at line 1:21: MULT\n mult!\n\n when 4\n # at line 1:26: DIV\n div!\n\n when 5\n # at line 1:30: LPAR\n lpar!\n\n when 6\n # at line 1:35: RPAR\n rpar!\n\n when 7\n # at line 1:40: LKEY\n lkey!\n\n when 8\n # at line 1:45: RKEY\n rkey!\n\n when 9\n # at line 1:50: GRTH\n grth!\n\n when 10\n # at line 1:55: LSTH\n lsth!\n\n when 11\n # at line 1:60: GRTHE\n grthe!\n\n when 12\n # at line 1:66: LSTHE\n lsthe!\n\n when 13\n # at line 1:72: EXEQ\n exeq!\n\n when 14\n # at line 1:77: AND\n and!\n\n when 15\n # at line 1:81: OR\n or!\n\n when 16\n # at line 1:84: EQLS\n eqls!\n\n when 17\n # at line 1:89: QTS\n qts!\n\n when 18\n # at line 1:93: PROGRAM\n program!\n\n when 19\n # at line 1:101: IF\n if!\n\n when 20\n # at line 1:104: ELSE\n else!\n\n when 21\n # at line 1:109: WHILE\n while!\n\n when 22\n # at line 1:115: OUT\n out!\n\n when 23\n # at line 1:119: OUTS\n outs!\n\n when 24\n # at line 1:124: IN\n in!\n\n when 25\n # at line 1:127: T__42\n t__42!\n\n when 26\n # at line 1:133: T__43\n t__43!\n\n when 27\n # at line 1:139: T__44\n t__44!\n\n when 28\n # at line 1:145: T__45\n t__45!\n\n when 29\n # at line 1:151: T__46\n t__46!\n\n when 30\n # at line 1:157: T__47\n t__47!\n\n when 31\n # at line 1:163: BOOL\n bool!\n\n when 32\n # at line 1:168: NUMBER\n number!\n\n when 33\n # at line 1:175: FLOAT\n float!\n\n when 34\n # at line 1:181: ID\n id!\n\n when 35\n # at line 1:184: STRING\n string!\n\n when 36\n # at line 1:191: WS\n ws!\n\n end\n end", "title": "" }, { "docid": "924d87b1a8c4c93c16d35a6bdd240c6a", "score": "0.5969487", "text": "def parse(expression)\n \n return \"0\" if expression.blank?\n \n # Phase 0: Take out any HTML if present\n parsed = expression.gsub(/<(\\/|\\s)*[^>]*>/,'')\n \n # Phase 1: Replace certain operations, clean extraneous symbols\n parsed.gsub!(\"^\", \"**\")\n parsed.gsub!(\"%\", \"/100\")\n parsed.gsub!(/[$,]/, \"\")\n \n # Phase 2: Turn the input algebra string into something that can be\n # evaluated using eval\n \n # Fix to handle \".33\" and \"33.\" as only character in list (the replacements below will\n # fail otherwise)\n parsed = ' ' + parsed + ' '\n \n # Replace .33 with 0.33 or 2 +.1 with 2 +0.1\n parsed.gsub!(/([^0-9])\\.([0-9])/, '\\10.\\2')\n \n # Replace 24360. with 24360\n parsed.gsub!(/([0-9])\\.\\s+/, '\\1')\n \n # Replace xy with x*y\n parsed.gsub!(/([a-z])\\s*([a-z])/, '\\1*\\2')\n \n # Replace 34xyz with 34*x*y*z\n parsed.gsub!(/([0-9a-z])\\s*([a-z])/, '\\1*\\2')\n parsed.gsub!(/([a-z])\\s*([0-9])/, '\\1*\\2')\n \n # Replace \"# #/#\" with \"(# + #/#)\"\n parsed.gsub!(/([0-9]+)\\s+([0-9]+\\/[0-9]+)/, '(\\1+\\2)')\n \n # Replace something( with something*(\n parsed.gsub!(/([0-9a-z]\\s*)\\(/, '\\1*(')\n \n # Replace )something with )*something\n parsed.gsub!(/\\)\\s*([0-9a-z])/, ')*\\1')\n \n # Replace (something)(something) with (something)*(something)\n parsed.gsub!(/\\)\\s*\\(/, ')*(')\n \n # Turn all numbers into floats\n # (prevents inequality of 1/3 and .3333)\n parsed.gsub!(/([0-9]+)(\\.[0-9]+)*/, 'Float(\\1\\2)')\n \n return parsed\n end", "title": "" }, { "docid": "7764128796259f9cd88ffd61c2e4fd32", "score": "0.5965395", "text": "def convertToPostfix(tokens)\n expr = []\n opStack = []\n count = 0\n tokens.map do |tok|\n \n count = count + 1\n \n if(tok == '(')\n opStack.push(tok)\n elsif(tok == ')')\n while(opStack.length > 0 && opStack.last != '(') do\n expr.push(opStack.pop)\n count = count + 1\n end\n opStack.pop\n #elsif(SearchRules::UNARY_OPERATORS.include?(tok) || SearchRules::BINARY_OPERATORS.include?(tok))\n elsif(SearchRules::OPERATORS.include?(tok))\n # an operator\n if(opStack.length == 0 || opStack.last == '(')\n opStack.push(tok)\n else\n while(opStack.length > 0 && opStack.last != '(') do\n if (getPrecedence(tok) <= getPrecedence(opStack.last))\n expr.push(opStack.pop)\n else\n break\n end\n end\n opStack.push(tok)\n \n end\n else\n # an operand\n expr.push(tok)\n end\n end\n while(opStack.length != 0) do\n expr.push(opStack.pop)\n end\n expr\n end", "title": "" }, { "docid": "e33d5aa88b8869e0c69e251754fc13a5", "score": "0.5922272", "text": "def eval_rpn(tokens)\n keys = { '+' => :+, '-' => :-, '*' => :*, '/' => :/ }\n\n while true\n idx = 0\n while idx < tokens.length\n if keys[tokens[idx]]\n n1 = tokens[idx - 2].to_i\n n2 = tokens[idx - 1].to_i\n result = n1.send(keys[tokens[idx]], n2)\n 3.times { tokens.delete_at(idx - 2) }\n tokens.insert(idx -2, result)\n break\n end\n idx += 1\n end\n\n break if tokens.length <= 1\n end\n tokens.first\nend", "title": "" }, { "docid": "3df2bfda7272a932b1ccd191397e131b", "score": "0.58305997", "text": "def token!\n # at line 1:8: ( T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | T__94 | T__95 | T__96 | T__97 | T__98 | T__99 | T__100 | T__101 | T__102 | T__103 | T__104 | T__105 | T__106 | T__107 | T__108 | T__109 | T__110 | T__111 | T__112 | T__113 | T__114 | T__115 | T__116 | T__117 | T__118 | T__119 | T__120 | T__121 | T__122 | T__123 | T__124 | T__125 | T__126 | T__127 | T__128 | T__129 | T__130 | T__131 | T__132 | T__133 | COLON | SEMI | COMMA | PLUS | MINUS | STAR | DIV | LPAREN | RPAREN | EQUAL | CARET | TILDE | LANGLE | RANGLE | LBRACK | RBRACK | BAR | OF | IDENT | NUMBER | QUOTEDSTRING | ANGLEQUOTEDSTRING | WS | COMMENT )\n alt_7 = 118\n alt_7 = @dfa7.predict( @input )\n case alt_7\n when 1\n # at line 1:10: T__40\n t__40!\n\n\n when 2\n # at line 1:16: T__41\n t__41!\n\n\n when 3\n # at line 1:22: T__42\n t__42!\n\n\n when 4\n # at line 1:28: T__43\n t__43!\n\n\n when 5\n # at line 1:34: T__44\n t__44!\n\n\n when 6\n # at line 1:40: T__45\n t__45!\n\n\n when 7\n # at line 1:46: T__46\n t__46!\n\n\n when 8\n # at line 1:52: T__47\n t__47!\n\n\n when 9\n # at line 1:58: T__48\n t__48!\n\n\n when 10\n # at line 1:64: T__49\n t__49!\n\n\n when 11\n # at line 1:70: T__50\n t__50!\n\n\n when 12\n # at line 1:76: T__51\n t__51!\n\n\n when 13\n # at line 1:82: T__52\n t__52!\n\n\n when 14\n # at line 1:88: T__53\n t__53!\n\n\n when 15\n # at line 1:94: T__54\n t__54!\n\n\n when 16\n # at line 1:100: T__55\n t__55!\n\n\n when 17\n # at line 1:106: T__56\n t__56!\n\n\n when 18\n # at line 1:112: T__57\n t__57!\n\n\n when 19\n # at line 1:118: T__58\n t__58!\n\n\n when 20\n # at line 1:124: T__59\n t__59!\n\n\n when 21\n # at line 1:130: T__60\n t__60!\n\n\n when 22\n # at line 1:136: T__61\n t__61!\n\n\n when 23\n # at line 1:142: T__62\n t__62!\n\n\n when 24\n # at line 1:148: T__63\n t__63!\n\n\n when 25\n # at line 1:154: T__64\n t__64!\n\n\n when 26\n # at line 1:160: T__65\n t__65!\n\n\n when 27\n # at line 1:166: T__66\n t__66!\n\n\n when 28\n # at line 1:172: T__67\n t__67!\n\n\n when 29\n # at line 1:178: T__68\n t__68!\n\n\n when 30\n # at line 1:184: T__69\n t__69!\n\n\n when 31\n # at line 1:190: T__70\n t__70!\n\n\n when 32\n # at line 1:196: T__71\n t__71!\n\n\n when 33\n # at line 1:202: T__72\n t__72!\n\n\n when 34\n # at line 1:208: T__73\n t__73!\n\n\n when 35\n # at line 1:214: T__74\n t__74!\n\n\n when 36\n # at line 1:220: T__75\n t__75!\n\n\n when 37\n # at line 1:226: T__76\n t__76!\n\n\n when 38\n # at line 1:232: T__77\n t__77!\n\n\n when 39\n # at line 1:238: T__78\n t__78!\n\n\n when 40\n # at line 1:244: T__79\n t__79!\n\n\n when 41\n # at line 1:250: T__80\n t__80!\n\n\n when 42\n # at line 1:256: T__81\n t__81!\n\n\n when 43\n # at line 1:262: T__82\n t__82!\n\n\n when 44\n # at line 1:268: T__83\n t__83!\n\n\n when 45\n # at line 1:274: T__84\n t__84!\n\n\n when 46\n # at line 1:280: T__85\n t__85!\n\n\n when 47\n # at line 1:286: T__86\n t__86!\n\n\n when 48\n # at line 1:292: T__87\n t__87!\n\n\n when 49\n # at line 1:298: T__88\n t__88!\n\n\n when 50\n # at line 1:304: T__89\n t__89!\n\n\n when 51\n # at line 1:310: T__90\n t__90!\n\n\n when 52\n # at line 1:316: T__91\n t__91!\n\n\n when 53\n # at line 1:322: T__92\n t__92!\n\n\n when 54\n # at line 1:328: T__93\n t__93!\n\n\n when 55\n # at line 1:334: T__94\n t__94!\n\n\n when 56\n # at line 1:340: T__95\n t__95!\n\n\n when 57\n # at line 1:346: T__96\n t__96!\n\n\n when 58\n # at line 1:352: T__97\n t__97!\n\n\n when 59\n # at line 1:358: T__98\n t__98!\n\n\n when 60\n # at line 1:364: T__99\n t__99!\n\n\n when 61\n # at line 1:370: T__100\n t__100!\n\n\n when 62\n # at line 1:377: T__101\n t__101!\n\n\n when 63\n # at line 1:384: T__102\n t__102!\n\n\n when 64\n # at line 1:391: T__103\n t__103!\n\n\n when 65\n # at line 1:398: T__104\n t__104!\n\n\n when 66\n # at line 1:405: T__105\n t__105!\n\n\n when 67\n # at line 1:412: T__106\n t__106!\n\n\n when 68\n # at line 1:419: T__107\n t__107!\n\n\n when 69\n # at line 1:426: T__108\n t__108!\n\n\n when 70\n # at line 1:433: T__109\n t__109!\n\n\n when 71\n # at line 1:440: T__110\n t__110!\n\n\n when 72\n # at line 1:447: T__111\n t__111!\n\n\n when 73\n # at line 1:454: T__112\n t__112!\n\n\n when 74\n # at line 1:461: T__113\n t__113!\n\n\n when 75\n # at line 1:468: T__114\n t__114!\n\n\n when 76\n # at line 1:475: T__115\n t__115!\n\n\n when 77\n # at line 1:482: T__116\n t__116!\n\n\n when 78\n # at line 1:489: T__117\n t__117!\n\n\n when 79\n # at line 1:496: T__118\n t__118!\n\n\n when 80\n # at line 1:503: T__119\n t__119!\n\n\n when 81\n # at line 1:510: T__120\n t__120!\n\n\n when 82\n # at line 1:517: T__121\n t__121!\n\n\n when 83\n # at line 1:524: T__122\n t__122!\n\n\n when 84\n # at line 1:531: T__123\n t__123!\n\n\n when 85\n # at line 1:538: T__124\n t__124!\n\n\n when 86\n # at line 1:545: T__125\n t__125!\n\n\n when 87\n # at line 1:552: T__126\n t__126!\n\n\n when 88\n # at line 1:559: T__127\n t__127!\n\n\n when 89\n # at line 1:566: T__128\n t__128!\n\n\n when 90\n # at line 1:573: T__129\n t__129!\n\n\n when 91\n # at line 1:580: T__130\n t__130!\n\n\n when 92\n # at line 1:587: T__131\n t__131!\n\n\n when 93\n # at line 1:594: T__132\n t__132!\n\n\n when 94\n # at line 1:601: T__133\n t__133!\n\n\n when 95\n # at line 1:608: COLON\n colon!\n\n\n when 96\n # at line 1:614: SEMI\n semi!\n\n\n when 97\n # at line 1:619: COMMA\n comma!\n\n\n when 98\n # at line 1:625: PLUS\n plus!\n\n\n when 99\n # at line 1:630: MINUS\n minus!\n\n\n when 100\n # at line 1:636: STAR\n star!\n\n\n when 101\n # at line 1:641: DIV\n div!\n\n\n when 102\n # at line 1:645: LPAREN\n lparen!\n\n\n when 103\n # at line 1:652: RPAREN\n rparen!\n\n\n when 104\n # at line 1:659: EQUAL\n equal!\n\n\n when 105\n # at line 1:665: CARET\n caret!\n\n\n when 106\n # at line 1:671: TILDE\n tilde!\n\n\n when 107\n # at line 1:677: LANGLE\n langle!\n\n\n when 108\n # at line 1:684: RANGLE\n rangle!\n\n\n when 109\n # at line 1:691: LBRACK\n lbrack!\n\n\n when 110\n # at line 1:698: RBRACK\n rbrack!\n\n\n when 111\n # at line 1:705: BAR\n bar!\n\n\n when 112\n # at line 1:709: OF\n of!\n\n\n when 113\n # at line 1:712: IDENT\n ident!\n\n\n when 114\n # at line 1:718: NUMBER\n number!\n\n\n when 115\n # at line 1:725: QUOTEDSTRING\n quotedstring!\n\n\n when 116\n # at line 1:738: ANGLEQUOTEDSTRING\n anglequotedstring!\n\n\n when 117\n # at line 1:756: WS\n ws!\n\n\n when 118\n # at line 1:759: COMMENT\n comment!\n\n\n end\n end", "title": "" }, { "docid": "3d35bb1b6ff0093cd5cb5b3f845ee9d7", "score": "0.5797321", "text": "def solve(input)\n stack = []\n postfix = []\n \n # first convert to postfix notation\n input.split(\"\").each do |elem|\n case elem\n when \"(\"\n # left bracket found\n stack.push(\"(\")\n when \")\"\n # right bracket found\n while (!stack.empty? && stack[-1] != \"(\")\n postfix.push(stack.pop)\n end\n stack.pop if stack[-1] == \"(\"\n when /\\d/\n # operand found\n new_value = elem.to_i\n postfix.push(new_value)\n when /\\+|\\*/\n # operator found\n if stack.empty? || stack[-1] == \"(\"\n stack.push(elem)\n else\n while(!stack.empty? && stack[-1] != \"(\" && (elem == \"*\" && stack[-1] == \"+\" )) do\n postfix.push(stack.pop)\n end\n stack.push(elem)\n end\n end\n end\n\n while stack.length > 0\n postfix.push(stack.pop)\n end\n\n values_stack = []\n\n postfix.each do |p|\n case p.to_s\n when /\\d/\n values_stack.push(p)\n when /\\+|\\*/\n val1 = values_stack.pop\n val2 = values_stack.pop\n new_val = val1.send(p, val2)\n values_stack.push new_val\n end\n end\n\n values_stack.pop\nend", "title": "" }, { "docid": "0e36dfc34d27593d18c6632c8cbeedd6", "score": "0.57882744", "text": "def parse(str)\n eval_array = str.reverse.split # reverse (prefix notation with reversed numbers), then split by whitespace\n eager_eval(eval_array)\n end", "title": "" }, { "docid": "b8ba5222f63e1d190546dbe9b6f1cc4b", "score": "0.57838666", "text": "def token!\n # at line 1:8: ( RET | SCOPE | FRAGMENT | TREE_BEGIN | ROOT | BANG | RANGE | REWRITE | AT | LABEL_ASSIGN | LIST_LABEL_ASSIGN | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | SL_COMMENT | ML_COMMENT | CHAR_LITERAL | STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL | DOUBLE_ANGLE_STRING_LITERAL | INT | ARG_ACTION | ACTION | TOKEN_REF | RULE_REF | OPTIONS | TOKENS | WS )\n alt_21 = 52\n alt_21 = @dfa21.predict( @input )\n case alt_21\n when 1\n # at line 1:10: RET\n ret!\n\n when 2\n # at line 1:14: SCOPE\n scope!\n\n when 3\n # at line 1:20: FRAGMENT\n fragment!\n\n when 4\n # at line 1:29: TREE_BEGIN\n tree_begin!\n\n when 5\n # at line 1:40: ROOT\n root!\n\n when 6\n # at line 1:45: BANG\n bang!\n\n when 7\n # at line 1:50: RANGE\n range!\n\n when 8\n # at line 1:56: REWRITE\n rewrite!\n\n when 9\n # at line 1:64: AT\n at!\n\n when 10\n # at line 1:67: LABEL_ASSIGN\n label_assign!\n\n when 11\n # at line 1:80: LIST_LABEL_ASSIGN\n list_label_assign!\n\n when 12\n # at line 1:98: T__67\n t__67!\n\n when 13\n # at line 1:104: T__68\n t__68!\n\n when 14\n # at line 1:110: T__69\n t__69!\n\n when 15\n # at line 1:116: T__70\n t__70!\n\n when 16\n # at line 1:122: T__71\n t__71!\n\n when 17\n # at line 1:128: T__72\n t__72!\n\n when 18\n # at line 1:134: T__73\n t__73!\n\n when 19\n # at line 1:140: T__74\n t__74!\n\n when 20\n # at line 1:146: T__75\n t__75!\n\n when 21\n # at line 1:152: T__76\n t__76!\n\n when 22\n # at line 1:158: T__77\n t__77!\n\n when 23\n # at line 1:164: T__78\n t__78!\n\n when 24\n # at line 1:170: T__79\n t__79!\n\n when 25\n # at line 1:176: T__80\n t__80!\n\n when 26\n # at line 1:182: T__81\n t__81!\n\n when 27\n # at line 1:188: T__82\n t__82!\n\n when 28\n # at line 1:194: T__83\n t__83!\n\n when 29\n # at line 1:200: T__84\n t__84!\n\n when 30\n # at line 1:206: T__85\n t__85!\n\n when 31\n # at line 1:212: T__86\n t__86!\n\n when 32\n # at line 1:218: T__87\n t__87!\n\n when 33\n # at line 1:224: T__88\n t__88!\n\n when 34\n # at line 1:230: T__89\n t__89!\n\n when 35\n # at line 1:236: T__90\n t__90!\n\n when 36\n # at line 1:242: T__91\n t__91!\n\n when 37\n # at line 1:248: T__92\n t__92!\n\n when 38\n # at line 1:254: T__93\n t__93!\n\n when 39\n # at line 1:260: SL_COMMENT\n sl_comment!\n\n when 40\n # at line 1:271: ML_COMMENT\n ml_comment!\n\n when 41\n # at line 1:282: CHAR_LITERAL\n char_literal!\n\n when 42\n # at line 1:295: STRING_LITERAL\n string_literal!\n\n when 43\n # at line 1:310: DOUBLE_QUOTE_STRING_LITERAL\n double_quote_string_literal!\n\n when 44\n # at line 1:338: DOUBLE_ANGLE_STRING_LITERAL\n double_angle_string_literal!\n\n when 45\n # at line 1:366: INT\n int!\n\n when 46\n # at line 1:370: ARG_ACTION\n arg_action!\n\n when 47\n # at line 1:381: ACTION\n action!\n\n when 48\n # at line 1:388: TOKEN_REF\n token_ref!\n\n when 49\n # at line 1:398: RULE_REF\n rule_ref!\n\n when 50\n # at line 1:407: OPTIONS\n options!\n\n when 51\n # at line 1:415: TOKENS\n tokens!\n\n when 52\n # at line 1:422: WS\n ws!\n\n end\n end", "title": "" }, { "docid": "aaaa1759b1ecb58a19feb37983e52eb6", "score": "0.5754716", "text": "def parse_string string, variables={}, verbose=false\n s = string.dup\n recounter = 0\n while /\\(\\S|\\S\\)/.match(s)\n s.gsub!(/([()])([A-Zn(]{1})/, \"\\\\1 \\\\2\")\n s.gsub!(/([A-Zt)]{1})([()])/, \"\\\\1 \\\\2\")\n if (recounter += 1) >= 5\n puts \"Can't parse in less than 5 steps. Try entering the formula with spaces between parentheses\"\n raise ArgumentError\n end\n end\n operators = {\"not\" => Not.new(), \"or\" => Or.new(), \"and\" => And.new(), \"->\" => If.new(), \"<->\" => Iff.new(), \"(\" => LeftParen.new()}\n sentinel = Sentinel.new\n output_queue = OutputQueue.new()\n operator_stack = [sentinel]\n# wff_stack = []\n# vars = []\n elements = s.split\n elements.each do |e|\n if (\"A\"..\"Z\").include? e\n variables[e] = Variable.new(e) unless variables.has_key? e\n output_queue << variables[e]\n# print \"Vars after adding #{e}: \\t\" + output_queue.to_s + \"\\n\"\n elsif [\"not\", \"and\", \"or\", \"->\", \"<->\"].include? e\n while (not operator_stack[-1].is_a? Sentinel) and operator_stack[-1] > operators[e]\n output_queue << operator_stack.pop\n end\n operator_stack << operators[e]\n# print \"OP after adding #{e}: \\t\" + operator_stack.to_s + \"\\n\"\n elsif e == \"(\"\n operator_stack << operators[e]\n elsif e == \")\"\n until operator_stack[-1].is_a? LeftParen or operator_stack[-1].is_a? Sentinel\n output_queue << operator_stack.pop\n end\n# print \"After paren\"\n operator_stack.pop\n# print operator_stack.to_s + \"\\n\"\n else\n raise ArgumentError\n end\n end\n# print operator_stack\n# print output_queue\n until operator_stack[-1].is_a? Sentinel\n x = operator_stack.pop\n if x.is_a? LeftParen\n raise MismatchedParenthesis\n else\n output_queue << x\n end\n end\n\n# print \"\\n\" + output_queue.map{|x| x.to_s}.join(\"\\t\") + \"\\n\"\n\n return variables, output_queue.get_wff\n\nend", "title": "" }, { "docid": "c0292c7ae2d7ee616977842599f3e834", "score": "0.57302713", "text": "def token!\n # at line 1:8: ( T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | MULTIPLICATIONDIVISIONOPERATORS | ADDITIONSUBSTRACTIONOPERATORS | COMPARITIONOPERATORS | BOOL | NULL | IDENTIFIER | ARRAYIDENTIFIER | INTEGER | CHAR | FLOAT | WS | STRING )\n alt_21 = 43\n alt_21 = @dfa21.predict( @input )\n case alt_21\n when 1\n # at line 1:10: T__21\n t__21!\n\n when 2\n # at line 1:16: T__22\n t__22!\n\n when 3\n # at line 1:22: T__23\n t__23!\n\n when 4\n # at line 1:28: T__24\n t__24!\n\n when 5\n # at line 1:34: T__25\n t__25!\n\n when 6\n # at line 1:40: T__26\n t__26!\n\n when 7\n # at line 1:46: T__27\n t__27!\n\n when 8\n # at line 1:52: T__28\n t__28!\n\n when 9\n # at line 1:58: T__29\n t__29!\n\n when 10\n # at line 1:64: T__30\n t__30!\n\n when 11\n # at line 1:70: T__31\n t__31!\n\n when 12\n # at line 1:76: T__32\n t__32!\n\n when 13\n # at line 1:82: T__33\n t__33!\n\n when 14\n # at line 1:88: T__34\n t__34!\n\n when 15\n # at line 1:94: T__35\n t__35!\n\n when 16\n # at line 1:100: T__36\n t__36!\n\n when 17\n # at line 1:106: T__37\n t__37!\n\n when 18\n # at line 1:112: T__38\n t__38!\n\n when 19\n # at line 1:118: T__39\n t__39!\n\n when 20\n # at line 1:124: T__40\n t__40!\n\n when 21\n # at line 1:130: T__41\n t__41!\n\n when 22\n # at line 1:136: T__42\n t__42!\n\n when 23\n # at line 1:142: T__43\n t__43!\n\n when 24\n # at line 1:148: T__44\n t__44!\n\n when 25\n # at line 1:154: T__45\n t__45!\n\n when 26\n # at line 1:160: T__46\n t__46!\n\n when 27\n # at line 1:166: T__47\n t__47!\n\n when 28\n # at line 1:172: T__48\n t__48!\n\n when 29\n # at line 1:178: T__49\n t__49!\n\n when 30\n # at line 1:184: T__50\n t__50!\n\n when 31\n # at line 1:190: T__51\n t__51!\n\n when 32\n # at line 1:196: MULTIPLICATIONDIVISIONOPERATORS\n multiplicationdivisionoperators!\n\n when 33\n # at line 1:228: ADDITIONSUBSTRACTIONOPERATORS\n additionsubstractionoperators!\n\n when 34\n # at line 1:258: COMPARITIONOPERATORS\n comparitionoperators!\n\n when 35\n # at line 1:279: BOOL\n bool!\n\n when 36\n # at line 1:284: NULL\n null!\n\n when 37\n # at line 1:289: IDENTIFIER\n identifier!\n\n when 38\n # at line 1:300: ARRAYIDENTIFIER\n arrayidentifier!\n\n when 39\n # at line 1:316: INTEGER\n integer!\n\n when 40\n # at line 1:324: CHAR\n char!\n\n when 41\n # at line 1:329: FLOAT\n float!\n\n when 42\n # at line 1:335: WS\n ws!\n\n when 43\n # at line 1:338: STRING\n string!\n\n end\n end", "title": "" }, { "docid": "004c0eab39f441def4720f1b32c5027a", "score": "0.57129294", "text": "def convert_input_to_RPN_queue(event, input)\n split_input = input.scan(/\\b(?:\\d+[d]\\d+(?:\\s?[a-z]+\\d+)*)|[\\+\\-\\*\\/]|(?:\\b\\d+\\b)|[\\(\\)]/i)# This is the tokenization string for our input\n\n # change to read left to right order\n input_queue = []\n while split_input.length > 0\n input_queue.push(split_input.pop)\n end\n\n operator_priority = {\n \"+\" => 1,\n \"-\" => 1,\n \"*\" => 2,\n \"/\" => 2\n }\n\n output_queue = []\n operator_stack = []\n\n # Use the shunting yard algorithm to get our order of operations right\n while input_queue.length > 0\n input_queue_peek = input_queue.last\n\n if input_queue_peek.match?(/\\b\\d+\\b/)# If constant in string form\n output_queue.prepend(Integer(input_queue.pop))\n\n elsif input_queue_peek.match?(/\\b\\d+[d]\\w+/i)# If dice roll\n output_queue.prepend(process_roll_token(event, input_queue.pop))\n\n elsif input_queue_peek.match?(/[\\+\\-\\*\\/]/)\n # If the peeked operator is not higher priority than the top of the stack, pop the stack operator down\n if operator_stack.length == 0 || operator_stack.last == \"(\" || operator_priority[input_queue_peek] > operator_priority[operator_stack.last]\n operator_stack.push(input_queue.pop)\n else\n output_queue.prepend(operator_stack.pop)\n operator_stack.push(input_queue.pop)\n end\n\n elsif input_queue_peek == \"(\"\n operator_stack.push( input_queue.pop )\n\n elsif input_queue_peek == \")\"\n while operator_stack.last != '('\n output_queue.prepend(operator_stack.pop)\n\n if operator_stack.length == 0\n raise \"Extra ')' found!\"\n end\n end\n operator_stack.pop # Dispose of the closed \"(\"\n input_queue.pop # Dispose of the closing \")\"\n else\n raise \"Invalid token! (#{input_queue_peek})\"\n end\n end\n\n while operator_stack.length > 0\n if operator_stack.last == '('\n raise \"Extra '(' found!\"\n end\n output_queue.prepend(operator_stack.pop)\n end\n\n return output_queue\nend", "title": "" }, { "docid": "55b4717178aaff103112ee56fe1635cc", "score": "0.57025206", "text": "def parse(tokens)\n if tokens.size == 1\n tokens.first\n elsif (lgroup = tokens.index(\"(\"))\n # replace any groupings first\n depth = 0\n rgroup = nil\n tokens[lgroup..].each.with_index(lgroup) do |token, i|\n if token == \"(\"\n depth += 1\n elsif token == \")\"\n depth -= 1\n if depth.zero?\n rgroup = i\n break\n end\n end\n end\n raise ArgumentError, \"unmatched parens at: #{tokens.inspect}\" if rgroup.nil?\n\n if lgroup.zero?\n parse([parse(tokens[(lgroup + 1)..(rgroup - 1)])] + tokens[(rgroup + 1)..])\n else\n parse(tokens[0..(lgroup - 1)] + [parse(tokens[(lgroup + 1)..(rgroup - 1)])] + tokens[(rgroup + 1)..])\n end\n elsif advanced && (plus = tokens.index(\"+\"))\n # part 2 treats addition as high priority that multiplication\n if plus == 1\n parse([tokens[0] + tokens[2]] + tokens[3..])\n else\n parse(tokens[0, plus - 1] + [tokens[plus - 1] + tokens[plus + 1]] + tokens[(plus + 2)..])\n end\n elsif tokens[1] == \"+\"\n parse([tokens[0] + tokens[2]] + tokens[3..])\n elsif tokens[1] == \"*\"\n parse([tokens[0] * tokens[2]] + tokens[3..])\n else\n raise ArgumentError, \"parser error at: #{tokens.inspect}\"\n end\n end", "title": "" }, { "docid": "6bab1029832dea8f794be951aaf175f7", "score": "0.5689635", "text": "def convert_to_postfix tokens\n tokens.each do |token|\n if token.is_a? Integer\n @post_fix_expression << token\n elsif token == \"(\"\n @operator_stack << token\n elsif is_op?(token)\n while @operator_stack.last && is_op?(@operator_stack.last) && (precedence_of(token) <= precedence_of(@operator_stack.last))\n @post_fix_expression << @operator_stack.pop\n end\n @operator_stack << token\n elsif token == \")\"\n until @operator_stack.last == \"(\"\n @post_fix_expression << @operator_stack.pop\n end\n @operator_stack.pop #throw away the left paren that was stored in the stack\n end\n end \n until @operator_stack.empty?\n @post_fix_expression << @operator_stack.pop\n end \n end", "title": "" }, { "docid": "3297cf93e26e3d6f6f8d3b1a86d39973", "score": "0.5679711", "text": "def parse_tokens_to_expression(tokens)\n with_numbers = parse_numbers(tokens)\n grouped = parse_groups(with_numbers)\n with_negations = parse_negate_operators(grouped)\n \n # Parse all the binary operators to make the tree.\n expressions = parse_operators(with_negations, [\"^\"])\n expressions = parse_operators(with_negations, [\"*\", \"/\"])\n expressions = parse_operators(expressions, [\"+\", \"-\"])\n \n expressions\n end", "title": "" }, { "docid": "27f0e877f7d8fed302c3d0ab9ad72411", "score": "0.5676824", "text": "def reverse_polish_notation(arr)\n valid_ops = {\n \"+\" => :+,\n \"-\" => :-,\n \"*\" => :*,\n \"/\" => :/\n }\n\n\n stack = Stack.new()\n\n i = 0\n while i < arr.length()\n puts \"looking at: #{arr[i]}\"\n if !valid_ops[arr[i]]\n puts \"pushing to stack\"\n stack.push(arr[i].to_i)\n else\n puts \"making operation\"\n oper = valid_ops[arr[i]]\n first_val = stack.pop()\n second_val = stack.pop()\n puts \"#{first_val} #{oper} #{second_val} = #{first_val.send(oper, second_val)}\"\n stack.push(first_val.send(oper, second_val))\n end\n i += 1\n end\n\n return stack.pop()\nend", "title": "" }, { "docid": "67132638d706845a0cfa44b1a1bb331c", "score": "0.56442976", "text": "def token!\n # at line 1:8: ( AS | AND | R_BOOL | R_CLASS | DEFINE | R_END | ELSE | R_FLOAT | FUNCTION | HER | IF | R_INTEGER | OR | PRINT | PROGRAM | READ | RETURN | R_STRING | VOID | WHILE | DIV | EQ | GREATER | GREATEQ | LESS | LEQ | MINUS | MULT | NEQ | PLUS | BOOL | STRING | ID | FLOAT | INTEGER | ASGN | COLON | COMMA | DOT | LBRACK | LPAR | RBRACK | RPAR | OBJ | WS | NEWLINE )\n alt_11 = 46\n alt_11 = @dfa11.predict( @input )\n case alt_11\n when 1\n # at line 1:10: AS\n as!\n\n\n when 2\n # at line 1:13: AND\n and!\n\n\n when 3\n # at line 1:17: R_BOOL\n r_bool!\n\n\n when 4\n # at line 1:24: R_CLASS\n r_class!\n\n\n when 5\n # at line 1:32: DEFINE\n define!\n\n\n when 6\n # at line 1:39: R_END\n r_end!\n\n\n when 7\n # at line 1:45: ELSE\n else!\n\n\n when 8\n # at line 1:50: R_FLOAT\n r_float!\n\n\n when 9\n # at line 1:58: FUNCTION\n function!\n\n\n when 10\n # at line 1:67: HER\n her!\n\n\n when 11\n # at line 1:71: IF\n if!\n\n\n when 12\n # at line 1:74: R_INTEGER\n r_integer!\n\n\n when 13\n # at line 1:84: OR\n or!\n\n\n when 14\n # at line 1:87: PRINT\n print!\n\n\n when 15\n # at line 1:93: PROGRAM\n program!\n\n\n when 16\n # at line 1:101: READ\n read!\n\n\n when 17\n # at line 1:106: RETURN\n return!\n\n\n when 18\n # at line 1:113: R_STRING\n r_string!\n\n\n when 19\n # at line 1:122: VOID\n void!\n\n\n when 20\n # at line 1:127: WHILE\n while!\n\n\n when 21\n # at line 1:133: DIV\n div!\n\n\n when 22\n # at line 1:137: EQ\n eq!\n\n\n when 23\n # at line 1:140: GREATER\n greater!\n\n\n when 24\n # at line 1:148: GREATEQ\n greateq!\n\n\n when 25\n # at line 1:156: LESS\n less!\n\n\n when 26\n # at line 1:161: LEQ\n leq!\n\n\n when 27\n # at line 1:165: MINUS\n minus!\n\n\n when 28\n # at line 1:171: MULT\n mult!\n\n\n when 29\n # at line 1:176: NEQ\n neq!\n\n\n when 30\n # at line 1:180: PLUS\n plus!\n\n\n when 31\n # at line 1:185: BOOL\n bool!\n\n\n when 32\n # at line 1:190: STRING\n string!\n\n\n when 33\n # at line 1:197: ID\n id!\n\n\n when 34\n # at line 1:200: FLOAT\n float!\n\n\n when 35\n # at line 1:206: INTEGER\n integer!\n\n\n when 36\n # at line 1:214: ASGN\n asgn!\n\n\n when 37\n # at line 1:219: COLON\n colon!\n\n\n when 38\n # at line 1:225: COMMA\n comma!\n\n\n when 39\n # at line 1:231: DOT\n dot!\n\n\n when 40\n # at line 1:235: LBRACK\n lbrack!\n\n\n when 41\n # at line 1:242: LPAR\n lpar!\n\n\n when 42\n # at line 1:247: RBRACK\n rbrack!\n\n\n when 43\n # at line 1:254: RPAR\n rpar!\n\n\n when 44\n # at line 1:259: OBJ\n obj!\n\n\n when 45\n # at line 1:263: WS\n ws!\n\n\n when 46\n # at line 1:266: NEWLINE\n newline!\n\n\n end\n end", "title": "" }, { "docid": "b7e57b80cfa5e5c8337e20da82419db5", "score": "0.5625778", "text": "def token!\n # at line 1:8: ( T__9 | T__10 | T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | LOALPHA | UPALPHA | DIGIT | WS | ESC )\n alt_4 = 40\n alt_4 = @dfa4.predict(@input)\n case alt_4\n when 1\n # at line 1:10: T__9\n t__9!\n\n when 2\n # at line 1:15: T__10\n t__10!\n\n when 3\n # at line 1:21: T__11\n t__11!\n\n when 4\n # at line 1:27: T__12\n t__12!\n\n when 5\n # at line 1:33: T__13\n t__13!\n\n when 6\n # at line 1:39: T__14\n t__14!\n\n when 7\n # at line 1:45: T__15\n t__15!\n\n when 8\n # at line 1:51: T__16\n t__16!\n\n when 9\n # at line 1:57: T__17\n t__17!\n\n when 10\n # at line 1:63: T__18\n t__18!\n\n when 11\n # at line 1:69: T__19\n t__19!\n\n when 12\n # at line 1:75: T__20\n t__20!\n\n when 13\n # at line 1:81: T__21\n t__21!\n\n when 14\n # at line 1:87: T__22\n t__22!\n\n when 15\n # at line 1:93: T__23\n t__23!\n\n when 16\n # at line 1:99: T__24\n t__24!\n\n when 17\n # at line 1:105: T__25\n t__25!\n\n when 18\n # at line 1:111: T__26\n t__26!\n\n when 19\n # at line 1:117: T__27\n t__27!\n\n when 20\n # at line 1:123: T__28\n t__28!\n\n when 21\n # at line 1:129: T__29\n t__29!\n\n when 22\n # at line 1:135: T__30\n t__30!\n\n when 23\n # at line 1:141: T__31\n t__31!\n\n when 24\n # at line 1:147: T__32\n t__32!\n\n when 25\n # at line 1:153: T__33\n t__33!\n\n when 26\n # at line 1:159: T__34\n t__34!\n\n when 27\n # at line 1:165: T__35\n t__35!\n\n when 28\n # at line 1:171: T__36\n t__36!\n\n when 29\n # at line 1:177: T__37\n t__37!\n\n when 30\n # at line 1:183: T__38\n t__38!\n\n when 31\n # at line 1:189: T__39\n t__39!\n\n when 32\n # at line 1:195: T__40\n t__40!\n\n when 33\n # at line 1:201: T__41\n t__41!\n\n when 34\n # at line 1:207: T__42\n t__42!\n\n when 35\n # at line 1:213: T__43\n t__43!\n\n when 36\n # at line 1:219: LOALPHA\n loalpha!\n\n when 37\n # at line 1:227: UPALPHA\n upalpha!\n\n when 38\n # at line 1:235: DIGIT\n digit!\n\n when 39\n # at line 1:241: WS\n ws!\n\n when 40\n # at line 1:244: ESC\n esc!\n\n end\n end", "title": "" }, { "docid": "185b9b57889ac67d71df5703fb1ee3ae", "score": "0.56201977", "text": "def parse(expr)\n array = Array.new\n until @d == expr.length\n c = expr[@d]\n case c\n when \"(\"\n @d += 1\n calc = parse(expr)\n array.push calc if calc != nil \n when \")\"\n @d += 1\n return array\n when /[\\*\\/]/\n @d +=1\n array.push c.to_sym\n when /[\\+\\-\\^]/\n @d+=1\n array.push c.to_sym\n when /\\=/\n @d += 1\n array.push c.to_sym\n when /\\>/\n @d += 1\n array.push c.to_sym\n when /\\\"/\n @d += 1\n array.push extract(expr)\n when /\\~/\n @d += 1\n if expr[@d] == \"(\"\n @d +=1\n calc = parse(expr)\n array.push calc unless calc == nil\n else\n array.push expr[@d]\n @d += 1\n end\n when /\\./\n if expr[@d-1] =~ /[0-9]+/\n x = array.pop.to_s + c + expr[@d+1]\n array.push x.to_n\n else\n unless @error\n @error = true\n puts \"Problem evaluating expression at index:#{@d}\"\n puts \"Invalid char '#{expr[@d]}' in string variable\"\n end\n return\n end\n @d+=2\n when /\\:/\n if expr[@d - 1] =~ /[a-zA-Z]+/ then\n x = array.pop.to_s + c\n array.push x.downcase.to_sym\n else\n unless @error\n @error = true\n puts \"Problem evaluating expression at index:#{@d}\"\n puts \"Invalid char '#{expr[@d]}' in numeric variable\"\n end\n return\n end\n @d += 1\n when /\\_/\n @d += 1\n x = array.pop.to_s + c\n array.push x\n when /\\p{Alnum}/ \n if expr[@d-1] =~ /[0-9\\.x]/ && array.count>0\n x = array.pop.to_s + c \n array.push x.to_n\n elsif (expr[@d-1] =~ /[a-z\\A-Z]/ or expr[@d-1] == '_') && array.count>0\n x = array.pop.to_s + c \n array.push x\n else \n array.push c.to_n if c =~ /[0-9\\.x]/\n array.push c if c =~ /[a-zA-Z]/\n end\n @d += 1\n else\n unless @error\n @error = true\n puts \"Problem evaluating expression at index:#{@d}\"\n puts \"Char '#{expr[@d]}' not recognized\"\n end\n return\n end\n end\n\n return array\n end", "title": "" }, { "docid": "758df69dad230c090008e1ccada3782e", "score": "0.5607757", "text": "def norm_phrase_tokens( tokens )\n tokens.\n reject { |t| @lparen === t || @rparen === t }.\n map { |t| norm_term( t ) }\n end", "title": "" }, { "docid": "72897bc6a871bed9962ff68c794f144a", "score": "0.55981547", "text": "def reverse_polish(array)\r\n stack = []\r\n array.each do |element|\r\n case element\r\n when \"+\"\r\n stack << stack.pop + stack.pop\r\n when \"/\"\r\n a = stack.pop\r\n b = stack.pop\r\n stack << b/a\r\n when \"-\"\r\n a = stack.pop\r\n b = stack.pop\r\n stack << b - a\r\n when \"*\"\r\n stack << stack.pop * stack.pop\r\n else\r\n stack << element.to_i\r\n end\r\n end\r\n stack.pop\r\nend", "title": "" }, { "docid": "a29c98ea37da284d7124f0e3de50afd0", "score": "0.55906546", "text": "def token!\n # at line 1:8: ( T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | T__94 | T__95 | T__96 | T__97 | T__98 | T__99 | T__100 | IDENTIFIER | CHARACTER_LITERAL | STRING_LITERAL | HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOATING_POINT_LITERAL | WS | COMMENT | LINE_COMMENT | LINE_COMMAND )\n alt_35 = 89\n alt_35 = @dfa35.predict(@input)\n case alt_35\n when 1\n # at line 1:10: T__23\n t__23!\n\n when 2\n # at line 1:16: T__24\n t__24!\n\n when 3\n # at line 1:22: T__25\n t__25!\n\n when 4\n # at line 1:28: T__26\n t__26!\n\n when 5\n # at line 1:34: T__27\n t__27!\n\n when 6\n # at line 1:40: T__28\n t__28!\n\n when 7\n # at line 1:46: T__29\n t__29!\n\n when 8\n # at line 1:52: T__30\n t__30!\n\n when 9\n # at line 1:58: T__31\n t__31!\n\n when 10\n # at line 1:64: T__32\n t__32!\n\n when 11\n # at line 1:70: T__33\n t__33!\n\n when 12\n # at line 1:76: T__34\n t__34!\n\n when 13\n # at line 1:82: T__35\n t__35!\n\n when 14\n # at line 1:88: T__36\n t__36!\n\n when 15\n # at line 1:94: T__37\n t__37!\n\n when 16\n # at line 1:100: T__38\n t__38!\n\n when 17\n # at line 1:106: T__39\n t__39!\n\n when 18\n # at line 1:112: T__40\n t__40!\n\n when 19\n # at line 1:118: T__41\n t__41!\n\n when 20\n # at line 1:124: T__42\n t__42!\n\n when 21\n # at line 1:130: T__43\n t__43!\n\n when 22\n # at line 1:136: T__44\n t__44!\n\n when 23\n # at line 1:142: T__45\n t__45!\n\n when 24\n # at line 1:148: T__46\n t__46!\n\n when 25\n # at line 1:154: T__47\n t__47!\n\n when 26\n # at line 1:160: T__48\n t__48!\n\n when 27\n # at line 1:166: T__49\n t__49!\n\n when 28\n # at line 1:172: T__50\n t__50!\n\n when 29\n # at line 1:178: T__51\n t__51!\n\n when 30\n # at line 1:184: T__52\n t__52!\n\n when 31\n # at line 1:190: T__53\n t__53!\n\n when 32\n # at line 1:196: T__54\n t__54!\n\n when 33\n # at line 1:202: T__55\n t__55!\n\n when 34\n # at line 1:208: T__56\n t__56!\n\n when 35\n # at line 1:214: T__57\n t__57!\n\n when 36\n # at line 1:220: T__58\n t__58!\n\n when 37\n # at line 1:226: T__59\n t__59!\n\n when 38\n # at line 1:232: T__60\n t__60!\n\n when 39\n # at line 1:238: T__61\n t__61!\n\n when 40\n # at line 1:244: T__62\n t__62!\n\n when 41\n # at line 1:250: T__63\n t__63!\n\n when 42\n # at line 1:256: T__64\n t__64!\n\n when 43\n # at line 1:262: T__65\n t__65!\n\n when 44\n # at line 1:268: T__66\n t__66!\n\n when 45\n # at line 1:274: T__67\n t__67!\n\n when 46\n # at line 1:280: T__68\n t__68!\n\n when 47\n # at line 1:286: T__69\n t__69!\n\n when 48\n # at line 1:292: T__70\n t__70!\n\n when 49\n # at line 1:298: T__71\n t__71!\n\n when 50\n # at line 1:304: T__72\n t__72!\n\n when 51\n # at line 1:310: T__73\n t__73!\n\n when 52\n # at line 1:316: T__74\n t__74!\n\n when 53\n # at line 1:322: T__75\n t__75!\n\n when 54\n # at line 1:328: T__76\n t__76!\n\n when 55\n # at line 1:334: T__77\n t__77!\n\n when 56\n # at line 1:340: T__78\n t__78!\n\n when 57\n # at line 1:346: T__79\n t__79!\n\n when 58\n # at line 1:352: T__80\n t__80!\n\n when 59\n # at line 1:358: T__81\n t__81!\n\n when 60\n # at line 1:364: T__82\n t__82!\n\n when 61\n # at line 1:370: T__83\n t__83!\n\n when 62\n # at line 1:376: T__84\n t__84!\n\n when 63\n # at line 1:382: T__85\n t__85!\n\n when 64\n # at line 1:388: T__86\n t__86!\n\n when 65\n # at line 1:394: T__87\n t__87!\n\n when 66\n # at line 1:400: T__88\n t__88!\n\n when 67\n # at line 1:406: T__89\n t__89!\n\n when 68\n # at line 1:412: T__90\n t__90!\n\n when 69\n # at line 1:418: T__91\n t__91!\n\n when 70\n # at line 1:424: T__92\n t__92!\n\n when 71\n # at line 1:430: T__93\n t__93!\n\n when 72\n # at line 1:436: T__94\n t__94!\n\n when 73\n # at line 1:442: T__95\n t__95!\n\n when 74\n # at line 1:448: T__96\n t__96!\n\n when 75\n # at line 1:454: T__97\n t__97!\n\n when 76\n # at line 1:460: T__98\n t__98!\n\n when 77\n # at line 1:466: T__99\n t__99!\n\n when 78\n # at line 1:472: T__100\n t__100!\n\n when 79\n # at line 1:479: IDENTIFIER\n identifier!\n\n when 80\n # at line 1:490: CHARACTER_LITERAL\n character_literal!\n\n when 81\n # at line 1:508: STRING_LITERAL\n string_literal!\n\n when 82\n # at line 1:523: HEX_LITERAL\n hex_literal!\n\n when 83\n # at line 1:535: DECIMAL_LITERAL\n decimal_literal!\n\n when 84\n # at line 1:551: OCTAL_LITERAL\n octal_literal!\n\n when 85\n # at line 1:565: FLOATING_POINT_LITERAL\n floating_point_literal!\n\n when 86\n # at line 1:588: WS\n ws!\n\n when 87\n # at line 1:591: COMMENT\n comment!\n\n when 88\n # at line 1:599: LINE_COMMENT\n line_comment!\n\n when 89\n # at line 1:612: LINE_COMMAND\n line_command!\n\n end\n end", "title": "" }, { "docid": "5a2533b83eb346464cdb26194b86667e", "score": "0.5587824", "text": "def calculate()\n @equation_tokens = @equation.split(/(\\+|\\-|\\*|\\/|\\(|\\))/).reject { |a| a.empty? }\n if @verbose\n puts \"1: #{@equation_tokens.join}\"\n end\n\n @equation_tokens = calculate_tokens(@equation_tokens)\n if @verbose\n puts \"2: #{@equation_tokens.join}\"\n end\n\n result = []\n yard = ShuntingYard.new(@equation_tokens)\n rpn = yard.parse()\n rpn.each do |symbol|\n result << (\n if EVAL[symbol] \n right = result.pop\n left = result.pop\n EVAL[symbol].call(left, right)\n else\n symbol\n end)\n end\n\n value = result.pop\n if @verbose\n puts \"3: #{value}\"\n end\n\n return value\n end", "title": "" }, { "docid": "f26d940918331d92ea12e80d1db5689c", "score": "0.5586975", "text": "def parse()\n analyze()\n \n position = 0\n while position < @input.length\n token = @input[position]\n position = _internal_parse(token, position)\n end\n end", "title": "" }, { "docid": "387e3fb6b64b8278cff603de70dc5411", "score": "0.5583978", "text": "def parse\n new_tokenize\n definitions_pass\n mangle_and_merge()\n do_main_pass()\n end", "title": "" }, { "docid": "b890a4c13c96214ef3f9ef946dfc2258", "score": "0.5581861", "text": "def process_tokens\n i = 0\n while i < tokens.length do\n if tokens[i] == '-'\n if tokens[i+1][0] == '-'\n tokens[i+1][0] = ''\n else\n tokens[i+1].insert(0,'-')\n end\n tokens[i] = '+'\n end\n i += 1\n end\n end", "title": "" }, { "docid": "1800bc0477f5a33541379dd9d5916363", "score": "0.5576504", "text": "def bracket_literals\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 126 )\n return_value = BracketLiteralsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n bracket_literals_start_index = @input.index\n\n root_0 = nil\n __LPAREN805__ = nil\n __RPAREN807__ = nil\n literals806 = nil\n\n tree_for_LPAREN805 = nil\n tree_for_RPAREN807 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 732:4: LPAREN literals RPAREN\n __LPAREN805__ = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_bracket_literals_4711 )\n if @state.backtracking == 0\n\n tree_for_LPAREN805 = @adaptor.create_with_payload( __LPAREN805__ )\n @adaptor.add_child( root_0, tree_for_LPAREN805 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_literals_IN_bracket_literals_4713 )\n literals806 = literals\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, literals806.tree )\n end\n __RPAREN807__ = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_bracket_literals_4715 )\n if @state.backtracking == 0\n\n tree_for_RPAREN807 = @adaptor.create_with_payload( __RPAREN807__ )\n @adaptor.add_child( root_0, tree_for_RPAREN807 )\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 126 )\n memoize( __method__, bracket_literals_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "f0f2c77dfc63cdaa023c5d6b2d73c89e", "score": "0.5563484", "text": "def process_token(ttoken, command_state, tok_start_offset) # [\n # method result is a token type such as :tIDENTIFIER\n\n src = @src_scanner\n\n #if ttoken =~ /^\\w/ && (s_matched = src.scan(/[\\!\\?](?!=)/))\n # ttoken << s_matched \n #end\n tt_first_ch = ttoken[0]\n next_ch = src.peek_ch\n if next_ch._equal?( ?! ) || next_ch._equal?( ?? )\n if src.ch_is_digit_alpha_uscore( tt_first_ch ) \n\tthird_ch = src.peek_ahead(1)\n\tif third_ch._not_equal?( ?= )\n\t src.advance(1)\n\t ttoken << next_ch\n\tend\n end\n end \n\n result = nil\n clex_state = @lex_state\n last_state = clex_state\n\n # case tk\n if tt_first_ch._equal?( ?$ ) # when /^\\$/ then\n @lex_state = Expr_end\n y_value = RpNameToken.new( ttoken, tok_start_offset)\n @yacc_value = y_value\n result = :tGVAR\n elsif tt_first_ch._equal?( ?@ ) # \n if ttoken[1]._equal?( ?@ ) # when /^@@/ then\n @lex_state = Expr_end\n y_value = RpNameToken.new( ttoken, tok_start_offset)\n @yacc_value = y_value\n result = :tCVAR\n else # when /^@/ then\n @lex_state = Expr_end\n y_value = RpNameToken.new( ttoken, tok_start_offset)\n @yacc_value = y_value\n result = :tIVAR\n end\n else # [\n tt_last_ch = ttoken[ttoken.size - 1]\n if tt_last_ch._equal?( ?! ) || tt_last_ch._equal?( ?? ) # ttoken =~ /[!?]$/\n result = :tFID\n else\n if clex_state._equal?( Expr_fname) then\n # ident=, not =~ => == or followed by =>\n # TODO202 test lexing of a=>b vs a==>b\n if src.peek_ch._equal?( ?= )\n if (s_matched = src.scan(/=(?:(?![~>=])|(?==>))/)) then\n result = :tIDENTIFIER\n ttoken << s_matched\n end\n end\n end\n # result ||= if ttoken =~ /^[A-Z]/ then :tCONSTANT else :tIDENTIFIER end\n if result._equal?( nil )\n if src.ch_is_uc_alpha(tt_first_ch) \n result = :tCONSTANT\n else\n result = :tIDENTIFIER\n end\n end\n end\n\n unless clex_state._equal?( Expr_dot) then # [\n # See if it is a reserved word.\n # was keyword = Keyword.keyword[ttoken]\n kwarr = @keyword_table.at_casesens_otherwise(ttoken, true, nil)\n\n if kwarr._not_equal?(nil) \n # clex_state holds \"old state\" and we update @lex_state\n # with new state to be valid after return\n kw_id_zero = kwarr[0] # was keyword.id0 \n if kw_id_zero._isFixnum\n @lex_state = kwarr[2] # was keyword.state\n if kw_id_zero._equal?(0)\n @yacc_value = ttoken\n else # kw_id_zero == 1 \n @yacc_value = RpNameToken.new( ttoken , tok_start_offset) \n end\n return kwarr[1] # synthesized kw_id_zero == kw_id_one\n elsif kw_id_zero._equal?(nil)\n @lex_state = kwarr[2] # was keyword.state\n kw_id_one = kwarr[1] # was keyword.id1\n if kw_id_one._equal?( :kELSE )\n @yacc_value = ttoken\n @last_else_src_offset = tok_start_offset # for hints and warnings\n elsif kw_id_one._equal?( :kDO )\n @command_start = true\n @yacc_value = RpNameToken.new( ttoken , tok_start_offset)\n return :kDO_COND if @cond.is_in_state\n return :kDO_BLOCK if clex_state._not_equal?( Expr_cmdArg) && @cmdarg.is_in_state \n return :kDO_BLOCK if clex_state._equal?( Expr_endArg )\n return :kDO\n elsif kw_id_one._equal?( :kDEF )\n @yacc_value = DefnNameToken.new( ttoken, tok_start_offset, @line_num )\n else\n @yacc_value = RpNameToken.new( ttoken , tok_start_offset)\n end\n return kw_id_one # synthesized kw_id_zero == kw_id_one\n else # kw_id_zero._isSymbol and kwarr[0]._not_equal?( kwarr[1] )\n @yacc_value = RpNameToken.new( ttoken, tok_start_offset)\n if clex_state._equal?( Expr_beg )\n @lex_state = kwarr[2] # was keyword.state\n return kw_id_zero \n end\n @lex_state = Expr_beg \n return kwarr[1] # was keyword.id1\n end\n end\n end # ]\n\n\n if (clex_state & Expr_IS_beg_mid_dot_arg_cmdarg)._not_equal?( 0) then\n if command_state then\n @lex_state = Expr_cmdArg\n else\n @lex_state = Expr_arg\n end\n else\n @lex_state = Expr_end\n end\n y_value = RpNameToken.new( ttoken , tok_start_offset )\n @yacc_value = y_value\n end # ]\n\n # unless ttoken.__as_symbol._equal?( y_value.symval ) # uncomment for debugging\n # puts 'Inconsistent ttoken' \n # nil.pause\n # end\n #\n if (last_state._not_equal?( Expr_dot)) && @parser.env[ y_value.symval ]._equal?( :lvar)\n @lex_state = Expr_end \n end\n return result\n end", "title": "" }, { "docid": "75c1ebeeccee63c0349a16228b9057af", "score": "0.55438006", "text": "def to_postfix(tokens)\n opstack = []\n output = []\n lparen = 0\n \n tokens.each do |token| \n # If the token is an operand, append it to the end of the output list\n if token.token_type.id == :pinteger\n output << token\n end\n\n # If the token is a left parenthesis, push it on the opstack\n if token.token_type.id == :lparen\n opstack << token\n end\n \n # If the token is a right parenthesis, pop the opstack until the \n # corresponding left parenthesis is removed. Append each operator to the \n # end of the output list.\n if token.token_type.id == :rparen\n loop do\n raise \"Malformed expression: parenthesis mismatch\" if opstack.empty?\n top = opstack.pop \n break if top.token_type.id == :lparen\n output << top\n end\n end\n\n # If the token is an operator, *, /, +, or -, push it on the opstack. \n # However, first remove any operators already on the opstack that have\n # higher or equal precedence and append them to the output list.\n if token.operator? \n until opstack.empty? or \n opstack.last.token_type.options[:precedence] < token.token_type.options[:precedence]\n output << opstack.pop\n end\n \n opstack << token\n end\n end\n\n # When the input expression has been completely processed, check the \n # opstack. Any operators still on the stack can be removed and appended \n # to the end of the output list. \n until opstack.empty? \n output << opstack.pop\n end\n\n output\n end", "title": "" }, { "docid": "86a7363e106b01f2f6be4a2094d05af9", "score": "0.55390453", "text": "def parseExpression token\n #puts \"parseExpression #{token}\"\n return nil unless lhs = parseUnary(token)\n return parseBinOprhs(0, lhs )\n end", "title": "" }, { "docid": "4c29af642c2047e164dcde998479201b", "score": "0.55223686", "text": "def pop_token(input)\n # can't use ^ since it matches line beginnings in mid-string\n token = case input\n when /\\A(\\s|;.*$)/ # ignore whitespace and comments\n @@lines += Regexp.last_match[1].count(\"\\n\")\n input[0 .. Regexp.last_match[1].length - 1] = ''\n return pop_token(input)\n when /\\A(\\(|\\))/ # parens\n Regexp.last_match[1].intern\n# when /\\A#([^\\)])/\n when /\\A#\\(/ # vector\n input[0 ... 2] = ''\n return [:'(', :vector.sym, tokenize(input)]\n when /\\A'/ # single-quote\n input[0 ... 1] = ''\n return [:'(', :quote.sym,\n if input[0 ... 1] == '('\n tokenize(input)\n else\n pop_token(input)\n end,\n :')']\n when /\\A(-?\\+?[0-9]*\\.[0-9]+)/ # float\n Regexp.last_match[1].to_f\n when /\\A(-?[0-9]+)/ # integer\n Regexp.last_match[1].to_i\n when /\\A(\"(.*?)\")/m # string\n Regexp.last_match[2]\n # Official Scheme valid identifiers:\n # when /\\A([A-Za-z!\\$%&\\*\\.\\/:<=>\\?@\\^_~][A-Za-z0-9!\\$%&\\*\\+\\-\\.\\/:<=>\\?@\\^_~]*)/ # symbol\n # when /\\A([^-0-9\\. \\n\\)][^ \\n\\)]*)/\n when /\\A([^ \\n\\)]+)/ # symbols\n # puts \"#{Regexp.last_match[1]} - #{@@lines}\"\n Regexp.last_match[1].sym.affect{ |sym| sym.file, sym.line = [BusScheme.loaded_files.last, @@lines] }\n else\n raise ParseError if input =~ /[^\\s ]/\n end\n\n # Remove the matched part from the string\n input[0 .. Regexp.last_match[1].length - 1] = '' if token\n return token\n end", "title": "" }, { "docid": "402c412f08563e1def0661d7fdb2edd1", "score": "0.55204976", "text": "def evaluate(str)\n \n\n arr = str.split\n arr.each do |a|\n \nif a==\"+\" \n n = arr.index(\"+\")\n \n total = arr[n-2].to_i + arr[n-1].to_i\n \n arr[n-2] = total\n arr.delete(arr[n])\n arr.delete(arr[n-1])\n \n if arr.length == 1\n return arr[0]\n end\n return evaluate(arr.join(' '))\n \nelsif a==\"*\" \n n = arr.index(\"*\")\n \n total = arr[n-2].to_i * arr[n-1].to_i\n \n arr[n-2] = total\n arr.delete(arr[n])\n arr.delete(arr[n-1])\n \n if arr.length == 1\n return arr[0]\n end\n \n return evaluate(arr.join(' '))\n \nelsif a==\"-\" \n n = arr.index(\"-\")\n \n tot = arr[n-2].to_i - arr[n-1].to_i\n arr[n-2] = tot\n arr.delete(arr[n])\n arr.delete(arr[n-1])\n \n if arr.length == 1\n return arr[0]\n end\n \n return evaluate(arr.join(' '))\n \n elsif a==\"/\" \n n = arr.index(\"/\")\n \n total = arr[n-2].to_f / arr[n-1].to_i\n arr[n-2] = total\n arr.delete(arr[n])\n arr.delete(arr[n-1])\n \n if arr.length == 1\n return arr[0]\n end\n \n return evaluate(arr.join(' '))\n \n else next\n end\n end\n end", "title": "" }, { "docid": "8eff844c9b9197ef224933d6f85d2394", "score": "0.55169314", "text": "def token!\n # at line 1:8: ( EQ | LT | GT | NE | LE | GE | ADD | SUB | MUL | DIV | COLON | SEMICOLON | COMMA | LP | RP | CONCAT | PERCENT | POWER | BANG | INT_CONST | NUM_CONST | STR_CONST | REF2D | TRUE_CONST | FALSE_CONST | QUOTENAME | FUNC_IF | FUNC_CHOOSE | NAME | WS )\n alt_14 = 30\n alt_14 = @dfa14.predict(@input)\n case alt_14\n when 1\n # at line 1:10: EQ\n eq!\n\n when 2\n # at line 1:13: LT\n lt!\n\n when 3\n # at line 1:16: GT\n gt!\n\n when 4\n # at line 1:19: NE\n ne!\n\n when 5\n # at line 1:22: LE\n le!\n\n when 6\n # at line 1:25: GE\n ge!\n\n when 7\n # at line 1:28: ADD\n add!\n\n when 8\n # at line 1:32: SUB\n sub!\n\n when 9\n # at line 1:36: MUL\n mul!\n\n when 10\n # at line 1:40: DIV\n div!\n\n when 11\n # at line 1:44: COLON\n colon!\n\n when 12\n # at line 1:50: SEMICOLON\n semicolon!\n\n when 13\n # at line 1:60: COMMA\n comma!\n\n when 14\n # at line 1:66: LP\n lp!\n\n when 15\n # at line 1:69: RP\n rp!\n\n when 16\n # at line 1:72: CONCAT\n concat!\n\n when 17\n # at line 1:79: PERCENT\n percent!\n\n when 18\n # at line 1:87: POWER\n power!\n\n when 19\n # at line 1:93: BANG\n bang!\n\n when 20\n # at line 1:98: INT_CONST\n int_const!\n\n when 21\n # at line 1:108: NUM_CONST\n num_const!\n\n when 22\n # at line 1:118: STR_CONST\n str_const!\n\n when 23\n # at line 1:128: REF2D\n ref_2_d!\n\n when 24\n # at line 1:134: TRUE_CONST\n true_const!\n\n when 25\n # at line 1:145: FALSE_CONST\n false_const!\n\n when 26\n # at line 1:157: QUOTENAME\n quotename!\n\n when 27\n # at line 1:167: FUNC_IF\n func_if!\n\n when 28\n # at line 1:175: FUNC_CHOOSE\n func_choose!\n\n when 29\n # at line 1:187: NAME\n name!\n\n when 30\n # at line 1:192: WS\n ws!\n\n end\n end", "title": "" }, { "docid": "1085ea14f96750640cf264522003eec4", "score": "0.55051285", "text": "def infixToPostfix(tokens)\n operators = ['-', '+', '/', '%', '*', '^']\n parentheses = ['(', ')'];\n output = []\n stack = []\n\n while tokens.length > 0\n\n # Read a token\n token = tokens.shift\n\n if (!operators.include? token) && (!parentheses.include? token)\n # Add numbers to the output queue\n output.push(token)\n elsif operators.include? token\n # Add operators to the stack, popping any higher\n # precedence operators from the stack first\n while operators.include? stack.last and\n operators.index(stack.last) > operators.index(token)\n output.push(stack.pop())\n end\n stack.push(token)\n else\n if token == '('\n # Add left parentheses to the stack\n stack.push(token)\n else\n # Pop operators from stack to output queue until left parenthesis\n while stack.last != '('\n output.push(stack.pop())\n end\n if !stack.empty? && stack.last == '('\n # Drop the parentheses\n stack.pop()\n else\n return puts 'Mismatched parentheses!'\n end\n end\n end\n end\n\n # All tokens have been read, pop stack to output queue\n while !stack.empty?\n if operators.include? stack.last\n output.push(stack.pop())\n else\n # Parentheses in stack at this point means mismatch\n return puts 'Mismatched parentheses!'\n end\n end\n\n return output\nend", "title": "" }, { "docid": "e8a77bcce215d7023576cd7db2139826", "score": "0.54858977", "text": "def parse_procedure(tokens)\n procedure = []\n\n while token = tokens.shift\n case token\n when \"\", \" \"\n next\n when \"{\"\n procedure << parse_procedure(tokens)\n when \"}\"\n break\n when /^ -? [0-9]+ $/x\n procedure.push Integer(token)\n when /^ -? [0-9]+ \\. [0-9]+ $/x\n procedure.push Float(token)\n when \"true\"\n procedure.push true\n when \"false\"\n procedure.push false\n else\n procedure.push token.to_sym\n end\n end\n\n procedure\n end", "title": "" }, { "docid": "60e86026ef85eb05efb2494b26c102e2", "score": "0.54844564", "text": "def untokenize(sexps)\n spc = -> needs_space { needs_space ? \" \" : \"\" }\n\n sexps.to_enum.reduce([false, \"\"]) do |(needs_space, aggregate), (type, arg, *)|\n case type\n when :val\n [true, aggregate + spc[needs_space] + arg]\n when :'!--'\n [true, aggregate + spc[needs_space] + '--']\n when :'--'\n [true, aggregate + spc[needs_space] + '--' + arg]\n when :'='\n [false, aggregate + \"=\"]\n end\n end[1]\n end", "title": "" }, { "docid": "ad08ded5e30296e1bdfe742391efdfb7", "score": "0.54775316", "text": "def next_token()\n if @input.nil?\n return Token.new(Token::EOF)\n end\n skip_white_space\n# puts @input\n if @input =~ /^exit(\\s|$)/i\n @input .gsub!(/^exit/i, \"\")\n return Token.new(Token::QUIT)\n elsif @input =~ /^quit(\\s|$)/i\n @input.gsub!(/^quit/i, \"\")\n return Token.new(Token::QUIT)\n elsif @input =~ /^list(\\s|$)/i\n @input.gsub!(/^list/i, \"\")\n return Token.new(Token::LIST)\n elsif @input =~ /^clear(\\s|$)/i\n @input.gsub!(/^clear/i, \"\")\n return Token.new(Token::CLEAR)\n elsif @input =~ /^\\(/\n @input.gsub!(/^\\(/, \"\")\n return Token.new(Token::LPAREN)\n elsif @input =~ /^\\)/\n @input.gsub!(/^\\)/, \"\")\n return Token.new(Token::RPAREN)\n elsif @input =~ /^\\+/\n @input.gsub!(/^\\+/, \"\")\n return Token.new(Token::PLUS)\n elsif @input =~ /^\\-/\n @input.gsub!(/^\\-/, \"\")\n return Token.new(Token::SBTR)\n elsif @input =~ /^\\*\\*/\n @input.gsub!(/^\\*\\*/, \"\")\n return Token.new(Token::POWR)\n elsif @input =~ /^\\*/\n @input.gsub!(/^\\*/, \"\")\n return Token.new(Token::MULT)\n elsif @input =~ /^\\//\n @input.gsub!(/^\\//, \"\")\n return Token.new(Token::DIV)\n elsif @input =~ /^\\=/\n @input.gsub!(/^\\=/, \"\")\n return Token.new(Token::ASSGN)\n elsif @input =~ /^[0-9]+\\.?[0-9]*/\n token = Token.new(Token::NUM, nil, /^[0-9]+/.match(@input)[0])\n @input.gsub!(/^[0-9]+\\.?[0-9]*/, \"\")\n return token\n elsif @input =~ /^sqrt(\\s|\\(|$)/i\n @input.gsub!(/^sqrt/i, \"\")\n return Token.new(Token::SQRT)\n elsif @input =~ /^[a-zA-Z]\\w*/\n token = Token.new(Token::ID, /^[a-zA-Z]\\w*/.match(@input)[0], nil)\n @input.gsub!(/^[a-zA-Z]\\w*/, \"\")\n return token\n elsif @input.empty?\n return Token.new(Token::EOF)\n elsif @input =~ /^\\n/\n @input.gsub!(/^\\n/, \"\")\n return Token.new(Token::EOL)\n else\n return Token.new(Token::ERR)\n end\n end", "title": "" }, { "docid": "3dd06e00e6d7895bd5bc3cceb3ea3885", "score": "0.5474204", "text": "def parse input\n @input = input.clone # Save for error msgs\n @tokens = lex input\n @rpn = parse_expr\n assert_eos\n self\n end", "title": "" }, { "docid": "1a214bb2493190aee8bee802cb0b345a", "score": "0.547352", "text": "def token!\n # at line 1:8: ( PLUS | MINUS | MULT | DIV | MOD | EXP | LPAREN | RPAREN | T__19 | INT | FLOAT | MODVAR | UNMODVAR | WHITESPACE )\n alt_3 = 14\n alt_3 = @dfa3.predict( @input )\n case alt_3\n when 1\n # at line 1:10: PLUS\n plus!\n\n when 2\n # at line 1:15: MINUS\n minus!\n\n when 3\n # at line 1:21: MULT\n mult!\n\n when 4\n # at line 1:26: DIV\n div!\n\n when 5\n # at line 1:30: MOD\n mod!\n\n when 6\n # at line 1:34: EXP\n exp!\n\n when 7\n # at line 1:38: LPAREN\n lparen!\n\n when 8\n # at line 1:45: RPAREN\n rparen!\n\n when 9\n # at line 1:52: T__19\n t__19!\n\n when 10\n # at line 1:58: INT\n int!\n\n when 11\n # at line 1:62: FLOAT\n float!\n\n when 12\n # at line 1:68: MODVAR\n modvar!\n\n when 13\n # at line 1:75: UNMODVAR\n unmodvar!\n\n when 14\n # at line 1:84: WHITESPACE\n whitespace!\n\n end\n end", "title": "" }, { "docid": "eb7565ce6ce5a0ee2e57da5bb79b1cde", "score": "0.5469115", "text": "def token!\n # at line 1:8: ( INTEGER | FLOAT | CHAR | BOOL | VOID | NULL | IF | ELSE | AND | OR | WHILE | FOR | INPUT | PRINT | PROGRAM | FUNCTION | RETURN | CLASS | INHER | START | R_END | NEW | ASSIGN | GT | GEQ | LT | LEQ | EQ | NE | ADD | SUB | MULT | DIV | MOD | C_INT | C_FLOAT | C_BOOL | C_CHAR | ID | COLON | SEMICOLON | COMMA | POINT | RP | LP | LB | RB | RBRACE | LBRACE | WHITESPACE | NEWLINE )\n alt_11 = 51\n alt_11 = @dfa11.predict( @input )\n case alt_11\n when 1\n # at line 1:10: INTEGER\n integer!\n\n\n when 2\n # at line 1:18: FLOAT\n float!\n\n\n when 3\n # at line 1:24: CHAR\n char!\n\n\n when 4\n # at line 1:29: BOOL\n bool!\n\n\n when 5\n # at line 1:34: VOID\n void!\n\n\n when 6\n # at line 1:39: NULL\n null!\n\n\n when 7\n # at line 1:44: IF\n if!\n\n\n when 8\n # at line 1:47: ELSE\n else!\n\n\n when 9\n # at line 1:52: AND\n and!\n\n\n when 10\n # at line 1:56: OR\n or!\n\n\n when 11\n # at line 1:59: WHILE\n while!\n\n\n when 12\n # at line 1:65: FOR\n for!\n\n\n when 13\n # at line 1:69: INPUT\n input!\n\n\n when 14\n # at line 1:75: PRINT\n print!\n\n\n when 15\n # at line 1:81: PROGRAM\n program!\n\n\n when 16\n # at line 1:89: FUNCTION\n function!\n\n\n when 17\n # at line 1:98: RETURN\n return!\n\n\n when 18\n # at line 1:105: CLASS\n class!\n\n\n when 19\n # at line 1:111: INHER\n inher!\n\n\n when 20\n # at line 1:117: START\n start!\n\n\n when 21\n # at line 1:123: R_END\n r_end!\n\n\n when 22\n # at line 1:129: NEW\n new!\n\n\n when 23\n # at line 1:133: ASSIGN\n assign!\n\n\n when 24\n # at line 1:140: GT\n gt!\n\n\n when 25\n # at line 1:143: GEQ\n geq!\n\n\n when 26\n # at line 1:147: LT\n lt!\n\n\n when 27\n # at line 1:150: LEQ\n leq!\n\n\n when 28\n # at line 1:154: EQ\n eq!\n\n\n when 29\n # at line 1:157: NE\n ne!\n\n\n when 30\n # at line 1:160: ADD\n add!\n\n\n when 31\n # at line 1:164: SUB\n sub!\n\n\n when 32\n # at line 1:168: MULT\n mult!\n\n\n when 33\n # at line 1:173: DIV\n div!\n\n\n when 34\n # at line 1:177: MOD\n mod!\n\n\n when 35\n # at line 1:181: C_INT\n c_int!\n\n\n when 36\n # at line 1:187: C_FLOAT\n c_float!\n\n\n when 37\n # at line 1:195: C_BOOL\n c_bool!\n\n\n when 38\n # at line 1:202: C_CHAR\n c_char!\n\n\n when 39\n # at line 1:209: ID\n id!\n\n\n when 40\n # at line 1:212: COLON\n colon!\n\n\n when 41\n # at line 1:218: SEMICOLON\n semicolon!\n\n\n when 42\n # at line 1:228: COMMA\n comma!\n\n\n when 43\n # at line 1:234: POINT\n point!\n\n\n when 44\n # at line 1:240: RP\n rp!\n\n\n when 45\n # at line 1:243: LP\n lp!\n\n\n when 46\n # at line 1:246: LB\n lb!\n\n\n when 47\n # at line 1:249: RB\n rb!\n\n\n when 48\n # at line 1:252: RBRACE\n rbrace!\n\n\n when 49\n # at line 1:259: LBRACE\n lbrace!\n\n\n when 50\n # at line 1:266: WHITESPACE\n whitespace!\n\n\n when 51\n # at line 1:277: NEWLINE\n newline!\n\n\n end\n end", "title": "" }, { "docid": "052fb2b363d2ac604361eee5c5d26ed9", "score": "0.5467998", "text": "def verbal_arithmetics(sentence)\n digits = [] # all digits actually used in sentence.\n primary_digits = [] # the digits which should not translate to zero.\n sentence.scan(/\\b(\\w+)\\b/).each { |number|\n number_digits = number.first.split('')\n primary_digits |= [number_digits.first]\n digits |= number_digits\n }\n raise \"Too many digits\" if digits.length > 10\n \n # reorder digits : primary first, then secondary\n secondary_digits = digits - primary_digits\n digits = primary_digits + secondary_digits\n \n # rewrite sentence : \"hello\" => 10*(10*(10*(10*(h)+e)+l)+l)+o\n sentence = sentence.gsub(/\\b(\\w+)\\b/) { '('+$1.split('').inject('') { |s,d| if s.empty? then d else \"10*(#{s})+#{d}\" end } + ')'}.gsub('=', '==')\n \n # test all permutations of actual digits\n (0..9).to_a.permutations(digits.length) { |permutation|\n next if permutation[0...(primary_digits.length)].include?(0) # reject 0 for primary digits\n translation = digits.zip(permutation)\n # evalute \"a=1;b=2;c=3;...;sentence\"\n return translation if eval((translation.map { |(digit, number)| \"#{digit}=#{number}\" } << \"#{sentence}\").join(';'))\n }\n \n # no solution\n nil\nend", "title": "" }, { "docid": "334a064ac4f88ca714143b1a214acc9c", "score": "0.54656285", "text": "def parse(str)\n lexeme = \"\"\n st = Stack.new\n isnumeric = false\n # Iterate over each character from the left\n str.each_char do |symbol|\n # If the current lexeme is not empty and the current symbol is not numeric\n # then the current lexeme must be complete.\n if !(NUMERIC.include? symbol) && lexeme != \"\"\n # If the current lexeme is numeric, convert it to a float\n if isnumeric\n # Ensure lexeme has no more than one decimal point, else stop parsing \n # and return nil\n if lexeme.count(DEC_SEP) == 1 || !lexeme.include?(DEC_SEP)\n lexeme = lexeme.to_f\n else\n puts \"Invalid numeric literal: \" + lexeme\n return\n end\n end\n # Push lexeme onto stack and reset for next lexeme\n st.push(lexeme)\n isnumeric = false\n lexeme = \"\" \n end\n # Check what next symbol is\n case symbol\n # Separators are used in the above selection, so are skipped\n when SEP\n next\n # Plus and minus symbols can be operators or sign a numeric, so add to lexeme\n when ADD_OP, SUB_OP\n lexeme = symbol\n # Mul and div ops are always there own lexeme, push to stack.\n when MUL_OP, DIV_OP\n st.push(symbol)\n # Digits and decimal points get added to current lexeme and set flag \n # isnumeric for the above selection\n when *NUMERIC\n isnumeric = true\n lexeme += symbol\n # If symbol is not recognized, stop parsing and return nil\n else\n puts \"Unknown symbol: \" + symbol \n return\n end\n end\n # Push last lexeme. Must be an operator unless only a numeric was passed.\n if lexeme != \"\"\n if isnumeric\n # Ensure lexeme has no more than one decimal point, else stop parsing \n # and return nil\n if lexeme.count(DEC_SEP) == 1 || !lexeme.include?(DEC_SEP)\n lexeme = lexeme.to_f\n else\n puts \"Invalid numeric literal: \" + lexeme\n return\n end\n end\n st.push(lexeme)\n end\n \n # Return the stack\n return st\n end", "title": "" }, { "docid": "7580a8ddc1673b46eb01d54923b7b0a7", "score": "0.54632765", "text": "def translate_token(input, **options)\n options.reverse_merge!({\n input_language: \"ENGLISH\",\n output_language: \"ARABIC\"\n })\n options.symbolize_keys!\n\n # Create an array like the following by spliting the input by space:\n # [\n # {:word=>\"10\", :type=>\"word\"},\n # {:word=>\"grams\", :type=>\"unit\"},\n # {:word=>\"of\", :type=>\"conjunction\"},\n # {:word=>\"Sodium\", :type=>\"word\"},\n # {:word=>\"Chloride\", :type=>\"word\"}\n # ]\n\n input_words = []\n input.split(\" \").each_with_index do |word, idx|\n if word.match(Regexp.union(Translation::CONJUNCTIONS))\n type = \"conjunction\"\n # elsif word.match(/[0-9]+/) || Translation::UNITS.include?(word)\n elsif word.match(UNIT_REGEX) || Translation::UNITS.include?(word)\n type = \"unit\"\n else\n type = \"word\"\n end\n input_words << {word: word, type: type }\n end\n\n reduced_words = []\n current_word = \"\"\n idx = 0\n\n while idx < input_words.length\n ip = input_words[idx]\n word = ip[:word]\n wtype = ip[:type]\n if wtype == \"conjunction\"\n reduced_words << {word: word, type: wtype }\n idx += 1\n elsif wtype == \"unit\"\n # If type == unit\n while wtype == \"unit\" and idx < input_words.length\n ip = input_words[idx]\n word = ip[:word]\n wtype = ip[:type]\n if wtype == \"unit\"\n current_word += word\n else\n break\n end\n idx += 1\n end\n reduced_words << {word: current_word, type: \"unit\" }\n current_word = \"\"\n else\n # If type == word\n while wtype == \"word\" and idx < input_words.length\n ip = input_words[idx]\n word = ip[:word]\n wtype = ip[:type]\n if wtype == \"word\"\n current_word += word\n else\n break\n end\n idx += 1\n end\n reduced_words << {word: current_word, type: \"word\" }\n current_word = \"\"\n end\n end\n\n # Create a scores list of all word combinations\n # including units, conjunctions\n # e.g: [\n # {\"10\" => {score: nil}, \"grams\" => {score: 0}}, \n # {\"of\" => {score: 0}}, \n # {\"Sodium Chloride\" => {score: nil, translation: 'كلوريد الصوديوم'}}\n # ]\n scores_hash = Translation.translate_token_words(reduced_words, options)\n return scores_hash\n end", "title": "" }, { "docid": "ff64bd40e300c6c1a27829f004bf53cf", "score": "0.5459264", "text": "def postfix_expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 41)\n postfix_expression_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 306:7: primary_expression ( '[' expression ']' | '(' ')' | '(' argument_expression_list ')' | '.' IDENTIFIER | '*' IDENTIFIER | '->' IDENTIFIER | '++' | '--' )*\n @state.following.push(TOKENS_FOLLOWING_primary_expression_IN_postfix_expression_1326)\n primary_expression\n @state.following.pop\n # at line 307:9: ( '[' expression ']' | '(' ')' | '(' argument_expression_list ')' | '.' IDENTIFIER | '*' IDENTIFIER | '->' IDENTIFIER | '++' | '--' )*\n while true # decision 49\n alt_49 = 9\n alt_49 = @dfa49.predict(@input)\n case alt_49\n when 1\n # at line 307:13: '[' expression ']'\n match(T__50, TOKENS_FOLLOWING_T__50_IN_postfix_expression_1340)\n @state.following.push(TOKENS_FOLLOWING_expression_IN_postfix_expression_1342)\n expression\n @state.following.pop\n match(T__51, TOKENS_FOLLOWING_T__51_IN_postfix_expression_1344)\n\n when 2\n # at line 308:13: '(' ')'\n match(T__48, TOKENS_FOLLOWING_T__48_IN_postfix_expression_1358)\n match(T__49, TOKENS_FOLLOWING_T__49_IN_postfix_expression_1360)\n\n when 3\n # at line 309:13: '(' argument_expression_list ')'\n match(T__48, TOKENS_FOLLOWING_T__48_IN_postfix_expression_1374)\n @state.following.push(TOKENS_FOLLOWING_argument_expression_list_IN_postfix_expression_1376)\n argument_expression_list\n @state.following.pop\n match(T__49, TOKENS_FOLLOWING_T__49_IN_postfix_expression_1378)\n\n when 4\n # at line 310:13: '.' IDENTIFIER\n match(T__61, TOKENS_FOLLOWING_T__61_IN_postfix_expression_1392)\n match(IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_postfix_expression_1394)\n\n when 5\n # at line 311:13: '*' IDENTIFIER\n match(T__52, TOKENS_FOLLOWING_T__52_IN_postfix_expression_1408)\n match(IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_postfix_expression_1410)\n\n when 6\n # at line 312:13: '->' IDENTIFIER\n match(T__62, TOKENS_FOLLOWING_T__62_IN_postfix_expression_1424)\n match(IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_postfix_expression_1426)\n\n when 7\n # at line 313:13: '++'\n match(T__58, TOKENS_FOLLOWING_T__58_IN_postfix_expression_1440)\n\n when 8\n # at line 314:13: '--'\n match(T__59, TOKENS_FOLLOWING_T__59_IN_postfix_expression_1454)\n\n else\n break # out of loop for decision 49\n end\n end # loop for decision 49\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 41)\n memoize(__method__, postfix_expression_start_index, success) if @state.backtracking > 0\n\n end\n \n return \n end", "title": "" }, { "docid": "29854cbc44fc2f822b4d2e7d4f95af8a", "score": "0.5451291", "text": "def arithmetic_check\n\t\t#error check\n\t\tif @@tokenize[0] == nil ||\n\t\t\t@@tokenize[1] == nil ||\n\t\t\t@@tokenize[2] == nil ||\n\t\t\t@@tokenize[3] == nil\n\t\t\tabort(\"Illegal input: #{@@tokenize[0]}\") \n\t\tend\n\t\t#form: (op a b) \n\t\top = @@tokenize[0]\n\t\t@@tokenize = @@tokenize[1..@@tokenize.length]\n\n\t\t#lambda expression for each arithmetic symbol\n\t\tsum = lambda { |a| \n\t\t\tsum = a[0]\n\t\t\ti = 1\n\t\t\twhile i < a.length \n\t\t\t\tsum = sum + a[i]\n\t\t\t\ti = i + 1\n\t\t\tend\n\t\t\treturn sum \n\t\t}\n\t\tsub = lambda { |a| \n\t\t\tsub = a[0]\n\t\t\ti = 1\n\t\t\twhile i < a.length \n\t\t\t\tsub = sub - a[i]\n\t\t\t\ti = i + 1\n\t\t\tend\n\t\t\treturn sub \n\t\t}\n\t\tmul = lambda { |a| \n\t\t\tmul = a[0]\n\t\t\ti = 1\n\t\t\twhile i < a.length\n\t\t\t\tmul = mul * a[i]\n\t\t\t\ti = i + 1\n\t\t\tend\n\t\t\treturn mul \n\t\t}\n\t\tdiv = lambda { |a| \n\t\t\tdiv = a[0]\n\t\t\ti = 1\n\t\t\twhile i < a.length\n\t\t\t\tdiv = div / a[i]\n\t\t\t\ti = i + 1\n\t\t\tend\n\t\t\treturn div \n\t\t}\n\t\tmod = lambda { |a| a[0] % a[1] }\n\n\t\t#define a consume a, define b consume b\n\t\t#puts all numerical values into numbers array\n\t\ti = 0\n\t\tnumbers = []\n\t\t#puts @@tokenize[2]\n\t\twhile @@tokenize[2] != ')'\n\t\t\tif @@tokenize[0] == '('\n\t\t\t\tnumbers[i] = root_check\n\t\t\telsif @@tokenize[0].numeric?\n\t\t\t\tnumbers[i] = @@tokenize[0].to_f\n\t\t\t\t@@tokenize = @@tokenize[1..@@tokenize.length]\n\t\t\telse\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti = i + 1\n\t\tend\n\t\tif @@tokenize[0].numeric?\n\t\t\tnumbers[i] = @@tokenize[0].to_f\n\t\t\t@@tokenize = @@tokenize[1..@@tokenize.length]\n\t\t\ti = i + 1\n\t\tend\n\t\tif @@tokenize[0].numeric?\n\t\t\tnumbers[i] = @@tokenize[0].to_f\n\t\t\t@@tokenize = @@tokenize[1..@@tokenize.length]\n\t\t\ti = i + 1\n\t\tend\n\n\t\t#calculates the solution by calling lambda functions\n\t\tif op == '+'\n\t\t\tsolution = sum.call(numbers)\n\t\telsif op == '-'\n\t\t\tsolution = sub.call(numbers)\n\t\telsif op == '*'\n\t\t\tsolution = mul.call(numbers)\n\t\telsif op == '/'\n\t\t\tsolution = div.call(numbers)\n\t\telsif op == 'modulo'\n\t\t\tif numbers.length > 2\n\t\t\t\tabort(\"Illegal input: #{@@tokenize[0]}\") \n\t\t\telse\n\t\t\t\tsolution = mod.call(numbers)\n\t\t\tend\n\t\telse\n\t\t\tabort(\"Illegal input: #{@@tokenize[0]}\") \n\t\tend\n\t\t\n\t\t#return result when the end is reached\n\t\tif @@tokenize[0] == ')'\n\t\t\t@@tokenize = @@tokenize[1..@@tokenize.length]\n\t\t\treturn solution\n\t\telse\n\t\t\tabort(\"Illegal input: #{@@tokenize[0]}\") \n\t\tend\n\tend", "title": "" }, { "docid": "b8d2cd122bfd07ad48411a519d428633", "score": "0.5439004", "text": "def parse\n return @tree if @tree\n\n # parse tree\n tree = MetaArray.new\n\n # paragraph, sentence, subsentence\n p_id, s_id, ss_id = 0, 0, 0\n\n # current token\n token = ''\n\n # run FSM\n text.each_char do |c|\n case c\n when END_OF_LINE then begin\n case token\n when EMPTY then token << c\n when END_OF_LINE then begin\n token = ''\n p_id += 1\n s_id = 0\n ss_id = 0\n end\n else\n tree[p_id][s_id][ss_id] << token\n token = c\n end\n end\n when SEPARATOR then begin\n case token\n when EMPTY\n else\n tree[p_id][s_id][ss_id] << token\n while tree[p_id][s_id][ss_id].last == c\n tree[p_id][s_id][ss_id].pop\n end\n tree[p_id][s_id][ss_id] << c\n token = ''\n end\n end\n when PUNCTUATION then begin\n case token\n when EMPTY\n else\n tree[p_id][s_id][ss_id] << token\n tree[p_id][s_id][ss_id] << c\n token = ''\n s_id += 1\n ss_id = 0\n end\n end\n when SENTENCE_PUNCTUATION then begin\n case token\n when EMPTY\n else\n tree[p_id][s_id][ss_id] << token\n tree[p_id][s_id][ss_id] << c\n token = ''\n ss_id += 1\n end\n end\n when RUSSIAN_LEXEME then begin\n case token\n when END_OF_LINE then begin\n tree[p_id][s_id][ss_id] << ' '\n token = c\n end\n else\n token << c\n end\n end\n when ENGLISH_LEXEME then begin\n case token\n when END_OF_LINE then begin\n tree[p_id][s_id][ss_id] << ' '\n token = c\n end\n else\n token << c\n end\n end\n when DIGIT then begin\n case token\n when END_OF_LINE then begin\n tree[p_id][s_id][ss_id] << ' '\n token = c\n end\n else\n token << c\n end\n end\n when DIGIT_LETTER then begin\n case token\n when END_OF_LINE then begin\n tree[p_id][s_id][ss_id] << token\n token = c\n end\n else\n token << c\n end\n end\n end\n end\n\n unless token.empty?\n tree[p_id][s_id][ss_id] << token\n end\n\n tree.delete(nil)\n\n @tree = tree.to_a\n end", "title": "" }, { "docid": "01bc59f8a145d263a14fbbdd1db183e4", "score": "0.5438984", "text": "def analyze(string, equal = true) \n @i = 0\n state = 0\n return false if string == \"\"\n @@string = string if string.is_a? String\n unless string.is_a? Array\n unless balanced_brackets? string\n puts \"Sintax Error: unbalanced brackets\"\n return false \n end\n end\n token = @lexer.tokenize(string) unless string.is_a? Array\n token = string if string.is_a? Array\n while @i < token.size\n \n case state\n # beginning state\n when 0\n case token[@i].attribute\n when \"SUM_OPERATOR\"\n state = 1\n when \"VARIABLE\"\n state = 2\n when \"NUMBER\"\n state = 2\n when \"L_BRACE\"\n sizer = Sizer.new\n return false unless sizer.analyze(token[(@i+1)...token.size])\n @i += sizer.count + 1\n state = 2\n when \"KEYWORD\"\n case token[@i].me\n when \"mx:\"\n state = 6\n when \"integ:\"\n state = 7\n when \"shwvar:\"\n unless equal\n PrintError.reduced(token[@i],@@string)\n return false\n end\n state = 5\n when \"solve:\"\n state = 8\n when \"f:\"\n state = 4\n else\n if [\"t:\",\"det:\",\"norm:\",\"id_mx:\",\"shw:\"].include? token[@i].me then\n unless equal or token[@i].me != \"shw:\"\n PrintError.reduced(token[@i],@@string)\n return false\n end\n state = 3\n elsif not Tool.keys.include? token[@i].me then\n PrintError.unknown(token[@i],@@string)\n return false\n else\n PrintError.reduced(token[@i],@@string)\n return false\n end\n end\n else\n PrintError.default(token[@i],@@string)\n return false\n end\n \n # expecting numbers,variables, keywords, (\n when 1\n case token[@i].attribute\n when \"NUMBER\"\n state = 2\n when \"VARIABLE\"\n state = 2\n when \"L_BRACE\"\n sizer = Sizer.new\n return false unless sizer.analyze(token[(@i+1)...token.size])\n @i += sizer.count + 1\n state = 2\n when \"KEYWORD\"\n case token[@i].me\n when \"mx:\"\n state = 6\n when \"integ:\"\n state = 7\n when \"shwvar:\"\n state = 5\n when \"solve:\"\n state = 8\n when \"f:\"\n state = 4\n else\n if [\"t:\",\"det:\",\"norm:\",\"id_mx:\"].include? token[@i].me then\n state = 3\n elsif not Tool.keys.include? token[@i].me then\n PrintError.unknown(token[@i],@@string)\n return false\n else\n PrintError.reduced(token[@i],@@string)\n return false\n end\n end\n else\n PrintError.default(token[@i],@@string)\n return false\n end\n \n # expecting operators, )\n when 2\n case token[@i].attribute\n when \"OPERATOR\"\n state = 1\n when \"SUM_OPERATOR\"\n state = 1\n when \"EQUAL_OP\"\n if equal\n unless @i + 1 >= token.size\n sizer = Sizer.new\n return sizer.analyze(token[(@i+1)...token.size],false)\n end\n PrintError.missing_expression_after_equal(@i+1,@@string)\n return false\n else\n PrintError.default(token[@i],@@string)\n return false\n end\n when \"TO_FILE_OP\"\n unless equal\n PrintError.default(token[@i],@@string)\n return false\n end\n state = 4\n when \"R_BRACE\"\n return true\n else\n PrintError.default(token[@i],@@string)\n return false\n end\n \n # expecting only variables or numbers\n when 3\n case token[@i].attribute\n when \"VARIABLE\"\n state = 2\n when \"NUMBER\"\n state = 2\n else\n PrintError.default(token[@i],@@string)\n return false\n end\n state = 5 if token[@i-1].me == \"shw:\"\n \n # expects blocks (full chek) than nothing\n when 4\n return false unless check_block(token)\n state = 5\n \n # expects nothing\n when 5\n PrintError.default(token[@i],@@string)\n return false\n \n # checking mx arguments (full check)\n when 6\n case token[@i].attribute\n when \"KEYWORD\"\n if token[@i].me == \"from:\" then\n @i += 1\n unless @i < token.size\n PrintError.missing(token[@i-1],@@string)\n return false\n end\n return false unless check_block(token)\n state = 2\n else\n PrintError.missmatch(token[@i],@@string,\"keyword 'from:' or block\")\n return false\n end\n when \"QUOTES\"\n return false unless check_block(token)\n unless @i+1 >= token.size\n if token[@i+1].attribute == \"KEYWORD\" then\n @i += 1\n# unless @i < token.size\n# PrintError.missing(token[@i-1],@@string)\n# return false\n# end\n unless token[@i].me == \"as:\"\n PrintError.missmatch(token[@i],@@string,\"keyword 'as:' or operator\")\n return false\n end\n @i += 1\n unless @i < token.size\n PrintError.missing_general_string(token[@i-1].position+token[@i-1],@@string)\n return false\n end\n if token[@i].attribute == \"QUOTES\"\n return false unless check_block(token)\n else\n unless token[@i].attribute == \"VARIABLE\"\n PrintError.default(token[@i],@@string)\n return false \n end\n end\n end\n end\n state = 2\n end\n \n # checking integ arguments (full check)\n when 7 \n unless @i < token.size\n PrintError.missing(token[@i-1],@@string)\n return false\n end \n if token[@i].attribute == \"QUOTES\" then\n return false unless check_block(token)\n elsif token[@i].attribute != \"VARIABLE\" then\n PrintError.missmatch(token[@i],@@string,\"variable or block\")\n return false\n end\n @i += 1\n unless @i < token.size\n PrintError.missing_integ_range(token[@i-1].position+1,@@string)\n return false\n end\n return false unless check_block(token)\n @i += 1\n unless @i < token.size\n PrintError.numPoint_missing(token[@i-1].position+1,@@string)\n return false\n end\n unless @i + 1 >= token.size\n if token[@i+1].attribute == \"QUOTES\" then\n @i += 1\n return false unless check_block(token)\n end\n end\n state = 2\n \n # checking solve args (full check) \n when 8\n inner_state = 0\n while !(token[@i].attribute == \"EQUALS_TO\") and @i < token.size\n case inner_state \n when 0\n if token[@i].attribute == \"VARIABLE\" or token[@i].attribute == \"NUMBER\" then\n inner_state = 1\n elsif token[@i].attribute == \"L_BRACE\"\n sizer = Sizer.new\n return false unless sizer.analyze(token[(@i+1)...token.size])\n @i += sizer.count + 1\n else\n PrintError.unexpected_token_in_solve(token[@i],@@string)\n return false\n end\n when 1\n if token[@i].attribute == \"OPERATOR\" then\n inner_state = 0\n else\n PrintError.unexpected_token_in_solve(token[@i],@@string)\n return false\n end\n end\n @i += 1\n end \n state = 1 \n end\n @i += 1\n end\n \n unless state == 2 or state == 5 \n if token[@i-1].attribute == \"R_BRACE\" then\n tk = token[@i-2]\n else\n tk = token[@i-1]\n end \n PrintError.missing(tk,@@string)\n return false\n end\n return true\n end", "title": "" }, { "docid": "fd2727579751e76a287da0ecb1f7f156", "score": "0.5436623", "text": "def shunt(input) #input string\r\n index = 0 #input string index\r\n output = Array.new #output queue (TODO: make efficient)\r\n ops = Array.new #operator stack\r\n\r\n #load token\r\n while(index < input.length)\r\n token = '' #token holder\r\n case input[index..-1]\r\n when /^\\d+/ #number token\r\n token = $~.to_s\r\n output.push(token)\r\n when /^[d\\-\\+\\/\\*]/ #operator token\r\n #more complex, expand for precedence\r\n token = $~.to_s\r\n ops.push(token)\r\n when /^\\(/ #left paren\r\n token = $~.to_s\r\n ops.push(token)\r\n when /^\\)/ #right paren\r\n token = $~.to_s\r\n #shift operators to the output queue until we find the matching paren\r\n last_op = ops.pop()\r\n while not last_op == '(' and not ops.empty?\r\n output.push(last_op)\r\n last_op = ops.pop()\r\n end\r\n\r\n if last_op != '('\r\n puts 'mismatched parentheses'\r\n return\r\n end\r\n\r\n\r\n else\r\n puts 'invalid'\r\n\r\n end\r\n\r\n index += token.length #step the token position\r\n\r\n end\r\n\r\n #finalize\r\n while not ops.empty?\r\n token = ops.pop()\r\n if token == '(' or token == ')'\r\n puts 'mismatched parentheses'\r\n return\r\n else\r\n output.push(token)\r\n end\r\n end\r\n\r\n\r\n\r\n puts 'output: ' + output.to_s\r\n puts 'ops: ' + ops.to_s\r\n\r\n ostr = ''\r\n output.each do |t|\r\n ostr += t += ' '\r\n end\r\n ostr = ostr[0..-2] #truncate trailing space\r\n puts ostr\r\n\r\n output\r\nend", "title": "" }, { "docid": "f663bb8970015dcfcfa008c45152d8fd", "score": "0.54354495", "text": "def token!\n # at line 1:39: ( QUOTED_STRING | SL_COMMENT | ML_COMMENT | FROM | INTO | UPDATE | JOIN_CLAUSE | WS | LBR | RBR )\n alt_28 = 10\n alt_28 = @dfa28.predict( @input )\n case alt_28\n when 1\n # at line 1:41: QUOTED_STRING\n quoted_string!\n\n when 2\n # at line 1:55: SL_COMMENT\n sl_comment!\n\n when 3\n # at line 1:66: ML_COMMENT\n ml_comment!\n\n when 4\n # at line 1:77: FROM\n from!\n\n when 5\n # at line 1:82: INTO\n into!\n\n when 6\n # at line 1:87: UPDATE\n update!\n\n when 7\n # at line 1:94: JOIN_CLAUSE\n join_clause!\n\n when 8\n # at line 1:106: WS\n ws!\n\n when 9\n # at line 1:109: LBR\n lbr!\n\n when 10\n # at line 1:113: RBR\n rbr!\n\n end\n end", "title": "" }, { "docid": "0c14f32023d9544ddd5a8b860e5f86f9", "score": "0.5432142", "text": "def parse_note\n\n # Split note into lines\n note_lines = self.note.split /\\n/\n\n note_lines.each do |line|\n\n # @NOTE Rules engine is where the magic lies -- here I will demonstrate a couple rules\n\n\n # RULE ONE - Words\n # if we match /^\\w+\\s+[\\-\\+]/ then we are possibly a word and need to be looked at closer\n if line.match /^\\w+\\s+[\\-\\+]/\n # Get our word and the attempts which there could be many of\n word, *attempts = line.split /\\s/\n\n # @TODO check to make sure we only have +- in the attempts or something is wonky\n # @TODO Check to see if there is a , in attempts then maybe this is a list of attempts etc..\n # This can get complext fast.\n\n # Iterate through our attempts and save them\n attempts.join.each_char.with_index do |attempt, index|\n # Create that attempt\n create_attempt index, word, attempt\n end\n end\n\n\n # RULE TWO - Errors\n # if we match /^errors:\\s*\\w+/ then we possibly have a list of error words\n if line.match /^errors:\\s*\\w+/\n # Get our error status and then the potential words\n key, *words = line.split ':'\n\n # Process / Flatten words... etc.. this is quick and dirty.. again rules engine goes here\n words = words.join.strip.split /\\s/\n\n # process each word so as to remove whatever... and then save them as a failed attempt\n words.each_with_index do |word, index|\n # @TODO process.. word. .make sure not +- etc..\n\n # Create that failed attempt\n create_attempt(index, word.gsub(/\\W/,'')) unless word.gsub(/[0-9]/,'').empty?\n end\n end\n\n\n # RULE THREE - Nouns|Verbs:\n # If we match /^(nouns|verbs):\\s[\\-\\+]/ then catch those +- attempts and log them as wordless attempts\n if line.match /^(nouns|verbs):\\s[\\-\\+]/\n # Get our noun key and then the attempts\n key, *attempts = line.split ':'\n\n # only listen to the +- information for now.\n attempts.join.gsub(/[^\\-\\+]/,'').each_char.with_index do |attempt, index|\n # Create a wordless attempt\n create_attempt index, nil, attempt\n end\n end\n\n # @TODO Talk to this...\n # More rules... again this would be a full rules engine that we can change over time, and can apply uniquely to\n # each therapist individually. Allowing for the ability to customize how things are parsed on a per therapist\n # level without forcing each therapist to learn a whole new way of doing things. In fact their day to day note\n # taking wouldn't change at all and we could go back in time and reparse to gleen more data as we make the parser\n # smarter over time.\n\n end\n\n end", "title": "" }, { "docid": "bb297fb386137cd10096663b43c03fb7", "score": "0.5422736", "text": "def grammar\n # first, assume reasonable defaults\n\n language = 'en' # default language: English\n dividers = /[,;]/ # default: split on comma and semicolon\n trim_expressions = '' # default: don't trim any expressions\n trim_after = nil # default: don't trim any trailing text\n\n # now bring in source-specific information\n\n if ['Cnt', 'Bxn', 'Egt', 'Fts'].include? @code\n # Spanish-language sources\n language = 'es'\n elsif ['Aca', 'Bgn', 'Btn', 'Hmn', 'Rch', 'Dln', 'Gzl', 'Jnu', 'Jsn', 'Rve', 'Lvs', 'Lch', 'Lmt', 'Myr', 'Mfr', 'Rdl', 'Sgs'].include? @code\n # French-language sources\n language = 'fr'\n elsif ['Ths'].include? @code\n # German-language sources\n language = 'de'\n end\n\n if ['Aca', 'Bxn', 'Jsn', 'Mtu', 'Grn'].include? @code\n # split by comma, semicolon, period\n dividers = /(,|;|\\. )/\n elsif ['Atn', 'Bwh', 'Hmn', 'Crk', 'Hdy', 'Smt', 'Rkj'].include? @code\n # don't split at all\n dividers = '\\n' # dividers = nil doesn't work\n elsif ['Bgn', 'Bst', 'Brn', 'Gms', 'Tmo'].include? @code\n # split by period\n dividers = '.'\n elsif ['Bkr', 'Bgs'].include? @code\n # split by comma, period\n dividers = /(,|\\. )/\n elsif ['Bge', 'Bck', 'Cbl', 'Chn', 'Cdn', 'Dvs', 'Dnr', 'Dln', 'Dye', 'Ebt', 'Egt', 'Fbg', 'Fth', 'Fox', 'Fts', 'Hzd', 'Hry', 'Hvn', 'Hnh', 'Fny', 'Mta', 'Myr', 'Mtx', 'Mnr', 'Mbg', 'Kvt', 'Ply', 'Ebt', 'Mka', 'Sby', 'Sve', 'Sta', 'Sma', 'Sks', 'Tbs', 'Tgr', 'Whe', 'Whr', 'Rmn', 'Wms', 'Ykr'].include? @code\n # split by semicolon\n dividers = ';'\n elsif ['Drd', 'Hbn', 'Mkn', 'Rdl', 'Bke'].include? @code\n # split by semicolon, period\n dividers = /(;|\\. )/\n end\n\n if ['McP', 'Dsn', 'Gzl', 'Sby', 'Sph'].include? @code\n # Trim all (parenthetical expressions)\n trim_expressions = /\\(.*\\)/\n elsif ['Cnt', 'Aca', 'Bse', 'Hmn', 'Cbl', 'Cpl', 'Crn', 'Chn', 'Chl', 'Cwd', 'Clk', 'Cek', 'Crk', 'Dvs', 'Dtn', 'Dnr', 'Dty', 'Fth', 'Fox', 'Fts', 'Gmd', 'McC', 'Hwd', 'Ivs', 'Lmt', 'Lvs', 'Lmt', 'Lbr', 'Mar', 'Mta', 'Myr', 'McE', 'Mnr', 'Mfr', 'Mtu', 'Gty', 'Ply', 'Rby', 'Mka', 'Clk', 'Sve', 'Shd', 'Sma', 'Stn', 'Sks', 'Tgr', 'Whe', 'Mke', 'Whr'].include? @code\n # Trim parenthetical expressions that are <= 4 chars or contain numbers\n trim_expressions = /\\((.{0,4}|.*[0-9].*)\\)/\n elsif ['Stz', 'Bck'].include? @code\n # Trim parenthetical expressions that contain numbers\n trim_expressions = /\\(.*[0-9].*\\)/\n elsif ['Kch', 'Ray'].include? @code\n # Trim all [bracketed expressions]\n trim_expressions = /\\[.*\\]/\n elsif ['Rsr'].include? @code\n # Trim all \"expressions in quotes\"\n trim_expressions = /\".*\"/\n end\n\n if ['Btl', 'Bck', 'Chl', 'McC', 'Hpr', 'Mbg', 'Wte'].include? @code\n # Trim everything after a period\n trim_after = '.'\n elsif ['Shd'].include? @code\n # Trim everything after an equals sign\n trim_after = '='\n end\n\n {\n :language => language,\n :dividers => dividers,\n :trim_expressions => trim_expressions,\n :trim_after => trim_after\n }\n end", "title": "" }, { "docid": "0d16a38dab6ad4323d06781d79be5973", "score": "0.5422525", "text": "def solve_exp_rpn(exp)\n # create a new stack\n stack = FiLo.new\n tokens = exp.split\n \n tokens.each do |token|\n if token =~ /^\\d+\\.?\\d?$/\n # it is a number (fixnum or float)\n stack.push(token.to_f)\n elsif token =~ /[A-Za-z]/\n # do nothing.. ignore it simply\n else\n # is an operator\n tmp_number = stack.pop()\n \n case token\n when '+'\n stack.push(stack.pop() + tmp_number)\n when '-'\n stack.push(stack.pop() - tmp_number)\n when '*'\n stack.push(stack.pop() * tmp_number)\n when '/'\n stack.push(stack.pop() / tmp_number)\n end\n end\n end\n \n stack.pop()\nend", "title": "" }, { "docid": "032900a7d946295a35e5d1699db98131", "score": "0.5414342", "text": "def parse_formula\n @tokens.inject([]) do |acc, token|\n acc + add_non_redundant_elements(token, acc)\n end\n end", "title": "" }, { "docid": "08a91a1ed2a7530884b814da25a64153", "score": "0.5413164", "text": "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n result = nil\n r = nil\n r2 = nil\n\n begin\n # at line 61:5: r= mult ( '+' r2= mult | '-' r2= mult )*\n @state.following.push( TOKENS_FOLLOWING_mult_IN_expression_160 )\n r = mult\n @state.following.pop\n # at line 62:5: ( '+' r2= mult | '-' r2= mult )*\n while true # decision 1\n alt_1 = 3\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == PLUS )\n alt_1 = 1\n elsif ( look_1_0 == MINUS )\n alt_1 = 2\n\n end\n case alt_1\n when 1\n # at line 62:7: '+' r2= mult\n match( PLUS, TOKENS_FOLLOWING_PLUS_IN_expression_168 )\n @state.following.push( TOKENS_FOLLOWING_mult_IN_expression_172 )\n r2 = mult\n @state.following.pop\n # --> action\n r += r2 \n # <-- action\n\n when 2\n # at line 63:7: '-' r2= mult\n match( MINUS, TOKENS_FOLLOWING_MINUS_IN_expression_182 )\n @state.following.push( TOKENS_FOLLOWING_mult_IN_expression_186 )\n r2 = mult\n @state.following.pop\n # --> action\n r -= r2 \n # <-- action\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n # --> action\n result = r \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return result\n end", "title": "" }, { "docid": "e91936aebf21dbfe25a2f985bfab6818", "score": "0.54047525", "text": "def parse(expression)\n stack =[]\n expression.each do |term|\n case term\n \n # If the term is an operand, push it to stack \n when /\\d/ \n stack.push(term)\n \n # If the term is an operator '* | \\'\n when /[ \\* \\/ ]/\n # Pop out two operands from the stack\n\t right_operand = stack.pop\n\t left_operand = stack.pop\n\t \n\t #Check for a compound operand, left and right define the match object\n\t left = /[\\+ \\- \\* \\/]/.match(left_operand)\n\t right = /[\\+ \\- \\* \\/]/.match(right_operand)\n\t \n\t #Check precedence to minimize parentheses \n\t #if left operand is compound, check precedence of the new operator with compound one.\n\t #left_par and right_par specifies whether to include parentheses or not\n\t if left\n\t left_par = check_precedence(term,left.to_s)\n\t elsif right \n\t right_par = check_precedence(term,right.to_s)\n\t end \n\t\n\t #If parentheses are required:\n\t if left_par || right_par\n \t#Place parentheses around the compound operands\n \t\tleft_operand = \"(\" + left_operand + \")\" if left\n\t\tright_operand = \"(\" + right_operand + \")\" if right \n end\n \n\t #Form a value by combining the left and right operand with operator in the middle\n\t val = left_operand + term + right_operand\n\t #Push the value to stack\n\t stack.push(val) \n \n #If operator is - or +\t\n when /[\\+ -]/\n # Pop the operands and form a value\n right_operand = stack.pop\n left_operand = stack.pop\n\t val = left_operand + term + right_operand\n #Push to stack\t \n\t stack.push(val)\n \t \n else \n #Invalid operator\n puts \"invalid operator{term}\"\n end\n end\n return stack\n end", "title": "" }, { "docid": "4110b768e86b831b7ee5d865e4bab611", "score": "0.54014844", "text": "def rpn( exp )\n a = [] # operands stack\n op = [] # operator stack\n\n exp.each_char do |c|\n next if c == '(' # discard opening brackets\n\n # When closing brackets, execute last operation and push result back to stack\n if c == ')'\n aux = a.pop\n a1 = \"#{a.pop}#{aux}#{op.pop}\"\n a << a1\n\n # Push operators to stack\n elsif (c == '^') or (c == '/') or (c == '*') or (c == '-') or (c == '+')\n op << c\n\n # Everything else is an operand. Push them to the stack\n else\n a << c\n end\n\n end\n\n a.pop\nend", "title": "" }, { "docid": "e01b018774d8ed27bba2633d8673c13a", "score": "0.53857905", "text": "def token!\n # at line 1:8: ( T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | ID | WS | SL_COMMENT | ML_COMMENT | DOT )\n alt_7 = 15\n alt_7 = @dfa7.predict( @input )\n case alt_7\n when 1\n # at line 1:10: T__11\n t__11!\n\n when 2\n # at line 1:16: T__12\n t__12!\n\n when 3\n # at line 1:22: T__13\n t__13!\n\n when 4\n # at line 1:28: T__14\n t__14!\n\n when 5\n # at line 1:34: T__15\n t__15!\n\n when 6\n # at line 1:40: T__16\n t__16!\n\n when 7\n # at line 1:46: T__17\n t__17!\n\n when 8\n # at line 1:52: T__18\n t__18!\n\n when 9\n # at line 1:58: T__19\n t__19!\n\n when 10\n # at line 1:64: T__20\n t__20!\n\n when 11\n # at line 1:70: ID\n id!\n\n when 12\n # at line 1:73: WS\n ws!\n\n when 13\n # at line 1:76: SL_COMMENT\n sl_comment!\n\n when 14\n # at line 1:87: ML_COMMENT\n ml_comment!\n\n when 15\n # at line 1:98: DOT\n dot!\n\n end\n end", "title": "" }, { "docid": "4a12df3811787accac4de823cb8746c9", "score": "0.5383177", "text": "def decode(_query)\n\n\t\t# check Empty Query String\n\t\tif _query.blank? then\n\t\t\treturn []\n\t\tend\n\n\t\t# form Query String for Parsing\n\t\tquery_string = '&' + _query + ';'\n\n\t\tqueries = []\n\t\t# for Proxy Parameters\n\t\twhile true\n\t\t\t## check Curly Brackets\n\t\t\tif ! matches = query_string.match(/\\A(?:|(.*?)([&|]))({.*?[^%]})(.*)\\z/) then\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\t## to Semantics Variables\n\t\t\tall_match = matches[0]\n\t\t\tpre_match = matches[1]\n\t\t\tprocess = matches[2]\n\t\t\tproxy = matches[3]\n\t\t\tpost_match = matches[4]\n\n\t\t\t## delete Curly Bracket\n\t\t\tproxy = proxy.sub(/\\A{(.*)}\\z/, '\\1');\n\n\t\t\t## for Virtical Proxy Module\n\t\t\tif 0 === proxy.index('/') then\n\t\t\t\tlocation = 'self'\n\t\t\t## for Horizontal Proxy Module\n\t\t\telsif matches = proxy.match(/\\A(http(?:|s):\\/\\/.+?)\\//i) then\n\t\t\t\tlocation = matches[1]\n\t\t\t\tproxy = proxy.gsub(/#{location}/, '')\n\t\t\t## for Others\n\t\t\telse\n\t\t\t\traise 'The Proxy Parameters are having unknown URL scheme: ' + proxy\n\t\t\tend\n\n\t\t\t### to Objects\n\t\t\tqueries << [\n\t\t\t\tprocess,\n\t\t\t\tlocation,\n\t\t\t\t'{}',\n\t\t\t\tproxy,\n\t\t\t]\n\n\t\t\t## reform Query String for Parsing\n\t\t\tquery_string = pre_match + post_match\n\t\tend\n\n\t\t# escape Operators\n\t\tesc_operators = []\n\t\[email protected]_with_index do |operator, i|\n\t\t\tesc_operators[i] = Regexp.escape(operator)\n\t\tend\n\n\t\t# form Operators Regex\n\t\toperators_regex = '\\A(.*?)(' + esc_operators.join('|') + ')(.*?)\\z'\n\n\t\tquery_parts = []\n\t\twhile true\n\t\t\t## matching Operators\n\t\t\tif ! matches = query_string.match(/#{operators_regex}/) then\n\t\t\t\tbreak;\n\t\t\tend\n\n\t\t\t## to Semantics Variables\n\t\t\tall_match = matches[0]\n\t\t\toperand = matches[1]\n\t\t\toperator = matches[2]\n\t\t\tpost_match = matches[3]\n\n\t\t\t## from Alias Operators to Master Operators\n\t\t\tif operator == '.ge.' || operator == '%3E=' then\n\t\t\t\toperator = '>='\n\t\t\telsif operator == '.le.' || operator == '%3C=' then\n\t\t\t\toperator = '<='\n\t\t\telsif operator == '.gt.' || operator == '%3E' then\n\t\t\t\toperator = '>'\n\t\t\telsif operator == '.lt.' || operator == '%3C' then\n\t\t\t\toperator = '<'\n\t\t\telsif operator == '.ij.' || operator == '%3E%3C' then\n\t\t\t\toperator = '><'\n\t\t\telsif operator == '.lj.' || operator == '%3C%3C' then\n\t\t\t\toperator = '<<'\n\t\t\telsif operator == '.rj.' || operator == '%3E%3E' then\n\t\t\t\toperator = '>>'\n\t\t\telsif operator == '.cj.' || operator == '%3C%3E' then\n\t\t\t\toperator = '<>'\n\t\t\tend\n\n\t\t\t## map to Query Parts\n\t\t\tif operand != '' then\n\t\t\t\tquery_parts << operand\n\t\t\tend\n\t\t\tquery_parts << operator\n\n\t\t\t## from Post Matcher to Query String\n\t\t\tquery_string = post_match\n\n\t\tend\n\n\t\t# check Data-Type-Head Module\n\t\tdata_type_id = query_parts.index('data-type')\n\t\tdata_type = nil\n\t\tif (nil != data_type_id) && (query_parts[data_type_id + 1] == ':=') then\n\t\t\tdata_type = query_parts[data_type_id + 2]\n\t\tend\n\n\t\t# map to Queries\n\t\tquery_parts.each_with_index do |query_part, i|\n\t\t\t## not Central Operators\n\t\t\tif ! @central_operators.include?(query_part) then\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\t## to Semantics Variables\n\t\t\tlogical_operator = query_parts[i - 2];\n\t\t\tleft_operand = query_parts[i - 1];\n\t\t\tcentral_operator = query_part;\n\t\t\tright_operand = query_parts[i + 1];\n\n\t\t\t## for Data-Type-Head Module\n\t\t\t### for Strict Data Type\n\t\t\tif data_type == 'true' then\n\t\t\t\tregex = /\\A%(?:22|27|[\"\\'])(.*?)%(?:22|27|[\"\\'])\\z/\n\t\t\t\t### delete first and last quotes for String Data Type\n\t\t\t\tif right_operand.match(regex) then\n\t\t\t\t\tright_operand = right_operand.sub(regex, '\\1')\n\t\t\t\t### for Not String Type\n\t\t\t\telse\n\t\t\t\t\t#### to Boolean\n\t\t\t\t\tif right_operand == 'true' then\n\t\t\t\t\t\tright_operand = true\n\t\t\t\t\t#### to Boolean\n\t\t\t\t\telsif right_operand == 'false' then\n\t\t\t\t\t\tright_operand = false\n\t\t\t\t\t#### to Null\n\t\t\t\t\telsif right_operand == 'null' then\n\t\t\t\t\t\tright_operand = nil\n\t\t\t\t\t#### to Integer\n\t\t\t\t\telsif right_operand.match(/\\A\\d\\z|\\A[1-9]\\d+\\z/) then\n\t\t\t\t\t\tright_operand = right_operand.to_i\n\t\t\t\t\t#### to Float\n\t\t\t\t\telsif right_operand.match(/\\A\\d\\.\\d+\\z|\\A[1-9]\\d+\\.\\d+\\z/) then\n\t\t\t\t\t\tright_operand = right_operand.to_f\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t## validate Left Operand\n\t\t\tif @operators.include?(left_operand) then\n\t\t\t\traise 'The parameter is having invalid left operands: ' + _query\n\t\t\tend\n\n\t\t\t## validate Right Operand\n\t\t\t### to Empty String\n\t\t\tif @logical_operators.include?(right_operand) || right_operand == ';' then\n\t\t\t\tright_operand = ''\n\t\t\t### for Double NV Operators\n\t\t\telsif @central_operators.include?(right_operand) then\n\t\t\t\traise 'The parameter is having double comparing operators: ' + _query\n\t\t\tend\n\n\t\t\t## map to Queries\n\t\t\t### for Head Parameters\n\t\t\tif central_operator == ':=' then\n\t\t\t\t#### validate Logical Part\n\t\t\t\tif logical_operator != '&' then\n\t\t\t\t\traise 'The Head Parameters must be a “and” logical operator: ' + _query\n\t\t\t\tend\n\t\t\t### for Assign Parameters\n\t\t\telsif central_operator == '=' then\n\t\t\t\t#### validate Logical Part\n\t\t\t\tif logical_operator != '&' then\n\t\t\t\t\traise 'The Assign Parameters must be a “&” logical operator: ' + _query\n\t\t\t\tend\n\t\t\t### for Join Parameters\n\t\t\telsif @join_operators.include?(central_operator) then\n\t\t\t\t#### validate Logical Part\n\t\t\t\tif logical_operator != '&' then\n\t\t\t\t\traise 'The Join Parameters must be a “&” logical operator: ' + _query\n\t\t\t\tend\n\t\t\t### for Search Parameters\n\t\t\telsif @compare_operators.include?(central_operator) then\n\t\t\t\t#### validate Logical Part\n\t\t\t\tif ! @logical_operators.include?(logical_operator) then\n\t\t\t\t\traise 'The Search Parameters are having invalid logical operators: ' + _query\n\t\t\t\tend\n\t\t\t## for Others\n\t\t\telse\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\t#### to Queries\n\t\t\tqueries << [\n\t\t\t\tlogical_operator,\n\t\t\t\tleft_operand,\n\t\t\t\tcentral_operator,\n\t\t\t\tright_operand,\n\t\t\t]\n\t\tend\n\n\t\t# init Searches 1st Logical Operator\n\t\tqueries[0][0] = ''\n\n\t\t# return\n\t\treturn queries\n\tend", "title": "" }, { "docid": "0c9a1fe215f2526f817d1c1b72cf271d", "score": "0.5375011", "text": "def sentence_state(str_with_pos_tags)\n state = POSITIVE\n #checking single tokens for negated words\n st = str_with_pos_tags.split(\" \")\n count = st.length\n tokens = Array.new\n tagged_tokens = Array.new\n i = 0\n interim_noun_verb = false #0 indicates no interim nouns or verbs\n \n #fetching all the tokens\n for k in (0..st.length-1)\n ps = st[k]\n #setting the tagged string\n tagged_tokens[i] = ps\n if(ps.include?(\"/\"))\n ps = ps[0..ps.index(\"/\")-1] \n end\n #removing punctuations \n if(ps.include?(\".\"))\n tokens[i] = ps[0..ps.index(\".\")-1]\n elsif(ps.include?(\",\"))\n tokens[i] = ps.gsub(\",\", \"\")\n elsif(ps.include?(\"!\"))\n tokens[i] = ps.gsub(\"!\", \"\")\n elsif(ps.include?(\";\"))\n tokens[i] = ps.gsub(\";\", \"\")\n else\n tokens[i] = ps\n i+=1\n end \n end#end of the for loop\n \n #iterating through the tokens to determine state\n prev_negative_word =\"\"\n for j in (0..i-1)\n #checking type of the word\n #checking for negated words\n if(is_negative_word(tokens[j]) == NEGATED) \n returned_type = NEGATIVE_WORD\n #checking for a negative descriptor (indirect indicators of negation)\n elsif(is_negative_descriptor(tokens[j]) == NEGATED)\n returned_type = NEGATIVE_DESCRIPTOR\n #2-gram phrases of negative phrases\n elsif(j+1 < count && !tokens[j].nil? && !tokens[j+1].nil? && \n is_negative_phrase(tokens[j]+\" \"+tokens[j+1]) == NEGATED)\n returned_type = NEGATIVE_PHRASE\n j = j+1 \n #if suggestion word is found\n elsif(is_suggestive(tokens[j]) == SUGGESTIVE)\n returned_type = SUGGESTIVE\n #2-gram phrases suggestion phrases\n elsif(j+1 < count && !tokens[j].nil? && !tokens[j+1].nil? &&\n is_suggestive_phrase(tokens[j]+\" \"+tokens[j+1]) == SUGGESTIVE)\n returned_type = SUGGESTIVE\n j = j+1\n #else set to positive\n else\n returned_type = POSITIVE\n end\n \n #----------------------------------------------------------------------\n #comparing 'returnedType' with the existing STATE of the sentence clause\n #after returnedType is identified, check its state and compare it to the existing state\n #if present state is negative and an interim non-negative or non-suggestive word was found, set the flag to true\n if((state == NEGATIVE_WORD or state == NEGATIVE_DESCRIPTOR or state == NEGATIVE_PHRASE) and returned_type == POSITIVE)\n if(interim_noun_verb == false and (tagged_tokens[j].include?(\"NN\") or tagged_tokens[j].include?(\"PR\") or tagged_tokens[j].include?(\"VB\") or tagged_tokens[j].include?(\"MD\")))\n interim_noun_verb = true\n end\n end \n \n if(state == POSITIVE and returned_type != POSITIVE)\n state = returned_type\n #when state is a negative word\n elsif(state == NEGATIVE_WORD) #previous state\n if(returned_type == NEGATIVE_WORD)\n #these words embellish the negation, so only if the previous word was not one of them you make it positive\n if(prev_negative_word.casecmp(\"NO\") != 0 and prev_negative_word.casecmp(\"NEVER\") != 0 and prev_negative_word.casecmp(\"NONE\") != 0)\n state = POSITIVE #e.g: \"not had no work..\", \"doesn't have no work..\", \"its not that it doesn't bother me...\"\n else\n state = NEGATIVE_WORD #e.g: \"no it doesn't help\", \"no there is no use for ...\"\n end \n interim_noun_verb = false #resetting \n elsif(returned_type == NEGATIVE_DESCRIPTOR or returned_type == NEGATIVE_PHRASE)\n state = POSITIVE #e.g.: \"not bad\", \"not taken from\", \"I don't want nothing\", \"no code duplication\"// [\"It couldn't be more confusing..\"- anomaly we dont handle this for now!]\n interim_noun_verb = false #resetting\n elsif(returned_type == SUGGESTIVE)\n #e.g. \" it is not too useful as people could...\", what about this one?\n if(interim_noun_verb == true) #there are some words in between\n state = NEGATIVE_WORD\n else\n state = SUGGESTIVE #e.g.:\"I do not(-) suggest(S) ...\"\n end\n interim_noun_verb = false #resetting\n end\n #when state is a negative descriptor\n elsif(state == NEGATIVE_DESCRIPTOR)\n if(returned_type == NEGATIVE_WORD)\n if(interim_noun_verb == true)#there are some words in between\n state = NEGATIVE_WORD #e.g: \"hard(-) to understand none(-) of the comments\"\n else\n state = POSITIVE #e.g.\"He hardly not....\"\n end\n interim_noun_verb = false #resetting\n elsif(returned_type == NEGATIVE_DESCRIPTOR)\n if(interim_noun_verb == true)#there are some words in between\n state = NEGATIVE_DESCRIPTOR #e.g:\"there is barely any code duplication\"\n else \n state = POSITIVE #e.g.\"It is hardly confusing..\", but what about \"it is a little confusing..\"\n end\n interim_noun_verb = false #resetting\n elsif(returned_type == NEGATIVE_PHRASE)\n if(interim_noun_verb == true)#there are some words in between\n state = NEGATIVE_PHRASE #e.g:\"there is barely any code duplication\"\n else \n state = POSITIVE #e.g.:\"it is hard and appears to be taken from\"\n end\n interim_noun_verb = false #resetting\n elsif(returned_type == SUGGESTIVE)\n state = SUGGESTIVE #e.g.:\"I hardly(-) suggested(S) ...\"\n interim_noun_verb = false #resetting\n end\n #when state is a negative phrase\n elsif(state == NEGATIVE_PHRASE)\n if(returned_type == NEGATIVE_WORD)\n if(interim_noun_verb == true)#there are some words in between\n state = NEGATIVE_WORD #e.g.\"It is too short the text and doesn't\"\n else\n state = POSITIVE #e.g.\"It is too short not to contain..\"\n end\n interim_noun_verb = false #resetting\n elsif(returned_type == NEGATIVE_DESCRIPTOR)\n state = NEGATIVE_DESCRIPTOR #e.g.\"It is too short barely covering...\"\n interim_noun_verb = false #resetting\n elsif(returned_type == NEGATIVE_PHRASE)\n state = NEGATIVE_PHRASE #e.g.:\"it is too short, taken from ...\"\n interim_noun_verb = false #resetting\n elsif(returned_type == SUGGESTIVE)\n state = SUGGESTIVE #e.g.:\"I too short and I suggest ...\"\n interim_noun_verb = false #resetting\n end\n #when state is suggestive\n elsif(state == SUGGESTIVE) #e.g.:\"I might(S) not(-) suggest(S) ...\"\n if(returned_type == NEGATIVE_DESCRIPTOR)\n state = NEGATIVE_DESCRIPTOR\n elsif(returned_type == NEGATIVE_PHRASE)\n state = NEGATIVE_PHRASE\n end\n #e.g.:\"I suggest you don't..\" -> suggestive\n interim_noun_verb = false #resetting\n end\n \n #setting the prevNegativeWord\n if(tokens[j].casecmp(\"NO\") == 0 or tokens[j].casecmp(\"NEVER\") == 0 or tokens[j].casecmp(\"NONE\") == 0)\n prev_negative_word = tokens[j]\n end \n \n end #end of for loop\n \n if(state == NEGATIVE_DESCRIPTOR or state == NEGATIVE_WORD or state == NEGATIVE_PHRASE)\n state = NEGATED\n end\n \n return state\n end", "title": "" }, { "docid": "b709a7ac46b8caa6faa2c4826860f857", "score": "0.5370215", "text": "def nextToken\n valid = false\n while !valid\n valid = true\n whitespace = false\n if @input[@index] == \"\\n\" || @index >= @input.length - 1\n @input = gets\n if @input == nil\n return Token.new(Token::EOF, \"END OF PROGRAM\")\n else\n @input.chomp.strip\n end\n @index = 0\n else\n @index +=1\n while(@input[@index] == \" \")\n @index +=1\n end\n end\n current_char = @input[@index]\n\n #check lcurly\n if (current_char =~ /{/)\n token = Token.new(LCURLY, current_char)\n #check rcurly\n elsif (current_char =~ /}/)\n token = Token.new(RCURLY, current_char)\n #check semi\n elsif (current_char =~ /;/)\n token = Token.new(SEMI, current_char)\n #check lbrack\n elsif (current_char =~ /[\\[]/)\n token = Token.new(LBRACK, current_char)\n #check rbrack\n elsif (current_char =~ /[\\]]/)\n token = Token.new(RBRACK, current_char)\n #check arrow\n elsif (current_char =~ /-/)\n #NOT DONE\n token = Token.new(ARROW, @input[@index] + @input[@index+1])\n @index +=1\n #check equals\n elsif (current_char =~ /=/)\n token = Token.new(EQUALS, current_char)\n #check comma\n elsif (current_char =~ /,/)\n token = Token.new(COMMA, current_char)\n #is_int\n elsif (current_char =~ /[0-9]/)\n token = Token.new(INT, current_char)\n #is_string\n elsif (current_char =~ /\"/)\n token = read_string\n #is_id or digraph or subgraph\n elsif (current_char =~ /[a-zA-Z]/)\n token = read_id\n #is_whitespace\n elsif (current_char =~ /[\\s\\t\\r\\n\\f]/)\n valid = false\n white_space = true\n #Illegal char\n else\n valid = false\n end\n if valid\n return token\n else\n if !white_space\n puts \"illegal char: #{current_char}\"\n end\n end\n end\n end", "title": "" }, { "docid": "2a6ad5b6bf8ccb92223ab68a7dceebe4", "score": "0.53605413", "text": "def parse\n pre_index = @scanner.token_index\n p_token,p_token_value = nil\n c_token,c_token_value = @scanner.get_token\n parenth = 0\n\n while (c_token != nil)\n @scanner.token_index += 1\n n_token, n_token_value = @scanner.get_token\n\n unless n_token == \" \"\n case c_token\n when \"bad_token\"\n @token_errors << c_token_value\n\n when \"and\"\n unless (n_token =~ /not|fstatement|statement|\\(/) || (scanner.token_index == scanner.arguments.size) && !(n_token == nil)\n @parse_errors << [pre_index, scanner.token_index]\n end\n\n if p_token == nil\n @parse_errors << [pre_index - c_token.size, scanner.token_index]\n elsif (p_token == \"and\" || p_token == \"or\")\n @parse_errors << [pre_index - 1 - p_token.size, pre_index - 1]\n end\n\n when \"or\"\n unless (n_token =~ /not|fstatement|statement|\\(/) || (scanner.token_index == scanner.arguments.size) && !(n_token == nil)\n @parse_errors << [pre_index, scanner.token_index]\n end\n\n if p_token == nil\n @parse_errors << [pre_index - c_token.size, scanner.token_index]\n elsif (p_token == \"and\" || p_token == \"or\")\n @parse_errors << [pre_index - 1 - p_token.size, pre_index - 1]\n end\n\n when \"not\"\n unless n_token =~ /fstatement|statement|\\(|not/ && !(n_token == nil)\n @parse_errors << [pre_index, scanner.token_index]\n end\n\n when \"statement\",\"fstatement\"\n unless n_token =~ /and|or|\\)/\n unless scanner.token_index == scanner.arguments.size\n @parse_errors << [pre_index, scanner.token_index]\n end\n end\n\n when \")\"\n unless (n_token =~ /|and|or|not|\\(/)\n unless(scanner.token_index == scanner.arguments.size)\n @parse_errors << [pre_index, scanner.token_index]\n end\n end\n unless @paren_errors.empty?\n @paren_errors.pop\n else\n @paren_errors.push((n_token.nil?) ? scanner.token_index - 1: scanner.token_index - n_token_value.size)\n end\n\n when \"(\"\n unless n_token =~ /fstatement|statement|not|\\(/\n @parse_errors << [pre_index, scanner.token_index]\n end\n @paren_errors.push((n_token.nil?) ? scanner.token_index - 1: scanner.token_index - n_token_value.size)\n\n else\n @parse_errors << [pre_index, scanner.token_index]\n end\n\n unless n_token == \" \" ||c_token == \"bad_token\"\n @execution_stack << {c_token => c_token_value}\n end\n\n p_token, p_token_value = c_token, c_token_value\n c_token, c_token_value = n_token, n_token_value\n end\n pre_index = @scanner.token_index\n end\n end", "title": "" }, { "docid": "d565af733b3cb56b835a42d84b4d0275", "score": "0.53604347", "text": "def parse_factor\n tok = @tokenizer.token\n return nil if tok.nil?\n if @tokenizer.is_current_an_operator? '+', '-', '!'\n @tokenizer.get_next\n return AST::Unary.new(tok, parse_factor)\n elsif tok.type == :lparen\n @tokenizer.get_next\n expr = parse_expression\n show_error \"Unmatched closing ')'!\" unless @tokenizer.is_next_an? :rparen\n return expr\n elsif tok.is_atom?\n return parse_atom\n elsif tok == nil || tok.type == :semi_colon\n return nil\n else\n show_error \"Unknown token #{tok}!\"\n end\n end", "title": "" }, { "docid": "0ce3b693ff18d725ad5db350371c6251", "score": "0.5358784", "text": "def procedure_name\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 57 )\n return_value = ProcedureNameReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n procedure_name_start_index = @input.index\n\n root_0 = nil\n __QUOTED_STRING488__ = nil\n identifier487 = nil\n\n tree_for_QUOTED_STRING488 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n # at line 419:2: ( identifier | QUOTED_STRING )\n alt_117 = 2\n look_117_0 = @input.peek( 1 )\n\n if ( look_117_0.between?( ID, DOUBLEQUOTED_STRING ) )\n alt_117 = 1\n elsif ( look_117_0 == QUOTED_STRING )\n alt_117 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 117, 0 )\n end\n case alt_117\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 419:4: identifier\n @state.following.push( TOKENS_FOLLOWING_identifier_IN_procedure_name_2767 )\n identifier487 = identifier\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, identifier487.tree )\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 419:17: QUOTED_STRING\n __QUOTED_STRING488__ = match( QUOTED_STRING, TOKENS_FOLLOWING_QUOTED_STRING_IN_procedure_name_2771 )\n if @state.backtracking == 0\n\n tree_for_QUOTED_STRING488 = @adaptor.create_with_payload( __QUOTED_STRING488__ )\n @adaptor.add_child( root_0, tree_for_QUOTED_STRING488 )\n\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 57 )\n memoize( __method__, procedure_name_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "0372bce20aab390b7fea9207b97fa386", "score": "0.5354978", "text": "def polish(string)\n stack = Stack.new\n split_string = string.split(' ')\n split_string.each do |item|\n if ['-', '*', '+', '/'].include?(item)\n first = stack.pop\n stack.push(stack.pop.send(item, first))\n else\n stack.push(item.to_i)\n end\n end\n return stack.top\nend", "title": "" }, { "docid": "3c5fecad872a7886ad02aa43d8ac3834", "score": "0.5351007", "text": "def parse(raw_string)\n # read_tokens_only tokenize(s)\n read_tokens before_read(tokenize(raw_string))\nend", "title": "" }, { "docid": "a2992fff33c9f90232c2bb86017c1eb2", "score": "0.53495795", "text": "def value\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 62 )\n return_value = ValueReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n value_start_index = @input.index\n\n root_0 = nil\n set502 = nil\n __NUMBER503__ = nil\n string_literal505 = nil\n string_literal506 = nil\n string_literal507 = nil\n quoted_string504 = nil\n\n tree_for_set502 = nil\n tree_for_NUMBER503 = nil\n tree_for_string_literal505 = nil\n tree_for_string_literal506 = nil\n tree_for_string_literal507 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n # at line 440:2: ( ( PLUS | MINUS )? NUMBER | quoted_string | 'TRUE' | 'FALSE' | 'NULL' )\n alt_123 = 5\n case look_123 = @input.peek( 1 )\n when PLUS, MINUS, NUMBER then alt_123 = 1\n when QUOTED_STRING then alt_123 = 2\n when T__110 then alt_123 = 3\n when T__111 then alt_123 = 4\n when T__58 then alt_123 = 5\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 123, 0 )\n end\n case alt_123\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 440:4: ( PLUS | MINUS )? NUMBER\n # at line 440:4: ( PLUS | MINUS )?\n alt_122 = 2\n look_122_0 = @input.peek( 1 )\n\n if ( look_122_0.between?( PLUS, MINUS ) )\n alt_122 = 1\n end\n case alt_122\n when 1\n # at line \n set502 = @input.look\n if @input.peek( 1 ).between?( PLUS, MINUS )\n @input.consume\n if @state.backtracking == 0\n @adaptor.add_child( root_0, @adaptor.create_with_payload( set502 ) )\n end\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n end\n __NUMBER503__ = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_value_2889 )\n if @state.backtracking == 0\n\n tree_for_NUMBER503 = @adaptor.create_with_payload( __NUMBER503__ )\n @adaptor.add_child( root_0, tree_for_NUMBER503 )\n\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 441:4: quoted_string\n @state.following.push( TOKENS_FOLLOWING_quoted_string_IN_value_2894 )\n quoted_string504 = quoted_string\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, quoted_string504.tree )\n end\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 442:4: 'TRUE'\n string_literal505 = match( T__110, TOKENS_FOLLOWING_T__110_IN_value_2899 )\n if @state.backtracking == 0\n\n tree_for_string_literal505 = @adaptor.create_with_payload( string_literal505 )\n @adaptor.add_child( root_0, tree_for_string_literal505 )\n\n end\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 442:13: 'FALSE'\n string_literal506 = match( T__111, TOKENS_FOLLOWING_T__111_IN_value_2903 )\n if @state.backtracking == 0\n\n tree_for_string_literal506 = @adaptor.create_with_payload( string_literal506 )\n @adaptor.add_child( root_0, tree_for_string_literal506 )\n\n end\n\n when 5\n root_0 = @adaptor.create_flat_list\n\n\n # at line 443:4: 'NULL'\n string_literal507 = match( T__58, TOKENS_FOLLOWING_T__58_IN_value_2908 )\n if @state.backtracking == 0\n\n tree_for_string_literal507 = @adaptor.create_with_payload( string_literal507 )\n @adaptor.add_child( root_0, tree_for_string_literal507 )\n\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 62 )\n memoize( __method__, value_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "d7edbb21d0f387ce395d8aa633777966", "score": "0.53453916", "text": "def parse(tokens)\n result = []\n return result if tokens.size == 0\n\n current = 0\n while current < tokens.size && tokens[current][:type] != :close\n\n if tokens[current][:type] == :string\n result << tokens[current]\n current += 1\n elsif tokens[current][:type] == :multiplier\n token = tokens[current]\n current += 2\n fragment, read = parse(tokens[current..-1])\n current += read\n\n token[:child] = fragment\n result << token\n end\n\n end\n\n current += 1 if current < tokens.size \n\n [result, current]\nend", "title": "" }, { "docid": "4d76e36727d86923e6eb067de873ff7e", "score": "0.5342883", "text": "def s(v, p, acc, t)\n if t.length == 0\n if p > 0\n # nothing!\n return []\n else\n # valid string...\n return [[acc, v]]\n end\n elsif t[0] == '('\n # you take it ...\n izq = s(v, p + 1, \"#{acc}#{t[0]}\", t[1..-1])\n # ... or you leave it\n der = s(v + 1, p, acc, t[1..-1])\n return izq.concat der\n elsif t[0] == ')'\n # can you take it?...\n izq = []\n if p > 0\n izq = s(v, p - 1, \"#{acc}#{t[0]}\", t[1..-1])\n end\n # ... or you just leave it\n der = s(v + 1, p, acc, t[1..-1])\n return izq.concat der\n end\n # ... just take it\n return s(v + 1, p, \"#{acc}#{t[0]}\", t[1..-1])\n\nend", "title": "" }, { "docid": "65f771dec7274a8ff6e256eb2d76b7d6", "score": "0.5338368", "text": "def parse_expression(message)\r\n\t\tcurrentValue = \"\"\r\n\t\ti = 0\r\n\t\t\r\n\t\tif /.*[Ll]ife.*[Uu]niverse.*[Ee]verything.*/.match(message) ||\r\n\t\t\t/.*[Mm]eaning.*[Ll]ife.*/.match(message)\r\n\t\t\[email protected](42)\r\n\t\t\treturn\r\n\t\tend\r\n\r\n\t\twhile i < message.length\r\n\t\t\tc = message[i]\r\n\t\t\t\r\n\t\t\tcase c\r\n\t\t\t\twhen /\\d/\r\n\t\t\t\t\tif @values.length != @operations.length\r\n\t\t\t\t\t\traise \"Incorrect number of operations during read\"\r\n\t\t\t\t\tend\r\n\t\t\t\t\tcurrentValue << c\r\n\t\t\t\twhen \"+\", \"-\", \"*\", \"/\"\r\n\t\t\t\t\tif currentValue == \"\" && @values.length == @operations.length\r\n\t\t\t\t\t\traise \"No values read before operation\"\r\n\t\t\t\t\tend\r\n\t\t\t\t\tif currentValue != \"\"\r\n\t\t\t\t\t\[email protected](currentValue.to_f)\r\n\t\t\t\t\t\tcurrentValue = \"\"\r\n\t\t\t\t\tend\r\n\t\t\t\t\[email protected](c)\r\n\t\t\t\twhen \"(\"\r\n\t\t\t\t\tcloseParenthesesIndex = message.index(\")\", i)\r\n\t\t\t\t\tif closeParenthesesIndex == nil\r\n\t\t\t\t\t\traise \"No closing parentheses\"\r\n\t\t\t\t\tend\r\n\t\t\t\t\tinnerCalculator = Calculator.new\r\n\t\t\t\t\tinnerExpression = message[i + 1, closeParenthesesIndex - i - 1]\r\n\t\t\t\t\tinnerValue = innerCalculator.calculate(innerExpression)\r\n\t\t\t\t\[email protected](innerValue)\r\n\t\t\t\t\ti = closeParenthesesIndex\r\n\t\t\t\twhen \")\"\r\n\t\t\t\t\traise \"Invalid closing parentheses\"\r\n\t\t\t\twhen \".\"\r\n\t\t\t\t\tif currentValue != \"\" &&\r\n\t\t\t\t\t ((i > 0 && message[i - 1][/\\d/] != nil) ||\r\n\t\t\t\t\t (i < message.length - 1 && message[i + 1][/\\d/] != nil))\r\n\t\t\t\t\t\tcurrentValue << c\r\n\t\t\t\t\telsif currentValue == \"\" && i < message.length - 1 && message[i + 1][/\\d/] != nil\r\n\t\t\t\t\t\tcurrentValue << c\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\t\tif currentValue != \"\"\r\n\t\t\t\t\t\[email protected](currentValue.to_f)\r\n\t\t\t\t\t\tcurrentValue = \"\"\r\n\t\t\t\t\tend\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\tend\r\n\r\n\t\tif currentValue != \"\"\r\n\t\t\[email protected](currentValue.to_f)\r\n\t\tend\r\n\t\t\r\n\t\tif @operations.length != @values.length - 1\r\n\t\t\traise \"Incorrect number of operations after read\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "8a812e30513340e58438c155c70a4426", "score": "0.53340846", "text": "def token!\n # at line 1:8: ( T__65 | T__66 | T__67 | T__68 | STRING | SIZEOF | ALLOC | READNUMBER | WRITEFILE | CLOSEFILE | OPENFILE | NULL | MAIN | READ | PRINT | PRINTL | PRINTLN | TRUE | FALSE | FOR | IF | ELSE | ELIF | ELSEIF | WHILE | DO | RETURN | EXIT | BREAK | CONTINUE | ID | INT | COMMENT | WS | LB | RB | LCB | RCB | QUOTE | COMMA | DOT | COLON | SEMICOLON | ASSIGN | PLUS | MINUS | MUL | DIV | MOD | EQ | NE | LT | GT | LE | GE | AND | OR | NOT | QM )\n alt_16 = 59\n alt_16 = @dfa16.predict( @input )\n case alt_16\n when 1\n # at line 1:10: T__65\n t__65!\n\n when 2\n # at line 1:16: T__66\n t__66!\n\n when 3\n # at line 1:22: T__67\n t__67!\n\n when 4\n # at line 1:28: T__68\n t__68!\n\n when 5\n # at line 1:34: STRING\n string!\n\n when 6\n # at line 1:41: SIZEOF\n sizeof!\n\n when 7\n # at line 1:48: ALLOC\n alloc!\n\n when 8\n # at line 1:54: READNUMBER\n readnumber!\n\n when 9\n # at line 1:65: WRITEFILE\n writefile!\n\n when 10\n # at line 1:75: CLOSEFILE\n closefile!\n\n when 11\n # at line 1:85: OPENFILE\n openfile!\n\n when 12\n # at line 1:94: NULL\n null!\n\n when 13\n # at line 1:99: MAIN\n main!\n\n when 14\n # at line 1:104: READ\n read!\n\n when 15\n # at line 1:109: PRINT\n print!\n\n when 16\n # at line 1:115: PRINTL\n printl!\n\n when 17\n # at line 1:122: PRINTLN\n println!\n\n when 18\n # at line 1:130: TRUE\n true!\n\n when 19\n # at line 1:135: FALSE\n false!\n\n when 20\n # at line 1:141: FOR\n for!\n\n when 21\n # at line 1:145: IF\n if!\n\n when 22\n # at line 1:148: ELSE\n else!\n\n when 23\n # at line 1:153: ELIF\n elif!\n\n when 24\n # at line 1:158: ELSEIF\n elseif!\n\n when 25\n # at line 1:165: WHILE\n while!\n\n when 26\n # at line 1:171: DO\n do!\n\n when 27\n # at line 1:174: RETURN\n return!\n\n when 28\n # at line 1:181: EXIT\n exit!\n\n when 29\n # at line 1:186: BREAK\n break!\n\n when 30\n # at line 1:192: CONTINUE\n continue!\n\n when 31\n # at line 1:201: ID\n id!\n\n when 32\n # at line 1:204: INT\n int!\n\n when 33\n # at line 1:208: COMMENT\n comment!\n\n when 34\n # at line 1:216: WS\n ws!\n\n when 35\n # at line 1:219: LB\n lb!\n\n when 36\n # at line 1:222: RB\n rb!\n\n when 37\n # at line 1:225: LCB\n lcb!\n\n when 38\n # at line 1:229: RCB\n rcb!\n\n when 39\n # at line 1:233: QUOTE\n quote!\n\n when 40\n # at line 1:239: COMMA\n comma!\n\n when 41\n # at line 1:245: DOT\n dot!\n\n when 42\n # at line 1:249: COLON\n colon!\n\n when 43\n # at line 1:255: SEMICOLON\n semicolon!\n\n when 44\n # at line 1:265: ASSIGN\n assign!\n\n when 45\n # at line 1:272: PLUS\n plus!\n\n when 46\n # at line 1:277: MINUS\n minus!\n\n when 47\n # at line 1:283: MUL\n mul!\n\n when 48\n # at line 1:287: DIV\n div!\n\n when 49\n # at line 1:291: MOD\n mod!\n\n when 50\n # at line 1:295: EQ\n eq!\n\n when 51\n # at line 1:298: NE\n ne!\n\n when 52\n # at line 1:301: LT\n lt!\n\n when 53\n # at line 1:304: GT\n gt!\n\n when 54\n # at line 1:307: LE\n le!\n\n when 55\n # at line 1:310: GE\n ge!\n\n when 56\n # at line 1:313: AND\n and!\n\n when 57\n # at line 1:317: OR\n or!\n\n when 58\n # at line 1:320: NOT\n not!\n\n when 59\n # at line 1:324: QM\n qm!\n\n end\n end", "title": "" }, { "docid": "d4845955e6cd10503e66e2e92e7c68f8", "score": "0.53324497", "text": "def parse(expr)\n @input = lex(expr)\n @output = []\n @op_stack = []\n @arities = []\n\n return nil if input.empty?\n\n while(token = input.shift)\n case token.type\n when :num, :bool, :string, :param\n output.push AST::Node.new(token.value)\n when :operator\n op_prop = token.value\n arities << op_prop.arity-1 if op_prop.symbol == '?'\n if op_prop.right_associative?\n while op_stack.last && op_prop.precedence < op_stack.last.precedence\n if !op_stack.last.grouping?\n consume\n else\n break\n end\n end\n else\n while op_stack.last && op_prop.precedence <= op_stack.last.precedence && !op_stack.last.grouping?\n consume\n end\n end\n op_stack << op_prop\n when :function\n arities << 0\n op_stack << token.value\n when :grouping\n op_prop = token.value\n op_str = op_prop.respond_to?(:nodes) ? op_prop.symbol : op_prop.to_s\n case op_str\n when '('\n if input.any? && input.first.type == :grouping && input.first.value.to_s == '('\n input.shift\n consume(0)\n else\n op_stack << op_prop\n end\n when ')'\n while op_stack.any? && op_stack.last.symbol != op_prop.pair.symbol\n consume(arities.pop || op_stack.last.arity)\n end\n lparen = op_stack.pop\n fail ParseError, \"Unbalanced parenthesis\" unless lparen && lparen.grouping?\n\n if op_stack.last && op_stack.last.position == 'prefix'\n consume(arities.pop)\n end\n when ','\n arities[-1] += 1\n while op_stack.any? && op_stack.last.symbol != '('\n consume\n end\n when ':'\n while op_stack.any? && op_stack.last.symbol != '?'\n consume(arities.pop)\n end\n arities[-1] += 1\n op_stack << op_prop\n else\n fail ParseError, \"Unknown grouping token #{ token.value }\"\n end # case token.value ... when :grouping\n else\n fail ParseError, \"Not implemented for tokens of type #{ token.type }\"\n end # case token.type\n end # while (token = input.shift)\n\n while op_stack.any?\n consume\n end\n\n unless output.count == 1\n fail ParseError, \"Invalid statement\"\n end\n\n output.first\n end", "title": "" }, { "docid": "7e193b01c7ae77a1c3b53a21e5d0406e", "score": "0.53192747", "text": "def convert_infix_to_postfix(infix_tokens)\n end", "title": "" }, { "docid": "cacf9aa6e75b4f873c41408d801677f7", "score": "0.53133535", "text": "def tokenize(raw)\n clausearr = []\n processed = []\n clauses = raw.split(\",\")\n clauses.each do |c|\n clausearr << c.scan(/\\S/)\n end\n raise \"Invalid input syntax\" if !grammar_valid?(clausearr)\n clausearr.each do |carr|\n processed << process_parens(carr)\n end\n return processed\n end", "title": "" }, { "docid": "a3286c0dbc6e3ca86cd40f6c28a7376b", "score": "0.5307335", "text": "def evaluate(pfixExpr)\n hashStack = []\n pfixExpr.map do |tok|\n if(SearchRules::BINARY_OPERATORS.include?(tok))\n rightOperand = hashStack.pop\n leftOperand = hashStack.pop\n hashStack.push({SearchRules::BINARY_OPERATORS[tok] => [leftOperand, rightOperand]})\n elsif(SearchRules::UNARY_OPERATORS.include?(tok))\n rightOperand = hashStack.pop\n hashStack.push({SearchRules::UNARY_OPERATORS[tok] => rightOperand})\n else\n if(tok[0] == \"\\\"\" && tok[-1] == \"\\\"\")\n hashStack.push({QUOT => tok[1..-2]})\n elsif(tok.length > 5 && tok[0..3] == \"len(\")\n hashStack.push( {LEN => tok[4..-2].to_i} )\n elsif (tok == \"false\")\n hashStack.push(false)\n elsif (tok == \"true\")\n hashStack.push(true)\n else\n hashStack.push(tok)\n end\n end\n end\n hashStack.pop\n end", "title": "" }, { "docid": "7494b7e47343f0c5ec1776b0b1759a78", "score": "0.5306988", "text": "def parse(str)\n exprs = [] # array of expressions used as a stack\n buffer = '' # buffer for parsing numbers\n\n # loop through each character\n str.each_char do |d|\n # we can apply operators only if there are at least two expressions in the stack\n if exprs.length >= 2\n # if the current character is an operator then take first two elements\n # from the stack, construct a new expression, and put it in the stack\n case d\n when '+'\n exprs.unshift Expr.new '+', exprs.shift, exprs.shift\n when '-'\n exprs.unshift Expr.new '-', exprs.shift, exprs.shift\n when '*'\n exprs.unshift Expr.new '*', exprs.shift, exprs.shift\n when '/'\n exprs.unshift Expr.new '/', exprs.shift, exprs.shift\n when ' '\n # if the buffer isn't empty then there is a number in it\n unless buffer.empty?\n begin # try\n x = Float(buffer) # convert to float\n exprs.unshift x # put in the stack\n buffer = '' # empty the buffer\n rescue(ArgumentError) # catch parsing exception\n # the expression is invalid, break the loop\n break\n end\n end\n else\n # put the character in the buffer\n buffer << d\n end\n else # less than two elements in the stack\n # only need to check if the character is ' '\n case d\n when ' '\n # the same behavior in case of a space\n unless buffer.empty?\n begin\n x = Float(buffer)\n exprs.unshift x\n buffer = ''\n rescue(ArgumentError)\n break\n end\n end\n else\n # put the character in the buffer\n buffer << d\n end\n end\n end\n\n # if the buffer is empty and the expressions stack has only one element\n # return the expression\n exprs.shift if exprs.length == 1 && buffer.empty?\n\n # expressions in reverse polish notation should have an operator at the end,\n # so if the buffer isn't empty then the expression is invalid.\n end", "title": "" }, { "docid": "f40bd4c1efe897a139a9350518f97790", "score": "0.52979267", "text": "def parse s\n\t\tif (s == nil || s == \"\")\n\t\t abort\n\t\tend\n\t\tout_a = [nil]\n\t\trule = to_rule(s)\n\t\tri = rule.size\n\t\trule.each_with_index do |r, i|\n\t\t if r == 'V'\n\t\t\tout_a = out_a.product(Vowel)\n\t\t elsif (r == 'C')\n\t\t\tif (i+1 == rule.size)\n\t\t\t out_a = out_a.product(Final)\n\t\t\telse\n\t\t\t out_a = out_a.product(Normal)\n\t\t\tend\n=begin\n\t\t elsif (r == 'N')\n\t\t\tout_a = out_a.product(n_sound_array)\n=end\n\t\t else\n\t\t\tout_a = out_a.product(Double)\n\t\t end\n\t\tend\n\t\tb = out_a.flatten(ri)\n\t\thelp = \"\"\n\t\tb.each do |c|\n\t\t if c == nil\n\t\t\thelp << \"\\n\"\n\t\t else\n\t\t\thelp << c\n\t\t end\n\t\tend\n\t\tresult = help.split(\"\\n\")\n\t\tresult.delete_at(0)\n\t\tFile.open(\"output.txt\", \"a+\") do |f|\n\t\t result.each do |token|\n\t\t\tf.write(\"\\n\")\n\t\t\tf.write(token)\n\t\t end\n\t\tend\n\t end", "title": "" }, { "docid": "c6927aad4303c49e548ac28a88092d97", "score": "0.5296195", "text": "def exp\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n\n __PLUS26__ = nil\n __MINUS27__ = nil\n\n\n begin\n # at line 224:5: term ( ( PLUS | MINUS ) term )*\n @state.following.push( TOKENS_FOLLOWING_term_IN_exp_2115 )\n term\n @state.following.pop\n # at line 224:10: ( ( PLUS | MINUS ) term )*\n while true # decision 29\n alt_29 = 2\n look_29_0 = @input.peek( 1 )\n\n if ( look_29_0 == MINUS || look_29_0 == PLUS )\n alt_29 = 1\n\n end\n case alt_29\n when 1\n # at line 224:12: ( PLUS | MINUS ) term\n # at line 224:12: ( PLUS | MINUS )\n alt_28 = 2\n look_28_0 = @input.peek( 1 )\n\n if ( look_28_0 == PLUS )\n alt_28 = 1\n elsif ( look_28_0 == MINUS )\n alt_28 = 2\n else\n raise NoViableAlternative( \"\", 28, 0 )\n\n end\n case alt_28\n when 1\n # at line 224:14: PLUS\n __PLUS26__ = match( PLUS, TOKENS_FOLLOWING_PLUS_IN_exp_2121 )\n\n # --> action\n $quads.add_operator(__PLUS26__.text) \n # <-- action\n\n\n when 2\n # at line 225:14: MINUS\n __MINUS27__ = match( MINUS, TOKENS_FOLLOWING_MINUS_IN_exp_2138 )\n\n # --> action\n $quads.add_operator(__MINUS27__.text) \n # <-- action\n\n\n end\n @state.following.push( TOKENS_FOLLOWING_term_IN_exp_2155 )\n term\n @state.following.pop\n\n # --> action\n $quads.is_exp_pending() \n # <-- action\n\n\n else\n break # out of loop for decision 29\n end\n end # loop for decision 29\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 25 )\n\n\n end\n\n return \n end", "title": "" }, { "docid": "fd640a5f7d1ad4ac7896b36781dff87a", "score": "0.5292057", "text": "def parse\n return @result if @result\n values = []\n skip(OPEN_PAREN)\n if skip(CLOSE_PAREN)\n values << nil\n else\n until eos?\n if skip(QUOTE_RE)\n values << scan(QUOTED_RE).gsub(REPLACE_RE, REPLACE_WITH)\n skip(QUOTE_SEP_RE)\n else\n v = scan(UNQUOTED_RE)\n values << (v unless v.empty?)\n skip(SEP_RE)\n end\n end\n end\n values\n end", "title": "" }, { "docid": "39b2e02df433a4d499d1c1e6a5e45da8", "score": "0.5291914", "text": "def token\n @src.sub!(/\\A\\n/,'')\n if $&\n @line += 1\n return [ :RETURN, \"\\n\" ]\n end\n\n if @done\n return nil\n end\n yytext = String.new\n\n\n # remove comments from this line\n @src.sub!(/\\A[ \\t]*;.*\\n/,\"\\n\")\n if $&\n return [:INLINECOMMENT, \"\"]\n end\n\n @src.sub!(/\\A#.*\\n/,\"\\n\")\n if $&\n return [:COMMENT, \"\"]\n end\n\n @src.sub!(/#.*/,'')\n\n if @src.length == 0\n @done = true\n return [false, '$']\n end\n\n if @invar\n @src.sub!(/\\A[ \\t]+/,'')\n @src.sub!(/\\A([^;\\n]+)(\\n|;)/,'\\2')\n if $1\n yytext += $1\n end\n @invar = false\n return [:VALUE, yytext]\n else\n @src.sub!(/\\A[\\t ]*(\\S+)([\\t ]*|$)/,'')\n if $1\n yytext = $1\n case yytext\n when 'define'\n #puts \"got define\"\n return [:DEFINE, yytext]\n when '{'\n #puts \"got {\"\n @inobject = true\n return [:LCURLY, yytext]\n else\n unless @inobject\n #puts \"got type: #{yytext}\"\n if yytext =~ /\\W/\n giveback = yytext.dup\n giveback.sub!(/^\\w+/,'')\n #puts \"giveback \" + giveback\n #puts \"yytext \" + yytext\n yytext.sub!(/\\W.*$/,'')\n #puts \"yytext \" + yytext\n #puts \"all [#{giveback} #{yytext} #{orig}]\"\n @src = giveback + @src\n end\n return [:NAME, yytext]\n else\n if yytext == '}'\n #puts \"got closure: #{yytext}\"\n @inobject = false\n return [:RCURLY, '}']\n end\n\n unless @invar\n @invar = true\n return [:PARAM, $1]\n else\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "83a323b740e6b2c04c089dbb50de7b37", "score": "0.5288225", "text": "def parse(s)\n return s.to_s.gsub('x.to_f/n', 'p').gsub('y.to_f/n', 'q')\n end", "title": "" }, { "docid": "ff399b829421dc0ed3c5feacc87baea3", "score": "0.5281565", "text": "def parse(string)\n#`stack` will hold the intermediate representation\n#the first element is the acctual representation, every new scope created by a nested pair of brackets is then added afterwards while the parser is in it. Thus we can allways append our tokens to `stack.last` and return to the parent scope by `stack.pop`.\n stack = [[]]\n#Remove all non-brainfuck instruction characters (they are considered to be comments in brainfuck)\n string = string.gsub(/[^\\[\\]\\-+,.<>]/,\"\")\n string.split(\"\").each do |tok|\n case tok\n #When we see an opening bracket we create a new scope and add it to the current scope\n when \"[\"\n new_scope = []\n stack.last << new_scope\n #Then we make this scope the current by appending it to the stack\n stack.push(new_scope)\n #When we see a closing bracket we return to the last scope by removing the current scope from the stack\n when \"]\"\n stack.pop\n #All other characters are simply added to the current scope\n else\n stack.last << tok\n end\n end\n #return the outmost scope\n return stack.first\n end", "title": "" }, { "docid": "5d071ef2119624938f038b04be7e2532", "score": "0.52800405", "text": "def analyze\n _tokenize\n _parse\n end", "title": "" }, { "docid": "ff6fc385a2202cd306705d22920f3c53", "score": "0.5278955", "text": "def eval_token(raw_marker_match)\n marker_match = raw_marker_match[3..-2].strip\n if marker_match.include?('?')\n # well i would have used regexp if it frig'n worked! :|\n match_rest = marker_match.dup\n mq = match_rest.index('?')\n match = match_rest[0..(mq-1)].downcase\n match_rest = marker_match[(mq+1)..-1].strip\n mq = match_rest.index(' ')\n match_include = match_rest[0..(mq-1)].downcase\n match_print = match_rest[mq..-1].strip.downcase\n match_on = true\n elsif marker_match.include?('!')\n match_rest = marker_match.dup\n mq = match_rest.index('!')\n match = match_rest[0..(mq-1)].downcase\n match_rest = marker_match[(mq+1)..-1].strip\n mq = match_rest.index(' ')\n match_include = match_rest[0..(mq-1)].downcase\n match_print = match_rest[mq..-1].strip.downcase\n match_on = false\n else\n match = marker_match.downcase\n match_on = nil\n end\n match_method, match_keys = match.split('.') # split off hash lookups\n match_eval = match_method.dup # build eval\n match_eval += match_keys.collect { |m| \"['#{m}']\" }.to_s if match_keys\n match_eval += \".include?('#{match_include}') ? '#{match_print}' : ''\" if match_on == true\n match_eval += \".include?('#{match_include}') ? '' : '#{match_print}'\" if match_on == false\n return match_eval, match_method\n end", "title": "" }, { "docid": "049820bedff5beb415e9a9d2c749b929", "score": "0.5274676", "text": "def token!\n # at line 1:8: ( INTEGER | DECIMAL | ADD | SUB | MUL | DIV | LPARENT | RPARENT | WS )\n alt_5 = 9\n alt_5 = @dfa5.predict( @input )\n case alt_5\n when 1\n # at line 1:10: INTEGER\n integer!\n\n\n when 2\n # at line 1:18: DECIMAL\n decimal!\n\n\n when 3\n # at line 1:26: ADD\n add!\n\n\n when 4\n # at line 1:30: SUB\n sub!\n\n\n when 5\n # at line 1:34: MUL\n mul!\n\n\n when 6\n # at line 1:38: DIV\n div!\n\n\n when 7\n # at line 1:42: LPARENT\n lparent!\n\n\n when 8\n # at line 1:50: RPARENT\n rparent!\n\n\n when 9\n # at line 1:58: WS\n ws!\n\n\n end\n end", "title": "" }, { "docid": "ae9a339ae98f2c9fcf5879414715c67e", "score": "0.5266848", "text": "def parse(string)\n s = string.split(\" \")\n i=0\n while i<s.length\n s[i] = \"+\" if s[i].eql?(\"@\")\n s[i] = \"-\" if s[i].eql?(\"$\")\n s[i] = \"*\" if s[i].eql?(\"#\")\n s[i] = \"/\" if s[i].eql?(\"&\")\n s[i] = \"%\" if s[i].eql?(\"conquer\")\n s[i-1],s[i-2],s[i] = s[i-2],s[i-1],\"\" if s[i].eql?(\"dance\")\n s[i] = \"-1 *\" if s[i].eql?(\"mirror\")\n s[i] = s[i-1] if s[i].eql?(\"breadandfish\")\n s[i] = \"\" if s[i].eql?(\".\")\n if s[i].eql?(\"fire\") then\n s[i-2] = (s[i-1].to_i>s[i-2].to_i) ? s[i-1] : s[i-2]\n s.delete_at(i-1)\n s.delete_at(i)\n i-=2\n end\n i+=1\n end\n return s.join(\" \")\nend", "title": "" }, { "docid": "0744a6e990f1c942a2fa3c00bd79b430", "score": "0.52642673", "text": "def parse_negate_operators(tokens)\n i = 0\n while i < tokens.length\n token = tokens[i]\n prev_token = i > 0 ? tokens[i - 1] : nil\n \n if token.is_a?(Operator)\n if token.symbol == \"-\"\n prev_is_operator = (not prev_token.nil? and prev_token.is_a?(Operator))\n \n if i == 0 or prev_is_operator\n elts = tokens.slice!(i, 2)\n target = parse_tokens_to_expression([elts[1]])[0]\n expr = Negate.new(target)\n tokens.insert(i, expr)\n end\n \n end\n end\n \n i += 1\n end\n \n tokens\n end", "title": "" }, { "docid": "4ce278e5c3e903a8c314ab43915147b5", "score": "0.52596503", "text": "def parseRelOp()\n parseAddOp()\n #now check if the next token is <=, < or =\n check(Token::T_RELOP, \"Expected a relational operator\")\n parseAddOp()\nend", "title": "" }, { "docid": "0beaf04a1a8058a4e1d566e7ca169243", "score": "0.5258019", "text": "def prog\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = ProgReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n expr1 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 16:8: ( expr )+\n # at file 16:8: ( expr )+\n match_count_1 = 0\n while true\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0.between?( VAR, NUM ) || look_1_0 == T__11 )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 16:8: expr\n @state.following.push( TOKENS_FOLLOWING_expr_IN_prog_69 )\n expr1 = expr\n @state.following.pop\n @adaptor.add_child( root_0, expr1.tree )\n\n else\n match_count_1 > 0 and break\n eee = EarlyExit(1)\n\n\n raise eee\n end\n match_count_1 += 1\n end\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "4655c662b0e98e83638fb937d7afe2ac", "score": "0.5255197", "text": "def interpreter file\n dfaStack = [ ] \n loop do\n line = file.gets\n if line == nil then break end\n words = line.scan(/\\S+/)\n words.each{ |word|\n case word\n when /DONE/\n return\n when /SIZE/\n f = dfaStack.last\n puts f.num_states\n when /PRINT/\n f = dfaStack.last\n f.pretty_print\n when /STAT/\n f = dfaStack.last\n f.print_stats\n when /DFA/\n f = dfaStack.pop\n f2 = f.to_dfa\n dfaStack.push f2\n when /COMPLEMENT/\n f = dfaStack.pop\n f2 = f.complement!\n dfaStack.push f2\n when /GENSTR([0-9]+)/\n f = dfaStack.last\n puts f.gen_str($1)\n when /\"([a-z]*)\"/\n f = dfaStack.last\n str = $1\n if f.accept?(str)\n puts \"Accept #{str}\"\n else\n puts \"Reject #{str}\"\n end\n when /([a-zE])/\n puts \"Illegal syntax for: #{word}\" if word.length != 1\n f = FiniteAutomaton.new\n sym = $1\n sym=\"\" if $1==\"E\"\n f.symbol!(sym)\n dfaStack.push f\n when /\\*/\n puts \"Illegal syntax for: #{word}\" if word.length != 1\n f = dfaStack.pop\n f.closure!\n dfaStack.push f\n when /\\|/\n puts \"Illegal syntax for: #{word}\" if word.length != 1\n f1 = dfaStack.pop\n f2 = dfaStack.pop\n f2.union!(f1)\n dfaStack.push f2\n when /\\./\n puts \"Illegal syntax for: #{word}\" if word.length != 1\n f1 = dfaStack.pop\n f2 = dfaStack.pop\n f2.concat!(f1)\n dfaStack.push f2\n else\n puts \"Ignoring #{word}\"\n end\n }\n end\nend", "title": "" }, { "docid": "bf88becc512c2494c81dd13164f28da3", "score": "0.5251495", "text": "def whatOperator(tempString) #determines if string/token contains an operator\r\n String operator = \"\"\r\n if(tempString.include? \"(\") then #.include needed for Lexer to determine if another split is needed\r\n operator = \"(\"\r\n elsif(tempString.include? \")\") then\r\n operator = \")\"\r\n elsif(tempString.include? \"+\") then \r\n operator = \"+\"\r\n elsif(tempString.include? \"-\") then\r\n operator = \"-\"\r\n elsif(tempString.include? \"*\") then\r\n operator = \"*\"\r\n elsif(tempString.include? \"/\") then\r\n operator = \"/\"\r\n elsif(tempString.include? \":=\") then\r\n operator = \":=\"\r\n elsif(tempString.include? \"<=\") then\r\n operator = \"<=\"\r\n elsif(tempString.include? \"<\") then\r\n operator = \"<\"\r\n elsif(tempString.include? \"=\") then\r\n operator = \"=\"\r\n else\r\n operator = \"noOperator\"\r\n end\r\n return operator\r\nend", "title": "" } ]
4b03716886dd16bb64efa840f9919a04
CALL THIS METHOD FROM FRONT END
[ { "docid": "ac7c95f12a6242135fe91ca6402c56a1", "score": "0.0", "text": "def read_message\n self.update(read: true)\n end", "title": "" } ]
[ { "docid": "e6d321f827333c13ccd774b53e6e0e1c", "score": "0.6584359", "text": "def back; end", "title": "" }, { "docid": "cefa636d42b0cae13f1b9c8d69e7515a", "score": "0.6526856", "text": "def call\r\n end", "title": "" }, { "docid": "462f660db193e8894824ce01a14e88fd", "score": "0.6499409", "text": "def during_after_load; end", "title": "" }, { "docid": "b4f962513b458fce31b0ce45f6cb469f", "score": "0.64730895", "text": "def end\n end", "title": "" }, { "docid": "b4f962513b458fce31b0ce45f6cb469f", "score": "0.64730895", "text": "def end\n end", "title": "" }, { "docid": "b4f962513b458fce31b0ce45f6cb469f", "score": "0.64730895", "text": "def end\n end", "title": "" }, { "docid": "0392c11c65fcf388520ddabc17a8628d", "score": "0.6447467", "text": "def call_back\n\n end", "title": "" }, { "docid": "daa8999942f195c165f5a390930ab3e8", "score": "0.6406802", "text": "def end\n\n end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.63890666", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.63890666", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.63890666", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.63890666", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.63890666", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.63890666", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.63890666", "text": "def end; end", "title": "" }, { "docid": "50926e82e8221e4169efc7e37b60211a", "score": "0.6386943", "text": "def at_end; end", "title": "" }, { "docid": "50926e82e8221e4169efc7e37b60211a", "score": "0.6386943", "text": "def at_end; end", "title": "" }, { "docid": "dbf9d4c3d7943ad687492d9f34bc977c", "score": "0.6370571", "text": "def main_end ; end", "title": "" }, { "docid": "c170d806997cc55c7dba91aa75fcef90", "score": "0.6337172", "text": "def after_render_screen\n end", "title": "" }, { "docid": "0f0df8828d29d38b86967b897de598ca", "score": "0.6313127", "text": "def callback; end", "title": "" }, { "docid": "0f0df8828d29d38b86967b897de598ca", "score": "0.6313127", "text": "def callback; end", "title": "" }, { "docid": "0f0df8828d29d38b86967b897de598ca", "score": "0.6313127", "text": "def callback; end", "title": "" }, { "docid": "0f0df8828d29d38b86967b897de598ca", "score": "0.6313127", "text": "def callback; end", "title": "" }, { "docid": "3ececad7d0b31bf904acae36e5999223", "score": "0.6310241", "text": "def after_start\n end", "title": "" }, { "docid": "22f23fc72dfbd5baf958bb933ec0e198", "score": "0.6262867", "text": "def onStart()\n\t\t\tputs 'onStart method has not been overridden!'\n\t\tend", "title": "" }, { "docid": "e806f684239aab65146c38b186a51e5e", "score": "0.6247671", "text": "def finish\n #\n end", "title": "" }, { "docid": "3923598cefdb39ff94e39293456a9cf0", "score": "0.62278175", "text": "def call\n # implement in subclasses\n end", "title": "" }, { "docid": "45150d94f866582795eb9a95078a1734", "score": "0.6225492", "text": "def front()\n \n end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.62047076", "text": "def call; end", "title": "" }, { "docid": "ccfe4044a5371ef1ee52c0eaecd344fc", "score": "0.61981463", "text": "def called_from; end", "title": "" }, { "docid": "31fff40d0309685423430e96f5aea73b", "score": "0.61818445", "text": "def after_start; end", "title": "" }, { "docid": "70ccaeaa3eee4fb0f2e60041f50de0e3", "score": "0.61784655", "text": "def process_end()\n super()\n end", "title": "" }, { "docid": "59025c8845087872e0f49c023e1a88d6", "score": "0.61664456", "text": "def call\n\n end", "title": "" }, { "docid": "b7645c2366df83142ada57851a0cbea1", "score": "0.6165163", "text": "def on_start\n\t\treturn nil # no-op\n\tend", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.61534715", "text": "def inner_action; end", "title": "" }, { "docid": "f7768f41b9afcf5d1ca7066d08b4aa71", "score": "0.61398333", "text": "def on_finish; end", "title": "" }, { "docid": "bed13fd1d5ddd3a1d318b8f23b653d1a", "score": "0.61375636", "text": "def call\n end", "title": "" }, { "docid": "0b2efa834a780be0f19352547b17809b", "score": "0.6130648", "text": "def on_page_load; end", "title": "" }, { "docid": "19b031aae8fdf0e6c3acff7bd60d31d0", "score": "0.61202365", "text": "def call\n end", "title": "" }, { "docid": "f64a3c90aa27dc9b6a072a5884b1ab7f", "score": "0.61128414", "text": "def on_refresh; end", "title": "" }, { "docid": "cdb096cc81d4244f80d7564e14cad39f", "score": "0.60917646", "text": "def after_load\n end", "title": "" }, { "docid": "cdb096cc81d4244f80d7564e14cad39f", "score": "0.60917646", "text": "def after_load\n end", "title": "" }, { "docid": "209c5543c90b019c969751acf3bf4a86", "score": "0.60885024", "text": "def after_call; end", "title": "" }, { "docid": "47a99deff0a202b09239f54ff4a4a521", "score": "0.60882473", "text": "def called(context); end", "title": "" }, { "docid": "1df65d045e0d65f9bf9b98c8cdd94356", "score": "0.6073316", "text": "def finish()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "ba80d9966d49094792520d5d6013c2ff", "score": "0.6050806", "text": "def travel_back; end", "title": "" }, { "docid": "5bd5ff16c980e9fc63bfadd4526e6af9", "score": "0.6050763", "text": "def call\n # No-op until redefined\n end", "title": "" }, { "docid": "4bc1e890096be37c7ffb2df67db38e15", "score": "0.60407305", "text": "def post_exec\n end", "title": "" }, { "docid": "c13f23579490ff181f0742040087456b", "score": "0.60368526", "text": "def postRun\n end", "title": "" }, { "docid": "ee96cf530bcbdbf5a9d9a2dea5910ac3", "score": "0.60235846", "text": "def upon\n end", "title": "" }, { "docid": "1c709e6047dee3022a362eb47e365c82", "score": "0.6016785", "text": "def hook; end", "title": "" }, { "docid": "1c709e6047dee3022a362eb47e365c82", "score": "0.6016785", "text": "def hook; end", "title": "" }, { "docid": "1c709e6047dee3022a362eb47e365c82", "score": "0.6016785", "text": "def hook; end", "title": "" }, { "docid": "1c709e6047dee3022a362eb47e365c82", "score": "0.6016785", "text": "def hook; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.6008116", "text": "def action_run\n end", "title": "" }, { "docid": "7e340608aeb31d3ea4c087fad943a73b", "score": "0.5994359", "text": "def do_finish; end", "title": "" }, { "docid": "30f91fc450065abe53a21a06c7e28b34", "score": "0.59858274", "text": "def start_page; end", "title": "" }, { "docid": "4facd28fa9ca3f2a12619837e61004af", "score": "0.5981424", "text": "def called(context); super if defined? super end", "title": "" }, { "docid": "0e276fcca6b34a031f73b0f330985a8d", "score": "0.59762794", "text": "def event; end", "title": "" }, { "docid": "0e276fcca6b34a031f73b0f330985a8d", "score": "0.59762794", "text": "def event; end", "title": "" }, { "docid": "0e276fcca6b34a031f73b0f330985a8d", "score": "0.59762794", "text": "def event; end", "title": "" }, { "docid": "cf320706f00d2de54dbcd5e152bfdf87", "score": "0.5975428", "text": "def on_bar; end", "title": "" }, { "docid": "db2d00cc1f56fce9ace1ca96395bb829", "score": "0.59741926", "text": "def postReady()\n\t\t\t#does nothing. extend in subclasses\n\t\tend", "title": "" }, { "docid": "b45eba7e0b58863b7443f1907cb3c7f1", "score": "0.5957857", "text": "def run_cycle\n\t\t\t\tsuper()\n\t\t\t\t\n\t\t\t\t#puts 'UIApp->run_cycle'\n\t\t\t\t\n\t\t\t\trender\n\t\t\tend", "title": "" }, { "docid": "95f1998773e9059ea32a1092fcfe2198", "score": "0.5956778", "text": "def starting; end", "title": "" }, { "docid": "f9fad952fadb402e9282535a3c7de1e2", "score": "0.5956763", "text": "def gui_end\n end", "title": "" }, { "docid": "f624fabbcc0024856a18146344f4a9c9", "score": "0.59566087", "text": "def start\n super\n end", "title": "" }, { "docid": "f624fabbcc0024856a18146344f4a9c9", "score": "0.59566087", "text": "def start\n super\n end", "title": "" }, { "docid": "f624fabbcc0024856a18146344f4a9c9", "score": "0.59566087", "text": "def start\n super\n end", "title": "" }, { "docid": "f624fabbcc0024856a18146344f4a9c9", "score": "0.59566087", "text": "def start\n super\n end", "title": "" }, { "docid": "e692d597bade15ce04caffb430d5220b", "score": "0.5954971", "text": "def post_load\n \n end", "title": "" }, { "docid": "61710f1359e9f4eb646612f0ec04f379", "score": "0.5949509", "text": "def post_process; end", "title": "" }, { "docid": "c0b8dc0298fd59ba1ef277e3116c4480", "score": "0.59408855", "text": "def done\n super\n end", "title": "" }, { "docid": "57f29599265b081ad03dcb6e20c45a84", "score": "0.593994", "text": "def start\n super\n end", "title": "" }, { "docid": "57f29599265b081ad03dcb6e20c45a84", "score": "0.593994", "text": "def start\n super\n end", "title": "" }, { "docid": "57f29599265b081ad03dcb6e20c45a84", "score": "0.593994", "text": "def start\n super\n end", "title": "" }, { "docid": "57f29599265b081ad03dcb6e20c45a84", "score": "0.593994", "text": "def start\n super\n end", "title": "" }, { "docid": "57f29599265b081ad03dcb6e20c45a84", "score": "0.593994", "text": "def start\n super\n end", "title": "" }, { "docid": "57f29599265b081ad03dcb6e20c45a84", "score": "0.593994", "text": "def start\n super\n end", "title": "" }, { "docid": "57f29599265b081ad03dcb6e20c45a84", "score": "0.593994", "text": "def start\n super\n end", "title": "" }, { "docid": "57f29599265b081ad03dcb6e20c45a84", "score": "0.593994", "text": "def start\n super\n end", "title": "" } ]
87901932c19ed3e732848b322fa89ee0
GET /consumables/1 or /consumables/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "06277cba2760234ac1d06f3de5ed69a9", "score": "0.6278811", "text": "def index\n @consumables = Consumable.all\n end", "title": "" }, { "docid": "79ec36ac425286888bc7ac5ff1ed2bc6", "score": "0.6138351", "text": "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "title": "" }, { "docid": "d4f5e3d9580bce75ce5f184c1109dde8", "score": "0.5944931", "text": "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "title": "" }, { "docid": "23405900a3681d262d46045501239ce1", "score": "0.5939267", "text": "def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end", "title": "" }, { "docid": "3089dc0eabcdd41821d6d23110d76d53", "score": "0.58739316", "text": "def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end", "title": "" }, { "docid": "468dc13aafa722f9af115c7bc259e06e", "score": "0.584698", "text": "def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end", "title": "" }, { "docid": "53a9d68c0a6e28521eaadb3be1cb66e2", "score": "0.5846684", "text": "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "title": "" }, { "docid": "f771b50ad34c0df56e6d5b662b0425d2", "score": "0.58437514", "text": "def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end", "title": "" }, { "docid": "9c87e74cd954311227e7494edd4d9f70", "score": "0.5813333", "text": "def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end", "title": "" }, { "docid": "966a374d8827e0437fc51ace7d406bd1", "score": "0.57665646", "text": "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "title": "" }, { "docid": "d5e2b0da8bb9721ede03c54ac0580ec1", "score": "0.5731168", "text": "def index\n @cables = Cable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cables }\n end\n end", "title": "" }, { "docid": "a085bec0e6af69709c69e0549a7556d8", "score": "0.57242644", "text": "def index\n @cables = Cable.all\n end", "title": "" }, { "docid": "a085bec0e6af69709c69e0549a7556d8", "score": "0.57242644", "text": "def index\n @cables = Cable.all\n end", "title": "" }, { "docid": "a96b2e1229205e2c402a69fd51c52b14", "score": "0.5689267", "text": "def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end", "title": "" }, { "docid": "ee97c52d5929a495d67c17be4296af5c", "score": "0.56875193", "text": "def index\n @consumable_objects = ConsumableObject.all\n end", "title": "" }, { "docid": "af47351c469c01362f0fc17da21b663c", "score": "0.56799906", "text": "def index\n @content_item_condos = ContentItemCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_item_condos }\n end\n end", "title": "" }, { "docid": "5fe6b2398a151c629eda5d2aa64dd98c", "score": "0.56668246", "text": "def index\n @fundamental_resource_pools = Fundamental::ResourcePool.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_resource_pools }\n end\n end", "title": "" }, { "docid": "339ca7d46a410a1a977acb9557ad3ef6", "score": "0.56636053", "text": "def show\n connection = connection_from_params\n if connection.nil?\n head 404\n else\n render jsonapi: connection_from_params, serializer: Connection::Serializer\n end\n end", "title": "" }, { "docid": "af4d844a60fb209e3fce37ab478533c7", "score": "0.5662424", "text": "def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end", "title": "" }, { "docid": "d10f9daba7a7d92ee0d75ddaa3013cb3", "score": "0.5662334", "text": "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "title": "" }, { "docid": "a2f6078b717fee4dbd8796306d82ecd1", "score": "0.5601393", "text": "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "title": "" }, { "docid": "ac38e15ae38ac1ffd22e1f79326e8c05", "score": "0.5597533", "text": "def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end", "title": "" }, { "docid": "35fa030b98b8b5b016093d4b5d2d3322", "score": "0.5594107", "text": "def index\n @conns = current_user.conns\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conns }\n end\n end", "title": "" }, { "docid": "ad29a188f8faeb241ba49b1ed7caa1ea", "score": "0.5574236", "text": "def index\n @content_condos = ContentCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_condos }\n end\n end", "title": "" }, { "docid": "e60ac17f6f023fbc004553d71ccd1313", "score": "0.5569015", "text": "def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end", "title": "" }, { "docid": "e60ac17f6f023fbc004553d71ccd1313", "score": "0.5569015", "text": "def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conductor }\n end\n end", "title": "" }, { "docid": "956e542386985d92bb739119ea0d03e0", "score": "0.556748", "text": "def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end", "title": "" }, { "docid": "60528cd7ab53148df76a39e37b8f70e9", "score": "0.5563102", "text": "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "title": "" }, { "docid": "30ce86bc57a13a8516fe27429ba55618", "score": "0.556105", "text": "def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end", "title": "" }, { "docid": "ac2b1a2d7426c9206fcd8bf16d40e83b", "score": "0.55350554", "text": "def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end", "title": "" }, { "docid": "cb09f7842e00b0b01e6cdbef3549276b", "score": "0.5505614", "text": "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "title": "" }, { "docid": "8f703056661e643ead8fc50acf3ab948", "score": "0.5504648", "text": "def index\n @comprobantes = Comprobante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comprobantes }\n end\n end", "title": "" }, { "docid": "4bc237f5b5b38d01e512bb0088ea603f", "score": "0.5501849", "text": "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "title": "" }, { "docid": "b1d67a8e02aae6a80c1b996288887c26", "score": "0.55012095", "text": "def get\n Iterable.request(conf, base_path).get\n end", "title": "" }, { "docid": "b1d67a8e02aae6a80c1b996288887c26", "score": "0.55012095", "text": "def get\n Iterable.request(conf, base_path).get\n end", "title": "" }, { "docid": "ab2170ea65871eaf4e287246a54a1d5e", "score": "0.5490402", "text": "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "title": "" }, { "docid": "c524e0bed934d57cce90862ca0c53223", "score": "0.5489043", "text": "def index\n render jsonapi: authorized_collection, each_serializer: Connection::Serializer\n end", "title": "" }, { "docid": "fdc8808b9b8dd83ceb14324653aaf92d", "score": "0.54809403", "text": "def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "title": "" }, { "docid": "472dd539d182dc416f9c05edffdaa4ef", "score": "0.54801226", "text": "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "title": "" }, { "docid": "1e156ad60e3c459b4e9c53523ef797ec", "score": "0.54763275", "text": "def index\n #Busca Banco\n @bancos = Banco.where(nil) #Inicia Escopo\n @bancos = @bancos.codigo(params[:codigo]) if params[:codigo].present?\n @bancos = @bancos.descricao(params[:descricao]) if params[:descricao].present?\n #End Busca Banco\n \n @bancos = @bancos.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json:{ bancos: @bancos, total: @bancos.total_entries } }\n end\n end", "title": "" }, { "docid": "2d1ae097967286723bef6e3fb3331cde", "score": "0.5471278", "text": "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "title": "" }, { "docid": "c27fa0288a5d23a490a9cd96266a3660", "score": "0.5470377", "text": "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "title": "" }, { "docid": "465b3974eea9a806a4584c5893b3442d", "score": "0.5469871", "text": "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "title": "" }, { "docid": "6475f9c783bba260e7421cf2182ba666", "score": "0.5466482", "text": "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "title": "" }, { "docid": "dae13b63983aa44582b14bcc9b28d413", "score": "0.5454607", "text": "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "title": "" }, { "docid": "400b928a44722f227613f163816550ce", "score": "0.545131", "text": "def all\n get(\"#{domain}/complaints\")\n end", "title": "" }, { "docid": "9a96c0192e67a0fc06b0621a6db62588", "score": "0.5444642", "text": "def index\n @macs = Mac.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @macs }\n end\n end", "title": "" }, { "docid": "c48cbc4ac44a4a93464c8a45c7131116", "score": "0.54425746", "text": "def index\n @congties = Congty.all\n end", "title": "" }, { "docid": "682bf008da8199213d8d99b527bd3878", "score": "0.54410815", "text": "def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end", "title": "" }, { "docid": "c97259dc12cc90e2e3aced41efd0b8ab", "score": "0.5437772", "text": "def current\n batles = BatlePool.instance.all\n render json: batles,\n except: :location_id,\n include: [:heroes, :threat],\n status: :ok\n end", "title": "" }, { "docid": "c63d01cc01f0073cce98ca85347cb7b7", "score": "0.5432943", "text": "def info\n CouchRest.get \"#{@uri}/\"\n end", "title": "" }, { "docid": "aa4cb0368db3bd8b8f4425c85893eac2", "score": "0.5430806", "text": "def show\n @connection = Connection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @connection }\n end\n end", "title": "" }, { "docid": "474b394c6230a281e2234eb92dc9f49f", "score": "0.5427261", "text": "def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end", "title": "" }, { "docid": "9b1d71667caba6fb998ec1301738d857", "score": "0.5425239", "text": "def show\n @consumable_use = ConsumableUse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @consumable_use }\n end\n end", "title": "" }, { "docid": "a96948f1221b42c9334fb9a2cd16f7f1", "score": "0.5424399", "text": "def show\n @combinacion = Combinacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @combinacion }\n end\n end", "title": "" }, { "docid": "a1e5d33c5e461f9297b2ffd206fe6b2a", "score": "0.54242224", "text": "def index\n @consents = Consent.all\n render json: @consents\n end", "title": "" }, { "docid": "cb5b998ed8a358ddc08dd8c1147b727c", "score": "0.54239386", "text": "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "title": "" }, { "docid": "f154dfbb32a467da95053bab6b850559", "score": "0.54200625", "text": "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "title": "" }, { "docid": "f154dfbb32a467da95053bab6b850559", "score": "0.54200625", "text": "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "title": "" }, { "docid": "d3e02320227b76d34c4d77469cd5ebc7", "score": "0.54174995", "text": "def index\n @combustibles = Combustible.all\n end", "title": "" }, { "docid": "9d8da5209ff0e26298b2d9496f3845dd", "score": "0.5417439", "text": "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "title": "" }, { "docid": "62a004e19e779568d9e38231d4327d10", "score": "0.5411955", "text": "def show_complaint_by_id\n complaint = Complaint.find(params[:id])\n if complaint\n render json: complaint, methods: [:status]\n else\n render json: {status: \"error\", error_message: \"complaint not found\"}\n end\n end", "title": "" }, { "docid": "24b7aa39318b8545a159e50ddb7dbafd", "score": "0.54078984", "text": "def show\n @contratacao = Contratacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contratacao }\n end\n end", "title": "" }, { "docid": "a6747d1f4b8b48976fb6e60d648839b5", "score": "0.5405567", "text": "def index\n @commits = Commits.all(params[:branche_id])\n\n respond_to do |format|\n format.json { render json: @commits, status: 200 }\n end\n end", "title": "" }, { "docid": "a77fb544011693c601aa2a3cb53ec3c1", "score": "0.539886", "text": "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "title": "" }, { "docid": "37922b2e171eba4979191d6e7080fb5d", "score": "0.5389161", "text": "def show\n @complaint = Complaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complaint }\n end\n end", "title": "" }, { "docid": "419c0c8c1051cb6c405dc297d089c2fe", "score": "0.53866243", "text": "def index\n @conductors = Conductor.all\n end", "title": "" }, { "docid": "836d3d8893da3514bf457c700f72a8d9", "score": "0.5385916", "text": "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "title": "" }, { "docid": "30f2add07deb55c35791e32fba2d319c", "score": "0.53855777", "text": "def index\n @resources = Resource.where(\"is_approved = true\")\n render json: @resources, status: 200\n end", "title": "" }, { "docid": "30a4aabe1044b64a0e4aa3b8422c1c93", "score": "0.5384329", "text": "def index\n render json: @chapter.reposoitories, status: :ok\n end", "title": "" }, { "docid": "4e876f75e2143a497659974d40ff528e", "score": "0.5383327", "text": "def index\n render json: Client.where(active:true)\n end", "title": "" }, { "docid": "7b9ad4675783d1929703a0cb858ad3da", "score": "0.5379052", "text": "def index\n @benefit_categories = BenefitCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @benefit_categories }\n end\n end", "title": "" }, { "docid": "6344313714ecb8bcd034bcb6f40f9a04", "score": "0.53783053", "text": "def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end", "title": "" }, { "docid": "173ef93e0583fe6dc010625bfa3b48c3", "score": "0.53746605", "text": "def index\n @cryptostables = Cryptostable.all\n\n require 'uri'\n require 'net/http'\n require 'openssl'\n\n @url = \"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?CMC_PRO_API_KEY=#{ENV.fetch('CRYPTO')}&start=1&limit=500\"\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_cryptos = JSON.parse(@response)\n @profit_loss = 0\n end", "title": "" }, { "docid": "05fab5cb14a4440b5a19f42d15c6648e", "score": "0.5369683", "text": "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "title": "" }, { "docid": "05fab5cb14a4440b5a19f42d15c6648e", "score": "0.5369683", "text": "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "title": "" }, { "docid": "7bbc0dbfc62a03e57e53d37f9425f736", "score": "0.5368344", "text": "def index\n if index_params.present?\n @complaints = Complaint.where(status: index_params[:filter], customer_id: current_user.customer_id)\n else\n @complaints = Complaint.all\n end\n render json: @complaints, status: 200\n end", "title": "" }, { "docid": "f448bb5d09aad1aeba580fd02afa4780", "score": "0.53639245", "text": "def show\n @coin_set = CoinSet.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coin_set }\n end\n end", "title": "" }, { "docid": "8da81bfb17d03843a690cffffa9bdd6b", "score": "0.53604", "text": "def index\n respond_with Celeb.all\n end", "title": "" }, { "docid": "d097161f639af1f8c010d68ba32ac57b", "score": "0.53451914", "text": "def show\n @cable = Cable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cable }\n end\n end", "title": "" }, { "docid": "0382563017f71f768645d1909a3a3ff7", "score": "0.53450215", "text": "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "title": "" }, { "docid": "4a06bdd75101cb800cd8b03bf1aa42ee", "score": "0.5344913", "text": "def statuses\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Available\", \"2\" => \"On Hold\", \"3\" => \"Borrowed\", \"4\" => \"Unavailable\"}}, :status => 200\n\t\treturn\n\tend", "title": "" }, { "docid": "a4e1612ce2b2ed47b4f4b68813b2fb60", "score": "0.53387105", "text": "def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end", "title": "" }, { "docid": "0cfe80208131fb65aa4c6d11312ef772", "score": "0.53386796", "text": "def index\n @_resources = client.credit_contracts.includes(:main_account, :current_account, credit: %i[currency credit_type])\n render layout: 'application_fluid'\n end", "title": "" }, { "docid": "534a1856f3aa21ae397edc113946d46c", "score": "0.5335133", "text": "def json_index_bundles\n\n @bundles = Bundle.where(\"active = 'y'\").order(:id)\n respond_to do |format|\n format.json { render json: @bundles.as_json()\n\n }\n end\n\n end", "title": "" }, { "docid": "e3d4b3a77400402d3766f64634579eb8", "score": "0.53325284", "text": "def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end", "title": "" }, { "docid": "63c64486c20c24937911bd369a6bf4d8", "score": "0.5330725", "text": "def show\n @cookbook = Cookbook.with_name(params[:cookbook]).\n includes(:cookbook_versions).first!\n @latest_cookbook_version_url = api_v1_cookbook_version_url(\n @cookbook, @cookbook.latest_cookbook_version\n )\n\n @cookbook_versions_urls = @cookbook.sorted_cookbook_versions.map do |version|\n api_v1_cookbook_version_url(@cookbook, version)\n end\n end", "title": "" }, { "docid": "bdacc1593e0ccb6c6227a161e5268f4b", "score": "0.53292936", "text": "def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end", "title": "" }, { "docid": "badd86fbb34e32089020fceb5c056a85", "score": "0.53286076", "text": "def index\n authenticate_admin!\n \n @candies = Candy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @candies }\n end\n end", "title": "" }, { "docid": "2eb96d50e42ddcb9d8fb7a1fa02d2ac8", "score": "0.5324181", "text": "def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @company = Company.find(id_from_params)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "title": "" }, { "docid": "85d92960429e6f46efb67cf3e3930ba2", "score": "0.53231764", "text": "def show\n @console_pool = ConsolePool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @console_pool }\n end\n end", "title": "" }, { "docid": "f375c302313bf7ba4efaca5d0394ae05", "score": "0.5321752", "text": "def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end", "title": "" }, { "docid": "1c00b1f8ed55042cf6b529d329e4cd8f", "score": "0.53186226", "text": "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "title": "" }, { "docid": "a962bb10b8e95ccf0fe5134a0565ab80", "score": "0.5316271", "text": "def show\n @comprobante = Comprobante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comprobante }\n end\n end", "title": "" }, { "docid": "dd5a521d960e3460371f73b43329d3b3", "score": "0.5310686", "text": "def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end", "title": "" }, { "docid": "5bbaf26029c337e0e4f88355ba111e88", "score": "0.5307004", "text": "def index\n @responsibilities = Responsibility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responsibilities }\n end\n end", "title": "" }, { "docid": "bccc7e08ca1ca9800639333e57e0f4f2", "score": "0.53011537", "text": "def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end", "title": "" }, { "docid": "bd2e468f30ea652b01d3d13114326602", "score": "0.5301102", "text": "def show\n @conn = current_user.conns.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conn }\n end\n end", "title": "" }, { "docid": "5c668a839e58642b47e26a54c9ebe88c", "score": "0.5298956", "text": "def index\n @client_changes = ClientChange.all\n if params[:client_id]\n authorize! :read, Client.find(params[:client_id])\n @client_changes = @client_changes.where('client_id' => params[:client_id])\n end\n if params[:user_id]\n @client_changes = @client_changes.where('user_id' => params[:user_id])\n end\n @client_changes = @client_changes.desc(:created_at)\n\n if params[:short]\n @client_changes = @client_changes.only(:id, :user, :client, :type, :description, :updated_at)\n end\n\n @client_changes = current_ability.select(@client_changes)\n if params[:limit]\n @client_changes = @client_changes.take(params[:limit].to_i)\n end\n\n respond_to do |format|\n format.json { render json: get_json(@client_changes) }\n end\n end", "title": "" }, { "docid": "0b64b4852e01df312a848ce7c7162c48", "score": "0.5297591", "text": "def fetch(options = {})\n url = build_url(options)\n puts \"Getting #{url}\"\n\n json = get_response(url)\n\n if self.is_json?\n data = JSON.parse(json)\n else\n data = XmlSimple.xml_in(json)\n end\n\n # TODO: Raise hell if there is a problem\n\n collection = OpenCongressApi::Collection.build(json_result(data))\n collection.map!{|result| format_result(result)}\n end", "title": "" }, { "docid": "a91f666272ac54f33a8e467b4e6d4053", "score": "0.5294058", "text": "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "title": "" } ]
9f2ef3ca2da42e7ab5d29210df406747
Send semminder after no activity about 2 days
[ { "docid": "a6ff71fddb9019e6c4465b9b047bd2b3", "score": "0.5320241", "text": "def send_reminder_no_activity(options)\n mailer_content = options['mailer_content']\n MemberMailer.send_reminder_no_activity(mailer_content).deliver if mailer_content.present?\n end", "title": "" } ]
[ { "docid": "6c56b84e53aac9627b650520f7808ed1", "score": "0.6545573", "text": "def reminder_sent\n end", "title": "" }, { "docid": "d1e1c4f7a0c8434f00817db6cb24106e", "score": "0.6415949", "text": "def send_reminder\r\n\t\tif Date.today == expiration_date - 1\r\n\t\t\tReminderMailer.food_reminder_msg(@user).deliver\r\n \t\tflash[:notice] = \"#{@user.username} has been notified by email.\" \r\n \tend\r\n end", "title": "" }, { "docid": "4d2c82aa33a2bac6f3b62471ef864f05", "score": "0.6264934", "text": "def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end", "title": "" }, { "docid": "0032aed8bb382a6685b7621cebe59695", "score": "0.6181551", "text": "def reminder\n\n end", "title": "" }, { "docid": "5a62862df16ed4c6f2dd6d5318ee312c", "score": "0.6079166", "text": "def daily_midnight\n logger.info \" daily_midnight\"\n PersistStatsJob.create({})\n Gift.send_expiration_reminders(5)\n Gift.send_expiration_reminders(3)\n Gift.send_expiration_reminders(1)\n end", "title": "" }, { "docid": "87c7d97f7f9ee4ad4aa2596b0d0f2848", "score": "0.6060301", "text": "def send_travel_reminders\n @title = 'Send reminders'\n @travels = Travel.pending.where(\"reminder_sent IS ? AND member_id IS NOT ?\", nil, nil)\n @messages = []\n @travels.each do |travel|\n if travel.member.email\n @messages << Notifier.travel_reminder(travel) \n travel.update_attribute(:reminder_sent, Date.today)\n#puts \"**Reminder_sent set to #{travel.reload.reminder_sent}\"\n end\n end\n @messages.each {|m| m.deliver}\n flash[:notice] = \"Sent #{@messages.count} travel reminder messages\"\n AppLog.create(:severity=>'info', :code=>'Notice.travel_reminder', :description => flash[:notice])\n redirect_to travels_path\n end", "title": "" }, { "docid": "2a12a1cf7e916ee4a69262939a8d358d", "score": "0.60111046", "text": "def send_auto_reminder?\n self.auto_reminder_days > 0\n end", "title": "" }, { "docid": "baf48ed546c007cedc3c6df7edf243ac", "score": "0.6005354", "text": "def due_date_chaser(user)\n @user = user\n # Checks if the time difference in days is between 0 and 1.\n \n # Toggle the 0..0 range if you want to change. 0..0 is 24 hours, 0..1 is 48 hours....\n @items = Item.where(user_id: @user.id).where(completed: false).where.not(due_date: nil).select {|v| (0..0).include?((DateTime.parse(v.due_date) - DateTime.current()).to_i) }\n @url = 'https://fergus-cvwo.netlify.app/'\n if @items != []\n mail(to: @user.email, subject: 'You have tasks due in 24 hours!')\n end\n end", "title": "" }, { "docid": "9cb2b53568489f3c3ee343cfd7589994", "score": "0.59665996", "text": "def notify_member_expire_1\n users, event = User.unpaid_membership_expires_in_1_day\n users.each do |user|\n UserMailer.deliver_membership_expires_in_1_day(user)\n User.add_email_event(user, event)\n end\n end", "title": "" }, { "docid": "e1cbc9801a26c941e6e046668bff99c2", "score": "0.5923625", "text": "def resendable?\n (self.sent_at + 15.minutes) < Time.current\n end", "title": "" }, { "docid": "a9d00b8479ac9ced8d1f4bf480a71a91", "score": "0.5868195", "text": "def send_diary_reminder( user_email, user_goal, date = Time.now, token = nil )\n subj = '#whatdidyoudo on ' + Date::DAYNAMES[ date.wday] + \n date.strftime(\" %d \") + \n Date::MONTHNAMES[ Time.now.month ] + user_goal + \" ?\"\n if !token or token.to_s == smtp_settings[:token].to_s\n mail from: smtp_settings[:sender_email], to: user_email, subject: subj\n end\n end", "title": "" }, { "docid": "2f597a9be401a3cf6c5c12a815de9b13", "score": "0.5863783", "text": "def extendbythirthydays\n update_at = update_at + 14.days.from_now\n end", "title": "" }, { "docid": "a607f5f95a6da5723bdfa0d97aaccfdf", "score": "0.58398676", "text": "def send_day_before_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end", "title": "" }, { "docid": "a4794210300c0d1ea223b0a9f9d82187", "score": "0.58352435", "text": "def create\n SellersMailer.delay.apply_reminder(current_user.id)\n\n # Delay slightly to make it seem like it wasn't automatic ;)\n SellersMailer.delay_for(rand(5.minutes..15.minutes)).apply(current_user.id)\n \n render json: {}, status: 200\n end", "title": "" }, { "docid": "9784d3321bfa764137c78c4d75b37aaf", "score": "0.57944036", "text": "def appt_reminder_email_time\n if self.start_time.to_date > (self.created_at.to_date + 1)\n self.start_time - 12.hours\n end\n end", "title": "" }, { "docid": "bc98ff8929bae5ef93ba511693552b4c", "score": "0.57897013", "text": "def reminder\n send_reminders self.charges.where(:completed => false)\n end", "title": "" }, { "docid": "ce6c0c9565f1c4d441fdae5fdf8c30b1", "score": "0.57893753", "text": "def increment_doer_reminder_count\n increment_reminder_count\n end", "title": "" }, { "docid": "f30eac40e67dc53cd99b6f0993b23afa", "score": "0.57580376", "text": "def send_final_exam_invitation!\n update_attribute(:final_exam_invitation_sent_at, Time.now)\n end", "title": "" }, { "docid": "bdaf1c25c8a3bd38c9b1d12cd654b0e6", "score": "0.5750636", "text": "def reminder(user:)\n @user = user\n @expiration = @user.trial_ends_at\n @subject = \"Your free trail to My Site Archive expires in #{time_ago_in_words(@expiration)}.\"\n\n mail to: @user.email, subject: @subject\n end", "title": "" }, { "docid": "523444e5de1db41feafce2531fa8c6bd", "score": "0.57442987", "text": "def schedule_reminder_email\n \tstart_time = Time.at(available_slot.start_time).strftime(' %H:%M')\n \tdate = appointment_date.to_s\n \tschedule_time = (Date.parse(date + start_time) - 30.minutes)\n \tReminderMailer.send_reminder(patient).deliver_later(wait_until: schedule_time)\n end", "title": "" }, { "docid": "420625cfa09d4b7af6c71e48434321cb", "score": "0.5732099", "text": "def send_today?\n day_today = (Date.today - @config['start_date']).round\n (day_today % 28) < 21\nend", "title": "" }, { "docid": "135424f5e98f7526a8b92ef219e5bb6f", "score": "0.57306266", "text": "def send_reminder\n superuser = authorized? @reservation\n \n if @reservation.user != current_user && !superuser\n flash[ :alert ] = \"Reminders can only be sent by their owner, an admin, or an instructor.\"\n elsif @reservation.session.in_past? && !superuser\n flash[ :alert ] = \"Reminders cannot be sent once the session has ended.\" \n else\n @reservation.send_reminder\n flash[ :notice ] = \"A reminder has been sent to #{@reservation.user.name}.\"\n end\n \n if @reservation.user == current_user\n redirect_to reservations_path\n elsif superuser\n redirect_to sessions_reservations_path( @reservation.session )\n else\n redirect_to root_url\n end\n end", "title": "" }, { "docid": "de6222299d8cdc465bda72e751e55dfd", "score": "0.5716508", "text": "def email_reminder(day)\n return if result(day) || unsubscribed\n send_email_reminder(day)\n end", "title": "" }, { "docid": "5384dacc20c0d81318baece864edc7df", "score": "0.5714353", "text": "def send_user_reminder_notice(user)\n return if user.email.nil?\n return if user.last_reminder.sent_at < one_week_ago\n EmailSender.send_notice_to(user.email)\nend", "title": "" }, { "docid": "1106a21928e6751c7e3d73d53deac1e1", "score": "0.5707437", "text": "def trial_ending(user)\n mail to: user.email, subject: \"Only 72 Hours Left of Review Alerts!\"\n end", "title": "" }, { "docid": "13c0e476f8427cbda5c972eeaefcf290", "score": "0.570485", "text": "def day_put_on_sale\n @day = params[:day]\n @seller = @day.seller\n @url = \"https://chickpeas.herokuapp.com/days\"\n\n seller_parent_ids = @seller.parents.map(&:id)\n # email to all parents other than those posting\n emails = Parent.all_current_with_active_email_except(seller_parent_ids)\n send_mail(to: emails, subject: \"A New Chickpeas Day is Up For Sale\")\n end", "title": "" }, { "docid": "326adc91e43dc87afeb8ee2f09be153e", "score": "0.5704818", "text": "def daily_claim()\n if not @daily\n @daily = true\n @credits = @credits + 250\n val = \"Daily claimed!\"\n else\n val = \"You already claimed your daily!\"\n end\n val\n end", "title": "" }, { "docid": "65bfaa4a81574005d9dadfb1c18721ed", "score": "0.5688535", "text": "def reminder\n RequestMailer.reminder\n end", "title": "" }, { "docid": "4faf37638729d76b7743bdb52c14a78d", "score": "0.56881", "text": "def send_sms_reminder\n return true # Disable sms sender\n if phone_number and sms_opt_in?\n _participation_requests = participation_requests.where(date: Date.tomorrow, state: 'accepted')\n return false if _participation_requests.empty?\n\n if _participation_requests.length > 1\n message = I18n.t('sms.users.day_before_reminder.multiple_course',\n nb_courses: _participation_requests.length,\n start_time: I18n.l(_participation_requests.first.start_time, format: :short))\n else\n message = _participation_requests.first.decorate.sms_reminder_message\n end\n\n self.delay.send_sms(message, phone_number)\n end\n end", "title": "" }, { "docid": "5f970882f4fc7a9cd7efda18d87c4efd", "score": "0.5675825", "text": "def send_overdue_notice(notice)\n p \"Reminder #{get_name} #{notice}\"\n end", "title": "" }, { "docid": "5f970882f4fc7a9cd7efda18d87c4efd", "score": "0.5675825", "text": "def send_overdue_notice(notice)\n p \"Reminder #{get_name} #{notice}\"\n end", "title": "" }, { "docid": "f472c05c71ef08a699e7a65c13dfeaf4", "score": "0.56634355", "text": "def day(member)\n puts \"sending for #{member.login}\"\n @day = member.days.latest\n @watchings = @day.watchings\n @followings = @day.followings\n @watchers = @day.watchers\n @followers = @day.followers\n mail from: \"Gitday <[email protected]>\", to: \"#{member.login} <#{member.email}>\", subject: @day.title\n rescue Timeout::Error\n puts \"connect error: #{entry.short_id}\"\n end", "title": "" }, { "docid": "bce6b725ce206dcd66a3c99cb67b0abe", "score": "0.56303877", "text": "def schedule_repetition\n self.due = Date.today + interval\n self.studied_at = Date.today\n end", "title": "" }, { "docid": "8852da9ebb8d3b72ee9197540e6f7fbc", "score": "0.5621362", "text": "def pre_lesson_reminder(user)\n @day = day_of_week_string(Date.tomorrow)\n @user = user\n mail to: user.email, subject: \"Reminder: Complete Pre-Lesson Information\"\n end", "title": "" }, { "docid": "daa568fcc78a7e5ab353bfadb5ce5ddb", "score": "0.56190366", "text": "def send_user_reminder(referral,num_of_times)\n @referral = referral\n @num_of_times = num_of_times\n set_receiver(@referral)\n set_sender(@referral)\n\n if @num_of_times == 1\n mail(to: @receiver_email,subject: \"Reminder - Please indicate your interest for your referral\").deliver\n else\n mail(to: @receiver_email,subject: \"Last Reminder - Please indicate your interest for your referral\").deliver\n end\n end", "title": "" }, { "docid": "66d345a70208156ea2c09a38cf4faf2e", "score": "0.56132156", "text": "def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end", "title": "" }, { "docid": "2f152b246ca66c0f5ea8fc1583af1be7", "score": "0.56044304", "text": "def remind\n # if the lesson is in a day and they haven't done the pre-lesson\n if lesson_tomorrow? && next_lesson.date != Date.tomorrow\n send_pre_lesson_reminder_email\n elsif Date.today == next_lesson.date\n send_lesson_reminder_email\n # if there was a lesson scheduled yesterday and no post-lesson survey was filled out\n #elsif previous_lesson.unfinished?\n # # remind the user to do the post lesson survey\n end\n end", "title": "" }, { "docid": "b5a6959a4ff7fe9d6fa4d508978bde16", "score": "0.55999374", "text": "def deliver!\n @delivery_time = Time.new + 30*60\n end", "title": "" }, { "docid": "aa815276346900abf78f4bfc6bf4276c", "score": "0.5587413", "text": "def dispute_closed\n UserMailer.dispute_closed\n end", "title": "" }, { "docid": "e6144091baf9b36b87e2a32ed2435018", "score": "0.5584882", "text": "def checking_in_number\n self.days_completed += 1\n self.check_in_current = true\n next_day = self.current_day + 1\n if next_day > self.days_to_complete # For real time feedback\n self.active = false \n self.inactive_cleanup\n end\n self.save\n\n # Since you already checked in, delete reminder to check in again\n sms_reminder_jobs = Delayed::Job.where(:owner_type => \"Micropost\", \n :owner_id => self.id, \n :owner_job_type => \"4 Hour Reminder\"\n )\n sms_reminder_jobs.each do |job|\n job.delete\n end\n end", "title": "" }, { "docid": "c8d8a077b95c06980be61825f5292877", "score": "0.55776983", "text": "def confirmation_period_expired?; end", "title": "" }, { "docid": "05ab15a66a3f27c28eaf577d369704c2", "score": "0.5573546", "text": "def schedule_future_check_out(user, future_date)\n\n end", "title": "" }, { "docid": "bfbe9ed6b6ab4ff848720c6ddb7e17f0", "score": "0.55582345", "text": "def notify\n ReminderMailer.notify\n end", "title": "" }, { "docid": "97b9c048bba1d981ee38ce7087635f9d", "score": "0.555351", "text": "def nominations_reminder_3_days_left(email:)\n user = User.find_by!(email: email)\n\n if user.reservations.none?\n return\n end\n\n account_numbers = account_numbers_from(user.reservations)\n conzealand = conzealand_memberships.where(reservations: {id: user.reservations}).any?\n\n if account_numbers.count == 1 && conzealand\n subject = \"Hugo Nominations Close in 3 Days! for member #{account_numbers.first}\"\n elsif conzealand\n subject = \"Hugo Nominations Close in 3 Days! for members #{account_numbers.to_sentence}\"\n elsif account_numbers.count == 1\n subject = \"Hugo Nominations Close in 3 Days! for account #{account_numbers.first}\"\n else\n subject = \"Hugo Nominations Close in 3 Days! for accounts #{account_numbers.to_sentence}\"\n end\n\n @details = Detail.where(claim_id: user.active_claims)\n\n mail(to: user.email, from: \"[email protected]\", subject: subject)\n end", "title": "" }, { "docid": "9e30c5ab416806bbdca311a5d80d5cdc", "score": "0.55449855", "text": "def do_job\r\n# disable recycle invites\r\n# min = Time.now.min\r\n# #recycle invites 1 min per hour\r\n# if min == 0\r\n# ret = ActiveRecord::Base.connection.execute(\"delete from invites where invitee_id is null and created_at < subdate(now(), interval 3 day)\")\r\n# puts \"recycle invites: #{ret}\"\r\n# end\r\n end", "title": "" }, { "docid": "a50fa2b265868e3586622ebd52b3b488", "score": "0.5543522", "text": "def ring\n every(2) do\n broadcast(:time, Time.now.httpdate)\n end\n end", "title": "" }, { "docid": "fcdc0798cadaef38495816cd5076c037", "score": "0.5543334", "text": "def remind \n touch :reminded_at\n\n UserMailer.access_token_renewal_reminder(user).deliver\n end", "title": "" }, { "docid": "dcd092469f873ca04279a3f4d25150bf", "score": "0.5527667", "text": "def data_update_notification(user)\n @greeting = \"FREE PEPPERLUNCH@@!!!!!111111\"\n\n @lunch_count = user.lunches.count\n\n if @lunch_count > 15\n\n\n mail to: user.email\n end\nend", "title": "" }, { "docid": "cdecf71103b86297fe1592a08f35cc6a", "score": "0.55241126", "text": "def send_booking_reminder(user, booking)\n @user = user\n @booking = booking\n\n mail( :to => @user.email,\n :subject => \"You have an upcoming booking in 24 hours\" )\n end", "title": "" }, { "docid": "84e4ad7dc01a67e9ff3e4df2f67393f0", "score": "0.5516766", "text": "def dmail_inactive_approvers!\n days_until_next_month = (Date.current.next_month.beginning_of_month - Date.current).to_i\n return unless days_until_next_month <= 21\n\n inactive_approvers.each do |user|\n Dmail.create_automated(to: user, title: \"You will lose approval privileges soon\", body: <<~BODY)\n You've approved fewer than #{MINIMUM_APPROVALS} posts in the past\n #{APPROVAL_PERIOD.inspect}. You will lose your approval privileges in\n #{days_until_next_month} #{\"day\".pluralize(days_until_next_month)}\n unless you have approved at least #{MINIMUM_APPROVALS} posts by the end\n of the month.\n BODY\n end\n end", "title": "" }, { "docid": "05285d6148e9d2cca8f6548711f14a4d", "score": "0.55131996", "text": "def weekly(user)\n @user = User.find(user)\n @points_away = Level.find(@user.level).points - @user.points\n mail(to: \"#{@user.name} <#{@user.email}>\", subject: \"Its Your Weekly Reminder to be Awesome\")\n end", "title": "" }, { "docid": "f1da5bddcceac394f71050aac3ca2811", "score": "0.5502008", "text": "def send_assessment(send_now: false)\n return if ['Unknown', 'Opt-out', '', nil].include?(preferred_contact_method)\n\n return if !last_assessment_reminder_sent.nil? && last_assessment_reminder_sent > 12.hours.ago\n\n # Do not allow messages to go to household members\n return unless responder_id == id\n\n # Stop execution if in CI\n return if Rails.env.test?\n\n # Don't send assessments until the user has at least one dose\n return if latest_dosage.nil?\n\n # start_of_exposure = last_date_of_exposure || created_at\n # return unless (monitoring && start_of_exposure >= ADMIN_OPTIONS['monitoring_period_days'].days.ago.beginning_of_day) ||\n # (monitoring && isolation) ||\n # (monitoring && continuous_exposure) ||\n # active_dependents_exclude_self.exists?\n\n # Determine if it is yet an appropriate time to send this person a message.\n unless send_now\n # Local \"hour\" (defaults to eastern if timezone cannot be determined)\n hour = Time.now.getlocal(address_timezone_offset).hour\n\n now_date = Time.now.getlocal(address_timezone_offset).to_date\n dose_date = latest_dosage.date_given&.to_date || latest_dosage.created_at.to_date\n difference = (now_date - dose_date).to_i\n # Determine if this is an appropriate day to send\n # Daily questionnaire sent daily for 7 days after administration of Dose 1;\n # Questionnaires will be sent to Recipient weekly until Dose 2 is administered\n # Dose 2 is administered between 21 and 28 days after Dose 1 has been administered.\n # Daily questionnaires sent daily for 7 days after dose 2\n # Questionnaire sent Weekly for 6 weeks after daily Dose 2 questionnaires completed.\n # Questionnaires will be sent to Recipient once at the 6 and 12 months marks.\n case latest_dosage&.dose_number\n when 1\n return unless (dose_date > (Time.now.getlocal(address_timezone_offset) - 7.days).to_date) || (difference % 7).zero?\n when 2\n unless (dose_date > (Time.now.getlocal(address_timezone_offset) - 7.days).to_date) ||\n ((difference % 7).zero? && difference / 7 < 6 && (difference / 7).positive?) ||\n (((difference % 30).zero? && (difference / 30 == 6 || difference / 30 == 12)))\n return\n end\n else\n return\n end\n\n # These are the hours that we consider to be morning, afternoon and evening\n morning = (8..12)\n afternoon = (12..16)\n evening = (16..19)\n case preferred_contact_time&.downcase\n when 'morning'\n return unless morning.include? hour\n when 'afternoon'\n return unless afternoon.include? hour\n when 'evening'\n return unless evening.include? hour\n else\n # Default to roughly afternoon if preferred contact time is not specified\n return unless (11..17).include? hour\n end\n end\n\n if preferred_contact_method&.downcase == 'sms text-message' && ADMIN_OPTIONS['enable_sms']\n PatientMailer.assessment_sms(self).deliver_later\n elsif preferred_contact_method&.downcase == 'sms texted weblink' && ADMIN_OPTIONS['enable_sms']\n PatientMailer.assessment_sms_weblink(self).deliver_later\n elsif preferred_contact_method&.downcase == 'telephone call' && ADMIN_OPTIONS['enable_voice']\n PatientMailer.assessment_voice(self).deliver_later\n elsif preferred_contact_method&.downcase == 'e-mailed web link' && ADMIN_OPTIONS['enable_email']\n PatientMailer.assessment_email(self).deliver_later if email.present?\n end\n end", "title": "" }, { "docid": "e45ba0fc4a5dc684c169580bf18506a8", "score": "0.5497699", "text": "def put_to_sleep\n if self.program_player.present?\n self.update_attributes(:num_crows => self.num_crows+1, :day_of_budge => NEEDS_REVIVING)\n self.program_player.user.contact_them(:email, :moment_of_truth, self) \n end\n end", "title": "" }, { "docid": "53746f360a0217cdddb08e5ba7232f48", "score": "0.54942036", "text": "def check_daily_message_limit\n flood_limit = ConfigurationSetting.get_setting( 'DailyPrivateMessageLimit' ).to_i\n today = Date.today.strftime('%Y-%m-%d')\n if not current_user.sent_private_messages.with_date(today).all.size <= flood_limit \n flash[:warning] = \"You have already sent the maximum of \" + flood_limit.to_s + \" messages for the day.\"\n redirect_to private_messages_path\n end\n end", "title": "" }, { "docid": "e57dbda95811d7aa5043c0d63792cb0f", "score": "0.5490698", "text": "def update_remaining_appointments!(time_to_add)\n remaining_appointments_today.each do |appt|\n appt.update_attribute(:appointment_delayed_time,\n appt.appointment_delayed_time + time_to_add.minutes)\n appt.send_delay_email\n appt.push_delay_notification\n end\n end", "title": "" }, { "docid": "f363e661d0aa0eaf7a8e6ac6cb90486b", "score": "0.5486193", "text": "def send_rating_emails_when_ends\n RateRentalJob.set(wait_until: self.end_date.tomorrow.noon).perform_later(self)\n RateSportingGoodJob.set(wait_until: self.end_date.tomorrow.noon).perform_later(self)\n end", "title": "" }, { "docid": "e1ff210262e15f734685ee7d433b497c", "score": "0.5485343", "text": "def reschedule\n reminders = DB.read_all(:shrk_reminders)\n reminders.each do |reminder|\n begin\n if Time.parse(reminder[:at]) <= Time.now\n send_reminder(\n SHRK.user(reminder[:user]),\n SHRK.channel(reminder[:channel]),\n Time.parse(reminder[:scheduled]),\n reminder[:message],\n )\n DB.delete_value(:shrk_reminders, :job_id, reminder[:job_id])\n else\n schedule_reminder(\n SHRK.user(reminder[:user]),\n SHRK.channel(reminder[:channel]),\n reminder[:at],\n reminder[:message],\n renew: true\n )\n end\n rescue Exception\n # Bot doesn't have the permissions to send a reminder somewhere.\n DB.delete_value(:shrk_reminders, :job_id, reminder[:job_id])\n end\n end\n end", "title": "" }, { "docid": "531ec702bab008c13723be3d62ba35fc", "score": "0.5479685", "text": "def next_alert_time\n false\n end", "title": "" }, { "docid": "0217ae029edea13baff337f3f912bee5", "score": "0.5469203", "text": "def can_change_after\n follow_up_for_dose.created_at + follow_up_for_dose.follow_up_in_days.days -\n Rails.configuration.x.schedule_up_to_days.days\n end", "title": "" }, { "docid": "be2cb8e6218712a3af69cb43a4b8e04b", "score": "0.54660726", "text": "def move_worktime_to_another_day(date, duration=0)\n person = self.presence.person\n presence = person.presences.find_by_presence_date(date)\n unless presence\n presence = person.presences.new\n presence.presence_date = date\n presence.company_id = person.company_id\n end\n presence.presence_length_in_hours += (self.end_working - self.start_working)/3600.to_f\n presence.paid_hours = presence.presence_length_in_hours\n self.save!\n end", "title": "" }, { "docid": "5bf74a144853fbaee3aeb2c9dd599388", "score": "0.5458772", "text": "def welcome_call_rescheduled\n UserMailer.welcome_call_rescheduled(WelcomeCall.where(available: false).take)\n end", "title": "" }, { "docid": "d6f3d7dda53bf70af8c3f35ec6c253fb", "score": "0.5458498", "text": "def check_in \n # User already checked in thru SMS before deadline\n if self.check_in_current == true\n next_day_tally\n schedule_new_day if self.days_remaining > 0\n inactive_cleanup if self.days_remaining == 0 # Checks if days_remaining > 0 and schedules a new day (24 hour + 4 hour reminder)\n self.check_in_current = false # Sets this column for next day\n self.save\n else \n # User has NOT checked in via SMS or website and is NOW DUE\n send_day_incomplete_sms # THIS ALWAYS GOES FIRST b/c CURRENT_DAY \n next_day_tally # THEN YOU UPDATE THE DB TALLIES\n send_bad_news_to_buddies if !self.recipients.empty?\n schedule_new_day if self.days_remaining > 0\n if self.days_remaining == 0\n inactive_cleanup \n self.active = false\n end\n self.check_in_current = false # Sets this column for next day\n self.save\n end\n end", "title": "" }, { "docid": "d18c5353bf6ae4a69fb61b709ac6ff70", "score": "0.54562837", "text": "def notify_member_expire_7\n users, event = User.unpaid_membership_expires_in_7_days\n users.each do |user|\n UserMailer.deliver_membership_expires_in_7_days(user)\n User.add_email_event(user, event)\n end\n end", "title": "" }, { "docid": "c33e30285f9ef51597e21d1585b16be5", "score": "0.54447013", "text": "def company_payment_reminders\n check_company_usage_cycle\n company_monthly_payment_reminders\n end", "title": "" }, { "docid": "e9a2ff06de53e5b286398a51f7807395", "score": "0.54340506", "text": "def send_delayed_validation_email\n #get delayed time\n delayed_time = self.time + 1.hour + 45.minutes\n #get info for emails\n booking_name = self.booking_name\n email = self.restaurant.principle_email\n restaurant_name = self.restaurant.name\n #send delayed emails\n if delayed_time > Time.now\n ReservationValidationEmailWorker.perform_at(delayed_time, booking_name, email, restaurant_name )\n end\n end", "title": "" }, { "docid": "4e36a6bb6958f89cee92901d4afae018", "score": "0.5432477", "text": "def send_one_week_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end", "title": "" }, { "docid": "4db40e156c947d2c543660e76e250201", "score": "0.5416058", "text": "def reminding_exec\n return nil unless @timelog_active\n @log.debug(\"Sending reminder through notify.\")\n Knj::Notify.send(\"time\" => 5, \"msg\" => sprintf(_(\"Tracking task: %s\"), @timelog_active[:descr]))\n end", "title": "" }, { "docid": "35ed28713cf32f858d9393eebb5f598a", "score": "0.5413959", "text": "def add_reminder; end", "title": "" }, { "docid": "78429db48cbb0892a5e59d5b5b2de020", "score": "0.5410702", "text": "def update_due_date(due_date)\n due = due_date.to_time\n if !self.reminder_at.nil?\n reminder_in_seconds = self.due_at - self.reminder_at\n self.reminder_at = due - reminder_in_seconds\n if self.project.user.email_flag?\n QueuedMessage.remove(self) \n QueuedMessage.add(self)\n end\n end\n self.due_at = due \n end", "title": "" }, { "docid": "10c79e5c8019e68d1071fa9043feaccf", "score": "0.5409875", "text": "def send_pre_lesson_reminder_email\n UserMailer.lesson_reminder(mentor).deliver_now\n end", "title": "" }, { "docid": "b52f0c7f28f35e362b23bac828a12376", "score": "0.54016864", "text": "def due_next_week_warning_mail\n PetitionMailer.due_next_week_warning_mail(Petition.live.first)\n end", "title": "" }, { "docid": "91891ecff961440aa7ac4381dbc949fd", "score": "0.53997135", "text": "def expiration_alert_to_influencer(tweet, time)\n @tweet = tweet\n @time = time.to_s\n\n set_attachments\n\n mail(to: tweet.influencer.user.email, subject: \"Tweet expira en \"+time.to_s+\" minutos - Its time to go social\")\n end", "title": "" }, { "docid": "b82a7fc866affc9f7eda29769f4d2121", "score": "0.5398534", "text": "def reset_expired?\n\t\treset_sent_at > 3.hours.ago\n\tend", "title": "" }, { "docid": "b66a025cb3dc557a80c30050042b723c", "score": "0.5394264", "text": "def appt_follow_up_email_time\n self.start_time + 4.hours\n end", "title": "" }, { "docid": "dbf5ea82c9c848c7cce3cf104affb0d1", "score": "0.5393513", "text": "def ask_office_answer_due_date_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.ask_office_answer_due_date_mail(Petition.live.first)\n end", "title": "" }, { "docid": "ecba76b1e6ed84956bbd439c93fde208", "score": "0.5391497", "text": "def snooze(days)\n days = days.to_i if (days.class.name == \"String\" and days != \"day-1\")\n\n if days == \"day-1\" and self.happening_date.present?\n self.start_date = self.happening_date - 1\n self.fade_date = self.start_date + 30 if self.fade_date.present?\n else\n #move back start_date and fade_date; happening stays same\n days = 7 if days == \"day-1\"\n self.start_date = Date.today + days\n self.fade_date = self.fade_date + days if self.fade_date.present?\n end\n return self.save\n end", "title": "" }, { "docid": "15325693673b13e803b2026000de5c31", "score": "0.5390724", "text": "def confirm_daily_test_sms()\n Test.order(:created_at).last.update(:incoming_sms => 1)\nend", "title": "" }, { "docid": "26d08237d9e3fe7a8ebc76b58d01fa9e", "score": "0.539066", "text": "def cron_invite_email\n @invites = Invite.find(:all, :conditions => ['draft=0 AND immediately=0'])\n if @invites.count > 0\n for inv in @invites \n @eve = Event.find(inv[:event_id])\n now_date = Time.now.strftime('%Y-%m-%d %H:%M')\n @eve_date = @eve[:event_start_date_time]\n \n if inv[:days]!='' && inv[:days]!=nil\n @eve_date = @eve_date - inv[:days].days\n end\n \n if inv[:hours]!='' && inv[:hours]!=nil\n @eve_date = @eve_date - inv[:hours].hours\n end\n \n if inv[:minutes]!='' && inv[:minutes]!=nil\n @eve_date = @eve_date - inv[:minutes].minutes\n end\n \n if inv[:select_date].strftime('%Y-%m-%d %H:%M') == now_date || @eve_date.strftime('%Y-%m-%d %H:%M')==now_date\n \n @guest = InviteGuest.find(:all, :conditions => ['invite_id=?', inv[:id]])\n if @guest.count > 0\n for g in @guest\n if g[:first_name]\n @name = g[:first_name]+' '+g[:last_name]\n else\n @name = '';\n end\n \n UserMailer.send_invite_email(inv, g[:email], @name).deliver\n g[:sent] = 1\n g[:send_date_time] = DateTime.now.strftime('%Y-%m-%d %H:%M:%S')\n g.save\n end ## for guest ends\n inv[:draft]=0\n inv[:sent] = 1\n inv[:send_date_time] = DateTime.now.strftime('%Y-%m-%d %H:%M:%S')\n inv.save\n \n end ### if guest ends\n end ### date compare ends \n \n end ### for ends\n end ### if ends \n render :text => (I18n.t 'invite_create.done') and return\n end", "title": "" }, { "docid": "794ade6d306cc63c900e921264fbffcc", "score": "0.5386813", "text": "def expiring_document(user_id, document_id, field_value_id, notify_duration_id)\n @user = User.find(user_id)\n @document = Document.find(document_id)\n\n field_value = DocumentFieldValue.find(field_value_id)\n document_field = field_value.base_standard_document_field\n formatted_date_value = field_value.field_date_value.strftime(\"%m/%d/%Y\")\n\n if notify_duration_id\n notify_duration = NotifyDuration.find(notify_duration_id)\n remaining_duration = [notify_duration.amount.to_i, notify_duration.unit.to_s.singularize.pluralize(notify_duration.amount.to_i)].join(' ')\n end\n\n if document_field.data_type == \"due_date\"\n if field_value.notification_level == NotifyDuration::EXPIRING\n if remaining_duration == \"1 day\"\n @notification_message = \"#{@document.standard_document.name} is due tomorrow\"\n @subject = \"Docyt Alert - #{@document.standard_document.name} is due tomorrow\"\n else\n @notification_message = \"#{@document.standard_document.name} is due in #{remaining_duration} (#{formatted_date_value})\"\n @subject = \"Docyt Alert - #{@document.standard_document.name} is due in #{remaining_duration}\"\n end\n else\n @notification_message = \"#{@document.standard_document.name} is due\"\n @subject = \"Docyt Alert - #{@notification_message}\"\n end\n @notice_type = \"Due\"\n else\n if field_value.notification_level == NotifyDuration::EXPIRING\n @notification_message = \"#{@document.standard_document.name} is about to expire in #{remaining_duration} (#{formatted_date_value})\"\n @subject = \"Docyt Alert - #{@document.standard_document.name} expires in #{remaining_duration}\"\n else\n @notification_message = \"#{@document.standard_document.name} has expired\"\n @subject = \"Docyt Alert - #{@notification_message}\"\n end\n @notice_type = \"Expiring\"\n end\n\n attachments.inline[\"error-icon.png\"] = File.read(\"#{Rails.root}/app/assets/images/error-icon.png\")\n\n mail(from: email_address_for(:noreply), to: @user.email, subject: @subject) do |format|\n format.html\n end\n end", "title": "" }, { "docid": "b88e9b6ef87900238fdb6bddf9f8b483", "score": "0.53831697", "text": "def reminder\n DateEventApplicationsMailer.reminder\n end", "title": "" }, { "docid": "d66fbdacf67c01f4ba85414e6985ca51", "score": "0.53824466", "text": "def remember_to_review\n if self.id and self.redeemed_at \n RunOncePeriodicJob.create!(:name => 'RememberToReview',\n :job => \"Credit.review_reminder(#{self.id})\",\n :next_run_at => (7.days.from_now)) unless self.redeemed_at.nil?\n end\n end", "title": "" }, { "docid": "9c7bf68e0136152ad60806168bda273f", "score": "0.5363614", "text": "def extend()\n # Get the appointment\n appointment = current_user.appointments.last\n student_id = current_user.id\n tutor_id = appointment.tutor.id\n # Get the sidekiq job\n jids = appointment.jids.split('|')\n jid_reminder = jids[0]\n jid_complete = jids[1]\n job_reminder = Sidekiq::ScheduledSet.new.find_job(jid_reminder)\n job_complete = Sidekiq::ScheduledSet.new.find_job(jid_complete)\n complete_new_time = job_complete.at + Settings.call_extend_time\n reminder_new_time = complete_new_time - Settings.call_speak_reminder_time\n\n if job_complete.reschedule(complete_new_time) &&\n job_reminder.reschedule(reminder_new_time)\n # update the appointment cost and call time\n appointment.update_attribute(:amount, appointment.amount + Settings.call_extend_cost)\n appointment.update_attribute(:tutor_earned, appointment.tutor_earned + Settings.call_extend_earned)\n # notify the student and the tutor\n msg = I18n.t('appointment.conference_room.call_extend', \n time: Settings.call_extend_time)\n MessageBroadcastJob.perform_later(msg, 'notification',\n student_id: student_id,\n tutor_id: tutor_id)\n else\n msg = I18n.t('students.errors.appointment.call_extend')\n MessageBroadcastJob.perform_later(msg, 'notification',\n student_id: student_id)\n end\n end", "title": "" }, { "docid": "88b37e68b47f5af3e4c6d01f2ad86850", "score": "0.535781", "text": "def email_reminder(week_id,day)\n # can we use a template?\n puts \"checking #{self.name}\"\n my_result = self.weekly_results.find_by(week_id: week_id) ||\n self.weekly_results.create(week_id: week_id)\n if my_result.send(\"#{day}_drinks\").nil? && !self.unsubscribed\n # generate a token and save to Redis\n puts \"No data for #{self.name} - #{Date.today}. Sending email\"\n my_token = SecureRandom.urlsafe_base64\n packet = {\n user: self.id,\n result: my_result.id,\n parameter: day\n }\n $redis.set(my_token,packet.to_json,{ex: 604800})\n # TODO: fix this bad workaround\n u = self\n # send email\n message = Mail.new do\n from ENV['EMAIL_FROM']\n to \"#{u.name} <#{u.email}>\"\n subject 'BoozeTracker Reminder'\n content_type 'text/html; charset=UTF-8'\n body \"<p>Did you have a drink yesterday?</p><p><a href='#{BASEURL}/token/#{my_token}?result=yes'>Yes</a> | <a href='#{BASEURL}/token/#{my_token}?result=no'>No</a></p><p>--</p><p>Brought to you by <a href='#{BASEURL}'>BoozeTracker</a> | <a href='#{BASEURL}/user/toggle-subscription?token=#{my_token}'>Unsubscribe</a></p>\"\n delivery_method Mail::Postmark, api_token: ENV['POSTMARK_API_TOKEN']\n end\n message.deliver\n\n else\n end\n\n\n end", "title": "" }, { "docid": "07fec4941a2e512563c743b0cdc7bf3c", "score": "0.53560406", "text": "def after_redeem() end", "title": "" }, { "docid": "99bcc24ad79749a16ccc4b1790b05392", "score": "0.53460515", "text": "def remind?\n DateTime.now < dt\n end", "title": "" }, { "docid": "58c059a0c2bdbad101fbb17b6695ec19", "score": "0.5334489", "text": "def trade_updates(date)\n @update_date = date\n mail to: \"[email protected]\", subject: \"Mise à jour des trades sur le serveur !\"\n end", "title": "" }, { "docid": "2d0fe9950a05ee78bd1d91daa9bbb87f", "score": "0.5332596", "text": "def send_reminders\n User.send_reminders\n redirect_to :back, notice: \"Email reminders sent.\"\n end", "title": "" }, { "docid": "371f05ebf6d55d74f5d7f9c0075928e8", "score": "0.5327705", "text": "def lesson_reminder(user)\n @user = user\n @lesson = user.next_lesson\n @school = @lesson.school.name\n @date = @lesson.date.to_s\n mail to: user.email, subject: \"Reminder: Lesson Scheduled Today\"\n end", "title": "" }, { "docid": "f28f25aa3b3f772333fd7c55cfeacfc1", "score": "0.5322943", "text": "def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end", "title": "" }, { "docid": "74b7b254f6b8c3e6f24e1695a1194681", "score": "0.5316476", "text": "def send_lesson_reminder_email\n UserMailer.lesson_reminder(mentor).deliver_now\n end", "title": "" }, { "docid": "3e1469886bd9e0a17bc0991e75b30a9c", "score": "0.5312483", "text": "def schedule_appointment(appointment, which)\n # sendgrid_category \"Sell Request\"\n @appointment = appointment\n if which == 1\n mail to: @appointment.user.email, subject: \"Appointment schedule confirmation\"\n else\n email = \"[email protected]\" if [email protected]\n mail to: email, subject: \"Appointment schedule confirmation\"\n end\n end", "title": "" }, { "docid": "6faae5c790d6f757be4d433da032e7b4", "score": "0.5309638", "text": "def daily_reading\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "title": "" }, { "docid": "4cfa8653b57386187fcd9130f9aba7a8", "score": "0.5309238", "text": "def expire_appointment\n #if the appointment has not been booked on the day of, the appointment expires. \n if self.expired?\n self.status = Status::EXPIRED\n self.save\n end\n end", "title": "" }, { "docid": "f449e362a62f1e118e43852e57f7c94d", "score": "0.53061676", "text": "def reminder\n UsersMailer.reminder\n end", "title": "" }, { "docid": "8758e4e30bf3cb7ec9ce28b5423e698e", "score": "0.5301621", "text": "def loan_due_date_notification(transaction)\n @owner = transaction.owner\n @requester = transaction.requester\n @user_lacquer = transaction.user_lacquer\n @lacquer_name = @user_lacquer.lacquer.name\n @transaction = transaction\n @days_left = (transaction.due_date.to_date - Date.today).to_i\n\n mail(to: @requester.email, subject: \"#{@lacquer_name} is due back to #{@owner.name} on #{@transaction.due_date.strftime(\"%m/%d/%Y\")}.\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end", "title": "" }, { "docid": "e601e102c24d7461934216d11ad790d6", "score": "0.5300384", "text": "def register_pledge_alert\n if payment_in? && payment_in_changed?\n d1 = (payment_in - 1.day).beginning_of_day\n d2 = payment_in.beginning_of_day\n self.delay(run_at: d1).send_pledge_alert(payment_in, false) if d1 >= Time.current\n self.delay(run_at: d2).send_pledge_alert(payment_in, true) if d2 >= Time.current\n end\n end", "title": "" }, { "docid": "2a5104d2eeaf1dd831c2d659f632b6cb", "score": "0.5298739", "text": "def notify_usage( user )\n most_recent = Usage.first :conditions => { :site => user.site }, :order => 'period_from DESC'\n # 24hr can be nil during free download periods\n if most_recent && most_recent.download_24hr && most_recent.download_24hr >= user.warning_threshold\n logger.info(\" notifying: #{most_recent.download_24hr}/#{user.warning_threshold}\")\n Notifier.deliver_usage_message( user, most_recent ) \n end\nend", "title": "" }, { "docid": "3ef332cebfedd356670c1fa072f300fe", "score": "0.528558", "text": "def expire_after_grace!(transaction = nil)\n return unless self.expire_on.nil? # You only set this once subsequent failed transactions shouldn't affect expiration\n self.expire_on = [Date.today, paid_through].max + Freemium.days_grace\n transaction.message = \"now set to expire on #{self.expire_on}\" if transaction\n Freemium.mailer.deliver_expiration_warning(self)\n transaction.save! if transaction\n save!\n end", "title": "" }, { "docid": "744178587518474310c50d157397fd72", "score": "0.52837574", "text": "def send_email_reminder(day)\n recipient = \"#{name} <#{email}>\"\n body = email_body(day)\n message = Mail.new do\n from ENV['EMAIL_FROM']\n to recipient\n subject 'BoozeTracker Reminder'\n content_type 'text/html; charset=UTF-8'\n body body\n delivery_method Mail::Postmark, api_token: ENV['POSTMARK_API_TOKEN']\n end\n message.deliver\n end", "title": "" }, { "docid": "20d4391c85f3dccf6943b2d5aec4a26a", "score": "0.5282421", "text": "def perform\n InvitationsManager.send_invitation_reminders\n InvitationsManager.destroy_old_invitations\n InvitationsManager.update_daily_limit\n InvitationsManager.reset_invitations_count\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0efd77822ea12bcca49b7d1e256fc268", "score": "0.0", "text": "def set_m_question\n @m_question = MQuestion.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.603186", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015241", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.5921496", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913448", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913448", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.5897832", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58885515", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58885515", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58885515", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.58878756", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58769405", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5861371", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5808766", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57400525", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.5731156", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57159877", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5702554", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.5693239", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5668723", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.56508374", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5649453", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56375533", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.56254196", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5609089", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5597798", "text": "def execute_callbacks; end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5597231", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5588031", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.555915", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.555915", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.5507016", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55030775", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.54662013", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465261", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54472864", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54438996", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5440141", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.541613", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5409782", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5409782", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5400219", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394745", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394745", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5390984", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.53887665", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53780794", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5356209", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5348786", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.5346732", "text": "def setup_phase; end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.5345979", "text": "def register_action(action); end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5344045", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5340186", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.5327604", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.5304261", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.52854896", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282047", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52573466", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5257324", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.5248408", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.52433753", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.52398264", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5236372", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5236372", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.5231744", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52285135", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.5223686", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52210605", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.52209604", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5213524", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.521152", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.520754", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52046543", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.52040523", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.52036524", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5202948", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5199691", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5194161", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5194161", "text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.51919067", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.51790345", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.5178361", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51730466", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51730466", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51730466", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.51632947", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5153717", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.51421857", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.5140802", "text": "def code_action_provider; end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51395875", "text": "def setup(params)\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5138662", "text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51344", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.51154596", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.51132", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5110998", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.51075375", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.51075375", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.51075375", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5105207", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.51044744", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.5097499", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.5093918", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.50929475", "text": "def add_callbacks(base); end", "title": "" } ]
5158d7c08e95f083c3c34898340b3829
Sends the given RCON packet to the server
[ { "docid": "2392095140f913b655269d22ab634207", "score": "0.5324763", "text": "def send(data_packet)\n connect if @socket.nil? || @socket.closed?\n\n super\n end", "title": "" } ]
[ { "docid": "4f528f160768f60783184ea2a1f2d0c8", "score": "0.6961842", "text": "def rcon_send(command); end", "title": "" }, { "docid": "65ffd9847f463687e8bbb3d87774ca3e", "score": "0.6033882", "text": "def rcon_send(command)\n send RCONGoldSrcRequest.new(command)\n end", "title": "" }, { "docid": "3fc886217adcfdb3db22a143f02c6dc0", "score": "0.60326934", "text": "def send_command\n socket = TCPSocket.new(@host, @port)\n begin\n socket.puts command\n response_from_socket(socket)\n ensure\n socket.close\n end\n end", "title": "" }, { "docid": "fe1bf0441c3890c2bb042fb0fcfe9442", "score": "0.6030602", "text": "def send_packet(packet)\n socket.send packet, 0\n end", "title": "" }, { "docid": "95ded54d52b58eaf307f201fecfc48df", "score": "0.59779567", "text": "def send(data)\n drain()\n @socket.puts \"#{data}\"\n end", "title": "" }, { "docid": "334d80db57e7aa588f12c20ed00887b0", "score": "0.59547937", "text": "def send(data)\n @socket.print(data)\n end", "title": "" }, { "docid": "2f5b2f20cb6461caa9dbe5cae95f245c", "score": "0.594519", "text": "def send_command(cmd)\n use_tcp_socket {|s| s.write cmd}\n self\n end", "title": "" }, { "docid": "71d16fd2646618b2cd761efce59176d9", "score": "0.5871323", "text": "def send(packet)\n set_sndbuf packet.length\n @socket.send packet, 0\n @socket.flush\n end", "title": "" }, { "docid": "45e7058088a8df8224ee717b11046107", "score": "0.58446485", "text": "def send_packet(data)\n @tx_buffer << [data.bytesize+2, data].pack('na*')\n @nio_monitor.interests = :rw\n end", "title": "" }, { "docid": "18af0e13b9b12b148e16a88ae197416c", "score": "0.5799979", "text": "def send(buf)\n @socket.write(buf)\n end", "title": "" }, { "docid": "fe676a2d443f26852ae1b9ff438028c5", "score": "0.57606524", "text": "def sendCommand(comstr)\n @socket.send(comstr,0,@shost,@sport) ;\n @cvMotor.lockedSignal() ; \n logging(LogLevel_Command,\n\t 'command',comstr, true) ;\n end", "title": "" }, { "docid": "57cbac6bd5b4d0a1afb119632f8a03a1", "score": "0.5750975", "text": "def send(data)\n @socket.send(data, 0)\n end", "title": "" }, { "docid": "3e99953c9513b9ade4418798e9fee9c0", "score": "0.5738378", "text": "def sendpacket(packet)\n @log.debug \"SEND: #{packet.size+1}b -- #{packet}\\\\0\"\n\n # Bounds checking to MAXCHAR-1 (terminating null).\n if packet.size > 254\n raise RuntimeError, \"send: packet > 255 bytes\"\n end\n\n # Add the terminating null & packet length (<= 255) to the packet head.\n packet << \"\\0\"\n packet = packet.size.chr + packet\n\n wrotelen = @socket.send(packet, 0)\n\n if wrotelen != packet.size\n raise RuntimeError, \"send: wrote $wrotelen of $plen: $!\"\n end\n end", "title": "" }, { "docid": "89d5c0163b80f0b25d3bb31fd2b960e8", "score": "0.57288635", "text": "def send_line(command)\n line = command + \"\\r\\n\"\n $stderr.printf(\"SEND: %s\", line) if @debug\n @sock.print(line)\n end", "title": "" }, { "docid": "f606d44f916870003fde4fb3ad440e54", "score": "0.57100385", "text": "def send(data)\n begin\n raise \"not connected\" unless connected?\n logger.info \"<-- \" + data.inspect\n @socket.puts data\n rescue RuntimeError, SystemCallError, IOError => e # socket exceptions or network errors\n logger.warn \"connection error: #{e}\"\n notify :connection_error, e\n end\n end", "title": "" }, { "docid": "0c42bfa8c69da967923dd2fe1a2efc6c", "score": "0.56986904", "text": "def rcon_exec(command)\n raise Error::RCONNoAuth unless @rcon_authenticated\n\n begin\n @socket.rcon_exec(@rcon_password, command).strip\n rescue Error::RCONNoAuth\n @rcon_authenticated = false\n raise\n end\n end", "title": "" }, { "docid": "8b33f8650a66baf25b30027c95efd6c6", "score": "0.5689624", "text": "def write(str)\n @socket.write str + CR\n end", "title": "" }, { "docid": "3c052522020f3d9e829400ab22fa120b", "score": "0.56874704", "text": "def sendln(cmd)\n if cmd.size <= 510 \n @socket.write(\"#{cmd}\\r\\n\")\n STDOUT.flush\n else\n end\n end", "title": "" }, { "docid": "da96a953e819b4162d1859139840b8f2", "score": "0.56781846", "text": "def send(data)\n if self.isSendAble?\n @socket.puts(data)\n end\n end", "title": "" }, { "docid": "76d782a6690674d3cc825e9f6e67f127", "score": "0.5663408", "text": "def sendraw(buf)\n sendpacket(buf)\n end", "title": "" }, { "docid": "521498ef8869987e800184ba6343348c", "score": "0.56549156", "text": "def tcpSend(packet, nextHop)\n\n\tsocket = $nodeToSocket[nextHop]\n\tputs \"trying to send\"\n\tputs socket\n\tsocket.puts(packet)\n\t#socket.send(packet, packet.size)\n\tputs \"sent\"\nend", "title": "" }, { "docid": "69f900ad3751e7c1bdac3b77923ac69e", "score": "0.5621937", "text": "def send(data)\n @client.puts(data)\n @client.readline\n # TODO: sync vs. async: @socket.read or a callback and a loop\n end", "title": "" }, { "docid": "36752d0002e5381f1f9accc241ba4df0", "score": "0.5617388", "text": "def write(data)\n begin\n @sock.sync = false\n data = StringIO.new data if data.is_a? String\n while d = data.read(MAX_PACKET_LENGTH)\n Timeout.timeout @write_timeout do\n @sock.write [d.length%256, d.length/256, @seq].pack(\"CvC\")\n @sock.write d\n end\n @seq = (@seq + 1) % 256\n end\n @sock.sync = true\n Timeout.timeout @write_timeout do\n @sock.flush\n end\n rescue Timeout::Error\n raise ClientError, \"write timeout\"\n end\n end", "title": "" }, { "docid": "f9a4f776236a24f4c86fa5cef86bbd5b", "score": "0.5612316", "text": "def send_raw_cmd(raw_ilv, wait_for_res=true, res_timeout=RES_RECV_TIMEOUT)\n #Make debug log\n $test_logger.log \"Sending ILV: #{ILVMessage.raw_to_hex(raw_ilv)}\"\n\n #Reset connection and ignore check\n #reset_connection true\n connect_to_device true\n\n #Raise exception if connection not opened\n raise \"Connection not open!\" if !is_connected\n\n #Write packet to device socket/serial\n @s.write(raw_ilv)\n\n resp_single = nil\n if wait_for_res\n resp = receive_response(-1, res_timeout)\n resp_single = resp.first\n close\n end\n resp_single\n end", "title": "" }, { "docid": "9d846743867279df9e917e4454a5a3d3", "score": "0.5612002", "text": "def send(line)\n @sock.print(line, \"\\r\\n\")\n end", "title": "" }, { "docid": "23657e8deaf81ff9d43897996fdeb593", "score": "0.5590696", "text": "def send_request(command)\n ensure_connected\n\n # Escape backslashes in command.\n @socket.puts command.gsub('\\\\', '\\\\\\\\\\\\')\n\n get_response\n end", "title": "" }, { "docid": "1ea3687fd533189496644a63c346ae69", "score": "0.55784315", "text": "def send_packet(data_packet); end", "title": "" }, { "docid": "1ea3687fd533189496644a63c346ae69", "score": "0.55784315", "text": "def send_packet(data_packet); end", "title": "" }, { "docid": "12f9d2791145f4f67525ed59358b7d21", "score": "0.55656147", "text": "def send_data(str)\n if !connected?\n if [email protected]? && @reconnect == false\n raise Munin::ConnectionError, \"Not connected.\"\n else\n open\n end\n end\n\n begin\n with_timeout { @socket.puts(\"#{str.strip}\\n\") }\n rescue Timeout::Error\n raise Munin::ConnectionError, \"Timed out on #{@host} trying to send.\"\n end\n end", "title": "" }, { "docid": "501a7b342e3d47834d41021ee228e434", "score": "0.5550808", "text": "def write(data)\n @tcp.write(data)\n end", "title": "" }, { "docid": "32c9fcc892755690bc340c19410032f6", "score": "0.5523379", "text": "def send_request(data)\n raise \"Client is not connected\" unless connected?\n\n @socket.request_response(payload_of(data.to_proto, nil))\n end", "title": "" }, { "docid": "e2f90682be8022569245f6c8706e5412", "score": "0.55169964", "text": "def send_packet(data)\n # Raise exception if we aren't connected\n raise MQTT::NotConnectedException unless connected?\n\n # Only allow one thread to write to socket at a time\n @write_semaphore.synchronize do\n @socket.write(data.to_s)\n end\n end", "title": "" }, { "docid": "e3374040f808e8bb7bf73be7e7293d09", "score": "0.5512333", "text": "def send_packet(data_packet)\n if log.debug?\n packet_class = data_packet.class.name[/[^:]*\\z/]\n log.debug \"Sending data packet of type \\\"#{packet_class}\\\".\"\n end\n\n @socket.send data_packet.to_s, 0\n end", "title": "" }, { "docid": "1205fe47135776840f8f7ceffa4a1a07", "score": "0.5507961", "text": "def write(data)\n @socket.write(data)\n end", "title": "" }, { "docid": "cc98bdb09cf03e54cc96c46bb181e2ae", "score": "0.5496679", "text": "def send(data={})\n binary_data = build_binary_data data\n @conn.send_datagram binary_data, Xplane.config.xplane_host, Xplane.config.xplane_port\n end", "title": "" }, { "docid": "9104e58ed523cb7ed5c0158ce21428a6", "score": "0.5492497", "text": "def send(msg)\n @socket.send(msg,0,MCADDR,PORT)\n end", "title": "" }, { "docid": "f2501b914bc54d9388c8da6703525761", "score": "0.54846966", "text": "def send_data(data)\n @socket.send_data(data)\n end", "title": "" }, { "docid": "b56b847ca01d316bf9c81f8c900f5a0b", "score": "0.5472283", "text": "def send(pkt)\r\n @port.write(pkt)\r\n\r\n s = @port.read(BinPktHdr::SIZE)\r\n hdr = BinPktHdr.new(s)\r\n n = hdr.msg_size\r\n\r\n s = @port.read(BinCmdRsp::SIZE)\r\n rsp = BinCmdRsp.new(s)\r\n\r\n n -= BinCmdRsp::SIZE\r\n\r\n if (n > 0)\r\n s = @port.read(n)\r\n return [ rsp.reply, s ]\r\n end\r\n\r\n return [ rsp.reply ]\r\n end", "title": "" }, { "docid": "a177c4ac33ccd8cb0c9f5344ee56bc7f", "score": "0.5469597", "text": "def sendC(char)\n if (!@open)\n connect()\n end\n @sp.putc char.chr\n end", "title": "" }, { "docid": "c81600488e3351e9b559ce2d676a8c2f", "score": "0.5464397", "text": "def send_packet(packet)\n write packet.serialize\n end", "title": "" }, { "docid": "f47afad2ca5f5e4cc12f6bee7a424378", "score": "0.54608387", "text": "def send msg\n @socket.send msg\n end", "title": "" }, { "docid": "46563d6f02e5496d68cee628ce0d632c", "score": "0.5455845", "text": "def rcon\n [0x8d,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x1b,0x36,0x6c,0xd8,0xab,0x4d,0x9a][self]\n end", "title": "" }, { "docid": "7255f2d22a2ffd73da6fa1053ed6eda4", "score": "0.5455825", "text": "def send(timeout = 5)\n sock = UDPSocket.open\n sock.connect(@host, @port)\n data = self.pack\n @identifier = (@identifier + 1) & 0xff\n # def send(mesg, flags, *rest)\n sock.send(data, 0)\n # Return the socket so it can be read\n sock\n end", "title": "" }, { "docid": "ad9af992dae67742fc032d5e9cc2f3c4", "score": "0.54446924", "text": "def send_data(data)\n @socket.send(data, 0)\n end", "title": "" }, { "docid": "75d8d6d6318c54625964cbc569260bf7", "score": "0.5440433", "text": "def send (msg=\"\")\n if @connected\n @sock.write \"\\1#{msg}\\r\\n\" # leading \\1 for terse reply\n end\n end", "title": "" }, { "docid": "89a4163670a56ef4a1a7cb41270891ce", "score": "0.5439292", "text": "def send_message(socket)\n socket.write(pack)\n end", "title": "" }, { "docid": "94c908d4ead30691dcfaea912f0f6a27", "score": "0.54169405", "text": "def raw_send(cmd, nsock = self.sock)\n\t\tnsock.put(cmd)\n\tend", "title": "" }, { "docid": "30c8a236a4a1af2af12933878ae04a25", "score": "0.54110396", "text": "def write(data)\n @socket << data\n end", "title": "" }, { "docid": "087e2ac108bd743d0a60faadec3c01b3", "score": "0.54090935", "text": "def send_data(data)\n logger.trace \"[SEND] #{data.to_s}\"\n @socket.write data.to_s\n end", "title": "" }, { "docid": "34ef1195c5d57fae18a6c3b3fdb6f126", "score": "0.5399631", "text": "def send_raw(raw_message, sync=true)\n encoded_message = [raw_message].pack(\"H*\")\n @client_socket.write encoded_message\n\n if (encoded_message[1] == 1)\n read_from_socket()\n else\n nil\n end\n end", "title": "" }, { "docid": "6f072ebd65a324f2b3d91f60c2451b76", "score": "0.53634006", "text": "def send(cmd)\n return false unless connected?\n while read_nonblock do end # flush previous response data\n @client.send(cmd, 0)\n @client.recv(256).strip\n end", "title": "" }, { "docid": "fcc277879bf31749117d015f4b3bc724", "score": "0.536095", "text": "def write(data)\n @sock.write(data)\n end", "title": "" }, { "docid": "05606ccf4ef2a9233f44a5b9c3c18359", "score": "0.5356444", "text": "def send(pkt)\n data = pkt.pack\n @transport.send data\n end", "title": "" }, { "docid": "be471c65c9a2bcb767245cacd3f2a97f", "score": "0.5348803", "text": "def send_request(command)\n @logger.request command\n @socket.puts command \n read_response\n end", "title": "" }, { "docid": "cfff29e0bbf95f94a169725ccd1a30f0", "score": "0.5338604", "text": "def send_packet(type, *args)\n buffer = Buffer.from(*args)\n data = [buffer.length + 1, type.to_i, buffer.to_s].pack(\"NCA*\")\n @socket.send data, 0\n end", "title": "" }, { "docid": "da7609cb114f7a1c4aea4194f594554a", "score": "0.53259623", "text": "def write(data)\n @socket.write(data + \"\\r\\n\")\n rescue IOError\n raise\n end", "title": "" }, { "docid": "1b59e7ef5537151f5f776c90abd62383", "score": "0.5324095", "text": "def command(cmd, server, port)\n\t\t@@socket ||= UDPSocket.open\n\t\t@@socket.send(\"\\xFF\\xFF\\xFF\\xFF#{cmd}\\x00\", 0, server, [65535, [0, port].max].min)\n\t\t@@socket.flush\n\tend", "title": "" }, { "docid": "acd38651ff1eae12470b673adb271a72", "score": "0.5324009", "text": "def send_command(command_string)\n\t\tTCPSocket.open(@ip, @port) {|s|\n\t\t\ts.send(command_string, 0)\n\t\t}\n\tend", "title": "" }, { "docid": "a9542c69a607a4bec66e28ef038090c7", "score": "0.5323755", "text": "def write(data)\n raise PeerError, 'The connection not opened' unless opened?\n\n @socket.write(data)\n @last_send = Time.now\n end", "title": "" }, { "docid": "10aa7f7d626a1db3daa6a0d25909fd40", "score": "0.53154135", "text": "def write(rawmsg)\r\n @last_message = rawmsg\r\n @sock.write(rawmsg + EOL)\r\n # ensure that the connection is still with a server\r\n # and wait for an answer at the same time\r\n if @sock.eof?\r\n disconnect\r\n raise Errno::ECONNRESET\r\n end\r\n end", "title": "" }, { "docid": "91ebc97d140e51cffed70a346a855ca5", "score": "0.5302454", "text": "def send_packet\n vprint_status('Protocol finished setup. Going to send packet.')\n msg = \"17 #{@packet_payload.length}\\n#{@packet_payload}\"\n plen = BF_BLOCKSIZE - (msg.length % BF_BLOCKSIZE)\n # padding\n msg += 'B' * plen\n @encryption_queue.push(msg)\n @keep_reading_socket = false\n handle_write\n end", "title": "" }, { "docid": "585ef677c8dc8ed88a40e1701ddd313a", "score": "0.530089", "text": "def send(data)\n\t\tencode_message(data).each do |m|\n\t\t\[email protected](m)\n\t\tend\n\tend", "title": "" }, { "docid": "fa79e5f3a57326ee5fd7373de6db26ef", "score": "0.529724", "text": "def rcon_exec(command)\n raise Error::RCONNoAuth unless @rcon_authenticated\n\n @rcon_socket.send_packet Packets::RCON::RCONExecRequest.new(@rcon_request_id, command)\n\n is_multi = false\n response = []\n begin\n response_packet = @rcon_socket.reply\n\n if response_packet.nil? || response_packet.is_a?(Packets::RCON::RCONAuthResponse)\n @rcon_authenticated = false\n raise Error::RCONNoAuth\n end\n\n if !is_multi && response_packet.response.size > 0\n is_multi = true\n @rcon_socket.send_packet Packets::RCON::RCONTerminator.new(@rcon_request_id)\n end\n\n response << response_packet.response\n end while is_multi && !(response[-2] == '' && response[-1] == '')\n\n response.join('').strip\n end", "title": "" }, { "docid": "1dba28432b5916ab3a7243daf0a3f6ad", "score": "0.5294187", "text": "def write(pkt)\n socket.write(pkt.to_bin)\n end", "title": "" }, { "docid": "9ba4902225df0f2fe059a466733fd85a", "score": "0.52937466", "text": "def send_packet(cmd_packet, wait_ack=true, ack_timeout=ACK_RECV_TIMEOUT)\n \n $test_logger.log(\"Send packet, WaitAck=#{wait_ack}, Timeout=#{ack_timeout}\")\n \n send_raw(cmd_packet.cmd_pkt, wait_ack, ack_timeout)\n end", "title": "" }, { "docid": "f910895c98ed0ff70cf0a7d6c48f4ea3", "score": "0.52902687", "text": "def do_send(command, data, options = {})\n\t\tcommand = \"\" << command << ' 00 ' << data.to_s(16).rjust(2, '0') << \"\\r\"\n\t\tsend(command, options)\n\tend", "title": "" }, { "docid": "0c1f2c66a79526ccc8191858c87f9287", "score": "0.52878356", "text": "def send_command(cmd)\n\n\n#Fill in TCP Packet\npkt = PacketFu::TCPPacket.new\n\ncmd.each_byte do | c | \n\n send_char(pkt, c)\n\nend #cmd.each_byte\n send_fin()\n \n\nend", "title": "" }, { "docid": "2814bb162a474b159de2f5723ef79479", "score": "0.5283973", "text": "def send(msg)\n\[email protected] \"#{msg}\\n\", 0\nend", "title": "" }, { "docid": "2814bb162a474b159de2f5723ef79479", "score": "0.5283973", "text": "def send(msg)\n\[email protected] \"#{msg}\\n\", 0\nend", "title": "" }, { "docid": "9151e40675fd4e4f6e5186f28cff6eb4", "score": "0.5280784", "text": "def send(string)\n @client_socket.puts string\n end", "title": "" }, { "docid": "65d3a654192c3819757403070a4b114b", "score": "0.5272429", "text": "def doTransmit(socket, command, headers={}, body=\"\")\n\n puts \"\\nTransmit #{command} ...\"\n\n begin\n # Write STOMP command\n socket.write \"#{command}\\n\"\n\n # Write headers\n headers.each do | k,v |\n socket.write \"#{k}:#{v}\\n\"\n end\n\n # Write blank line; indicates the end of the headers\n socket.write \"\\n\"\n\n # Write body\n socket.write body\n\n socket.write \"\\0\"\n socket.flush\n rescue\n raise \"Error: #{$!}\"\n end\nend", "title": "" }, { "docid": "bc87b0d814da44c8cfe83758bcbf5ef6", "score": "0.52710927", "text": "def send ( msg )\n @log.info \"--> #{msg}\\n\"\n @socket.send \"#{msg}\\n\", 0\n end", "title": "" }, { "docid": "2428264a5bfbaff4021d45ce1ddd2276", "score": "0.5263146", "text": "def send(frame)\n @logger.debug \"Send: #{frame.to_s}\" if @logger\n @socket.send frame.to_s, 0\n end", "title": "" }, { "docid": "f12e409d9a790290b04d1bce5235fa90", "score": "0.52612525", "text": "def send_command(command, value, data)\n Packet.new(command, value, data).write(@io, @addr)\n end", "title": "" }, { "docid": "3e76bab193cb9a496921677a18899e41", "score": "0.5258887", "text": "def send_ng_byte(socket)\n socket.write([0].pack('c'))\n end", "title": "" }, { "docid": "0eee81a362b97c445b2150e3549575a6", "score": "0.52560526", "text": "def send!\n self.responce = self.connection.__send__(self.command, self.params)\n end", "title": "" }, { "docid": "799265f23eaced800cb58095eb8de0b3", "score": "0.5254342", "text": "def send_recv_imd(cmd_packet, exp_err=nil, res_timeout=RES_RECV_TIMEOUT)\n $test_logger.log(\"Sending packet and waiting for Response of #{@device_id}\")\n $test_logger.log(\"Send packet, Timeout=#{res_timeout}\") \n raise \"Connection not open!\" if !is_connected\n\n #Write packet to device socket/serial\n @s.write(cmd_packet.cmd_pkt)\n $test_logger.log(\"Waiting for RES\")\n res_pkt = receive_packet(res_timeout)\n if $test_ref\n $test_ref.assert_not_nil(res_pkt, \"CmdId='#{cmd_packet.hex_cmd_id}': RES packet not received from device(#{@device_id})\")\n if (exp_err != nil) \n $test_ref.assert_true(res_pkt.err_bit, \"CmdId='#{cmd_packet.hex_cmd_id}': Error bit not set in RES, expected error #{exp_err} '#{BioPacket.get_error_desc(exp_err)}'!\")\n $test_ref.assert_equal BioPacket.format_err_desc(exp_err), res_pkt.error_desc, \"Error code mismatch with actual error code in RES for CmdId='#{res_pkt.hex_cmd_id}'!\"\n else\n $test_ref.assert_false(res_pkt.err_bit, \"CmdId='#{res_pkt.hex_cmd_id}': Error in RES packet #{res_pkt.error_desc}\")\n end \n else\n raise \"RES packet not received from device\" if !res_pkt\n raise \"RES packet error #{res_pkt.error_desc}\" if res_pkt.err_bit\n end \n return res_pkt\n end", "title": "" }, { "docid": "075368c66b8b11166854dd0293d0d869", "score": "0.5252434", "text": "def send_command\n # Send the packet 3 times (loop will break early if command is successful and response is received)\n 3.times {\n @port_write.write @packet\n @returned_packet = @port_read.read(18)\n #DEBUG: print the received packet\n puts @returned_packet.unpack('C*')\n @parsed_response = parse_response(@returned_packet)\n if @returned_packet != nil && @parsed_response\n puts @parsed_response\n break\n elsif @returned_packet != nil && @parsed_response == false\n \"A packet was received, but it was not a valid response\"\n else\n puts \"No response received\"\n end\n # Wait 125ms before sending the packet again\n sleep(1.0/8.0)\n }\nend", "title": "" }, { "docid": "68f88d6b592dc580ec7e1c00f099d521", "score": "0.5251894", "text": "def raw_send_recv(cmd, nsock = self.sock)\n nsock.put(cmd)\n nsock.get_once\n end", "title": "" }, { "docid": "679dacb7dc24ac042211c3c38649f9fd", "score": "0.52503616", "text": "def write s\n raise RuntimeError, \"No socket\" unless @socket\n @socket.puts s += \"\\r\\n\"\n puts \"WROTE: #{s.inspect}\" if config[:debug]\n end", "title": "" }, { "docid": "4dc5da61e460f2728aebce1cca5e0aa2", "score": "0.5244867", "text": "def send_command(command)\n \n # Encrypt command with XOR so cannot be seen.\n encrypted_command = xor(command, @date)\n \n # Send encrypted command byte by byte in ttl field to server\n \tcommand.each_char do |c|\n \t\ttcp_pkt = TCPPacket.new(:config => @myInfo)\n\t\t \ttcp_pkt.tcp_flags.syn=1\n\t\t \ttcp_pkt.ip_ttl = c\n\t\t \ttcp_pkt.tcp_dst= @destPort\n\t\t \ttcp_pkt.tcp_src= @sourcePort\n\t\t \ttcp_pkt.eth_daddr = @serverMac\n\t\t \ttcp_pkt.ip_daddr= @serverIP\n\t\t \ttcp_pkt.recalc\n\t\t \ttcp_pkt.to_w(@interface)\n\t\t \tputs tcp_pkt.ip_ttl\n\t\t \tsleep 0.1\n\t\tend\n\t\tputs \"Command Sent\"\n # Send final packet to tell server no more data is coming\n\t\ttcp_pkt = TCPPacket.new(:config => @myInfo)\n\t\ttcp_pkt.tcp_flags.syn=1\n\t\ttcp_pkt.ip_ttl = 0\n\t\ttcp_pkt.tcp_dst= @destPort.to_i\n\t\ttcp_pkt.tcp_src= @sourcePort.to_i\n\t\ttcp_pkt.eth_daddr = @serverMac\n\t\ttcp_pkt.ip_daddr= @serverIP\n\t\ttcp_pkt.recalc\n\t\ttcp_pkt.to_w(@interface)\n\t\tputs tcp_pkt.ip_ttl\n xor(command, @date)\n end", "title": "" }, { "docid": "570bca76cec2fc7984e435dac2a257be", "score": "0.5238462", "text": "def send_ok_byte(socket)\n socket.write([1].pack('c'))\n end", "title": "" }, { "docid": "be72b6a9bf38df9bb555658f866272b1", "score": "0.52316004", "text": "def send_data!(data)\n raise \"Lost remote connection\" unless connected?\n message = JSON.generate(__json_marshall(data)) + self.__class.terminator\n @socket.write(message)\n puts \"> #{message}\" if self.class.log?\n end", "title": "" }, { "docid": "d851516eb8a2b180d7c57353d871b23b", "score": "0.52314657", "text": "def send_packet(socket,packet,key=nil)\n # set correct type\n if (packet.body.kind_of?(Authentication))\n packet.header.type_authentication!\n elsif (packet.body.kind_of?(Authorization))\n packet.header.type_authorization!\n else\n packet.header.type_accounting!\n end\n\n # set body & header length fields\n packet.body.set_len!\n packet.header.length = packet.body.packed.length\n\n if (@dump_file)\n @dump_file.print(\"# Sent\\n\" + packet.to_yaml + \"\\n\")\n @dump_file.flush\n end\n pkt = TacacsPlus.encode_packet(packet,key)\n socket.write(pkt)\n return(true)\n end", "title": "" }, { "docid": "259f203a7b9647ff11a20c954c29190b", "score": "0.5230172", "text": "def write frame\n @socket.write frame\n end", "title": "" }, { "docid": "d9a0a523f8c2b4057ca0aeefae98417a", "score": "0.52299374", "text": "def send command\n @write_fh.write(\"#{command}\\n\")\n end", "title": "" }, { "docid": "d9a0a523f8c2b4057ca0aeefae98417a", "score": "0.52299374", "text": "def send command\n @write_fh.write(\"#{command}\\n\")\n end", "title": "" }, { "docid": "16bca7280a6429ca7cf94c7d8f310be6", "score": "0.52256364", "text": "def send_data(data)\n @connection.send_data(data)\n end", "title": "" }, { "docid": "b571b1e5202ab4a7ddea33abd1a2773d", "score": "0.52223325", "text": "def transmit(command)\n @logger.debug(\"TX: #{unpack(command.to_binary_s).inspect}\")\n @connection.write_data(command.to_binary_s)\n end", "title": "" }, { "docid": "a4dfb90115cc3530e41d2b3d438deb9a", "score": "0.5208096", "text": "def sendln cmd, log_or_get = :none\n logger.trace \"IRC command : #{cmd}\"\n r = socket.puts cmd\n case log_or_get\n when :log\n log_response\n else\n r\n end\n end", "title": "" }, { "docid": "6c31017c8a766355174d4cfc502e2804", "score": "0.52009755", "text": "def send(line)\n Puppet.debug(\"ssh: send #{line}\") if @verbose\n @channel.send_data(line + \"\\r\")\n end", "title": "" }, { "docid": "c8fa70ed346333562d4a0c499ff8579a", "score": "0.5200818", "text": "def send_packet(packet, completion_routine = nil, completion_param = nil)\n\t\tif (completion_routine)\n\t\t\tadd_response_waiter(packet, completion_routine, completion_param)\n\t\tend\n\n\t\tbytes = 0\n\t\traw = packet.to_r\n\n\t\tif (raw)\n\t\t\tbytes = self.sock.write(raw)\n\t\tend\n\n\t\treturn bytes\n\tend", "title": "" }, { "docid": "bad6bccc42b8984a347c619cae3423ac", "score": "0.5194306", "text": "def send_raw(raw_data, wait_ack=true, ack_timeout=ACK_RECV_TIMEOUT)\n \n $test_logger.log(\"Send raw, WaitAck=#{wait_ack}, Timeout=#{ack_timeout}\")\n \n if is_serial\n #Reset connection\n connect_to_device\n end\n \n raise \"Connection not open!\" if !is_connected\n \n if raw_data.size > BUFF_SIZE && $comm_type == CommType::SERIAL\n $test_logger.log(\"Data size '#{raw_data.size}' greater than '#{BUFF_SIZE}', writing data on serial port using buffer.\")\n buf_ctr = 0\n begin\n buffer = raw_data[buf_ctr, BUFF_SIZE]\n if buffer\n @s.write(buffer)\n sleep 0.001\n end \n buf_ctr += BUFF_SIZE\n \n end while buffer != nil\n $test_logger.log(\"Writing data on serial port using buffer completed!\")\n else\n #Write packet to device socket/serial connection\n @s.write(raw_data)\n end\n \n \n ack_pkt = nil\n if wait_ack\n ack_pkt = receive_packet(ack_timeout)\n end\n\n ack_pkt\n end", "title": "" }, { "docid": "b9d6686adb78e999e4579e3eabad7340", "score": "0.5193345", "text": "def do_send(command, data, options = {})\n\t\tcommand = \"\\x0F001\" << command << data << \"0\\r\"\n\t\tsend(command, options)\n\tend", "title": "" }, { "docid": "c96a2bc65e289249cd021d869396618c", "score": "0.5192201", "text": "def raw(msg)\r\n @server.write(msg)\r\n end", "title": "" }, { "docid": "73d37b2eeb9c614c9a5d44d01678873d", "score": "0.5178505", "text": "def write(data)\n socket.write(data.pack)\n end", "title": "" }, { "docid": "d1c0aa5c8543c1c80119dae7897fcafe", "score": "0.5178372", "text": "def send(type, payload = nil)\n check_connected\n @socket.write(pack(type, payload))\n end", "title": "" }, { "docid": "1e64ae780c4a5f5a9e2cf76eae28246c", "score": "0.5176068", "text": "def transmit(command, **options)\n client.connection.transmit(command, **options)\n end", "title": "" }, { "docid": "46a8c59812d9fffa9ffd950d25951070", "score": "0.517307", "text": "def write_command(command)\n command_socket.write(\"#{command}\\n\")\n read_command_response(command_socket)\n end", "title": "" }, { "docid": "47714412164cdf17ffc8a0a25c7314aa", "score": "0.5171233", "text": "def send( sender_id, conn_id, data )\n\t\tself.check_closed\n\t\theader = \"%s %d:%s,\" % [ sender_id, conn_id.to_s.length, conn_id ]\n\t\tbuf = header + ' ' + data\n\t\tself.log.debug \"Sending response (PUB)\"\n\t\tself.response_sock << buf\n\t\tself.log.debug \" done with send (%d bytes)\" % [ buf.bytesize ]\n\tend", "title": "" } ]
ca0d8a39407b642168489bfd2f252f11
Palauttaa vasemmal lapsen indeksin
[ { "docid": "818b83bff5b347ea45d1f5737f783bab", "score": "0.0", "text": "def child_index_left index\n [@d * index + 1, @heap.length-1].min\n end", "title": "" } ]
[ { "docid": "4b155bb04ece1e48ace44223cd5ac811", "score": "0.66039556", "text": "def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend", "title": "" }, { "docid": "87e18362896ce8f1ce9e5d48e0510c05", "score": "0.6491509", "text": "def get_almidon\n @_100=((@almidon*100)/@peso)\n #@ir_100=(@_100/90)*100\n @porcion=((@almidon*@gramos_porciones)/@peso)\n #@ir_porcion=(@porcion/90)*100\n [ @almidon , @_100 , 0 , @porcion , 0 ]\n end", "title": "" }, { "docid": "36b1ebaf4e4f0a6466714efbec1d25f7", "score": "0.6263867", "text": "def huellaNut \n\t\t(@indEnergia.call + @indGei.call)/2.0\n\tend", "title": "" }, { "docid": "1b62ad1bc6e4e301be96a23bfc92e6b2", "score": "0.62353563", "text": "def vin; end", "title": "" }, { "docid": "e31314136df8ef4c6876d9bdad1a5b39", "score": "0.61169785", "text": "def lip\n\t\tsuma = 0\n\t\tx = 0\n\t\tcantidad = 0\n\n\t\[email protected] do |i|\n\t\t\tcantidad = @gramos[x].valor / (i.proteinas + i.lipidos + i.carbohidratos)\n\t\t\tsuma += i.lipidos * cantidad\n\t\t\tx += 1\n\t\tend\t\n\n\t\treturn ((suma * 100) / gramos_total).round(2)\n\tend", "title": "" }, { "docid": "ced2809f3204f78c1d42021f8eb22417", "score": "0.6068356", "text": "def iralmidonp\n vag=(valoralmidonp * 100) / 90\n vag.round(2)\n end", "title": "" }, { "docid": "7aec7f0db497acd15cc0be6b0b696d44", "score": "0.6065057", "text": "def vida\n @vida_actual\n end", "title": "" }, { "docid": "964219ece76cfb5bbd8d5210da66678b", "score": "0.6052296", "text": "def huella_ambiental\r\n energia = 0.0\r\n carbono = 0.0\r\n huella = 0.0\r\n if vct < 670 then\r\n energia = 1.0\r\n elsif vct <= 830 then\r\n energia = 2.0\r\n else\r\n energia = 3.0\r\n end\r\n if gei < 800 then\r\n carbono = 1.0\r\n elsif terrenos <= 1200 then\r\n carbono = 2.0\r\n else\r\n carbono = 3.0\r\n end\r\n huella = (energia + carbono)/2\r\n return huella\r\n \r\n end", "title": "" }, { "docid": "7d24ea6c4662f592164474b0e9b2afc8", "score": "0.603373", "text": "def huella\n huella = @alimentos.inject([0,0,0]) do |acc, i|\n if i.kcal_total < 670\n acc[0] += (1.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n elsif i.kcal_total > 830\n acc[0] += (3.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n else acc[0] += (2.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n end\n if (i.gases * 1000.0) < 800\n acc[0] += (1.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n elsif (i.gases * 1000.0) > 1200\n acc[0] += (3.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n else\n acc[0] += (2.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n\t\t\tend\n\n\t\t\tacc[2] += (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos))\n acc[1] += 1\n acc\n\t\tend\n\n\t\treturn (huella[0] / (2.0 * huella[2])).round(2)\n\tend", "title": "" }, { "docid": "3b4df29992323899033bb22a35a64989", "score": "0.6033388", "text": "def malts; end", "title": "" }, { "docid": "19fa6d20f194865068155610bd966db6", "score": "0.6032127", "text": "def iralmidon\n vag=(almidon * 100) / 90\n vag.round(2)\n end", "title": "" }, { "docid": "f369591ec1c9626ddd9dbad9a0aaf562", "score": "0.6028042", "text": "def kcallipidos\n\t\t\t@lipidos * 9\n\t\tend", "title": "" }, { "docid": "3c73b67832c54b0bd5725f993ec08f00", "score": "0.5965755", "text": "def get_energia_lipidos\n\t\t\t\t@lipidos * 9\n\t\t\tend", "title": "" }, { "docid": "b30c9cc89a52aba842873d012d686d7a", "score": "0.59639573", "text": "def vel\n @velocidad\n end", "title": "" }, { "docid": "1e4b6ac4af70f0d3506e740ae32d5617", "score": "0.5950042", "text": "def lip\n grtotal = 0\n sum = 0\n\t\t#itera en las dos listas a la vez para poder calcular las \n #lipidos dependiendo de la cantidad y tambien suma\n #todas las cantidades para poder calcular el porcentaje\n #despues\n @lista.zip(@listagr).each do |normal, gr|\n grtotal += gr\n cant = gr/1000.0\n sum += normal.lip*cant\n end\n (sum*100)/grtotal\n end", "title": "" }, { "docid": "60614b9d2dd219ebd9eb71b9f8ef578a", "score": "0.59095055", "text": "def vegetaliana\n\t\thuevo = Alimento.new(\"Huevo\", 13.0, 1.1, 11.0, 4.2, 5.7)\n\t\tqueso = Alimento.new(\"Queso\",25.0,1.3,33.0,11.0,41.0)\n\t\tleche = Alimento.new(\"Leche de vaca\", 3.3, 4.8, 3.2, 3.2, 8.9)\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tcamarones = Alimento.new(\"Camarones\",17.6,1.5,0.6,18.0,2.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\n\t\t[huevo,queso,leche,cerdo,cordero,vaca,camarones,pollo].each do |i|\n\t\t\tif (@alimentos.find { |x| x == i }) != nil\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn true\n\tend", "title": "" }, { "docid": "620f4bd67e3f8d2ce8e76d866b84f805", "score": "0.5860842", "text": "def IVA (precio_iva)\n precio_iva.map {|plato, precio| precio * 1.19}\n end", "title": "" }, { "docid": "9c3f33386ca5b7a0ae6f6e9df146f98a", "score": "0.58489573", "text": "def topsman_periphacitis_urosteon()\n end", "title": "" }, { "docid": "63e6ec7673aa88c4d0f8f765184ff6c9", "score": "0.58455414", "text": "def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend", "title": "" }, { "docid": "937a2215adb38ad6c08a6bb280a1ad6b", "score": "0.5839349", "text": "def vrat_soucet_vah(jedinec)\n soucet = 0\n citac = 0\n jedinec.each do |prvek| \n if(prvek)then\n soucet += @pole_vah[citac].to_i\n end\n citac +=1\n end\n return soucet\n end", "title": "" }, { "docid": "7a542de83d8b80d4d6ebdf8a5d4ba1d6", "score": "0.58324224", "text": "def irpolialcoholesp\n vag=(valorpolialcoholesp * 100) / 90\n vag.round(2)\n end", "title": "" }, { "docid": "4263e6f212ffe68f94f7a6f4613755d6", "score": "0.5829113", "text": "def vocal_en_nombre_piloto(pilotos) \n pos = 0\n mayor = 0\n\n for i in 0..pilotos.size-1\n nombre = pilotos[i].downcase\n\n contador = 0\n for j in 0..nombre.size-1\n letra = nombre[j]\n if letra == 'a' || letra == 'e' || letra == 'i' || letra =='o' || letra =='u'\n contador = contador + 1\n end\n end\n\n if contador > mayor\n mayor = contador\n pos = i\n end\n end\n\n return pilotos[pos]\n\nend", "title": "" }, { "docid": "a38cdb78c9a9c2b600d7626e122d231f", "score": "0.581609", "text": "def por_lip\n\t\t\t(@lipidos/suma_gramos)*100\n\t\tend", "title": "" }, { "docid": "43cca9dd528533cf2111f4e2fdc9e0bb", "score": "0.58066076", "text": "def lesen\r\n @posteingang.each{|x| puts x + \"\\n\"}\r\n end", "title": "" }, { "docid": "28674208bded637a71068070399d5e32", "score": "0.5801704", "text": "def valoralmidonp\n\t\tvag=(almidon * 70) / 100\n vag.round(2)\n\tend", "title": "" }, { "docid": "ad244bd0c45d5d9274f7612fa6fee986", "score": "0.5792977", "text": "def suivre; end", "title": "" }, { "docid": "7bd36219dcf7d2e0a38e3d56f507ff30", "score": "0.57775074", "text": "def lsi; end", "title": "" }, { "docid": "13289d4d24c54cff8b70fcaefc85384e", "score": "0.5774331", "text": "def verdi; end", "title": "" }, { "docid": "7e01b387acb19b14a6b52845478a4245", "score": "0.5772074", "text": "def areatrapezoide\n\t\tdt = 5\n\t\tsi = []\n\t\tgi.each do |i|\n\t\t\ts = (((gi[i]-gi[0]) + ((gi[i - 1]) - gi[0])) /2 ) * dt\n\t\t\tsi.push(s)\n\t\tend \n\t\treturn si\n\tend", "title": "" }, { "docid": "b1773bd34f7fbe476fbc652201e2b659", "score": "0.5768545", "text": "def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end", "title": "" }, { "docid": "5496ff77d9938724a147dedac056a68d", "score": "0.57680637", "text": "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "title": "" }, { "docid": "52e4c2f5593968ff9231188f6beb27b3", "score": "0.57629037", "text": "def irmonograsaslp\n vag=(valormonograsasp * 100) / 70\n vag.round(2)\n end", "title": "" }, { "docid": "eb047fa681f464082c1e160c43110ed5", "score": "0.57557344", "text": "def irazucaresp\n vag=(valorazucaresp * 100) / 90\n vag.round(2)\n end", "title": "" }, { "docid": "0e6d539238d9bbb247821dbfd43d8d4b", "score": "0.5739829", "text": "def porcentaje_lipidos\n recorrido = lista_alimentos.head\n acumulador = 0\n porcentaje = 0\n\n while recorrido != nil\n acumulador = acumulador + recorrido.value.proteinas + recorrido.value.carbohidratos + recorrido.value.lipidos\n porcentaje = porcentaje + recorrido.value.lipidos\n\n recorrido = recorrido.next\n end\n\n ((porcentaje * 100)/acumulador).round(2)\n end", "title": "" }, { "docid": "8791203361d9bbe9cf55dac17650084b", "score": "0.5734393", "text": "def irpoliinsaturadas\n vag=(grasaspoli * 100) / 70\n vag.round(2)\n end", "title": "" }, { "docid": "a2d1e68fbc893fdd8d5f4661e8692bf4", "score": "0.57333916", "text": "def tl_Aries() \r\n # Celes.anp(eq_of_equinox() + ml_Aries())\r\n dt = 67.184 \r\n tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt) \r\n Celes.gst06a(@ajd, 0, tt, 0) \r\n end", "title": "" }, { "docid": "da9a83bae386fb5a22dae2bf4fafc39a", "score": "0.57332623", "text": "def devolver_azucar \n\t\treturn @azucares\n\tend", "title": "" }, { "docid": "74f27d227a5f2035a2c46187aceb4cec", "score": "0.5731948", "text": "def pLipidos\n\t\tlip = 0\n\t\ttotal = 0\n\t\[email protected] do |alimento|\n\t\t\ttotal += alimento.proteinas + alimento.lipidos + alimento.carbohidratos\n\t\t\tlip += alimento.lipidos\n\t\tend\n\t\treturn ((lip/total)*100).round\n\t\n\tend", "title": "" }, { "docid": "032928bf3f1081e7534353aa66822ac8", "score": "0.5725804", "text": "def irazucares\n vag=(azucares * 100) / 90\n vag.round(2)\n end", "title": "" }, { "docid": "faf7904b74d773f2eb2fab165f5c6350", "score": "0.5707836", "text": "def irvitaminas\n vag=(vitymin * 100) / 50\n vag.round(2)\n end", "title": "" }, { "docid": "0570c713d15e3c2c3c08b565e09a689e", "score": "0.5703285", "text": "def get_usoterreno\n aux = 0.0\n @contenido.each do |alimento|\n aux += alimento.ground\n end\n @usoterreno = aux\n end", "title": "" }, { "docid": "141d2d62f1805a5c2a339c0fce24df96", "score": "0.57032514", "text": "def calcular_Aptitud(alelos)\n return diff_vectors(alelos).round(2)\n #vector_R = producto_Mtz_Vcr(@matriz_problema, alelos)\n #return (sumatoriaCuadratico(vector_R, @vector_problema) * -1).round(2)\n end", "title": "" }, { "docid": "f0d0ca1f3313478c2fff820c7cd67c6c", "score": "0.56982374", "text": "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "title": "" }, { "docid": "7cdb702ad83bd8794204a7b8f17dbda8", "score": "0.568225", "text": "def vertikal_bewegen(anzahl_punkte)\n @fuss.vertikal_bewegen(anzahl_punkte)\n @stiel.vertikal_bewegen(anzahl_punkte)\n @schirm.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl1.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl2.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl3.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl4.vertikal_bewegen(anzahl_punkte)\n end", "title": "" }, { "docid": "d3cd7045d81236f80b2241964baa2ac5", "score": "0.5679963", "text": "def konversiMenit(menit) \n # =================================\n # Area Kode Kode di sini\n \n \n \n # =================================\n end", "title": "" }, { "docid": "301f3f42245d048ea83907121d519121", "score": "0.56779766", "text": "def imc \n\t\t@peso/(@talla*@talla)\n\tend", "title": "" }, { "docid": "bf0cd9ff8de1f47a98c329423b9c8f22", "score": "0.56686264", "text": "def lipidos\n\t\treturn @lipidos*@cantidad\n\tend", "title": "" }, { "docid": "f99c4ec53eb85981c63a4959c42dba0a", "score": "0.5661469", "text": "def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end", "title": "" }, { "docid": "95d2872e2fdfeb122aa8e69b1a516a84", "score": "0.5645459", "text": "def irpoliinsaturadasp\n vag=(valorgrasaspolip * 100) / 70\n vag.round(2)\n end", "title": "" }, { "docid": "a6d1b730188c667037410a8db0101f50", "score": "0.5632711", "text": "def dv; end", "title": "" }, { "docid": "07388179527877105fd7246db2b49188", "score": "0.56257546", "text": "def villian; end", "title": "" }, { "docid": "97c5af340ba5e8f6958c50b6024fbc34", "score": "0.5623712", "text": "def england\n end", "title": "" }, { "docid": "10bb7baf20d1db7a86b0f42469cc23e0", "score": "0.56196886", "text": "def irproteinas\n vag=(proteinas * 100) / 50\n vag.round(2)\n end", "title": "" }, { "docid": "ef89ab652a0fffea4467489e76f37e7a", "score": "0.56096536", "text": "def vrat_modif_instanci\n vystup=\"\"\n @pole_dat.each do |radek| \n if(radek[0]==\"p\")then \n vystup +=radek\n vystup += \"w #{generuj_vahy(radek).join(' ')}\\n\" #pridani radku s vahami\n else\n vystup +=radek\n end \n end\n # puts vystup\n return vystup\n end", "title": "" }, { "docid": "8969834c1d9911d013e38083c1372216", "score": "0.5606455", "text": "def gastriloquism_quinnipiac_apodictical()\n end", "title": "" }, { "docid": "7c0f2b512c5e09eb73da45df103035ed", "score": "0.5594777", "text": "def iva\n restaurant_menu.each { |k, v| resultado = iva = 1.19 * v }\n puts resultado\nend", "title": "" }, { "docid": "3098bf563a6e0314dd251580f818ae0f", "score": "0.5589385", "text": "def elv_blindalys\n !elv_armulys\n end", "title": "" }, { "docid": "5d5490e9aff08262697f3beee40a04b2", "score": "0.5588222", "text": "def porcentaje_lipidos\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n porcentaje_lip = 0\n while(auxNodo1 != nil && auxNodo2 != nil)\n porcentaje_lip += (auxNodo1.value.lipidos * auxNodo2.value) / 100\n auxNodo1 = auxNodo1.next\n auxNodo2 = auxNodo2.next\n end\n return porcentaje_lip.round(1)\n end", "title": "" }, { "docid": "7f71534cec45302d7d9ca46f87a74b4d", "score": "0.5581509", "text": "def totalLipidos\n\t\tlip = 0\n\t\ttotal = 0\n\t\[email protected] do |alimento|\n\t\t\tlip += alimento.lipidos\n\t\tend\n\t\treturn lip.round(2)\n\t\n\tend", "title": "" }, { "docid": "fb2f7009a320465ce2387108fc5b54e5", "score": "0.55800134", "text": "def huellaAmbiental\r\n indiceCarbono = 0.0\r\n if @geiTotal < 800.0\r\n indiceCarbono = 1.0\r\n elsif @geiTotal <= 1200.0\r\n indiceCarbono = 2.0\r\n else\r\n indiceCarbono = 3.0\r\n end\r\n\r\n indiceEnergia = 0.0\r\n if kcalPlato < 670.0\r\n calorias = 1.00\r\n elsif kcalPlato <= 830.0\r\n calorias = 2.0\r\n else\r\n calorias = 3.0\r\n end\r\n\r\n return (indiceCarbono + indiceEnergia)/2\r\n end", "title": "" }, { "docid": "d7a0aafdf54c22a021b7cbf86f3348a6", "score": "0.55773324", "text": "def vitaminasIR\n\t\t((valorEnergeticoKJ.to_f*260)/8400).round(2)\n\tend", "title": "" }, { "docid": "680f98f70ae4a4ba5443f9df765e5a1f", "score": "0.5571837", "text": "def irvitaminasp\n vag=(valorvityminp * 100) / 50\n vag.round(2)\n end", "title": "" }, { "docid": "4bea3f7a258bd3ae5e32a702f0b2ebb6", "score": "0.55669117", "text": "def kcalglucidos\n\t\t\t@carbohidratos * 4\n\t\tend", "title": "" }, { "docid": "171a51f1c6c9c55cc6a298c4ecbd5267", "score": "0.55591166", "text": "def ligar #iniciando o método ligar\n puts 'O carro está ligado...' #imprime na tela a ação do método\n end", "title": "" }, { "docid": "f042a458ae044edfae8be2dc577810dc", "score": "0.55503786", "text": "def lax_wendroff\n @u[0] = @mx.times.map { |j| self.ic(@x[j]) } # IC: u(x,0)\n alpha = @a*@dt/@dx\n 0.upto(@mt-2) do |n|\n @u[n+1] = (1.upto(@mx-3)).to_a\n @u[n+1].map! { |j| @u[n][j]-0.5*alpha*(@u[n][j+1]-@u[n][j-1])+0.5*(alpha**2)*(u[n][j+1]-2*u[n][j]+u[n][j-1]) }\n @u[n+1].unshift @u[n][0]-0.5*alpha*(@u[n][1]-@u[n][@mx-2])+0.5*(alpha**2)*(u[n][1]-2*u[n][0]+u[n][@mx-2]) # u(0,t)\n @u[n+1].push @u[n][@mx-2]-0.5*alpha*(@u[n][0]-@u[n][@mx-3])+0.5*(alpha**2)*(u[n][0]-2*u[n][@mx-2]+u[n][@mx-3]) # u(max(x), t)\n @u[n+1].push @u[n+1][0] # periodic BC\n end\n end", "title": "" }, { "docid": "d54a6b25ebb8cae8c462f3e716939819", "score": "0.55503637", "text": "def vrat_celkovy_soucet_vah\n soucet = 0\n @pole_vah.each do |prvek| \n soucet += prvek.to_i\n end\n return soucet\n end", "title": "" }, { "docid": "9b2030fdde2168b0c8a25ebd4ba73c41", "score": "0.554345", "text": "def get_alco\n @_100=((@alco*100)/@peso)\n #@ir_100=(@_100/90)*100\n @porcion=((@alco*@gramos_porciones)/@peso)\n #@ir_porcion=(@porcion/90)*100\n [ @alco , @_100 , 0 , @porcion , 0 ]\n end", "title": "" }, { "docid": "888035d3d7581e3f50cc7ebb3a7ef160", "score": "0.55385756", "text": "def valorenergeticoKJ\n\t\tveKJ=(cgrasas * 37) + (cgrasassa * 37) + (grasasmono * 37) + (grasaspoli * 37) + (hcarbono * 17) + (polialcoholes * 10) + (almidon * 17) + (fibra * 8) + (proteinas * 17) + (sal * 25)\n\t\tveKJ.round(2)\n\tend", "title": "" }, { "docid": "d8d67456d4be626c721a93f7aa3dddd0", "score": "0.553489", "text": "def ir_azucares \n\t\t@ir_azucares = (@azucares/90.to_f)*100\n\t\t@ir_azucares.round(1)\n\tend", "title": "" }, { "docid": "082b32b6a13fbcc18fff7229ad30e476", "score": "0.5529282", "text": "def ener_kj \n\t\t@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25\n\t\treturn @ener_kj\n\tend", "title": "" }, { "docid": "c38773098786be4bebd5b4ef4647d338", "score": "0.55288273", "text": "def irmonograsas\n vag=(grasasmono * 100) / 70\n vag.round(2)\n end", "title": "" }, { "docid": "4a8a45e636a05760a8e8c55f7aa1c766", "score": "0.55265516", "text": "def terpene; end", "title": "" }, { "docid": "787cf1d3dde36ac9dc375cd5dc8348da", "score": "0.5512916", "text": "def palladius_version\n\t:TODO\nend", "title": "" }, { "docid": "67a69a09033ac67c9545b74f43b458ab", "score": "0.5510103", "text": "def two_pt_a\n fga - three_p_a\n end", "title": "" }, { "docid": "2be7551fb4a00c4d709f271428f881f6", "score": "0.5505822", "text": "def valorenergeticoKcal\n veKJ=(cgrasas * 9) + (cgrasassa * 9) + (grasasmono * 9) + (grasaspoli * 9) + (hcarbono * 4) + (polialcoholes * 2.4) + (almidon * 4) + (fibra * 2) + (proteinas * 4) + (sal * 6)\n veKJ.round(2)\n end", "title": "" }, { "docid": "dee90215cca381e327f1114586ec653b", "score": "0.54987407", "text": "def adjourn_points_giocataend\r\n # at the end of the game remain to calculate the primiera\r\n player1 = @players[0]\r\n player2 = @players[1]\r\n hand1 = @carte_prese[player1.name]\r\n hand2 = @carte_prese[player2.name]\r\n prim_res_arr = calculate_primiera(hand1, hand2)\r\n @log.debug(\"Primiera of #{player1.name}:#{prim_res_arr[0]}, #{player2.name}: #{prim_res_arr[1]}\")\r\n # update points on all players\r\n ix = 0\r\n [player1, player2].each do |pl|\r\n points_info = @points_curr_segno[pl.name]\r\n points_info[:primiera] = prim_res_arr[ix]\r\n #calculate total\r\n tot = 0\r\n points_info.each do |k,v|\r\n next if k == :tot\r\n tot += v\r\n end\r\n points_info[:tot] = tot\r\n ix += 1\r\n end\r\n end", "title": "" }, { "docid": "69ff8dcdf952b2e6fbf7a41c12387e39", "score": "0.54981107", "text": "def kcalproteinas\n\t\t\t@proteinas * 4\n\t\tend", "title": "" }, { "docid": "a121c70f1966307c110eb81509850d16", "score": "0.5481794", "text": "def ingresar_detalle_en_venta(detalle_venta,venta)\n if venta[:esta_vacio]\n venta[:tope] = detalle_venta\n venta[:final] = detalle_venta\n venta[:esta_vacio] = false\n venta[:size] +=1\n venta[:max]-=1\n else\n final = venta[:final]\n final[:siguiente] = detalle_venta\n venta[:final] = detalle_venta\n venta[:size]+=1\n venta[:max]-=1\n end\nend", "title": "" }, { "docid": "c9bb103b1082314e2f7decf2c4e2d62e", "score": "0.54807806", "text": "def native_kendalTauish_cost( pi )\n EpsSrraNative::rank_aggergate_upperW(@n){ |u,v| pi.pref(u,v) == @w[u][v] ? 0 : 1 } \n end", "title": "" }, { "docid": "f859b5cb278197eb0d039c592b6307fb", "score": "0.5478161", "text": "def langrage_coefficients\n # TODO\n end", "title": "" }, { "docid": "f4b48a4aa8328a52eb949a78b47565b6", "score": "0.5476974", "text": "def conta_vicini(i,j,game)\n vicini = 0\n \n #### BORDI RIGIDI\n #if i > 0\n # vicini += 1 if game[:griglia][i-1][j]\n #end\n #if i > 0 && j > 0\n # vicini += 1 if game[:griglia][i-1][j-1]\n #end\n #if i > 0 && j < CELLE_PER_RIGA\n # vicini += 1 if game[:griglia][i-1][j+1]\n #end\n #if j > 0\n # vicini += 1 if game[:griglia][i][j-1]\n #end\n #if j < CELLE_PER_RIGA-1\n # vicini += 1 if game[:griglia][i][j+1]\n #end\n #if i < CELLE_PER_COLONNA-1 && j > 0\n # vicini += 1 if game[:griglia][i+1][j-1]\n #end\n #if i < CELLE_PER_COLONNA-1\n # vicini += 1 if game[:griglia][i+1][j]\n #end\n #if i < CELLE_PER_COLONNA-1 && j < CELLE_PER_RIGA-1\n # vicini += 1 if game[:griglia][i+1][j+1]\n #end\n \n #======================================================\n ### BORDI RICORSIVI\n i += CELLE_PER_COLONNA if i-1 < 0\n j += CELLE_PER_RIGA if j-1 < 0\n i -= CELLE_PER_COLONNA if i+1 >= CELLE_PER_COLONNA\n j -= CELLE_PER_RIGA if j+1 >= CELLE_PER_RIGA\n \n vicini += 1 if game[:griglia][i-1][j]\n vicini += 1 if game[:griglia][i-1][j-1]\n vicini += 1 if game[:griglia][i-1][j+1]\n vicini += 1 if game[:griglia][i][j-1]\n vicini += 1 if game[:griglia][i][j+1]\n vicini += 1 if game[:griglia][i+1][j-1]\n vicini += 1 if game[:griglia][i+1][j]\n vicini += 1 if game[:griglia][i+1][j+1]\n \n return vicini\nend", "title": "" }, { "docid": "7974f1e14a7ef28ac1f8b55b1b968116", "score": "0.54709345", "text": "def por_lipidos\n\t\taux_lipidos = 0.0\n\t\ti = 1\n\t\twhile i < @lista_alimentos.size do\n\t\t\taux_lipidos += @lista_alimentos[i].lipidos * @lista_cantidades[i]\n\t\t\ti+=1\n\t\tend\n\t\treturn ((aux_lipidos/total_nutrientes)*100.0).round(2)\n\tend", "title": "" }, { "docid": "f8648aa735bca950b61f3f032b3f3b7c", "score": "0.5469956", "text": "def display_villains\n line\n i = 1\n Villain.all.each do |villain| \n puts \"#{i}. \" + villain.alter_ego\n i +=1\n end\n line\n end", "title": "" }, { "docid": "8223b05db7b4ba181cc8767627886bfd", "score": "0.5460916", "text": "def lipidos\n food = @ingredientes.head\n lipidos = 0.0\n while food != nil do\n lipidos += food[:value].lipidos * (food[:value].gramos / 1000.0)\n food = food[:next]\n end\n lipidos * (100.0 / @total_nutricional)\n end", "title": "" }, { "docid": "6d630796efb533d861c9f89c6080401d", "score": "0.545931", "text": "def vertikal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(0,anzahl))\n end", "title": "" }, { "docid": "39eb67ce0a773cfc52da560c76aec818", "score": "0.545498", "text": "def ndp_lla; self[:ndp_lla].to_s; end", "title": "" }, { "docid": "5249a3716ba7e63b29961100e865251d", "score": "0.5454827", "text": "def vat_number; end", "title": "" }, { "docid": "5a487bddd6d9ac8b196d01fd916a430b", "score": "0.54523385", "text": "def residency_diploma\n\tend", "title": "" }, { "docid": "6d9b5323cf15bd7b9a2474bb24ecc3e2", "score": "0.54492295", "text": "def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend", "title": "" }, { "docid": "a5453761125333c1565d79d79a34f210", "score": "0.5438043", "text": "def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend", "title": "" }, { "docid": "731bcac6401835a4d33e597baf64dd50", "score": "0.5433222", "text": "def transform line\n i = 1\n tortoise = line[i]\n hare = line[i * 2]\n while tortoise != hare\n i += 1\n tortoise = line[i]\n hare = line[i * 2]\n end\n v = i\n\n mu = 0\n tortoise = line[mu]\n hare = line[v * 2 + mu]\n while tortoise != hare\n mu += 1\n tortoise = line[mu]\n hare = line[v * 2 + mu]\n end\n\n lam = 1\n hare = line[mu + lam]\n while tortoise != hare\n lam += 1\n hare = line[mu + lam]\n end\n #puts \"v mu lam %d %d %d\" % [v, mu, lam]\n \n line[mu, lam] \nend", "title": "" }, { "docid": "0dbcacb7e2300dd09df2c30c665e5f6d", "score": "0.5416936", "text": "def total_ve\n\t\t\n\t\ttotal_ve = 0\n\t\ti = 0\n\t\t\n\t\twhile i < conjunto_alimentos.length do\n\t\t\n\t\t\ttotal_ve += conjunto_alimentos[i].gei + total_ve\n\t\t\ti += 1\n\n\t\tend\n\t\n\t\treturn total_ve\n\tend", "title": "" }, { "docid": "eba97e4ccc9404094b074472c12d9a5e", "score": "0.54166406", "text": "def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend", "title": "" }, { "docid": "4c53194285ebc987ba108aa4c1bbfd83", "score": "0.541482", "text": "def set_disciplina\n @aula = Aula.find(params[:id])\n end", "title": "" }, { "docid": "e0a3872f030ffc26a331e1ea578a8151", "score": "0.541408", "text": "def palabras\n end", "title": "" }, { "docid": "e1c799192769911148c22bf2f35190c2", "score": "0.5412479", "text": "def initialize\n\t\t@vida = 1\n\t\t@forca = 1\n\t\t@carisma = 1\n\t\t@arma = 1\n\tend", "title": "" }, { "docid": "5726e276ef25d51d4dfb4154d39b7ebc", "score": "0.54053915", "text": "def aff()\n\t\t\tprint @plateau[0][0],\"|\", @plateau[0][1],\"|\",@plateau[0][2]\n\t\t\tputs\n\t\t\tputs \"-----\"\n\t\t\tprint @plateau[1][0],\"|\", @plateau[1][1],\"|\",@plateau[1][2]\n\t\t\tputs\n\t\t\tputs \"-----\"\n\t\t\tprint @plateau[2][0],\"|\", @plateau[2][1],\"|\",@plateau[2][2]\n\t\t\tputs\n\tend", "title": "" }, { "docid": "49d7f4ca3641c836d57e619ee9bd4dc4", "score": "0.540486", "text": "def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend", "title": "" }, { "docid": "2cf702e3ae27dcad9fbda916cfbe4c4d", "score": "0.5400187", "text": "def irsalp\n vag=(valorsalp * 100) / 6\n vag.round(2)\n end", "title": "" }, { "docid": "7289c8a63c95fead0dffed76689eb1c3", "score": "0.5393938", "text": "def get_energia\n\t\t\t\t@lipidos * 9 + @proteins * 4 + @carbs * 4\n\t\t\tend", "title": "" }, { "docid": "120dec4f0d34f70f37611a4483815a88", "score": "0.5391924", "text": "def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend", "title": "" } ]
7d64a953d9a19834d1ed7203a3165be4
predefined method NOT to be removed
[ { "docid": "741a903814579be74cb7ed1b713f7e03", "score": "0.0", "text": "def check_valid(secret)\r\n\[email protected] = secret\r\n\tsarray = []\r\n\ti = 0\r\n\tsecret.split('').each do|c| \r\n\t\tsarray[i] = c\r\n\t\ti=i+1\r\n\tend\r\nend", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.792181", "text": "def private; end", "title": "" }, { "docid": "a02f7382c73eef08b14f38d122f7bdb9", "score": "0.7842519", "text": "def custom; end", "title": "" }, { "docid": "a02f7382c73eef08b14f38d122f7bdb9", "score": "0.7842519", "text": "def custom; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7633941", "text": "def method; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.73635644", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.73635644", "text": "def implementation; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.72787184", "text": "def methods; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.72787184", "text": "def methods; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.72787184", "text": "def methods; end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.72787184", "text": "def methods; end", "title": "" }, { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.7274473", "text": "def internal; end", "title": "" }, { "docid": "530e65cba197567f73b8125444ac33cc", "score": "0.7255775", "text": "def private_method\n end", "title": "" }, { "docid": "f4ad13bf5fa71b1e7bc47220336ffdbf", "score": "0.71795", "text": "def methods() end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", "score": "0.71501845", "text": "def specie; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", "score": "0.71501845", "text": "def specie; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", "score": "0.71501845", "text": "def specie; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", "score": "0.71501845", "text": "def specie; end", "title": "" }, { "docid": "e6431ff47476c9014fb64198d5853e1e", "score": "0.7044318", "text": "def overrides; end", "title": "" }, { "docid": "a29c5ce532d6df480df4217790bc5fc7", "score": "0.69512945", "text": "def extra; end", "title": "" }, { "docid": "126c2c552b724e98ef167fa2195be768", "score": "0.6871269", "text": "def overload; end", "title": "" }, { "docid": "172bd2432a5b585c3a1d57951dc4bb76", "score": "0.6846852", "text": "def special\n override\n end", "title": "" }, { "docid": "2dbabd0eeb642c38aad852e40fc6aca7", "score": "0.68466747", "text": "def operations; end", "title": "" }, { "docid": "2dbabd0eeb642c38aad852e40fc6aca7", "score": "0.68466747", "text": "def operations; end", "title": "" }, { "docid": "31e801a93dc2fdf9be17a4b890837c5a", "score": "0.68424344", "text": "def public_method; end", "title": "" }, { "docid": "3dcc18e4f5b39cab9ba4dea317e3a1d7", "score": "0.6840908", "text": "def original_method; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.68347234", "text": "def probers; end", "title": "" }, { "docid": "bd395ef5570ec94ad67ca3120a943fca", "score": "0.6794822", "text": "def operation; end", "title": "" }, { "docid": "cdd16ea92eae0350ca313fc870e10526", "score": "0.67901576", "text": "def who_we_are\r\n end", "title": "" }, { "docid": "bb2cf20999efd9fcacf7668301ebe565", "score": "0.67768854", "text": "def missing; end", "title": "" }, { "docid": "78715c96fa1cf2097657613c494e2cc6", "score": "0.6760516", "text": "def internal_methods; end", "title": "" }, { "docid": "21c1024f9479c72a02693a26c09d88f1", "score": "0.6758646", "text": "def extended(*) end", "title": "" }, { "docid": "01c705f4b4a1ad8438a1e47aba72f9f3", "score": "0.67576426", "text": "def operation_method\n raise 'Not implemented!'\n end", "title": "" }, { "docid": "9033a4004eb88fe2a1f0a7e5671e3d95", "score": "0.6711095", "text": "def private_method; end", "title": "" }, { "docid": "14187174b07e4c51e8d38b1dd3593d4a", "score": "0.6697672", "text": "def macro; raise NotImplementedError; end", "title": "" }, { "docid": "14187174b07e4c51e8d38b1dd3593d4a", "score": "0.6697672", "text": "def macro; raise NotImplementedError; end", "title": "" }, { "docid": "14187174b07e4c51e8d38b1dd3593d4a", "score": "0.6697672", "text": "def macro; raise NotImplementedError; end", "title": "" }, { "docid": "0a556b1952ad83e39c4a887f1f85e9bc", "score": "0.6694365", "text": "def method\n\t\t# code code\n\tend", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "a265fe5e200ae985db3fc3d804b9fd77", "score": "0.66885585", "text": "def method_name; end", "title": "" }, { "docid": "3103349d09f884a9193b8c4ac184a666", "score": "0.6671081", "text": "def wrapper; end", "title": "" }, { "docid": "ad244bd0c45d5d9274f7612fa6fee986", "score": "0.6667846", "text": "def suivre; end", "title": "" }, { "docid": "27c7f843e216dc44293f3ebd8b8aa758", "score": "0.6665918", "text": "def method_undefined(*) end", "title": "" }, { "docid": "909ab03cfa69b7f2c15675306a8a87d4", "score": "0.66609275", "text": "def tag; raise 'Override this method'; end", "title": "" }, { "docid": "64875541f8c42bdd60f0a7e3f539b0ba", "score": "0.6656391", "text": "def delegating_method; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.6651904", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.6651904", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.6651904", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.6651904", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.6651904", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.6651904", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.6651904", "text": "def call; end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36966d859", "score": "0.6651904", "text": "def call; end", "title": "" }, { "docid": "65ffca17e416f77c52ce148aeafbd826", "score": "0.66375816", "text": "def schubert; end", "title": "" }, { "docid": "2cc9969eb7789e4fe75844b6f57cb6b4", "score": "0.65922076", "text": "def refutal()\n end", "title": "" }, { "docid": "73c74e6dd2dc52a56f5258bfdeea60b7", "score": "0.65906006", "text": "def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end", "title": "" }, { "docid": "410acce3aabbb7b9adf35f889c493a83", "score": "0.6563627", "text": "def method\r\nend", "title": "" }, { "docid": "323233d632cf96104fa548b4c1fc10f9", "score": "0.6555684", "text": "def ignore_method_conflicts; end", "title": "" }, { "docid": "65868f3890b7055ca6fbf5f330690d03", "score": "0.6534388", "text": "def method_731(base); end", "title": "" }, { "docid": "40ad11ae52949cc12141dcd7bf3f555c", "score": "0.6532262", "text": "def implemented_in; end", "title": "" }, { "docid": "7ff2011fa3dc45585a9272310eafb765", "score": "0.65267926", "text": "def isolated; end", "title": "" }, { "docid": "7ff2011fa3dc45585a9272310eafb765", "score": "0.65267926", "text": "def isolated; end", "title": "" }, { "docid": "2d8d9f0527a44cd0febc5d6cbb3a22f2", "score": "0.6516718", "text": "def weber; end", "title": "" }, { "docid": "4ea6f5c11a3bc16e2394d273e748b292", "score": "0.6499955", "text": "def internal?; end", "title": "" }, { "docid": "8a391425187ceff6461e558601ca3c06", "score": "0.6495809", "text": "def method_one; end", "title": "" }, { "docid": "b8903ea470da4aff13d096e26515327b", "score": "0.6472021", "text": "def specialty; end", "title": "" }, { "docid": "0eb3d9fe5f9f25d5d4681707022b9ab6", "score": "0.6452033", "text": "def ignores; end", "title": "" }, { "docid": "4e7f63d2e8327143b97af38c6fce7a24", "score": "0.6437461", "text": "def original; end", "title": "" }, { "docid": "adc143d9921490a32ce81e2ec1b81602", "score": "0.6429007", "text": "def invoke; end", "title": "" }, { "docid": "2e498b811c1d13b03e32aed2be901419", "score": "0.63847095", "text": "def virtual; end", "title": "" }, { "docid": "ccfe4044a5371ef1ee52c0eaecd344fc", "score": "0.636821", "text": "def called_from; end", "title": "" }, { "docid": "ccfe4044a5371ef1ee52c0eaecd344fc", "score": "0.636821", "text": "def called_from; end", "title": "" }, { "docid": "3d9abab6384f891b3bc8138a5a311580", "score": "0.63662905", "text": "def op; end", "title": "" }, { "docid": "a1a3e55c69241e71aba45ecb5d3dbd46", "score": "0.6352129", "text": "def standard\n end", "title": "" }, { "docid": "5ad7e5c7a147626a2b0a2c5956411be5", "score": "0.6343515", "text": "def r; end", "title": "" }, { "docid": "5ad7e5c7a147626a2b0a2c5956411be5", "score": "0.6343515", "text": "def r; end", "title": "" }, { "docid": "c88668ef65f1f1d114c50c09b32ed596", "score": "0.6336655", "text": "def old_method\n \"old improved method\"\nend", "title": "" }, { "docid": "06b6203baf3c9311f502228839c5ab4e", "score": "0.632965", "text": "def intensifier; end", "title": "" }, { "docid": "750171411e91dc9aed0585bfcbba6092", "score": "0.63290024", "text": "def interface; end", "title": "" }, { "docid": "750171411e91dc9aed0585bfcbba6092", "score": "0.63290024", "text": "def interface; end", "title": "" }, { "docid": "70f46f89dae30c347c6e8535f7ab7187", "score": "0.63282377", "text": "def method_name\n\n end", "title": "" } ]
79fb6d667c01d155bd11c6f00442a6be
Used to provide data for autocomplete on taxon field
[ { "docid": "5850fdd7fb62e9990adf6895d64a6831", "score": "0.6957864", "text": "def autocomplete\n @taxa = Taxon.order(:scientific_name).search(params[:term])\n list = @taxa.map {|t| Hash[id: t.id, label: t.label, value: t.scientific_name]}\n respond_to do |format|\n format.html { render :index }\n format.json do\n render json: list.to_json\n end\n end\n end", "title": "" } ]
[ { "docid": "0e01ebf5bc6b4085803502cdac1093b6", "score": "0.6582837", "text": "def call\n add_fields(leeds_taxi: true)\n end", "title": "" }, { "docid": "5f62c78add290c24b65d8205468365fe", "score": "0.6531084", "text": "def auto_complete_info(field)\r\n { \"id\" => id, \"label\" => send(field), \"value\" => send(field) }\r\n end", "title": "" }, { "docid": "d5f081221624d7196b0268d359913be8", "score": "0.63339084", "text": "def generate_autocomplete\n # we'll martial brand into the autocomplete field since it's\n # natural to search by brand\n s = \"#{ brand } #{ name } #{ model_number }\".squish\n s = s.truncate(45, omission: \"\", separator: \" \") if s.length > 45\n self.autocomplete = self.class.normalize(s)\n end", "title": "" }, { "docid": "3cec4976f8fb89d7cd4aa3a96c4da2aa", "score": "0.6253671", "text": "def aniade_taxones_query\n end", "title": "" }, { "docid": "edf037632f3dd409a45b7e797ab9eded", "score": "0.6195355", "text": "def tax\n unescape params['x_tax']\n end", "title": "" }, { "docid": "78fe93d63122022dc5c8f1445bbef00c", "score": "0.61808175", "text": "def tax\n unescape params['x_tax']\n end", "title": "" }, { "docid": "a3ec89ee5750ac1de689fe04eca4386e", "score": "0.60402316", "text": "def autocomplete; end", "title": "" }, { "docid": "eb445be5c21cd471b5309740357662ac", "score": "0.6038743", "text": "def tax_index\n\n end", "title": "" }, { "docid": "d6f50f16da1534fe99e0caf6ee9086bc", "score": "0.59846437", "text": "def autocomplete\n results = AttributeAutocomplete.new(\n attribute: params[:attribute],\n term: params[:term],\n year: year\n ).perform\n render json: results\n end", "title": "" }, { "docid": "4330bf3db7d3bf513c81a1751d128c74", "score": "0.5956087", "text": "def as_json_for_autocomplete\n {id: id, value: full_name, link: autocomplete_link}\n end", "title": "" }, { "docid": "1834f277dbde394be14a172399b8e08c", "score": "0.59429604", "text": "def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end", "title": "" }, { "docid": "71a4e911e9a34fd8713258c3d988a7d5", "score": "0.592988", "text": "def set_Tax(value)\n set_input(\"Tax\", value)\n end", "title": "" }, { "docid": "9969d1bb3987a1dddf97e815d532cbea", "score": "0.57759494", "text": "def tax_1\n get_or_build_tax_for_key(\"tax_1\")\n end", "title": "" }, { "docid": "2ecce75e3687e552a97cd9718092be7c", "score": "0.5728137", "text": "def generate_autocomplete\n s = self.complete_fields.map{|f| self.send(f)}.join(\" \")\n s = s.truncate(100, omission: \"\", separator: \" \") if s.length > 100\n write_attribute(:autocomplete, Autocomplete.normalize(s))\n write_attribute(:autocomplete_length, Autocomplete.normalize(s).size)\n end", "title": "" }, { "docid": "8bdf04ec59ae8630455b5bb623178302", "score": "0.57206255", "text": "def envia_taxones_query\n end", "title": "" }, { "docid": "cdc4a8d4f3cc4d3842bcd3134e1ec251", "score": "0.5695378", "text": "def autocomplete(q:)\n return unless String(q).length > 1\n\n result = Geocoder.search(q, autocomplete: true)\n result&.data\n end", "title": "" }, { "docid": "d88c29147b58f6eb14a86f879339d5af", "score": "0.567004", "text": "def autocomplete_product_code\n term = params[:term]\n if params[:supplier_id].blank?\n products = current_company.products.where('code ILIKE ?', \"%#{term}%\").order(:code).all\n else\n products = current_company.suppliers.find(params[:supplier_id]).products.where('code ILIKE ?', \"%#{term}%\").order(:code).all\n end\n render :json => products.map { |product| {:id => product.id, :label => product.full_name, :value => product.code, name: product.name, price: product.cost_price, supplier_code: product.supplier_code} }\n end", "title": "" }, { "docid": "bcd331f5fc46a8c0d1e64f834fb20bc2", "score": "0.56444156", "text": "def autocomplete\n respond_to do |format|\n format.json do\n # Only get non-soft deleted Donations and Donations where the available until datetime is after the current datetime.\n @donations = Donation.kept.available\n\n # Ensure the User has permission to perform this action.\n authorize @donations\n\n # Search the Donations based on the current term typed into the search bar.\n @donations = @donations.search(params[:term])\n\n # Only return the name and description of the Donation, as a single array.\n @donation_names_and_descriptions = []\n @donations.map(&:name).zip(@donations.map(&:description)).each do |name, description|\n @donation_names_and_descriptions << \"#{name}: #{description}\"\n end\n\n render json: @donation_names_and_descriptions.to_json\n end\n end\n end", "title": "" }, { "docid": "61be3e084a390642072134d00d62b7bd", "score": "0.5612732", "text": "def ajax_auto_complete\n type = params[:type].to_s\n instr = params[:id].to_s\n letter = ' '\n scientific = false\n user = login_for_ajax\n if user\n scientific = (user.location_format == :scientific)\n end\n @items = []\n if instr.match(/^(\\w)/)\n letter = $1\n case type\n\n when 'location'\n @items = Observation.connection.select_values(%(\n SELECT DISTINCT `where` FROM observations\n WHERE `where` LIKE '#{letter}%' OR\n `where` LIKE '% #{letter}%'\n )) + Location.connection.select_values(%(\n SELECT DISTINCT `name` FROM locations\n WHERE `name` LIKE '#{letter}%' OR\n `name` LIKE '% #{letter}%'\n ))\n if scientific\n @items.map! {|i| Location.reverse_name(i)}\n end\n @items.sort!\n\n when 'name'\n @items = Name.connection.select_values %(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{letter}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )\n\n when 'name2'\n @items = Name.connection.select_values(%(\n SELECT text_name FROM names\n WHERE text_name LIKE '#{instr}%'\n AND correct_spelling_id IS NULL\n ORDER BY text_name ASC\n )).sort_by {|x| (x.match(' ') ? 'b' : 'a') + x}\n # This sort puts genera and higher on top, everything else on bottom,\n # and sorts alphabetically within each group.\n letter = ''\n\n when 'project'\n @items = Project.connection.select_values %(\n SELECT title FROM projects\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'species_list'\n @items = SpeciesList.connection.select_values %(\n SELECT title FROM species_lists\n WHERE title LIKE '#{letter}%'\n OR title LIKE '%#{letter}%'\n ORDER BY title ASC\n )\n\n when 'user'\n @items = User.connection.select_values %(\n SELECT CONCAT(users.login, IF(users.name = \"\", \"\", CONCAT(\" <\", users.name, \">\")))\n FROM users\n WHERE login LIKE '#{letter}%'\n OR name LIKE '#{letter}%'\n OR name LIKE '% #{letter}%'\n ORDER BY login ASC\n )\n end\n end\n\n # Result is the letter requested followed by results, one per line. (It\n # truncates any results that have newlines in them -- that's an error.)\n render(:layout => false, :inline => letter +\n %(<%= @items.uniq.map {|n| h(n.gsub(/[\\r\\n].*/,'')) + \"\\n\"}.join('') %>))\n end", "title": "" }, { "docid": "feed70c6a6dea4eb5fc213238822ea32", "score": "0.5574169", "text": "def autocomplete\n @drain_results = Drain.ransack(address_cont: params[:q]).result(distinct: true).limit(5)\n @street_results = Street.ransack(street_name_cont: params[:q]).result(distinct: true).limit(5)\n @need_help_category_results = NeedHelpCategory.ransack(category_name_cont: params[:q]).result(distinct: true).limit(5)\n render json: {streets: ActiveModel::ArraySerializer.new(\n @street_results,\n each_serializer: Api::V1::StreetSerializer\n ), drains: ActiveModel::ArraySerializer.new(\n @drain_results,\n each_serializer: Api::V1::DrainSerializer\n ), categories: ActiveModel::ArraySerializer.new(\n @need_help_category_results,\n each_serializer: Api::V1::NeedHelpCategorySerializer\n )}\n end", "title": "" }, { "docid": "266c87acc46e8c00a478c4d949fe9ca3", "score": "0.55651975", "text": "def set_university_autocomplete\n render json: {\"course_tags\": @course_tags, \"program_tags\": @program_tags}\n end", "title": "" }, { "docid": "e8f02c7518fadcde34f8e075309cec1b", "score": "0.5554578", "text": "def autocomplete_agente_apellido\n agente_activo = 1\n respond_to do |format|\n @agentes = Agente.where(\"agentes.estado_agente_id = ? AND agentes.apellido ILIKE ?\", agente_activo, \"%#{params[:term]}%\")\n render :json => @agentes.map { |agente| {:id => agente.id, :value => agente.apellido + \" \"+ agente.nombre } } \n format.js { } \n end\n end", "title": "" }, { "docid": "4d3da0dcff910332263e4c62dea4ada0", "score": "0.554297", "text": "def my_autocomplete(input, latitude, longitude)\r\n\tyelp = yelp_autocomplete(input, latitude, longitude)\r\n\t\r\n\treturn '\"error\"' if yelp.nil? || yelp['error']\r\n\t\r\n\tprediction = (\r\n\t\tyelp['categories'].map{ |category| category['title'] } +\r\n\t\tyelp['terms'].map{ |term| term['text'] }\r\n\t) .map { |x| x.downcase }\r\n\t.select { |x| x.start_with? input.downcase }\r\n\t .map { |x| x[0...x.index(/[^a-z]/, input.length)] }\r\n\t .min { |a, b| a.length <=> b.length }\r\n\t\r\n\tprediction = input[0...input.length] + prediction[input.length...prediction.length] if !prediction.nil?\r\n\t\r\n\tJSON.generate({ prediction: prediction }) # return a hash to differentiate {prediction:\"error\"} from simply \"error\"\r\nend", "title": "" }, { "docid": "a6ed4ed1b2b3f7fc4d16418187876e95", "score": "0.5529534", "text": "def auto_complete_for_customer\n render :json => {} and return if (terms_string = params[:term].to_s).length < 2\n terms = terms_string.split( /\\s+/ )\n max_matches = 60\n exact_name_matches = Customer.exact_name_matches(terms).limit(max_matches/3)\n partial_name_matches = Customer.partial_name_matches(terms).limit(max_matches/3) - exact_name_matches\n other_term_matches = Customer.other_term_matches(terms).limit(max_matches/3) - exact_name_matches - partial_name_matches\n\n if (exact_name_matches.size + partial_name_matches.size + other_term_matches.size) == 0\n render :json => [{'label' => '(no matches)', 'value' => nil}] and return\n end\n show_all_matches = [{\n 'label' => \"List all matching '#{terms_string}'\",\n 'value' => customers_path(:customers_filter => terms_string)}]\n result =\n exact_name_matches.map { |c| {'label' => c.full_name, 'value' => customer_path(c)} } +\n partial_name_matches.map { |c| {'label' => c.full_name, 'value' => customer_path(c)} } +\n other_term_matches.map { |c| {'label' => \"#{c.full_name} (#{c.field_matching_terms(terms)})\", 'value' => customer_path(c)} } +\n show_all_matches\n render :json => result.uniq\n end", "title": "" }, { "docid": "0acdf302fa0e7977a268df72379b53ad", "score": "0.5520911", "text": "def generate_autocomplete\n s = self.name\n s = s.truncate(100, omission: \"\", separator: \" \") if s.length > 100\n write_attribute(:autocomplete, Autocomplete.normalize(s))\n write_attribute(:autocomplete_length, Autocomplete.normalize(s).size)\n end", "title": "" }, { "docid": "d0e9205c468497d536f9871e484c1278", "score": "0.5513701", "text": "def taxonomies_json\n @taxons_json = []\n query_string = \"%#{params[:term]}%\"\n @taxons = Spree::Taxonomy.categories.taxons#.where(\"name like ? OR id like ?\", query_string, query_string)\n @taxons.collect{ |taxon|\n if (taxon.parent.present? && taxon.parent.parent.present? && taxon.parent.parent.parent.present?)\n name = (taxon.parent.parent.name+\" -> \"+taxon.parent.name+\" -> \"+taxon.name)\n @taxons_json << {'label' => name, 'id' => taxon.id} if name.downcase.include? params[:term].downcase\n end\n }\n render :json=>@taxons_json.to_json\n end", "title": "" }, { "docid": "3aa86838f5d82493ba12a01dd0058e01", "score": "0.5511763", "text": "def autocomplete\n render :json => end_of_association_chain.ordered.search(params[:term]).limit(params[:limit] || 10).to_autocomplete\n end", "title": "" }, { "docid": "94ae50dd86e849ca1897f274ef4de8a5", "score": "0.5492064", "text": "def envia_taxones_seleccionados\n end", "title": "" }, { "docid": "4643a036f6b1eb2df4b4a41fbc2802f6", "score": "0.54865193", "text": "def get_taxi\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_or_create_by(plate_no: plate_no)\n data = taxi.summary() #taxi_json_with_ratings(taxi)\n\n render json: {data:data, success:true}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "title": "" }, { "docid": "f1d80ead2cd0958615a5d2ed1bc04050", "score": "0.5469281", "text": "def tags_input\n adding_field do |f|\n f.text_field :tags, :value => question.tags.join(\", \"), :class => \"text_field autocomplete_for_tags\"\n end\n end", "title": "" }, { "docid": "a4fd5ce683979f86b61037ab4cd46868", "score": "0.54640895", "text": "def tax_2\n get_or_build_tax_for_key(\"tax_2\")\n end", "title": "" }, { "docid": "10c5ff612378db6a4446874b6b0c89a7", "score": "0.5454974", "text": "def build_estimate_tax\n estimate_line_items.each do |line|\n add_tax_line(line)\n end\n end", "title": "" }, { "docid": "30b1596f642eac099f743dcd0be5e8d5", "score": "0.5453971", "text": "def autocomplete\r\n # table parameter must be defined. If not, get it from search parameter\r\n if params['table'].nil? && params['search'].match(/\\./)\r\n name = params['search'].split('.').first\r\n params['table'] = name.underscore\r\n end\r\n if params['table'].match('_control')\r\n # it must be at least logged on\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW, 'dc_memory')\r\n else\r\n return render json: { label: t('drgcms.not_authorized') } unless dc_user_can(DcPermission::CAN_VIEW)\r\n end\r\n\r\n table = params['table'].classify.constantize\r\n input = params['input'].gsub(/\\(|\\)|\\[|\\]|\\{|\\|\\.|\\,}/, '')\r\n # call method in class if search parameter contains . This is for user defined searches\r\n a = if params['search'].match(/\\./)\r\n #method, additional_params = params['search'].split('.')\r\n #data = additional_params ? table.send(method, input, additional_params, self) : table.send(method, input)\r\n name, method = params['search'].split('.')\r\n data = table.send(method, input)\r\n data.map do |v|\r\n { label: v[0], value: v[0], id: (v[1] || v[0]).to_s }\r\n end\r\n # will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{input}/i).limit(20).map do |v|\r\n { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render json: a\r\nend", "title": "" }, { "docid": "450f639559d4839b7b2bff928ac4ba93", "score": "0.54487926", "text": "def autocomplete(line, namespace)\n raise NotImplementedError, \"autocomplete\"\n end", "title": "" }, { "docid": "293bf3cd82486182f82c6e1ae7bffa6b", "score": "0.54408854", "text": "def getAutocomplete(query, type)\n request('getAutocomplete', {'query' => query, 'type' => type})\nend", "title": "" }, { "docid": "0430a87d9e865b786cd2563f2fec24e2", "score": "0.54355484", "text": "def build_options_for_new_row(attribute_name, _index, options)\n super\n\n options[:readonly] = true\n options[:data] ||= {}\n options[:data][:autocomplete] = attribute_name\n end", "title": "" }, { "docid": "834548728fa843464595d52306b35f82", "score": "0.5435331", "text": "def input\n if object.respond_to? :reflections\n hid_name = object.reflections[attribute_name].foreign_key || :\"#{attribute_name}_id\"\n relation = attribute_name\n else\n hid_name = attribute_name\n relation = attribute_name.to_s.gsub(/\\A(.+)(_id)\\z/,'\\1')\n end\n\n case\n when options['data-source'].present?\n input_html_options['data-source'] = options.delete('data-source')\n when input_html_options[:data].present? && input_html_options[:data][:source].present?\n input_html_options['data-source'] = input_html_options[:data].delete(:source)\n end\n\n raise 'input_html_options data-source required' unless input_html_options['data-source'].present?\n input_html_options[:placeholder] = input_html_options[:placeholder] || I18n.t('bonsai.autocomplete_placeholder')\n input_html_options[:size] ||= SimpleForm.default_input_size\n input_html_options['data-value'] = object.send(relation).to_s\n input_html_options[:class] = 'select2-autocomplete'\n\n @builder.text_field hid_name, input_html_options\n end", "title": "" }, { "docid": "d47e723164ebc7dcbc0a07a510edc0a2", "score": "0.54001856", "text": "def getTaxon\n classification = ['Kingdom:', 'Phylum:', 'Class:', 'Order:', 'Family:', 'Genus:', 'Species:', 'Organism:']\n i = 0\n @gbkObj.classification.each do |taxon|\n puts classification[i] + \"\\t\" + taxon\n i += 1\n end\n puts classification[i] + \"\\t\" + @gbkObj.organism\n end", "title": "" }, { "docid": "aa8c8e200733ac62fbb7e756e0d51dd9", "score": "0.5379195", "text": "def set_university_autocomplete\n render json: @group_tags\n end", "title": "" }, { "docid": "ff9cc6a46cc94913f48379463dfd0124", "score": "0.53749967", "text": "def auto_complete_for_technician_enquiry_from\n re = Regexp.new(\"^#{params[:technician][:name]}\", \"i\")\n find_options = { :order => \"name ASC\" }\n @technicians = Technician.find(:all, find_options).collect(&:name).select { |org| org.match re }\n render :template => 'sales/auto_complete_for_technician_name',:layout=>false\n end", "title": "" }, { "docid": "a433d7134d2c39743a3984f9170184d9", "score": "0.5374419", "text": "def taxi_params\n params.require(:taxi).permit(:nombreBase, :nombreTitular, :latitud, :longitud)\n end", "title": "" }, { "docid": "b4c48a1acaa80aafb10a46dc8f9739fb", "score": "0.53701496", "text": "def data\n what = searched_for(@term)\n where = searched_in(@filter)\n {\n term: @term,\n title: (what + where).sub(/\\sin\\s|\\sfor\\s/, ''), # strip out opening ' in ' or ' for '\n cpvs: @cpvs,\n keywords: @term,\n countries: @filter.countries,\n what: what,\n where: where,\n }\n end", "title": "" }, { "docid": "ad5b76a7495cbd2d65ca861b1962873c", "score": "0.53632367", "text": "def tax\n price_as_price.tax\n end", "title": "" }, { "docid": "a563dd305f99a9d7e0e99d25562f9005", "score": "0.5361253", "text": "def auto_complete_for_ces\r\n value = params[:term]\r\n field = %w(collectors locality mthd verbatim_method macro_habitat micro_habitat).include?(params[:field]) && params[:field]\r\n\r\n if field && value\r\n @ids = Ce.select(field.downcase).where([ \"ces.proj_id = ? AND LOWER(ces.#{field.downcase}) LIKE (?)\", params[:proj_id], '%' + value.downcase + '%' ])\r\n .group(field.downcase).order(\"#{field.downcase} ASC\").limit(100).map {|v| v.send(field.downcase.to_sym)}\r\n\r\n render :json => Json::simple_autocomplete(@ids)\r\n elsif value\r\n @ces = Ce.find_for_auto_complete(value)\r\n render :json => Json::format_for_autocomplete_with_display_name(:entries => @ces, :method => params[:method])\r\n else\r\n head(:bad_request)\r\n end\r\n end", "title": "" }, { "docid": "c3f26c3ed4a3e5eecad874e3886524ac", "score": "0.53506905", "text": "def autocomplete\r\n# return '' unless session[:edit_mode] > 0 # \r\n return render text: t('drgcms.not_authorized') unless dc_user_can(DcPermission::CAN_VIEW)\r\n# TODO Double check if previous line works as it should.\r\n table = params['table'].classify.constantize\r\n id = [params['id']] || '_id'\r\n# call method in class if search parameter has . This is for user defined searches\r\n# result must be returned as array of [id, search_field_value]\r\n a = if params['search'].match(/\\./)\r\n name, method = params['search'].split('.')\r\n table.send(method, params['input']).inject([]) do |r,v|\r\n r << { label: v[0], value: v[0], id: v[1].to_s }\r\n end\r\n# simply search which will search and return field_name defined in params['search']\r\n else\r\n table.where(params['search'] => /#{params['input']}/i).limit(20).inject([]) do |r,v|\r\n r << { label: v[params['search']], value: v[params['search']], id: v.id.to_s }\r\n end\r\n end\r\n\r\n render inline: a.to_json, formats: 'js'\r\nend", "title": "" }, { "docid": "21d884ba8853e94c25508f50a60d9fa0", "score": "0.53322554", "text": "def auto_complete\n @query = params[:term] || ''\n @auto_complete = hook(:auto_complete, self, query: @query, user: current_user)\n if @auto_complete.empty?\n exclude_ids = auto_complete_ids_to_exclude(params[:related])\n @auto_complete = klass.my(current_user).text_search(@query).ransack(id_not_in: exclude_ids).result.limit(10)\n else\n @auto_complete = @auto_complete.last\n end\n\n session[:auto_complete] = controller_name.to_sym\n respond_to do |format|\n format.any(:js, :html) { render partial: 'auto_complete' }\n format.json do\n results = @auto_complete.map do |a|\n {\n id: a.id,\n text: a.respond_to?(:full_name) ? a.full_name : a.name\n }\n end\n render json: {\n results: results\n }\n end\n end\n end", "title": "" }, { "docid": "66cc0b0995b99ede165d30ee4fe46cb5", "score": "0.532755", "text": "def set_tax_information\n @tax_information = TaxInformation.find(params[:id])\n end", "title": "" }, { "docid": "20aa52ee1c61c0eadf879a468af17627", "score": "0.530953", "text": "def autocomplete_station\n term = params[:term]\n stations = Station.where('name LIKE ?', \"%#{term}%\").select(\"distinct(name)\").order(:name).limit(10)\n render :json => stations.map { |s| {:id => s.id, :label => s.name, :value => s.name} }\n end", "title": "" }, { "docid": "9b2241dddec59e5b19025dc6942382f6", "score": "0.53014654", "text": "def profile_specialist_search\n\t\t# search the the speciality name according to the terms\n\t\tspecialities = Speciality.any_of({ :name => /^#{params[:term]}/i }).all.collect{|speciality| {label: speciality.name ,value: speciality.id.to_s}}.to_json \n\t\t# render to the surgery name page\n\t\trespond_to do |format|\n\t\t format.json { render :json => specialities }\n\t\tend\n\tend", "title": "" }, { "docid": "1d967a9cec42d27b3ae20a91f0909076", "score": "0.528757", "text": "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "title": "" }, { "docid": "1d967a9cec42d27b3ae20a91f0909076", "score": "0.528757", "text": "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "title": "" }, { "docid": "a775d70edf9cad9e0b97eb768db2798e", "score": "0.52836835", "text": "def add_tax(tax)\n tax_breakdown(tax)[0]\n end", "title": "" }, { "docid": "69abb6b12cb637647abe1fcf902f447c", "score": "0.5283674", "text": "def autocomplete_clase_nombre \n respond_to do |format|\n @clases = Clase.joins(:partida_parcial => [:partida_principal]).where(\"clases.fecha_de_baja IS NULL AND clases.nombre ILIKE ?\", \"%#{params[:term]}%\").order(\"partidas_principales.codigo\").order(\"partidas_parciales.codigo\").order(\"clases.codigo\").paginate(:page => params[:page], :per_page => 30) \n render :json => @clases.map { |clase| {:id => clase.id, :label => clase.nombre, :value => clase.nombre} } \n format.js { } \n end \n end", "title": "" }, { "docid": "5770f3ff81332043d2cab683c570a9dc", "score": "0.527694", "text": "def tax\n\t\t@value * 0.16\n\tend", "title": "" }, { "docid": "59ed098a9c83f4caf82e6809535ec480", "score": "0.5273461", "text": "def tax_params\n res = ActiveModelSerializers::Deserialization.jsonapi_parse(params, {})\n end", "title": "" }, { "docid": "277a8e768c1cd6fab45dbbaff3aed1e5", "score": "0.52721924", "text": "def search_prof\n # Search for email or name of professor\n term = \"%#{params[:term]}%\"\n @users = User.all(:conditions => [\"(LOWER(first_name) LIKE LOWER(?) OR LOWER(last_name) LIKE LOWER(?) OR LOWER(email) LIKE LOWER(?)) AND role = ?\", term, term, term, \"Professor\"])\n\n # Return a JSON with \"label\" and \"value\" as key required by JQUeryUI autocomplete\n result = Array.new\n @users.each do |user| \n label = user.first_name + \" \" + user.last_name + \" - \" + user.email\n item = Hash[ \"label\" => label, \"value\" => user.email ]\n result.push item\n end\n\n render :json => result\n end", "title": "" }, { "docid": "5cb28bc7bc2177d786e599a9859a8a72", "score": "0.52685666", "text": "def autocomplete\n\t\tcond = get_search_conditions(params[:term], {\n\t\t\t'vacancies.exec_approval_no' => :like,\n\t\t\t'vacancies.org_no' => :like,\n\t\t\t'vacancies.cost_center' => :like,\n\t\t\t'vacancies.position_no' => :like,\n\t\t\t'vacancies.position' => :like,\n\t\t\t'vacancies.last_incumbent' => :like\n\t\t})\n\t\tcond << 'vacancies.exec_decision = \"Approved\"'\n\t\tuser_limited = @current_user.agency_level? && !@current_user.allow_vacancy_omb && !@current_user.allow_vacancy_admin\n\t\tagency_id = user_limited && @current_user.agency_id || params[:agency_id]\n\t\tdepartment_id = user_limited && @current_user.department_id || params[:department_id]\n\t\tdivision_id = user_limited && @current_user.division_id || params[:division_id]\n\t\tcond << 'vacancies.agency_id = %d' % agency_id.to_i if !agency_id.blank?\n\t\tcond << 'vacancies.department_id = %d' % department_id.to_i if !department_id.blank?\n\t\tcond << 'vacancies.division_id = %d' % division_id.to_i if !division_id.blank?\n\t\tobjs = @model.find(:all, :include => :vacancy_data, :conditions => get_where(cond), :limit => 10, :order => 'vacancies.id desc').map { |o|\n\t\t\to.autocomplete_json_data\n\t\t}\n\t\trender :json => objs.to_json\n\tend", "title": "" }, { "docid": "310a559c35a400a3044ae4877c71ab39", "score": "0.52569586", "text": "def tax\n Tax.find(self.tax_id)\n end", "title": "" }, { "docid": "99d1df82e17af1ba379a813ac29c11d6", "score": "0.5253538", "text": "def bioportal_form_complete options,html_options={}\n options[:value]||=\"name\"\n result = \"\"\n result += javascript_include_tag(\"bioportal_form_complete.js\") unless options[:no_javascript_include]\n\n html_options[:class]=\"bp_form_complete-#{options[:ontology_ids].join(',')}-#{options[:value]}\"\n name = options[:name]\n result += text_field_tag name,nil,html_options\n return result\n end", "title": "" }, { "docid": "fbb99fa0ecf5bdf28149da4eb16b3c4a", "score": "0.5248244", "text": "def tax_account\n customer_or_supplier \\\n proc { customer.tax_account },\n proc { supplier.input_tax_account }\n end", "title": "" }, { "docid": "f8a0c2867bf75b2b1abd1e07c54ec078", "score": "0.5240983", "text": "def tax_address\n self.ship_address || self.bill_address\n end", "title": "" }, { "docid": "743008bbc307a904235dc1c13518a5a9", "score": "0.5236557", "text": "def autocomplete(term)\n get(\"/catalog/titles/autocomplete?term=#{term}\")\n end", "title": "" }, { "docid": "20ef9f0b95f8b2a485901af5d508cf6d", "score": "0.52265376", "text": "def auto_complete_result(entries, field, phrase = nil)\n return unless entries\n render :partial => '/admin/orders/autocomplete', :locals => { :entries => entries, :field => field, :phrase => phrase }\n end", "title": "" }, { "docid": "b5587ed2df50b2dfd6368f79d394c0e0", "score": "0.52186894", "text": "def autocomplete_doctor_name\n\n if params[:term].present?\n items = get_autocomplete_items(:model => Doctor, \n :method => :name,\n :term => params[:term], \n :options => { :full => true, :where => { :hospital_id => params[:id] } })\n end\n\n render :json => json_for_autocomplete(items || {}, :name)\n end", "title": "" }, { "docid": "8348fb5eb5cc39738ed960a63fb37bc5", "score": "0.5216769", "text": "def autocomplete_name\n @tags = Tag.where([\"name ILIKE ?\", \"*#{params[:term]}*\".to_escaped_for_sql_like]).order('LENGTH(name)', :name).limit(20).pluck(:name)\n respond_to do |format|\n format.json { render :json => @tags }\n end\n end", "title": "" }, { "docid": "bce82737e8740b36be335507b903b3fd", "score": "0.52029496", "text": "def autocomplete_path ptype\n ptype && ptype.upcase == 'BUS' ? autocomplete_user_business_name_temp_listings_path : autocomplete_user_first_name_temp_listings_path\n end", "title": "" }, { "docid": "52a068be13c66906e9ee132bec3bd317", "score": "0.52014136", "text": "def taxon_params\n params.require(:taxon).permit(:name)\n end", "title": "" }, { "docid": "2e699875ec6d65c9096b7eb234e4b76e", "score": "0.5193273", "text": "def auto_complete\n @users = if params[:term] =~ /(@[^\\s]+)\\s.*/\n elsif user_name = params[:term].match(/(@[^\\s]+)/)\n users = User.select('name').where('name LIKE ?', \"%#{user_name[1].to_s[1..-1]}%\")\n\n users.map {|user| {name: \"#@{user.name}\"} }\n end\n render json: @users.to_json\n end", "title": "" }, { "docid": "7ca5209a7de90890c4b0331ccc7ede32", "score": "0.5189495", "text": "def handle_autocomplete\n if (query = request.params['q'].to_s).empty?\n ''\n else\n model.autocomplete(:type=>@subtype, :request=>request, :association=>params_association, :query=>query, :exclude=>request.params['exclude']).join(\"\\n\")\n end\n end", "title": "" }, { "docid": "24faea10334b8016257eb240532d5bf9", "score": "0.51819277", "text": "def atv2_details(firstname, lastname, email)\n firstname_field_v2.send_keys firstname\n lastname_field_v2.send_keys lastname\n email_field_v2.send_keys email\n dropdown_select\n end", "title": "" }, { "docid": "d7623fd4730cdcdd8459a38c7bd14825", "score": "0.51803577", "text": "def bu_autocomplete\n search_term = params[:term]\n\n species_id = Specie.find_by_scientificname(params[:species])\n\n cultivars = Cultivar.where(\"specie_id = ?\", species_id)\n\n logger.debug(\"cultivars for autocompletion: #{cultivars.inspect}\")\n\n filtered_cultivars = cultivars.where(\"LOWER(name) LIKE LOWER(?)\", '%' + search_term + '%')\n\n if filtered_cultivars.size > 0 || search_term.size > 1\n cultivars = filtered_cultivars\n # else if there are no matches and the user has only typed one letter, just return every cultivar associated with the chosen species\n end\n\n cultivars = cultivars.to_a.map do |item|\n item.name.squish\n end\n\n # don't show rows where name is null or empty\n # TO-DO: eliminate these from the database and prevent them with a constraint\n cultivars.delete_if { |item| item.nil? || item.empty? }\n\n if cultivars.empty?\n cultivars = [ { label: \"No matches\", value: \"\" }]\n end\n\n respond_to do |format|\n format.json { render :json => cultivars }\n end\n end", "title": "" }, { "docid": "510ce35d46e26a05f8a31c19f9120261", "score": "0.51802087", "text": "def taxpayer_more_data(taxpayer)\n return { 'ins1:Individual': taxpayer_individual_details(taxpayer) } if taxpayer.org_name.blank?\n\n { 'ins1:OrganisationContact': taxpayer_org_details(taxpayer) }\n end", "title": "" }, { "docid": "8461472efff5ec1405446f0f33689ccd", "score": "0.51774204", "text": "def show\n render json: @tax\n end", "title": "" }, { "docid": "3a6786dfd77544cabba0096c4f31a754", "score": "0.5177003", "text": "def autocomplete\n render json: Post.search(params[:query],operator: \"or\", autocomplete: true,limit: 10,boost_by_distance: {field: :location, origin: [current_user.lat, current_user.lon]}).map {|post| {title: post.title, value: post.id}}\n end", "title": "" }, { "docid": "7e8db3f89fda4d5f911ebed4100ebea0", "score": "0.51704675", "text": "def search_data\n {\n name: name,\n secondary: secondary_name,\n city: city,\n state: state\n }\n end", "title": "" }, { "docid": "afa261d726d722f60f1c943a1270a7ad", "score": "0.5167845", "text": "def setup_taxons(record, data)\n taxon_list = split_data(data)\n\n taxon_list.each do |taxon_str|\n taxon_names = taxon_str.split(/\\s*>\\s*/)\n taxonomy = Spree::Taxonomy.find_or_create_by(name: taxon_names.shift)\n parent = taxonomy.root\n associate_to_product(record, 'taxons', parent)\n\n taxon_names.each do |taxon_name|\n taxon = Spree::Taxon.find_or_create_by(name: taxon_name,\n taxonomy: taxonomy,\n parent: parent)\n associate_to_product(record, 'taxons', taxon)\n parent = taxon\n end\n end\n end", "title": "" }, { "docid": "050e1ae7f791f7746ef98effb40ce38d", "score": "0.5157722", "text": "def autocomplete\n \n @credits = Credit.select([:id, :department, :credit]).where(\"credit ILIKE ? \", \"%#{params[:filter]}%\" ).limit(params[:limit])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @credits }\n format.js\n format.json { render :json => @credits }\n end\n\n\n end", "title": "" }, { "docid": "877aabdf9f1b1b8f4bb3ccc9b4c0c14e", "score": "0.5152016", "text": "def apdata\n \"#{name_rus}, #{iata_code}, г.#{city_rus} (#{city_eng})\"\n end", "title": "" }, { "docid": "ca4dfa1f9dcedf71b1425b48b1453e9a", "score": "0.5129279", "text": "def taxes\n wizard_step(STEPS)\n end", "title": "" }, { "docid": "b2b0a4b7666120b38d267a610bb384d3", "score": "0.51112914", "text": "def tr_pq_taxes(pq)\n\t \tresponse = \"\"\n\t \titf = pq[:priced_itinerary][:air_itinerary_pricing_info][:itin_total_fare]\n\t \ttaxes = itf[:taxes][:tax_breakdown_code]\n\t \tcode_tax = itf[:taxes][:tax][:@tax_code]\n\t \tdiv_taxes = taxes.each_slice(4).to_a\n\t \tdiv_taxes.each {\n\t \t\t|ts|\n\t \t\tresponse += \"<tr>\"\n\t \t\tresponse += \"<td>#{code_tax}</td>\"\n\t \t\tts.each { |t| response += \"<td>#{t}</td>\" }\n\t \t\tresponse += \"</tr>\"\n\t \t\tcode_tax = \"\" #el codigo del impuesto solo va en la primer fila\n\t \t}\n\t \treturn response\n\t end", "title": "" }, { "docid": "c8c08f7bcb5cf3c6426b768ba6636f03", "score": "0.51029485", "text": "def findorsuggest()\n \n end", "title": "" }, { "docid": "fbaf3725ce407479a726bd10577c6648", "score": "0.5098187", "text": "def typeahead\n @users = User.search do\n fulltext params[:query] do\n fields(:bio, :name => 2.0)\n end\n order_by :id, :desc\n paginate :page => 1, :per_page => 15\n end.results.collect { |u| u.name }\n\n respond_to do |format|\n format.html #typeahead.html.erb\n format.xml { render :xml => {:options => @users} }\n format.json { render :json => {:options => @users} }\n end\n end", "title": "" }, { "docid": "ba2521185d26f4fd1f41a2ca4c0cabe4", "score": "0.50968474", "text": "def auto_complete_for_dependencies\n auto_complete_field('dependencies_input',\n { :url => { :action => 'dependency_targets' },\n :min_chars => 1,\n :frequency => 0.5,\n :indicator => 'loading',\n :after_update_element => \"addDependencyToTask\"\n })\n end", "title": "" }, { "docid": "6459b09f756dc8d83678f6af8e31aaaf", "score": "0.5096127", "text": "def tax_breakdown\n global_tax_breakdown(purchase_order_items, true)\n end", "title": "" }, { "docid": "a91eb1decf18a4aa559ec1c68d46016a", "score": "0.5096047", "text": "def setup_taxons(record, data)\n taxon_list = split_data(data)\n\n taxon_list.each do |taxon_str|\n taxon_names = taxon_str.split(/\\s*>\\s*/)\n taxonomy = Spree::Taxonomy.find_or_create_by(name: taxon_names.shift)\n parent = taxonomy.root\n associate(record, 'taxons', parent)\n\n taxon_names.each do |taxon_name|\n taxon = Spree::Taxon.find_or_create_by(name: taxon_name,\n taxonomy: taxonomy,\n parent: parent)\n associate(record, 'taxons', taxon)\n parent = taxon\n end\n end\n end", "title": "" }, { "docid": "1cb6f18b4e4395f46aa6b8e696e99870", "score": "0.5082654", "text": "def ticket_tax(accounting_element)\n\t \taccounting_element[:taxes][:tax][:@amount]\n\t end", "title": "" }, { "docid": "1c4b4f7fd050d484df85f52b65304a8c", "score": "0.5078461", "text": "def typeahead_field_tag(name, value = nil, options = {})\n data = options['data'] || {}\n data.merge! provide: 'typeahead'\n data.merge! url: options.delete(:url)\n data.merge! submit: options.delete(:submit) && 'yes'\n options['data'] = data\n\n if options['class']\n options['class'] += ' typeahead'\n else\n options['class'] = 'typeahead'\n end\n\n options['autocomplete'] = 'off'\n\n text_field_tag name, value, options\n end", "title": "" }, { "docid": "a26d7c3ad705eb63f3a4310a55714d22", "score": "0.50722206", "text": "def predictions\n raise \"Err\"\n buyer_suggestions = PropertyBuyer.suggest_buyers(params[:str]).select([:id, :name, :image_url]).limit(20)\n render json: buyer_suggestions, status: 200\n end", "title": "" }, { "docid": "b6a6eaf5f1b28df8d115c9cc8260b647", "score": "0.5059605", "text": "def set_taxon\n @taxon = Taxon.find(params[:id])\n end", "title": "" }, { "docid": "b6a6eaf5f1b28df8d115c9cc8260b647", "score": "0.5059605", "text": "def set_taxon\n @taxon = Taxon.find(params[:id])\n end", "title": "" }, { "docid": "12c8d558304807674ed40c685716dc39", "score": "0.5052482", "text": "def payment_term; end", "title": "" }, { "docid": "aedf8d3f5ab65eba041188cd4cc4342f", "score": "0.50509435", "text": "def auto_complete_for_journal_title\n # Don't search on blank query.\n query = params['rft.jtitle']\n search_type = params[\"umlaut.title_search_type\"] || \"contains\"\n unless ( query.blank? )\n (context_objects, total_count) = find_by_title\n @titles = context_objects.collect do |co|\n metadata = co.referent.metadata\n {:object_id => metadata[\"object_id\"], :title => (metadata[\"jtitle\"] || metadata[\"btitle\"] || metadata[\"title\"])}\n end\n end\n render :text => @titles.to_json, :content_type => \"application/json\"\n end", "title": "" }, { "docid": "e0ec57755277d4eeabb3397537326b7f", "score": "0.5043385", "text": "def add_tax_as_line_item\n raise unless @fields['x_tax']\n add_line_item :name => 'Total Tax', :quantity => 1, :unit_price => @fields['x_tax'], :tax => 0, :line_title => 'Tax'\n end", "title": "" }, { "docid": "e7cf842122666ce14818eb75b4bf3b51", "score": "0.5038759", "text": "def autocomplete\n all.to_a\n end", "title": "" }, { "docid": "4609bece2842143076b80a1467b54d3c", "score": "0.5037256", "text": "def taxpayer_individual_details(taxpayer)\n { 'ins1:ForeName': taxpayer.firstname, 'ins1:Surname': taxpayer.surname }\n end", "title": "" }, { "docid": "1d3fcb84db21377ace51a2bdb329c194", "score": "0.5035499", "text": "def populate_fields(target,data)\n data.each{|key,value|target.text_field(:name=>key).set value}\nend", "title": "" }, { "docid": "55aa9d664bc73291cc3b2a239178cc0f", "score": "0.50306046", "text": "def search_data\n attributes.merge(\n places_city: places.map(&:city),\n places_country: places.map(&:country),\n places_state: places.map(&:state)\n )\n end", "title": "" }, { "docid": "29b6c45ef2cb5413ac58d810a577c817", "score": "0.5024192", "text": "def getTaxAddress property\n\t\tarr = []\n\t\taddray = property[:taxAddr].split\n\t\tarr << (addray[0...-3].join \" \")\n\t\tarr << addray[-3]\n\t\tarr << addray[-2]\n\t\tarr << addray[-1]\n\t\tarr << property[:owns]\n\t\tarr << property[:owner]\n\t\tarr\n\tend", "title": "" }, { "docid": "a6d360baa3bdba0edf9d086f6112bc3b", "score": "0.5021048", "text": "def index\n @taxons = Taxon.all\n end", "title": "" }, { "docid": "ba27a9881b690c2c204104917c4a361f", "score": "0.5018984", "text": "def tax_params\n params.require(:tax).permit(:tax_name, :description, :percentage, :tax_category, :tax_type_id, :organization_id, :child_tax=>[])\n end", "title": "" } ]
debf53aeebe786dce90072675fb3609e
Site Alerts Deletes all alerts from the site.
[ { "docid": "2df518f41f475de97d2f81e0c0e187f0", "score": "0.62168604", "text": "def delete_all_site_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.delete_all_site_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "7876e6527e191d11e988dd89ec908e3f", "score": "0.7425809", "text": "def delete_all_site_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_alerts_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "8d62fc80edfaf6ffe9231b534b6836aa", "score": "0.73131776", "text": "def delete_all_site_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_alerts_with_http_info(id, opts)\n return data\n end", "title": "" }, { "docid": "403c460eaed06f463ea6733415f5c611", "score": "0.70496887", "text": "def delete_all_site_smtp_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_smtp_alerts_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "a3404592606017d6bde34d9aedad8b58", "score": "0.6918777", "text": "def delete_all_site_smtp_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_smtp_alerts_with_http_info(id, opts)\n return data\n end", "title": "" }, { "docid": "b9abd5cd78100a1f2ed015f017b04999", "score": "0.6903962", "text": "def delete_all_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_snmp_alerts_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "f30e76829a4e518c254eddbd54d01697", "score": "0.67823786", "text": "def delete_all_site_snmp_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_snmp_alerts_with_http_info(id, opts)\n return data\n end", "title": "" }, { "docid": "1ecb5a68acccad9ffce77998136eb964", "score": "0.6736394", "text": "def delete_all_site_syslog_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_syslog_alerts_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "8bab9e853115b97e70a394d05607bc6a", "score": "0.6691412", "text": "def clear_alerts\n @alerts = []\n @model_status = :okay\n end", "title": "" }, { "docid": "e83e5ebc072e40041665c7df80e90a54", "score": "0.66042304", "text": "def delete_all_site_syslog_alerts(id, opts = {})\n data, _status_code, _headers = delete_all_site_syslog_alerts_with_http_info(id, opts)\n return data\n end", "title": "" }, { "docid": "8a10eaba171f0be2871ab3eea0fc9030", "score": "0.63655055", "text": "def destroy\n @alert.destroy\n end", "title": "" }, { "docid": "43728b65d462fa6995b6b06475e82ef7", "score": "0.6358394", "text": "def user\n @alerts = Alert.where(:user_id => params[:id])\n @alerts.each { |alert| alert.delete }\n render :index\n end", "title": "" }, { "docid": "8d4f97806b0bdd68480e420735bd2319", "score": "0.6201467", "text": "def delete_all_site_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.delete_all_site_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "164ec686d4d71c6ab44444b79c0ecf3d", "score": "0.6161702", "text": "def pause_all_alerts\n\n endpoint = '/api/admin/pause-all-alerts'\n logger.debug(\"pause all alerts (POST #{endpoint})\") if @debug\n\n post( endpoint, nil )\n end", "title": "" }, { "docid": "957134d0f09eabf7f968a20e1b965244", "score": "0.60102355", "text": "def destroy\n Site.delete_all \"sitename = 'lost+found'\" \n super\n end", "title": "" }, { "docid": "d5ec0f2d642775cea5ec0d86aa3251ff", "score": "0.59953916", "text": "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to admins_event_alerts_path(@current_event), notice: t(\"alerts.destroyed\") }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fb8bb8ad1c5fe53ffaf19144c829bea4", "score": "0.59083456", "text": "def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to(alerts_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "bc0620139d39f74f728983a5445bda80", "score": "0.5906507", "text": "def delete_all_site_smtp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.delete_all_site_smtp_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_smtp_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/smtp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_smtp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "d1e6638423bb7ab8a8ea3fb4081b9a09", "score": "0.5893038", "text": "def delete_all_site_smtp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.delete_all_site_smtp_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_smtp_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/smtp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_smtp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "6cdd22b1cc5f8a04930a7ad2858d5786", "score": "0.58873385", "text": "def index\r\n @notifications = current_user.alerts.paginate(page: params[:page])\r\n current_user.reset_alerts\r\n end", "title": "" }, { "docid": "9eca58a266a4e3412e1fbb40ae2baa55", "score": "0.5869202", "text": "def destroy\n if current_user.is_admin\n @user_alert = UserAlert.find(params[:id])\n @user_alert.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_alerts_url) }\n format.xml { head :ok }\n end\n else\n redirect_to new_session_path\n end\n end", "title": "" }, { "docid": "8e06c13218bea2722f595ff4a0e44c15", "score": "0.5847194", "text": "def destroy\n @alert.destroy(alert_params)\n redirect_to alerts_url, :notice => \"Alert Deleted!\"\nend", "title": "" }, { "docid": "d83439bcb1d23b9a3144fa1b113b2ccc", "score": "0.5828628", "text": "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "03dc56c8d96025f5aeee1f68fb8e8c3e", "score": "0.58153665", "text": "def delete_all_reports!\n reports=get_report_list\n reports.each do |rep|\n rep[:ReportID]\n delete_report(rep[:ReportID])\n end\n end", "title": "" }, { "docid": "5ef7b8b284e894409ed06369e5c5d22a", "score": "0.57683784", "text": "def destroy\n @user = User.find(params[:id])\n #@user.alerts.destroy_all # achived by seting \",:dependent => :destroy\" to has_many :alerts in User model, this automatically destroy user's alerts when user is deleted.\n @user.destroy\n redirect_to genres_path\n end", "title": "" }, { "docid": "7f50d2697e568d435d7e3b7282a30327", "score": "0.5747098", "text": "def destroy\n @site.destroy\n redirect_to admin_sites_url, notice: t('admin.destroy.success')\n end", "title": "" }, { "docid": "8b57ea8b193900e576e4b87e2d0f72d9", "score": "0.5743283", "text": "def destroy_all\n unless current_user.nil?\n #current_user.events.delete_all # why this line doesn't work on production, seriously?\n Event.delete_all(user_id: current_user.id)\n redirect_to :back, notice: \"All events have been deleted.\"\n else\n redirect_to :back, alert: \"Deleting an event is restricted to logged-in users.\"\n end\n end", "title": "" }, { "docid": "8667475ca316733be5fc44bbc99417e2", "score": "0.569638", "text": "def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to alerts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8667475ca316733be5fc44bbc99417e2", "score": "0.5695091", "text": "def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to alerts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7fba944076e3d66dbbad3bbe3c5b87f9", "score": "0.5689791", "text": "def destroy\n @agendasalerta = Agendasalerta.find(params[:id])\n @agendasalerta.destroy\n\n respond_to do |format|\n format.html { redirect_to(agendasalertas_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "08d26dece25ccab3f03b1d8a9d3b5d07", "score": "0.5668961", "text": "def destroy\n @alert_email = AlertEmail.find(params[:id])\n @alert_email.destroy\n\n respond_to do |format|\n format.html { redirect_to(alert_emails_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "3c7c580229fec7598b4741212e670938", "score": "0.56002027", "text": "def destroy\n @item_alert = ItemAlert.find(params[:id])\n @item_alert.destroy\n authorize! :delete, @item_alert\n\n respond_to do |format|\n format.html { redirect_to item_alerts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "34bc36bd60babe1cf4ab49eb3dc8122d", "score": "0.5585092", "text": "def index\n @alerts = Alert.all\n end", "title": "" }, { "docid": "34bc36bd60babe1cf4ab49eb3dc8122d", "score": "0.5585092", "text": "def index\n @alerts = Alert.all\n end", "title": "" }, { "docid": "34bc36bd60babe1cf4ab49eb3dc8122d", "score": "0.5585092", "text": "def index\n @alerts = Alert.all\n end", "title": "" }, { "docid": "52966f2826f5a5124f2d6ebe25e0d374", "score": "0.5584794", "text": "def destroy\n @sms_alert.destroy\n redirect_to account_path(@account), notice: 'Sms alert was successfully destroyed.'\n end", "title": "" }, { "docid": "64eb6e228e9b5ae84321e938f6e7509c", "score": "0.55733716", "text": "def delete_all_site_snmp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.delete_all_site_snmp_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_snmp_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/snmp\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_snmp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a30219d0057ed06d84809ebc26c7990c", "score": "0.55608207", "text": "def delete(alerter)\n Log4JLogger.logger(self.name).info \"Deleting alert #{alerter.id} from pattern #{alerter.pattern_name}\"\n alerter.shutdown_monitor(alerter.pattern)\n if @alerters.include?(alerter)\n Log4JLogger.logger(self.name).info \"Removing stored alert file for #{alerter.id}\"\n File.delete(make_filename(alerter))\n @alerters.delete(alerter)\n end\n end", "title": "" }, { "docid": "8f9c6922a752d22b915c823cf960df38", "score": "0.55598307", "text": "def delete_all_site_snmp_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.delete_all_site_snmp_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_snmp_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/snmp'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_snmp_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "7edd3dd99cd229763c2bcb28e1fcd044", "score": "0.55185866", "text": "def delete_all_site_syslog_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.delete_all_site_syslog_alerts ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_syslog_alerts\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/alerts/syslog\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_syslog_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "15c6e429e97798c35c4ae0e79e2f8324", "score": "0.55181587", "text": "def delete_all_events\n doc = {}\n attach_user_id doc\n attach_storage_id doc\n\n Event.delete_all(doc)\n end", "title": "" }, { "docid": "c80379e67673031f4a908921644accb6", "score": "0.5510912", "text": "def delete_all_site_syslog_alerts_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.delete_all_site_syslog_alerts ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.delete_all_site_syslog_alerts\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/alerts/syslog'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, 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 => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#delete_all_site_syslog_alerts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "44ae2b053e04d7c08fcdb5bed61fa53f", "score": "0.55072707", "text": "def destroy\n @alert = Alert.find(params[:id])\n @alert.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "11aae017ddfff2d7729008cd5a26099b", "score": "0.54956776", "text": "def delete_all\n\t Bill.delete_all\n\t Cosponsorship.delete_all\n\t Representative.delete_all\n\t Event.delete_all\n\t RollCall.delete_all\n\t redirect_to :action => \"index\"\n\tend", "title": "" }, { "docid": "3910252ceec5bdb1c7efdde76407d910", "score": "0.5488636", "text": "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_url, notice: 'Alert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3910252ceec5bdb1c7efdde76407d910", "score": "0.5488636", "text": "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_url, notice: 'Alert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6fa38ad15a0d737a9a5330676e4bdef0", "score": "0.5481771", "text": "def delete_all\n refresh_index!\n Elasticsearch::Persistence.client.delete_by_query(\n index: alias_name,\n conflicts: :proceed,\n body: { query: { match_all: {} } }\n )\n end", "title": "" }, { "docid": "9769d85ab5bc0c3cee87eaba6f66e850", "score": "0.5481314", "text": "def delete_all_cookies\n $LOG.info \"deleting all cookies\"\n begin\n $driver.manage.delete_all_cookies\n rescue Exception => e\n $LOG.error \"error in deleting cookies :: \" +e.message\n raise \"error in deleting cookies :: \" +e.message\n end\n end", "title": "" }, { "docid": "32a9222f56dfe97b90412511973a7d6b", "score": "0.54778665", "text": "def destroy\n @email_alert.destroy\n respond_to do |format|\n format.html { redirect_to email_alerts_url, notice: 'Email alert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "acaf68eff5309150cb9459cdca8c5a59", "score": "0.5466299", "text": "def destroy\n @alert.destroy\n respond_to do |format|\n format.html { redirect_to alerts_url, notice: \"Alert was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7d070b176c0fec96780ea32fc593cb28", "score": "0.5459435", "text": "def destroy\n load_alert\n return if (@alert.blank?)\n\n respond_to do|format|\n format.html{\n # The alert can be destroyed?\n if (@alert.destroy)\n flash[:notice] = t(\"alerts.notice.destroyed\", :name => @alert.name)\n redirect_to alerts_path()\n else\n flash[:error] = t(\"alerts.error.not_destroyed\", :name => @alert.name)\n redirect_to alert_path(@alert)\n end\n return\n }\n end\n end", "title": "" }, { "docid": "2b2fe9d977f14c2b24ebeaac2d3266ff", "score": "0.5453901", "text": "def delete_all\n start do |pop3|\n unless pop3.mails.empty?\n pop3.delete_all\n pop3.finish\n end\n end\n end", "title": "" }, { "docid": "03182b9299547842d98204ac7df29020", "score": "0.5452528", "text": "def alerts\n @alerts ||= []\n end", "title": "" }, { "docid": "240b519306c166d399fe79c15404c45e", "score": "0.54507595", "text": "def deleteAll\n Record.destroy_all()\n redirect_to(records_path)\n end", "title": "" }, { "docid": "4e6ee630ac774c1794fd5d70499d4f96", "score": "0.5441249", "text": "def disable_all_alerts\n self.service_subscriptions.each do |subscription|\n subscription.update_attribute :sms_enabled, false\n subscription.update_attribute :email_enabled, false\n end\n end", "title": "" }, { "docid": "6ecb71d7a3f21494a5dc38fc731f5125", "score": "0.54353476", "text": "def remove_weekly_alerts_if_genre_all_edit \n WeeklyAlert.destroy_all([\"id != ? AND user_id = ?\" , id, user_id]) if Genre.find(genre_id).name == \"all\"\n end", "title": "" }, { "docid": "236232aeae82147b5790f5e6f8a27d43", "score": "0.54338115", "text": "def clear_domains\n clear_all_dependencies\n puts \"All domains removed from the monitoring list\"\n end", "title": "" }, { "docid": "16ccac465702674ba37743913d021512", "score": "0.5428433", "text": "def delete_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]'\n\t\targs[:query]['Action'] = 'DeleteAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "title": "" }, { "docid": "281141f819b70c2b6d480ed3be3caf7a", "score": "0.54085195", "text": "def delete_site_syslog_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_syslog_alert_with_http_info(id, alert_id, opts)\n data\n end", "title": "" }, { "docid": "7d1c0f7c27194004ab42b10d8785d65f", "score": "0.53891003", "text": "def remove_all_triggers!\n client.triggers.results.sort_by { |f| [f[\"triggerName\"], f[\"className\"]] }.each do |f|\n next unless f[\"url\"].present?\n triggerName = f[\"triggerName\"]\n className = f[Parse::Model::KEY_CLASS_NAME]\n client.delete_trigger triggerName, className\n yield(f[\"triggerName\"], f[Parse::Model::KEY_CLASS_NAME]) if block_given?\n end\n end", "title": "" }, { "docid": "ebd5ea934a277c4cb670c1def22ce4fa", "score": "0.5382003", "text": "def clear_administrator_accounts\n Administrator.destroy_all\n end", "title": "" }, { "docid": "476e1493aed5360d7be9026264bfed3f", "score": "0.53776944", "text": "def delete_dashboards\n Dashboard.all.map { |data| Dashboard[data['link']] }.each { |d| d.delete }\n end", "title": "" }, { "docid": "6c04cbd0aa96d1ffc8d5fe00bf5c1c43", "score": "0.53763646", "text": "def destroy\n @alert_trigger_type = AlertTriggerType.find(params[:id])\n @alert_trigger_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_alert_trigger_types_path) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e10f9b4f03eace8c6eb82e8f3241f1c3", "score": "0.5372231", "text": "def delete_all_expired_for(time)\n expired_for(time).delete_all\n end", "title": "" }, { "docid": "ea2c6f39a0a378557c404e1468838366", "score": "0.53590775", "text": "def delete_site_syslog_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_syslog_alert_with_http_info(id, alert_id, opts)\n return data\n end", "title": "" }, { "docid": "6c781fa1a247a874077a7e2b773510a0", "score": "0.5351814", "text": "def clear\n if in_alert?\n self.status = 'clear_new'\n log('info', 'Asq alert has cleared')\n elsif operational_error?\n self.status = 'clear_new'\n log('info', 'Asq operational error has cleared')\n else\n self.status = 'clear_still'\n # self.result = ''\n self.related_tickets = nil\n finish_refresh\n end\n end", "title": "" }, { "docid": "16da08e6a0a5e9a339201cbf6d6d7a46", "score": "0.5338686", "text": "def index\n # @alerts = Alert.all\n @user = User.find(session[:id])\n @alerts = @user.alerts\n end", "title": "" }, { "docid": "15bdb1748210bcbe9d6822aac292576c", "score": "0.5321409", "text": "def remove_all\n Measure.delete_all\n flash[:notice] = \"You have removed all measurements!\"\n redirect_to measures_path\n end", "title": "" }, { "docid": "b3598df17259ff40a2736745aba13e3d", "score": "0.5314718", "text": "def clear_all\n Test.all.each do |test|\n test.clear_all\n test.save\n end\n \n redirect_to admin_root_path\n end", "title": "" }, { "docid": "560cf4b6a38ef2b6df6774f83d7e8e6c", "score": "0.53086114", "text": "def destroy\n @website.destroy\n respond_to do |format|\n format.html { redirect_to(contact_info_admin_websites_url) }\n format.xml { head :ok }\n end\n add_log(user: current_user, action: \"Deleted website: #{@website.url}\")\n end", "title": "" }, { "docid": "ed3bb7fcac3356b7e154d928735417ed", "score": "0.5301878", "text": "def destroy\n @site_appraisal.destroy\n respond_to do |format|\n format.html { redirect_to site_appraisals_url, notice: \"Site appraisal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1fc7d9efca82c5bb17cdf536014cc03a", "score": "0.5301851", "text": "def delete_all(date = Date.today)\n delete(date.strftime(@request_path))\n end", "title": "" }, { "docid": "020eab41cc779fcf7740666ec183b6ab", "score": "0.52964634", "text": "def cleanup\n site_cleaner.cleanup!\n nil\n end", "title": "" }, { "docid": "70fb5c37a11dc4b92ec906a3edf5b082", "score": "0.52896607", "text": "def alert_close\n MenuControllerContracts.invariant(self)\n @alert_view = nil\n MenuControllerContracts.invariant(self)\n end", "title": "" }, { "docid": "1eb603f122fb8e53bb7cc70dd590d21d", "score": "0.5285676", "text": "def unsubscribe_all\n send_action('unsubscribe_all')\n end", "title": "" }, { "docid": "fda5f38228fb5a3f377920e7c0032129", "score": "0.52807474", "text": "def purge_expired_schedules\n _schedules = Schedule.where('student_id = ? AND end_date < ?', @student.id, Date.today)\n _schedules.each {|s| s.destroy}\n\n redirect_to @student, notice: 'Expired schedules have been deleted'\n end", "title": "" }, { "docid": "53138e679a8f9220466ca9051dc6c05a", "score": "0.52796096", "text": "def host_delete_all(hosts = @hosts_delta)\n hosts.each do |host|\n host_delete(host)\n unmanage_host(host)\n end\n end", "title": "" }, { "docid": "ee258cc95d862c1e7590e9fc1a130f76", "score": "0.52795833", "text": "def destroy\r\n @patient_alert = PatientAlert.find(params[:id])\r\n @patient_alert.destroy\r\n get_patient_by_alert\r\n APP_LOGGER_LOG.info \"ALERT DELETED - for PATIENT ID \" + \r\n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\r\n \r\n respond_to do |format|\r\n format.html { redirect_to(patient_alerts_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "title": "" }, { "docid": "3d0d6d570da8e2c4421c72e899f5a0a6", "score": "0.5272001", "text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to xmt_press_sites_url, notice: '站点删除成功.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b7fcb4b5d0efa9f575bb5e6aaa8b5c73", "score": "0.52662045", "text": "def destroy\n @vip_email.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_emails_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted a amx vip email: #{@vip_email.email}\")\n end", "title": "" }, { "docid": "eaa181bfaec2d8d9ff899dad012bf1ea", "score": "0.5263281", "text": "def destroyAll\n Staging.all.each do |staging|\n\tStaging.destroy(staging)\n end\n\tredirect_to :action => 'index'\n end", "title": "" }, { "docid": "0d04ffb1dca5d1aafcb6632d5604e1ba", "score": "0.5261886", "text": "def delete_site_snmp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_snmp_alert_with_http_info(id, alert_id, opts)\n data\n end", "title": "" }, { "docid": "f95cc719f02b7d84d490c15487db0307", "score": "0.52556396", "text": "def destroy\n @parsed_site.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "a6385830e0dc214308c59dd4592046b5", "score": "0.5246896", "text": "def destroy_all\n posts = current_user.posts\n\n posts.each do |post|\n post.destroy\n end\n\n redirect_to posts_url, :notice => \"Destroyed all Posts.\"\n end", "title": "" }, { "docid": "1101ad34f03ddce62d22897223357265", "score": "0.5241084", "text": "def destroy\n if @site.columns.size > 0\n flash[:error] = \"该站点存在多个栏目,不能删除\"\n else\n delete_file(@site.logo_file) if [email protected]_file.blank?\n @site.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to cms.sites_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2cf96dda0a514d37c97c3a4d28016253", "score": "0.52397853", "text": "def delete_site_snmp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_snmp_alert_with_http_info(id, alert_id, opts)\n return data\n end", "title": "" }, { "docid": "f90644bf09e40832e33042a1ddd4d053", "score": "0.52372694", "text": "def purge_associations\n EspRulesList.where(list_type: type, list_id: id).delete_all\n ExportedLead.where(list_type: type, list_id: id).delete_all\n MessageAutoResponse.where(esp_list_type: type, esp_list_id: id).delete_all\n end", "title": "" }, { "docid": "0b40906f75d64c7a449058b79c6194d9", "score": "0.52349436", "text": "def get_site_alerts(id, opts = {})\n data, _status_code, _headers = get_site_alerts_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "047d7de885fcad6e1234bf0cdda1137f", "score": "0.5234075", "text": "def delete_all\n records.clear\n end", "title": "" }, { "docid": "92f9fb1354d7635609f4bcf8476e7025", "score": "0.5233605", "text": "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to after_destroy_path, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1b9edfec7f0118d2c2959b266b4bdffc", "score": "0.5207395", "text": "def clear_all\n clear\n clear_stored_requests\n end", "title": "" }, { "docid": "2c3e86f8791315811d579948e1e89a3c", "score": "0.52026623", "text": "def index\n @sleep_alerts = SleepAlert.all\n end", "title": "" }, { "docid": "858553d88598bbf0ef1b1e7ca794f416", "score": "0.5198266", "text": "def deleteAllEmail\n queryParams = Hash.new\n queryParams['key'] = @API_KEY\n queryParams['mailbox'] = @MAILBOX\n RestClient.post(\"#{@BASE_URI}/emails/deleteall\", nil, {:params => queryParams})\n end", "title": "" }, { "docid": "3f90f5a1031794b3ec8fa8a1f79a28b4", "score": "0.51937723", "text": "def purge\n i = 0\n debug \"Purge events on GCal... \"\n g_cal.events_all.each do |e|\n next if e.status == 'cancelled'\n debug \"Delete: #{e}\"\n e.delete\n i += 1\n end\n debug \"Done. #{i} event(s) deleted.\"\n i\n end", "title": "" }, { "docid": "9b1cc4af105bc096c86951450801b7d1", "score": "0.51926684", "text": "def destroy_all\n destroy_users\n puts \"Destroyed users\"\n destroy_comments\n puts \"Destroyed comments\"\n destroy_costs\n puts \"Destroyed costs\"\n destroy_service_locations\n puts \"Destroyed service locations\"\n destroy_service_contacts\n puts \"Destroyed service contacts\"\n destroy_services\n puts \"Destroyed services\"\n destroy_service_types\n puts \"Destroyed service types\"\n destroy_locations\n puts \"Destroyed locations\"\n destroy_contacts\n puts \"Destroyed contacts\"\n destroy_categories\n puts \"Destroyed categories\"\n end", "title": "" }, { "docid": "2983707bb52956dfd1ca356ba33519ca", "score": "0.5190929", "text": "def destroy\n @site = Site.find(params[:id])\n \n if @site.uninstall(@site) == true \n puts \"\\n\\n\\n----------- DESTROYED -----------\\n\\n\\n\"\n puts \"SITE = #{@site.name}\"\n @site.destroy\n @site.save\n \n respond_to do |format|\n format.html { redirect_to(sites_url, :notice => \"Your site was successfully deleted.\") }\n format.xml { head :ok }\n end\n else\n redirect_to(@site, :warning => \"Remove site incomplete!. Please contact administrator.\")\n end\n end", "title": "" }, { "docid": "025ab090790fd5413fb860d8e83b6e70", "score": "0.51877147", "text": "def clear\n validate_arguments!\n action(\"Removing all domain names from #{app}\") do\n api.delete_domains(app)\n end\n end", "title": "" }, { "docid": "b9e1d7ef4957f588d8f29fb381266061", "score": "0.5185211", "text": "def delete_all_site_scan_schedules(id, opts = {})\n data, _status_code, _headers = delete_all_site_scan_schedules_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "1a63bffb68aaf3805bab8e216d8916c7", "score": "0.5183434", "text": "def destroy_all_allocations\n school_room_id = SchoolRoom.find(params[:id]).id\n allocations_sh = Allocation.where(school_room_id: school_room_id)\n allocations_sh.each(&:destroy)\n flash[:success] = 'Desalocação feita com sucesso'\n redirect_to allocations_destroy_path(school_room_id)\n end", "title": "" }, { "docid": "1d2bd1f590d95c445aefbbf27981a97f", "score": "0.5178832", "text": "def delete_site_smtp_alert(id, alert_id, opts = {})\n data, _status_code, _headers = delete_site_smtp_alert_with_http_info(id, alert_id, opts)\n data\n end", "title": "" }, { "docid": "fcb43196f533c8b00f0a5884a56b8e20", "score": "0.51653016", "text": "def clear_emails\n ActionMailer::Base.deliveries = []\n end", "title": "" } ]
3c28dd54172d6b72c1b373fa93c07b85
Overrides the +version_attributes+ method to include label passed into the parent object, by way of a +commit_label+ attr_accessor.
[ { "docid": "5a0b91449910c742fd9ffcff801b2def", "score": "0.87120295", "text": "def version_attributes\n super.merge(:commit_label => commit_label)\n end", "title": "" } ]
[ { "docid": "1947933efc2ecef331057968e9903d96", "score": "0.61617595", "text": "def attributes_for_version\n versioned_attributes_from_object(self)\n end", "title": "" }, { "docid": "f14760f1485ea18387da3dea87d64c17", "score": "0.58723277", "text": "def version_attributes\n attributes = super\n\n if @reverted_from.nil?\n attributes\n else\n attributes.merge(:reverted_from => @reverted_from)\n end\n end", "title": "" }, { "docid": "878cba03af36221278d27e29c0102d74", "score": "0.57622033", "text": "def version_attributes\n super.merge(:user => updated_by)\n end", "title": "" }, { "docid": "8cba37a636cf4bfda6a92c632c0f5a35", "score": "0.56888473", "text": "def attributes(new_attrs)\n @new_attrs = new_attrs.symbolize_keys\n attrs = original_attributes.merge(@new_attrs.merge({\n is_current_version: true,\n id: @record.id,\n version: @record.version + 1\n }))\n end", "title": "" }, { "docid": "c7ec5732fe1a9f0170860c1aa8f19549", "score": "0.55535996", "text": "def attributes\n {\n branch: to_s,\n status: status,\n release_date: release_date,\n eol_date: eol_date,\n latest: latest.to_s,\n releases: releases.map(&:to_s)\n }\n end", "title": "" }, { "docid": "591ae946ead9abf908152a24f72b7254", "score": "0.553451", "text": "def bt_versioned_attributes\n attributes.slice(*self.class.bt_versioned_columns)\n end", "title": "" }, { "docid": "a328e4cd6f1a95fcc9611bc52fcd1f12", "score": "0.5382495", "text": "def versioned_attributes\n versioned_columns.map { |attr| [attr, send(attr)] }.to_h.with_indifferent_access\n end", "title": "" }, { "docid": "efe81c345bafbe140b1bb64fe1d791b2", "score": "0.5381711", "text": "def bt_new_version(attributes={})\n self.class.new(bt_value_attributes) do |rec|\n rec.bt_attributes = attributes\n rec.vtstart_at ||= vtstart_at\n rec.vtend_at ||= vtend_at\n end\n end", "title": "" }, { "docid": "76dcd9a8217dcffa6ce0581d5142e217", "score": "0.5380607", "text": "def attributes\n {\n release: to_s,\n branch: branch.to_s,\n status: status,\n release_date: release_date,\n latest: latest?,\n prerelease: prerelease?\n }\n end", "title": "" }, { "docid": "3a541b89b2a9e5ae5890313145662919", "score": "0.5368276", "text": "def versioning(*fields, &block)\n return unless ActsLikeGit.versioning_enabled?\n \n include Callbacks, Git, VersionMethods\n ActsLikeGit.all_versioned_models |= [self.name] if ActsLikeGit.all_versioned_models\n \n self.git_settings ||= ModelInit.new(self, &block)\n git_settings.versioned_fields = [fields].flatten\n\n # Make sure we load all the methods, as well as any permalink-fu overriding of methods.\n define_attribute_methods\n \n self.git_settings.versioned_fields.each do |column|\n git_read_method = \"def #{column}; read_git_method('#{column}'); end\" \n generated_attribute_methods.module_eval(git_read_method, __FILE__, __LINE__)\n \n git_write_method = \"def #{column}=(val); write_git_method('#{column}', val); end\" \n generated_attribute_methods.module_eval(git_write_method, __FILE__, __LINE__)\n end\n \n after_save :git_commit\n after_destroy :git_delete\n end", "title": "" }, { "docid": "2ec3a10b82dd652e5134e8b0319eacdb", "score": "0.5327", "text": "def version_attribute(attributes)\n attributes.delete(version_field)\n end", "title": "" }, { "docid": "3a2e4e8201efab326a6f76eb48d8cf1f", "score": "0.5197442", "text": "def build_version(new_attrs = {})\n new_version = self.class.new(new_version_attrs(new_attrs)).tap do |built|\n built.deprecate_old_versions_after_create!\n preserve_has_one_associations_to(built) \n end\n end", "title": "" }, { "docid": "c41f621c496112806922d237203b86bb", "score": "0.51801693", "text": "def merge_attributes(child, parent_attributes); end", "title": "" }, { "docid": "64d041b7cd0dd7ac0330e13b8fac8044", "score": "0.5111074", "text": "def context_with_attributes(attributes_hash, parent_context: Context.current)\n attributes_hash = attributes(parent_context).merge(attributes_hash)\n parent_context.set_value(CURRENT_ATTRIBUTES_HASH, attributes_hash)\n end", "title": "" }, { "docid": "aefc36ccc6fb5e3d9bcfa534d3d24d76", "score": "0.50742435", "text": "def git_attributes\n {\n name: \"full_name\",\n homepage: \"homepage\",\n last_commit: \"pushed_at\",\n forks_count: \"forks_count\",\n stargazers_count: \"stargazers_count\",\n watchers_count: \"subscribers_count\",\n open_issues_count: \"open_issues_count\",\n }\n end", "title": "" }, { "docid": "acaf7caed91f90b97fec91a1ccb00c7b", "score": "0.5058661", "text": "def attributes\r\n unless @stop_merging_translated_attributes || @attributes.frozen?\r\n @attributes.merge! translated_attributes\r\n end\r\n super\r\n end", "title": "" }, { "docid": "a5c3430fd1ba7390dec1b84e6a90384e", "score": "0.50559914", "text": "def git_attributes\n {\n name: \"full_name\",\n homepage: \"homepage\",\n last_commit: \"pushed_at\",\n forks_count: \"forks_count\",\n stargazers_count: \"stargazers_count\",\n watchers_count: \"watchers_count\",\n open_issues_count: \"open_issues_count\",\n }\n end", "title": "" }, { "docid": "c1e1724b7012a747b05e2dc0ddd8ed97", "score": "0.50368315", "text": "def git_commit\n init_structure\n sha = add_all_changes_to_git\n \n if self.attributes.has_key?(\"version\") \n self.version = sha\n self.connection.update(\"UPDATE #{self.class.table_name} SET version='#{sha}' WHERE id='#{self.id}'\")\n end\n \n return sha\n end", "title": "" }, { "docid": "f1b4c2f2aaab213b891cdc948d2bb0ce", "score": "0.5017526", "text": "def update!(**args)\n @label = args[:label] if args.key?(:label)\n @version = args[:version] if args.key?(:version)\n end", "title": "" }, { "docid": "2af8fa2d09ac316851e6d95ca35b29ce", "score": "0.49438184", "text": "def model_attributes\n super.merge(\n viewmodel: ->(_v) {\n self.schema_version = 2\n migrates from: 1, to: 2 do\n down do |view, refs|\n view.delete('child')\n end\n end\n })\n end", "title": "" }, { "docid": "4be9fabd16497cb1e7aae9badf8fa347", "score": "0.49309924", "text": "def set_version_by_git!\n return unless use_git?\n\n if attr[:github] && !attr[:git_repository]\n default_attr.git_repository = \"https://github.com/#{attr[:github]}.git\"\n end\n\n unless attr[:git_branch]\n default_attr.git_branch = 'master'\n end\n\n unless attr[:version]\n default_attr.version =\n case\n when attr[:git_commit]\n attr.git_commit[/\\A[\\da-f]{7}(?=[\\da-f]{33}\\z)/] || attr.git_commit\n when attr[:git_tag]\n attr.git_tag\n else\n # TODO: independent from git command\n result = `git ls-remote --heads #{attr.git_repository} refs/heads/#{attr.git_branch}`\n unless hash = result[/\\A[\\da-f]{7}(?=[\\da-f]{33}\\b)/]\n raise \"cannot find #{attr.git_branch} in #{attr.git_repository}\"\n end\n hash\n end\n end\nend", "title": "" }, { "docid": "3c8e01615152a20fcc14701e39ab5863", "score": "0.49194834", "text": "def base_attributes\n kind.attributes\n end", "title": "" }, { "docid": "18e690119ed335562917e274a55abac4", "score": "0.49026254", "text": "def child_attributes\n super.merge(\n schema: ->(t) { t.references :child, foreign_key: true },\n model: ->(m) {\n belongs_to :child, inverse_of: :parent, dependent: :destroy\n has_one :parent, inverse_of: :child, class_name: self.name\n },\n viewmodel: ->(_v) {\n self.schema_version = 2\n association :child\n migrates from: 1, to: 2 do\n down do |view, refs|\n view.delete('child')\n end\n end\n })\n end", "title": "" }, { "docid": "0531ef1b7e09c4eef1e3e7075ab50975", "score": "0.4891689", "text": "def at_version_arg(parent)\n # TODO: remove coercion when the compatibility layer is removed\n # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883\n version_id = ::Gitlab::Graphql::FindArgumentInParent.find(parent, :at_version, limit_depth: 4)\n version_id &&= VersionID.coerce_isolated_input(version_id)\n version_id\n end", "title": "" }, { "docid": "e3683219f74646920d411e6a20d3a094", "score": "0.48863155", "text": "def versioned_attributes_from_object(object)\n self.class.versioned_columns.inject({}){|attrs, col| attrs[col] = object.send(col); attrs }\n end", "title": "" }, { "docid": "3bcd84d298d8d7300c425a037a451d63", "score": "0.48660746", "text": "def save_version_on_create\n\t\t\t\t\t$TRACE.debug 9, \"save_version_on_create, changed_attributes = #{changed_attributes_aado.inspect}\"\n\t\t\t\t\tif self.database_object then\n\t\t\t\t\t\tself.database_object.save_version_on_create(self.id)\n\t\t\t\t\t\t\n\t\t\t\t\t\tsave_version if save_version?\n\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "6e0fc98cf66fc81e60d241757d1b9b24", "score": "0.48623848", "text": "def label(label = nil, &block)\n if label || block\n @label = label || block\n else\n if @label.nil?\n label = parent.nil? ? parent.abstract_model.pretty_name : parent.label\n else\n label = @label\n end\n label = instance_eval &label if label.kind_of?(Proc)\n label\n end\n end", "title": "" }, { "docid": "837633cfc0c13740dcb97609ad86f804", "score": "0.4842808", "text": "def version\n attributes.fetch(:version)\n end", "title": "" }, { "docid": "837633cfc0c13740dcb97609ad86f804", "score": "0.4842808", "text": "def version\n attributes.fetch(:version)\n end", "title": "" }, { "docid": "837633cfc0c13740dcb97609ad86f804", "score": "0.4842808", "text": "def version\n attributes.fetch(:version)\n end", "title": "" }, { "docid": "837633cfc0c13740dcb97609ad86f804", "score": "0.4842808", "text": "def version\n attributes.fetch(:version)\n end", "title": "" }, { "docid": "837633cfc0c13740dcb97609ad86f804", "score": "0.4842808", "text": "def version\n attributes.fetch(:version)\n end", "title": "" }, { "docid": "f765b77f4f73c3e5359cc70d44f69005", "score": "0.4826121", "text": "def create_version!(new_attrs = {})\n create_operation do\n self.class.create!(new_version_attrs(new_attrs))\n end\n end", "title": "" }, { "docid": "2f8b0f5845c3c6ecd2a561a7e0a986a7", "score": "0.482142", "text": "def versioned_attributes_before_last_save\n versioned_columns.map { |attr| [attr, attribute_before_last_save(attr)] }.to_h.with_indifferent_access\n end", "title": "" }, { "docid": "4612c09c17016f105ba124c1c6650642", "score": "0.4820149", "text": "def _version\n special_attribute('@version'.freeze)\n end", "title": "" }, { "docid": "e157adab9845011f4ab5c53217cd3b79", "score": "0.4815464", "text": "def model_attributes\n super.merge(\n viewmodel: ->(v) {\n self.schema_version = 2\n\n migrates from: 1, to: 2 do\n down do |view, refs|\n case view['name']\n when 'old-tail'\n view['next'] = { ViewModel::REFERENCE_ATTRIBUTE => 'ref:s:new_tail' }\n refs['ref:s:new_tail'] = {\n ViewModel::TYPE_ATTRIBUTE => v.view_name,\n ViewModel::VERSION_ATTRIBUTE => v.schema_version,\n 'id' => 100, # entirely fake\n 'name' => 'new-tail',\n 'next' => nil,\n }\n\n when 'new-tail'\n view['name'] = 'newer-tail'\n end\n end\n end\n },\n )\n end", "title": "" }, { "docid": "934d32e20f91ac4ebd981d72ca26de5e", "score": "0.47869855", "text": "def bt_attributes_merge(updates)\n updates = updates.stringify_keys\n\n bt_value_attributes.merge( updates.slice(*self.class.bt_versioned_columns) )\n end", "title": "" }, { "docid": "22fe9a7729b353fe74e320f0dea107f8", "score": "0.477367", "text": "def editable_version\n parent_version.nil? ? self : parent_version\n end", "title": "" }, { "docid": "ea0aabdb0e63b06659937a5b840d0563", "score": "0.47162104", "text": "def version\n @attributes[:version]\n end", "title": "" }, { "docid": "ea0aabdb0e63b06659937a5b840d0563", "score": "0.47162104", "text": "def version\n @attributes[:version]\n end", "title": "" }, { "docid": "ba65b0765fdc95158708681c3a8d8c08", "score": "0.4715771", "text": "def get_indexed_attributes\n {\n data_version: data_version || self.class.current_data_version_number\n }.merge(self.get_crud_attributes)\n end", "title": "" }, { "docid": "ffdeae3e78351c9d3d3eb7c6ed9f3cab", "score": "0.4683762", "text": "def attributes(version = nil)\r\n version = validate_version!(version)\r\n\r\n versions.sort.inject({}) { |attributes, (current, mappable)|\r\n if mappable\r\n attributes.update mappable[:attributes] if current <= version\r\n\r\n if mappable[:actions]\r\n attributes[:actions] ||= {}\r\n attributes[:actions].update mappable[:actions]\r\n end\r\n end\r\n\r\n attributes\r\n }\r\n end", "title": "" }, { "docid": "4674f357eefe2254a65fef1ecabe88fd", "score": "0.4681804", "text": "def create_version(new_attrs = {})\n create_operation do\n self.class.create(new_version_attrs(new_attrs))\n end\n end", "title": "" }, { "docid": "2abeb21d762add262095c745c8a1aff1", "score": "0.4677477", "text": "def save_version\n\t\t\t\t\t$TRACE.debug 9, \"save_version: at beginning: #{self.inspect}\"\n\t\t\t\t\tself.changed_attributes_aado ||= []\n\t\t\t\t\t$TRACE.debug 5, \"save_version, changed_attributes = #{changed_attributes_aado.inspect}\"\n\t\t\t\t\t#save_version_on_create if save_version?\n\t\t\t\t\tif (dobj = get_database_object) && !changed_attributes_aado.empty? then\n\t\t\t\t\t\tdobj.save_version(changed_attributes_aado)\n\t\t\t\t\tend\n\t\t\t\tend", "title": "" }, { "docid": "01316c08a98b7308d84237e0b454d208", "score": "0.46656874", "text": "def updatable_attributes\n [:name]\n end", "title": "" }, { "docid": "a62d49258f189f6d3e6192c0268b20cd", "score": "0.46646568", "text": "def attributes=(attributes)\r\n version = @version\r\n versions = self.class.versions\r\n version = versions.keys.max if version.nil? || version > versions.keys.max\r\n attributes.try(:each) { |key, value| map_set key, value, version }\r\n end", "title": "" }, { "docid": "7896b21e66f46740fa9d90973578386a", "score": "0.4660579", "text": "def initialize(name, version, pretty_version)\n super(name, version, pretty_version)\n\n @minimum_stability = 'stable'\n @stability_flags = []\n @references = []\n @aliases = []\n end", "title": "" }, { "docid": "750b3532ab09fdf395c259d5a75229bd", "score": "0.46549082", "text": "def vertex_label_coords(v)\n x, y = *polar_to_cartesian(bisector_angle_to_x(v), VERTEX_LABEL_MARGIN)\n [ @coords[v][0] - x, @coords[v][1] + y ]\n end", "title": "" }, { "docid": "b63162a6bbbf45692035db7c7622a575", "score": "0.4649602", "text": "def version\n super.to_s\n end", "title": "" }, { "docid": "b63162a6bbbf45692035db7c7622a575", "score": "0.4649602", "text": "def version\n super.to_s\n end", "title": "" }, { "docid": "8e953771680834525df82dd17707c831", "score": "0.4638619", "text": "def assign_version_params\n resource_params.first.merge!(version_author: committer)\n end", "title": "" }, { "docid": "31c605de67413c0dc87587f7532b9bbe", "score": "0.46346152", "text": "def serialize\n super(ATTR_NAME_ARY)\n end", "title": "" }, { "docid": "31c605de67413c0dc87587f7532b9bbe", "score": "0.46346152", "text": "def serialize\n super(ATTR_NAME_ARY)\n end", "title": "" }, { "docid": "31c605de67413c0dc87587f7532b9bbe", "score": "0.46346152", "text": "def serialize\n super(ATTR_NAME_ARY)\n end", "title": "" }, { "docid": "31c605de67413c0dc87587f7532b9bbe", "score": "0.46346152", "text": "def serialize\n super(ATTR_NAME_ARY)\n end", "title": "" }, { "docid": "31c605de67413c0dc87587f7532b9bbe", "score": "0.46346152", "text": "def serialize\n super(ATTR_NAME_ARY)\n end", "title": "" }, { "docid": "595a4b42951048a3734e549e9ad2a5d4", "score": "0.4631931", "text": "def initialize(attributes = {})\n @label = attributes[:label]\n @admin_key = attributes[:admin_key]\n @base_uri = attributes[:base_uri]\n end", "title": "" }, { "docid": "44e16176f1c7bdf934d38125c97d413d", "score": "0.46299624", "text": "def label=(new_label)\n super(new_label)\n super(self.label[0, 255])\n end", "title": "" }, { "docid": "b193842c9411165c4458e6676c00ed68", "score": "0.46131855", "text": "def at_version_arg(parent)\n ::Gitlab::Graphql::FindArgumentInParent.find(parent, :at_version, limit_depth: 4)\n end", "title": "" }, { "docid": "145e674bea0522b4b9a250eb2b7b925e", "score": "0.4611436", "text": "def get_attributes\n necessary_attributes = PageVersioning::Config[klass + '_revision_attributes']\n attributes = self.attributes\n attributes.delete_if { |key, value| !necessary_attributes.include?(key) }\n attributes\n end", "title": "" }, { "docid": "95404a3097b486f33085b658331db39d", "score": "0.46102515", "text": "def to_hash(nested = true)\n # no need of _position and _visible (unless it's false)\n hash = super.delete_if { |k, v| k == '_position' || (k == '_visible' && v == true) }\n\n # also no need of the content type\n hash.delete('content_type')\n\n # dynamic attributes\n hash.merge!(self.dynamic_attributes.deep_stringify_keys)\n\n # no need of the translation of the field name in the current locale\n label_field = self.content_type.label_field\n\n if label_field.localized\n if !hash[label_field.name].empty?\n hash[label_field.name].delete(Locomotive::Mounter.locale.to_s)\n\n hash.delete(label_field.name) if hash[label_field.name].empty?\n end\n else\n hash.delete(label_field.name)\n end\n\n nested ? { self._label => hash } : hash\n end", "title": "" }, { "docid": "67c6600ee54ea87ab571cda2616b48d1", "score": "0.46099225", "text": "def concierge_version\n context[:version]\n end", "title": "" }, { "docid": "80416fa3b284428a1b2eb744b67249ff", "score": "0.45986456", "text": "def label=(label)\n write_attr :label, label\n end", "title": "" }, { "docid": "93bc607637d3d87ed8ee3bd3f863a781", "score": "0.45915362", "text": "def update!(**args)\n @canonical_name = args[:canonical_name] if args.key?(:canonical_name)\n @label_created = args[:label_created] if args.key?(:label_created)\n @label_deleted = args[:label_deleted] if args.key?(:label_deleted)\n @label_id = args[:label_id] if args.key?(:label_id)\n @label_renamed = args[:label_renamed] if args.key?(:label_renamed)\n @label_updated = args[:label_updated] if args.key?(:label_updated)\n @sync_id = args[:sync_id] if args.key?(:sync_id)\n end", "title": "" }, { "docid": "2302667ac1ce2d1267b2d36361fb10eb", "score": "0.4580069", "text": "def default_attributes\n @attributes = {\n :project => @name,\n :prefix => @prefix,\n :repositories => @repositories,\n :source => @source_project,\n :target => @target_project,\n :creation_date => \"#{Time.now}\",\n :last_mirror => \"0\",\n :date => \"#{Time.now}\",\n }\n end", "title": "" }, { "docid": "d175f5bedd91a8daf191cad42b04dc0c", "score": "0.45785418", "text": "def update_attributes(attrs)\n super({})\n end", "title": "" }, { "docid": "0c873fb5098ba464375d4a4a484bbc7f", "score": "0.4572363", "text": "def update\n requires :label, :application_name\n\n options = {\n 'ApplicationName' => application_name,\n 'Description' => description,\n 'VersionLabel' => label\n }\n options.delete_if {|key, value| value.nil?}\n\n data = service.update_application_version(options).body['UpdateApplicationVersionResult']['ApplicationVersion']\n merge_attributes(data)\n end", "title": "" }, { "docid": "988e10c9f843445d368dd1379d04a1f2", "score": "0.4572289", "text": "def label=(label)\n write_attr :label, label\n end", "title": "" }, { "docid": "66b71dd288a124260500e3e7cc643679", "score": "0.45691165", "text": "def label\n attributes.fetch(:label)\n end", "title": "" }, { "docid": "66b71dd288a124260500e3e7cc643679", "score": "0.45691165", "text": "def label\n attributes.fetch(:label)\n end", "title": "" }, { "docid": "66b71dd288a124260500e3e7cc643679", "score": "0.45691165", "text": "def label\n attributes.fetch(:label)\n end", "title": "" }, { "docid": "66b71dd288a124260500e3e7cc643679", "score": "0.45691165", "text": "def label\n attributes.fetch(:label)\n end", "title": "" }, { "docid": "66b71dd288a124260500e3e7cc643679", "score": "0.45691165", "text": "def label\n attributes.fetch(:label)\n end", "title": "" }, { "docid": "66b71dd288a124260500e3e7cc643679", "score": "0.45691165", "text": "def label\n attributes.fetch(:label)\n end", "title": "" }, { "docid": "fd48b1289aca96b1c68d24d0118548af", "score": "0.45653248", "text": "def update!(**args)\n @container_image_uri = args[:container_image_uri] if args.key?(:container_image_uri)\n @version_aliases = args[:version_aliases] if args.key?(:version_aliases)\n @version_description = args[:version_description] if args.key?(:version_description)\n @version_id = args[:version_id] if args.key?(:version_id)\n @vertex_model_source_info = args[:vertex_model_source_info] if args.key?(:vertex_model_source_info)\n end", "title": "" }, { "docid": "7424a80fe27c46c80b4e96f868a15a2c", "score": "0.45581347", "text": "def lively_attributes(*args)\n self._active_attributes += args.collect(&:to_s)\n end", "title": "" }, { "docid": "e185de956c60472165c999e45fb3f7a1", "score": "0.455016", "text": "def inherited(subclass)\n super\n subclass.instance_variable_set(:@comparison_attrs, comparison_attrs.dup)\n end", "title": "" }, { "docid": "c7db8760b4f99adc216610219734d367", "score": "0.4547951", "text": "def version=(value)\n @children['version'][:value] = value\n end", "title": "" }, { "docid": "c7db8760b4f99adc216610219734d367", "score": "0.4547951", "text": "def version=(value)\n @children['version'][:value] = value\n end", "title": "" }, { "docid": "0f23627f79b3081dc07009da1b5cda60", "score": "0.4544711", "text": "def initialize_attributes\n CommentLineAbove.(context.location)\n super\n end", "title": "" }, { "docid": "fba69d096a76854550077298b34a231d", "score": "0.4536545", "text": "def bt_value_attributes\n attributes.slice(*(self.class.bt_scope_columns + self.class.bt_versioned_columns))\n end", "title": "" }, { "docid": "85f019a1306a195d0fe55553ae6b0604", "score": "0.4534035", "text": "def label(attribute_name, *args); end", "title": "" }, { "docid": "47a07c6805ae448af31a98cf34685d7c", "score": "0.45276514", "text": "def initialize(*args)\n @attributes = HashWithIndifferentAccess[ self.class.attribute_names.zip([]) ]\n @attributes_cache = HashWithIndifferentAccess.new\n @previously_changed = HashWithIndifferentAccess.new\n @changed_attributes = HashWithIndifferentAccess.new\n super()\n end", "title": "" }, { "docid": "a012dfc7bc8344dfab339d9d56ce8db2", "score": "0.45183778", "text": "def set_attributes(data_attributes)\n parent = data_attributes.delete(:parent)\n super\n self.parent = parent if parent\n end", "title": "" }, { "docid": "a9a62854ba670512d58d1794ab765464", "score": "0.45059222", "text": "def _attributes\n @_attributes = superclass.try(:_attributes)&.dup || {} unless defined?(@_attributes)\n @_attributes\n end", "title": "" }, { "docid": "5fcf7f41799233a0623819139d23dfa3", "score": "0.45006764", "text": "def version\n res = {}\n res[:branch] = @branch\n res[:history] = @history\n res[:releases] = @releases\n res[:diffs] = @diffs.keys\n res\n end", "title": "" }, { "docid": "a95058090928af129b555f55020e6039", "score": "0.44973868", "text": "def update!(**args)\n @anchor_label = args[:anchor_label] if args.key?(:anchor_label)\n @break_label = args[:break_label] if args.key?(:break_label)\n @char_label = args[:char_label] if args.key?(:char_label)\n @language_label = args[:language_label] if args.key?(:language_label)\n @semantic_label = args[:semantic_label] if args.key?(:semantic_label)\n end", "title": "" }, { "docid": "596443355785042dcc2bbacb78c6e0e2", "score": "0.44944087", "text": "def create_version(attributes = nil)\n add_version(Version.create(attributes || version_attributes))\n reset_version\n end", "title": "" }, { "docid": "ff7d5e556a35e870b699a967630e75f5", "score": "0.44940934", "text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @labels = args[:labels] if args.key?(:labels)\n @lifecycle_state = args[:lifecycle_state] if args.key?(:lifecycle_state)\n @name = args[:name] if args.key?(:name)\n @parent = args[:parent] if args.key?(:parent)\n @project_id = args[:project_id] if args.key?(:project_id)\n @project_number = args[:project_number] if args.key?(:project_number)\n end", "title": "" }, { "docid": "ad4a9a78874b9db11d5679ec510d4a4f", "score": "0.44902626", "text": "def label\n @attributes[:label]\n end", "title": "" }, { "docid": "beee201b2069656a48264e60e99d7eb3", "score": "0.4476882", "text": "def vertex_label(v)\n x, y = *vertex_label_coords(v)\n label(x, y, v.to_s.upcase)\n end", "title": "" }, { "docid": "831dc9f7595e4d2534ba62ae5344515a", "score": "0.44538662", "text": "def initialize(assembly_instance, opts = {})\n super(assembly_instance)\n @base_version = opts[:version]\n @base_module_branch = get_or_create_module_for_service_instance(delete_existing_branch: opts[:delete_existing_branch], version: opts[:version])\n @add_nested_modules = opts[:add_nested_modules]\n end", "title": "" }, { "docid": "446e7268d1eb0472fdea9549aa2cf053", "score": "0.4439073", "text": "def model_attributes\n raise NotImplementedError\n end", "title": "" }, { "docid": "8d3a8928eedfee67ae6959cc85f4a4a2", "score": "0.4437004", "text": "def initialize(attrs = {})\n @output_filename = attrs['output_filename']\n @commit = attrs['commit']\n end", "title": "" }, { "docid": "048b2933e74633e7e805abbacfb70449", "score": "0.44359666", "text": "def custom_data\n super.attributes\n end", "title": "" }, { "docid": "d971bbd7b76ed4e58067d925db75865e", "score": "0.4435621", "text": "def new_attributes(name, library)\n (library.commands_hash[name] || {}).merge(name: name).\n update(library_attributes(library))\n end", "title": "" }, { "docid": "c70489c121752238c1c91e7fff7afcb3", "score": "0.44263387", "text": "def initialize(attributes = nil, options = {})\n super\n update_data[:state] = 'ON'\n end", "title": "" }, { "docid": "d898429c94c3461733c1281a0bf548a4", "score": "0.44239533", "text": "def merge_attributes(attrs={})\n # copy attributes from the parent module fields array\n @attributes = self.class.attributes_from_module\n # populate the attributes with values from the attrs provided to init.\n @attributes.keys.each do |name|\n write_attribute name, attrs[name] if attrs[name]\n end\n # If this is an existing record, blank out the modified_attributes hash\n @modified_attributes = {} unless new?\n end", "title": "" }, { "docid": "cacc934516d8554de16a5647e63b6495", "score": "0.44213614", "text": "def attributes=(attributes)\n @attributes = Layer::Patch::Hash.new(patch, attributes)\n end", "title": "" }, { "docid": "1cce86a4f793cfc763acf9d4886e2e10", "score": "0.4418289", "text": "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @label_name = args[:label_name] if args.key?(:label_name)\n end", "title": "" } ]
67083f1686b292770d312010580fa79e
Format floating point numbers according to Payson specifications; strings with commas as decimal separators.
[ { "docid": "eba0295b9310d44a7aa5943e5fe58742", "score": "0.64563453", "text": "def format_number(n)\n sprintf(\"%.2f\", n).gsub('.',',')\n end", "title": "" } ]
[ { "docid": "13c926b47f137ef8a36d3095bc4995b8", "score": "0.7440209", "text": "def format(comma = ',', decimal = '.')\n\t\tto_s.reverse.scan(/(?:-?\\d{1,3}(?:\\.\\d{1,3})?-?)/).map { |s| s.sub('.', decimal) }.join(comma).reverse\n\tend", "title": "" }, { "docid": "5aab676ca3856c0a99c3b8116b8587e1", "score": "0.73728245", "text": "def decimal_number\n return nil_format if @value.nil?\n @value.to_f.to_s.gsub('.', ',')\n end", "title": "" }, { "docid": "61e6f607e5e6ff4f410b837f5fd60f2e", "score": "0.73138916", "text": "def format_as_general(val, precision = 2)\n begin\n Float(val)\n number_with_precision(val, :precision => precision, :delimiter => \",\")\n rescue\n val\n end\n end", "title": "" }, { "docid": "0289bdc9052b85f4bf30157c95a850c1", "score": "0.7142863", "text": "def format_as_general(val, precision = nil)\n begin\n Float(val)\n precision ||= (val % 1 == 0) ? 0 : 2\n number_with_precision(val, :precision => precision, :delimiter => \",\")\n rescue\n val\n end\n end", "title": "" }, { "docid": "b22ae9788ed5b7c07abb28f330a19978", "score": "0.7095638", "text": "def format_number(measure)\n if measure != nil || measure.value != nil\n whole, decimal = measure.value.to_s.split(\".\")\n whole_with_commas = whole.chars.to_a.reverse.each_slice(3).map(&:join).join(\",\").reverse\n [whole_with_commas, decimal].compact.join(\".\")\n end\n end", "title": "" }, { "docid": "a09c29b06b8e1e080bc2b4423cf642b2", "score": "0.7020301", "text": "def format_float(float_as_string, decimal_pt, show_hundredths)\n return '' unless float_as_string\n output = decimal_pt + float_as_string\n return output unless show_hundredths \n output += '0' if (float_as_string.size == 1)\n return output\n end", "title": "" }, { "docid": "e7c637d5f3105f4993c88be8a3ace321", "score": "0.6959084", "text": "def format(value, decimals)\n \"%.#{decimals}f\" % round(value, decimals)\n end", "title": "" }, { "docid": "43b71a0e1ceb87741e2d9be0ed53ca2c", "score": "0.69122255", "text": "def decimals_or_floaters(number)\n number.to_i == number.to_f ? number= \"%.1f\" % [number] : number= \"%.2f\" % [number];\n end", "title": "" }, { "docid": "a0646235353ff4ffcbc154e7ff3d3b40", "score": "0.6883128", "text": "def format_as_decimal(val, precision = 2)\n number_with_precision(val, :precision => precision, :delimiter => \",\")\n end", "title": "" }, { "docid": "a0646235353ff4ffcbc154e7ff3d3b40", "score": "0.6883128", "text": "def format_as_decimal(val, precision = 2)\n number_with_precision(val, :precision => precision, :delimiter => \",\")\n end", "title": "" }, { "docid": "a2c9247753fbc6434cf20d30463b3f12", "score": "0.6781302", "text": "def amount_formatted_plain\n number_with_precision(self.amount, :precision => 2, :delimiter => ',')\n end", "title": "" }, { "docid": "c66cc226dca3d761854cbe6b28d6a6c8", "score": "0.67493284", "text": "def force_2decimals(value)\n '%.2f' % value\nend", "title": "" }, { "docid": "c66cc226dca3d761854cbe6b28d6a6c8", "score": "0.67493284", "text": "def force_2decimals(value)\n '%.2f' % value\nend", "title": "" }, { "docid": "c66cc226dca3d761854cbe6b28d6a6c8", "score": "0.6749035", "text": "def force_2decimals(value)\n '%.2f' % value\nend", "title": "" }, { "docid": "4d4a43278e80759cbb7e1322f2a7c3f2", "score": "0.672768", "text": "def format_float(value)\n value.is_a?(String) ? value : ('%0.1f' % value)\n end", "title": "" }, { "docid": "2ff337bb118e14624ce52c61c693fd18", "score": "0.6697858", "text": "def two_decimals(f)\n sprintf('%.2f', f).gsub(/(\\d)(?=\\d{3}+(?:\\.|$))(\\d{3}\\..*)?/, '\\1,\\2')\n end", "title": "" }, { "docid": "2f54f598e07258002fb08264d4068602", "score": "0.6648726", "text": "def round_float(decimales)\n num_digits = self.to_s.length\n sprintf(\"%#{num_digits}.#{decimales}f\",self).to_f\n end", "title": "" }, { "docid": "33baa87b2b1dc23199a05afd60f6c4ac", "score": "0.6642154", "text": "def prettify_float(data)\n data.to_s.match(/(\\d+\\.\\d+)e?([+-]\\d+)?/)\n base = Regexp.last_match[1]\n power = Regexp.last_match[2]\n s = format '%.2f', base\n s << \" &times; 10<sup>#{power}</sup>\" if power\n s\n end", "title": "" }, { "docid": "57c962e42ab8ce1ac2e1b7c24ceb2063", "score": "0.66039246", "text": "def number_format(decimal_places = 2)\n return \"%.#{decimal_places}f\" % self\n end", "title": "" }, { "docid": "818d994115dd2254f5aa2f3193376ea8", "score": "0.65853703", "text": "def pf(f,d=2)\n s = sprintf(\"%.#{d}f\",f)\n s.gsub!(/(\\.0+|(\\.\\d*[1-9])0+)$/, '\\2')\n s\n end", "title": "" }, { "docid": "cb835490bfd0b08a3409ec4fe7ce24c0", "score": "0.6520378", "text": "def test_float_numbers_greater_than_1000_are_delimited\n property_of do\n Rantly { range(1000.00, 9999.00) { float } }\n end.check do |input|\n expected_string = '%.2f' % input\n expected_string = expected_string.gsub(/(\\d)(?=(\\d{3})+(?!\\d))/, '\\\\1 ')\n assert_equal expected_string, Helper.format_money(input)\n end\n end", "title": "" }, { "docid": "58f28a8e596640dd078fe92aac6cec69", "score": "0.6516653", "text": "def format_money(str)\n sprintf(\"%.2f\", str.to_s.gsub(/[^\\d.,]/,'').to_f)\n end", "title": "" }, { "docid": "5d941e49a577878339e4854fd2360f27", "score": "0.6516071", "text": "def format_number_with_commas(st)\n st.to_s.gsub(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/, \"\\\\1,\")\n end", "title": "" }, { "docid": "10264605393f2585bb8e4b88ca6810e5", "score": "0.64983183", "text": "def number_format(number, precision = 2, seperator = \".\", delimiter = \",\")\n number = number.to_f if !number.is_a?(Float)\n precision = precision.to_i\n return sprintf(\"%.#{precision.to_s}f\", number).gsub(\".\", seperator) if number < 1 and number > -1\n \n number = sprintf(\"%.#{precision.to_s}f\", number).split(\".\")\n \n str = \"\"\n number[0].reverse.scan(/(.{1,3})/) do |match|\n if match[0] == \"-\"\n #This happens if the number is a negative number and we have reaches the minus-sign.\n str << match[0]\n else\n str << delimiter if str.length > 0\n str << match[0]\n end\n end\n \n str = str.reverse\n if precision > 0\n str << \"#{seperator}#{number[1]}\"\n end\n \n return str\n end", "title": "" }, { "docid": "f69fb7a7615c70c2628e30e2112ec66f", "score": "0.6484705", "text": "def format_numbers(num)\n num = num.to_s\n\n if num.index(\".\") != nil #deal with numbers that have decimals\n start_index = num.index(\".\") - num.length - 4\n if (num.index(\".\") % 3) == 0\n num_commas = (num.index(\".\") / 3) - 1\n else\n num_commas = (num.index(\".\") / 3)\n end\n\n else #for numbers without decimals\n start_index = -4\n if (num.length % 3) == 0\n num_commas = (num.length / 3) - 1\n else\n num_commas = (num.length / 3)\n end\n end\n\n until num_commas <= 0 #insert commas into number\n num.insert(start_index, \",\")\n start_index -=4\n num_commas -=1\n end\n\n return num\nend", "title": "" }, { "docid": "3cc395db449c8b99964062b26a9e74e7", "score": "0.64841664", "text": "def comma(number, digits=2)\n if number.is_a? Float\n str = \"%.#{digits}f\" % number\n else\n str = number.to_s\n end\n\n str.reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end", "title": "" }, { "docid": "3cc395db449c8b99964062b26a9e74e7", "score": "0.64841664", "text": "def comma(number, digits=2)\n if number.is_a? Float\n str = \"%.#{digits}f\" % number\n else\n str = number.to_s\n end\n\n str.reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end", "title": "" }, { "docid": "3be6cf4bd013feb3468ebf6d3d7bcd67", "score": "0.646208", "text": "def formatted_number(n, options={})\n\t options = {\n\t :precision => 2,\n\t :separator => '.',\n\t :delimiter => ',',\n\t :format => \"$%s\"\n\t }.merge(options)\n\t\t\n\t\ta,b = sprintf(\"%0.#{options[:precision]}f\", n.to_s.to_f).split('.')\n\t a.gsub!(/(\\d)(?=(\\d{3})+(?!\\d))/, \"\\\\1#{options[:delimiter]}\")\n\t sprintf(options[:format], \"#{a}#{options[:separator]}#{b}\")\n\tend", "title": "" }, { "docid": "7c1c983f86ea2bf5d76abb11f4f0911b", "score": "0.64529854", "text": "def pf(f,d=2)\n f = f.scalar if Unit === f\n s = sprintf(\"%.#{d}f\",f)\n s.gsub!(/(\\.0+|(\\.\\d*[1-9])0+)$/, '\\2')\n s\n end", "title": "" }, { "docid": "a96fcf285ecfa8d24bc6af007fa83ce8", "score": "0.644295", "text": "def format_number(number)\n whole, decimal = number.to_s.split(\".\")\n num_groups = whole.chars.to_a.reverse.each_slice(3)\n whole_with_commas = num_groups.map(&:join).join(',').reverse\n [whole_with_commas, decimal].compact.join(\".\")\nend", "title": "" }, { "docid": "49b4ae34628b62d061539617b491a718", "score": "0.6411799", "text": "def format_currency( value, pre_symbol='$', thousands=',' )\n \"#{pre_symbol}#{\n (\"%.2f\" % value).gsub(\n /(\\d)(?=(?:\\d{3})+(?:$|\\.))/,\n \"\\\\1#{thousands}\")}\"\n end", "title": "" }, { "docid": "a34c9aba1b7bd7a7a4008379978e9a57", "score": "0.6389848", "text": "def escape_float s\n s = s.to_s\n s.gsub!(\"\\.0\", \"\")\n s\n end", "title": "" }, { "docid": "7d51db293c33790612a1d7a22f9b43c4", "score": "0.635689", "text": "def add_number_commas(number)\n whole, decimal = number.to_s.split(\".\")\n whole_with_commas = whole\n .chars\n .reverse\n .each_slice(3)\n .map(&:join)\n .join(\",\")\n .reverse\n [whole_with_commas, decimal].compact.join(\".\")\nend", "title": "" }, { "docid": "9516e79dc574fe64f773757abe1a7683", "score": "0.63458467", "text": "def float_to_string(amount)\n sprintf('%.2f'.freeze, amount.round(2))\n end", "title": "" }, { "docid": "09d01708a65d11f733fe66793c551ebc", "score": "0.6343877", "text": "def format_float(f, digits)\n if f < 1\n sprintf('%.*f', digits - Math.log10(f), f)\n else\n f.to_s\n end\n end", "title": "" }, { "docid": "5cf6447f0274d1d32374b8833c13b1f1", "score": "0.63178617", "text": "def format(value, currency)\n\t\tsprintf('%.2f', value) + \" \" + currency \n\tend", "title": "" }, { "docid": "6d8ec12a6d0a4e0f4f320c98557ba133", "score": "0.63124645", "text": "def format_number(a_number)\n number_with_delimiter(number_with_precision(a_number, precision: 0, strip_insignificant_zeros: true), :delimiter => \".\", :separator => \",\")\n end", "title": "" }, { "docid": "c403172fca36ee7033a07eef015c1df8", "score": "0.63098526", "text": "def separate_comma(number)\n\tnegative = false\n\tif number.is_a? Float\n\t\tnumber = number.to_s.split('.')\n\t\tdecimal = number[1]\n\t\tnumber = number[0]\n\tend\n\toutput = number.to_s \n\tif number[0] == '-'\n\t\tnumber.slice!(0) \n\t\tnegative = true\n\tend\n\toutput = output.reverse.chars.each_slice(3).to_a.collect(&:join).join(',').reverse\n\toutput.insert(0, '-') if negative == true\n\toutput << \".\" << decimal if decimal \n\toutput\nend", "title": "" }, { "docid": "639f2164436524c6b2c5bdb76e9750ad", "score": "0.63039577", "text": "def stringy_decimalise(integer)\n '%.2f' % integer\n end", "title": "" }, { "docid": "9ea5e18fc45c18e59b4c0678252f4e3f", "score": "0.6303044", "text": "def currency_conversion(float)\n format('%.2f', float)\nend", "title": "" }, { "docid": "6a17a0e6ce464851a9828d52fcd509ee", "score": "0.62957144", "text": "def formatted_price\n\t\tprice_in_dollars = price_in_cents.to_f / 100\n\t\tsprintf(\"%.2f\", price_in_dollars)\n\tend", "title": "" }, { "docid": "12d92cf4348e3a8bb18a9d0ee494b8c9", "score": "0.6279117", "text": "def commas(num)\n if num.blank?\n number = ''\n else\n number= num.to_f.fixed_precision(2).to_s.reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end\n return number\n end", "title": "" }, { "docid": "d118f99345c03e92fa16e81e092a8f8a", "score": "0.62717736", "text": "def formatted_price\n price_in_dollars = price_in_cents.to_f / 100\n sprintf(\"%.2f\", price_in_dollars)\n end", "title": "" }, { "docid": "13ac48e919fb32fbc59a493ab308e2a7", "score": "0.62689954", "text": "def separate_comma(number)\n whole, decimal = number.to_s.split(\".\")\n whole_with_commas = whole.chars.to_a.reverse.each_slice(3).map(&:join).join(\",\").reverse\n [whole_with_commas, decimal].compact.join(\".\")\nend", "title": "" }, { "docid": "4cbc800769aef90f26b77c82f8f7d10a", "score": "0.6258814", "text": "def format_value( value )\n if value.is_a?( Fixnum)\n value.to_s.gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?$)/, '\\1,')\n elsif value.is_a?(Hash)\n buff = []\n value.each_pair { |k,v| buff << \"#{k}:#{format_value(v)}\"}\n buff.join( \", \" )\n elsif value.is_a?(Array)\n (value.empty? ? \"[]\" : value.join(\", \"))\n else\n value\n end \n end", "title": "" }, { "docid": "903ea0606bd737d77230db6966c543b8", "score": "0.62552226", "text": "def parse_decimal(f)\n FacturagemUtils.parse_decimal(f)\n end", "title": "" }, { "docid": "145a0a1cdb25ab442d430c0a3d0f4e73", "score": "0.62540346", "text": "def format(amount)\n decimal, fraction = amount.round(2).to_s.split('.')\n decimal_part = decimal.\n chars.\n reverse.\n each_slice(3).\n map { |xs| xs.reverse.join }.\n reverse.\n join(\",\")\n\n \"$\" + decimal_part + \".\" + fraction.ljust(2, \"0\")\nend", "title": "" }, { "docid": "86a2502526cee5c4c4f09b59b8d761af", "score": "0.6249972", "text": "def split_amount_display\n Currency.format(split_amount.abs, currency, :hide_unit => true).sub(/[.,]00$/,'')\n end", "title": "" }, { "docid": "c5e9b7e11af5740c18970dc4b0daceaf", "score": "0.6243136", "text": "def format(amount)\n '%.2f' % (amount / 100.to_f)\n end", "title": "" }, { "docid": "af70fe8c1af13bf31e3f7976b9dea946", "score": "0.6224892", "text": "def to_comma(number)\n whole, decimal = number.to_s.split(\".\")\n whole_with_commas = whole.chars.to_a.reverse.each_slice(3).map(&:join).join(\",\").reverse\n [whole_with_commas, decimal].compact.join(\".\")\n end", "title": "" }, { "docid": "a3aab203529d99af196c0274b3e54eed", "score": "0.6222543", "text": "def print_float(val)\n printf('%7.4f',val);\nend", "title": "" }, { "docid": "b75dd49de5d1d31f6096d112435001fa", "score": "0.62170345", "text": "def format(amount, places: @places, **options)\n\t\t\t\t# Round to the desired number of places. Truncation used to be the default.\n\t\t\t\tamount = amount.round(places).to_d\n\t\t\t\t\n\t\t\t\tintegral, fraction = amount.abs.to_s('F').split(/\\./, 2)\n\t\t\t\t\n\t\t\t\t# The sign of the number\n\t\t\t\tsign = '-' if amount < 0\n\t\t\t\t\n\t\t\t\t# Decimal places, e.g. the '.00' in '$10.00'\n\t\t\t\tfraction = fraction[0...places].ljust(places, @zero)\n\t\t\t\t\n\t\t\t\t# Grouping, e.g. the ',' in '$10,000.00'\n\t\t\t\tremainder = integral.size % 3\n\t\t\t\tgroups = integral[remainder..-1].scan(/.{3}/).to_a\n\t\t\t\tgroups.unshift(integral[0...remainder]) if remainder > 0\n\t\t\t\t\n\t\t\t\tsymbol = options.fetch(:symbol, @symbol)\n\t\t\t\tvalue = \"#{sign}#{symbol}#{groups.join(@delimiter)}\"\n\t\t\t\t\n\t\t\t\tname = options.fetch(:name, @name)\n\t\t\t\tsuffix = name ? \" #{name}\" : ''\n\t\t\t\t\n\t\t\t\tif places > 0\n\t\t\t\t\t\"#{value}#{@separator}#{fraction}#{suffix}\"\n\t\t\t\telse\n\t\t\t\t\t\"#{value}#{suffix}\"\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "fa794aba5a680d4ff8570d833b8deb2a", "score": "0.62146664", "text": "def format_number(number)\n return '' if number.nil?\n return number unless number.is_a?(Numeric)\n\n formatted = format('%.6g', number)\n formatted = formatted =~ /\\./ ? formatted : \"#{ formatted }.0\"\n\n # Add comma delimiters.\n parts = formatted.to_s.split('.')\n parts[0].gsub!(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/, '\\\\1,')\n parts.join('.')\n end", "title": "" }, { "docid": "f986437f0cd4274c193cb05a9bb5156d", "score": "0.6207659", "text": "def price_formatted\n decimal_price = (@unit_price_cents * @quantity / 100.to_f)\n '$%.2f' % decimal_price\n end", "title": "" }, { "docid": "4f9067bbee0b245dbe1502201cb07e1a", "score": "0.62041605", "text": "def commafy(n)\n\tn.to_s.gsub(/(\\d)(?=\\d{3}+(?:\\.|$))(\\d{3}\\..*)?/,'\\1,\\2')\nend", "title": "" }, { "docid": "456233f53f5e72a3dcd1420dd2a5f9b2", "score": "0.6202403", "text": "def numFmt; end", "title": "" }, { "docid": "c4d5127d990e564522f4e0815517ef58", "score": "0.61780477", "text": "def dc_format_number(value=0, decimals=nil, separator=nil, delimiter=nil, currency=nil) #:nodoc:\n CmsCommonHelper.dc_format_number(value, decimals, separator, delimiter, currency)\nend", "title": "" }, { "docid": "3d29a61dc2e08b39fc324b3ef501c764", "score": "0.6176791", "text": "def formatted_price\n price_in_dollars = price_in_cents.to_f / 100\n format(\"%.2f\", price_in_dollars)\n end", "title": "" }, { "docid": "3d29a61dc2e08b39fc324b3ef501c764", "score": "0.6176791", "text": "def formatted_price\n price_in_dollars = price_in_cents.to_f / 100\n format(\"%.2f\", price_in_dollars)\n end", "title": "" }, { "docid": "f8f13203416caadf4fca8c307765bfdc", "score": "0.61683244", "text": "def format_string\n [\"%<value>.#{normalizer.significant}f\"].tap do |values|\n values << '(%<deviance>d)' if deviance?\n values << 'e%<exponential>d' if exponential?\n end.join\n end", "title": "" }, { "docid": "298b9ad9d475e0107456999fe339d098", "score": "0.61351997", "text": "def value_s\n sprintf( \"%.2f\", value.to_f)\n end", "title": "" }, { "docid": "034c6a6c6ac722df38492ff9b33d7408", "score": "0.61340344", "text": "def add_commas(number)\n\tnumber.to_s.reverse.gsub(/...(?=.)/,'\\&,').reverse # make numbers pretty with commas\nend", "title": "" }, { "docid": "aafbf2d3e4518cf0fce15368e8799e7e", "score": "0.6119637", "text": "def print_decimal(variable)\n sprintf('%.2f', variable)\nend", "title": "" }, { "docid": "db3c573f0144a023b964df678f56ec5f", "score": "0.6119598", "text": "def format(number)\n parts = number.round(@decimal_places).to_s.split(\".\")\n parts[0].gsub! /(\\d)(?=(\\d\\d\\d)+(?!\\d))/, \"\\\\1#{@delimiter}\"\n\n if @decimal_places > 0\n parts[1] = parts[1].ljust @decimal_places, \"0\"\n end\n\n \"#{@symbol}#{parts.join @separator}\"\n end", "title": "" }, { "docid": "a0a3619e1071216746a2ae9e2b3318b4", "score": "0.60927147", "text": "def is_float?(value, decimal_separator = POINT)\n if decimal_separator == POINT\n return value.\n gsub(COMMA_SPACE_REGEX, EMPTY) if !(value =~ DECIMAL_POINT_REGEX).nil?\n else\n return value.\n gsub(POINT_SPACE_REGEX, EMPTY).\n gsub(COMMA, POINT) if !(value =~ DECIMAL_COMMA_REGEX).nil?\n end\n end", "title": "" }, { "docid": "b23bedd5c8b6bf023c01f0d8ebe76de4", "score": "0.6085055", "text": "def float_custom_format(num)\n num == num.to_i ? num.to_i : num\n end", "title": "" }, { "docid": "98c05e765f73b456b74f5c2cb0ad94bc", "score": "0.6082487", "text": "def amount_formatted\n amount_formatted_with_decimal\n end", "title": "" }, { "docid": "7b161f3150f0d73587ad520a3d2cb136", "score": "0.6081942", "text": "def parse_decimal(f)\n GastosminiUtils.parse_decimal(f)\n end", "title": "" }, { "docid": "35e4a2fdd598f5d7041f476e3b020697", "score": "0.60793996", "text": "def filter_decimal(value)\n value.tr!(',', '.')\n value.gsub!(/[^\\d.+-]/, \"\")\n value.scan(/([-+]?\\d+\\.?\\d*)/).to_s\n end", "title": "" }, { "docid": "a849d693a7a2e60e743a48e199485b78", "score": "0.6065966", "text": "def format_num( tmp_arr )\n tmp_arr.collect! do |x|\n if ( ( x.to_f.to_s == x ) and ( x.to_f == x.to_i ) ) # (integer value - no decimals)\n x.to_i.to_s\n elsif ( x.to_f.to_s == x ) # (decimal value - format to 2 decimals)\n sprintf(\"%0.2f\", x)\n else\n x\n end\n end\nend", "title": "" }, { "docid": "08f2192451c54523f3615d8974d29c07", "score": "0.6063822", "text": "def format_number(number)\n whole, decimal = number.to_s.split('.')\n whole.reverse!.gsub!(/(\\d{3})(?=\\d)/, '\\\\1,').reverse! if whole.to_i < -999 || whole.to_i > 999\n [whole, decimal].compact.join('.')\n end", "title": "" }, { "docid": "6c351736ae7c4d8310cd183a1d4543e6", "score": "0.6060626", "text": "def translate_amount(dk_amount)\n return dk_amount unless dk_amount.include?(',')\n dk_amount.tr_s(',', '.')\nend", "title": "" }, { "docid": "2fd04fea96bedcdd8556c74f3ae035f5", "score": "0.60567546", "text": "def decimal_to_string(amount)\n str = amount.to_s('F'.freeze)\n dot_idx = str.rindex('.'.freeze)\n frac_length = str.length - dot_idx - 1\n\n if frac_length == 1\n # put the second zero after . if there is only one\n str.insert(-1, '0'.freeze)\n elsif frac_length == 2\n str\n else\n round_string(str, dot_idx)\n end\n end", "title": "" }, { "docid": "495db08d6674207ddba64add14eec5f1", "score": "0.6054251", "text": "def default_amount_format\n \"%.#{amount_formatting_precision}g\"\n end", "title": "" }, { "docid": "accd604b1330c6344bd08b86adf834a7", "score": "0.6037501", "text": "def float_with_precision(val, options)\n number_with_precision(val.to_f, :precision => 1)\n end", "title": "" }, { "docid": "2a13b34d72b79f8cc365c655b20985e1", "score": "0.6022763", "text": "def two_decimals(num)\n '%.2f' % num\nend", "title": "" }, { "docid": "5fc0c557f67007fadc41f04db7a89f3d", "score": "0.60195094", "text": "def format n\n case\n when format_string\n format_string % n\n when n == 0.0\n '0.0'\n when n.abs > 1000 || n.abs < 0.001\n \"%#{precision}.#{precision}E\" % n\n else\n \"%#{precision}.#{precision}f\" % n\n end\n end", "title": "" }, { "docid": "a074962499c62ce66513b51f281a63fe", "score": "0.60164225", "text": "def FormattedDivision(num1,num2)\n float = sprintf(\"%.4f\", num1/num2.to_f)\n\n split = float.to_s.split(\".\")\n\n first = split[0].reverse.gsub(/(\\d{3})(?=\\d)/, \"\\\\1,\").reverse\n\n second = split[1]\n\n first + \".\" + second\nend", "title": "" }, { "docid": "dec45a2ee3d6c57b3f351af3b2193573", "score": "0.6015505", "text": "def number_with_precision(number, precision=3)\n \"%01.#{precision}f\" % number\n rescue\n number\n end", "title": "" }, { "docid": "3b35c41456061532c5ec9f02ab630ca9", "score": "0.60143024", "text": "def price_format(number)\n return \"free\" if number.to_f==0.to_f\n \"£%01.2f\" % ((Float(number.to_f) * (10 ** 2)).round.to_f / 10 ** 2)\n end", "title": "" }, { "docid": "558c59d23eaa7045117553fef3df1fe1", "score": "0.6010363", "text": "def strfnum(num, p = 0, opts = {})\n opts = {precision: p, :delimiter => ','}.merge(opts)\n number_with_precision(num, opts)\n end", "title": "" }, { "docid": "6ab05bbe2934db086f4de7fc13c54db9", "score": "0.601004", "text": "def format_price (price)\n return nil unless price\n # logger.debug2 \"@user_currency_separator = #{@user_currency_separator}, @user_currency_delimiter = #{@user_currency_delimiter}\"\n number_with_precision(price, :precision => 2, :separator => @user_currency_separator, :delimiter => @user_currency_delimiter)\n end", "title": "" }, { "docid": "16f75b12e1ba3776fa67ed30795e2666", "score": "0.60034084", "text": "def money_to_f(val)\n val.gsub(/[^\\d\\.-]/,'').to_f\n end", "title": "" }, { "docid": "ea86b8b4c9af13cd19f9b1eac39885e5", "score": "0.6002526", "text": "def price_format\n if price.present?\n begin\n Float(price)\n rescue\n errors.add :price , \"must be numeric value.\"\n end\n end\n end", "title": "" }, { "docid": "44b038f30ca7064a817ed126e2584a3d", "score": "0.60023165", "text": "def float\n /([_,])/.match(self) { |m| $options[:grouped] ||= m[1] }\n\n BigDecimal(self.gsub(/[,_]/, ''), Float::DIG)\n end", "title": "" }, { "docid": "9e4a480a7dc751dce14cd2468d130ca2", "score": "0.5998548", "text": "def money_formatted\n '%.2f %s' % [self.amount/100.00, self.currency.upcase]\n end", "title": "" }, { "docid": "7132c6be79e1e02eedd7cf9e906138e4", "score": "0.59948057", "text": "def to_f\n to_s_no_currency.to_f\n end", "title": "" }, { "docid": "2c7175d408ee7cb1da6ce5fc41ebdff3", "score": "0.5993399", "text": "def neat_numbers(number, roundto = 2) #round to 0 or 2)\r\n if roundto == 2\r\n number = sprintf \"%.2f\", number\r\n else\r\n number = number.round\r\n end\r\n #regex to add commas\r\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\r\n end", "title": "" }, { "docid": "2c7175d408ee7cb1da6ce5fc41ebdff3", "score": "0.5993399", "text": "def neat_numbers(number, roundto = 2) #round to 0 or 2)\r\n if roundto == 2\r\n number = sprintf \"%.2f\", number\r\n else\r\n number = number.round\r\n end\r\n #regex to add commas\r\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\r\n end", "title": "" }, { "docid": "2c7175d408ee7cb1da6ce5fc41ebdff3", "score": "0.5993399", "text": "def neat_numbers(number, roundto = 2) #round to 0 or 2)\r\n if roundto == 2\r\n number = sprintf \"%.2f\", number\r\n else\r\n number = number.round\r\n end\r\n #regex to add commas\r\n number.to_s.reverse.gsub(%r{([0-9]{3}(?=([0-9])))}, \"\\\\1,\").reverse\r\n end", "title": "" }, { "docid": "83294a232afa1217d1d4cc1527558094", "score": "0.5990367", "text": "def float(cell, str = +'')\n numeric cell, str\n end", "title": "" }, { "docid": "396541e662d4be50d5c2547146ab20f7", "score": "0.5987179", "text": "def to_s_fraction(values)\n return \"#{values[1] - values[0]} / #{values[1]}\"\n end", "title": "" }, { "docid": "0e97b759152c356fdeb27cd7b6182c63", "score": "0.5982587", "text": "def test_float\n\t\t42.12345\n\tend", "title": "" }, { "docid": "a14fa3bee7a65b445fe9a59c1edb7199", "score": "0.5982169", "text": "def collatable_decimal\n return '' unless decimal?\n \".#{decimal}\"\n end", "title": "" }, { "docid": "09f6021806cb8cd7f4cd189a428a33cd", "score": "0.5978247", "text": "def format_number(number)\n if number\n number = number.gsub(/\\s+/, '').gsub(',', '').gsub('£', '').gsub('+', '').to_f\n end\n\n number\n end", "title": "" }, { "docid": "3192aeaa044b8f91da29653a7e91bc3c", "score": "0.5972882", "text": "def to_decimals decimals = 2\n \"%.#{decimals}f\" % self\n end", "title": "" }, { "docid": "6cf61abfa4e82a02c59aa14c8a30b57b", "score": "0.59716433", "text": "def neat_numbers(number, roundto = 2) # round to 0 or 2)\n if roundto == 2\n number = format '%.2f', number\n else\n number = number.round\n end\n # regex to add commas\n number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\\\1,').reverse\n end", "title": "" }, { "docid": "6cf61abfa4e82a02c59aa14c8a30b57b", "score": "0.59716433", "text": "def neat_numbers(number, roundto = 2) # round to 0 or 2)\n if roundto == 2\n number = format '%.2f', number\n else\n number = number.round\n end\n # regex to add commas\n number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\\\1,').reverse\n end", "title": "" }, { "docid": "6cf61abfa4e82a02c59aa14c8a30b57b", "score": "0.59716433", "text": "def neat_numbers(number, roundto = 2) # round to 0 or 2)\n if roundto == 2\n number = format '%.2f', number\n else\n number = number.round\n end\n # regex to add commas\n number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\\\1,').reverse\n end", "title": "" }, { "docid": "6cf61abfa4e82a02c59aa14c8a30b57b", "score": "0.59716433", "text": "def neat_numbers(number, roundto = 2) # round to 0 or 2)\n if roundto == 2\n number = format '%.2f', number\n else\n number = number.round\n end\n # regex to add commas\n number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\\\1,').reverse\n end", "title": "" } ]
41006e6880f7fa7f739ff757c1d8b012
Turn a path into string and symbol segments so it can be reconstructed, as in the case of a named route. ==== Parameters path:: The path to split into segments. ==== Returns Array:: The Symbol and String segments for the path.
[ { "docid": "c0548a68b9d92c209fc85fedf41d0760", "score": "0.7327001", "text": "def segments_from_path(path)\n # Remove leading ^ and trailing $ from each segment (left-overs from regexp joining)\n strip = proc { |str| str.gsub(/^\\^/, '').gsub(/\\$$/, '') }\n segments = []\n while match = (path.match(SEGMENT_REGEXP))\n segments << strip[match.pre_match] unless match.pre_match.empty?\n segments << match[2].intern\n path = strip[match.post_match]\n end\n segments << strip[path] unless path.empty?\n segments\n end", "title": "" } ]
[ { "docid": "0fc76a99dca9c37bab043c888e283998", "score": "0.7307869", "text": "def parse_path(path)\n path[1..-1].split(Const::UNESCAPED_SLASH).map do |s|\n arr = s.gsub(\n Const::ESCAPED_SLASH,\n Const::SLASH\n ).split(Const::UNESCAPED_COLON)\n route_part = {:route => unescape(arr[0]).to_sym}\n args = {}\n arr[1..-1].each do |argval|\n varr = argval.split(Const::UNESCAPED_MINUS)\n args[unescape(varr[0])] = unescape(varr[1..-1].join)\n # TODO Predict argument\n end\n route_part[:args] = extract_args(args)\n route_part\n end # map\n end", "title": "" }, { "docid": "8c43d01bd5a1bcbeda6db6853434904e", "score": "0.72227997", "text": "def parse_path(path)\n path[1..-1].split(/(?<!\\$)\\//).map do |s|\n arr = s.gsub('$/', '/').split(/(?<!\\$):/)\n route_part = {:route => unescape(arr[0]).to_sym}\n args = {}\n arr[1..-1].each do |argval|\n varr = argval.split(/(?<!\\$)-/)\n args[unescape(varr[0])] = unescape(varr[1..-1].join) # TODO Predict argument\n end\n route_part[:args] = extract_args(args)\n route_part\n end # do\n end", "title": "" }, { "docid": "9bcbec3400df7791f29fc99dd077ee3e", "score": "0.7114092", "text": "def segments_for_route_path(path)\n rest, segments = path, []\n\n until rest.empty?\n segment, rest = segment_for rest\n segments << segment\n end\n segments\n end", "title": "" }, { "docid": "9bcbec3400df7791f29fc99dd077ee3e", "score": "0.7114092", "text": "def segments_for_route_path(path)\n rest, segments = path, []\n\n until rest.empty?\n segment, rest = segment_for rest\n segments << segment\n end\n segments\n end", "title": "" }, { "docid": "de50027c2d1e39da7cda7205a747d325", "score": "0.69783366", "text": "def parse_path(path)\n match = PARSING_REGEXP.match(path)\n Hash[match.names.map(&:to_sym).zip(match.captures)].compact\n end", "title": "" }, { "docid": "900cff5387c588945ca282b129e2f7b2", "score": "0.672389", "text": "def split_path path\n return ['/', path] unless path.index '/'\n pre_path = path[0, path.rindex('/').to_i]\n key = path[pre_path.size + 1, path.size - pre_path.size - 1]\n [pre_path, key]\n end", "title": "" }, { "docid": "04d65c192fe2772985967e80cabf885d", "score": "0.6704934", "text": "def parse_path(path)\n path.split(File::PATH_SEPARATOR).map do |part|\n File.expand_path(part)\n end\n end", "title": "" }, { "docid": "a89abfb401e01a47cb36b6016492f0ef", "score": "0.66848963", "text": "def parse(path)\n # I'm pretty sure this isn't quite valid but it's a holdover from\n # tenderlove's code. Once the operations are refactored I believe this\n # won't be necessary.\n return [\"\"] if path == \"/\"\n # Strip off the leading slash\n path = path.sub(/^\\//, '')\n path.split(\"/\").map { |p| unescape(p) }\n end", "title": "" }, { "docid": "a89abfb401e01a47cb36b6016492f0ef", "score": "0.66848963", "text": "def parse(path)\n # I'm pretty sure this isn't quite valid but it's a holdover from\n # tenderlove's code. Once the operations are refactored I believe this\n # won't be necessary.\n return [\"\"] if path == \"/\"\n # Strip off the leading slash\n path = path.sub(/^\\//, '')\n path.split(\"/\").map { |p| unescape(p) }\n end", "title": "" }, { "docid": "7f0b9a9cc08f46622e29bfc4103df0d0", "score": "0.655476", "text": "def split_path(path); end", "title": "" }, { "docid": "7f0b9a9cc08f46622e29bfc4103df0d0", "score": "0.655476", "text": "def split_path(path); end", "title": "" }, { "docid": "d7d6834f2a08976dd92c01578fb77770", "score": "0.6474922", "text": "def path_to_parts(path)\n path.split(/\\/+/)\n end", "title": "" }, { "docid": "750ccf035ef9d9bfe634a53b80cb1077", "score": "0.64692265", "text": "def path_components(path)\n return filter_components(path.split(split_pattern))\n end", "title": "" }, { "docid": "f8ac95242eacedfcd2bd852b9dad63c6", "score": "0.6460337", "text": "def analyse_path path\n raise 'path must contain no new line' if path.index \"\\n\"\n raise 'path must start with /' unless path.start_with? '/'\n path.split(FORWARD_SPLIT, 2)\n end", "title": "" }, { "docid": "cc1fdbec64a9132b1fdd957c6225487e", "score": "0.6396419", "text": "def extract_path_parts(path)\n result = []\n if tmp=path.split('/')\n result << tmp.last\n result << tmp.slice(1, tmp.size-2) \n else\n result << path\n result << nil\n end \n result\n end", "title": "" }, { "docid": "5054d12250d76bc5b7920d39b585b16c", "score": "0.6340445", "text": "def split_path(path)\n path = path.to_s\n extension = File.extname(path)[1..-1] || \"\"\n path_without_extension = path.sub(/\\.#{Regexp.escape(extension)}\\Z/, \"\")\n [extension, path_without_extension]\n end", "title": "" }, { "docid": "21daf5a0514dc3051b3b9c29efe5df6c", "score": "0.6325463", "text": "def param_names_from_path(path)\n path.scan(/:(\\w+)/).map do |ar|\n ar[0].to_sym\n end\n end", "title": "" }, { "docid": "e103fd2285dea65271c6c2381dc50fc3", "score": "0.62913674", "text": "def split_path(path_string)\n path_string.split('->').map! { |element| element.strip }\n end", "title": "" }, { "docid": "e103fd2285dea65271c6c2381dc50fc3", "score": "0.62913674", "text": "def split_path(path_string)\n path_string.split('->').map! { |element| element.strip }\n end", "title": "" }, { "docid": "101868e0b7da5fcc54f4984e167edd79", "score": "0.6216097", "text": "def split(path)\n parts = []\n last_index = 0\n while index = path.index(\"/\", last_index)\n if index == last_index\n parts << \"\"\n else\n parts << path[last_index...index]\n end\n last_index = index + 1\n end\n # and also get that last segment\n parts << path[last_index..-1]\n # it should begin with a blank segment from the leading \"/\"; kill that\n parts.shift\n parts\n end", "title": "" }, { "docid": "4c775eb23d278c5b6e2fd261ed06da85", "score": "0.6175024", "text": "def compile(path)\n keys = []\n if path.respond_to? :to_str\n special_chars = %w{. + ( ) $}\n pattern =\n path.to_str.gsub(/((:\\w+)|[\\*#{special_chars.join}])/) do |match|\n case match\n when \"*\"\n keys << 'splat'\n \"(.*?)\"\n when *special_chars\n Regexp.escape(match)\n else\n keys << $2[1..-1]\n \"([^/?#]+)\"\n end\n end\n # Wrap the regex in parens so the regex works properly.\n # They can fail when there's an | for example (matching only the last one).\n # Note: this means we also need to remove the first matched value.\n [/\\A(#{pattern})\\z/, keys]\n elsif path.respond_to?(:keys) && path.respond_to?(:match)\n [path, path.keys]\n elsif path.respond_to?(:names) && path.respond_to?(:match)\n [path, path.names]\n elsif path.respond_to? :match\n [path, keys]\n else\n raise TypeError, path\n end\n end", "title": "" }, { "docid": "9fba876fdea0bd97d5a95a9dca4b22c1", "score": "0.6170151", "text": "def path2navigate(path)\n path.split('/').map { |x| \"\\\"#{x}\\\"\" }.join(', ')\n end", "title": "" }, { "docid": "eed34233aeb50a2d422dec32daa565a2", "score": "0.61531115", "text": "def path2navigate(path)\n \"[#{path.split('/').map { |x| \"'#{x}'\" }.join(', ')}]\"\n end", "title": "" }, { "docid": "547acd1c7820ba1b1484153f3f1a926a", "score": "0.6123153", "text": "def splitfn(path)\n path =~ /\\A ((?: .*\\/ )?) ([^\\/]+) \\Z/x\n return [$1, $2]\n end", "title": "" }, { "docid": "ab889375b1933d580bc6ccd1e3e8e939", "score": "0.6102856", "text": "def decompose_htagpath(path)\n path.split('/').take_while{|frag|\n # 潜在的な危険性のある文字列を発見したら、そのパスについては\n # 危険な文字列以降を捨てる。\n # (たとえば'a/b/../c'であれば'a/b'までが使われる)。\n # 空文字列でない\n !frag.empty? &&\n # \"index.html\" でない(タグページに使うため、この名前のディレクトリができては困る)\n (frag != 'index.html') &&\n # '..'でない\n (frag != '..') &&\n # backslash ('\\\\')を含まない\n !frag.include?('\\\\') &&\n # asterisk ('*')を含まない\n !frag.include?('*') &&\n # tilde ('~')を含まない\n !frag.include?('~')\n }\n end", "title": "" }, { "docid": "2404262b99485bad25b800601f8152a1", "score": "0.6089858", "text": "def analyse_path path\n raise 'path must contain no new line' if path.index \"\\n\"\n raise 'path must start with /' unless path.start_with? '/'\n path = path.sub(/\\/$/, '') if path != '/'\n\n path.split(/(?=%[dfsux])/, 2)\n end", "title": "" }, { "docid": "8e66cae0a00c7ab67cf16614598b3278", "score": "0.60011894", "text": "def chunk_path(path)\n normalize(path).split('/')\n end", "title": "" }, { "docid": "873cb34e7b626c42094ac40b7fc79cae", "score": "0.5991475", "text": "def interpolated_params(path)\n path.split('/').reject { |i| i.length.zero? || i !~ /^:/ }.uniq.map { |i| i[1..-1].to_sym }\n end", "title": "" }, { "docid": "28b8dc613422ad06bb1a3d428eb2b7de", "score": "0.59655505", "text": "def normalize_path(path)\n components = []\n if path.respond_to?(:split) # likely a String\n components = path_components(path)\n elsif path.respond_to?(:join) # likely an Array\n components = filter_components(path)\n end\n return separator + join_path(components)\n end", "title": "" }, { "docid": "f90ca97bee31603a706ed384333bcede", "score": "0.5937053", "text": "def split(*path) \n category = \"\"\n id = \"\"\n if path.length == 1\n path = path.first.split(\"/\")\n end\n [path.first, path.last]\n end", "title": "" }, { "docid": "a070af822f2de326eafeede35ccba448", "score": "0.59351176", "text": "def get_url_parts(path)\n result = path.match(@url_parts_matcher)\n result ? result.names.map {|name| name.to_sym}.zip(result.captures).to_h : {resource: ''}\n end", "title": "" }, { "docid": "36297fb64cb905063fb18a399d0f6510", "score": "0.5844262", "text": "def compile_path(path)\n @segments = []\n compiled = \"\"\n\n return nil if path.nil? || path.empty?\n\n path.each do |part|\n case part\n when Regexp\n @regexp = true\n @segments = []\n compiled << part.source.sub(/^\\^/, '').sub(/\\$$/, '')\n when String\n segments = segments_with_optionals_from_string(part.dup)\n compile_path_segments(compiled, segments)\n # Concat the segments\n unless regexp?\n if @segments[-1].is_a?(String) && segments[0].is_a?(String)\n @segments[-1] << segments.shift\n end\n @segments.concat segments\n end\n else\n raise ArgumentError.new(\"A route path can only be specified as a String or Regexp\")\n end\n end\n \n unless regexp?\n @variables = @segments.flatten.select { |s| s.is_a?(Symbol) }\n compiled.gsub!(%r[/+], '/')\n compiled.gsub!(%r[(.+)/$], '\\1')\n end\n\n compiled\n end", "title": "" }, { "docid": "42e13def1bd56e6a673beb801828653a", "score": "0.5825325", "text": "def path_parse(string)\n string.scan(/:(\\w+)\\W/).flatten\n end", "title": "" }, { "docid": "a3b53493b50f17e2b84f166b9cd708f6", "score": "0.5824862", "text": "def splitPropPath(propPath)\n pathArray = []\n inKey = false\n pc = ''\n\n propPath.split(//).each do |c|\n case c\n when '.'\n unless inKey\n pathArray << pc\n pc = ''\n next\n end\n when '['\n inKey = true\n when ']'\n inKey = false\n end\n pc << c\n end\n pathArray << pc unless pc.empty?\n\n pathArray\n end", "title": "" }, { "docid": "fbd827295b48d5b6c245e97c330b919c", "score": "0.5821653", "text": "def path\n temporary = []\n actual_route = nil\n router do |route|\n actual_route = extract_and_format_route(route)\n temporary.push(actual_route) unless temporary.include?(actual_route)\n actual_route\n end\n temporary\n end", "title": "" }, { "docid": "963091683c2242381e781b9c40689ad1", "score": "0.5814432", "text": "def get_route_with_params(path)\n params = {:splat => []}\n route = get_route(path) do |node, val|\n if node.wildcard?\n params[node.name] = val \n elsif node.absorbent?\n params[:splat] << val \n end\n end\n [route, params]\n end", "title": "" }, { "docid": "120a29354e6f2ae7a1aad8a0686f54ee", "score": "0.58039254", "text": "def format_path(path)\n formatted_path = Array.new\n path.each do |position|\n formatted_path.push('(' + position.join(',') + ')')\n end\n return formatted_path.join('->')\nend", "title": "" }, { "docid": "2aef9b14e82309116928e057ff24907b", "score": "0.5776074", "text": "def split_path(str)\n return str.map(&:to_s) if str.is_a?(::Array)\n @delimiter_handler.split_path(str.to_s)\n end", "title": "" }, { "docid": "d0e61caad47d145da9738c0bd7f50947", "score": "0.5772573", "text": "def decompose_entity_path( path )\n return unless path.present?\n\n path.split( \"/\" ).map do |node|\n entity, id = node.split \"[\"\n\n [ entity, id[ 0..-2 ] ]\n end\n end", "title": "" }, { "docid": "32e07b34157447ffcaf77865ea07cb8e", "score": "0.57596135", "text": "def path_keys(path)\n path.split(\"/\").reject { |c| c.empty? }\n end", "title": "" }, { "docid": "bc6399ce923b1002e7eb36c51fb7366f", "score": "0.57470167", "text": "def split_names(path)\n names = []\n while r = chop_basename(path)\n path, basename = r\n names.unshift basename\n end\n return path, names\n end", "title": "" }, { "docid": "44dd4db8e3af30f8684b2fe8e265776a", "score": "0.5746935", "text": "def parse_path_components(components)\n if ['path', 'url'].include?(components.last)\n [components, components.pop]\n else\n [components, 'path']\n end\n end", "title": "" }, { "docid": "fde36df9683fbe7a6feb5ca8b2993563", "score": "0.5741006", "text": "def path_to_partial_paths(path)\n path.to_s.split('/')\n end", "title": "" }, { "docid": "960d98314db4861f38ed692891a4d1fd", "score": "0.57368034", "text": "def parse_path(path)\n parsed_path = path.starts_with?(\"/\") ? path : \"/#{path}\"\n parsed_path = URI.encode(parsed_path)\n URI.parse(parsed_path).to_s \n end", "title": "" }, { "docid": "b5f405f8e269bb5c3251b788deab8aa7", "score": "0.570847", "text": "def symbol_segments\n (segments || []).select{ |s| s.is_a?(Symbol) }\n end", "title": "" }, { "docid": "358f22cf4955aa2f77ac3adc683f0963", "score": "0.56852907", "text": "def split_names(path)\n names = []\n while r = chop_basename(path)\n path, basename = r\n names.unshift basename\n end\n return path, names\n end", "title": "" }, { "docid": "eb470ae69d97def9f9f5b46b46c8e2c6", "score": "0.56507164", "text": "def split_names(path)\n names = []\n while r = chop_basename(path)\n path, basename = r\n names.unshift basename if basename != '.'\n end\n return path, names\n end", "title": "" }, { "docid": "eb53c5eac6cb713573da1b96e8b82f97", "score": "0.56337065", "text": "def tokenize(path)\n return path if path.respond_to? :to_a\n path, _, file = path.gsub(/^\\//, \"\").rpartition(@delimiter)\n ext = File.extname(file)\n file = File.basename(file, ext)\n path.split(@delimiter).push(file).push(ext)\n end", "title": "" }, { "docid": "21c6c81f7c4ab9dcf402d8525bc9751b", "score": "0.56286484", "text": "def extract_path_data(path_string)\n results = array_wrap(path_string.scan(/([^\\[]*)(\\[)*(\\d|\\-\\d|\\*)*(\\])*/i))\n results.map { |match| { path: match[0], predicate: match[2] } }\n end", "title": "" }, { "docid": "d07ccfc1a17fea59ad7cd17ead53ba89", "score": "0.5619618", "text": "def compile(path)\n path ||= \"\"\n keys = []\n if path.respond_to? :to_str\n special_chars = %w{. + ( )}\n pattern =\n path.gsub(/((:\\w+)|[\\*#{special_chars.join}])/) do |match|\n case match\n when \"*\"\n keys << 'splat'\n \"(.*?)\"\n when *special_chars\n Regexp.escape(match)\n else\n keys << $2[1..-1]\n \"([^/?&#]+)\"\n end\n end\n [/^#{pattern}$/, keys]\n elsif path.respond_to? :match\n [path, keys]\n else\n raise TypeError, path\n end\n end", "title": "" }, { "docid": "b9c8dde00fb859eba14082150aa5cf18", "score": "0.5604164", "text": "def value_path(path)\n path.split('.').reduce(self) do |a, b|\n if a\n if a.is_a?(Array)\n a[b.to_i]\n else\n a[b] || a[b.to_sym]\n end\n end\n end\n end", "title": "" }, { "docid": "275768691b2afff2923fbd12019bb609", "score": "0.5548206", "text": "def params_given path\n path.split('/').map { |s| s if s.size > 0 }.compact\n end", "title": "" }, { "docid": "2174d5afce61ace99e28e4f45d3ba5fc", "score": "0.55443776", "text": "def process_path_params path\n match = @matcher.match path\n values = match.captures.to_a\n\n if @path_keys.any?\n @path_keys.zip(values).inject({}) do |hash,(k,v)|\n if k == 'splat'\n (hash[k] ||= []) << v\n else\n hash[k] = v\n end\n\n hash\n end\n\n elsif values.any?\n {'captures' => values}\n\n else\n {}\n end\n end", "title": "" }, { "docid": "37e0a803b4d8718f5b696dd4c8ac8de8", "score": "0.55387026", "text": "def symbol_segments\n segments.select{ |s| s.is_a?(Symbol) }\n end", "title": "" }, { "docid": "611ed091f8245afd6da3f79c3256d441", "score": "0.5505415", "text": "def to_a\n array = split(@sep) # Split string by path separator\n array.delete(\"\") # Remove empty elements\n array\n end", "title": "" }, { "docid": "c9287e2e85bb65830b741931a618ec19", "score": "0.54829115", "text": "def decompose_path_item(path_item)\n element, index = path_item.split('[')\n index = index[0..-2].to_i if index\n [element, index]\n end", "title": "" }, { "docid": "acec5a718b0a7cd11511a4a54113330d", "score": "0.54772425", "text": "def recognize_path(path_info)\n route, params = recognize(Rack::MockRequest.env_for(path_info)).first\n [route.name, params.inject({}){|hash, (key, value)| hash[key] = value; hash }]\n end", "title": "" }, { "docid": "e4f0557535059724c3138102661106ad", "score": "0.54608685", "text": "def parse_path_extnames(path)\n mime_type = nil\n engine_extnames = []\n len = path.length\n\n path_extnames(path).reverse_each do |extname|\n if engines.key?(extname)\n mime_type = engine_mime_types[extname]\n engine_extnames.unshift(extname)\n len -= extname.length\n elsif mime_exts.key?(extname)\n mime_type = mime_exts[extname]\n len -= extname.length\n break\n else\n break\n end\n end\n\n name = path[0, len]\n return [name, mime_type, engine_extnames]\n end", "title": "" }, { "docid": "e4f0557535059724c3138102661106ad", "score": "0.54608685", "text": "def parse_path_extnames(path)\n mime_type = nil\n engine_extnames = []\n len = path.length\n\n path_extnames(path).reverse_each do |extname|\n if engines.key?(extname)\n mime_type = engine_mime_types[extname]\n engine_extnames.unshift(extname)\n len -= extname.length\n elsif mime_exts.key?(extname)\n mime_type = mime_exts[extname]\n len -= extname.length\n break\n else\n break\n end\n end\n\n name = path[0, len]\n return [name, mime_type, engine_extnames]\n end", "title": "" }, { "docid": "e4f0557535059724c3138102661106ad", "score": "0.54608685", "text": "def parse_path_extnames(path)\n mime_type = nil\n engine_extnames = []\n len = path.length\n\n path_extnames(path).reverse_each do |extname|\n if engines.key?(extname)\n mime_type = engine_mime_types[extname]\n engine_extnames.unshift(extname)\n len -= extname.length\n elsif mime_exts.key?(extname)\n mime_type = mime_exts[extname]\n len -= extname.length\n break\n else\n break\n end\n end\n\n name = path[0, len]\n return [name, mime_type, engine_extnames]\n end", "title": "" }, { "docid": "c2fcc369bed5be318d4069dfb91ab80e", "score": "0.54564863", "text": "def public_path_segments(path)\n segments = []\n \n path.split(SPLIT).each do |seg|\n next if seg.empty? || seg == '.'\n seg == '..' ? segments.pop : segments << seg\n end\n \n segments\n end", "title": "" }, { "docid": "ec7b1de39daabcc078fa0ff37284decf", "score": "0.5446613", "text": "def path_as_array\n get_path_name_array().reverse\n end", "title": "" }, { "docid": "ec7b1de39daabcc078fa0ff37284decf", "score": "0.5446613", "text": "def path_as_array\n get_path_name_array().reverse\n end", "title": "" }, { "docid": "d414d0a75ccc3214ba3fd92b11260ea4", "score": "0.54360783", "text": "def path_as_array\n get_path_name_array().reverse\n end", "title": "" }, { "docid": "f7571f16549ace269ef6e014b7c36255", "score": "0.5423041", "text": "def parse_path(path)\n path = normalise_path(path)\n\n # if we do not have param sections, just return the string\n return path unless path.include?('/:')\n\n path = path.gsub(%r{/:\\w+}) do |m|\n m.sub!('/:', '')\n @params.push(m)\n '(/\\w+)'\n end\n\n Regexp.new(\"^#{path}$\")\n end", "title": "" }, { "docid": "d497be39434dda9e433c9ef1c62d9f47", "score": "0.5419507", "text": "def path_as_array\n get_path_name_array.reverse\n end", "title": "" }, { "docid": "c3331342d928d0632cce71396ff70fd5", "score": "0.5418868", "text": "def process_path(path)\n add_debug(*path.info(\"process_path\"))\n\n object = process_expression(path.pathitem)\n \n # Create a list of direction/predicate pairs\n path_list = process_path_list(path.expression, path.respond_to?(:reverse))\n #puts path_list.inspect\n # Now we should have the following\n # [\n # [:forward, b]\n # [:forward, c]\n # ]\n path_list.each do |p|\n reverse, pred = p\n bnode = BNode.new\n if reverse\n add_triple(\"path(#{reverse})\", bnode, pred, object)\n else\n add_triple(\"path(#{reverse})\", object, pred, bnode)\n end\n object = bnode\n end\n object\n end", "title": "" }, { "docid": "7c93f4dbbb782c19386b331de9eac611", "score": "0.54054457", "text": "def demodulize(path)\n path = path.to_s\n\n if (i = path.rindex(\"::\"))\n path[(i + 2)..]\n else\n path\n end\n end", "title": "" }, { "docid": "ad28b7a445ca8a8a4eb35997a34557cb", "score": "0.5401257", "text": "def parse path_str\n match = @matcher.match path_str\n return unless match\n\n values = match.captures.to_a\n\n if @keys.any?\n @keys.zip(values).inject({}) do |hash,(k,v)|\n if k == 'splat'\n (hash[k] ||= []) << v\n else\n hash[k] = v unless v.nil?\n end\n\n hash\n end\n\n elsif values.any?\n {'captures' => values}\n\n else\n {}\n end\n end", "title": "" }, { "docid": "536023fb5a95b33d8de91210f037c567", "score": "0.5368771", "text": "def extract_path(path_reference)\n return [path_reference] unless path_reference.start_with?('[') && path_reference.end_with?(']')\n\n path_reference[1...-1].split('][')\n end", "title": "" }, { "docid": "536023fb5a95b33d8de91210f037c567", "score": "0.5368771", "text": "def extract_path(path_reference)\n return [path_reference] unless path_reference.start_with?('[') && path_reference.end_with?(']')\n\n path_reference[1...-1].split('][')\n end", "title": "" }, { "docid": "e81c4d4435c91b3e5eeb10d147df1c75", "score": "0.53554237", "text": "def parse(keypath)\n if /\\s/ =~ keypath\n raise(KeyError, \"keypath '#{keypath}' contains whitespace\")\n end\n keypath.split('.').map { |segment| parse_segment segment }\n end", "title": "" }, { "docid": "4b1785ada6f87b3b3651b53f1ca40762", "score": "0.53529197", "text": "def parse_path(input)\n state = 'run'\n stack = []\n ret = ''\n sc = StringScanner.new(input)\n while state == 'run'\n chr = sc.getch\n case chr\n when nil\n state = if stack.empty?\n 'halt'\n else\n 'error'\n end\n when /\\s/\n if stack.empty?\n state = 'halt'\n else\n ret << chr\n end\n when '['\n stack.push(chr)\n ret << chr\n when ']'\n if stack.last == '['\n stack.pop\n ret << chr\n else\n state = 'error'\n end\n when '('\n stack.push(chr)\n ret << chr\n when ')'\n if stack.last == '('\n stack.pop\n ret << chr\n else\n state = 'error'\n end\n when '\"'\n if stack.last == '\"'\n stack.pop\n else\n stack.push(chr)\n end\n ret << chr\n when \"'\"\n if stack.last == \"'\"\n stack.pop\n else\n stack.push(chr)\n end\n ret << chr\n else\n ret << chr\n end\n end\n raise ArgumentError, \"Couldn't parse path expresion from #{path}\" unless state == 'halt'\n sc.scan(/\\s*/)\n [ret, sc.rest]\n end", "title": "" }, { "docid": "4c73a049a13e7e0fb6c3162d267a3fc0", "score": "0.5344231", "text": "def path_params\n Hash[@path_params.map { |param, value| [param, cast_to_string(value)] }]\n end", "title": "" }, { "docid": "4a5706bb002133bba4807d727b0077e4", "score": "0.5338469", "text": "def path_parts\n @path_parts ||= PathParts.new(*path.match(PATH_PARTS_REGEX).captures)\n end", "title": "" }, { "docid": "47af5471d455a935c72aa81e5c9cb539", "score": "0.53238845", "text": "def encode_path(path)\n num = den = 1\n postfix = path.dup\n\n while postfix\n sibling, postfix = postfix.split('.', 2)\n num, den = child(num, den, sibling.to_i)\n end\n\n return num, den\n end", "title": "" }, { "docid": "676954c26c9d753b8f393b8d7ba0a71e", "score": "0.5323279", "text": "def chain_from_path(path)\n chain = path.split(\".\") do |key|\n key.strip\n end\n return chain\n end", "title": "" }, { "docid": "3f4cdc80058289522386cb0f78033997", "score": "0.53107893", "text": "def path_components(path, relative_to = nil)\n #convert to relative path if requested\n path = path[relative_to.length..-1] if relative_to\n #convert /path/to/file/ to [\"path\", \"to\", \"file\"]\n path.split('/').select{|v| v != ''} \nend", "title": "" }, { "docid": "5cb144a45ad650f81c1d06088089c1ec", "score": "0.5293745", "text": "def split_all(path); end", "title": "" }, { "docid": "04aaa8d0025639e0ec71c6b77f7d6a99", "score": "0.5279487", "text": "def split\n File.split(@path).map(&Path)\n end", "title": "" }, { "docid": "04aaa8d0025639e0ec71c6b77f7d6a99", "score": "0.5279487", "text": "def split\n File.split(@path).map(&Path)\n end", "title": "" }, { "docid": "932fa31dd777ec0e5c5c30b7acb0f6c3", "score": "0.5266826", "text": "def split_path(pathname)\n pathname.each_filename.inject([]) { |acc, p| acc << p }\n end", "title": "" }, { "docid": "b3c0dd1cd905e3a4e523d72fb44b2a44", "score": "0.526409", "text": "def separate(path)\n path.gsub(%r{/}, File::SEPARATOR)\n end", "title": "" }, { "docid": "72ef27ab82aa3e8341e7d79c9cbe0a31", "score": "0.52509266", "text": "def demodulize(path)\n path = path.to_s\n if i = path.rindex(\"::\")\n path[(i + 2), path.length]\n else\n path\n end\n end", "title": "" }, { "docid": "7e66deef18ad30c81504dc09755b8fcf", "score": "0.52309", "text": "def parse_route(route)\n feature_name, action_name = route.to_s.split('/')\n\n feature_name = handle_parsed_string(feature_name)\n action_name = handle_parsed_string(action_name)\n\n handle_empty_feature(feature_name)\n handle_empty_action(action_name)\n\n\n [route, feature_name, action_name]\n end", "title": "" }, { "docid": "47c2d91feccd9be41fccc916f7ab19a1", "score": "0.52293074", "text": "def parse_path_v2\n token = raw(@extended_flag == 1 ? 8 : 2)\n @path = \"\"\n begin\n @path += token.unpack(\"Z*\").first\n break if token.unpack(\"C*\").last == 0\n end while(token = raw(8))\n end", "title": "" }, { "docid": "f5e6a80758f0841685078d7f0d7cc4cd", "score": "0.52171874", "text": "def path_map(requested_path=env['REQUEST_PATH'])\n requested_path.split('.')[0].split('/')[1..-1]\n end", "title": "" }, { "docid": "9c57ce6baeb4d61329dca57b22212a86", "score": "0.5208291", "text": "def __pathify(*segments)\n Array(segments).flatten.\n compact.\n reject { |s| s.to_s.strip.empty? }.\n join('/').\n squeeze('/')\n end", "title": "" }, { "docid": "9dd39931d0c0bfd558ed64c3a91d8c67", "score": "0.5206307", "text": "def split_subpath(path, subpath); end", "title": "" }, { "docid": "9dd39931d0c0bfd558ed64c3a91d8c67", "score": "0.5206307", "text": "def split_subpath(path, subpath); end", "title": "" }, { "docid": "63dcc1e0febb9f00d5c0441579da82d4", "score": "0.5206133", "text": "def parse_path(path)\n full_path = path\n if path.nil?\n full_path = '/'\n end\n if more_path\n full_path += '/' + more_path\n end\n return full_path\n end", "title": "" }, { "docid": "a86920add0e98689050e6b97f6ac4ea1", "score": "0.5200838", "text": "def __pathify(*segments)\n Array(segments).flatten.\n compact.\n reject { |s| s.to_s =~ /^\\s*$/ }.\n map { |s| __escape(s) }.\n join('/').\n squeeze('/')\n end", "title": "" }, { "docid": "ea27117daeb8c84115f2577579f629bf", "score": "0.51976717", "text": "def by_path(path)\n parse_one(path, extract(path: path))\n end", "title": "" }, { "docid": "faeaa7aa10c4fc306227c07451557fdb", "score": "0.5197158", "text": "def at_path(path)\n parts = path.split(\".\")\n parts.inject(@data) do |a, d|\n a[d] if a\n end\n end", "title": "" }, { "docid": "ba8bca9802128a01a0b160f7460d7562", "score": "0.5185211", "text": "def pattern_for(path)\n atoms = path.to_s.split('/').grep(/\\S/)\n atoms.unshift('')\n patterns, joiner = [], '/'\n\n atoms.size.times do |enum|\n enum += 1\n pattern = atoms.dup\n\n controller = pattern[0, enum].join(joiner)\n controller.gsub!(/^__/, '/')\n controller = \"/\" if controller == \"\"\n\n pattern = pattern[enum..-1]\n args, temp = [], []\n\n patterns << [controller, 'index', atoms[enum..-1]]\n\n until pattern.empty?\n args << pattern.shift\n joined = args.join('__')\n patterns << [controller, joined, pattern.dup]\n patterns << [controller, \"#{joined}__index\", pattern.dup]\n end\n end\n\n patterns.reverse!\n end", "title": "" }, { "docid": "2a1e4c5498eaa8ba2ccc2daeb608ed1b", "score": "0.5173035", "text": "def process_path(path)\n pathitem, direction, pathtail = path[:pathitem], path[:direction], path[:pathtail]\n debug(\"process_path\", depth: @options[:depth]) {path.inspect}\n\n while pathtail\n bnode = bnode()\n pred = pathtail.is_a?(RDF::Term) ? pathtail : pathtail[:pathitem]\n if direction == :reverse\n add_statement(\"process_path(reverse)\", bnode, pred, pathitem)\n else\n add_statement(\"process_path(forward)\", pathitem, pred, bnode)\n end\n pathitem = bnode\n direction = pathtail[:direction] if pathtail.is_a?(Hash)\n pathtail = pathtail.is_a?(Hash) && pathtail[:pathtail]\n end\n pathitem\n end", "title": "" }, { "docid": "f23a929f6cacbc3eb2045e7671570579", "score": "0.51714927", "text": "def parse_path_extnames(path)\n engines = []\n extname, value = match_path_extname(path, extname_map)\n\n if extname\n path = path.chomp(extname)\n type, engines, pipeline = value.values_at(:type, :engines, :pipeline)\n end\n\n return path, type, engines, pipeline\n end", "title": "" }, { "docid": "0d82c57ff996ce433d7803c2f688f4d6", "score": "0.51578456", "text": "def test_path_decode\n assert_equal [], CoAP.path_decode('/')\n assert_equal ['foo'], CoAP.path_decode('/foo')\n assert_equal ['foo', ''], CoAP.path_decode('/foo/') # confusing!\n assert_equal %w(foo bar), CoAP.path_decode('/foo/bar')\n assert_equal ['f.o', 'b-r'], CoAP.path_decode('/f.o/b-r')\n assert_equal ['f(o', 'b)r'], CoAP.path_decode('/f(o/b)r')\n assert_equal ['foo', 'b/r'], CoAP.path_decode('/foo/b%2Fr')\n assert_equal ['foo', 'b&r'], CoAP.path_decode('/foo/b&r')\n assert_equal ['føo', 'bär'], CoAP.path_decode('/f%C3%B8o/b%C3%A4r')\n end", "title": "" }, { "docid": "9a8f49e5809ea7824da863853cf7aef9", "score": "0.5153905", "text": "def compile_path\n @keys = []\n if @path.respond_to? :to_str\n special_chars = %w{. + ( )}\n pattern =\n @path.to_str.gsub(/((:\\w+)|[\\*#{special_chars.join}])/) do |match|\n case match\n when \"*\"\n @keys << 'splat'\n \"(.*?)\"\n when *special_chars\n Regexp.escape(match)\n else\n @keys << $2[1..-1]\n \"([^/?&#]+)\"\n end\n end\n @pattern = /^#{pattern}$/\n elsif @path.respond_to?(:keys) && @path.respond_to?(:match)\n @pattern = @path\n @keys = @path.keys\n elsif @path.respond_to? :match\n @pattern = path\n else\n raise TypeError, @path\n end\n end", "title": "" } ]
53ea0881abc2509dad92b4cc871d64e1
POST /descriptions POST /descriptions.xml
[ { "docid": "659dac0b93d3f5946da8801123dad542", "score": "0.6343009", "text": "def create\n @description = Description.new(params[:description])\n \n respond_to do |format|\n if @description.save_and_index\n flash[:notice] = 'Description was successfully created.'\n format.html { redirect_to(@description) }\n format.xml { render :xml => @description, :status => :created, :location => @description }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @description.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "61f0a0c9e123cc7d73a4aac8177f7102", "score": "0.6242366", "text": "def create\n @desc = Desc.new(params[:desc])\n\n respond_to do |format|\n if @desc.save\n format.html { redirect_to @desc, notice: 'Desc was successfully created.' }\n format.json { render json: @desc, status: :created, location: @desc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @desc.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e83ac7860067ab54c86cf813973d8c77", "score": "0.62011606", "text": "def create\n @description = Description.new(description_params)\n\n respond_to do |format|\n if @description.save\n format.html { redirect_to @description, notice: 'Description was successfully created.' }\n format.json { render :show, status: :created, location: @description }\n else\n format.html { render :new }\n format.json { render json: @description.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fddb1c15d4fc5c4ebab45136ecd2a9ee", "score": "0.6038847", "text": "def create\n json_response(Description.create!(description_params), :created)\n end", "title": "" }, { "docid": "ba75d768f5e2993f98a078b62cafbca8", "score": "0.60229665", "text": "def create\n @admin_description = Admin::Description.new(admin_description_params)\n\n respond_to do |format|\n if @admin_description.save\n format.html { redirect_to @admin_description, notice: 'Description was successfully created.' }\n format.json { render :show, status: :created, location: @admin_description }\n else\n format.html { render :new }\n format.json { render json: @admin_description.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b74c10cbf43d505f004eb49024b21627", "score": "0.589225", "text": "def postEntityDescription( entity_id, headline, body, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['headline'] = headline\n params['body'] = body\n params['gen_id'] = gen_id\n return doCurl(\"post\",\"/entity/description\",params)\n end", "title": "" }, { "docid": "c78e0b38d566040be49ce816aa8db91e", "score": "0.5719953", "text": "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "title": "" }, { "docid": "d6eadaf4c6fe58c268ecc95a7aac1c19", "score": "0.5709687", "text": "def description_params\n\t\t params.require(:description).permit(:described_name, :content, :interests, :hobbies, :additional_authors)\n\t\tend", "title": "" }, { "docid": "44f1c4410ed840b6128028b3131dd00d", "score": "0.5657441", "text": "def description_params\n params.require(:description).permit(:content)\n end", "title": "" }, { "docid": "10e15692f8c55ff361dd59ea192a6ccc", "score": "0.55282027", "text": "def index\n set_sort_params(params, params[:description])\n find_descriptions(params)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @descriptions }\n format.atom\n end\n end", "title": "" }, { "docid": "6fa8396b9e1635d280744fc17544eb4e", "score": "0.551251", "text": "def index\n @descriptions = Description.all\n end", "title": "" }, { "docid": "6fa8396b9e1635d280744fc17544eb4e", "score": "0.551251", "text": "def index\n @descriptions = Description.all\n end", "title": "" }, { "docid": "6d45a843d04e4bcb1f2e9949bcb0e581", "score": "0.54880995", "text": "def create\n @home_categories_products_indices_description = Home::Categories::Products::Indices::Description.new(params[:home_categories_products_indices_description])\n\n respond_to do |format|\n if @home_categories_products_indices_description.save\n format.html { redirect_to @home_categories_products_indices_description, notice: 'Description was successfully created.' }\n format.json { render json: @home_categories_products_indices_description, status: :created, location: @home_categories_products_indices_description }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_categories_products_indices_description.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9e21e4f9d2c5522dbd5eb3313248dd5", "score": "0.54590714", "text": "def post #:doc:\n end", "title": "" }, { "docid": "f9bb0950fff62cfc56af310eb7e192a1", "score": "0.5446097", "text": "def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end", "title": "" }, { "docid": "93912151c9899a0fd0a82df8aaec6b83", "score": "0.5436019", "text": "def process_descriptions(n)\n descriptions = self.feature.descriptions\n delete_descriptions = self.fields.delete('descriptions.delete')\n descriptions.clear if !delete_descriptions.blank? && delete_descriptions.downcase == 'yes'\n 0.upto(n) do |i|\n prefix = i>0 ? \"#{i}.descriptions\" : 'descriptions'\n description_content = self.fields.delete(\"#{prefix}.content\")\n if !description_content.blank?\n description_content = \"<p>#{description_content}</p>\"\n author_name = self.fields.delete(\"#{prefix}.author.fullname\")\n description_title = self.fields.delete(\"#{prefix}.title\")\n author = author_name.blank? ? nil : AuthenticatedSystem::Person.find_by(fullname: author_name)\n description = description_title.blank? ? descriptions.find_by(content: description_content) : descriptions.find_by(title: description_title) # : descriptions.find_by(['LEFT(content, 200) = ?', description_content[0...200]])\n language = Language.get_by_code_or_name(self.fields.delete(\"#{prefix}.languages.code\"), self.fields.delete(\"#{prefix}.languages.name\"))\n attributes = {:content => description_content, :title => description_title}\n attributes[:language_id] = language.id if !language.nil?\n if description.nil?\n if language.nil?\n self.say \"Language needed to create description for feature #{self.feature.pid}.\"\n description = nil\n else\n description = descriptions.create(attributes)\n end\n else\n description.update_attributes(attributes)\n end\n if !description.nil?\n self.spreadsheet.imports.create(:item => description) if description.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n description.authors << author if !author.nil? && !description.author_ids.include?(author.id)\n end\n end\n end \n end", "title": "" }, { "docid": "82dcf1255b4ce323cd04602e6f420649", "score": "0.54187095", "text": "def description_params\n params.require(:description).permit(:title,:content)\n end", "title": "" }, { "docid": "28ac19a6f9e5741978f9d6f704e37b14", "score": "0.53964806", "text": "def post\n \"\n desc 'create #{resource.singularize}' do\n tags %w[#{resource.singularize}]\n end\n params do\n # TODO: specify the parameters\n end\n post do\n # your code goes here\n end\"\n end", "title": "" }, { "docid": "d5a9d3c5191240ee289d7b0c73106513", "score": "0.53857106", "text": "def create\n @descriptor = Descriptor.new(descriptor_params)\n\n respond_to do |format|\n if @descriptor.save\n format.html { redirect_to @descriptor, notice: 'Descriptor was successfully created.' }\n format.json { render :show, status: :created, location: @descriptor }\n else\n format.html { render :new }\n format.json { render json: @descriptor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "109fdac220ed1bdccbb501cc2ff6131d", "score": "0.5385001", "text": "def addlabeldesc\n label = Label.find(params[:label][:id])\n label.description = params[:label][:description].strip\n label.save\n \n respond_to do |format|\n format.html { redirect_to label, notice: \"The description for this label has been successfully updated.\" }\n end\n \n end", "title": "" }, { "docid": "bb38ef589949091cb1e9819434f668c5", "score": "0.53835547", "text": "def create\n @descriptor_especifico = DescriptorEspecifico.new(params[:descriptor_especifico])\n\n respond_to do |format|\n if @descriptor_especifico.save\n flash[:notice] = 'DescriptorEspecifico se creo exitosamente..'\n format.html { redirect_to(admin_descriptor_especificos_url) }\n format.xml { render :xml => @descriptor_especifico, :status => :created, :location => @descriptor_especifico }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @descriptor_especifico.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e635eba96cec0f95da880340058a4db", "score": "0.5364813", "text": "def destroy\n @description = Description.find(params[:id])\n @description.destroy\n \n respond_to do |format|\n format.html { redirect_to(descriptions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e58dd9bcb6f95414e15b73fa46e48fb5", "score": "0.53634596", "text": "def create\n @file_description = FileDescription.new(file_description_params)\n\n respond_to do |format|\n if @file_description.save\n format.html { redirect_to @file_description, notice: 'File description was successfully created.' }\n format.json { render :show, status: :created, location: @file_description }\n else\n format.html { render :new }\n format.json { render json: @file_description.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eaa11396336b8356ccc5cdee62fe7233", "score": "0.53598154", "text": "def create\n @admin_additional_description = @product.additional_descriptions.build(admin_additional_description_params)\n\n respond_to do |format|\n if @admin_additional_description.save\n format.html { redirect_to admin_products_path, notice: 'Additional description was successfully created.' }\n format.json { render :show, status: :created, location: @admin_additional_description }\n else\n format.html { render :new }\n format.json { render json: @admin_additional_description.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c86cbdd7f18ac151bda43cf237ec599", "score": "0.5333721", "text": "def index\n redirect_to category_child_url(@main_category,@category)\n #@descriptions = @category.descriptions\n #respond_to do |format|\n # format.xml\n #end\n end", "title": "" }, { "docid": "6c9df92b7b5866afd54f6b7a4dfa8279", "score": "0.5326332", "text": "def admin_description_params\n params.require(:admin_description).permit(:name, :text)\n end", "title": "" }, { "docid": "80686e56dd8048dd747661348e261ea8", "score": "0.5322814", "text": "def create\n @description_item = DescriptionItem.new(description_item_params)\n\n respond_to do |format|\n if @description_item.save\n format.html { redirect_to @description_item, notice: 'Description item was successfully created.' }\n format.json { render :show, status: :created, location: @description_item }\n else\n format.html { render :new }\n format.json { render json: @description_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c47ac5762ba76b2834ff052f3c0c7f8", "score": "0.5313073", "text": "def create_desc_item(node_name, id_suffix)\n \n #puts \"node_name = #{node_name}\"\n #puts \"id_suffix = #{id_suffix}\"\n \n node = @xml.at('/ead/archdesc/' + node_name)\n return unless node\n if head = node.at('head')\n label = head.text.empty? ? id_suffix : head.text.capitalize\n else\n label = id_suffix\n end\n \n doc = self.base_doc.merge({\n :xml_display => node.to_xml,\n :id => generate_id(id_suffix),\n :title_t => label,\n :hierarchy => [self.title, label]\n })\n doc\n end", "title": "" }, { "docid": "bb54e93f24e3fffc91d10f82a44a244b", "score": "0.5300734", "text": "def new\n @description = Description.new\n @description.edition_id = params[:edition_id]\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @description }\n end\n end", "title": "" }, { "docid": "6af72106c9060be9e662e73cd04ab1c4", "score": "0.5299678", "text": "def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end", "title": "" }, { "docid": "a727960ac2765d41d7ee1d407549e0bd", "score": "0.5284859", "text": "def new\n @descriptor_especifico = DescriptorEspecifico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @descriptor_especifico }\n end\n end", "title": "" }, { "docid": "f0562aae61f7ea8b9051a1b0fee10919", "score": "0.52702904", "text": "def create\n @descriptor = Descriptor.new(descriptor_params)\n if @descriptor.save\n respond_with @descriptor, notice: 'Descriptor was successfully created.' \n else\n render :new \n end\n end", "title": "" }, { "docid": "9cf96f38dc025371acec30fef5762fc2", "score": "0.52556455", "text": "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "title": "" }, { "docid": "396c6389110db4d16f342916fa77b858", "score": "0.52469015", "text": "def add_action_params \n params.permit(:description)\n end", "title": "" }, { "docid": "d86714ebc2bcdb35359c9331214c19c3", "score": "0.5239089", "text": "def description\n query_root_node(\"description/text()\")\n end", "title": "" }, { "docid": "e57ae54265bddaf03bb19df9cd390b7d", "score": "0.5231443", "text": "def create\n @descuento = Descuento.new(descuento_params)\n\n respond_to do |format|\n if @descuento.save\n format.html { redirect_to @descuento, notice: 'Descuento fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @descuento }\n else\n format.html { render :new }\n format.json { render json: @descuento.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf936171225ebcfbced888fe7b8a8b29", "score": "0.5231273", "text": "def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "title": "" }, { "docid": "877eaabc76018e0452cafbf546353346", "score": "0.5224847", "text": "def update\n @description = Description.find(params[:id])\n \n respond_to do |format|\n if @description.update_attributes_and_index(params[:description])\n flash[:notice] = 'Description was successfully updated.'\n format.html { redirect_to(@description) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @description.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9bd3c6f544c04f5b3187a364e2df2c7", "score": "0.51935154", "text": "def description\n element = Element.find(params[:element_id])\n \n respond_with(element.description.to_json)\n end", "title": "" }, { "docid": "159943eb48eb7d4100f27d828d0d56e7", "score": "0.5178029", "text": "def update\n json_response(@description.update!(description_params))\n end", "title": "" }, { "docid": "8abe64e65fa676b4a2584c08b8591191", "score": "0.516499", "text": "def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.51611286", "text": "def POST; end", "title": "" }, { "docid": "179bb675967ee255fc56a5280dda1879", "score": "0.5153148", "text": "def create\n @descriptor_generico = DescriptorGenerico.new(params[:descriptor_generico])\n\n respond_to do |format|\n if @descriptor_generico.save\n flash[:notice] = 'Descriptor Generico se ha creado con exito.'\n format.html { redirect_to(admin_descriptor_genericos_url) }\n format.xml { render :xml => @descriptor_generico, :status => :created, :location => @descriptor_generico }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @descriptor_generico.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d579d25f7261e673c5c8473361dd2ade", "score": "0.5153137", "text": "def description request\n @description\n end", "title": "" }, { "docid": "31d687f49326406f3a371973abdbddfe", "score": "0.5151561", "text": "def new\n\n @definition = Definition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @definition.to_xml(:request => request) }\n format.json { render :json => @definition.to_json(:request => request) }\n end\n end", "title": "" }, { "docid": "9a4d55d7e9ebafcd0679c1b393ad31e9", "score": "0.5140887", "text": "def antique_params\n params.require(:antique).permit(:description)\n end", "title": "" }, { "docid": "d8a3bafed8ffea5fa1b6cf5548db4ff9", "score": "0.51341593", "text": "def new\n @descriptor_generico = DescriptorGenerico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @descriptor_generico }\n end\n end", "title": "" }, { "docid": "31c22cffc73242e404808afd82502d9d", "score": "0.5132142", "text": "def knowledge_params\n params.require(:knowledge).permit(:descricao)\n end", "title": "" }, { "docid": "d14eabbedc16237fede8855ca6a5d6ac", "score": "0.51172346", "text": "def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end", "title": "" }, { "docid": "23cdde8d4b1a2be0bc3eecca07b39e74", "score": "0.51123226", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "title": "" }, { "docid": "3093952dd9f916a5c7f27feab1ddc00a", "score": "0.5110793", "text": "def documentation_params\n params.require(:documentation).permit(:title, :description, :category)\n end", "title": "" }, { "docid": "775a8655912c29c29abb24d27bd0c5ed", "score": "0.51040184", "text": "def create\n @description = Description.new(description_params2)\n @description.company_id = description_params[:company_id]\n\n if Company.find(params[:company_id]).description != nil\n respond_to do |format|\n format.html { redirect_to company_path(@description.company_id), notice: 'No se puede guardar, ya existe una descripción' }\n end\n else\n respond_to do |format|\n if @description.save\n format.html { redirect_to company_path(@description.company_id), notice: 'Description was successfully created.' }\n format.json { render :show, status: :created, location: @description }\n else\n format.html { render :new }\n format.json { render json: @description.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "bc1639ed25112805aab7196fe617099d", "score": "0.5102414", "text": "def descriptor_params\n params.require(:descriptor).permit(:foreign_key_type, :foreign_key_id, :name, :description_id, :category_id)\n end", "title": "" }, { "docid": "35ac36b35145c4324275eebfd9f29f33", "score": "0.51023805", "text": "def set_description\n @description = Description.find(params[:id])\n end", "title": "" }, { "docid": "ea408dbbe280cc0ad67b0e1108727a10", "score": "0.5099475", "text": "def description; @doc['description']; end", "title": "" }, { "docid": "ea408dbbe280cc0ad67b0e1108727a10", "score": "0.5099475", "text": "def description; @doc['description']; end", "title": "" }, { "docid": "8dade7d862267aa4fed16c1a2817894e", "score": "0.50975394", "text": "def postEntityYext_list( entity_id, yext_list_id, description, name, type)\n params = Hash.new\n params['entity_id'] = entity_id\n params['yext_list_id'] = yext_list_id\n params['description'] = description\n params['name'] = name\n params['type'] = type\n return doCurl(\"post\",\"/entity/yext_list\",params)\n end", "title": "" }, { "docid": "e80f71878285a56be2a2a18b0ad3261e", "score": "0.50924027", "text": "def create\n @users_desc = UsersDesc.new(users_desc_params)\n\n respond_to do |format|\n if @users_desc.save\n format.html { redirect_to @users_desc, notice: 'Users desc ha sido creado.' }\n format.json { render :show, status: :created, location: @users_desc }\n else\n format.html { render :new }\n format.json { render json: @users_desc.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c4123d93a22b8bae569f2fa09a7e35f", "score": "0.5081551", "text": "def create\n @descuento = Descuento.new(params[:descuento])\n\n respond_to do |format|\n if @descuento.save\n format.html { redirect_to @descuento, notice: 'Descuento was successfully created.' }\n format.json { render json: @descuento, status: :created, location: @descuento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @descuento.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fad66279df84cb20a7173f1725930ec2", "score": "0.50794077", "text": "def create\n\n @definition = Definition.new(params[:definition])\n\n respond_to do |format|\n\n if @definition.save\n\n flash[:notice] = 'Definition was successfully created.'\n\n format.html {\n redirect_to(@definition)\n }\n format.xml {\n render(\n :xml => @definition.to_xml(:request => request),\n :status => :created,\n :location => @definition)\n }\n format.json {\n render(\n :json => @definition.to_json(:request => request),\n :status => :created,\n :location => @definition)\n }\n\n else\n\n format.html {\n render(:action => 'new')\n }\n format.xml {\n render(:xml => @definition.errors, :status => :unprocessable_entity)\n }\n format.json {\n render(:json => @definition.errors, :status => :unprocessable_entity)\n }\n end\n end\n end", "title": "" }, { "docid": "c5c5ae33469b17c40e19990b6e661caf", "score": "0.50711566", "text": "def description_params\n params.require(:description).permit(:business_type_primary, :amex_business_type, :business_type_secondary, :avg_ticket)\n end", "title": "" }, { "docid": "d5efd313ad02808098d01be26b2a30b8", "score": "0.5069921", "text": "def description=(new_desc)\n @options[:connection].put(\"/namespaces/#{path}\", :payload => {:description => new_desc})\n @options[:description] = new_desc\n end", "title": "" }, { "docid": "38dcf5cc190fa80167ba5906fbea1e81", "score": "0.5064576", "text": "def add_help(id, text)\n url = URI.parse(\"http://#{@@api_url}/helps/add/#{id}.xml#{@config[:apikey]}\")\n req = Net::HTTP::Post.new(url.path+@config[:apikey])\n\n req.basic_auth(@config[:email], @config[:password])\n req.set_form_data({'text' => text})\n\n response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }\n parse(response.body)\n\n end", "title": "" }, { "docid": "c840df2b574d7e45c9a87240d8f7c240", "score": "0.5046293", "text": "def post\n resource.post(request, response)\n end", "title": "" }, { "docid": "4aa2baefb25fe9b3764c88b61f2f52df", "score": "0.5037275", "text": "def new\n @desc = Desc.new\n @phase_collection = Desc.phase_hashes\n @star_collection = Desc.star_hashes\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @desc }\n end\n end", "title": "" }, { "docid": "b0b8260801f62ab8ba3287f1185b03e0", "score": "0.5036013", "text": "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", "title": "" }, { "docid": "76ee87249526e330bcda9f2ee3c01d42", "score": "0.50313747", "text": "def new\n @documentation = Documentation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentation }\n end\n end", "title": "" }, { "docid": "cc3a66c0a97fb52bbea7726292296a5d", "score": "0.5022322", "text": "def create\n @violation_description = ViolationDescription.new(violation_description_params)\n\n respond_to do |format|\n if @violation_description.save\n format.html { redirect_to @violation_description, notice: 'Violation description was successfully created.' }\n format.json { render :show, status: :created, location: @violation_description }\n else\n format.html { render :new }\n format.json { render json: @violation_description.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42046d689d9131ce1ae205fbb79b4194", "score": "0.50185114", "text": "def descriptions\n return attributes[:descriptions] if attributes[:descriptions]\n attributes[:descriptions] = {}\n attributes[:descriptions]\n end", "title": "" }, { "docid": "2d66a2a904ba233c29431da0fd47d076", "score": "0.50044554", "text": "def knowledge_params\n params.require(:knowledge).permit(:name, :desc)\n end", "title": "" }, { "docid": "5d38aaada1f30eecbde453cca2848838", "score": "0.50018924", "text": "def create\n @documentation = Documentation.new(params[:documentation])\n\n respond_to do |format|\n if @documentation.save\n flash[:notice] = 'Documentation was successfully created.'\n format.html { redirect_to(@documentation) }\n format.xml { render :xml => @documentation, :status => :created, :location => @documentation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @documentation.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50bcaaa367d95e8b4c3f8f3287dbd015", "score": "0.5000742", "text": "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "title": "" }, { "docid": "6bd334fcf876655eccdf88e314ab1f6b", "score": "0.49921492", "text": "def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end", "title": "" }, { "docid": "5ec91dc6dc61b91c56829da0d4427fad", "score": "0.4991856", "text": "def permitted_name_description_params\n params.required(:description).\n permit(:classification, :gen_desc, :diag_desc, :distribution, :habitat,\n :look_alikes, :uses, :refs, :notes, :source_name, :project_id,\n :source_type, :public, :public_write)\n end", "title": "" }, { "docid": "fa8fcc23911ab0c33dc007eceacc29f5", "score": "0.49910778", "text": "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "title": "" }, { "docid": "0eb1df6ce4b81d28f3f672c74b534ea8", "score": "0.49851567", "text": "def set_description\n @description = Description.find(params[:id])\n end", "title": "" }, { "docid": "5f3ae334e2155b275dc6b17c183fad56", "score": "0.49848464", "text": "def create\n @series_description = SeriesDescription.new(series_description_params)#params[:series_description])\n\n respond_to do |format|\n if @series_description.save\n flash[:notice] = 'SeriesDescription was successfully created.'\n format.html { redirect_to(@series_description) }\n format.xml { render :xml => @series_description, :status => :created, :location => @series_description }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @series_description.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f70fb51b9eccaad95aa7df41afba303c", "score": "0.49838093", "text": "def ocupation_params\n params.require(:ocupation).permit(:description)\n end", "title": "" }, { "docid": "26f99d95e3e1080f881bd68ae16dc41f", "score": "0.49821594", "text": "def descriptions\n []\n end", "title": "" }, { "docid": "d7047dcb40925dc7ed5a164e3b80826b", "score": "0.49735874", "text": "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "title": "" }, { "docid": "d4e5a3237b15cfe327a75e57c37cdf43", "score": "0.4970546", "text": "def new\n @descuento = Descuento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @descuento }\n end\n end", "title": "" }, { "docid": "d545cdc2b006b38111cb263fda757043", "score": "0.49670625", "text": "def new\n @definition = Definition.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @definition }\n end\n end", "title": "" }, { "docid": "f5bd67bd0658127da9b4b578ff657b49", "score": "0.49612054", "text": "def post_headers\n {\"Content-Type\" => 'text/xml; charset=utf-8'}\n end", "title": "" }, { "docid": "09290eb9421c69e1c24e1c9afe8ccfac", "score": "0.49593878", "text": "def new\n @testing = Testing.new\n @testing.build_documents\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testing }\n end\n end", "title": "" }, { "docid": "046c0ed6b71098bb8b9cc7b4cb31f557", "score": "0.4957455", "text": "def new\n @req_breakdown = ReqBreakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @req_breakdown }\n end\n end", "title": "" }, { "docid": "ee02f5295325451a65dc90a0bba653c6", "score": "0.49547955", "text": "def description(description)\n @controller.description = description\n end", "title": "" }, { "docid": "d0a7220bd600d314a301ecbf85854d48", "score": "0.49540612", "text": "def describe(description)\n api_desc(description)\n end", "title": "" }, { "docid": "0e2d350a963a7c459003452cba50aa9f", "score": "0.49502456", "text": "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "title": "" }, { "docid": "77aeba940846feeb9a26e93a5f033111", "score": "0.4949139", "text": "def show\n find_description(params)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @description.to_xml(:include => { :edition => {:include => {:book => {:include => [:keywords, :sb_keywords, :signum]}}}, :user => { :except => [:email, :password_hash], :include => :library } }) }\n end\n end", "title": "" }, { "docid": "92549f188802a45167eb076f967c293f", "score": "0.49468377", "text": "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "title": "" }, { "docid": "b5283dff25fe8a1569a82808d02195b2", "score": "0.49464378", "text": "def set_description\n @description = Description.find_by(uuid: params[:id])\n end", "title": "" }, { "docid": "78b124686ee65413538fd774fbe028cf", "score": "0.4945691", "text": "def setDescription(description)\n\t\tRestClient.put(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}\",\n \"action=set_description&description=#{description}\")\n\tend", "title": "" }, { "docid": "da950234617aa53dba578e7b5b9f1688", "score": "0.4942225", "text": "def index\n @descriptions = Description.all\n respond_to do |format|\n format.html\n format.csv { render text: @descriptions.to_csv }\n end\n end", "title": "" }, { "docid": "47cb8afdfce5b715987bb150a63934ec", "score": "0.49415907", "text": "def post_params\n params.require(:post).permit(:description)\n end", "title": "" }, { "docid": "88374ef35fb5f751e05b3cf58b5b2b28", "score": "0.49409372", "text": "def description_params\n params.require(:description).permit(:task_id)\n end", "title": "" }, { "docid": "eafa7080b1dd46331ff65364b5f2ba91", "score": "0.49357527", "text": "def new\n @solicitation = @representative.solicitations.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitation }\n end\n end", "title": "" }, { "docid": "085cf2cbbc5ace224c6a014feac8849f", "score": "0.49305356", "text": "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end", "title": "" }, { "docid": "bb5968fd20a325964c45b798c74e10f7", "score": "0.49165502", "text": "def description_params\n params.require(:description).permit(:folder_id, :description, :title, :mode)\n end", "title": "" }, { "docid": "dce7ff3af745b6cf1f4446c8e5310b06", "score": "0.4914312", "text": "def answer_params\n params.require(:answer).permit(:description)\n end", "title": "" }, { "docid": "025f54d6ce8cf68b421543deadef938b", "score": "0.49137828", "text": "def create(doc_client,course_name)\n @doc_client=doc_client\n body=<<-EOF\n<?xml version='1.0' encoding='UTF-8'?>\n<entry xmlns=\"http://www.w3.org/2005/Atom\">\n<category scheme=\"http://schemas.google.com/g/2005#kind\"\nterm=\"http://schemas.google.com/docs/2007#spreadsheet\"/>\n<title>#{course_name}</title>\n</entry>\nEOF\n @doc_feed=@doc_client.post('http://docs.google.com/feeds/documents/private/full',body) \n puts @doc_feed\n \n end", "title": "" }, { "docid": "45a5cfe790342d365ad4216b50684388", "score": "0.4911909", "text": "def new\n @series_description = SeriesDescription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @series_description }\n end\n end", "title": "" } ]
09285eb3f1143d5451ebde1ffb77808e
Handles updating edge costs on the table
[ { "docid": "eada6473aecda1dcc7f3a7ffc0a74031", "score": "0.6301984", "text": "def handleEntryUpdate(destNode, newcost)\n\ti = $neighbors.index{|n| n.name == destNode}\n\t$neighbors[i].cost = newcost\n\t$local_change = 1\nend", "title": "" } ]
[ { "docid": "1a32bbdfd856dbd7ce16f0e464263cb2", "score": "0.6200763", "text": "def save_cost\n self.update_attribute(:sale_price,self.orders.sum(:sale_price).ceil)\n self.update_attribute(:final_price,self.orders.sum(:final_price).ceil)\n end", "title": "" }, { "docid": "a55e9666a8d51d9006bd23fd38593ee0", "score": "0.6182348", "text": "def update_cost_total!\n self.cost_total = self.estimate ? self.estimate.cost : 0\n self.save!\n end", "title": "" }, { "docid": "b73083a3619bcbe9386a43c05cb170f3", "score": "0.61667746", "text": "def update_deal_costs(deal)\n super\n end", "title": "" }, { "docid": "98957f06a465180b7632ef86641a1364", "score": "0.6058598", "text": "def change_cost(new_cost)\n CONNECTION.execute(\"UPDATE products SET cost = #{new_cost} WHERE id = #{@id};\")\n end", "title": "" }, { "docid": "a1125499b7111f53045ea95f63ccbce0", "score": "0.59950936", "text": "def edgeuExt(cmd)\n\n\t#get commands\n\tdst = cmd[0]\n\tcost = cmd[1].to_i\n\t\n\t#update cost hash with the new cost to get to the neighbor\n\t$cost[dst] = cost\nend", "title": "" }, { "docid": "bfb94420c35cc2d10a2789e5d5d211d4", "score": "0.59825", "text": "def update_cost_price\n self[:cost_price] = cost_price\n end", "title": "" }, { "docid": "db3e1f409237544c73b87436d8516379", "score": "0.59463286", "text": "def calc_costs\n start_vertex, end_vertex = @vertices.first, @vertices.last\n \n @vertices.each do |vertex|\n best_cost = nil\n best_prev = nil\n best_edge_type = nil\n\n vertex.in_edges.each do |in_edge|\n prev_vertex = in_edge.out_vertex\n prev_cost = prev_vertex.value[:cost]\n\n next if prev_cost.nil?\n\n current_cost = prev_cost + in_edge.value\n\n if best_cost.nil? || current_cost < best_cost\n best_cost = current_cost\n best_prev = prev_vertex\n best_edge_type = in_edge.type\n end\n end\n \n if vertex.value[:pos] != 0\n vertex.value[:cost] = best_cost\n vertex.value[:prev] = best_prev\n vertex.value[:edge] = best_edge_type\n end\n end\n\n nil\n end", "title": "" }, { "docid": "5dd3f66cfe1a7b02316602d833cfd099", "score": "0.5938002", "text": "def cost\n @path.inject(0) { |cost, edge| cost += edge.cost }\n end", "title": "" }, { "docid": "88b732cc06e97c6cdb2df966f3b57686", "score": "0.5921702", "text": "def set_cost key, _\n visits = fetch_visit_count(key)\n visits ? super + visit_weight(visits).to_i : super\n end", "title": "" }, { "docid": "f2f6143a945551ea36713599e4ce21b2", "score": "0.58427197", "text": "def update_deal_costs(deal)\n super\n\n dated_costs.create({\n :deal => deal,\n :contact => sales_person,\n :cost => deal.won? ? sales_fee : 0,\n :label => \"#{self}: Sales Fee for #{deal.name}\",\n :date => deal.created_at.to_date\n })\n end", "title": "" }, { "docid": "844cfcf643124eae36de27b697d33ffd", "score": "0.58423275", "text": "def apply_costs\n\t\t\[email protected] do |cost, delta|\n\t\t\t\tif delta.is_a? Method\n\t\t\t\t\tdelta.call :apply_costs, self\n\t\t\t\telse\n\t\t\t\t\tif delta != 0 && @entity.respond_to?(cost)\n\t\t\t\t\t\tcost_set = (cost.to_s + '=').to_sym\n\t\t\t\t\t\tvalue = @entity.send cost\n\t\t\t\t\t\tvalue -= delta\n\t\t\t\t\t\[email protected] cost_set, value\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "43d15048fd5dfd65017734970e1cae86", "score": "0.5829997", "text": "def update_visit_data_cents visit\n visit.cost unless visit.nil?\n end", "title": "" }, { "docid": "767ec8239d9de8df2bbc31cc9418e0c2", "score": "0.5815319", "text": "def cost=(cost); end", "title": "" }, { "docid": "6dab935de649e6c6d7454fd9e50acb71", "score": "0.5794904", "text": "def hex_edge_cost(conn)\n conn[:paths].each_cons(2).sum do |a, b|\n a.hex == b.hex ? 0 : 1\n end\n end", "title": "" }, { "docid": "4c91eb27680f26e09083422f87688906", "score": "0.57896304", "text": "def update_deal_costs(deal)\n super\n\n dated_costs.create({\n :deal => deal,\n :contact => affiliate,\n :cost => deal.won? ? affiliate_fee : 0,\n :label => \"#{self}: Affiliate Fee for #{deal.name}\",\n :date => deal.created_at.to_date\n })\n end", "title": "" }, { "docid": "2c77eb4580de46b29c46c6791dc7d705", "score": "0.5744611", "text": "def optimal_cost(node)\n end", "title": "" }, { "docid": "d738dbaacac68afb419a5f7fd5c13818", "score": "0.5708591", "text": "def do_update_throughput\n converge_by(\"change throughput on DynamoDB table #{new_resource.table_name}\") do\n # wait for table to become ready (if it is not)\n wait_for_table\n dynamodb.update_table(\n table_name: new_resource.table_name,\n provisioned_throughput: new_resource.provisioned_throughput\n )\n end\nend", "title": "" }, { "docid": "b8440261d7bd633a8932d8915d0ecf32", "score": "0.57036895", "text": "def cost(edges)\n leg_count = 0\n cost = 0.0\n\n edges.each do |edge|\n cost += leg_cost(leg_count) * edge.distance\n leg_count += 1 # keep track of number of flights\n end\n # return rounded value (ie. 100.00)\n (cost * 100).round / 100.0\n end", "title": "" }, { "docid": "e96ec09f5b3f7dfece9f097cd9f90131", "score": "0.56988484", "text": "def wo_update_costs_from_vehicle\n vehicle = params[:vehicle]\n distance = params[:distance].to_f / 100\n tbl = params[:tbl]\n cost = 0\n costs = 0\n if vehicle != '0'\n @vehicle = Vehicle.find(vehicle)\n # Assignment\n cost = @vehicle.cost\n costs = distance * cost\n end\n # Format numbers\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "2a9f55a680d09275b96453fc9bac829f", "score": "0.5668763", "text": "def weight_for_edge(edge)\n @weight_table[edge]\n end", "title": "" }, { "docid": "4d20c77d2ff9c92f1ec7520e55658fba", "score": "0.56529176", "text": "def handleCost\n self.cost = self.quantity * self.flower.price\n end", "title": "" }, { "docid": "91a323d3566000fdd520efbe882a71a3", "score": "0.56400365", "text": "def _edge_labeling_inc\n end", "title": "" }, { "docid": "811f4d0ede998e544a147aeb34b6087a", "score": "0.5626752", "text": "def wo_update_costs_from_cost_or_distance\n cost = params[:cost].to_f / 10000\n distance = params[:distance].to_f / 100\n tbl = params[:tbl]\n costs = distance * cost\n distance = number_with_precision(distance.round(2), precision: 2)\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n @json_data = { \"distance\" => distance.to_s,\n \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "7884b5d7cc15e152677e836c2bf48c44", "score": "0.5574561", "text": "def cost(new_cost)\n @cost + new_cost\n end", "title": "" }, { "docid": "8578d284fec3a635776589dde16d6af6", "score": "0.55608803", "text": "def do_change_gsi(op)\n @gsi_changes[op].each do |index|\n converge_by(\n \"#{op} global secondary index #{index[op][:index_name]} \" \\\n \"on table #{new_resource.table_name}\"\n ) do\n wait_for_table\n dynamodb.update_table(\n table_name: new_resource.table_name,\n attribute_definitions: new_resource.attribute_definitions,\n global_secondary_index_updates: [index]\n )\n end\n end\nend", "title": "" }, { "docid": "a8d4699e132a8777fd0277bf3e4bb08d", "score": "0.55556405", "text": "def add_edge(src, dst, cost)\n add_directed_edge(src, dst, cost)\n add_directed_edge(dst, src, cost)\n end", "title": "" }, { "docid": "00211ffadbc6b2d4f917fdd60c48f613", "score": "0.5540243", "text": "def wo_update_costs_from_cost_or_enforcement_pct\n cost = params[:cost].to_f / 10000\n pct = params[:pct].to_f / 100\n tbl = params[:tbl]\n costs = (pct / 100) * cost\n pct = number_with_precision(pct.round(2), precision: 2)\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n @json_data = { \"pct\" => pct.to_s, \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "b9556ab8d29c35500e3893a481bdbdc2", "score": "0.5531571", "text": "def update_visit_prices\n self.visits.price_editable_visits.each do |visit|\n visit.update_visit_total_price\n end\n end", "title": "" }, { "docid": "5295db5ff4095ba0febda900ee1baea7", "score": "0.55093086", "text": "def edge_count\n sum = 0\n adj_table.each_value{|list| sum += list.size}\n sum\n end", "title": "" }, { "docid": "befa79e305ffbf8196362a926992583e", "score": "0.55045575", "text": "def update!(**args)\n @cost_scenario = args[:cost_scenario] if args.key?(:cost_scenario)\n end", "title": "" }, { "docid": "befa79e305ffbf8196362a926992583e", "score": "0.55045575", "text": "def update!(**args)\n @cost_scenario = args[:cost_scenario] if args.key?(:cost_scenario)\n end", "title": "" }, { "docid": "befa79e305ffbf8196362a926992583e", "score": "0.55045575", "text": "def update!(**args)\n @cost_scenario = args[:cost_scenario] if args.key?(:cost_scenario)\n end", "title": "" }, { "docid": "befa79e305ffbf8196362a926992583e", "score": "0.55045575", "text": "def update!(**args)\n @cost_scenario = args[:cost_scenario] if args.key?(:cost_scenario)\n end", "title": "" }, { "docid": "f214f051e8bc679cd716cf7652640bf3", "score": "0.54848", "text": "def update_average_cost( price_mutation, diff_quantity ) \n if ready == 0\n self.avg_cost = BigDecimal(\"0\")\n self.save \n return \n end\n \n old_quantity = ready - diff_quantity \n old_inventory = old_quantity * avg_cost \n additional_inventory = price_mutation.amount \n total_inventory = old_inventory + additional_inventory \n \n self.avg_cost = ( total_inventory / (ready) ) .round( 2 )\n self.save \n end", "title": "" }, { "docid": "0d9de04f94f64f8c93ab104d3db1d3bf", "score": "0.54738706", "text": "def add_edge i, j, cost\n self.node(i).add_edge self.node(j), cost\n end", "title": "" }, { "docid": "0c234a411df2617591d0beb5a9e7179b", "score": "0.54570323", "text": "def cost\n @cost += 0.89 \n end", "title": "" }, { "docid": "e1148f5466fa2e263ebd81d92f2afdfa", "score": "0.5422921", "text": "def estimated_cost\n @h + cost\n end", "title": "" }, { "docid": "9f79ca9a04546b1db21f143be386c44e", "score": "0.5395489", "text": "def update_sogr_costs\n unless disposed?\n update_asset_state(policy)\n end\n end", "title": "" }, { "docid": "b86899b520718ab8c018133675b08afa", "score": "0.5394906", "text": "def recalculate!\n attributes = { price: 0, items_count: 0 }\n links = order_items\n links.reload\n links.map do |order_item|\n attributes[:price] += order_item.price * order_item.quantity\n attributes[:items_count] += order_item.quantity\n end\n update attributes\n end", "title": "" }, { "docid": "271b466d2f2194d6dd34493096bb49f0", "score": "0.53941387", "text": "def total_cost\n\n end", "title": "" }, { "docid": "3cf6ded90ccedd448ed982b724476716", "score": "0.53843725", "text": "def wo_update_costs_from_purchase_order\n order = params[:order]\n pct = params[:pct].to_f / 100\n tbl = params[:tbl]\n cost = 0\n costs = 0\n if order != '0'\n @order = PurchaseOrder.find(order)\n # Assignment\n cost = @order.taxable\n costs = (pct / 100) * cost\n end\n # Format numbers\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "b9c142b06e6cf76ca1713a05055e73ee", "score": "0.53785205", "text": "def add_edge(from, to, cost)\n @vertices[from] = true unless @vertices.has_key? from\n @vertices[to] = true unless @vertices.has_key? to\n \n @edges_cost[from] = Hash.new() unless @edges_cost[from]\n @edges_cost[from].store(to, cost)\n\n @edges_up[from] = Hash.new() unless @edges_up[from]\n @edges_up[from].store(to, true)\n end", "title": "" }, { "docid": "b11ffc110a6c8a56e989041ed8f55f5a", "score": "0.53675616", "text": "def reset_cost\n @costs = Hash.new(0)\n end", "title": "" }, { "docid": "8544a06dd8a186744603ff40f28909c8", "score": "0.5357099", "text": "def cost()\n sql = \"UPDATE customers\n SET funds = (SELECT customers.funds - films.price AS \" \"cost\"\"\n FROM customers\n INNER JOIN tickets\n ON tickets.customer_id = customers.id\n INNER JOIN films\n ON tickets.film_id = films.id\n\t\tWHERE tickets.id = $1)\n WHERE customers.id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n\n\n # cost = SqlRunner.run(sql,values)\n # # cannot get the value out of the hash\n # cost_array = []\n # cost.each {|ticket| cost_array << ticket [\"cost\"].to_i}\n # p cost\n # sql = \"UPDATE customers\n # SET funds = #{cost}\n # WHERE tickets.customer_id = customers.id\"\n # SqlRunner.run(sql)\n\nend", "title": "" }, { "docid": "038c84d903131a43d726c17503ff1eab", "score": "0.5355428", "text": "def update_item_cost(new_item_unit_cost)\n\n if product = ::Yito::Model::Booking::BookingCategory.get(self.item_id)\n old_booking_line_item_cost = self.item_cost\n self.transaction do\n self.item_unit_cost = new_item_unit_cost\n self.item_cost = self.item_unit_cost * self.quantity\n self.save\n # Update the booking (cost)\n item_cost_increment = self.item_cost - old_booking_line_item_cost\n booking.item_cost += item_cost_increment\n booking.calculate_cost(false, false)\n booking.save\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'updated_item_cost',\n identifier: self.booking.id.to_s,\n description: BookingDataSystem.r18n.t.booking_news_feed.updated_item_cost(\"%.2f\" % new_item_unit_cost, self.item_id, \"%.2f\" % old_booking_line_item_cost),\n attributes_updated: {item_unit_cost: new_item_unit_cost}.merge({booking: booking.newsfeed_summary}).to_json)\n end\n booking.reload\n end\n\n end", "title": "" }, { "docid": "4af039f45b28d3b480a5ed7f6560066e", "score": "0.5354042", "text": "def cost\n @cost += 0.99\n end", "title": "" }, { "docid": "fa6173e7e8d92b94f84c478025ee90ac", "score": "0.5344663", "text": "def update_price\n self.price = order_lines.map(&:price).reduce(:+)\n save\n end", "title": "" }, { "docid": "198e9d31868b7bf0d2039c842f8ad3b8", "score": "0.53405595", "text": "def update\n @costing.update(costing_params)\n @costing.landed_cost = @costing.foreign_cost.to_i * ((100 + @costing.markup.to_f ) / 100)\n respond_to do |format|\n if @costing.save\n format.html { redirect_to @costing, notice: 'Costing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @costing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7a1345a2e1a97c4d27535134d754025", "score": "0.5340452", "text": "def update_prices\n @wholesale = vehicle.wholesale_price\n\n @markup_total = markup_calculation(@wholesale)\n @tax_total = tax_calculation(@wholesale)\n @total = @wholesale + @markup_total + @tax_total\n update_columns(markup: @markup_total, sales_tax: @tax_total, total: @total)\n end", "title": "" }, { "docid": "e4e88b546d3c80dbd89894310790bb22", "score": "0.53353906", "text": "def cost\n @cost += 1.99 \n end", "title": "" }, { "docid": "24874005fc1ed3b925b40fcddc8f52ed", "score": "0.5333424", "text": "def cost(current_node,new_node)\n\t\tcurrent_node.gCost + current_move_cost(new_node)\n\tend", "title": "" }, { "docid": "6b8fccfeed998b3cc409776c5f7035cf", "score": "0.532979", "text": "def cost(new_cost)\n @beverage.cost + new_cost\n end", "title": "" }, { "docid": "664265c49efd1aebed6e0f83c1875bbb", "score": "0.53160596", "text": "def update_weight\n self.weight = product.weight + product_option_selections.inject(0){|sum, s| sum + s.weight_adjustment }\n self.save!\n end", "title": "" }, { "docid": "d71acd7ccbef6ddb9829b75a0ed94cbf", "score": "0.53013337", "text": "def update_edge(node_from_key, node_to_key, value)\n remove_edge(node_from_key, node_to_key)\n add_edge(node_from_key, node_to_key, value)\n end", "title": "" }, { "docid": "c92fcfa7e017ad6471eebfc4eedaa110", "score": "0.52932525", "text": "def cost\n @beverage.cost += 0.10\n end", "title": "" }, { "docid": "c92fcfa7e017ad6471eebfc4eedaa110", "score": "0.52932525", "text": "def cost\n @beverage.cost += 0.10\n end", "title": "" }, { "docid": "3fc95da698de9fced8823cf4b91abb84", "score": "0.5293024", "text": "def update\n @component = Component.find(params[:id])\n @index = 0\n \n #Rails.logger.debug(\"######################Test Part Cost: #{@component.inspect}\")\n \n respond_to do |format|\n begin @component.update_attributes(params[:component])\n @component.total_service_cost = 0\n \n @component.componentmonths.each do |v|\n total_service_cost_per_date = 0\n total_service_parts_per_date = 0\n total_service_labour_per_date = 0\n total_break_cost_per_date = 0\n total_break_parts_per_date = 0\n total_break_labour_per_date = 0\n total_hrs = v.offhire_hrs - v.onhire_hrs \n \n v.services.each do |x|\n #Rails.logger.debug(\"Total Service Cost: #{x.service_cost}\")\n @component.total_service_cost += x.service_cost\n total_service_cost_per_date += x.service_cost\n total_service_parts_per_date += x.total_parts_cost\n total_service_labour_per_date += x.total_labour_cost\n end\n \n v.breakdowns.each do |x|\n #Rails.logger.debug(\"Total Service Cost: #{x.service_cost}\")\n @component.total_service_cost += x.breakdown_cost\n total_break_cost_per_date += x.breakdown_cost\n total_break_parts_per_date += x.total_parts_cost\n total_break_labour_per_date += x.total_labour_cost\n #Rails.logger.debug(\"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Total Service Cost: #{total_break_cost_per_date}\")\n end\n \n @component.componentmonths.find(v.id).update_attribute(:total_service_parts, total_service_parts_per_date )\n @component.componentmonths.find(v.id).update_attribute(:total_service_cost, total_service_cost_per_date )\n @component.componentmonths.find(v.id).update_attribute(:total_service_labour, total_service_labour_per_date )\n \n @component.componentmonths.find(v.id).update_attribute(:total_break_parts, total_break_parts_per_date )\n @component.componentmonths.find(v.id).update_attribute(:total_break_cost, total_break_cost_per_date )\n @component.componentmonths.find(v.id).update_attribute(:total_break_labour, total_break_labour_per_date )\n @component.componentmonths.find(v.id).update_attribute(:total_hrs, total_hrs )\n end\n \n format.html { redirect_to @component, notice: 'Component was successfully updated.' }\n format.json { head :no_content }\n rescue Exception => ex\n flash[:error] = ex.message\n #flash[:error] = @component.errors.full_messages.to_sentence\n format.html { render action: \"edit\" }\n format.json { render json: @component.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c2a531e722a7aaa3dfb452ff1e2d658", "score": "0.52882427", "text": "def update_status_total_cost\n total_cost = self.total_cost * self.quantity\n self.status = \"pending-confirmation\"\n self.update_attribute(:total_cost, total_cost)\n end", "title": "" }, { "docid": "3698715d98c19de2af6c89878d6a7341", "score": "0.5284453", "text": "def cost\n @beverage.cost += 0.20\n end", "title": "" }, { "docid": "a7cde1c6df57d61ff2cb9780b11cb5a1", "score": "0.5281099", "text": "def update_line_item_totals(line_item)\r\n line_item.total_price = line_item.price * line_item.quantity\r\n line_item.total_cost = line_item.cost * line_item.quantity\r\n\r\n line_item.save\r\n end", "title": "" }, { "docid": "eb2ce718a71599dc82b4414022a9e342", "score": "0.5268422", "text": "def update_cost(params)\n params[:from] = to_rounded_s(params[:from] || Time.now.utc.to_date)\n params[:to] = to_rounded_s(params[:to] || Time.now.utc)\n params[:cost] = params[:cost].to_f\n params[:timezone] ||= 'UTC'\n params[:campaignId] ||= params.delete(:campaign_id)\n @connection.post('report/manual-cost', params)\n end", "title": "" }, { "docid": "d3ddb9fe055c33a0d3308eb4600f3dd4", "score": "0.5257319", "text": "def estimate_cost_to(node)\n box.dist_to(node.box)\n end", "title": "" }, { "docid": "ce331b5986e9323675bda6eee772f88a", "score": "0.52548856", "text": "def add_directed_edge(src, dst, cost)\n if @adjacency_map.has_key?(src)\n map = @adjacency_map[src]\n map[dst] = cost\n else\n @adjacency_map[src] = {dst => cost}\n end\n end", "title": "" }, { "docid": "9ce74f72ef4c71f3f176cf6746d8f95a", "score": "0.5249173", "text": "def weight\n @weight + @edges.weight\n end", "title": "" }, { "docid": "8acc269812e36308d5a69e845fbd6482", "score": "0.52467495", "text": "def reinforce_cost_modifier(v)\n calculated_land_cost 0.2*v\n end", "title": "" }, { "docid": "fa900130cefbf1ffa49271be68ed113e", "score": "0.5246681", "text": "def update(vertex, context)\n if context.getIteration == 0\n # Initialize on first iteration\n vertex.setValue(1.0)\n else\n # On other iterations, set my value to be the weighted\n # average of my in-coming neighbors pageranks.\n sum = 0.0\n vertex.numInEdges.times { |i| sum += vertex.inEdge(i).getValue }\n vertex.setValue(0.15 + 0.85 * sum)\n end\n\n # Write my value (divided by my out-degree) to my out-edges so neighbors can read it. #/\n outValue = vertex.getValue / vertex.numOutEdges\n vertex.numOutEdges().times { |i| vertex.outEdge(i).setValue(outValue) }\n end", "title": "" }, { "docid": "ee9929e6db865b2449fff52cbbf21ea5", "score": "0.5244163", "text": "def update!(**args)\n @egress_rate = args[:egress_rate] if args.key?(:egress_rate)\n end", "title": "" }, { "docid": "538c62571bf6a056225225890ef8deea", "score": "0.52416164", "text": "def calculate_cost(node)\n cost=@distances[node]+1\n neighbours(*node).each do |n|\n next unless @space.include?(n)\n next if @distances[n] and @distances[n] < cost\n @distances[n]=cost\n calculate_cost(n)\n end\n end", "title": "" }, { "docid": "7148e48e5a79c38d8de05bbe703c05e9", "score": "0.52406615", "text": "def cost\n @beverage.cost += 0.15\n end", "title": "" }, { "docid": "7370d998005a8142bd78fae4adac9f3b", "score": "0.5240313", "text": "def update(on)\n # Just rebuild the table\n @lock.synchronize do\n @table.build_heap\n end\n end", "title": "" }, { "docid": "76cab440565f6d61dfea211f3e23fa83", "score": "0.52321637", "text": "def cost(&block)\n NEAT::controller.cost_func_set &block\n end", "title": "" }, { "docid": "ef14ef847546335326c32be46516b573", "score": "0.52235234", "text": "def update_pricing\n\n cs = self.flight_matrix.flight_schedule.charge_schedule\n\n self.transaction do\n taxation = (self.count_pax * cs.session_price + self.count_caddy * cs.caddy +\n self.count_buggy * cs.cart + self.count_insurance * cs.insurance) * self.golf_club.tax_schedule.rate\n self.assign_attributes({\n actual_pax: self.count_pax * cs.session_price, actual_caddy: self.count_caddy * cs.caddy, actual_buggy: self.count_buggy * cs.cart,\n actual_insurance: self.count_insurance * cs.insurance, actual_tax:taxation\n })\n self.save!\n end\n\n end", "title": "" }, { "docid": "cfe06ac27a08cff5417419c4bd40569c", "score": "0.5222858", "text": "def update_neighbours(current)\n current.neighbours.each do |e|\n next if @closed_set.any? { |n| n.coords == e } # already checked the node\n neighbour ||= @open_set.find { |n| n.coords == e }\n calculate_costs(neighbour, e, current)\n end\n end", "title": "" }, { "docid": "e5c246dc42b04bc7a0a354f2060f3f7c", "score": "0.52210766", "text": "def model_graph_edges(graph_edges, mapping)\n if graph_edges\n graph_edges.rest.each do |edge|\n a = mapping[edge[0]]\n b = mapping[edge[1]]\n @local_table.assure_existence(a, ConnectionGraph::FieldNode)\n @local_table.assure_existence(b, ConnectionGraph::FieldNode)\n @local_table.last_graph.add_edge(a, b)\n end \n end\n end", "title": "" }, { "docid": "9528d9c9c57100bbb9dbdb5c669904c4", "score": "0.5216628", "text": "def update_line_item_effective_prices\n logger.debug \"********** Contract update_line_item_effective_prices\"\n hw_disc = BigDecimal.new('1.0') - self.effective_hw_discount\n sw_disc = BigDecimal.new('1.0') - self.effective_sw_discount\n srv_disc = BigDecimal.new('1.0') - self.effective_srv_discount\n self.line_items.each do |lineitem|\n if lineitem.list_price.nil? || lineitem.list_price == BigDecimal.new('0.0')\n lineitem.list_price, lineitem.effective_price = 0.0, 0.0\n else\n lineitem.effective_price = hw_disc * lineitem.list_price if lineitem.support_type == \"HW\"\n lineitem.effective_price = sw_disc * lineitem.list_price if lineitem.support_type == \"SW\"\n lineitem.effective_price = srv_disc * lineitem.list_price if lineitem.support_type == \"SRV\"\n end\n lineitem.save\n end\n end", "title": "" }, { "docid": "b25fc855436283d25def60769da979d2", "score": "0.5216523", "text": "def update\r\n\r\n last_cost = @quantity.cost\r\n last_weight = @quantity.weight\r\n cost_kilo = ( last_cost / last_weight )\r\n \r\n Quantity.transaction do \r\n\r\n lot = Lot.find_by(id: @quantity.lot_id)\r\n product_treatment_phase = ProductTreatmentPhase.joins(:lot).where(lot_id: lot.id, cost: lot.cost, weight: lot.weight, product_id: @quantity.product_id).last\r\n \r\n cost_lot_total = (lot.weight * lot.cost)\r\n cost_lot_total = (cost_lot_total - last_cost)\r\n lot.weight = ( lot.weight - last_weight )\r\n cost_kilo_lot = ( cost_lot_total / lot.weight )\r\n lot.cost = cost_kilo_lot \r\n \r\n old_cost_lot = ( lot.weight * lot.cost )\r\n new_weight = ( lot.weight + quantity_params[:weight] )\r\n new_cost = ( ( old_cost_lot + quantity_params[:cost] ) / new_weight )\r\n \r\n lot.update(cost: new_cost, weight: new_weight)\r\n product_treatment_phase.update(cost: new_cost, weight: new_weight)\r\n\r\n if @quantity.update(quantity_params)\r\n render json: @quantity \r\n else\r\n render json: @quantity.errors, status: :unprocessable_entity\r\n end\r\n \r\n end # closed transaction \r\n end", "title": "" }, { "docid": "5fbda5f1c686fdbdbc3e3aacaab67b54", "score": "0.52141917", "text": "def cost; end", "title": "" }, { "docid": "5fbda5f1c686fdbdbc3e3aacaab67b54", "score": "0.52141917", "text": "def cost; end", "title": "" }, { "docid": "b4790a68530270d9c04156b466f24c08", "score": "0.5211246", "text": "def update\n\n if cost_params[:base] != \"\"\n @cost.values.each do |value|\n value.update(value: (Value.where(cost_id: cost_params[:base], codeval_id: value.codeval_id).first.value * (1 + (cost_params[:factor].to_f / 100))), admin_id: current_admin.id, description: cost_params[:description])\n end\n \n else\n if @cost.values.count == 0 #Solo pone en 0 los valores si NO hay ya unos costos/values\n @cost.values.each do |value|\n value.update(value: 0, admin_id: current_admin.id, description: cost_params[:description])\n end\n end\n \n end\n \n Rate.all.each do |rate|\n if rate.cost_id == params[:id].to_i\n rate.factors.each do |factor|\n factor.update(price: Value.where(cost_id: params[:id].to_i, codeval_id: factor.codeval_id).first.value * (1 + (factor.factor / 100)), description: factor.description)\n end\n end\n end\n\n if @cost.update(cost_params)\n redirect_to @cost, notice: 'Tabla de costos y sus tarifas asociadas exitosamente actualizadas.'\n else\n render :edit\n end\n \n end", "title": "" }, { "docid": "284bda26444b51f7c3b1efeec05f2ef8", "score": "0.5193777", "text": "def upgrade_cost(tile, hex, entity, spender)\n cost = super\n num_cubes = current_builder_cubes(tile)\n if num_cubes >= 2 && terrain?(tile, 'mountain')\n num_cubes -= 2\n cost -= 80\n end\n if num_cubes >= 1 && terrain?(tile, 'hill')\n num_cubes -= 1\n cost -= 40\n end\n cost -= 20 if num_cubes >= 1 && terrain?(tile, 'river')\n cost\n end", "title": "" }, { "docid": "edb281d449c59a09ceb679f3ab6102bf", "score": "0.5192225", "text": "def calculate_costs\n\n lines.each(&:calculate_costs) \n\n self.net_cost = lines.collect(&:net_cost).sum\n self.taxable_amount = lines.select { |l| l.tax_percentage > 0 }.collect(&:net_cost).sum\n self.tax_cost = lines.collect(&:tax_cost).sum\n self.total_cost = lines.collect(&:total_cost).sum\n\n end", "title": "" }, { "docid": "ae076f280ff32ddb60a575172e3a2e4b", "score": "0.5181446", "text": "def recalculate!\n if payment_detail_coupon_code.nil?\n update_attribute(:amount, line_item.total_cost)\n else\n update_attribute(:amount, payment_detail_coupon_code.price)\n end\n end", "title": "" }, { "docid": "ff014deaff6b4c2ef7ae763488ec550f", "score": "0.517698", "text": "def perpetuate\n #flag set by links that were modified in association\n return true if self.do_not_perpetuate\n \n #if edge changed this was manually altered\n if direct_changed?\n if self.direct?\n self[count_column_name] += 1\n else\n self[count_column_name] -= 1\n end\n self.wiring\n end\n end", "title": "" }, { "docid": "5c0afa93861b19b57d532c96836bd31f", "score": "0.51633614", "text": "def cost\n super + @cost\n end", "title": "" }, { "docid": "5c0afa93861b19b57d532c96836bd31f", "score": "0.51633614", "text": "def cost\n super + @cost\n end", "title": "" }, { "docid": "5c0afa93861b19b57d532c96836bd31f", "score": "0.51633614", "text": "def cost\n super + @cost\n end", "title": "" }, { "docid": "5d2b787fbb125165b2c5921f49167076", "score": "0.5149459", "text": "def oven_cost(batches)\n # put your code here!\nend", "title": "" }, { "docid": "7a9687b07576d0984211985afbbac98d", "score": "0.5149214", "text": "def update(h)\n Edge.new super(h)\n end", "title": "" }, { "docid": "537d53a28bd8fbb2de677d873fc9a0db", "score": "0.5144647", "text": "def cost_segment\n super\n end", "title": "" }, { "docid": "b92039f5b5cc22a4fc08b815fa2ba126", "score": "0.5137127", "text": "def unit_cost_adjustment\n\tend", "title": "" }, { "docid": "410be8b06f9027043c1c9e7c2117b982", "score": "0.5130429", "text": "def clean_cost\n self.cost = 0\n save\n end", "title": "" }, { "docid": "b192d4cfb76909bf3a9f2fb0d25a66cb", "score": "0.5130046", "text": "def update\r\n @edge = Edge.find(params[:id])\r\n\t\r\n respond_to do |format|\r\n if @edge.update_attributes(params[:edge])\r\n format.html { redirect_to @edge, notice: 'Edge was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @edge.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "98f1481d56920945ca088a76b04e571c", "score": "0.51274204", "text": "def recalc_totals_from_db!\n self.allocated = self.payment_allocates.sum(:amount)\n self.save!\n end", "title": "" }, { "docid": "7607009c02459e03fb0d387fe1699329", "score": "0.5123703", "text": "def update_price\n self.price = product.price + product_option_selections.inject(0){|sum, s| sum + s.price_adjustment }\n self.save!\n end", "title": "" }, { "docid": "68e80e37bb84b2226780f85f8d9f07fd", "score": "0.5115359", "text": "def path_cost(cost:, from_state:, action:, to_state:)\n cost + step_cost(from_state: from_state, action: action, to_state: to_state)\n end", "title": "" }, { "docid": "6ab9c6802110d470d31c79e814edc7c1", "score": "0.5112291", "text": "def call\n self.costs = append_costs(child)\n end", "title": "" }, { "docid": "9d63c024bc47970a5d722493060e406a", "score": "0.51090103", "text": "def update\n @edge = Edge.find(params[:id])\n\n respond_to do |format|\n if @edge.update_attributes(params[:edge])\n format.html { redirect_to @edge, :notice => 'Edge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @edge.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c89fb5347ff8cb8e87724cc3dda17dcb", "score": "0.51017874", "text": "def after_save_propagation\n bridges.each do |bridge|\n bridge.calculate_price_columns\n bridge.save\n end\n end", "title": "" }, { "docid": "e21cd913fd5290a34bdc1e3b460a83fb", "score": "0.5100551", "text": "def cost(u,v=nil,weight=nil)\r\n u.kind_of?(Arc) ? weight = v : u = edge_class[u,v] \r\n case weight\r\n when Proc : weight.call(u)\r\n when nil : self[u]\r\n else self[u][weight]\r\n end\r\n end", "title": "" }, { "docid": "3f86b83feda4c01d3d6592af2be73cdd", "score": "0.50993997", "text": "def recalculate\n end", "title": "" } ]
5e15bc61eecd1fa91be29c6518bf5cce
returns true if given code matches number in DB
[ { "docid": "69d95237346eba49b6f96ae6cd9ca3b0", "score": "0.70874685", "text": "def verify_code?(number:, code:, user:)\n user.phones.find_by_number(number, code: code)\n end", "title": "" } ]
[ { "docid": "667f6974b5d97d7c02e14b5eb2d4ab6b", "score": "0.6908439", "text": "def active_code?(code)\n find :first, :conditions => {:code => code}\n end", "title": "" }, { "docid": "07d3f46b44cbe5e0056fc7e9f06ab0b2", "score": "0.6895805", "text": "def success?\n @code.to_s =~ /^2\\d\\d$/\n end", "title": "" }, { "docid": "07d3f46b44cbe5e0056fc7e9f06ab0b2", "score": "0.6895805", "text": "def success?\n @code.to_s =~ /^2\\d\\d$/\n end", "title": "" }, { "docid": "502b209a1760fb6b68d69a6ece9e0af9", "score": "0.6828054", "text": "def active_code?(code)\n find :first, :conditions => {:code => code}\n end", "title": "" }, { "docid": "e0dfa2854dba9bb4351053edb65eaa08", "score": "0.66455007", "text": "def active_code?(code)\n self.find_by_code(code)\n end", "title": "" }, { "docid": "eb50acb30b55a7ee84553cf0f4cac006", "score": "0.64846617", "text": "def bus_code?\n (code[1] == '1')\n end", "title": "" }, { "docid": "1bbc3c3d7d9cf1221625470ff5576960", "score": "0.64127666", "text": "def tested?(code)\n\t\t@codes[code] > 0\n\tend", "title": "" }, { "docid": "f39dbc4dd6541272061a662f875911d1", "score": "0.6362396", "text": "def check_code_result(game, team, code)\n # Found?\n if code.is_a?(Code) && code.present?\n\n # Was this code already found?\n team_code = TeamCode.where(game_id: game.id, team_id: team.id, code_id: code.id)\n if team_code.blank?\n\n # check if this is accept code for a new zone\n if code.hold_zone.present?\n result = :accessed_zone\n # check if this is accept code for a new task\n elsif code.hold_task.present?\n\n # Does team have enough codes to pass this code?\n if have_enough_codes?(code, team)\n result = :accessed_task\n else\n result = :not_enough_costs\n end\n else\n #Check if Zone of this code is available for this team\n if code.task.is_available?(team)\n\n # Does team have enough codes to pass this code?\n if have_enough_codes?(code, team)\n result = :accepted\n # Mark as found\n else\n result = :not_enough_costs\n end\n else\n result = :not_available\n end\n end\n else\n result = :repeated\n end\n else\n result = :not_found\n end\n result\n end", "title": "" }, { "docid": "fc87683aca9f24172acc5bf405693cb1", "score": "0.63241994", "text": "def code_cracked?\n @num_guess == @code\n end", "title": "" }, { "docid": "0fe8bd52cc840c24447af679c14440e3", "score": "0.6295535", "text": "def is_not_aviacion_y_comercio?(row); row['Code'].to_i != 19452; end", "title": "" }, { "docid": "c5743923f67c77f417d82c4ea9159e23", "score": "0.6269156", "text": "def informational?\n @code.in? 100..199\n end", "title": "" }, { "docid": "9d27625000e4790755677409da92dd52", "score": "0.6258088", "text": "def is_not_air_china?(row); row['Code'].to_i != 19543; end", "title": "" }, { "docid": "fe02aab6d5fe607bf9bd15865f27cc08", "score": "0.62239677", "text": "def value\n i = code.to_i\n i if i.to_s == code\n end", "title": "" }, { "docid": "7e9c252040019b21c9eb914201701401", "score": "0.6215544", "text": "def check_numbers(code)\n\n\tnumbers = '123456789'\n\t#puts \"Now checking #{code}: \"\n\n\tfor x in numbers.chars\n\t\tif code.count(x) < 1\n\t\t\t#puts \"#{x} not found.\"\n\t\t\treturn false\n\t\telsif code.count(x) > 1 \n\t\t\t#puts \"Too many #{x}.\"\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\n\nend", "title": "" }, { "docid": "dcd57c6ad04a597812e6d2a0fe071ff7", "score": "0.6174722", "text": "def validate_code(code)\n code.to_s.start_with?(\"1\", \"2\", \"3\") # I use method start_with to check the number start with 1 of 2 or 3\nend", "title": "" }, { "docid": "a7a543f64f5a9b22ef0c8016f2ef231f", "score": "0.615582", "text": "def valid_code?(code)\n unless code =~ /^[A-Z]{2,3}\\d{1,4}$/\n puts \"Invalid station code: \\\"#{code}\\\". Skipping this data row.\"\n return false\n end\n\n true\n end", "title": "" }, { "docid": "829916920410383043c76ddc7c13f60a", "score": "0.615439", "text": "def validate_code(code)\n code.to_s.match(/^[1|2|3]/) ? true : false\nend", "title": "" }, { "docid": "d8ec50b7bf18bc436c0225b39f5f1b5d", "score": "0.61388046", "text": "def is_not_air_berlin?(row); row['Code'].to_i != 21361; end", "title": "" }, { "docid": "534aed87060a42055b011464bc4ae194", "score": "0.6130642", "text": "def is_valid?(code)\n\t\tcode.length == CODE_SIZE && code.split(//).all? { |c| c.to_i >= CODE_RANGE.first && c.to_i <= CODE_RANGE.last }\n\tend", "title": "" }, { "docid": "481b8985b8fb535bb374364bea7fc8f0", "score": "0.6123572", "text": "def verify_backup_code(code)\n return false if code.blank?\n code = code.gsub(/[^0-9]/, '')\n counter = self.multi_factor_backup_codes[code]\n counter.present? && code =~ /^\\d{8}$/ && hotp.verify(code, counter)\n end", "title": "" }, { "docid": "bd41f5a6433032ad7700cb79f2302ea4", "score": "0.6118598", "text": "def l33t?\n return true if @number.include? \"1337\"\n end", "title": "" }, { "docid": "67a2903620b965c823b9e98e631fdff7", "score": "0.60826045", "text": "def plausible? number, hints = {}\n @codes.plausible? number, hints\n end", "title": "" }, { "docid": "67a2903620b965c823b9e98e631fdff7", "score": "0.60785884", "text": "def plausible? number, hints = {}\n @codes.plausible? number, hints\n end", "title": "" }, { "docid": "5542737e9a1704e795e25154fc8bc110", "score": "0.6053378", "text": "def checkExist(hcode)\n flag = false\n con = PGconn.connect(\"localhost\",5432,nil,nil,\"resource53\")\n sql = \"SELECT f_hcode FROM failreport WHERE f_hcode='#{hcode}' \"\n res = con.exec(sql)\n con.close\n found = res.num_tuples\n flag = true if (found == 1)\n flag\nend", "title": "" }, { "docid": "e15ec2a07ade2475a5f40544b72a1ad2", "score": "0.6024844", "text": "def verify?(encryption_code)\n\t\tencryption_code_array = encryption_code.split(\":\")\n\n\t\treturn false if encryption_code_array.length != 2\n\n\t\tencoded_sign = encryption_code_array[0]\n\t\tencoded = encryption_code_array[1]\n\t\t\n\t\tduration_time = Time.now.to_i - self.updated_at.to_i\n\n\t\tif duration_time > 1800\n\t\t\treturn false\n\t\tend\n\n\t\tkey = self.verification_code\n\t\tif CGI.escape(Base64.encode64(OpenSSL::HMAC.digest('sha1', key, encoded)).chomp) == encoded_sign\n\t\t\tself.failed_attempts = 0\n\t\t\tself.sent_attempts = 0\n\t\t\tself.save\n\t\t\treturn true\n\t\telse\n\t\t\tself.failed_attempts += 1\n\t\t\tself.save\n\t\t\treturn false\n\t\tend \n\tend", "title": "" }, { "docid": "d969e2f6911fbe6617b2cc37f7a6191e", "score": "0.60091215", "text": "def success?\n !!code.match(/^20\\d$/)\n end", "title": "" }, { "docid": "8b1e32450a526a0df4c9852884eca779", "score": "0.5997004", "text": "def check_test(code)\r\n obj = code.shift\r\n check_for('in', code)\r\n if code[0] == 'pack'\r\n check_for('pack', code)\r\n return @dungeon.pack.has?(obj)\r\n elsif code[0] == 'room'\r\n check_for('room', code)\r\n return @dungeon.current_room.has?(obj)\r\n end\r\n end", "title": "" }, { "docid": "da1a01532184b3f9356128a2cf540522", "score": "0.59818476", "text": "def validate_code(code)\n code.to_s =~ /^[123].*/ ? true : false\nend", "title": "" }, { "docid": "cfaf5fed33fa8bbfd9d7f675464ae614", "score": "0.59814966", "text": "def ok? ; code.to_i.zero? ; end", "title": "" }, { "docid": "a948e212a9b8ac0ace9b9dc0805875fb", "score": "0.598047", "text": "def success_from_code(code)\n code / 100 == 2\n end", "title": "" }, { "docid": "16a29d4fccb050994b1846b6c04ac03a", "score": "0.5962826", "text": "def valid_poa_code?(poa_code)\n ::Veteran::Service::Representative.where('? = ANY(poa_codes)', poa_code).any?\n end", "title": "" }, { "docid": "16a29d4fccb050994b1846b6c04ac03a", "score": "0.5962826", "text": "def valid_poa_code?(poa_code)\n ::Veteran::Service::Representative.where('? = ANY(poa_codes)', poa_code).any?\n end", "title": "" }, { "docid": "3bc56911343f5f73eef8e48870181e24", "score": "0.59589857", "text": "def get_code?\n record.recipient == user\n end", "title": "" }, { "docid": "550ac477b05bf55a81d5dc5fb1d9eae8", "score": "0.5958348", "text": "def hex_digit?(code)\n code >= 0x30 && code <= 0x39 or\n code >= 0x41 && code <= 0x46 or\n code >= 0x61 && code <= 0x66\n end", "title": "" }, { "docid": "7c8a998e02c1531e5c3774ce861abbe2", "score": "0.59197366", "text": "def valid_code?(code) \n return code.length == 4 && /^[rgbymc]+$/.match(code)\n end", "title": "" }, { "docid": "0d8b9c4fa1ba1a1c75684e804a74b967", "score": "0.5886185", "text": "def find_by_code(code)\n @items.detect { |item| item[:data].code == code }\n end", "title": "" }, { "docid": "b2d68bdcdff59f8375295262f131f20e", "score": "0.5862846", "text": "def find_by_code(code)\n index_by_code[code]\n end", "title": "" }, { "docid": "fdf25f2a028f5dc5fb128dcce2a7faff", "score": "0.5839156", "text": "def code_contained(list, code)\n result = false\n\n list.map(&:coding).each do |coding|\n result |= coding.map(&:code).first == code \n end\n\n result \n end", "title": "" }, { "docid": "0178958fd1930bec1f3e11cb2840b8b5", "score": "0.58343285", "text": "def info?(code)\n code.to_i >= 100 and code.to_i < 200\n end", "title": "" }, { "docid": "fe991157dec53d5ee1d018719d536b10", "score": "0.5831771", "text": "def code?\n\t\[email protected](flags)\n\tend", "title": "" }, { "docid": "0381cebc302b5b7b1536619e60095fb8", "score": "0.58291185", "text": "def check(code, ref)\n\t\tcode == self.decode(ref)\n\tend", "title": "" }, { "docid": "d070e184ae27b77bcea0c48f7f0c35a1", "score": "0.5828386", "text": "def check_seq(num)\n database_entry = get_database_entry(@ip)\n return false if num < database_entry.seq_num_r - 9 ||\n num > database_entry.seq_num_r + 101\n true\n end", "title": "" }, { "docid": "630c509eeb08e9e1c2753c49acbcdda6", "score": "0.58205354", "text": "def db_id?(key)\n key.is_a?(Fixnum) or key.is_a?(Integer) or key =~ /^[0-9]+$/\n end", "title": "" }, { "docid": "b22d4c9e95a15d7b9003cdef9cac4aff", "score": "0.58154905", "text": "def code_match?(guess, jeeves_code)\n guess_temp = guess.dup\n jeeves_code_temp = jeeves_code.dup\n results = { c: 0, p: 0 }\n (guess_temp.length - 1).downto(0) do |index|\n if guess_temp[index] == jeeves_code_temp[index]\n results[:c] += 1\n guess_temp.delete_at(index)\n jeeves_code_temp.delete_at(index)\n end\n end\n (guess_temp.length - 1).downto(0) do |index|\n if jeeves_code_temp.include? guess_temp[index]\n results[:p] += 1\n jeeves_index = jeeves_code_temp.index(guess_temp[index])\n guess_temp.delete_at(index)\n jeeves_code_temp.delete_at(jeeves_index)\n end\n end\n results\n end", "title": "" }, { "docid": "4ccd4ffa1f3b40dcce05b27cb22dcc60", "score": "0.5813516", "text": "def valid_type?(code)\n codes.include?(code.to_s)\n end", "title": "" }, { "docid": "4feba25c52195c2fb94e644e5949dacd", "score": "0.5811001", "text": "def san?\n return nil unless valid?\n\n prefix = @number.to_s[0,6]\n if prefix == \"079999\" || prefix == \"503067\"\n true\n else\n false\n end\n end", "title": "" }, { "docid": "1532d76f41011169be4ca24af09cba3c", "score": "0.5806416", "text": "def region_id number\n\[email protected] do |row|\n\t\treturn row[2] if row[0].to_i == number\n\tend\n\treturn false\nend", "title": "" }, { "docid": "cc2237d0ec7a605ca34fb6c223a672f3", "score": "0.579143", "text": "def exact_matches(code)\n i = 0\n @pegs.count do |el|\n value = el == code.pegs[i]\n i +=1\n value\n end\n end", "title": "" }, { "docid": "109aea45b382c9a6c81caeb6b273963b", "score": "0.578828", "text": "def have_enough_codes?(code_or_hint, team)\n case code_or_hint.class.name\n when 'Code'\n return true if code_or_hint.zone.blank?\n cost = code_or_hint.bonus\n zone = code_or_hint.zone\n when 'Hint'\n cost = code_or_hint.cost\n zone = code_or_hint.task.zone\n else\n return false\n end\n\n team.codes_number_in_zone(zone.try(:id)) + cost >= 0\n end", "title": "" }, { "docid": "821dbe29c8dd0b5a5bd0cdafa978d215", "score": "0.5788152", "text": "def is_toll_free?(number)\n areaCodeFirstDigit = number[2]\n areaCodeSecondDigit = number[3]\n areaCodeThirdDigit = number[4]\n\n if areaCodeFirstDigit == \"8\" && areaCodeSecondDigit == areaCodeThirdDigit\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "5064c9dcd7c266935eb571b4c5cb0efc", "score": "0.5780107", "text": "def verify_with(code)\n return (code == self.verification_code) ? self.verify! : false\n end", "title": "" }, { "docid": "a4b7939857b8b885c32a20106eeaf903", "score": "0.5778196", "text": "def credit?\n CREDIT_TRANSACTION_CODE_ENDING_DIGITS.include? transaction_code.to_s[1..1]\n end", "title": "" }, { "docid": "226fb2606725671c6f9bc70882c05ed5", "score": "0.5775151", "text": "def lookup_verification_code(code)\n if code.to_s.empty?\n return nil\n end\n # >>>>> NOTICE <<<<<\n # This should be implemented on your application as a SELECT on your\n # \"document table\" by the verification code column, which should be an\n # indexed column.\n if session[\"Codes/#{code}\"]\n return session[\"Codes/#{code}\"]\n end\n nil\n end", "title": "" }, { "docid": "762b250b5ba6c7e89e8038bb572f7639", "score": "0.57692975", "text": "def valid?\n code == '200'\n end", "title": "" }, { "docid": "6749e7396437bb1a3de8244fb65fa28d", "score": "0.5767908", "text": "def authenticate\n code = params[:user][:code]\n found_user.code_valid && found_user.code == code\n end", "title": "" }, { "docid": "147943d08ea6eda82d11ce038a368527", "score": "0.57488656", "text": "def verify index, given_passcode\r\n passcode( index ) == given_passcode\r\n end", "title": "" }, { "docid": "1c12ad98cf32d29e3b7fecb64b366414", "score": "0.5730443", "text": "def is_not_sallee_s_aviation?(row); row['Code'].to_i != 19740; end", "title": "" }, { "docid": "e792a84c422fd1c81a6e619230a70c47", "score": "0.57297623", "text": "def code_exists\n if self.code_changed?\n if GeneticBank.exists?(self.code)\n errors.add(:code, \"already exists\")\n end\n end\n end", "title": "" }, { "docid": "58a506a1882efbaf6294f2a23cb2d295", "score": "0.57270473", "text": "def is_not_south_african_airways?(row); row['Code'].to_i != 19570; end", "title": "" }, { "docid": "a75fc7ff7d310a6dbcfcb266da5d7c51", "score": "0.572461", "text": "def verify_response_code(code) \r\n uri = URI.parse(@driver.current_url)\r\n http = Net::HTTP.new(uri.host, uri.port)\r\n request = Net::HTTP::Get.new(uri.request_uri)\r\n response = http.request(request)\r\n if (response.code == \"#{code}\")\r\n return true\r\n else\r\n return false\r\n end\r\n end", "title": "" }, { "docid": "812f8b2866f34fd32ea7f60602e5e242", "score": "0.56974095", "text": "def is_in_code_set?(code_set)\n @codes.keys.each do |code_system|\n all_codes_in_system = code_set.find_all {|set| set['set'] == code_system}\n all_codes_in_system.each do |codes_in_system|\n matching_codes = codes_in_system['values'] & @codes[code_system]\n if matching_codes.length > 0\n return true\n end\n end\n end\n false\n end", "title": "" }, { "docid": "2d49ff20258e9135034fbf27cad6152d", "score": "0.56956923", "text": "def matches?(number, num)\n number.to_s.chars.sort == num.to_s.chars.sort\nend", "title": "" }, { "docid": "2d49ff20258e9135034fbf27cad6152d", "score": "0.56956923", "text": "def matches?(number, num)\n number.to_s.chars.sort == num.to_s.chars.sort\nend", "title": "" }, { "docid": "7303f819f9efdfc4ee905dccc31f176c", "score": "0.56832445", "text": "def vanity? phone_number\n @codes.vanity? phone_number.dup\n end", "title": "" }, { "docid": "7303f819f9efdfc4ee905dccc31f176c", "score": "0.56832445", "text": "def vanity? phone_number\n @codes.vanity? phone_number.dup\n end", "title": "" }, { "docid": "fc1706b3fcf7bbb731e2f95af090bdd2", "score": "0.56809586", "text": "def test_integer?(data)\r\n return data.to_i.to_s == data\r\n end", "title": "" }, { "docid": "79c0f6a1bab802baa798710d3fddcb05", "score": "0.5675492", "text": "def nocirc_loan?(loan_code)\n [9].include? loan_code.to_i\n end", "title": "" }, { "docid": "a9940f41144bd9b1fa8ad677b6fe66fc", "score": "0.56732565", "text": "def correct?(code, current_row)\n return true if code == row_to_array(@board[current_row])\n end", "title": "" }, { "docid": "2b6db8efdb217b35ef3249f5f2882bae", "score": "0.56731075", "text": "def exact_match(code, guess)\n exact = 0\n\n code.each_with_index do |item, index|\n if item == guess[index]\n exact += 1\n code[index] = 'x'\n guess[index] = 'x'\n end\n end\n exact \n end", "title": "" }, { "docid": "1ae431f0e5b414605be81fed0b461308", "score": "0.5671571", "text": "def check_gene_id=(code)\n if code.match(Regexp.new(/A[Tt]\\d[Gg]\\d\\d\\d\\d\\d/))\n return code\n else\n raise \"The gene id is incorrect. It should follow the format /A[Tt]\\d[Gg]\\d\\d\\d\\d\\d/\"\n end\n end", "title": "" }, { "docid": "1ae431f0e5b414605be81fed0b461308", "score": "0.5671571", "text": "def check_gene_id=(code)\n if code.match(Regexp.new(/A[Tt]\\d[Gg]\\d\\d\\d\\d\\d/))\n return code\n else\n raise \"The gene id is incorrect. It should follow the format /A[Tt]\\d[Gg]\\d\\d\\d\\d\\d/\"\n end\n end", "title": "" }, { "docid": "a6301c8d98320f06303e4723f25e163b", "score": "0.56696373", "text": "def scan(code)\n if @pricing_lines[code]\n @pricing_lines[code].quantity += 1\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "22775225a5dee7f9c2f6a0c3779e9f50", "score": "0.56555563", "text": "def validate_code(oid,code,name=nil)\n valid = true \n map = @mapping[oid] \n \n # if there isnt a mapping for leave it alone , we know nothing about the code system and cannot pass judgment \n # on whether or not it's valid. \n if map && code \n cs = map[\"codesystem\"]\n parent = map[\"umlscode\"]\n valid = parent ? in_code_system_with_parent(cs,parent,code,name) : in_code_system(cs,code,name)\n end\n valid\n end", "title": "" }, { "docid": "73660d9272cad2e6e5774ff07ea93d12", "score": "0.5651736", "text": "def va900?\n code == 'VA900'\n end", "title": "" }, { "docid": "224e93b6e29f3e98a7bd56d0439687b6", "score": "0.56479776", "text": "def is_in_code_set?(code_set)\n codes.keys.each do |code_system|\n all_codes_in_system = code_set.find_all {|set| set['set'] == code_system}\n all_codes_in_system.each do |codes_in_system|\n matching_codes = codes_in_system['values'] & codes[code_system]\n if matching_codes.length > 0\n return true\n end\n end\n end\n false\n end", "title": "" }, { "docid": "9b9a614cbaf14211a20582c201b476a8", "score": "0.5644596", "text": "def checkMatchNum()\n\t\t#Uses methods to check if the last and forth from last cards have equal numbers.\n\t\tif getLast(@hand).equalNum(getForthLast(@hand).getNum())\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "aa5139139e325092d97cd24e59ab3c63", "score": "0.5642245", "text": "def exact_matches\n matches = 0\n 4.times{ |x| matches += 1 if @num_guess[x] == @code[x] }\n matches\n end", "title": "" }, { "docid": "b853e93c8651cb83cdf24107ee40c428", "score": "0.56418014", "text": "def validate_security_code(code, area_number = 0)\n if code.match /[0-9][0-9][0-9][0-9]/\n api \"controller.validateCodeSynchronously('#{code}', #{area_number})\"\n else\n 0\n end\n end", "title": "" }, { "docid": "ae2e567cfd88863705af1d27663fa12a", "score": "0.5619785", "text": "def check_seq(num)\n create_standard_ip_entry if @database_object.nil?\n return false if num < @database_object.seq_num_r - 9 ||\n num > @database_object.seq_num_r + 101\n true\n end", "title": "" }, { "docid": "30bffd839d741ed7e487b8e8b9ae63d0", "score": "0.56168157", "text": "def decimal_digit?(code)\n code >= 0x30 and code <= 0x39\n end", "title": "" }, { "docid": "78488c152b74d1e0655d7a7806e4a437", "score": "0.56161255", "text": "def country_checked(code)\n @countries.include? code\n rescue\n false\n end", "title": "" }, { "docid": "cdca5c87e9861de06653b433a80dc5d5", "score": "0.56158054", "text": "def match_code; end", "title": "" }, { "docid": "cdca5c87e9861de06653b433a80dc5d5", "score": "0.56158054", "text": "def match_code; end", "title": "" }, { "docid": "f3db442e2d3fa669d7fe7f275b4060b0", "score": "0.56040585", "text": "def redirect?\n @code.to_s =~ /^30\\d$/\n end", "title": "" }, { "docid": "f3db442e2d3fa669d7fe7f275b4060b0", "score": "0.56040585", "text": "def redirect?\n @code.to_s =~ /^30\\d$/\n end", "title": "" }, { "docid": "26a875e29eff4e77d89c1136d9ba131c", "score": "0.5597402", "text": "def can_find_desired_code\r\n attacker_favors_true(target.cap.can_discover_desired_code_address) or predicate(:can_find_address, :code) > 0\r\n end", "title": "" }, { "docid": "7aa6304a6f216795ade380eb00cdfdd2", "score": "0.55880046", "text": "def is_code_valid?(code)\n @code = code\n if is_user_valid? == true\n\n return\n end\n end", "title": "" }, { "docid": "b936e8023f6a824eb74b09652f68875a", "score": "0.5585867", "text": "def result_code code = :resultCode\n\t\t\t@ldap_result and @ldap_result[code]\n\t\tend", "title": "" }, { "docid": "f825363da12f5fcc2ccf4cbf1a245837", "score": "0.55821323", "text": "def magic_number?(n)\n\tn.to_s.split('').each.map{|char| char.to_i}.reduce(:+) == 7\nend", "title": "" }, { "docid": "95cfce8366c945f66df8789dff76070c", "score": "0.5569108", "text": "def find(code)\n @hash[code]\n end", "title": "" }, { "docid": "0f90e91adf43986d0b9fc522736bd18f", "score": "0.5565214", "text": "def matches_identifier?(identifier)\n (self.identifier.try(:upcase) == identifier.upcase || self.barcode.try(:upcase) == identifier.upcase)\n end", "title": "" }, { "docid": "b38748ab0991d9c899792884497fc0d6", "score": "0.55565286", "text": "def codeCheck(code, trialCode, finalCode = [\"\",\"\",\"\",\"\"])\n $i = 0\n while $i < 4\n if code[$i] == trialCode[$i]\n finalCode[$i] = trialCode[$i]\n trialCode[$i] = \"0\"\n print clue_colors('*')\n elsif trialCode.include?(code[$i])\n print clue_colors('?')\n end\n $i += 1\n end\n # print \"finalCode is: #{finalCode}\"\n return finalCode\nend", "title": "" }, { "docid": "4104d5a8098bcbf4bbd7b36da11b66ea", "score": "0.55561244", "text": "def validate_code data\n codes = data[CODES]\n return false if codes.nil? || codes.size == 0\n\n key = codes.keys[0]\n code_vals = codes[key]\n oid = HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(key)\n return false if oid.nil?\n return false if code_vals.nil?\n return false unless code_vals.class == Array\n return true\n end", "title": "" }, { "docid": "cb1108dcea32e826bd0764cb66873fb0", "score": "0.5552336", "text": "def validate_input(code)\n if code.is_a?(Integer)\n code.to_s\n elsif code.is_a?(String) && code.delete('_').size == code.to_i.to_s.size\n code.to_i.to_s\n end\n end", "title": "" }, { "docid": "d83e53849bb0d4a7209fe55501c3b6d5", "score": "0.5551472", "text": "def guess_correct?(magic_number, guess)\n magic_number == guess\nend", "title": "" }, { "docid": "c7ae791a0f61ba0437945ad4af876633", "score": "0.5548561", "text": "def compare (code, guess)\n in_code = 0\n correct_spot = 0 \n\n (0..3).each do |i|\n if code[i] == guess[i]\n correct_spot += 1\n elsif code.include?(guess[i])\n in_code += 1\n end\n end\n\n return [in_code, correct_spot]\nend", "title": "" }, { "docid": "42f7c574ca3172c31b91b420834fb5f3", "score": "0.55471706", "text": "def with_code(code)\n where(code: code).first\n end", "title": "" }, { "docid": "42f7c574ca3172c31b91b420834fb5f3", "score": "0.55471706", "text": "def with_code(code)\n where(code: code).first\n end", "title": "" }, { "docid": "41b076c207805d5b53752cdb8db5ecdd", "score": "0.55442154", "text": "def result_code code = :resultCode\n @ldap_result and @ldap_result[code]\n end", "title": "" }, { "docid": "d48ee3daec41a738926deb26e964025a", "score": "0.5540508", "text": "def check_code\n #grabs the code the user input from the text box\n @test = params[:offer][:test]\n\n #checks if user input code is the same as the businesses offer code\n if @test == @offer.offer_code\n #increases the count of how many times the offer has been used correctly\n @offer.analytics = @offer.analytics + 1\n @offer.update_attributes(:analytics => @offer.analytics)\n #outputs that code was correct\n respond_to do |format|\n format.html { redirect_to offer_url, notice: 'Listing code was successfully redeemed!' }\n format.json { head :no_content }\n end\n # outputs that code was incorrect\n else\n respond_to do |format|\n format.html { redirect_to offer_url, notice: 'Listing code was incorrect!' }\n format.json { head :no_content }\n end\n end\n end", "title": "" } ]
9a98663e718f60b145ec6ab481c436d2
Allows user to enter street, zip or boro and get back results based on that info with options to either add to favorites, show favorites, new search or quit
[ { "docid": "87b7b8adb19901585672bfafe43638d0", "score": "0.73756075", "text": "def search_location\n prompt = TTY::Prompt.new\n options = %w(Enter_street Enter_zip Enter_boro Go_back Quit)\n search = prompt.select(\"Choose search method:\", options)\n\n case search\n when \"Enter_street\"\n street = prompt.ask(\"Enter street\")\n Location.retrieve_data(\"address\", street, self)\n when \"Enter_zip\"\n zip = prompt.ask(\"Enter zip\")\n Location.retrieve_data(\"zip\", zip, self)\n when \"Enter_boro\"\n options = %w(Manhattan/NYC Brooklyn Queens Bronx Staten_Island)\n choice = prompt.select(\"Choose boro:\", options)\n\n case choice\n when \"Manhattan/NYC\"\n boro = \"Manhattan\"\n when \"Brooklyn\"\n boro = \"Brooklyn\"\n when \"Queens\"\n boro = 'Queens'\n when \"Bronx\"\n boro = \"Bronx\"\n when \"Staten_Island\"\n boro = \"Staten Island\"\n end\n Location.retrieve_data(\"boro\", boro, self)\n when \"Go_back\"\n self.display_choices\n when \"Quit\"\n User.end\n else\n puts \"Invalid choice! Please try again!\"\n self.search_location\n end\n end", "title": "" } ]
[ { "docid": "7aea045d776cca4eed2185bbbb64ab17", "score": "0.6803658", "text": "def search\t\t\n\t\t @query = params[:query]\n\t\t @streets = Street.search @query, :page => params[:page], :per_page => 10\t\t\n\tend", "title": "" }, { "docid": "c581e4d98283609ebbe51654866a5aad", "score": "0.6522736", "text": "def search\n #define the type of search\n if params[:search]==\"code\"\n #code\n @postal_code_hints = PostalCodeHint.list_by_code (params[:code])\n elsif params[:search]==\"public_place_name\"\n #public_place_name\n @postal_code_hints = PostalCodeHint.list_by_public_place_name (params[:public_place_name])\n elsif params[:search]==\"hint\"\n #hint\n @postal_code_hints = PostalCodeHint.list_by_hint (params[:hint])\n end\n\n if @postal_code_hints.nil?||@postal_code_hints.empty?\n render html: '<div>No results</div>'.html_safe\n else\n respond_to do |format|\n format.html { render partial: 'postal_code_hints/search'}\n #format.json { render json: @postal_code_hints}\n end\n end\n end", "title": "" }, { "docid": "1927e899a6ff73f3c66c756153af55a6", "score": "0.6488676", "text": "def search(opts = {})\n params = {\n limit: limit\n }.merge!(opts.except(:zip_code, :address, :page))\n location = opts[:zip_code] || opts[:address] || nil\n raise InvalidArguments unless location\n\n params.merge!(offset(opts[:page]))\n restaurants = client.search(location, params)\n rescue Yelp::Fusion::Error::ValidationError\n []\n else\n restaurants&.businesses\n end", "title": "" }, { "docid": "ae8133f3784f145b86903942508cd203", "score": "0.64117545", "text": "def browse\n\n address = params[:address]\n @lat_lon = a=Geokit::Geocoders::GoogleGeocoder.geocode address\n @listings = Listing.within(5, :origin => [@lat_lon.lat, @lat_lon.lng])\n\n end", "title": "" }, { "docid": "018c4e1baa24a3202ddfdf1cd1f01629", "score": "0.6395235", "text": "def search_place\n @radius = @params[:radius] if @params[:radius].present?\n @type = @params[:type] if @params[:type].present?\n if @params[:choices].present?\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&name=\"+@params[:choices]+\"&radius=#{@radius}&type=#{@type}\")\n else\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&radius=#{@radius}&type=#{@type}\")\n end\n places[\"results\"] \n end", "title": "" }, { "docid": "f4976b7e22e191ea007b2eacec4a6643", "score": "0.6374589", "text": "def search_response(user)\n puts \"-- Search by Venue, User, or City:\".colorize(:blue)\n venue_or_user = gets.chomp\n if venue_or_user.downcase == \"venue\"\n self.search_venue\n elsif venue_or_user.downcase == \"user\"\n self.search_user(user)\n elsif venue_or_user.downcase == \"city\"\n else\n self.user_menu(user)\n end\n end", "title": "" }, { "docid": "b40055f0f9b421f1732146d809e11637", "score": "0.6367094", "text": "def search_for_addresses\n populate_address_data\n address_search\n end", "title": "" }, { "docid": "e329feafe62cb08ae1f686254f4c8452", "score": "0.6337129", "text": "def search\n\n puts \"---------------------------------------------\".yellow\n puts \"----------Search for a Restaurant------------\".yellow\n puts \"---------------------------------------------\".yellow\n @name_result = search_name\n search_after_input @name_result\n end", "title": "" }, { "docid": "9d2199c86947029dfb36f8310ee9cb19", "score": "0.6312079", "text": "def search_by_zip(page, zip)\n\t\tpage.form_with(:action => '/cgi-bin/findweather/getForecast') do |search|\n\t\t\tsearch.query = zip\n\t\tend.submit\n\tend", "title": "" }, { "docid": "5cf91517a1e3946caaa48e51677aff45", "score": "0.63060766", "text": "def search_venue\n puts \"-- Enter Venue Name, or 'all' for current list of venues:\".colorize(:blue)\n venue_input = gets.chomp\n if venue_input.downcase == \"all\"\n self.venue_by_number\n elsif\n venue_input = Venue.all.find_by(name: name_input)\n self.venue_by_name(venue_input)\n else\n self.user_menu(user)\n end\n end", "title": "" }, { "docid": "f848bb819c3e205e68e8826407996d85", "score": "0.6304043", "text": "def call_search(name, lat, lng)\n Faraday.get('https://api.yelp.com/v3/businesses/search') do |req|\n req.headers = {\n 'Authorization': \"Bearer #{ENV['YELP_KEY']}\"\n }\n req.params = {\n 'term': name,\n 'latitude': lat,\n 'longitude': lng\n }\n end\n end", "title": "" }, { "docid": "d3c77440974830ad287e0b0cae803b2d", "score": "0.62522626", "text": "def search\n\t\tputs \"Step 2: Find Programs. Use the search filters to narrow your search of programs. Would you like to search by Content Area, Model Type, or Both?\"\n\t\tsearch_filter = gets.chomp\n\t\t\tif search_filter == \"Content Area\"\n\t\t\t\tputs \"Are you interested in Arts, Science, Sports, Tech, or Communication?\"\n\t\t\t\t@content_area = gets.chomp.capitalize\n\t\t\t\tprogram_options\n\t\t\telsif search_filter == \"Model Type\"\n\t\t\t\tputs \"Would you like a Pre-Apprenticeship, Apprenticeship, Advanced-Apprenticeship, or Internship?\"\n\t\t\t\t@model_type = gets.chomp\n\t\t\t\tprogram_options\n\t\t\telsif search_filter == \"Both\"\n\t\t\t\tputs \"Are you interested in Arts, Science, Sports, Tech, or Communication?\"\n\t\t\t\t@content_area = gets.chomp.capitalize\n\t\t\t\tputs \"Would you like a Pre-Apprenticeship, Apprenticeship, Advanced-Apprenticeship, or Internship?\"\n\t\t\t\t@model_type = gets.chomp, \"\\n\"\n\t\t\t\tprogram_options\n\t\t\tend\n\tend", "title": "" }, { "docid": "eaa3336955e54b25f0ca3ff528166bb1", "score": "0.6238423", "text": "def search\n\n if params[:query]\n @what = params[:query][:find]\n @where = params[:query][:near]\n @how_far = 20 #dist in miles\n\n @businesses = Business.search_by_name(@what).near(@where, @how_far)\n\n @reviews = Review.search_by_content(@what).includes(:business)\n\n @reviews.each do |review|\n biz = review.business\n if biz.distance_from(@where) < @how_far\n @businesses.push(biz) unless @businesses.include?(biz)\n end\n end\n\n @results = Kaminari.paginate_array(@businesses).page(params[:page])\n\n @names = []\n @addresses = []\n @results.each do |result|\n @addresses.push(result.full_address)\n @names.push(result.name)\n end\n end\n end", "title": "" }, { "docid": "6606015a305af0404c92e6f43db5524a", "score": "0.62362695", "text": "def query_by_nap(first, last, street, city, state, options = {})\n if options[:email]\n url = \"#{@BASE_PATH}&email=#{url_encode(options[:email])}&first=#{url_encode(first)}&last=#{url_encode(last)}\" +\n \"&street=#{url_encode(street)}&city=#{url_encode(city)}&state=#{url_encode(state)}\"\n else\n url = \"#{@BASE_PATH}&first=#{url_encode(first)}&last=#{url_encode(last)}\" +\n \"&street=#{url_encode(street)}&city=#{url_encode(city)}&state=#{url_encode(state)}\"\n end\n get_json_response(url, options[:show_available])\n end", "title": "" }, { "docid": "092b3ac79ff4b1028d98c32ee5022a86", "score": "0.6233491", "text": "def search\n @search = Hash.new\n @search[\"cuisine\"] = \"Any\" unless params[:cuisine].present?\n @search[\"price\"] = \"Any\" unless params[:price].present?\n @search[\"location\"] = \"Any\" unless params[:location].present?\n @search[\"cuisine\"] ||= params[:cuisine]\n @search[\"price\"] ||= params[:price]\n @search[\"location\"] ||= params[:location]\n\n if @search[\"price\"][0]!=\"Any\" and \n @search[\"cuisine\"][0]!=\"Any\" \n # @restaurants = Restaurant.near(@search, 10).limit(10)\n @search_results = Restaurant.with_cuisine(@search[\"cuisine\"]).with_price(@search[\"price\"])\n elsif @search[\"cuisine\"][0]==\"Any\" and \n @search[\"price\"][0]!=\"Any\" \n @search_results = Restaurant.with_price(@search[\"price\"])\n elsif @search[\"cuisine\"][0]!=\"Any\" and \n @search[\"price\"][0]==\"Any\" \n @search_results = Restaurant.with_cuisine(@search[\"cuisine\"])\n else \n @search_results = Restaurant.all\n end\n end", "title": "" }, { "docid": "d69b1a2fc956428af6f7cbc526bf0e24", "score": "0.62322974", "text": "def address\n @api_key,@standard_address_line1,@standard_address_location = \"\",\"\",\"\"\n if request.post?\n @error = \"\"\n @search_for = \"location\"\n @api_key = params[:api_key]\n @standard_address_line1 = params[:address_street_line_1]\n @standard_address_location = params[:address_city]\n unless params[:api_key].blank?\n unless params[:address_street_line_1].blank?\n unless params[:address_city].blank?\n encrypt(@api_key)\n wp_obj = WhitePagesApi.new(@api_key)\n wp_obj.street_line_1 = @standard_address_line1\n wp_obj.city = @standard_address_location\n @graph_url = wp_obj.get_location_url\n else\n @error = \"please enter city and state or Zip.\"\n end\n else\n @error = \"please enter street address or name.\"\n end\n else\n @error = \"please enter your api key.\"\n end\n end\n end", "title": "" }, { "docid": "d7e419cfb538f71b295d9e5f160672a6", "score": "0.6226975", "text": "def address_search\n coords = []\n if params[:address].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:address]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n elsif params[:lat].present? && params[:lon].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:lat]}, #{params[:lon]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n end\n\n respond_to do |format|\n format.json { render json: coords.to_json }\n end\n end", "title": "" }, { "docid": "cdff0747da0995580441feecaa05bff7", "score": "0.6174602", "text": "def yelp_search(search_term, search_zip, page)\n client = Yelp::Client.new\n search_request = Yelp::V2::Search::Request::Location.new(\n :term => search_term,\n :zip => search_zip,\n :state => \"MA\",\n :consumer_key => YELP_API['consumer_key'], \n :consumer_secret => YELP_API['consumer_secret'], \n :token => YELP_API['token'], \n :token_secret => YELP_API['token_secret'],\n :offset => 10 * (page - 1),\n :limit => 10)\n\n client.search(search_request)\n end", "title": "" }, { "docid": "b90883dd5273fa1fff23ba61bc4ba2a3", "score": "0.61682814", "text": "def search\n \n set_city\n city = @city\n \n \n if params['address_string'].empty? and params['search_string'].empty?\n flash[:error] = \"You must enter a search term or address.\" \n redirect_to root_url\n return\n end\n \n # Get the trucks\n # First check if the search string matches a name\n # if not, check for a category\n # otherwise, show a no results view \n # *Unless* we are processing a location search\n # in which case, show all trucks for that city\n # TODO: Change to a search so an exact match is not required, esp. for name\n # TODO: req a search string even for address searches?\n if !(params['search_string'].empty?)\n @title = params['search_string']\n @trucks = Truck.paginate(:conditions => [\"city = ? and name = ?\", city, params['search_string']], :order => \"name ASC\", :page => params[:page], :per_page => 5)\n if (@trucks.count < 1)\n category = Category.find_by_name(params['search_string'])\n if category\n @trucks = category.trucks.paginate(:all, :conditions => [\"city = ?\", city], :page => params[:page], :order => \"name ASC\", :per_page => 5)\n end\n end\n else\n @title = params['address_string']\n @trucks = Truck.paginate(:conditions => [\"city = ?\", city], :page => params[:page], :order => \"name ASC\", :per_page => 5)\n end\n \n # If an address is passed, geolocate\n if !(params['address_string'].empty?)\n @center_location = Location.get_location(params['address_string'], city, false)\n if @center_location.nil?\n flash[:error] = \"That address doesn't seem to be valid.\"\n redirect_to root_url\n return\n end\n end\n\n if (update_and_set)\n render :action => \"show\"\n else\n redirect_to root_url\n return\n end\n end", "title": "" }, { "docid": "821b9a37be2a4700fc01e8ab59013b6c", "score": "0.616534", "text": "def show\n\n # Accept query parameters\n\n case true\n when !params[:ll].nil?\n coords = Geokit::LatLng.normalize(params[:ll])\n response = RestClient.get \"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{coords.lat},#{coords.lng}&sensor=false\"\n when !params[:address].nil?\n clean_location = CGI::escape(params[:address])\n response = RestClient.get \"http://maps.googleapis.com/maps/api/geocode/json?address=#{clean_location}&sensor=false\"\n when !params[:ip].nil?\n coords = Geokit::Geocoders::MultiGeocoder.geocode(params[:ip])\n response = RestClient.get \"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{coords.lat},#{coords.lng}&sensor=false\"\n else\n render :json => \"Missing criteria\", :status => :bad_request\n return\n end\n\n data = JSON.parse(response)\n\n township, county, state = \"\"\n\n data['results'][0]['address_components'].each { |type|\n if(type['types'][0] == \"administrative_area_level_3\")\n township = type['long_name']\n elsif(type['types'][0] == \"administrative_area_level_2\")\n county = type['long_name']\n elsif(type['types'][0] == \"administrative_area_level_1\")\n state = type['long_name']\n end\n }\n\n query = DemographicRegion.where(:Geography => /^#{township}.*#{county}.*#{state}/)\n\n result = query.first\n increment_api_count params.to_s, \"#{township}, #{county}, #{state}\", result\n render :json => result || \"\"\n end", "title": "" }, { "docid": "58d6c80b4433db7d4c44f2c0271159ee", "score": "0.6160972", "text": "def user_search(database)\n\tputs \"Would you like to search by name, cuisine or price?(Please type 'name', 'cuisine' or 'price')\"\n\tsearch_action = gets.chomp.downcase\n\tif search_action == \"name\"\n\t\tputs \"What is the name of the restaurant you want to find? (Type the beginning few letters)\"\n\t\tname_search = gets.chomp\n\t\tsearch_by_name(database, name_search)\t\n\telsif search_action == \"cuisine\"\n\t\tputs \"Which cuisine would you like to find? (Type the beginning few letters)\"\n\t\tcuisine_search = gets.chomp\n\t\tsearch_by_cuisine(database, cuisine_search)\n\telsif search_action == \"price\"\n\t\tputs \"Find a restaurant under your given price. How much are you willing to spend?\"\n\t\tprice_search = gets.chomp.to_i\n\t\tsearch_by_price(database, price_search)\n\tend\nend", "title": "" }, { "docid": "7bf84753a46f5693f62da2d3d52a74d3", "score": "0.6144207", "text": "def search_all_contacts \n puts \"\\e[H\\e[2J\"\n puts \"Which contact(s) would you like to display?\"\n shower_id = gets.chomp\n contacts_show = @rolodex.search_all(shower_id)\n carriage_return = gets.chomp\n end", "title": "" }, { "docid": "afa607c1d7d3bd7a9ade021044f57a00", "score": "0.6141774", "text": "def search\n # [issue #41] replace possessive apostroph-s with just s; e.g. \"Bear's Ramen House\"\n query = params[:q].to_s.strip.gsub(/'s\\b/, \"s\")\n if query.present?\n current_city = City.includes(:sub_cities).find(params[:city_id])\n fb_search_options = {\n center: current_city.fb_center,\n access_token: current_user.fb_search_token\n }\n results = FbGraph::Place.search(query, fb_search_options).map do |place|\n if current_city.acceptable_fb_place?(place) && place.location.street != \"\" && place.location.city != \"\"\n {id: place.identifier, name: place.name, address: place.location.street, city: place.location.city, url: place.fetch.picture}\n end\n end.compact\n else\n results = []\n end\n\n render :json => results.to_json\n end", "title": "" }, { "docid": "9a7031be4a7eb77deca630c9e509764c", "score": "0.61390704", "text": "def city_search\n if params[:city_search].present?\n @restaurants = Restaurant.search(params[:city_search])\n else\n @restaurants = Restaurant.all\n end\n end", "title": "" }, { "docid": "9a432f3578672a8126e8b62800b8ac2a", "score": "0.61372787", "text": "def search_address_list(opts)\n check_query_params(opts)\n request(endpoint(nil,opts),@api_key,nil,\"GET\")\n end", "title": "" }, { "docid": "ea4d22cec47a2dc1e16a5b7920a6ce8a", "score": "0.6121104", "text": "def search_entries\n print \"Search by name: \"\n name = gets.chomp\n\n match = @address_book.binary_search(name)\n system \"clear\"\n\n if match\n puts match.to_s\n search_submenu(match)\n else\n puts \"No match found for #{name}\"\n end\n end", "title": "" }, { "docid": "0098903080dec87a13dc7227ccc7b25c", "score": "0.6120228", "text": "def search_location2(search_string)\n puts \"----------------------------------------------------------------------------\"\n puts \"search_string: #{search_string}\"\n # latinize, remove all punctiation other than dashes, and downcase\n pure_string = search_string.purify\n puts \"pure_string: #{pure_string}\"\n # perform some latin morphing, split into an array, and perform some extra georgian morphing\n search_terms = pure_string.georgian_morph('extended').split(' ')\n puts \"search_terms: #{search_terms.join(' ')}\"\n\n # Get likely street type\n likely_street_type = get_likely_street_type(search_terms)\n\n # Get likely streets and locales\n if has_street_type?(search_terms)\n temp = split_by_street_type(search_terms)\n search_string_alpha = temp[0]\n search_string_zeta = temp[1]\n puts \"-----------------\"\n puts search_string_alpha\n puts search_string_zeta\n puts \"-----------------\"\n likely_streets = get_likely_streets(search_string_alpha.split(' '), false)\n likely_locales = get_likely_locales(search_string_zeta.split(' '))\n else\n likely_streets = get_likely_streets(search_terms, true)\n likely_locales = get_likely_locales(search_terms)\n end\n\n puts \"______________\"\n puts \"likely_street_type is #{likely_street_type}\"\n puts \"likely_streets are #{likely_streets}\"\n puts \"likely_locales are #{likely_locales}\"\n puts \"______________\"\n\n likely_streets_bool = booleanize(likely_streets)\n likely_locales_bool = booleanize(likely_locales)\n\n unless likely_streets == nil\n result_matches = Street.search likely_locales_bool, :conditions => {:name => likely_streets_bool,\n :street_type => likely_street_type},\n :match_mode => :boolean,\n :sort_mode => :extended,\n :order => \"@weight DESC\"\n end\n\n return result_matches.first.full_name_en unless result_matches.empty?\n return \"FAIL\"\n return get_likely_locales(search_terms)\n\n #likely_number = get_likely_number(search_terms)\n\n####\nend", "title": "" }, { "docid": "24cfc9ec3c182aaa051b356b0ef042b4", "score": "0.61189455", "text": "def general_search\n puts \"WHICH TABLE WOULD YOU LIKE TO SEARCH: 1-LOCATIONS, 2-PRODUCTS, OR 3-CATEGORIES?\"\n puts \"-\"*60\n search = gets.chomp \n case search\n when \"1\"\n puts \"ENTER SEARCH FIELD\"\n puts \"(id, name)\"\n field = gets.chomp\n puts \"ENTER SEARCH TERM\"\n look_for = gets.chomp \n results = Location.search_where(\"locations\", field, look_for)\n results.each do |r|\n r.display_attributes\n end\n \n when \"2\"\n puts \"ENTER SEARCH FIELD\"\n puts \"(id, serial_number, name, description, cost, quantity, location_id, category_id)\"\n field = gets.chomp\n puts \"ENTER SEARCH TERM\"\n look_for = gets.chomp\n results = Product.search_where(\"products\", field, look_for)\n results.each do |r|\n r.display_attributes\n end\n \n when \"3\"\n puts \"ENTER SEARCH FIELD\"\n puts \"(id, name)\"\n field = gets.chomp\n puts \"ENTER SEARCH TERM\"\n look_for = gets.chomp\n results = Category.search_where(\"categories\", field, look_for)\n results.each do |r|\n r.display_attributes\n end\n else puts \"RETURNING TO MAIN MENU\"\n end\n end", "title": "" }, { "docid": "601eb7a920dc00f0c82a9b3e56fefaea", "score": "0.61180866", "text": "def search_for_store(query)\n\n @stores = Store.all\n\n # List to hold all store matches\n store_matches = []\n\n # for each store\n @stores.each do |store|\n\n if query[:uid] && !query[:uid].empty?\n return store if store.uid == query[:uid]\n end\n\n # If the user entered a zipcode\n if query[:zip] && !query[:zip].empty?\n if store.address.zip == query[:zip]\n store_matches << store\n next\n end\n next\n end\n\n next unless store.address.state == query[:state]\n\n # If the user entered a street name\n if query[:street_name] && !query[:street_name].empty?\n\n # Downcase and remove all spaces in both the query and store street names\n sanitized_store_street_name = store.address.street_name.downcase.gsub(/\\s+/, '')\n sanitized_query_street_name = query[:street_name].downcase.gsub(/\\s+/, '')\n\n # Add store to results if the store street name matches the query street name\n if sanitized_store_street_name == sanitized_query_street_name\n store_matches << store\n next\n end\n end\n\n # If the user entered a city name\n if query[:city] && !query[:city].empty?\n\n # Downcase and remove all spaces in both the query and store city\n sanitized_store_city = store.address.city.downcase.gsub(/\\s+/, '')\n sanitized_query_city = query[:city].downcase.gsub(/\\s+/, '')\n\n # Add store to results if the store city matches the query city\n if sanitized_store_city == sanitized_query_city\n store_matches << store\n next\n end\n end\n\n # Is the user only entered a state name, show all stores in the state\n unless (query[:street_name] && !query[:street_name].empty?) || (query[:city] && !query[:city].empty?)\n store_matches << store\n end\n end\n store_matches\n end", "title": "" }, { "docid": "7ff972957f580116c9a3e3db71d741e5", "score": "0.6107241", "text": "def find(info)\n params = {}\n [:city, :address].each do |dup|\n params[dup] = info[dup] if info[dup]\n end\n if info[:destination_string]\n params[:destinationString] = info[:destination_string]\n end\n\n if Configuration.cache? and Configuration.cache.cached?(:geoSearch, params)\n raw = Configuration.cache.get_query(:geoSearch, params)\n else\n url = url(:method => 'geoSearch', :params => params, :session => info[:session])\n raw = parse_response(url)\n handle_errors(raw)\n end\n \n parse(raw)\n end", "title": "" }, { "docid": "63da5a7d9d38a88e6ea322d05604b31a", "score": "0.6106225", "text": "def main\n welcome_user\n search_term = get_search_term\n response = get_book_info(search_term)\n parse_book_info(response)\n\nend", "title": "" }, { "docid": "14ed79edf951f683dcdf661b1d88e215", "score": "0.6099678", "text": "def restaurant_list\n if params[:search].present?\n @restaurants = Restaurant.near(params[:search], 15)\n elsif location.present?\n @restaurants = Restaurant.near([location.latitude, location.longitude], 2500)\n else\n @restaurants = Restaurant.all.order('name ASC')\n end\n end", "title": "" }, { "docid": "63a769a8b3216db21758b096125bd2e3", "score": "0.6085364", "text": "def index\n @citystreets = Citystreet.all.paginate(:per_page =>15, :page => params[:page])\n .where(\"address ILIKE ?\",\"%#{params[:address_search]}%\").where(\"name ILIKE ?\",\"%#{params[:name_search]}%\").where(\"callback ILIKE ?\",\"%#{params[:phone_search]}%\").where(\"unitassigned ILIKE ?\",\"%#{params[:unit_search]}%\")\n end", "title": "" }, { "docid": "7543d47f91867d7e0534b2f5cdddd0b2", "score": "0.60768014", "text": "def index\n @restaurants = Restaurant.all\n @restaurant = Restaurant.new\n\n if params[:full_address].present?\n @restuarant = Restaurant.near(params[:full_address])\n else\n @restaurant = Restaurant.all\n end\n \n end", "title": "" }, { "docid": "2f1b4682f77e45d79d26c82b4dbf655c", "score": "0.60714763", "text": "def search_city_grid(business, zip)\n\n params = {\n :what => \"#{business}\",\n :where => zip,\n :format => 'json',\n :publisher => @publisher_code,\n }\n \n res = HTTParty.get(\"http://api.citygridmedia.com/content/places/v2/search/where\", { :query => params })\n\n data = res.parsed_response[\"results\"][\"locations\"]\n \n if res.success? && data != nil\n\tbusiness_listed = [:unlisted]\n\tdata.flatten.each do |business_name|\n\t\tif business_name['name'] == business\n\t\t puts \"Business is listed\"\n\t\t business_listed = [:listed]\n\t end\n\tend\n else\n\tputs \"Business is not listed\"\n end\n return business_listed\nend", "title": "" }, { "docid": "998826f569556535bd36a10a762bbd65", "score": "0.60652757", "text": "def search_results\n \tresults = Geocoder.search(\"Golden Gate Park, San Francisco, CA\")\n \tparse_results = JSON.parse(results)\n end", "title": "" }, { "docid": "5f9ef4b45a23a4b78233b1da505aca76", "score": "0.605769", "text": "def search_item(num)\n system 'clear'\n result = nil\n case num\n when 1\n print 'Enter a name to search for >> '\n lookup_item = gets.chomp.capitalize\n result = @search.name(lookup_item)\n when 2\n print 'Enter a phone number to search for >> '\n lookup_item = gets.chomp\n result = @search.phone_number(lookup_item)\n when 3\n print 'Enter an email to search for >> '\n lookup_item = gets.chomp\n result = @search.email(lookup_item)\n end\n system 'clear'\n puts \"\\n#{formatted_search_result(result)}\"\n hold_screen\n rescue EntryNotFoundError => e\n puts e.message\n hold_screen\n end", "title": "" }, { "docid": "d3a27a58a8d0aa399d1220ec130c2c95", "score": "0.60442793", "text": "def find_user\n puts \"Enter your address (This will not be published to PubNub): \"\n user_address = gets.chomp\n url = \"http://api.opencagedata.com/geocode/v1/json?q=\" + \"#{user_address}\" + \"&key=your-key\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n response = JSON.parse(response)\n if response['total_results'] === 0\n puts \"That's not a legitimate address. Try again.\"\n find_user\n else\n $user_latitude = response['results'][1]['geometry']['lat']\n $user_longitude = response['results'][1]['geometry']['lng']\n puts \"You are located at latitude: #{$user_latitude}, longitude: #{$user_longitude}\"\n end\nend", "title": "" }, { "docid": "941f0dfb9e7ae79f6884e26daa1a58b0", "score": "0.60423905", "text": "def index\n @txdotstreets = Txdotstreet.all.paginate(:per_page =>15, :page => params[:page])\n .where(\"intersection ILIKE ?\",\"%#{params[:address_search]}%\").where(\"name ILIKE ?\",\"%#{params[:name_search]}%\").where(\"callback ILIKE ?\",\"%#{params[:phone_search]}%\").where(\"unitassigned ILIKE ?\",\"%#{params[:unit_search]}%\")\n end", "title": "" }, { "docid": "f6d147c5d42991411a96832ae60282d0", "score": "0.60398096", "text": "def search(search_term, location)\n self.class.get('/places', :query => {:show => search_term, :in => location})\n end", "title": "" }, { "docid": "8e05090a04bd9fcacdde60ea041cd2d4", "score": "0.6035754", "text": "def detail_search(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/Travel/HotelDetailSearch/20131024\", Rakuten::Api.merge(opts))\r\n end", "title": "" }, { "docid": "ff448a3cd2de902d32be6df116b2386f", "score": "0.60342145", "text": "def nearby_search(address = nil)\n end", "title": "" }, { "docid": "29b2a8b2a4f836d2a03deee8fdf079d7", "score": "0.6012242", "text": "def google_search(argumento)\n Geocoder::Configuration.lookup = :google\n #Uses google api to search for latitude,longitude\n geocoded = Geocoder.search(argumento)\n if geocoded.nil? then\n puts \"Error searching with Google API\"\n exit\n end\n if geocoded.count==0 then\n puts \"Cant find the country\"\n exit\n end\n #Get the ISO country code\n $pais= cambia(geocoded.last.data[\"address_components\"].last[\"short_name\"]).upcase\n\n # If the country is not in the list of no states countries.\n if $no_states[$pais].nil? then\n busca_estados($pais)\n # now the list of states of this country is in $pais_states\n # Search returned info from google for state info.\n geocoded.each do |q|\n if q.data[\"address_components\"][0][\"types\"][0] == \"administrative_area_level_1\" then\n elestado = cambia(q.data['formatted_address'])\n $pais_states.each do |x|\n if x[\"googleName\"]==elestado then\n $estado_info << x\n $estado = $estado_info[0][\"stateCode\"]\n end\n end\n end\n end\n if $estado_info.count==0 then\n # second try searching, this time fuzzy search\n encfinal = 0.0\n distancia = FuzzyStringMatch::JaroWinkler.create( :native )\n geocoded.each do |q|\n if q.data[\"address_components\"][0][\"types\"][0] == \"administrative_area_level_1\" then\n elestado = cambia(q.data['formatted_address'])\n $pais_states.each do |x|\n actual = distancia.getDistance(x[\"googleName\"].upcase,elestado.upcase)\n if actual > encfinal\n encfinal= actual\n $estado_info =[]\n $estado_info << x\n $estado = $estado_info[0][\"stateCode\"]\n end\n end\n end\n end\n end\n if $estado_info.count==0 then\n puts \"Error, state in Google API not found on states.csv \"\n exit\n end\n\n else\n busca_paises($pais)\n $estado_info = $pais_info\n end\n\nend", "title": "" }, { "docid": "a02baa69c5508293d6eb94eeb4f2c297", "score": "0.60101855", "text": "def fazerYourInfo(first, last, zip)\n input_firstName.send_keys(first)\n input_lastName.send_keys(last)\n input_zipCode.send_keys(zip)\n btn_continue.click()\n end", "title": "" }, { "docid": "9b1f750149d92dc09b86bba9f9231556", "score": "0.60094064", "text": "def index\n @title = \"Search Results\"\n \n @test = params[:search] #used for hiding of results, if there are none.\n unless (@test.nil?)\n addr = @test[\"address_contains\"]\n @test[\"address_contains\"] = List.street_endings(addr)\n end\n \n @search = List.search(params[:search]).paginate(:page => params[:results_page], :per_page => 5)\n \n @lists = @search.all\n @no_results = List.no_results(@lists) \n \n #reset the search parameter\n @search = List.search(params[:search]);\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lists }\n end\n end", "title": "" }, { "docid": "1ab42e65afa79cd3daed61365dcf2e59", "score": "0.60070014", "text": "def index\r\n @offices = Office.search(params[:search_postcode],params[:search_radius])\r\n end", "title": "" }, { "docid": "00c707f5c70c5c25ac617c0ac7b22353", "score": "0.59959316", "text": "def index\n search_keywords = params[:keywords] ? params[:keywords] : \"\" \n limit = params[:limit] ? params[:limit].to_i : DEFAULT_LIMIT\n range = params[:range] ? params[:range].to_f : DEFAULT_RANGE\n street_address = params[:street]\n city = params[:city] ? params[:city] : DEFAULT_CITY \n country = params[:country] ? params[:country] : DEFAULT_COUNTRY\n full_address = [street_address, city, country].reject(&:blank?).join(', ')\n\n food_trucks = FoodTruck.filter full_address, search_keywords, range, limit\n @markers = build_map_markers(food_trucks)\n @markers << address_marker(full_address)\n\n respond_to do |format|\n format.json { render :json => food_trucks }\n format.html\n end\n end", "title": "" }, { "docid": "1a3c02aca268ad9014ff97199634107c", "score": "0.59935457", "text": "def show\n\n @client = Yelp::Client.new\n\n @request = Location.new(\n :term => @yelp_search.term,\n :city => \"San Francisco\",\n :limit => @yelp_search.limit,\n :offset => @yelp_search.offset,\n :sort => @yelp_search.sort,\n :category_filter => @yelp_search.category_filter,\n :radius_filter => @yelp_search.radius_filter,\n :deals_filter => @yelp_search.deals_filter\n )\n\n @response = @client.search(@request)\n @businesses = @response.to_h[\"businesses\"]\n \n\n end", "title": "" }, { "docid": "e8b1d3484f8b244a8d60ce84d6df71a0", "score": "0.59740686", "text": "def get_code(book)\n puts \"Which city do you want the zip code for:\"\n # Promot the user for the city name\n city_name = gets.chomp\n if book.include?(city_name)\n puts \"Valid entry\"\n else\n puts \"Invalid entry. Try again\"\n get_code(book)\n end\n\n # Print the area code\n puts \"The zip for #{city_name} is #{book[city_name]}\"\nend", "title": "" }, { "docid": "09f11cd7d6c0c7a916ca45bae8df4560", "score": "0.59690005", "text": "def show\n @businesses = package_results(search(@search.term, @search.location))\n if @businesses.nil?\n #format.json { redirect_to new_search_path, notice: 'No options available with particular request' }\n\n redirect_to home_url, notice: 'Plan Cannot Be Made with Given Information'\n else\n @businesses\n #@search = Search.new\n end\n end", "title": "" }, { "docid": "e7f0e4ae972361eb1991dd4f9b9d62bc", "score": "0.59621996", "text": "def search\n # Create grouped optrions for administrative_area select tag\n @opt1 = Address.select('distinct country, administrative_area_level_1')\n @opt1_grouped = @opt1.each_with_object({}) do |f, options|\n (options[f.country] ||= []) << [f.administrative_area_level_1]\n end\n @opt2 = Address.select('distinct administrative_area_level_1, locality')\n @opt2_grouped = @opt2.each_with_object({}) do |f, options|\n (options[f.administrative_area_level_1] ||= []) << [f.locality]\n end\n\n country = params[:country] || nil\n administrative_area = params[:administrative_area] || nil\n locality = params[:locality] || nil\n property_type = params[:property_type] || nil\n # Joining addresses table to properties table by a single associated model\n # for searching sorted with 'created_at'\n @property = Property.joins(:address)\n .where('country LIKE ?'\\\n\t\t\t\t\t\t\t'and administrative_area_level_1 LIKE ?'\\\n\t\t\t\t\t\t\t'and locality LIKE ?'\\\n\t\t\t\t\t\t\t'and property_type LIKE ?',\n \"%#{country}%\", \"%#{administrative_area}%\", \"%#{locality}%\", \"%#{property_type}%\")\n .page(params[:page])\n .order('created_at DESC')\n render action: 'index'\n end", "title": "" }, { "docid": "0b111a6e56051f5feabf11a17b8aa29c", "score": "0.5959716", "text": "def zipsearch(inZipcode)\n\t\treturn YelpApi.searchZip(inZipcode)\n\tend", "title": "" }, { "docid": "529069d95a4c6319a9aa361139affc70", "score": "0.59569997", "text": "def search_last_name\n\tputs \"Searching for entries by last name.\"\n\tputs \"Search: \"\n\tsearch_string = gets.strip\n\tputs\n\n\t@results = AddressEntry.where(\n\t\tlast_name: search_string\n\t\t)\n\tputs \"Found #{@results.size()} matches!\"\n\tputs\n\[email protected] do |c|\n\t\tputs \"First name:\\t\\t#{c.first_name}\"\n\t\tputs \"Last name:\\t\\t#{c.last_name}\"\n\t\t@emails = c.email_addresses\n\t\tputs \"Emails: \"\n\t\[email protected] do |e|\n\t\t\tputs e.address + \"\\t\\t#{e.category}\"\n\t\tend\n\t\t@phone_nums = c.phone_numbers\n\t\tputs \"Phone Numbers: \"\n\t\t@phone_nums.each do |p|\n\t\t\tputs p.digits + \"\\t\\t#{p.category}\"\n\t\tend\n\t\tputs\n\tend\n\tputs\n\tif ask_delete == \"Y\"\n\t\tdelete_entry(@results)\n\tend\nend", "title": "" }, { "docid": "529069d95a4c6319a9aa361139affc70", "score": "0.59569997", "text": "def search_last_name\n\tputs \"Searching for entries by last name.\"\n\tputs \"Search: \"\n\tsearch_string = gets.strip\n\tputs\n\n\t@results = AddressEntry.where(\n\t\tlast_name: search_string\n\t\t)\n\tputs \"Found #{@results.size()} matches!\"\n\tputs\n\[email protected] do |c|\n\t\tputs \"First name:\\t\\t#{c.first_name}\"\n\t\tputs \"Last name:\\t\\t#{c.last_name}\"\n\t\t@emails = c.email_addresses\n\t\tputs \"Emails: \"\n\t\[email protected] do |e|\n\t\t\tputs e.address + \"\\t\\t#{e.category}\"\n\t\tend\n\t\t@phone_nums = c.phone_numbers\n\t\tputs \"Phone Numbers: \"\n\t\t@phone_nums.each do |p|\n\t\t\tputs p.digits + \"\\t\\t#{p.category}\"\n\t\tend\n\t\tputs\n\tend\n\tputs\n\tif ask_delete == \"Y\"\n\t\tdelete_entry(@results)\n\tend\nend", "title": "" }, { "docid": "d1b414be59a40d61ec748b366b854407", "score": "0.59496725", "text": "def pba_search(options = {})\n type \"criteria\", options[:pin]\n click '//input[@type=\"radio\" and @value=\"WithDischarge\"]' if options[:with_discharge_notice]\n click \"optDis\" if options[:discharged]\n click \"optAdm\" if options[:admitted]\n click \"optAll\" if options[:all_patients] && (is_element_present('optAll'))\n click '//input[@type=\"submit\" and @value=\"Search\" and @name=\"search\"]', :wait_for => :page\n sleep 2\n if is_element_present \"css=#results>tbody>tr>td:nth-child(4)\" #discount adjustment line#87\n visit_no = get_text(\"css=#results>tbody>tr>td:nth-child(4)\").gsub(' ', '' )\n\n return visit_no\n end\n if options[:no_result]\n is_text_present(\"NO PATIENT FOUND\")\n else\n is_text_present options[:last_name]\n end\n end", "title": "" }, { "docid": "56bcd6e779cca78486699ca8fabc29ed", "score": "0.5946826", "text": "def search(term, location)#This search method takes two arguments(a food and a Zip Code or City)\n begin\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n params = {\n term: term,\n location: location,\n }\n response = HTTP.auth(\"Bearer #{YELP_API_KEY}\").get(url, params: params)#This authorizes the key holder to get information fromthe Yelp API \n names=[]#creates an empty array called names\n final= JSON.parse(response)#Turns information transmitted from Yelp APi into JSON(a dta format composed of hashes and/or arrays)\n final[\"businesses\"].each do |business|#This iteration goes through each bussiness in the the JSON data and takes the name,location, product picture, rating, and \"priceiness\" of the resturant\n names << [business[\"name\"], business[\"location\"][\"display_address\"], business[\"image_url\"], business[\"rating\"], business[\"price\"], business[\"display_phone\"], business[\"coordinates\"][\"longitude\"] ,business[\"coordinates\"][\"latitude\"] ]\n end \n names# All the info about the bussiness is composed in here, a double dimension array \n rescue\n names<< [\"I'm sorry I didn't get that. Can you please refresh the page and try again? Thank you\",[\"Error\"],\" \",\"Error\",\"Error\",\"Error\",\" \"]#If there are no results from the Yelp API, the user will get this error message\n end\n \nend", "title": "" }, { "docid": "4bffd836f2fbac3f8d87fcee3f08f092", "score": "0.5938267", "text": "def street_lookups\n [:google, :google_premier, :yahoo, :bing, :geocoder_ca, :yandex, :nominatim]\n end", "title": "" }, { "docid": "f9cb0ccb30f50c12f1624fc3b0cd910c", "score": "0.5932083", "text": "def pba_search_1(options = {})\n type \"criteria\", options[:pin]\n click \"filter\" if options[:with_discharge_notice]\n click \"filter1\" if options[:discharged]\n click \"filter2\" if options[:admitted]\n click \"filter3\" if options[:all_patients] && (is_element_present('filter3'))\n click \"search\", :wait_for => :page\n sleep 2\n if is_element_present \"css=#results>tbody>tr>td:nth-child(5)\" #discount adjustment line#87\n visit_no = get_text(\"css=#results>tbody>tr>td:nth-child(5)\").gsub(' ', '' )\n return visit_no\n end\n if options[:no_result]\n is_text_present(\"NO PATIENT FOUND\")\n else\n is_text_present options[:last_name]\n end\n end", "title": "" }, { "docid": "3d8345baadc80f1e5b62270e4c10de57", "score": "0.59214497", "text": "def index\n\n @requested_item = params[:requested_item]\n @postal_code = params[:postal_code]\n if @postal_code == nil\n @postal_code = \"NULL\"\n end\n\n @countries = Country.all\n\n @postal_codes = PostalCode.where (\"postal_code LIKE '\" + params[:postal_code].to_s + \"'\")\n\n\n render 'index', :layout => false\n end", "title": "" }, { "docid": "275e392f54b92cb63104931a14c402a1", "score": "0.591588", "text": "def geocoding_search( force_geocoding_search )\n add_to_log( \"Searching with GeocodingParser using @source_text_line...#{ force_geocoding_search ? ' (FORCED)' : '' }\" )\n geocoder = get_geocoder\n\n if geocoder.instance_of?( GeocodingParser )\n # Override values w/ actual name, zip, country, country_code & area_type:\n name = geocoder.locality_name # ex.: \"Albinea\"\n zip = geocoder.postal_code_name # ex.: \"42020\"\n area = geocoder.administrative_area_level_3_name # \"Reggio nell'Emilia\"\n # Sometimes the locality_name is not set and the Area (level 3) name should take over:\n name = area unless name.present?\n area_type_code = geocoder.administrative_area_level_2_name # \"RE\"\n country_code = geocoder.country_name # ex.: \"IT\"\n country = ( country_code == 'IT' ? 'ITALIA' : country_code )\n area_type = AreaType.find_by_code( area_type_code )\n area_type_id = area_type.nil? ? nil : area_type.id\n add_to_log( \"Geocoded result => #{ name }, zip: #{ zip }, #{ country } (#{ country_code }), area: #{ area }\" )\n [ name, zip, area, area_type_id, country, country_code ]\n\n else\n add_to_log( \"Warning: cannot create a GeocodingParser instance using current source text line! Returning nil values for address & area...\" )\n [ nil, nil, nil, nil, 'ITALIA', nil ]\n end\n end", "title": "" }, { "docid": "eb5184ccb602906ea4e42d26b7e814fb", "score": "0.59150916", "text": "def search \n system \"clear\"\n puts \"You can search through our database of jobs using programming language, job location, and schedule!\".light_blue\n puts \"What programming language should the position use?\".green\n language = gets.chomp.to_s\n puts \"Where do you want to look?\".green\n location = gets.chomp.to_s\n puts \"Do you want it to be full time?\".green\n full_time = gets.chomp.to_s.upcase\n self.list(Ironjobs::Jobs.fetch_by_job(language,location,full_time))\n end", "title": "" }, { "docid": "7944d4561d40b2b00b876ee2ec7b2e46", "score": "0.5913148", "text": "def list\n @geocode = if params[:commit] == I18n.t('mobile.use_my_location_button') || params[:search].blank? || params[:search] == I18n.t('mobile.search_prompt')\n geocode_from_params\n else\n Geocoder.coordinates(params[:search]) || geocode_from_params\n end\n \n\n cookies[:geocode] = { :value => @geocode, :expires => 1.year.from_now }\n\n @locations = PlaceLoader.near(@geocode)\n\n @deals = DealSet.near(@geocode)\n @events = EventSet.upcoming_near(@geocode)\n end", "title": "" }, { "docid": "7dca83d2b5d432cfa5a52b90b6cf673b", "score": "0.59019285", "text": "def give_address\n\t\t\tputs \"For which user would you like to find an address? Please input first name:\"\n\t\t\tname1=gets.chomp\n\t\t\tputs \"Please input last name:\"\n\t\t\tname2=gets.chomp\n\t\t\tuser_address = User.find_by(first_name: name1, last_name: name2)\n\t\t\t\n\t\t\taddress=Address.find(user_address)\n\n\t\t\taddress.each do |address|\n\t\t\t\tputs \"Your current address is #{address.street}, #{address.city}, #{address.state} #{address.zip}.\"\n\t\t\tend\n\t\t\t\n\t\tend", "title": "" }, { "docid": "cacd09ce6012d6c590e954683aab4e4b", "score": "0.5901573", "text": "def comp_address_lookup\r\n params_exist = false\r\n if params[:address] and params[:zipcode]\r\n begin\r\n result = get_dashboard_query_url(:previous => true, :address1 => params[:address], :zipcode => params[:zipcode],\r\n :search_type => \"address_zipcode\")\r\n params_exist = true\r\n redirect_to dashboard_path(result)\r\n rescue => exception\r\n @exception = exception.message\r\n end\r\n end\r\n render 'comp_lookup' unless params_exist\r\n end", "title": "" }, { "docid": "81af71547a40ef0f1be5d7e8e690a44d", "score": "0.59005165", "text": "def search_breweries_by_city\n puts \"Please enter the city you would like to search in:\"\n puts\"\\n\"\n input = gets.chomp\n breweries = MaBreweries::BREWERY.find_by_city(input)\n if breweries\n breweries.each do |brewery|\n brewery.brew_info\n puts \"\\n\"\n end\n end\n end", "title": "" }, { "docid": "95fc060603647744aa867582031e7317", "score": "0.5882702", "text": "def index\n if params[:search_address].present?\n @products = Product.cakes_near(params[:search_address])\n else \n @products = Product.all\n end \n end", "title": "" }, { "docid": "e97e4d6b45510d7bbb68db3e9de3b696", "score": "0.58804256", "text": "def hotels_search(query)\n\t base_url = \"http://www.tripadvisor.in/TypeAheadJson?action=HOTELHOME&types=hotel,geo&hglt=true&global=true\"\n\t url = \"#{base_url}&query=#{URI.encode(query)}\"\n\t resp = Net::HTTP.get_response(URI.parse(url))\n\t data = resp.body\n\t result = JSON.parse(data)\n\t end", "title": "" }, { "docid": "3a6d61d3e70776b201cba4777793bb65", "score": "0.58766484", "text": "def search\n if params[:address].nil?\n @techs = []\n elsif !params[:address].blank? and !params[:city].blank? and params[:state]\n origin = [params[:address], params[:city], params[:state]].join(', ')\n elsif !params[:zip].blank?\n origin = params[:zip]\n elsif current_user.lat and current_user.lon\n origin = [current_user.lat, current_user.lon]\n else\n @error = 'Unable to determine your location'\n end\n \n if origin\n @techs = User.within(params[:miles].to_i, :origin => origin).paginate(:page => params[:page], :per_page => 10, :joins => :roles, :conditions => [\"roles.role = 'tech' and users.active = 1 and distance <= users.distance\"]).order('created_at DESC')\n end \n end", "title": "" }, { "docid": "012ff4446532346d256dfb4a67249084", "score": "0.5876052", "text": "def index\n @current_place = \"\"\n if params[:search].present?\n @current_place = params[:search]\n else\n @current_place = \"#{request.location.city} #{request.location.country unless request.location.country == 'Reserved'}\"\n end\n @current_place = \"Budapest, Hungary\" if @current_place.blank?\n\n @places = Place.near(@current_place, 200, :order => :distance)\n end", "title": "" }, { "docid": "1903e1d1b8a34a52bf146ef9fe9a96d3", "score": "0.58735263", "text": "def index\n if params[:query].present?\n sql_query = \"city ILIKE :query OR name ILIKE :query\"\n @superheros = Superhero.geocoded.where(sql_query, query: \"%#{params[:query].downcase}%\")\n @markers = @superheros.map do |superhero|\n {\n lat: superhero.latitude,\n lng: superhero.longitude\n }\n end\n else\n @superheros = Superhero.geocoded\n @markers = @superheros.map do |superhero|\n {\n lat: superhero.latitude,\n lng: superhero.longitude\n }\n end\n end\nend", "title": "" }, { "docid": "3066229cb1ded05b9b8b914f2f156219", "score": "0.5873157", "text": "def search\n query = params[:q]\n\t opts = {:pg => 1,\t:pgLen => 10, :where => \"Toronto\", :what => query, :UID => 1, :apikey => \"kdsu6xxqva28eu9zvpcpqfba\" }\n\t\tresult = open(\"http://api.sandbox.yellowapi.com/FindBusiness/?fmt=JSON&\" + opts.map{|k,v| \"#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}\" }.join(\"&\")).read\n\t\tresponse.content_type = Mime::JSON\n render :text => result\n end", "title": "" }, { "docid": "85622c81eeb4064cc7785fdf00ad6ebf", "score": "0.5870049", "text": "def choose_location_prompt\n\t\tif choice != 'exit'\n\t\t\tputs \"\\nPlease enter the city and state OR the zip code to search\"\n\t\t\tputs \"Example: 'Albuquerque, NM'; Example: '90210'\"\n\t\t\tputs \"Or type 'exit' to exit.\"\n\n\t\t\tgets_and_hand_off(:choose_location_input)\n\t\tend\n\tend", "title": "" }, { "docid": "10d59cbfc854d1b8277c1315b91f7c66", "score": "0.58699024", "text": "def search_book\n while 1\n puts \"Search for books by\\n1) Author's last name\\n2) Book title\\n3) Exit\"\n print \"Choice: \"\n choice = STDIN.gets\n\n case choice.to_i\n when 1\n print \"Last Name: \"\n last_name = STDIN.gets.chomp\n\n search_last_name last_name\n break\n when 2\n print \"Title: \"\n title = STDIN.gets.chomp\n\n search_title title\n break\n when 3\n break\n else\n puts \"Invalid choice!\"\n end\n end\nend", "title": "" }, { "docid": "16396cdd80b208f5b4719d644a7b2539", "score": "0.58691233", "text": "def searchByExact\n \trender json: $yelpClient.search(params[:exactLocation], {limit: 5})\n end", "title": "" }, { "docid": "54ed67e78dab652e0770ca3b329b7766", "score": "0.5866947", "text": "def search\n @results = searchPlace(params[:q])\n respond_to do |format|\n format.html\n format.json { render json: @results[0] }\n end\n end", "title": "" }, { "docid": "b347a927cee702380913d06ac0650ff8", "score": "0.58617896", "text": "def search\n require \"pp\"\n fields = {}\n fields[:bankname] = params[:bankname] if params[:bankname].present? \n fields[:branchname] = params[:branchname] if params[:branchname].present? \n fields[:bankcode] = params[:bankcode] if params[:bankcode].present? \n fields[:branchcode] = params[:branchcode] if params[:branchcode].present? \n fields[:swiftcode] = params[:swiftcode] if params[:swiftcode].present? \n fields[:address] = params[:address] if params[:address].present? \n \n #@banks = Bank.search_or(fields)\n @banks = Bank.search_and(fields)\n end", "title": "" }, { "docid": "f7151a2aa2eea5b205d364d54fa80830", "score": "0.58609396", "text": "def search\n\tuser_search = gets.strip.downcase\n\tsearch_input(user_search)\nend", "title": "" }, { "docid": "2d5efe317622430b865d9506c1c46e5b", "score": "0.58604586", "text": "def display_city_info(city_name)\n # showing list of cities and searching through them for the city name\n # search function is smart enough to find whichever city is closest to the city name entered\n if valid_city?(city_name)\n readable_city_info(city_name)\n else\n puts \"=====================================================\"\n puts \"No results found. Please try again.\"\n end\nend", "title": "" }, { "docid": "5f5b3df99c9b326ebf59586b551a56b5", "score": "0.5858895", "text": "def gatherInput\n\tputs \"Enter a postal code to continue fetching weather information\"\n\treturn gets.chomp\nend", "title": "" }, { "docid": "07a9633e8aa358a001c18bc7a128158e", "score": "0.5858033", "text": "def index\n if params[:search].present?\n @places = Place.near(params[:search], 1, order: 'distance', :units => 'km')\n\n @hash = Gmaps4rails.build_markers(@places) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow place.business_name\n end\n render :result, layout: 'result_layout' \n else\n @places = Place.all\n end\n end", "title": "" }, { "docid": "7f608e1ece93a3b09dc75a7eccc0b338", "score": "0.58572066", "text": "def index\n if params[:search].present?\n @halfway = Geocoder::Calculations.geographic_center([\"#{params[:search][:location_1]}\", \"#{params[:search][:location_2]}\"])\n # removes all empty strings from the array using reject\n categories = params[:search][:category].reject do |category|\n category == \"\"\n end\n # creates a query which holds the place holder times the number of elements in the array\n query = \"category = ? OR \" * categories.length\n # removes the additional \" OR \" added in the query string\n query = query.chomp(\" OR \")\n\n\n @geo_venues = Venue.geocoded.near(@halfway, 0.5, units: :km, :order => :distance).where(query, *categories)\n @venues = Venue.geocoded.near(@halfway, 0.5, units: :km, :order => :distance).where(query, *categories)\n @markers = @geo_venues.map do |venue|\n {\n lat: venue.latitude,\n lng: venue.longitude,\n id: venue.id,\n infoWindow: render_to_string(partial: \"info_window\", locals: { venue: venue }),\n }\n end\n else\n @venues = Venue.all\n @geo_venues = Venue.geocoded\n @markers = @geo_venues.map do |venue|\n {\n lat: venue.latitude,\n lng: venue.longitude,\n infoWindow: render_to_string(partial: \"info_window\", locals: { venue: venue }),\n }\n end\n end\n end", "title": "" }, { "docid": "debbe1c923b205dfe06c076fb5ac0ea1", "score": "0.5854647", "text": "def breakdown_proper_format(address)\n parsed = address.split(' ')\n zip = parsed[-1] #or regex\n state = parsed[-2] #or regex\n\n #Now find either city by going back and comparing to database, or ending of street input by going back and finding numbers/key words\n i = parsed.length - 3\n while i >= 0\n if /\\d+/ =~parsed[i] || /Floor/ =~parsed[i] #possibly more key words\n break\n else\n i -= 1\n end\n end\n city = parsed[i+1...-2].join(\" \")\n street = parsed[0..i].join(\" \")\n p street\n p city + \" \" + state + \", \" + zip\nend", "title": "" }, { "docid": "e9f6b7affbb050c3f584ada2caabd4ab", "score": "0.58535385", "text": "def search_results\n @search_params = {}\n\n\n #If the user has entered a search term, include it in the search params to pass to the Model find method\n if params[:river][:name] != \"\" && params[:river][:name] != nil\n name = params[:river][:name]\n river_id = River.find_all_by_name(name)[0].id\n @search_params[:river_id] = river_id\n end \n if params[:trip][:leader] != \"\" && params[:trip][:leader] != nil\n leader = params[:trip][:leader]\n @search_params[:leader] = leader\n end \n if params[:trip][:agency] != \"\" && params[:trip][:agency] != nil\n trip_agency = params[:trip][:agency]\n @search_params[:agency] = trip_agency \n end \n if params[:trip][:start_date] != \"\" && params[:trip][:start_date] != nil\n date = params[:trip][:start_date]\n @search_params[:start_date] = date\n end \n if params[:trip][:key_words] != \"\" && params[:trip][:keywords] != nil\n keywords = params[:trip][:keywords]\n end \n\n # MH 4/24/13 - Search model depending on params that are set by calling Trip model's find method\n # Set @trips variable to the result to make available to search_results view \n # Search algorithm: if the user has entered keywords, search summary column in Trips table\n # for those keywords, and return any matches (regardless of other column values for now)\n # if no keywords are entered, then search using other params\n # User.friends.find(:all, :conditions => [\n # 'town LIKE ? AND hobby = ? AND age >= ?', \n # \"%#{params[:town]}%\", params[:hobby], params[:age] \n # ])\n @trips = Trip.find(:all, :conditions => \n if(keywords == \"\" || keywords == nil) \n @search_params \n else\n # [\"summary LIKE ? AND river_id = ? AND leader = ? AND agency = ? AND start_date = ?\", \n # \"%#{keywords}%\", river_id, leader, trip_agency, date] #this doesn't work unless all form fields are filled out\n [\"summary like ?\", keywords + \"%\"] || @search_params\n end ) \n end", "title": "" }, { "docid": "c0e86e29186279249e9a4b5bdf8140c4", "score": "0.58422554", "text": "def search(options)\n defaults = {\n :realestatetype => [\"housebuy\"],\n :geocodes => 1276,\n }\n options = defaults.merge(options)\n types = options[:realestatetype]\n\n case types\n when String\n types = [types]\n end\n\n objects = []\n\n types.each do |type|\n options[:realestatetype] = type\n #puts \"Search options are \" + options.inspect\n\n url = connection.build_url(\"search/region\", options)\n puts \"Calling URL \" + url.to_s\n\n response = connection.get(\"search/region\", options )\n puts \"Resp \" + response.inspect\n if response.status == 200\n if response.body[\"resultlist.resultlist\"].resultlistEntries[0]['@numberOfHits'] == \"0\"\n response.body[\"resultlist.resultlist\"].resultlistEntries[0].resultlistEntries = []\n end\n arr = response.body[\"resultlist.resultlist\"]['resultlistEntries'][0]['resultlistEntry']\n objects = objects.concat(arr)\n end\n end\n\n #puts \"Object size \" + objects.length.to_s\n objects\n end", "title": "" }, { "docid": "1efbf1ebb4654e6a71c82635b5cbdd23", "score": "0.583369", "text": "def search_params_for_display(search_query)\n search_query[:place_ids].present? ? search_query_places_size = search_query[:place_ids].length : search_query_places_size = 0\n if search_query_places_size > 0\n first_place = search_query[:place_ids][0]\n first_place = Place.find(first_place) if appname.downcase == 'freereg'\n if appname.downcase == 'freecen'\n first_place = Place.find(search_query[:place_ids][0])\n if first_place.blank?\n first_place = Freecen2Place.find(search_query[:place_ids][0])\n end\n end\n place = first_place.place_name\n if search_query.all_radius_place_ids.length > 1\n last_place = search_query.all_radius_place_ids[-2]\n last_place = Place.find(last_place) if appname.downcase == 'freereg'\n if appname.downcase == 'freecen'\n last_place = Place.find(last_place)\n if last_place.blank?\n last_place = Freecen2Place.find(search_query.all_radius_place_ids[-2])\n end\n end\n additional = search_query.all_radius_place_ids.length - 1\n place <<\n \" (including #{additional} additional places within\n #{geo_near_distance(first_place,last_place,Place::MeasurementSystem::ENGLISH).round(1)}\n #{Place::MeasurementSystem::system_to_units(Place::MeasurementSystem::ENGLISH)} )\"\n end\n end\n display_map = {}\n # name fields\n display_map['First Name'] = search_query.first_name.upcase if search_query.first_name\n display_map['Last Name'] = search_query.last_name.upcase if search_query.last_name\n display_map['Exact Match?'] = 'Yes' unless search_query.fuzzy\n display_map['Exact Match?'] = 'No' if search_query.fuzzy\n\n case appname.downcase\n when 'freereg'\n display_map['Start Year'] = search_query.start_year if search_query.start_year\n display_map['End Year'] = search_query.end_year if search_query.end_year\n display_map['Record Type'] = RecordType::display_name(search_query.record_type) if search_query.record_type\n display_map['Record Type'] = 'All' if search_query.record_type.blank?\n counties = search_query.chapman_codes.map{|code| ChapmanCode::name_from_code(code)}.join(' or ')\n display_map['Counties'] = counties if search_query.chapman_codes.size > 1\n display_map['County'] = counties if search_query.chapman_codes.size == 1\n display_map['Place'] = place if search_query_places_size > 0\n display_map['Include Family Members'] = 'Yes' if search_query.inclusive\n display_map['Include Witnesses'] = 'Yes' if search_query.witness\n when 'freecen'\n display_map['Birth Year'] = \"#{search_query.start_year} - #{search_query.end_year}\" if search_query.start_year || search_query.end_year\n display_map['Census Year'] = RecordType::display_name(search_query.record_type) if search_query.record_type\n display_map['Census Year'] = 'All' if search_query.record_type.blank?\n counties = search_query.birth_chapman_codes.map{|code| ChapmanCode::name_from_code(code)}.join(' or ')\n display_map['Birth Counties'] = counties if search_query.birth_chapman_codes.size > 1\n display_map['Birth County'] = counties if search_query.birth_chapman_codes.size == 1\n counties = search_query.chapman_codes.map{|code| ChapmanCode::name_from_code(code)}.join(' or ')\n display_map['Census Counties'] = counties if search_query.chapman_codes.size > 1\n display_map['Census County'] = counties if search_query.chapman_codes.size == 1\n display_map['Census Place'] = place if search_query_places_size > 0\n display_map['Disabled'] = 'Yes' if search_query.disabled\n display_map['Sex'] = search_query.sex if search_query.sex.present?\n display_map['Marital Status'] = search_query.marital_status if search_query.marital_status.present?\n display_map['Language'] = search_query.language if search_query.language.present?\n display_map['Occupation'] = search_query.occupation if search_query.occupation.present?\n end\n display_map\n end", "title": "" }, { "docid": "f84cdbbf4fad006b9959d08346662513", "score": "0.5832339", "text": "def get_location\n\tputs \"Enter your zip code:\"\n\tlocation = gets.chomp\nend", "title": "" }, { "docid": "f84cdbbf4fad006b9959d08346662513", "score": "0.5832339", "text": "def get_location\n\tputs \"Enter your zip code:\"\n\tlocation = gets.chomp\nend", "title": "" }, { "docid": "69ee94504dc79c19b40b62756522d9f6", "score": "0.5829274", "text": "def cityDetails(city)\n print \"You selected #{city.name}\\n\"\n print \"Do you want to know this city's:\\n\"\n print \" * Code. (c)\\n\"\n print \" * Name. (n)\\n\"\n print \" * Country. (cy)\\n\"\n print \" * Continent. (ct)\\n\"\n print \" * Timezone. (t)\\n\"\n print \" * Latitude and longitude. (l)\\n\"\n print \" * Population. (p)\\n\"\n print \" * Region. (r)\\n\"\n print \" * Flights from this metro. (f)\\n\"\n print \" * Edit. (e)\\n\"\n print \" * Remove. (rm)\\n\"\n print \" * Back. (b)\\n\"\n print \" * Exit. (x)\\n\"\n\n query = gets.chomp\n exiting = false\n\n # Get what the user wants to see, man\n if query.match(/^c$/i)\n print \"#{city.name}'s code is #{city.code}\\n\"\n elsif query.match(/[nN]/)\n print \"#{city.code} has name #{city.name}\\n\"\n elsif query.match(/cy/i)\n print \"#{city.name} is in #{city.location.country}\\n\"\n elsif query.match(/ct/i)\n print \"#{city.name} is in #{city.location.continent}\\n\"\n elsif query.match(/[t]/i)\n print \"#{city.name} is in timezone #{city.location.timezone}\\n\"\n elsif query.match(/[l]/i)\n print \"#{city.name} has latitude #{city.location.lat_and_lon}\\n\"\n elsif query.match(/[p]/i)\n print \"#{city.name} has population #{city.population}\\n\"\n elsif query.match(/^r$/i)\n print \"#{city.name} has region code #{city.location.region}\\n\"\n elsif query.match(/[f]/i)\n print \"This metro has flights to: #{@my_network.getFlightsByNameFrom(city).join(', ')}\\n\"\n elsif query.match(/[e]/)\n edit(city)\n elsif query.match(/rm/)\n removeDialog(city)\n elsif query.match(/[bB]/)\n inputCity\n elsif query.match(/[xX]/)\n exiting = true\n exit\n else\n error\n end\n\n # Make one of the options default with caps\n unless exiting\n print \"Do you want to know anything else about #{city.name}? (y/n)\\n\"\n\n # Do they want to know something else about this city?\n continue = gets.chomp\n if continue.match(/y/i)\n cityDetails(city)\n\n elsif continue.match(/n/i)\n mainMenu\n\n else\n error\n end\n end\n end", "title": "" }, { "docid": "f84060e31ff38a9ed0e9150db1f03c50", "score": "0.5825362", "text": "def autocomplete(query, options = {} )\n available_options = %w(q st level boxLatitudeNW boxLongitudeNW boxLatitudeSE boxLongitudeSE returnCount)\n options = options.select {|k,v| available_options.include?(k.to_s)}\n options[:q] = query\n get \"/autocomplete/schools\", options\n end", "title": "" }, { "docid": "f97d7ea56b4338a98532f42438f9b4cc", "score": "0.5817224", "text": "def find_restaurants\n \t\trequire 'foursquare2'\n\t\tclient = Foursquare2::Client.new(:client_id => 'YSQG41AQAJQ1OORJNEKL100YNLT1WU1ANTZQIGMRBHWYRJ3E', :client_secret => 'D44KN20IQPAAF41HZVB0SOZPVQULSGRLZACCXKTZAUAURO0K', :api_version => '20120505')\n\t\tresults = client.search_venues(:ll => '36.142064,-86.816086', :query => self.input).venues\n\t\tputs \" #{results.length} Results for search term '#{self.input}' \"\n\t\ttotal_results = []\n\t\tresults.each do |venue|\n\t\t\tputs \"Restaurant Name: #{venue.name}\"\n\t\t\tputs \"Address: #{venue.location.address}\"\n\t\t\ttotal_results.push(\"#{venue.name} - #{venue.location.address}\")\n\t\tend\n\t\tself.result = total_results.join(\",\")\n \t end", "title": "" }, { "docid": "f5d0e1916f3c72b9b97e0138a84f2f5d", "score": "0.5817158", "text": "def geocode_query(query)\n if self.query.blank?\n Geokit::Geocoders::MultiGeocoder.geocode('99.157.198.126')\n elsif self.is_address_query?\n Geokit::Geocoders::MultiGeocoder.geocode query\n elsif (named_listing = Listing.first(:conditions => ['listings.title LIKE ?', \"%#{self.query}%\"]))\n GeoKit::GeoLoc.new(named_listing)\n end\n end", "title": "" }, { "docid": "2c9329f186b296e8d7641e7e5d4aed3e", "score": "0.58048886", "text": "def get_search options\n make_request :get, SEARCH_URL, :search, options, [:word, :pn]\n end", "title": "" }, { "docid": "832f2eb8fd98b8f821a97fe5cf7b8f4b", "score": "0.5803006", "text": "def search(*args)\n if blank_query?(args[0])\n results = []\n else\n ip = (args.size == 1 and ip_address?(args.first))\n results = lookup(ip).search(*args)\n end\n results.instance_eval do\n def warn_search_deprecation(attr)\n warn \"DEPRECATION WARNING: Geocoder.search now returns an array of Geocoder::Result objects. \" +\n \"Calling '%s' directly on the returned array will cause an exception in Geocoder v1.0.\" % attr\n end\n\n def coordinates; warn_search_deprecation('coordinates'); first.coordinates if first; end\n def latitude; warn_search_deprecation('latitude'); first.latitude if first; end\n def longitude; warn_search_deprecation('longitude'); first.longitude if first; end\n def address; warn_search_deprecation('address'); first.address if first; end\n def city; warn_search_deprecation('city'); first.city if first; end\n def country; warn_search_deprecation('country'); first.country if first; end\n def country_code; warn_search_deprecation('country_code'); first.country_code if first; end\n end\n return results\n end", "title": "" }, { "docid": "e882412f37ddc0a830a60979866507a7", "score": "0.5802747", "text": "def index\n puts params[:zip_code]\n @coworkings = Coworking.all\n @coworkings_selected = []\n if params[\"geocode_information\"]\n analyze_geocode_information\n end\n\n if params[:zip_code]\n @coworkings.each do |coworking|\n if coworking.zipcode[0..1] == params[:zip_code]\n @coworkings_selected << coworking\n end\n end\n end\n\n if @coworkings_selected.empty?\n @coworkings_selected = @coworkings\n @box_focus = \"France\"\n end\n\n @coordinates = []\n @co_id = []\n\n @coworkings_selected.each do |coworking|\n @coordinates << [coworking.latitude.to_f / 1_000_000, coworking.longitude.to_f / 1_000_000]\n @co_id << coworking.id\n end\n end", "title": "" }, { "docid": "3a97516140ca7b5f8a20399bdc2acce1", "score": "0.57919586", "text": "def search\n args = search_params\n # If the search term is greater than 2 characters\n if args.present? && args.fetch(:name, \"\").length > 2\n type = params.fetch(:type, \"local\")\n\n # If we are including external API results\n case type\n when \"combined\"\n orgs = OrgSelection::SearchService.search_combined(\n search_term: args[:name]\n )\n when \"external\"\n orgs = OrgSelection::SearchService.search_externally(\n search_term: args[:name]\n )\n else\n orgs = OrgSelection::SearchService.search_locally(\n search_term: args[:name]\n )\n end\n\n # If we need to restrict the results to funding orgs then\n # only return the ones with a valid fundref\n if orgs.present? && params.fetch(:funder_only, \"false\") == true\n orgs = orgs.select do |org|\n org[:fundref].present? && !org[:fundref].blank?\n end\n end\n\n render json: orgs\n\n else\n render json: []\n end\n end", "title": "" }, { "docid": "56d78fc5be71353883066cb11600bf3e", "score": "0.5785646", "text": "def search\n=begin\ncompany = params[:Company]\noffice = params[:Office]\nletter = params[:letter]\n\n@search = Worker.search do\nfulltext params[:search]\nif !company.blank?\nwith :company_id, company\nend\nif !office.blank?\nwith :office_id, office\nend\nend\nif letter.blank? || letter == \"%\"\n@workers = @search.results.sort_by{ |worker| worker.worker_code }\nelse\n@workers = Worker.order('worker_code').where(\"last_name LIKE ?\", \"#{letter}%\")\nend\n\nrespond_to do |format|\nformat.html # search.html.erb\nformat.json { render json: @workers }\nend\n=end\n=begin\ncase\nwhen !has_company && !has_office\n@workers = Worker.order('worker_code').all\nwhen has_company && !has_office\n@workers = Worker.order('worker_code').where(\"company_id = ?\", company)\nwhen !has_company && has_office\n@workers = Worker.order('worker_code').where(\"office_id = ?\", office)\nwhen has_company && has_office\n@workers = Worker.order('worker_code').where(\"company_id = ? AND office_id = ?\", company, office)\nend\n=end\n end", "title": "" }, { "docid": "871fa2e40c71117808c12d0257a10d92", "score": "0.5784384", "text": "def options_to_start_new_search(user)\n puts \"------------------------------------\"\n puts \"To start new search with current location, enter 'Search'\"\n puts \"To change your current location and start new search, enter 'Change'\"\n puts \"To exit app, enter 'Exit'\"\n puts \"------------------------------------\"\n response = gets.chomp\n if response == \"search\" || response == \"Search\" || response == \"SEARCH\"\n start_search(user.user_location, user)\n elsif response == \"change\" || response == \"Change\" || response == \"CHANGE\"\n new_user_address = get_new_user_location\n change_user_location(user, new_user_address)\n start_search(new_user_address, user)\n elsif response == \"exit\" || response == \"Exit\" || response == \"EXIT\"\n puts \"------------------------------------\"\n puts \"Thank you for using our App, bye.\"\n puts \"------------------------------------\"\n else\n puts \"------------------------------------\"\n puts \"Sigh... I guess you really don't know how to read\"\n puts \"How did you manage to open the app?\"\n puts \"------------------------------------\"\n options_to_start_new_search(user)\n end\nend", "title": "" }, { "docid": "02c4a169887d0545095fc914c6becba8", "score": "0.57823646", "text": "def search\n address = params['btc_address']\n @btc_address = GeneratedAddress.find_by_btc_address address\n if @btc_address\n render :search_form\n else\n redirect_to admin_generated_address_search_form_path, alert: 'Address not found'\n end\n end", "title": "" }, { "docid": "c95fda065b47834753319f9d94fb6fa9", "score": "0.5781388", "text": "def index\n location = params[:zipcode] || 'Florida'\n @gyms = HTTParty.get( \"https://api.yelp.com/v3/businesses/search?&attributes=deals&term=fitness gym #{params[:search_term]}&location=#{location}\" , {\n headers: { 'Authorization': 'Bearer r4wFUtshxYjSPcFpTycPOSIuza5_eVkTvpjKFlSdF4bqCqIIaQh2y5rjliAUIo__6h6L6JMDnLVQJWr6eP6uCR2kQgRm1-96gPkmpZRbyRsfq7mJbTt8NLznDQ1TXXYx' }\n })\n @gyms = @gyms.parsed_response[\"businesses\"]\n @terms = [params[:search_term], params[:zipcode]].join(' ')\n end", "title": "" }, { "docid": "69e24a54ebf0b3d461e102bc0f0e6a60", "score": "0.5775833", "text": "def index\n if params[:zipcode] != ''\n session[:search_results] = request.url\n @laundromats = Laundromat.where(zipcode: params[:zipcode]).order(\"name\")\n \n else\n \n @laundromats = Laundromat.all\n end\n end", "title": "" } ]
e4116e07d5cc16e9f88e9826660c8fa3
PUT /devices/1 PUT /devices/1.xml
[ { "docid": "c43ddf431019577cd21bcc05ad18ac74", "score": "0.599442", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n flash[:notice] = 'Device was successfully updated.'\n format.html { redirect_to(@device) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "608d2f58e93e2a844cba814b363df9ef", "score": "0.6375398", "text": "def update(id, name=\"Updated Name\", extension=0000)\n xml_req =\"{\\\"device\\\":{ \\\"id\\\":#{id},\\\"number\\\":\\\"#{number}\\\",\\\"name\\\":\\\"#{name}\\\",\\\"address\\\":\\\"#{address}\\\"}}\"\n \n \n request = Net::HTTP::Put.new(\"#{@url}/#{id}.json\")\n request.add_field \"Content-Type\", \"application/json\"\n request.body = xml_req\n \n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n \n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "title": "" }, { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.6184096", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "7e5885e9ee1b37d0430014584a0115af", "score": "0.59265333", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n File.open(Rails.root.to_s + \"/config/device_configs/device_#{@device.id}.json\",\"w\") do |f|\n f.write(params[:configs])\n end \n format.html { redirect_to [@project, @device], notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e1df3139218ad5203b80b4405fefc5f", "score": "0.58962846", "text": "def update\n @device = Device.find(params[:id])\n #devicename = @device.name\n respond_to do |format|\n \tif @device.update_attributes(params[:device])\n\t\t\t#\tif @device.sends_logs\n\t \t#\t\tputs @device.name\n \t# client = SimpleApp::Application::Sockets[devicename] # wczesniejsza wersja z tutaj wyluskiwanym name nie dziala bo zwracalo nul\n \t# client.puts 'dupa' \t\n \t# end\n \t format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n \t format.json { head :no_content }\n \telse\n \t format.html { render action: \"edit\" }\n \t format.json { render json: @device.errors, status: :unprocessable_entity }\n \tend\n end\n end", "title": "" }, { "docid": "537dd89d9df3cb746c0f8b6b277f5d3b", "score": "0.5863787", "text": "def update\n @device = Device.find(params[:id])\n\n if @device.update(device_params)\n head :no_content\n else\n render json: @device.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "526e6e30e325e7fd9538a3d04ab69d1d", "score": "0.58503944", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to :controller => \"devices\", :action => \"edit\", :id => @device.id }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4e8e2ba23f715d79691f428fe2b8330", "score": "0.5823421", "text": "def set_device(device_id, display_name:)\n device_id = ERB::Util.url_encode device_id.to_s\n\n request(:put, client_api_latest, \"/devices/#{device_id}\", body: { display_name: display_name })\n end", "title": "" }, { "docid": "cc2e9938dcede3bdfc04507abf309bd8", "score": "0.5805588", "text": "def bulk_update(devices)\n client = IotHubApiClient.new(@options)\n hash = devices.map &:as_json\n res = client.post(devices_path, @api_version_param, JSON.dump(hash))\n check_response(res)\n end", "title": "" }, { "docid": "9ddf960eb3f437e62b9b99d34992bc0f", "score": "0.58001596", "text": "def test_should_update_status_post_via_API_XML\r\n get \"/logout\"\r\n put \"/status_posts/1.xml\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_response :success\r\n end", "title": "" }, { "docid": "0c9d8600815149e41de9e8965cdefd98", "score": "0.5793404", "text": "def set(host, devices, commands)\n action(host, MEACControl::XML::SetRequest.new(devices, commands))\n end", "title": "" }, { "docid": "a874e543c6cd458d56dd4bc27007fb74", "score": "0.5712394", "text": "def update\n @device_config = DeviceConfig.find(params[:id])\n\n respond_to do |format|\n if @device_config.update_attributes(params[:device_config])\n flash[:notice] = 'DeviceConfig was successfully updated.'\n format.html { redirect_to(@device_config) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac4fab8a3951a7cb0fea1b148bdef205", "score": "0.570174", "text": "def update\n @device_type = DeviceType.find(params[:id])\n\n respond_to do |format|\n if @device_type.update_attributes(params[:device_type])\n flash[:notice] = 'DeviceType was successfully updated.'\n format.html { redirect_to(@device_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cac383775f82391ceec9ed25fe5134fc", "score": "0.5678201", "text": "def update\n @device_config = Probe::DeviceConfig.find(params[:id])\n\n respond_to do |format|\n if @device_config.update_attributes(params[:device_config])\n flash[:notice] = 'Probe::DeviceConfig.was successfully updated.'\n format.html { redirect_to(@device_config) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "191ceb89fad270838051ac3d3268acc2", "score": "0.56447476", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: \"#{@device.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b49ff24235c03b9c043f32e9d8b7f7ec", "score": "0.56318647", "text": "def update\n @apn_device = APN::Device.find(params[:id])\n\n respond_to do |format|\n if @apn_device.update_attributes(params[:apn_device])\n format.html { redirect_to(@apn_device, :notice => 'Device was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @apn_device.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6b64f7d50eab9d75dd95fe5d59b6e32", "score": "0.562391", "text": "def update\n respond_to do |format|\n @device.name = params[:device][:name]\n if @device.save\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d69de89b524f0629f2e0cbca090c5eb", "score": "0.5617717", "text": "def update\n @device = Device.find(params[:id])\n if @device.update_attributes(params[:device])\n flash[:notice] = \"Updated Device\"\n redirect_to :action => :index\n else\n render :template => \"devices/edit\"\n end\n end", "title": "" }, { "docid": "a48b3229e830876ae619b936301400b2", "score": "0.5617231", "text": "def put(url, xml, version = nil)\n req = Net::HTTP::Put.new(url)\n req.content_type = 'application/x-ssds+xml'\n \n if(!version.nil?)\n req['if-match'] = version;\n end\n \n req.content_length = xml.to_s.size.to_s\n req.basic_auth @username, @password\n req.body = xml.to_s\n execute_request(req)\n end", "title": "" }, { "docid": "b1b350aa21243005996ebccb0a2cad5d", "score": "0.56086403", "text": "def update\n @device = Device.find(params[:id])\n user_device_token_ids\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95096fe031f231f0b1ee756b4a69fe78", "score": "0.55937594", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, \n notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, \n status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe6ed27e834e5ef8f9dcbc5e45f2f45c", "score": "0.55912447", "text": "def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n end", "title": "" }, { "docid": "fe6ed27e834e5ef8f9dcbc5e45f2f45c", "score": "0.55912447", "text": "def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n end", "title": "" }, { "docid": "fe6ed27e834e5ef8f9dcbc5e45f2f45c", "score": "0.55912447", "text": "def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n end", "title": "" }, { "docid": "fe6ed27e834e5ef8f9dcbc5e45f2f45c", "score": "0.55912447", "text": "def update!(**args)\n @devices = args[:devices] if args.key?(:devices)\n end", "title": "" }, { "docid": "8a443842e8832ce157eaf4ec2dfc775e", "score": "0.5576452", "text": "def update_device(sku, data)\n put(\"/devices/#{sku}\", data)['device']\n end", "title": "" }, { "docid": "9ee7e3df9c2a1b79ca23626732c632d5", "score": "0.55724245", "text": "def update\n @customer = Customer.find(params[:customer_id])\n @device = @customer.devices.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to([@customer,@device], :notice => 'Device was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @device.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c735fbad7d1714dfee23b9ca1a078350", "score": "0.5571956", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c735fbad7d1714dfee23b9ca1a078350", "score": "0.5571956", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c735fbad7d1714dfee23b9ca1a078350", "score": "0.5571956", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c735fbad7d1714dfee23b9ca1a078350", "score": "0.5571956", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c735fbad7d1714dfee23b9ca1a078350", "score": "0.5571956", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c735fbad7d1714dfee23b9ca1a078350", "score": "0.5571956", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.55645704", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "38979984bdedacd95706689e25f09f9e", "score": "0.5543794", "text": "def put(document, method='')\n @resource[method].put(document.to_s, :content_type => 'text/xml')\n end", "title": "" }, { "docid": "cb88e65227f9283ba66c93fb970afeb2", "score": "0.55108684", "text": "def add_device(kind, params)\n Cheetah.run([\"sudo\", \"virt-xml\", name, \"--add-device\", \"--#{kind}\", params])\n end", "title": "" }, { "docid": "b72e7622abbb6809c435b490cd361aaa", "score": "0.54978824", "text": "def set_device\n @device = Device.find(params[:id])\nend", "title": "" }, { "docid": "dc3e84a6796d2404c43cc14c1ac600f9", "score": "0.5491138", "text": "def set_device\n puts \"***************** From Set device\"\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "ab05d2d3850ab650bb86caa53f0130b7", "score": "0.5490291", "text": "def update\n headers = self.class.headers.merge 'Accept' => 'application/xml'\n connection.post(element_path(prefix_options.merge(:action_hack => :update)), encode, headers).tap do |response|\n load_attributes_from_response(response)\n end\n end", "title": "" }, { "docid": "a2abaea7eb23530e64c3f72049a5c3cb", "score": "0.54888326", "text": "def update_xml(xml, value)\n xml\n end", "title": "" }, { "docid": "65002c12b6e1020c98daca99a1db15e3", "score": "0.54832506", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "65002c12b6e1020c98daca99a1db15e3", "score": "0.54832506", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "65002c12b6e1020c98daca99a1db15e3", "score": "0.54832506", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "65002c12b6e1020c98daca99a1db15e3", "score": "0.54832506", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "65002c12b6e1020c98daca99a1db15e3", "score": "0.54832506", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "65002c12b6e1020c98daca99a1db15e3", "score": "0.54832506", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "65002c12b6e1020c98daca99a1db15e3", "score": "0.54832506", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "65002c12b6e1020c98daca99a1db15e3", "score": "0.54832506", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "160eefb084b94f81025521d90a383921", "score": "0.54826194", "text": "def update\n @device = Device.find(params[:id])\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to edit_device_path(@device), notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acacdd703b3e949f1f400be84ae58b45", "score": "0.54795563", "text": "def update\n @device = Device.find(params[:id])\n if !check_owner(@device)\n flash[:warning] = \"Unable to edit this device. Are you the owner?\"\n redirect_to root_path\n return\n end\n\n respond_to do |format|\n if @device.update_attributes(params[:device])\n flash[:notice] = 'Device was successfully updated.'\n format.html { redirect_to(root_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45cad7c5aee9fadb2d004ec9f0a14d67", "score": "0.5471719", "text": "def update(conn, datahexstr)\n data = hexToBytes(datahexstr)\n resp = conn.put do |req|\n req.url \"/sensor.json\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['Accept'] = 'application/json'\n req.body = DecodeElsysPayload(data).to_json\n end\n puts resp.status\nend", "title": "" }, { "docid": "ddc81ddd582d68da1e497bb560343bcf", "score": "0.5466452", "text": "def update\n respond_to do |format|\n if @device_id.update(device_id_params)\n format.html { redirect_to @device_id, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_id }\n else\n format.html { render :edit }\n format.json { render json: @device_id.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6fd8842ed08fa1572950f3e78514aecf", "score": "0.54649204", "text": "def do_PUT(req, res)\n domain, resource, id, format = parse_request_path(req.path_info)\n attributes = from_xml(resource, req.body)\n attributes['updated-at'] = Time.now.iso8601\n logger.debug \"Updating item with attributes: #{attributes.inspect}\"\n sdb_put_item(domain, attributes, true)\n raise WEBrick::HTTPStatus::OK\n end", "title": "" }, { "docid": "2fc2c7bb6b737601c50e14d87e1c4ff4", "score": "0.5449092", "text": "def update\n puts \"***************** From update\"\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f92fd98bf5fa83bc99696bc0309de152", "score": "0.54432046", "text": "def register_device(device_token, tags=[])\n data = {:tags=>tags}.to_json\n\n put \"/device/#{device_token}\", data\n end", "title": "" }, { "docid": "dce4af4ea9f20e389d8e7d59a7cae9ed", "score": "0.5441708", "text": "def update\n respond_to do |format|\n if @iot_device.update(iot_device_params)\n format.html { redirect_to @iot_device, notice: 'Iot device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @iot_device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c8f03a2633f8f9d583c3fe73716aafc", "score": "0.5434929", "text": "def update_xml(xml, value)\r\n xml\r\n end", "title": "" }, { "docid": "523f65f243a3c61812e5ade15c5ca5b8", "score": "0.5431637", "text": "def update!(property_id:, value:)\n HTTParty.put(\"#{NestApi::API_URL}/devices/thermostats/#{@id}\",\n query: { auth: @token.access_token },\n body: { \"#{property_id}\" => value }.to_json,\n headers: { 'Content-Type' => 'application/json'\n })\n end", "title": "" }, { "docid": "0f9ffa55734a2da95f9b9ac9992fdf83", "score": "0.54310733", "text": "def update\n @device_type = DeviceType.find(params[:id])\n\n respond_to do |format|\n if @device_type.update_attributes(params[:device_type])\n format.html { redirect_to @device_type, notice: 'Device type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39875cf5ad854227ddcb62ff9361b7a2", "score": "0.5428884", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n if device_params.has_key?('volumes_attributes')\n vols = \"\"\n @device.volumes.each { |vol| vols = vols + \"<#{vol.name.upcase.delete(' ')}>#{vol.value}</#{vol.name.upcase.delete(' ')}>\" }#FIXME take from volumes_attributes\n\n task = @device.tasks.where({ typeofstatus_id: 1, typeoftask_id: 3}).first\n if task.present?\n task.update(typeofstatus_id: 1, user_id: current_user.id, options: \"<VOLUMES>#{vols}</VOLUMES>\")\n else\n @device.tasks.create(typeoftask_id: 3, typeofstatus_id: 1, user_id: current_user.id, options: \"<VOLUMES>#{vols}</VOLUMES>\")\n end\n end\n\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ba5c63d9f819d361c969959ffdff264", "score": "0.5418493", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to devices_path, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d61a25d69ed10b03601d4f17ba7d9ef3", "score": "0.5415517", "text": "def update\n #RAILS_DEFAULT_LOGGER.debug(\"******** REST Call to CRMS: Updating #{self.class.name}:#{self.id}\")\n #RAILS_DEFAULT_LOGGER.debug(caller[0..5].join(\"\\n\")) \n response = connection.put(element_path(prefix_options), to_xml, self.class.headers)\n save_nested\n load_attributes_from_response(response)\n merge_saved_nested_resources_into_attributes\n response\n end", "title": "" }, { "docid": "6eb02f739f61ef06f4d42865071ecad3", "score": "0.541414", "text": "def put_memory(id, memory)\n data = <<EOF\n <Item \n xmlns=\"http://www.vmware.com/vcloud/v1.5\" \n xmlns:rasd=\"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData\" \n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n xmlns:ns12=\"http://www.vmware.com/vcloud/v1.5\" \n ns12:href=\"#{end_point}vApp/#{id}/virtualHardwareSection/memory\" \n ns12:type=\"application/vnd.vmware.vcloud.rasdItem+xml\" \n xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1.5 #{end_point}v1.5/schema/master.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd\">\n <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>\n <rasd:Description>Memory Size</rasd:Description>\n <rasd:ElementName>#{memory} MB of memory</rasd:ElementName>\n <rasd:InstanceID>5</rasd:InstanceID>\n <rasd:Reservation>0</rasd:Reservation>\n <rasd:ResourceType>4</rasd:ResourceType>\n <rasd:VirtualQuantity>#{memory}</rasd:VirtualQuantity>\n <rasd:Weight>0</rasd:Weight>\n <Link rel=\"edit\" type=\"application/vnd.vmware.vcloud.rasdItem+xml\" href=\"#{end_point}vApp/#{id}/virtualHardwareSection/memory\"/>\n </Item>\nEOF\n\n request(\n :body => data,\n :expects => 202,\n :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.rasdItem+xml'},\n :method => 'PUT',\n :parser => Fog::ToHashDocument.new,\n :path => \"vApp/#{id}/virtualHardwareSection/memory\"\n )\n end", "title": "" }, { "docid": "ed6b1e473b7eae92e30c36fba9b61212", "score": "0.5413277", "text": "def update\n @external_system = Uid::ExternalSystem.find(params[:id])\n\n respond_to do |format|\n if @external_system.update_attributes(params[:uid_external_system])\n format.html { redirect_to({:action=>\"index\"}, :notice => t(:successfully_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @external_system.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91e222f5e4ec3e3bdb488c250d77c6dd", "score": "0.5409537", "text": "def update\n @component = Component.find(params[:component][:id])\n\n respond_to do |format|\n if @component.update_attributes(params[:component])\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "5e7f56eb1e62b28a791b8dded85ac5c5", "score": "0.5406708", "text": "def update_rest\n @v1_item_usage = V1ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @v1_item_usage.update_attributes(params[:v1_item_usage])\n flash[:notice] = 'V1ItemUsage was successfully updated.'\n format.html { redirect_to(@v1_item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @v1_item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f7c7adb727828e6476078587181f2044", "score": "0.540588", "text": "def update\n puts \">>> DEVICE_CONTROLLER: update \"\n\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "60f67389e95069c20c28f698bb6f5c58", "score": "0.53980356", "text": "def update\n\n #if !(logged_in? && current_user.user_type<=1)\n # redirect_to \"/404.html\"\n #end\n\n\n #1st you retrieve the net_rack thanks to params[:net_rack_id]\n #net_rack = NetRack.find(params[:net_rack_id])\n #2nd you retrieve the device thanks to params[:id]\n #@device = net_rack.devices.find(params[:id])\n\n respond_to do |format|\n # if @device.update_attributes(params[:device])\n if @device.update(device_params)\n #1st argument of redirect_to is an array, in order to build the correct route to the nested resource device\n format.html { redirect_to([@device], :notice => 'Termination Device was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @device.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4bae15e49cfc9eff945f2ba27b40300", "score": "0.5394761", "text": "def updateDevice(device)\n @target = \"#{@api_base_uri}/device/updateDevice\"\n @xmlstring = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' + create_device_xml(device).to_s\n @request = prepare_request\n @result = post_request\n if @result.elements[\"response/status/code\"].try(:text) == '000'\n return @result.elements[\"response/profile/data\"].try(:text)\n else\n # TODO: Raise error\n return false\n end\n end", "title": "" }, { "docid": "0df207901d6e4fee81c09b87ba00caca", "score": "0.53913903", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0df207901d6e4fee81c09b87ba00caca", "score": "0.53913903", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0df207901d6e4fee81c09b87ba00caca", "score": "0.53913903", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ed315709fd41bf84d60e5804b965243", "score": "0.53902656", "text": "def update\n respond_to do |format|\n if @device.update_attributes(params[:device])\n format.html { redirect_to(@device, :notice => 'Device was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "title": "" }, { "docid": "764dec45d24095158154c83be477e8c3", "score": "0.53661823", "text": "def update_delivery_device(device)\n users(request(build_path('account/update_delivery_device.xml', {'device' => device}), :auth => true, :method => :post)).first\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.536426", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ff24b34e81355605c98339af0b0ab3a", "score": "0.53634506", "text": "def update\n respond_to do |format|\n if @device.update(device_params)\n format.html { redirect_to @device, notice: 'Device was successfully updated.' }\n format.json { render :show, status: :ok, location: @device }\n else\n format.html { render :edit }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" }, { "docid": "86695675507f615d43f64960b193a328", "score": "0.53628784", "text": "def set_device\n @device = Device.find(params[:id])\n end", "title": "" } ]
586cc16a9bcd63b364a5291fea7e00c5
TODO default config_param :server_type, :string, :default => 'nonblocking'
[ { "docid": "5b81117e9cfd484617627f0ca81388c4", "score": "0.0", "text": "def initialize\n require 'zmq'\n super\n end", "title": "" } ]
[ { "docid": "c6ce6fcc04c155a6adab42980f373a1a", "score": "0.63660514", "text": "def configure_server(options = T.unsafe(nil)); end", "title": "" }, { "docid": "7b659c38b64fedec047e9c8f812835d5", "score": "0.6276633", "text": "def server_flags; end", "title": "" }, { "docid": "6339703d908b51a2e6363233e9e82fe6", "score": "0.6272689", "text": "def server(&blk); end", "title": "" }, { "docid": "6339703d908b51a2e6363233e9e82fe6", "score": "0.6272689", "text": "def server(&blk); end", "title": "" }, { "docid": "518f0a468c2354cdc1d14c93131abcae", "score": "0.61045396", "text": "def server_type\n super\n end", "title": "" }, { "docid": "141f8ce3eeadd43ae016f179e60915bb", "score": "0.6073482", "text": "def isnonblocking\n\t\tfalse\n\tend", "title": "" }, { "docid": "60014a8282b7fecca83156a3d2ff90b3", "score": "0.5992985", "text": "def configure_cc_server(options)\n search_string = \"live\"\n configure_linux_server(options,search_string)\n return\nend", "title": "" }, { "docid": "d7898547f312cc17b3bda0f546c77137", "score": "0.5918269", "text": "def connection_status_server; end", "title": "" }, { "docid": "5a6a4eb2ba4036fb88080fe170d92f9a", "score": "0.58854073", "text": "def server_mechanisms\n mechanisms :server\n end", "title": "" }, { "docid": "8482582270ad21ced151a3fce712cbf3", "score": "0.58307004", "text": "def connection_status_client_setting; end", "title": "" }, { "docid": "8d0ac3a1d3c579b4ea34d4aee87df28c", "score": "0.57048225", "text": "def clientserver\n end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", "score": "0.56517345", "text": "def server; end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", "score": "0.56517345", "text": "def server; end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", "score": "0.56517345", "text": "def server; end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", "score": "0.56517345", "text": "def server; end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", "score": "0.56517345", "text": "def server; end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", "score": "0.56517345", "text": "def server; end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", "score": "0.56517345", "text": "def server; end", "title": "" }, { "docid": "f14db66a546f7bd1b89ef1ed7fd10bec", "score": "0.56517345", "text": "def server; end", "title": "" }, { "docid": "8aa5a517fb1101e2dd7158c6a543800f", "score": "0.5649896", "text": "def server\n ::PuppetLibrary::Server.configure do\n sources.each do |src|\n type = src.delete(:type)\n forge type do\n src.each {|k, v| self.send(k, v) }\n end\n end\n end \n end", "title": "" }, { "docid": "d5f549373d13570034539b0841188a39", "score": "0.5639243", "text": "def default_socket_class; end", "title": "" }, { "docid": "184f57d7a344c6aea6b1dee4420fe93f", "score": "0.56338906", "text": "def server_side_config_options\n [:klass, :client_config]\n end", "title": "" }, { "docid": "2d72daae369add0bdc65a2bb1f9a3021", "score": "0.5567647", "text": "def parse_servers(config, type)\n case type\n when 'radius' then parse_radius_server(config)\n when 'tacacs+' then parse_tacacs_server(config)\n end\n end", "title": "" }, { "docid": "4fc394cd21c103ff5aaf8393ab0d6fa7", "score": "0.55598366", "text": "def setnonblocking(enabled)\n\t\tsingleton_class.async_send_api = !enabled\n\t\tself.flush_data = !enabled\n\t\tsync_setnonblocking(true)\n\tend", "title": "" }, { "docid": "cb30f8d223657f7c9e209b20f2ed0f3b", "score": "0.554693", "text": "def setup_non_blocking_methods\n read_mod = @socket.respond_to?(:read_nonblock) ? NonblockingRead :\n BlockingRead\n write_mod = @socket.respond_to?(:write_nonblock) ? NonblockingWrite :\n BlockingWrite\n self.extend read_mod\n self.extend write_mod\n end", "title": "" }, { "docid": "0ae3680cd5ed8ef891e864b4eb8c7f8c", "score": "0.55356014", "text": "def blocking?\n false\n end", "title": "" }, { "docid": "4f015e5780280d8071270b313d536108", "score": "0.55212885", "text": "def config\n current_server.config\n rescue\n DRbServer.make_config\n end", "title": "" }, { "docid": "49c64e6cd11b0d628c4199cd2b942f8f", "score": "0.5514299", "text": "def configure_client(options = T.unsafe(nil)); end", "title": "" }, { "docid": "7098ec6d7c0116a3ee5512a6a8053d7b", "score": "0.5495007", "text": "def server?\n return @mode == :server\n end", "title": "" }, { "docid": "a7e1f0a214bc11d27c89e26b8e6c1527", "score": "0.5474317", "text": "def default_server\n server?(:default)\n end", "title": "" }, { "docid": "b687f0475fa0f9674c77b6e577297146", "score": "0.54367685", "text": "def recv_nonblock(*rest) end", "title": "" }, { "docid": "7c7f58e01f6b5ba6cf24d9cb04f221d2", "score": "0.5422184", "text": "def protocol; config[:protocol]; end", "title": "" }, { "docid": "29773c7a4985144a147355902c23ae0f", "score": "0.5416949", "text": "def server\n @_server ||= case options.fetch(:type, :tcp)\n when :tcp\n TCPServer.new options.fetch(:host, \"127.0.0.1\"),\n options.fetch(:port, 2010)\n when :unix\n UNIXServer.new options.fetch(:path)\n when :pipe\n FakeServer.new options.fetch(:pipe)\n end\n end", "title": "" }, { "docid": "d16aab7b0b4831ba36ea53bc122a8e3e", "score": "0.5411851", "text": "def configure_server(options={})\n socket.server.set(options)\n end", "title": "" }, { "docid": "9b65dd429b96b70f8b7792f9c8e464e3", "score": "0.54060847", "text": "def server?\r\n @connect_type == :server\r\n end", "title": "" }, { "docid": "f3237a3c4b16592b2d45ca1befe23600", "score": "0.54054505", "text": "def default_server(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"default-server \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "title": "" }, { "docid": "c4f38dc9b152aebdd60e86e1cfdc144d", "score": "0.5371582", "text": "def default_socket_class=(_arg0); end", "title": "" }, { "docid": "f3574f97b92b1d44af70e89a52d8722d", "score": "0.53623813", "text": "def run_server_thread; end", "title": "" }, { "docid": "cd47b0203ebee8615854d497a55e5cd6", "score": "0.535765", "text": "def create_server\n\n end", "title": "" }, { "docid": "4671f9dc8978762c99074b273aff60a9", "score": "0.53517133", "text": "def image_server\r\n server = config[:image_server]\r\n if server.is_a? String\r\n server = { server: server }\r\n server[:protocol] = \"simplestreams\" if server[:server].split(\":\", 3)[2].nil?\r\n end\r\n server\r\n end", "title": "" }, { "docid": "cffee2c12d0c8dbf6beb3d7c02ee7dd6", "score": "0.53515404", "text": "def set_server_type(server_type)\n if (server_type.casecmp('filer') == 0)\n @url = FILER_URL\n @dtd = FILER_dtd\n elsif (server_type.casecmp('netcache') == 0)\n @url = NETCACHE_URL\n @port = 80\n elsif (server_type.casecmp('agent') == 0)\n @url = AGENT_URL\n @port = 4092\n @dtd = AGENT_dtd\n elsif (server_type.casecmp('dfm') == 0)\n @url = DFM_URL\n @port = 8088\n @dtd = DFM_dtd\n if(@transport_type == \"HTTPS\")\n @port = 8488\n end\n elsif (server_type.casecmp('ocum') == 0)\n @url = DFM_URL\n @port = 443\n @transport_type = \"HTTPS\"\n @dtd = DFM_dtd\n else\n fail_response(13001, \"NaServer::set_server_type: bad type \\\"\" + server_type + \"\\\"\")\n end\n @server_type = server_type\n end", "title": "" }, { "docid": "2b0b8aa059a8e500fb264bff5d2b9390", "score": "0.5351297", "text": "def setup_server(s)\n # noop\n end", "title": "" }, { "docid": "131bfe78fbc130562a9c88b636c02835", "score": "0.5342883", "text": "def set_server_type(opts)\n opts = check_params(opts,[:types])\n super(opts)\n end", "title": "" }, { "docid": "1598d0e14e89e433ad7e26965db96e6d", "score": "0.5334698", "text": "def server_configuration\n @server_configuration ||= Uninterruptible::Configuration.new\n end", "title": "" }, { "docid": "1598d0e14e89e433ad7e26965db96e6d", "score": "0.5334698", "text": "def server_configuration\n @server_configuration ||= Uninterruptible::Configuration.new\n end", "title": "" }, { "docid": "3f7daa4db6f09615936ee3f3fd61c16f", "score": "0.53336746", "text": "def _server_control(command, body = nil)\n @connection.comm.server_message(\"#{command} #{body}\")\nend", "title": "" }, { "docid": "d05af4e08e7d437daa783ad03a65ed10", "score": "0.5321521", "text": "def server\n\t\treturn @server ||= self.create_server\n\tend", "title": "" }, { "docid": "a3c6a1a3c7a2ec68f2adf6c09753e854", "score": "0.5310627", "text": "def server\r\n\t\t@usr_server\r\n\tend", "title": "" }, { "docid": "40e79931064a5e9fa5d67324e9c63893", "score": "0.5309968", "text": "def connection_type; end", "title": "" }, { "docid": "9d52205c23d2ea9af4099e7734d36f2d", "score": "0.53038186", "text": "def initialize(config: nil, block: true)\n # create a channel and exchange that both client and server know about\n config ||= CarrotRpc.configuration\n @thread_request_variable = config.thread_request_variable\n @channel = config.bunny.create_channel\n @logger = config.logger\n @block = block\n setup_queue(config)\n @exchange = @channel.default_exchange\n end", "title": "" }, { "docid": "89f0824ec5862ce09cfb51b602b124c6", "score": "0.5293403", "text": "def wait_connection=(_arg0); end", "title": "" }, { "docid": "216f5fa6f4eb407000b2b284c667fbc3", "score": "0.5280378", "text": "def prepare(server); end", "title": "" }, { "docid": "4ba9fbd8ea9fd3dd93ed6838bffacd4a", "score": "0.527739", "text": "def check(type)\n if config[type]\n send(type, \"Unix socket backlog value (#{@data}) [#{config[:socket]}]\") if (below?(type) || above?(type))\n end\n end", "title": "" }, { "docid": "3da11d1be4a91bf53c5a97f1176ed01a", "score": "0.52758425", "text": "def default_protocol(type)\n case type\n when 'stream'\n 'tcp'\n when 'dgram'\n 'udp'\n else\n 'unknown'\n end\n end", "title": "" }, { "docid": "ef8cd8a0244d9d8f34d3524495d6de8c", "score": "0.5266331", "text": "def nodelay; end", "title": "" }, { "docid": "f1f41f3e8a42865b530514da7e800221", "score": "0.52598494", "text": "def server_port; end", "title": "" }, { "docid": "0a33894d97ae54ecc5b3018355f379fb", "score": "0.5250382", "text": "def option_tcp_smart_accept\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"option tcp-smart-accept \" + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "title": "" }, { "docid": "03ad06a7d6020c428b16e3d700da263b", "score": "0.5248019", "text": "def blocking(params = {})\n get \"blocks/blocking\", params\n end", "title": "" }, { "docid": "9fd6514436987d6926c76eeb6394f305", "score": "0.52459955", "text": "def recvfrom_nonblock(*rest) end", "title": "" }, { "docid": "9fd6514436987d6926c76eeb6394f305", "score": "0.52459955", "text": "def recvfrom_nonblock(*rest) end", "title": "" }, { "docid": "d1a9e727313fa4b41a7472cafb2e2075", "score": "0.52458864", "text": "def network(type, options=nil); end", "title": "" }, { "docid": "d1a9e727313fa4b41a7472cafb2e2075", "score": "0.52458864", "text": "def network(type, options=nil); end", "title": "" }, { "docid": "c33064055a310b512e8649e886630392", "score": "0.5244337", "text": "def server_settings\n [\n {\n url: \"https://pinning-service.example.com\",\n description: \"No description provided\",\n }\n ]\n end", "title": "" }, { "docid": "c33064055a310b512e8649e886630392", "score": "0.5244337", "text": "def server_settings\n [\n {\n url: \"https://pinning-service.example.com\",\n description: \"No description provided\",\n }\n ]\n end", "title": "" }, { "docid": "d38575a105f59dbc5043d9e4836cd144", "score": "0.52398425", "text": "def configure(&block); end", "title": "" }, { "docid": "d38575a105f59dbc5043d9e4836cd144", "score": "0.52398425", "text": "def configure(&block); end", "title": "" }, { "docid": "af975de8b7e41d93949081906dd31396", "score": "0.52355623", "text": "def auto_blocked_status\n 'auto_blocked'\n end", "title": "" }, { "docid": "5be5e4024197424ed28358a4ef2e31da", "score": "0.5233863", "text": "def server(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"server \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "title": "" }, { "docid": "39911604fcc8208fe2eed0db1f9eb92b", "score": "0.52331656", "text": "def optional_port; end", "title": "" }, { "docid": "6c5ea67d749a50154c854773b64f9f87", "score": "0.5231846", "text": "def server_endpoint\n endpoint = +\"#{@base_url}/message-bus/#{@client_id}/poll\"\n endpoint << '?dlp=t' unless self.class.long_polling\n\n endpoint.freeze\n end", "title": "" }, { "docid": "4247a795fcca4b3632d4b4652ec248a5", "score": "0.52269226", "text": "def non_blocking=(p1)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "6bd3a6f75b3bf8eee641237feb20d1a7", "score": "0.52214396", "text": "def prepare_simple_client(client, channel, type); end", "title": "" }, { "docid": "b406e83a5a02200b7115a575f181aef1", "score": "0.5206646", "text": "def initialize_server(port)\r\n set :port, port # Specify Port For Sinatra Server\r\n set :bind, \"0.0.0.0\" # Allow Ping From External Devices\r\n set :environment, :production # Allow External Nodes To Query Websocket\r\n set :run, true # Start Sinatra Server\r\nend", "title": "" }, { "docid": "27e30365c15beb66b3de86a730d12618", "score": "0.5197971", "text": "def get_server(target_type)\n return api_call('get-queue',{'apiKey' => @@_api_key,'targetType' => target_type});\n end", "title": "" }, { "docid": "89f8ed1c28b53b4f240b621b72fb8ecd", "score": "0.51972336", "text": "def rpc_to_specified_server msg, server_type, route_param, &block\n unless route_param.instance_of? String\n return\n end\n\n if route_param == '*'\n @station.servers.each { |server_id, server|\n if server[:server_type] == server_type\n rpc_invoke server_id, msg, &block\n end\n }\n else\n rpc_invoke route_param, msg, &block\n end\n end", "title": "" }, { "docid": "1a4742dae10892e4063acd07f5177ed2", "score": "0.51876134", "text": "def override_client_config_timeouts config\n config.timeout = timeout\n rpc_names = config.rpcs.methods - Object.methods\n rpc_names.each do |rpc_name|\n rpc = config.rpcs.send rpc_name\n rpc.timeout = timeout if rpc.respond_to? :timeout=\n end\n end", "title": "" }, { "docid": "fbefc4265454191e639c2e7bdf525a71", "score": "0.51842624", "text": "def server_config\n \tRails.cache.fetch(\"tmdb/server_config\", expires_in: 24.hours) do\n \t\tget_serv_config\n\t\tend\n\tend", "title": "" }, { "docid": "ced20962adecc11cee66a757d08af9f0", "score": "0.5177942", "text": "def allowed_types\n [NetBlock]\nend", "title": "" }, { "docid": "916917350ded0306db0adf82356bce5f", "score": "0.5174379", "text": "def start_server(klass, config={}, &block)\n server = klass.new({\n ServerType: Thread,\n BindAddress: \"127.0.0.1\",\n Port: 0,\n Logger: WEBrick::Log.new([], WEBrick::BasicLog::WARN),\n AccessLog: [],\n }.merge(config))\n\n server_thread = server.start\n\n addr = server.listeners[0].addr\n\n client_thread = Thread.new {\n begin\n block.yield([server, addr[3], addr[1]])\n ensure\n server.shutdown\n end\n }\n\n assert_join_threads([client_thread, server_thread])\nend", "title": "" }, { "docid": "05ddf1a4a5a3601a5de717f1b27a217b", "score": "0.51690084", "text": "def connection_status_mcnet_request; end", "title": "" }, { "docid": "460e07950f551b54179ddfaa1e8e489f", "score": "0.5167736", "text": "def serverCanStopNowNonBlocking\r\n if not @blockManager.done? # ltodo wherever says this change to assert\r\n error \"ended server serving without being done?\" # ndo fix tests to not violate this\r\n end\r\n debug \"stopping server -- should close all clients on next_tick -- client queue length #{@aliveServerObjects.length}\" \r\n if @server_signature \r\n EM::stop_server @server_signature # ltodo ask if this umm...disallows ALL none queued, nothing.\r\n @server_signature = nil\r\n else\r\n error \"no server signatures for stop? ok if testing means that you wanted the server to 'stop early' for whatever reason...\"\r\n end\r\n @serverShouldStop = true\r\n debug \"killing length #{@aliveServerObjects.length}\"\r\n @aliveServerObjects.each do |death, status| # ltodo look into whether one can sneak in (use @serverShouldStop)\r\n debug \"death to existing conn #{death}, status #{status}\"\r\n death.close_connection\r\n end\r\n end", "title": "" }, { "docid": "365029736dda3d3b75bfbe1dcfabe273", "score": "0.5166889", "text": "def keep_alive=(enable); end", "title": "" }, { "docid": "783c95ec5725071325fd72c00906b5d0", "score": "0.51647586", "text": "def servers # Only in Ruby API (1.3 compatible)\n\t\[email protected]\n\tend", "title": "" }, { "docid": "cdde6f422199db67a93ff64a5c9f8b31", "score": "0.51623994", "text": "def request_listen\n send_command RemoteListenCommand.new(@client.remote_listen_address)\n enable_tunnel_timeouts \n end", "title": "" }, { "docid": "29a127d0f697058e4baf2bbe1dd66c33", "score": "0.5159794", "text": "def alternative_config!\n JabberAdmin.configure do |conf|\n conf.username = '[email protected]'\n conf.password = 'defaultpw'\n conf.url = 'http://jabber.local/api'\n end\nend", "title": "" }, { "docid": "9b7f176ddf84aa5cfaa33949aafe9245", "score": "0.5155019", "text": "def remote_server_type\n @attributes[:remote_server_type]\n end", "title": "" }, { "docid": "51a79b6e4544f99b3a3bf05313175e9f", "score": "0.515458", "text": "def server_software; end", "title": "" }, { "docid": "5c9d973c4f74a309b1f68d827af3c77a", "score": "0.51496536", "text": "def set_server_statement\n super\n end", "title": "" }, { "docid": "dbf10a9f15058f522d72c4b0cca3da6d", "score": "0.51482326", "text": "def security_server_client\n end", "title": "" }, { "docid": "58e08852bc0f9f41a3820351df579a1e", "score": "0.5137999", "text": "def non_blocking?()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "05a5c6acdcd1e7a66d1bbbd963198254", "score": "0.5134163", "text": "def blocklisted_responder=(_arg0); end", "title": "" }, { "docid": "4cbb82738e17c78396ef39a46e089edb", "score": "0.5133942", "text": "def prepare_tcp_server(host: T.unsafe(nil), port: T.unsafe(nil), adapter: T.unsafe(nil)); end", "title": "" }, { "docid": "069cbbb968274c32f6dc1b80194677b1", "score": "0.5132639", "text": "def inherit_socket; end", "title": "" }, { "docid": "9304d9597c0cde9800348199dc2c870c", "score": "0.5120928", "text": "def initialize( opts={} )\n @opts = { 'ServerHost' => '0.0.0.0', 'ServerPort' => 1080 }\n @opts = @opts.merge( opts )\n @server = nil\n @clients = ::Array.new\n @running = false\n @server_thread = nil\n end", "title": "" }, { "docid": "2a9a6f1cffa47f18b8b8ad7d8cf5a792", "score": "0.5119596", "text": "def validate\n case lock_config.type\n when :while_executing\n validate_server\n when :until_executing\n validate_client\n else\n validate_client\n validate_server\n end\n\n lock_config\n end", "title": "" }, { "docid": "2a9a6f1cffa47f18b8b8ad7d8cf5a792", "score": "0.5119596", "text": "def validate\n case lock_config.type\n when :while_executing\n validate_server\n when :until_executing\n validate_client\n else\n validate_client\n validate_server\n end\n\n lock_config\n end", "title": "" }, { "docid": "999f7a0c09edfef11403559084439f7f", "score": "0.51095974", "text": "def get_config_for (type)\n\t\tcurrent_config = server_config\n\t\tconfig = server_config[\"images\"][type]\n\tend", "title": "" }, { "docid": "68d5b71129f5a212b2d99130824a75a1", "score": "0.51082236", "text": "def setsockopt(*) end", "title": "" }, { "docid": "615b8713a4b2a30753cf7c997b5e20c2", "score": "0.5107731", "text": "def initialize(nickname, server, options={})\n @server = server\n @nickname = nickname\n @options = options\n @port = options[:port]\n @port = 9999 if @port == nil and options[:ssl] != nil\n @port = 6667 if @port == nil\n @handlers = {}\n @raw_handler = nil\n @quit = nil\n @channels = @options[:channels]\n @channels = [] if @channels == nil\n @channels.push(@options[:channel]) unless @options[:channel] == nil\n @password = options[:password]\n end", "title": "" }, { "docid": "65674d163ec56cd9efabba96eb3dd802", "score": "0.51066977", "text": "def server_params\n params.permit(:uuid, :addr, :port, :status)\n end", "title": "" }, { "docid": "ae49cef0d4d147d514ab35244a08a986", "score": "0.51046324", "text": "def on_rpl_isupport(m)\n @server_config.set(m)\n end", "title": "" } ]
77696eb5074c6574d343101c4228f37a
find c's index in the Charset string, decrement the index by offset, and ensure it wraps around properly c is the current character from the encrypted message. offset is distance to travel backwards (perhaps wrapping around) in the given character set to decode the character
[ { "docid": "0cf63237fec424b616475de38efe4a45", "score": "0.6714542", "text": "def charmap( c, offset )\n start_index = Charset.index(c)\n finish_index = start_index - offset\n if finish_index < 0\n finish_index = Charset.length + finish_index\n end\n return Charset[finish_index]\nend", "title": "" } ]
[ { "docid": "30c077579d8ed1dc9464355b5821dc92", "score": "0.7174027", "text": "def ceasar_cipher_decrypt(text, offset)\n\n # Note this is my implementation and may differ from\n # others regarding the upper and lower bounds\n # of printable characters. If any ceasar cipher is used\n # in the solution, it would be this one.\n buffer = \"\"\n text.chars.each do |c|\n ordinal = c.ord\n new_ordinal = ordinal + offset\n # Keep the characters within a somewhat normal\n # printable range\n if new_ordinal < 32\n new_ordinal = 127 - (32 - new_ordinal)\n elsif new_ordinal > 126\n new_ordinal = 31 + (new_ordinal - 126)\n end\n new_char = new_ordinal.chr\n buffer = buffer + new_char\n end\n buffer\nend", "title": "" }, { "docid": "df879a2afcfd32c0a9ade279e880aea8", "score": "0.67472243", "text": "def cipher(_string, _offset)\n\n final = \"\"\n\n _string.each_char do |char|\n if char.ord > 96 && char.ord < 123\n final += shift_lowercase(char.ord, _offset).chr\n elsif char.ord > 64 && char.ord < 91\n final += shift_uppercase(char.ord, _offset).chr\n else\n final += char\n end\n end\n final # RETURN VALUE\nend", "title": "" }, { "docid": "e8268b3b3e2bf92481d19189bc499abf", "score": "0.6723943", "text": "def caesar_cipher(offset, string)\n (0...string.length).each do |i|\n val = string[i].ord\n if val >= 97 && val <= 122\n coded_val = ((val + offset - 97) % 26) + 97\n string[i] = coded_val.chr\n elsif val >= 65 && val <= 90 # Improvement to include capital letters\n coded_val = ((val + offset - 65) % 26) + 65\n string[i] = coded_val.chr\n end\n end\n\n return string\nend", "title": "" }, { "docid": "f6b13d24aab7f0b46e062a72a8701af0", "score": "0.670154", "text": "def caesar_cipher(offset, string)\n #string.each_char do |char| \n idx = 0\n new_string = ''\n code = 0\n \n \n while idx < string.length \n code = string[idx].ord\n \n if code == 32\n new_char = code.chr\n \n \n end\n unless code == 32\n new_code = code + offset\n if new_code > 122 \n result = new_code - 122\n new_char = (97 + result-1).chr\n \n \n else\n new_char = new_code.chr\n end\n end\n \n puts new_string += new_char\n idx = idx + 1\n \n end\n \n new_string\n\n \nend", "title": "" }, { "docid": "0129c3fde39dc2e4c31cace603696767", "score": "0.6586905", "text": "def caesar_cipher(string, offset = 0)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n encrypted_string = \"\"\n string.each_char do |char|\n if char.match(/[a-zA-Z]/)\n index = alphabet.index(char.downcase)\n index += offset % 26\n index -= 26 if index > 25\n shifted_char = alphabet[index]\n shifted_char.upcase! if char.match(/[A-Z]/)\n encrypted_string << shifted_char\n else\n encrypted_string << char \n end\n end\n return encrypted_string\nend", "title": "" }, { "docid": "e2566a2d5e59b930de3c7502cd61ec7c", "score": "0.6578539", "text": "def caesar_cipher(offset,string)\r\n idx_str = 0\r\n while idx_str < string.length\r\n if string[idx_str] != \" \"\r\n ascii_letter = string[idx_str].ord\r\n ascii_value = ascii_letter + offset\r\n if ascii_value > 122\r\n ascii_value -= 26 #number of letters in alphabet\r\n end\r\n string[idx_str] = (ascii_value).chr\r\n end\r\n idx_str += 1\r\n end\r\n return string\r\nend", "title": "" }, { "docid": "852277873cb2fb7079077447f4177378", "score": "0.6566341", "text": "def caesar_decode(string, offset) #makes method 'caeser_cipher' and two place holders\n string.split(\"\").map do |character| # takes first place holder string and slpits it up into indivdual letters. Also makes another place hodler called character.\n if $alp_up.include? (character) \n final_character = $alp_up [($alp_up.index(character)+offset) %26 ] #final variable that will become new shifted letterr. Takes upper case string and finds the number of letters and repeats shift for each one based on the number of the offset givin by user. \n elsif $alp_down.include? (character)\n final_character = $alp_down [($alp_down.index(character)+offset) %26 ]#final variable that will become new shifted letterr. Takes lower case string and finds the number of letters and repeats shift for each one based on the number of the offset given by user. \n else\n character\n end\n end.join(\"\") #puts all of the newly shifted strings back together\n \nend", "title": "" }, { "docid": "86bc7f0a3a815b0c202bbd3895a9d226", "score": "0.6540333", "text": "def caesar_cipher(offset, string)\n string = string.split('')\n offset.times do\n string = string.map do |letter|\n if letter == \" \"\n letter\n elsif letter.ord > 122 - offset\n new_ord = 97 - offset + ((letter.ord + offset) % 122)\n new_ord.chr\n else\n letter.next\n end\n end\n end\n string.join('')\nend", "title": "" }, { "docid": "ec09982d773edea9124386bfd706be2f", "score": "0.6529233", "text": "def caesar_cipher(offset, string)\n result = \"\"\n i=0\n\n while i<string.length\n asc_code = string[i].ord\n if (asc_code<97 || 122<asc_code)\n result += asc_code.chr\n else\n asc_code -= \"a\".ord #remove value of a in ascii\n asc_code += offset #add offset value\n char = (asc_code%26 + \"a\".ord).chr\n result += char\n end\n i+=1\n end\n puts result\n return result\nend", "title": "" }, { "docid": "bca82b2559d154fde340b82abc5c574b", "score": "0.65101814", "text": "def caesar_decode(string,offset)\n # code\n # alp_array = [*('a'..'z')]\n # string.split(\"\").collect do |character|\n # if character ==character.upcase && alp_array.include?(character.downcase)\n # diff= ((alp_array.index(character.downcase))-offset)%26\n # character = alp_array[diff].upcase\n # elsif character ==character.downcase && alp_array.include?(character.downcase)\n # diff= ((alp_array.index(character.downcase))-offset)%26\n # character = alp_array[diff].downcase\n # else\n # character\n # end\n # end.join(\"\")\n caesar_encode(string,offset*-1) \nend", "title": "" }, { "docid": "0f617750ed70e566938e6eef857d6074", "score": "0.64888114", "text": "def caesar_cipher(offset, string)\n chars = string.split('')\n chars.map! {|char|\n if char.ord == 32\n char\n else\n raw = char.ord + offset\n rem = (raw - 96) % 26\n char = (rem + 96).chr\n end\n }\n chars = chars.join('')\n return chars\nend", "title": "" }, { "docid": "b4c17166798db68a90c7a8e6afc2f445", "score": "0.64785427", "text": "def caesar_cipher(offset, string)\n alphabet = ('a'..'z').to_a\n offset_alphabet = alphabet[offset..-1] + alphabet[0...offset]\n\n output = ''\n string.chars.each do |char|\n if alphabet.include?(char)\n output << offset_alphabet[alphabet.index(char)]\n else\n output << char\n end\n end\n\n output\nend", "title": "" }, { "docid": "cc1b3a13a5badf9b7b90d86154d306d4", "score": "0.64439446", "text": "def caesar_decode(string, offset)\n string.split(\"\").map do |character|\n if $array_abc_down.include?(character)\n new_character = $array_abc_down[($array_abc_down.index(character)-offset)%26]\n elsif $array_abc_upper.include?(character)\n new_character = $array_abc_upper[($array_abc_upper.index(character)-offset)%26]\n else\n character \n end\n end.join(\"\") \nend", "title": "" }, { "docid": "1a06ee8e1de038a6f2da666bc1da2592", "score": "0.643654", "text": "def translate_offset(str, byte_offset)\n return 0 if str == ''\n return nil if byte_offset.nil?\n chunk = str[0..byte_offset]\n begin\n begin\n chunk.unpack('U*').length - 1\n rescue ArgumentError => e\n chunk = str[0..(byte_offset+=1)]\n # Stop retrying at the end of the string\n raise e unless byte_offset < chunk.length \n # We damaged a character, retry\n retry\n end\n # Catch the ArgumentError so we can throw our own\n rescue ArgumentError \n raise EncodingError.new('malformed UTF-8 character')\n end\n end", "title": "" }, { "docid": "b1714581b78aee7557a2f557fed70bfb", "score": "0.6428623", "text": "def caesar_decipher(string, deshift)\n\n character_ranges = {:uppercase => (65..90), :lowercase => (97..122)}\n deshifted_string_array = [];\n\n # Loop through each character\n string.each_char{|char|\n # Only deshift alphabetic characters\n if (char.match /[a-zA-Z]/)\n # define our deshifted character's unicode result\n deshifted_char_code = char.ord - deshift\n \n # is the deshifted character beyond the boundaries?\n is_deshifted_character_in_range = (character_ranges[:uppercase] === deshifted_char_code || character_ranges[:lowercase] === deshifted_char_code );\n \n if (!is_deshifted_character_in_range)\n # wrap the character\n deshifted_char_code += 26;\n end\n else\n # Our character isn't alphabetic, don't deshift it\n deshifted_char_code = char.ord;\n end\n\n deshifted_string_array.append(deshifted_char_code.chr)\n }\n return deshifted_string_array.join;\nend", "title": "" }, { "docid": "ec99868da84e5b306e2f19a8b03d0bee", "score": "0.6421754", "text": "def GetCharDecrypted(cy,k)\n #Posicion actual y cambio que aplica k\n position = @alphabet.index cy\n change = @alphabet.reverse.index k\n \n #Atrapa error\n if position == nil or change==nil\n puts \"Position #{position}\"\n puts \"#{k} Change #{change}\"\n end\n newPosition = position-change\n #Si llegamos al inicio de @alphabet, continua desde el final\n if (newPosition<0)\n newPosition = @top+newPosition\n end\n return @alphabet[newPosition]\n end", "title": "" }, { "docid": "201d0cfb0a661f0a1d865f0fc35eadc7", "score": "0.64154935", "text": "def caesar_cipher(string, offset)\n alphabet = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\",\n \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"] # Alphabet length = 26\n string = string.downcase\n cipher = ''\n i = 0\n while i < string.length\n idx = alphabet.index(string[i])\n if idx == nil\n cipher += string[i]\n elsif idx + offset > 25\n cipher += alphabet[(idx + offset) % 26]\n else\n cipher += alphabet[idx + offset]\n end\n i += 1\n end\n cipher\nend", "title": "" }, { "docid": "ee745cf41a1ff08a62e86f93b61e991f", "score": "0.63999116", "text": "def caesar_cipher(offset, string)\n\n\tstr = string.split(\"\")\n\ti = 0\n\n\twhile i < str.length\n\t\tstr[i] = (str[i].ord + offset)\n\t\t\n\t\tif str[i] < 122\n\t\t str[i] = str[i].chr\n\t\telsif\n\t\t\tstr[i] = str[i] - 26\n\t\t\tstr[i] = str[i].chr\n\t end\n\t \n\t if str[i] == \"#\"\n\t\t\tstr[i] = \" \"\n\t end\n\t i += 1\n\tend\n\nreturn str.join\n\t\nend", "title": "" }, { "docid": "eed53f2e657efb3de6478beb4eba7b47", "score": "0.6394481", "text": "def caesar_decode(string, offset)\n # code\n capital_alphabet = [*(\"A\"..\"Z\")]\n lowercase_alphabet = [*(\"a\"..\"z\")]\n string.split(\"\").collect do |character|\n if lowercase_alphabet.include?(character)\n lowercase_alphabet[(lowercase_alphabet.index(character) - offset) % 26]\n elsif capital_alphabet.include?(character)\n capital_alphabet[(capital_alphabet.index(character) - offset) % 26]\n else\n character\n end\n end.join(\"\")\nend", "title": "" }, { "docid": "05f30cfe0ce042c29f175afe8ead5456", "score": "0.6380718", "text": "def caesar_cipher(offset, string)\n #split the string into characters in an array (word_arr), sets up another\n #array (ord_word_arr) and variable idx1 (used for a counter)\n string = string.downcase\n if offset > 26\n while offset > 26\n offset = offset - 26\n end\n end\n word_arr = string.split(//)\n ord_word_arr = []\n idx1 = 0\n \n #This loop converts the characters in word_arr to ASCII numbers, moves them\n #into the ord_word_arr array, and increments them by the offset\n while idx1 < word_arr.length\n ord_letter = word_arr[idx1].ord\n if ord_letter >= 97 && (ord_letter + offset) <= 122 #standard offset\n ord_letter = ord_letter + offset\n elsif ord_letter >= 97 && (ord_letter + offset) > 122 #offset that wraps\n new_set = offset - (122 - ord_letter)\n ord_letter = 96 + new_set\n else #prevents spaces from being offset\n ord_letter = ord_letter\n end\n ord_word_arr.push(ord_letter) #pushes the offset ASCII to array\n idx1 = idx1 + 1\n end\n \n #resets the counter variable and clears the word_arr array\n idx1 = 0\n word_arr = []\n \n # converts ASCII numbers back to characters and moves them to word_arr array\n while idx1 < ord_word_arr.length\n chr_letter = ord_word_arr[idx1].chr\n word_arr.push(chr_letter)\n idx1 = idx1 + 1\n end\n \n #joins the characters in word_arr into a single string (new_str)\n new_str = word_arr.join\n \n #return new_str with the offset letters\n return new_str\nend", "title": "" }, { "docid": "cdb4dee24c33a8cf9e68a882541ba459", "score": "0.6375454", "text": "def caesar_cipher(str, offset)\n\n alphabet = (\"a\"..\"z\").to_a\n\n new_str = \"\"\n str.each_char do |char|\n char_index = alphabet.index(char)\n if (char_index + offset) >= 26\n new_str << alphabet[char_index + offset - 26]\n else\n new_str << alphabet[char_index + offset]\n end\n end\n new_str\nend", "title": "" }, { "docid": "6fe270b8a92a6079cb3b09a722522ca0", "score": "0.63427913", "text": "def decrypted_character(shift, message_array, i)\n alphabet_index = @alphabet.index(message_array[i])\n if(alphabet_index == nil)\n message_array[i]\n else\n new_index = (-shift + alphabet_index)%27\n @alphabet[new_index]\n end\n end", "title": "" }, { "docid": "1601188605a9b8de9e1288fa7779a0f4", "score": "0.63369536", "text": "def caesar_cipher(offset, string)\n split_sentence = string.split\n idx1 = 0\n new_sentence = []\n while idx1 < split_sentence.length\n current_word = split_sentence[idx1]\n idx2 = 0\n new_word = \"\"\n while idx2 < current_word.length\n current_letter = current_word[idx2].ord + offset\n if current_letter > 122\n current_letter = 96 + current_letter - 122\n end\n new_word = new_word + current_letter.chr\n idx2 += 1\n end\n new_sentence << new_word\n idx1 += 1\n end\n return new_sentence.join(\" \")\nend", "title": "" }, { "docid": "d3d1941a8f50f1859a70b8413f50a5cf", "score": "0.6314119", "text": "def caesar_decode(string,offset)\n caesar_encode(string,offset*-1)\nend", "title": "" }, { "docid": "61e20e1947c0107e91ee593e50b34432", "score": "0.62531805", "text": "def caesar_cipher (input_string, delta)\n input_string.each_byte do |ch|\n if ch >64 && ch <91 \n ch=(ch-64+delta)%26+64\n elsif ch >96 && ch <123 \n ch=(ch-96+delta)%26+96\n end\n print ch.chr\n end\nend", "title": "" }, { "docid": "e6aadf874e2aca31ee961f20e09fba1a", "score": "0.6240757", "text": "def caesar_cipher(input, offset)\n if offset < 0\n newOffset = (26 - (offset.abs() % 26)) % 26\n else\n newOffset = offset % 26\n end\n result = \"\"\n input.each_char {|char|\n num = char.ord\n if num >= 65 && num <= 90\n newNum = num + newOffset\n if newNum > 90\n newNum = newNum - 26\n end\n elsif num >= 97 && num <= 122\n newNum = num + newOffset\n if newNum > 122\n newNum = newNum - 26\n end\n else\n newNum = num\n end\n result += newNum.chr\n }\n return result\nend", "title": "" }, { "docid": "4fb705266d7a63298ff61465c2d07912", "score": "0.6236782", "text": "def caesar_cipher(offset, string)\n result = \"\"\n alph = (\"a\"..\"z\").each.to_a\n\n string.each_char do |char|\n if char == \" \"\n result += char\n else\n result += alph[(alph.index(char) + offset) % 26]\n end\n end\n result\nend", "title": "" }, { "docid": "d202f3bdc5fb87c5d02158669dc602b6", "score": "0.6233514", "text": "def caesar_decode(string,offset)\n caesar_encode(string, offset *-1)\nend", "title": "" }, { "docid": "e57893a3ef985b3eed18ae70276f77bc", "score": "0.6233287", "text": "def caesar_cipher(string, offset=0)\n\n\tresult = ''\n\n\n\tstring.each_byte do |b|\n\t\tresult << shifter(b, offset).chr\n\tend\n\nresult\n\nend", "title": "" }, { "docid": "28861b95f9f78c63dd86b8355b299a3a", "score": "0.6218397", "text": "def shift_char_in_set (char, charset)\n if !charset.index(char)\n char\n else\n i = charset.index(char) + 1\n i -= charset.length if i >= charset.length\n charset[i]\n end \nend", "title": "" }, { "docid": "c08df17899cfec929d23d333c28fae83", "score": "0.6203274", "text": "def caesar_decode(string, offset)\n caesar_encode(string, offset * -1)\nend", "title": "" }, { "docid": "e29f603cf60a2709ae972a056534d128", "score": "0.61894137", "text": "def decode_shift char\n 26 - (char.unpack('C*')[0] - 101)\nend", "title": "" }, { "docid": "c08c8a8d9a50b6f096409d789fceb7fb", "score": "0.61530834", "text": "def caesar_cipher_char(char, offset, type)\n\tif position = @alphabet.index(char)\n\t\ttype ? @alphabet[(position - offset) % 26] : @alphabet[(position + offset) % 26]\n\telsif position_upper = @alphabet_upper.index(char)\n\t\ttype ? @alphabet_upper[(position_upper - offset) % 26] : @alphabet_upper[(position_upper + offset) % 26]\n\telse\n\t\tchar\n\tend\nend", "title": "" }, { "docid": "97d166af42e2521125851be0dc4e7f7b", "score": "0.6126951", "text": "def caesar_cipher(offset, string)\n alpha = (\"a\"..\"z\").to_a + (\"a\"..\"z\").to_a #so it \"loops\" back to the beginning\n newString = \"\" #answer\n string = string.split(\" \")\n\n string.each do |i| #loop through array of string(s)\n i.chars.each do |j| #loop through each letter in the string\n newString << alpha[alpha.index(j).to_i+offset] #shift the letter by the offset\n end\n newString += \" \" #add an empty space so you it's not all one string. This is for conditions than > 1 word. \n end\n return newString.strip #remove whitespace at the end of the string\nend", "title": "" }, { "docid": "046b23f8693c966907dc4f0dd2610bc9", "score": "0.6080085", "text": "def decrypt string, unshift #unshift is positive\n if unshift > 25\n raise Exception.new('Unshift should logically be less than 26.')\n end\n if unshift < 1\n raise Exception.new('Unshift must be positive')\n end\n if !unshift.is_a?(Integer)\n raise Exception.new('Are you using a non-integer alphabet?!')\n end\n char_arr = string.split('') # char_arr = ['E' ,' ', 'w', 'i', 'r', 'x', 'i', 'r', 'g', 'i','.']\n char_arr.map do |char|\n char = char.ord # ASCII numberic\n if char - unshift >= 97 && char <= 122 || char - unshift >= 65 && char <= 90 # Char does not shift out of its alphabet\n char -= unshift\n elsif char >= 97 && char <= 122 # Lowercase\n # Shift the character the remainder over only\n under = 97 - (char - unshift)\n char = 123 - under\n elsif char >= 65 && char <= 90 # Uppercase\n # Shift the character the remainder over only\n under = 65 - (char - unshift)\n char = 91 - under\n end\n char = char.chr\n end.join(\"\")\n#rescue Exception\n #puts 'Shift should logically be less than 26.'\nend", "title": "" }, { "docid": "543b9a4104ca2b5ff1d2b448947de9e2", "score": "0.60309863", "text": "def cipher(string)\n 0.upto(string.length-1){|n|\n if string[n].match(/[a-z]/)\n string[n] = (219 - string[n].ord).chr\n end\n }\n return string \nend", "title": "" }, { "docid": "89e67dd41202ddcadc08a0be61750f05", "score": "0.603095", "text": "def caesar_shift(offset, character)\n ((((character.ord - 97) + offset) % 26) + 97).chr\nend", "title": "" }, { "docid": "2efeeb7c81a00971675b5c8586bb1f48", "score": "0.60192555", "text": "def caesar_decode(string, offset)\n # code \n# puts caesar_encode(string, offset*-1) #once offset is negative num, from adding to index --> substracting from index (making it go backwards instead) \n little_alphabet = [*('a'..'z')] \n big_alphabet = [*('A'..'Z')]\n# numbers = [*('0'..'9')] \n \n string.split(//).map do |letter| #splits every letter \n if letter == letter.downcase \n little_alphabet[(little_alphabet.index(letter) - offset)%26] #lowercase + wrapping back\n elsif letter == letter.upcase \n big_alphabet[(big_alphabet.index(letter) - offset)%26] #uppercase \n # elsif letter == numbers \n # numbers[(numbers.index(letter) + offset)%10]\n else \n put letter\n end\n end.join(\"\")\nend", "title": "" }, { "docid": "5b2d1a774b0e58188f564aa3e958f7b5", "score": "0.5975228", "text": "def decrypt(string)\r\n\r\n index = 0\r\n while index < string.length\r\n\r\n if string[index] != \" \"\r\n if string[index] == \"a\"\r\n string[index] = \"z\"\r\n else\r\n string[index] = (string[index].ord - 1).chr\r\n end\r\n end\r\n index += 1\r\n end\r\n return string\r\nend", "title": "" }, { "docid": "ea741756772b4f690f09e8c7be714abb", "score": "0.59317", "text": "def caesar_cipher(str, num)\n\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n returnStr = \"\"\n\n\n str.each_char do |let|\n found = alphabet.index(let)\n\n if (found + num) > 26\n offset = alphabet[found + num - 26]\n else\n offset = alphabet[found + num]\n end\n\n returnStr << offset\n end\n\n return returnStr\n\nend", "title": "" }, { "docid": "55801200b06e624e26a529aa449e8e54", "score": "0.5904367", "text": "def caesar_cipher(offset, string)\n words = string.split(\" \") # split string into words, - to an array\n \n # outter loop through our words array\n word_i = 0\n while word_i < words.length # to go through each word in the string\n word = words[word_i] # set current word\n \n # inner loop through our individual word from our array created\n letter_i = 0\n while letter_i < word.length # to go through each letter in each word\n # set the current letter to its ASCII character and subtract the ASCII value of \"a\"\n char_i = word[letter_i].ord - \"a\".ord # \"a\".ord == 97\n \n # determine where the offset occurs in the aplphabet\n new_char_i = (char_i + offset) % 26 # %26 to wrap the letter to the front of the alphabet (there are 26 letters in the alphabet)\n \n # set new current letter (in ASCII value) in regards to the offset value specified\n # and convert it to a normal letter\n word[letter_i] = (\"a\".ord + new_char_i).chr\n \n # increment inner loop\n letter_i += 1\n end\n \n # increment outer loop\n word_i += 1\n end\n \n return words.join(\" \") # join all the words together to form a new string\n end", "title": "" }, { "docid": "782fee760c794efbdc4696bda54dcfe1", "score": "0.5901381", "text": "def decrypt(char)\n case char.downcase\n when 'a'..'m'\n (char.ord + 13).chr\n when 'n'..'z'\n (char.ord - 13).chr\n else\n char\n end\nend", "title": "" }, { "docid": "b6773a0a7f9d1bbbf100f67cca706809", "score": "0.588642", "text": "def cesar_cifra(encrypted_sentence, shift)\r\n\tsentence = encrypted_sentence.chars\r\n\tleft_limit = 65\r\n\tright_limit = 90\r\n\tnew_sentence=[]\r\n\tfor letter in sentence\r\n\t\tif letter.ord == 32\r\n\t\t\tnew_sentence.push letter\r\n\t\telsif (letter.ord+shift) < 65\r\n\t\t\tnew_sentence.push ((letter.ord+shift)+26).chr\r\n\t\telsif (letter.ord+shift) > 90\r\n\t\t\tnew_sentence.push ((letter.ord+shift)-26).chr\r\n\t\telse\r\n\t\t\tnew_sentence.push (letter.ord+shift).chr\r\n\t\tend\r\n\tend\r\n\tprint \"El mensaje descifrado es: #{new_sentence.join}\\n\"\r\nend", "title": "" }, { "docid": "db91679deb0f8d0c74389cc02105f527", "score": "0.58762884", "text": "def encode(message, offset)\n # local variables\n new_array = []\n new_message = \"\"\n \n # Array of the cipher\n alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']\n\n new_array = message.upcase.split(\"\").collect {|x| alphabet.index(x)}\n new_array.each do |x|\n if x == nil\n new_message << \" \"\n else\n x -= offset\n new_message << alphabet[x]\n end\n end\n return new_message\nend", "title": "" }, { "docid": "00093992e08d895e106fcb4555d418f6", "score": "0.5861668", "text": "def caesar_decode(letters,offset) \n #other things google\n #.scan(/\\w+|\\W+/)\n #split(/(\\W)/)\n #/\\s/ - A whitespace character: /[ \\t\\r\\n\\f]/\n #string.split(/(\\W)/)\n alpha_uppercase = [*?A..?Z] \n #could use a global variable but it doesnt work when I use the $\n alpha_lowercase = [*?a..?z]\n empty= \"\" \n \n string.each_char do |letters| \n if letters[/[a-zA-Z]/] == letters \n if letters.upcase == letters \n index= (alpha_uppercase.index(letters) - offset ) % 26 \n letters.sub!(letters,alpha_uppercase[index])\n else \n \n index = (alpha_lowercase.index(letters) - offset) % 26\n letters.sub!(letters,alpha_lowercase[index])\n end\n else\n letters\nend\n empty << letters\nend\nempty\nend", "title": "" }, { "docid": "2cbddd80bd0c9cf8a1a1be3dee707e63", "score": "0.5857386", "text": "def decrypt(string)\nindex = 0\na_to_z = \"abcdefghijklmnopqrstuvwxyz\"\n\n while index < string.length\n new_string = string[index]\n\n position = a_to_z.index(new_string)\n second_index= position-1\n print a_to_z[second_index]\nindex += 1\nend\nreturn string\nend", "title": "" }, { "docid": "a82c0ff8f06b4af7c8257314b80cba82", "score": "0.58438617", "text": "def decrypt(encoded_message)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\n index = 0\n while index < encoded_message.length\n if encoded_message[index] != \" \"\n offset = alphabet.index(encoded_message[index])\n encoded_message[index] = alphabet[offset - 1]\n end\n index += 1\n end\n\n encoded_message\nend", "title": "" }, { "docid": "c95df93ea19a6400317fe02c9d382a81", "score": "0.58282864", "text": "def decipher_rot_13(char)\n case char\n when 'a'..'m', 'A'..'M' then (char.ord + 13).chr\n when 'n'..'z', 'N'..'Z' then (char.ord - 13).chr\n else char\n end\nend", "title": "" }, { "docid": "17a730feadc4eb4811fa6382289dca03", "score": "0.58255154", "text": "def decrypt(ciphertext, padtext)\n text = ''\n\n ciphertext.length.times do |idx|\n # You have to do [idx,1] in ruby 1.8; in later version(s), you can just \n # do [idx]. Oh well.\n cnum = lton(ciphertext[idx,1])\n pnum = lton(padtext[idx,1])\n lnum = (cnum - pnum) % 26\n\n text += ntol(lnum)\n end\n\n return text\nend", "title": "" }, { "docid": "77673b586960463dca91fc4c98f70e7a", "score": "0.58207154", "text": "def decrypt(string)\n return conversion(string) { |char, key_index| contain(char - key_index) + 64 }\n end", "title": "" }, { "docid": "1157f98a4e5349a9ad68a780b647b131", "score": "0.58082145", "text": "def caesar_shift(letter, offset)\n if (letter.ord < 97 && letter.ord > 65) || letter.ord < 65 || letter.ord > 122\n letter\n\n elsif 122 - letter.ord >= offset\n (letter.ord + offset).chr\n else \n overhang = offset - (122 - letter.ord)\n (96 + overhang).chr \n end \nend", "title": "" }, { "docid": "57aee11325411a017ddfd1caff6b47f6", "score": "0.5807333", "text": "def decrypt_char(char, i, seed)\n (char.hex^VT_TABLE[(i + seed) % 53]).chr\n end", "title": "" }, { "docid": "1a53e2a73d4490a56ef9c6fef0143429", "score": "0.58065385", "text": "def caesar_encode(string,offset)\n string.split(\"\").map do |characters|#take the user string and split it into different character\n if $array_abc_low.include?(characters)#check if the within the lower abc array there is the characters\n new_character = $array_abc_low[($array_abc_low.index(characters)+offset)%26]#if there is set it to a new character with the new offset and %26 so you can get the new index of the character.\n elsif\n $array_abc_up.include?(characters)#check if the within the up\n new_character = $array_abc_up[($array_abc_up.index(characters)+offset)%26]\n else characters\n end\nend.join(\"\")\nend", "title": "" }, { "docid": "9c191cd537622cae5383a308f55f2896", "score": "0.5798436", "text": "def caesar_cipher(string, shift)\n symbols = 'abcdefghijklmnopqrstuvwxyz'\n ciphered_text = ''\n string.each_char do |char|\n if char.match(/[A-Z]/) \n new_index = (symbols.index(char.downcase) + shift) % symbols.length\n ciphered_text += symbols[new_index].upcase\n next\n end\n if symbols.include?(char) \n new_index = (symbols.index(char) + shift) % symbols.length\n ciphered_text += symbols[new_index]\n else\n ciphered_text += char\n end\n end\n return ciphered_text\nend", "title": "" }, { "docid": "d6c30eef7e2b9f0b3a53cd494c1252ec", "score": "0.57831275", "text": "def decoded_cypher(coded_message)\n coded_characters = coded_message.downcase.split('')\n @base_cypher = (\"a\"..\"z\").to_a\n decoded_message = []\n coded_characters.each do |character|\n if character.match(/[a-z]/)\n coded_index = @base_cypher.index(character)\n if coded_index > 26\n input_index += 26\n end\n decoded_message << @base_cypher[coded_index - 4]\n elsif character.match(/\\W/)\n decoded_message << \" \"\n else\n decoded_message << character\n end\n end\n decoded_message\nend", "title": "" }, { "docid": "34299b55a4c9bcf71c1e6697edb02d01", "score": "0.5774839", "text": "def GetCharEncrypted(pt,k)\n #Posicion actual de pt en el alfabeto\n position = @alphabet.index pt\n \n #Valor que k hara que pt se mueva\n #Se utiliza el mismo alfabeto pero al reves\n #de esta forma 'a' como texto tiene posicion 0\n #pero como clave recorre n-0 espacios (donde n es\n #la cantidad máxima de caracteres en @alphabet\n change = @alphabet.reverse.index k\n \n #Atrapa un error. Sucede si pt o k no existen en @alphabet\n if position == nil or change==nil\n puts \"Position #{position}\"\n puts \"#{k} Change #{change}\"\n end\n\n #La nueva posicion (caracter encriptado)\n newPosition = position+change\n \n #Si se pasa del máximo de caracteres en @alphabet\n #continua desde el inicio\n if (newPosition>@top-1)\n newPosition = newPosition-@top\n end\n return @alphabet[newPosition]\n end", "title": "" }, { "docid": "c322f4a3c34b091506c9892586458854", "score": "0.57707155", "text": "def decode_char(c, key)\n\n # if c is not a letter between a-z, then return c\n if c < 97 || c > 122\n return c\n end\n \n # if c - ket is less than 97, add 26 to bring it back into the a-z range\n if c - key < 97\n return c - key + 26\n else\n return c - key\n end\nend", "title": "" }, { "docid": "e3f4f431c8ed3b8f789bd3d9ab4cf2e6", "score": "0.5770544", "text": "def caesar_cipher(string)\r\n \r\n # Array to hold the finished (encoded) string\r\n shiftedArray = [] \r\n # Maps the characters in the string to an array of corresponding ASCII values\r\n charMap = string.chars.map(&:ord)\r\n\r\n shift = 1\r\n # Loop accounting for all possible encoded strings from input\r\n 26.times do |shift|\r\n \t# Add encoded characters to final array\r\n shiftedArray << charMap.map do |c|\r\n # Conditional to account for wrapping, then converting from ASCII back to alphabet\r\n ((c + shift) < 123 ? (c + shift) : (c + shift) - 26).chr\r\n # Reassemble shifted characters into string\t\r\n end.join\r\n end\r\n\r\n # Print the encoded string\r\n shiftedArray\r\nend", "title": "" }, { "docid": "66fe4235e54bf1ff7ce96d1beb32e4a0", "score": "0.57695615", "text": "def decrypt(message)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n i = 0\n while i < message.length\n if (\"b\"..\"z\").include? message[i]\n # message[i] = alphabet[alphabet.index(message[i]) - 1]\n index_in_alphabet = alphabet.index(message[i])\n index_in_alphabet -= 1\n message[i] = alphabet[index_in_alphabet]\n elsif message[i] == \"a\"\n message[i] = \"z\"\n end\n i += 1\n end\n message\nend", "title": "" }, { "docid": "13c24a61d2986dfc20fac058d986dbbf", "score": "0.5768416", "text": "def better_cipher (string, shift_factor)\n\tstring.each_byte do |c|\n\t\tif c.between?(65,90)\n\t\t\tc = c + shift_factor\n\t\t\tif c > 90\n\t\t\t\tc = 64 + (c - 90)\n\t\t\tend\n\t\telsif c.between?(97,122)\n\t\t\tc = c + shift_factor\n\t\t\tif c > 122\n\t\t\t\tc = 96 + (c - 122)\n\t\t\tend\n\t\tend\n\t\tprint c.chr\n\tend\n\tputs ' '\t\t\t\nend", "title": "" }, { "docid": "48edab3d3fb85f1e8036187947993937", "score": "0.5751407", "text": "def decrypt(string)\nindex=0\n # loop over the string's letters\n until index== string.length\n # if the letter is a space, do nothing\n if string[index] == \" \"\n string[index]\n # conditional logic for edge case\n elsif string[index] == \"a\" \n string[index]= \"z\"\n else \n # with .ord we get string's position in the alphabet and -1 goes 1 letter backwards\n previous= string[index].ord-1\n # .chr returns a one-character string at the beginning of the string\n string[index]= previous.chr \n end\n index += 1\n end\n string\nend", "title": "" }, { "docid": "b7785aa75805356fc6adf3aed2125f5b", "score": "0.5746763", "text": "def decrypt(str)\n \n index=0\n while index < str.length\n #switch to leeter preceding it, alphabetically - string\n output = (str[index].ord-1).chr\n p output.tr(\"`\", \"z\")\n index += 1 \n end\nend", "title": "" }, { "docid": "e0390796441224d30574836029b93632", "score": "0.57442105", "text": "def decoder(key_count, cypher, key_array)\r\n\tcypher = cypher.downcase.ord\r\n\tkey_length = key_array.length\r\n\t# gotta be 0 - 25\r\n\tif cypher.ord > 96 and cypher.ord < 123 then\r\n\t\tcypher = cypher.ord - 97\r\n\t\tkey_count %= key_length\r\n\t\tx = key_array[key_count].downcase.ord - 97\r\n\t\t# decode and back to ascii\r\n\t\ttext = (cypher - x) % 26 + 97\r\n\t\treturn text.chr.upcase\r\n\telse \r\n\t\treturn cypher.chr\r\n\tend\r\nend", "title": "" }, { "docid": "d8f572ade0657c9c2b3b07cd25913733", "score": "0.5735487", "text": "def decrypt(decrypt_input)\n decrypt_index = 0\n decrypt_output = \"\"\n \n while decrypt_index < decrypt_input.length\n if decrypt_input[decrypt_index] == \"a\"\n decrypt_output[decrypt_index] = \"z\"\n \n elsif decrypt_input[decrypt_index] == \" \"\n decrypt_output[decrypt_index] = \" \"\n \n else\n decrypt_output[decrypt_index] = (decrypt_input[decrypt_index].ord - 1).chr \n \n end \n \n decrypt_index+=1 \n \n end\n \n return decrypt_output\n\nend", "title": "" }, { "docid": "237f8f537b9caf41ac6aa9a6e5b23a51", "score": "0.57334125", "text": "def decrypt(string)\n index = 0\n while index < string.length\n letter_position = \"abcdefghijklmnopqrstuvwxyz\".index(string[index])\n puts \"abcdefghijklmnopqrstuvwxyz\"[letter_position - 1]\n index += 1\n end\nend", "title": "" }, { "docid": "1084a10bcba33cd33ea7ae5077a594ef", "score": "0.57275105", "text": "def caesar_cipher(str, shift_factor)\r\n # create alphabet array\r\n alphabet = ('a'..'z').to_a\r\n # create array that will hold the chars of the new string\r\n new_str_arr = []\r\n # create array of current string chars\r\n str_arr = str.split('')\r\n\r\n # loop over every character of the current string\r\n for char in str_arr do \r\n # downcase char so we can also find it in the alphabet if it's uppercase\r\n downcase_char = char.downcase;\r\n # get position of char alphabet\r\n char_pos = alphabet.index(downcase_char);\r\n # create var for new char later on\r\n new_char = ''\r\n\r\n # if the char has been found in the alphabet\r\n if (char_pos) \r\n # if the char_pos + shift_factor index exists in alphabet\r\n if (alphabet[char_pos + shift_factor])\r\n new_char = alphabet[char_pos + shift_factor]\r\n else \r\n # we substract how much we could shift at the end of the array from the total shift needed\r\n # and correct for the shift we already made\r\n new_char = alphabet[shift_factor - (26 + char_pos)]\r\n end\r\n\r\n # else if the char is not a letter\r\n elsif (!char_pos)\r\n # the new char is the same as the old char (e.g. space, punctuation)\r\n new_char = char\r\n end\r\n\r\n # add new char to new string array\r\n new_str_arr.push(char == downcase_char ? new_char : new_char.upcase)\r\n end\r\n\r\n # make a string of new string array\r\n new_str_arr.join\r\nend", "title": "" }, { "docid": "0d7b795dfcb3e019ccd050c5058dcac1", "score": "0.57224226", "text": "def decrypt(string)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n current_index = 0\n while current_index <= (string.length - 1)\n previous_letter = alphabet.index(string[current_index]) - 1 ## b would give you the index of a, which is 0\n string[current_index] = alphabet[previous_letter]\n current_index += 1\n end\n return string #ensure that the method returns a correct string, puts method did not work when encrypt was nested within decrypt\nend", "title": "" }, { "docid": "8b74e2ab263d52a4ac0a7e811cbaf69d", "score": "0.5717924", "text": "def caesar_cipher(phrase, shift)\n # creates an empty variable to hold the soon to be ciphered text string\n ciphertext = ''\n # takes each character of the string and gives it its integer value\n phrase.each_codepoint do |asc|\n #uses case statement (when/then) and pushes each ciphered character to the ciphered string variable\n ciphertext << case asc\n #when we're passing a codepoint that relates to a lower case letter between a and z\n when 'a'.ord..'z'.ord\n #take the codepoint value of the letter, then substract from it the value of lowercase a, then add the shift value. Next modulo by 26. And lastly add back the value of lowercase a.\n 'a'.ord + (asc - 'a'.ord + shift) % 26\n #but when we're passing a codepoint that relates to an upper case letter between A and Z...\n when 'A'.ord..'Z'.ord\n #take the codepoint value of the letter, then subract from it the value of uppercase A, then add the shift value. Next modulo by 26. Next modulo by 26. Lastly, add back the value of uppercase A.\n 'A'.ord + (asc - 'A'.ord + shift) % 26\n else\n #since it's not a lowercase nor uppercase letter we leave it alone and it will be pushed to the ciphertext string as is. This would be the case for punctuation or numbers.\n asc\n #closing out the case (when/then) statement\n end\n #closing out the each_codepoint section\n end\n #returns the ciphertext string based on the conversions made above\n ciphertext\nend", "title": "" }, { "docid": "e9ccf1675b73f350590ae1028f8d6246", "score": "0.57031953", "text": "def shift_decipher(key, text)\r\n plaintext = ''\r\n encrypted_text = ''\r\n key = translate_key(key, MY_DICT)\r\n ciphertext = clean_text(text, LETTERS)\r\n ciphertext.each_char.with_index do |character, index|\r\n encrypted_text = MY_DICT[character]\r\n encoded_text = (encrypted_text - key[index % key.length]) % 26\r\n plaintext += LETTERS[encoded_text]\r\n end\r\n return plaintext\r\nend", "title": "" }, { "docid": "11e7cea427df61eeef2ddac3db6be9c5", "score": "0.5702109", "text": "def decrypt(code)\n counter = 0\nnew_code = \"\"\ncharacters = \"abcdefghijklmnopqrstuvwxyz\"\n\n\n while counter < code.length\n \n new_code += characters[characters.index(code[counter]) - 1] \n counter += 1\n\n end\n \np new_code\n\nend", "title": "" }, { "docid": "c18f7c2e6dc65ba6eef3106f6ebbaf72", "score": "0.5700586", "text": "def caesar_cipher(input_string, shift_factor)\n\n #the unpack means it converts the string into ASCII values\n positions = input_string.unpack('C*')\n\n=begin\n puts \"This should be the ASCII values\"\n puts positions\n=end\n\n #shifted positions is the loop\n #for each position in the map, do the following\n #pos is the current value being worked on\n \n #the .map [1, 2, 3].map { |n| n * n } #=> [1, 4, 9]\n #it makes an array of the shifted positions created by the original positions\n shifted_positions = positions.map do |pos|\n\n #using switch statements\n case pos\n\n #A-Z inclusive, a-z inclusive means include everything\n #this checks to see if the input is a letter\n when (65..90), (97..122)\n\n #modulus 26\n #shifted is the current position plus the shift factor\n shifted = pos + (shift_factor % 26) # use % 26 to account for shift factors over 26\n\n #now check to make sure it is a-z or A-Z\n #check if b/w 90 and 97, or if greater than 122\n if (shifted > 90 && shifted < 97) || (shifted > 122) # loop around\n\n #if so, shift it by subtracting 26\n #minus 26 to wrap around, looks like a few others did the same technique\n shifted = shifted - 26\n #end of if statement\n end\n \n #this is the result of the shifting \n pos = shifted\n else\n \n #if it is not a letter, it stays the same\n pos # ignore non-alphabet chars\n\n end\n=begin\n puts \"This should be the shifted ASCII values\"\n puts pos\n=end\n end\n \n #the resulting string is \n #i think it puts the ASCII values \n result_string = shifted_positions.pack('C*')\n puts result_string\nend", "title": "" }, { "docid": "72e0735dd7a9b2b7267598faf9b022bc", "score": "0.57004297", "text": "def caesar_cipher_ord(string, shift)\n if shift > 0\n result_str = \"\"\n \n if (shift > 26)\n shift %= 26\n end\n\n string.each_char do |char|\n char.to_i\n result_char = char\n if (char.ord.between?(65, 90) || char.ord.between?(97, 122))\n char_code = char.ord + shift\n if (char.ord.between?(65, 90) and !char_code.between?(65,90)) or (char.ord.between?(97, 122) and !char_code.between?(97,122))\n char_code -= 26\n end\n result_char = char_code.chr\n end\n result_str.insert(result_str.length, result_char)\n end\n result_str\n end\n end", "title": "" }, { "docid": "5707848d1ac656f8bbe2a858794e0da0", "score": "0.5699947", "text": "def caesar_cipher(string, shift_factor)\n# Write your code here\n lower_alphabets = (\"a\"..\"z\").to_a\n upper_alphabets = (\"A\"..\"Z\").to_a\n result = \"\"\n\n string.each_char do |char|\n if lower_alphabets.include?(char)\n old_index = lower_alphabets.index(char)\n new_index = old_index + shift_factor\n result = result + lower_alphabets[new_index % 26]\n elsif upper_alphabets.include?(char)\n old_index = upper_alphabets.index(char)\n new_index = old_index + shift_factor\n result = result + upper_alphabets[new_index % 26]\n else\n result = result + char\n end\n end\n\n return result\n\nend", "title": "" }, { "docid": "8c02150470a40c6a4713aebb8b550402", "score": "0.5692454", "text": "def decrypt(string_input) #define the method and parameter it will take in\n # index = 0 #set index to zero as a baseline / to initialize\n alphabet = \"abcdefghijklmnopqrstuvwxyz\" #define the alphabet as a string\n\n # while index < string_input.length #while loop that will run while the index is less than the length of the argument passed in / the string input. The index will increment by one each time the loop runs.\n # if string_input[index] == \"a\" #this is addressing an edge case, saying that if \"a\" is in the input, set it equal to \"z.\" Here we are using the location/index to check through each char in the string. The loop with index+= 1 is handling incrementing to each character but [index] is identifying which letter the character is at in the string.\n # string_input[index] = \"z\"\n # elsif string_input[index] != \" \" #This is the condition that handles all other letters that are not exceptions/edge cases. \n # index_of_previous = alphabet.index(string_input[index]) - 1 #This is creating a new variable that is taking the char of the input that has not met the previous conditions (string_input[index]), and asking what index it is occuring at within the alphabet (aka alphabet.index(\"char\")) and then subtracting one (to get the index before to similate accessing the letter before it.)\n # #For example: \n # #index_of_previous = alphabet.index(string_input[1]) - 1\n # #index_of_previous = alphabet.index(\"b\") - 1\n # # alphabet.index(\"b\") = 1\n # #index_of_previous = 1 - 1\n # #index_of_previous = 0\n # string_input[index] = alphabet[index_of_previous] #still within the condition, it is reassigning that new index found above to alphabet, so that now whatever index you are on in the string input, is now equal to this character.\n # #For example:\n # #string_input[index] = alphabet[0]\n # # alphabet[0] = \"a\"\n # #string_input[index] = \"a\"\n # #string_input[3] = \"a\" <= \"a\" is now newly assigned to the index of the string_input that the loop was at currently\n # end\n # index += 1 #This makes the loop run again\n\n decrypted_string = string_input.chars\n\n decrypted_string.map! do |char|\n if char == \"a\" \n char = \"z\"\n elsif char != \" \" #This is the condition that handles all other letters that are not exceptions/edge cases. \n new_index = alphabet.index(char) - 1 #This is creating a new variable that is taking the char of the input that has not met the previous conditions (string_input[index]), and asking what index it is occuring at within the alphabet (aka alphabet.index(\"char\")) and then subtracting one (to get the index before to similate accessing the letter before it.)\n #For example: \n #index_of_previous = alphabet.index(string_input[1]) - 1\n #index_of_previous = alphabet.index(\"b\") - 1\n # alphabet.index(\"b\") = 1\n #index_of_previous = 1 - 1\n #index_of_previous = 0\n char = alphabet[new_index]\n end\n end\n\n puts decrypted_string.join('')\n return decrypted_string.join('') #return is requesting the output so we can potentially use it\nend", "title": "" }, { "docid": "df8ad2d57cc7eb28ed0dac8ea8aa7aa3", "score": "0.5685618", "text": "def caesar_cipher_byte(string, shift)\n if shift > 0\n byte_array = string.bytes\n \n if (shift > 26)\n shift %= 26\n end\n\n byte_array.each_with_index do |byte, index|\n byte.to_i\n result_byte = byte\n if byte.between?(65, 90) || byte.between?(97, 122)\n result_byte += shift\n if !result_byte.between?(65, 90) and !result_byte.between?(97, 122)\n result_byte -= 26\n end\n end\n byte_array[index] = result_byte\n end\n byte_array.pack(\"c*\")\n end\n end", "title": "" }, { "docid": "ec1001f262df654503473a4fb144a88f", "score": "0.5681536", "text": "def decrypt(cipher, key)\n ary = []\n for i in (0..cipher.count-1) do\n # \"#{i} - #{cipher[i]}\"\n c = cipher[i]^key[i%3]\n if is_printable(c)\n ary << c.chr\n else\n return \"~~~\" # This sequence will signal decrypted text is not readable\n end\n end\n ary.join\nend", "title": "" }, { "docid": "9beb0ec6fe206ad5a250b8fd0041b13b", "score": "0.5680477", "text": "def decrypt (undecrypted_string)\n #find the length of the string\n string_length = undecrypted_string.length\n\n #create alphabet index\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\n index = 0\n decrypted_string = \"\"\n\n #for each letter on the string\n while index < string_length\n letter = undecrypted_string[index]\n #find position in the alphabet\n index_original = alphabet.index(letter)\n #add previous letter in the alphabet to the result\n decrypted_string += alphabet[index_original - 1]\n index += 1\n end\n decrypted_string\nend", "title": "" }, { "docid": "c0556b01b28a2801b460dad23e0b48e5", "score": "0.56693625", "text": "def old_caesar_cipher(input, shift)\n return input.chars.map{|c|\n (shift%26).times{c.next!} if c.ord.between?(65, 90) || c.ord.between?(97, 122)\n c[-1]\n }.join('')\nend", "title": "" }, { "docid": "f9bdc05569763511c18cc1f6d159bd55", "score": "0.5666077", "text": "def caesar_cipher(string,k)\n\tk = k % 26\n\tlow_alpha = \"abcdefghijklmnopqrstuvwxyz\"\n\tupp_alpha = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\tlow_case_max = 122\n\tupp_case_max = 90\n\tstring.each_char do |c|\n\t\tif low_alpha.include? c\n\t\t\tval = c.ord + k\n\t\t\tval -= 26 if val > low_case_max\n\t\t\tprint val.chr\t\n\t\telsif upp_alpha.include? c\n\t\t\tval = c.ord + k\n\t\t\tval -= 26 if val > upp_case_max\n\t\t\tprint val.chr\t\n\t\telse\n\t\t\tprint c\n\t\tend\n\tend\nend", "title": "" }, { "docid": "3321fb193af0d52424a95e7d238eca4f", "score": "0.5661572", "text": "def caesar_cipher_long_original message, shift_factor\n\tencoded = \"\"\n\tmessage.each_byte do |byte|\n\t\tascii = byte.ord\n\t\t#if it is lower case\n\t\tshifted = ascii+shift_factor\n\t\tif is_lower? ascii \n\t\t\tif is_lower? shifted\n\t\t\t\tencoded += shifted.chr\n\t\t\telse \n\t\t\t\tencoded += (shifted-26).chr\n\t\t\tend\n\t\telsif is_upper? ascii \n\t\t\tif is_upper? shifted\n\t\t\t\tencoded += shifted.chr\n\t\t\telse \n\t\t\t\tencoded += (shifted-26).chr\n\t\t\tend\n\t\t#if it is not a letter just return it\n\t\telse \n\t\t\tencoded += ascii.chr\n\t\tend\t\n\tend\n\treturn encoded\n\nend", "title": "" }, { "docid": "251c01ceda7999b8bccc31a32bebe295", "score": "0.5659481", "text": "def offset(string, offset)\n string.chars.map do |x|\n if x.match?(/[a-z]/i)\n x = ((x.ord + offset) % 122)\n x += 97 if x < 97\n x.chr\n else\n x\n end\n end.join\nend", "title": "" }, { "docid": "430a2b364aa7d1e550a168ec4f85700d", "score": "0.56573546", "text": "def caesar_cipher(string, shift_factor)\n\talphabet = (\"a\"..\"z\").to_a\n\tencrypted_string = \"\"\n\t(string.length).times do |i|\n\n\t\tif alphabet.index(string[i].downcase).nil? # handles non-letters\n\t\t\tencrypted_string += string[i]\n\t\t\tnext\n\t\telse\n\t\t\tletter_index = alphabet.index(string[i].downcase).to_i\n shifted_index = ((letter_index + shift_factor) % 25)\n\t\t\tshifted_index -= 1 if letter_index + shift_factor > 25\n\t\tend\n\n\t\tif string[i].upcase == string[i]\n\t\t\tencrypted_string += alphabet[shifted_index].upcase\n\t\telse\n\t\t\tencrypted_string += alphabet[shifted_index]\n\t\tend\n\n\tend\n\tencrypted_string\nend", "title": "" }, { "docid": "c27025813813cd88a152b8a4187542cc", "score": "0.5651433", "text": "def test_text_charcode\n dec = DecT.new \"123ABCabc\" # 6 * 9 = 54 bit\n assert_nothing_raised { dec.decode(54) }\n dec = DecT.new \"123ABCab@\"\n assert_raise(KeyError) { dec.decode(54) }\n end", "title": "" }, { "docid": "ba1f01b5d67c093e55d84f50171a7848", "score": "0.565074", "text": "def caesar_cipher_string(string, offset, type)\n\tresult = \"\"\n\tfor i in 0..(string.length - 1)\n\t\tresult += caesar_cipher_char(string[i], offset, type)\n\tend\n\treturn result\nend", "title": "" }, { "docid": "828ea069cfec4903010163ed5ad36f4b", "score": "0.564725", "text": "def decrypt(str)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\tstart_count = 0\n\ta_count = 0 \n\tuntil start_count == str.length\n a_count = alphabet.index(str[start_count])\n\t str[start_count] = alphabet[a_count-=1 ]\n\t\tstart_count += 1\n end\nstr\nend", "title": "" }, { "docid": "1777e871518e7e1ff5157495b44edeba", "score": "0.56361496", "text": "def decrypt(string)\n \n index = 0\n a_z = \"abcdefghijklmnopqrstuvwxyz\"\n str = \"\"\n\n while index < string.length\n character = string[index]\n position = a_z.index(character)\n\n if character == \" \"\n str += \" \"\n else\n new_character = a_z[position - 1]\n str += new_character\n end\n \n index += 1\n end\n\n str\nend", "title": "" }, { "docid": "85899262839a08397a637a2828d23f5c", "score": "0.5635645", "text": "def caesar_cipher(message,n)\n alphabet_arr=('a'..'z').to_a\n new_message=\"\"\n message.each_char do |char|\n if alphabet_arr.include?(char)\n old_idx=alphabet_arr.index(char)\n new_idx=(old_idx+n)%26\n new_message+=alphabet_arr[new_idx] \n else\n new_message+=char\n end\n end\n new_message\nend", "title": "" }, { "docid": "a9e9b469f2159b22a232d5c58f26308f", "score": "0.5634781", "text": "def decrypt(encrypted_password)\nindex = 0\nwhile index < encrypted_password.length\n str = \"zabcdefghijklmnopqrstuvwxyza\"\n current_letter = encrypted_password[index]\n #For password of \"hello\", expect first current_letter to be \"h\"\n #Find the index of current letter in string. And store in variable current_letter_position\n #Reduce current_letter_position by 1. Store in variable decrypted_letter_position\n #Find the letter that corresponds to decrypted_letter_position from str variable. Store in variable decrypted_letter\n #Replace characters in encrypted password with decrypted_letter.\n current_letter_position = str.index(current_letter)\n decrypted_letter_position = current_letter_position-1\n decrypted_letter = str[decrypted_letter_position]\n encrypted_password[index] = decrypted_letter\n index +=1\nend\nreturn encrypted_password\nend", "title": "" }, { "docid": "0bb5d987c9fdda6a3cc6fabbbe8da90d", "score": "0.5630372", "text": "def decrypt(input)\n input.downcase!\n alph = \"abcdefghijklmnopqrstuvwxyz\"\n length = input.length\n coded_string = \"\"\n for i in 0..(length-1)\n letter = input[i]\n if letter == \"!\"\n \t#encrypt changes spaces to exclamation points so decrypt needs to change it back\n \tcoded_string += \" \"\n else\n currlet = alph.index(letter)\n #currlet is the index in alph of the letter we're looking at\n #currlet-1 should give us the index of the letter before it\n coded_string += alph[currlet - 1]\n end\n end\n coded_string\nend", "title": "" }, { "docid": "4d6575de7fa5b4ef9cd78e41adfb46f7", "score": "0.5629884", "text": "def decrypt(text)\n #declared counter to keep track of iterations\n counter=0\n #declared variable with array of alphabet from a to z\n alpha=(\"a\"...\"z\").to_a\n #declared variable to set number to compare to counter\n number_text=text.length\n #declared empty string to add updated values from method parameter.\n message= \"\"\n\n #added loop that will end when counter number(iterations) is equal to number of characters in parameter.\n until counter==number_text\n current_letter=text[counter]\n #conditional to address edge case and spaces\n if current_letter=='a'\n message+='z'\n elsif current_letter==' '\n message+=' '\n else\n #modify index value to reflect the left shift -1\n new_alpha_index=alpha.index(current_letter)-1\n # use new index value to get new letter value from original alphabet\n new_alpha_letter=alpha[new_alpha_index]\n #add iterated parameter value to final message string.\n message+=new_alpha_letter\n end\n #increase counter to validate loop\n counter+=1\n end\nreturn message\nend", "title": "" }, { "docid": "1d1eaf294baff3f61ccd59df99cb20cd", "score": "0.56239223", "text": "def caesar_cipher(string, factor)\n ind = 0\n\n string.each_char do |char|\n if (\"a\"..\"z\").include?(char.downcase)\n factor.times { char = char.next }\n end\n string[ind] = char[-1]\n ind += 1\n end\n\n string\nend", "title": "" }, { "docid": "fa6e00ede38a188a7f46fe4f2759ad49", "score": "0.56169426", "text": "def decrypt(encryption)\n index = 0\n alphabet = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n alphabet_index=0\n\n if encryption.length < alphabet.length\n while index < encryption.length\n alphabet_index = 0\n while alphabet_index < alphabet.length\n if encryption[index] == \"a\"\n encryption[index] = \"z\"\n break\n elsif encryption[index] == \"A\"\n encryption[index] = \"Z\"\n break\n elsif encryption[index] == alphabet[alphabet_index]\n encryption[index] = alphabet[alphabet_index-1]\n break\n else\n alphabet_index = alphabet_index+1\n end\n end\n index = index+1\n end\n puts encryption\n return encryption\n else\n puts \"Encryption too long to decrypt\"\n end\nend", "title": "" }, { "docid": "bda468e702fa63d172b87f88ba4ce492", "score": "0.5616635", "text": "def decryption_method(string)\n var2 = \"abcdefghijklmnopqrstuvwxyz\"\n x = 0 \n while x < string.length \n new_position = var2.index(string[x]) - 1\n string[x] = var2[new_position]\n x += 1\n end\n return string\nend", "title": "" }, { "docid": "7d8f8fffbef8e5debee336500835e23e", "score": "0.56126934", "text": "def caeser_cipher(str, shift)\n#break down letters to array\n letters = ('a'..'z').to_a\n # map through chars in string\n # find the index in the string & downcase\n str.chars.map { |x| letters.include?(x.downcase) ? \n # find the index of the current letter + shift - the size of the array\n letters[letters.find_index(x.downcase) + shift - letters.size] : x\n }.join\nend", "title": "" }, { "docid": "8b8c5d916e01985fa0f5eb3bbbfd1217", "score": "0.56106776", "text": "def wrap_char_code(char_code_shifted)\n if char_code_shifted.between?(\"a\".ord, \"z\".ord) || char_code_shifted.between?(\"A\".ord, \"Z\".ord)\n return char_code_shifted\n else\n return char_code_shifted -= (\"z\".ord - \"a\".ord) # char_code_shifted -= 25\n end\nend", "title": "" }, { "docid": "8ebbed450a2351636cc55a692d19270b", "score": "0.5609354", "text": "def caesar_cipher(str, shift)\n # arr = str.chars\n # correct_arr = []\n # arr.each do |char|\n # if char == \" \"\n # correct_arr << char\n # else\n # char = char.to_i\n # char += shift\n # if char >\n # end\n # end\n # end\n\nend", "title": "" }, { "docid": "65f33266bd311b075e0dfe32c202a91a", "score": "0.56047267", "text": "def decrypt(string)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n index = 0\n while index < string.length\n string[index] = alphabet[(alphabet.index(string[index]))-1]\n index += 1\n end\n p string\nend", "title": "" }, { "docid": "f6f2dc77887af306b93946af5708b275", "score": "0.56044483", "text": "def decrypt(new_string)\n\tlength = new_string.length\n\tcounter = 0\n\told_string = \"\"\n\twhile counter < length\n\t\talphabeth = \"abcdefghijklmnopqrstuvwxyz\"\n\t\tletter = new_string[counter]\n\t\tindex = alphabeth.index(letter)\n\t\told_string += alphabeth[index - 1]\n\t\tcounter += 1\n\tend\n\tputs old_string\nend", "title": "" }, { "docid": "ddc49ef40ea9fd18bcd9d684a9388502", "score": "0.5600906", "text": "def caesar_cipher(uncoded_message, shift_factor = 1)\n #checks inputs for valid input type\n shift_factor = shift_factor.to_i\n puts \"Original message: #{uncoded_message}\"\n encoded_array = Array.new()\n check = check_inputs(uncoded_message, shift_factor)\n #if true, the code proceeds as normal\n if check == true\n\n uncoded_array = uncoded_message.split(\"\")\n \n #uncoded_array allows for easier manipulation of individual characters\n uncoded_array.each_with_index do |character, index|\n \n \n old_character_number = character.ord \n #checks if the ascii number generated is a lower case letter, uppercase \n #letter, or a non letter character\n if old_character_number <= 90 && old_character_number >= 65\n new_character_number = old_character_number - shift_factor\n #this keeps the new letter uppercase\n if new_character_number < 65\n new_character_number = 91 - (65 - new_character_number) \n end\n\n elsif old_character_number <= 122 && old_character_number >= 97\n new_character_number = old_character_number - shift_factor\n #this keeps the new letter undercase\n if new_character_number < 97\n new_character_number = 123 - (97 - new_character_number)\n end\n \n else\n #keeps the character the same if it's not a letter\n new_character_number = old_character_number\n end\n\n #converting the character number to a letter according to ASCII standards\n new_character = new_character_number.chr\n \n \n encoded_array[index] = new_character\n end\n encoded_message = encoded_array.join(\"\")\n puts \"Encoded message: #{encoded_message}\" \n encoded_message\n else \n #if the check is false, the following is printed\n puts \"Please enter a valid string and number. The number must be in between 0 and 26 excluding 0 and 26\"\n end\n\n\nend", "title": "" }, { "docid": "0f054671a72a7220781ff59aff38e743", "score": "0.55980885", "text": "def decode(ciphertext, key)\n cipher = key.chars.uniq + (('a'..'z').to_a - key.chars)\n # p cipher\n plaintext_chars =\n ciphertext.chars.map do |char| \n # p char\n cipher[char.ord - 65]\n end\n plaintext_chars.join\nend", "title": "" } ]