query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
PATCH/PUT /inputs/1 PATCH/PUT /inputs/1.json
|
def update
respond_to do |format|
if @input.update(input_params)
format.html { redirect_to @input, notice: 'Input was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @input.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n raise to_yaml\n\n respond_to do |format|\n if @input.update(input_params)\n format.html { redirect_to @input, notice: 'Input was successfully updated.' }\n format.json { render :show, status: :ok, location: @input }\n else\n format.html { render :edit }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @parameters = args[:parameters] if args.key?(:parameters)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n #@input = Input.find(params[:id])\n\n respond_to do |format|\n if @input.update_attributes(params[:input])\n \n format.html { redirect_to outputs_path, notice: 'Input was successfully updated.' }\n format.json { head :ok }\n format.js {@updates=params[:input].keys}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @input.update(input_params)\n format.html { redirect_to @input, notice: 'Input was successfully updated.' }\n format.json { render :show, status: :ok, location: @input }\n else\n format.html { render :edit }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @input.update(input_params)\n format.html { redirect_to @input, notice: 'Input was successfully updated.' }\n format.json { render :show, status: :ok, location: @input }\n else\n format.html { render :edit }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @input_path = args[:input_path] if args.key?(:input_path)\n end",
"def update\n respond_to do |format|\n if @example_input.update(example_input_params)\n format.html { redirect_to @example_input, notice: 'Example input was successfully updated.' }\n format.json { render :show, status: :ok, location: @example_input }\n else\n format.html { render :edit }\n format.json { render json: @example_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @input = args[:input] if args.key?(:input)\n end",
"def update!(**args)\n @input = args[:input] if args.key?(:input)\n end",
"def put!\n request! :put\n end",
"def patch!\n request! :patch\n end",
"def update!(**args)\n @data_schema = args[:data_schema] if args.key?(:data_schema)\n @input_uris = args[:input_uris] if args.key?(:input_uris)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @operation = Operation.find(params[:id])\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n format.html { redirect_to user_model_path(@model.user,@model), notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update!(**args)\n @input = args[:input] if args.key?(:input)\n @output = args[:output] if args.key?(:output)\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update!(**args)\n @input_uri = args[:input_uri] if args.key?(:input_uri)\n end",
"def update!(**args)\n @input_uri = args[:input_uri] if args.key?(:input_uri)\n end",
"def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end",
"def update!(**args)\n @input_config = args[:input_config] if args.key?(:input_config)\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @model_input.update(model_input_params)\n format.html { redirect_to @model_input, notice: 'Model input was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_input }\n else\n format.html { render :edit }\n format.json { render json: @model_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @context = args[:context] if args.key?(:context)\n @input = args[:input] if args.key?(:input)\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @resource_info = args[:resource_info] if args.key?(:resource_info)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end",
"def update!(**args)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end",
"def update\n @mathematical_model_input = MathematicalModelInput.find(params[:id])\n\n respond_to do |format|\n if @mathematical_model_input.update_attributes(params[:mathematical_model_input])\n format.html { redirect_to @mathematical_model_input, notice: 'Mathematical model input was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mathematical_model_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @first_input.update(first_input_params)\n format.html { redirect_to @first_input, notice: 'First input was successfully updated.' }\n format.json { render :show, status: :ok, location: @first_input }\n else\n format.html { render :edit }\n format.json { render json: @first_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @recipe_input.update(recipe_input_params)\n format.html { redirect_to @recipe_input, notice: 'Recipe input was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_input }\n else\n format.html { render :edit }\n format.json { render json: @recipe_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"def update(path)\n output { patch(path, params) }\n end",
"def update!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end",
"def update\n @input = Input.find(params[:id])\n\n respond_to do |format|\n if @input.update_attributes(params[:input])\n flash[:notice] = 'Input was successfully updated.'\n format.html { redirect_to(@input) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @input.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(context)\n context.request.body.rewind # in case someone already read it\n\n begin\n data = JSON.parse(context.request.body.read)\n rescue JSON::ParserError\n context.halt(406, { status: 'error', message: 'Not acceptable JSON payload' }.to_json)\n end\n\n set_resource(context)\n\n begin\n permitted_params = resource_fields.map { |k| k[:name] }\n permitted_params = data.select { |k, _| permitted_params.include?(k) }\n\n if instance_variable_get(:\"@#{resource_name}\").update_attributes(permitted_params)\n instance_variable_get(:\"@#{resource_name}\").reload\n instance_variable_get(:\"@#{resource_name}\").to_json\n else\n errors = instance_variable_get(:\"@#{resource_name}\").errors.map { |k, v| \"#{k}: #{v}\" }.join('; ')\n context.halt(406, { status: 'error', message: errors }.to_json)\n end\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @custom_input.update(custom_input_params)\n format.html { redirect_to custom_inputs_url, notice: 'Entrada personalizada foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @custom_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @http_body = args[:http_body] if args.key?(:http_body)\n end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @field_configs = args[:field_configs] if args.key?(:field_configs)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end",
"def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def update!(**args)\n @artifact_uri = args[:artifact_uri] if args.key?(:artifact_uri)\n @container_spec = args[:container_spec] if args.key?(:container_spec)\n @predict_schemata = args[:predict_schemata] if args.key?(:predict_schemata)\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end",
"def update!(**args)\n @description = args[:description] if args.key?(:description)\n @format = args[:format] if args.key?(:format)\n @json_path = args[:json_path] if args.key?(:json_path)\n @name = args[:name] if args.key?(:name)\n @priority = args[:priority] if args.key?(:priority)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @include_form_in_response = args[:include_form_in_response] if args.key?(:include_form_in_response)\n @requests = args[:requests] if args.key?(:requests)\n @write_control = args[:write_control] if args.key?(:write_control)\n end",
"def update!(**args)\n @input_path = args[:input_path] if args.key?(:input_path)\n @pipeline_config = args[:pipeline_config] if args.key?(:pipeline_config)\n @processor_type = args[:processor_type] if args.key?(:processor_type)\n @schema_name = args[:schema_name] if args.key?(:schema_name)\n @skip_ingested_documents = args[:skip_ingested_documents] if args.key?(:skip_ingested_documents)\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_explanations = args[:disable_explanations] if args.key?(:disable_explanations)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_access_logging = args[:enable_access_logging] if args.key?(:enable_access_logging)\n @enable_container_logging = args[:enable_container_logging] if args.key?(:enable_container_logging)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @id = args[:id] if args.key?(:id)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @private_endpoints = args[:private_endpoints] if args.key?(:private_endpoints)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shared_resources = args[:shared_resources] if args.key?(:shared_resources)\n end",
"def update\n respond_to do |format|\n if @http_request.update(http_request_params)\n format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @http_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @http_request.update(http_request_params)\n format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @http_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update!(**args)\n @http_request = args[:http_request] if args.key?(:http_request)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @severity = args[:severity] if args.key?(:severity)\n @source_location = args[:source_location] if args.key?(:source_location)\n @struct_payload = args[:struct_payload] if args.key?(:struct_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @trace = args[:trace] if args.key?(:trace)\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update!(**args)\n @address_input = args[:address_input] if args.key?(:address_input)\n @context = args[:context] if args.key?(:context)\n @email_input = args[:email_input] if args.key?(:email_input)\n @language_code = args[:language_code] if args.key?(:language_code)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @phone_input = args[:phone_input] if args.key?(:phone_input)\n end",
"def update!(**args)\n @outputs = args[:outputs] if args.key?(:outputs)\n @parameters = args[:parameters] if args.key?(:parameters)\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update!(**args)\n @collection_ids = args[:collection_ids] if args.key?(:collection_ids)\n @input_uri_prefix = args[:input_uri_prefix] if args.key?(:input_uri_prefix)\n end",
"def update!(**args)\n @api_signatures = args[:api_signatures] if args.key?(:api_signatures)\n @unique_apis = args[:unique_apis] if args.key?(:unique_apis)\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end"
] |
[
"0.6625975",
"0.6494558",
"0.6494558",
"0.6494558",
"0.6494558",
"0.6494558",
"0.6494558",
"0.6494558",
"0.6423025",
"0.64133173",
"0.64133173",
"0.64133173",
"0.64133173",
"0.64133173",
"0.64133173",
"0.64133173",
"0.64133173",
"0.64133173",
"0.6405385",
"0.6385818",
"0.62839776",
"0.62839776",
"0.6259195",
"0.61706805",
"0.6160936",
"0.6160936",
"0.6094423",
"0.6080423",
"0.60753334",
"0.6069335",
"0.60622936",
"0.60274625",
"0.5981657",
"0.593841",
"0.593841",
"0.59287953",
"0.59287953",
"0.5915735",
"0.5903884",
"0.5892643",
"0.5881561",
"0.5881121",
"0.58724535",
"0.58682734",
"0.58566266",
"0.58516365",
"0.58516365",
"0.58516365",
"0.58516365",
"0.5836042",
"0.5836042",
"0.582654",
"0.58202434",
"0.5817039",
"0.5806842",
"0.5802426",
"0.57960653",
"0.5793968",
"0.57877976",
"0.57614166",
"0.57429093",
"0.5728692",
"0.57272714",
"0.572198",
"0.57192713",
"0.56988657",
"0.5691839",
"0.5690494",
"0.56898504",
"0.56891066",
"0.56722105",
"0.56641525",
"0.56585324",
"0.5657305",
"0.5646148",
"0.5640078",
"0.5638963",
"0.563596",
"0.56323063",
"0.5632138",
"0.5632138",
"0.5629797",
"0.5628941",
"0.56266207",
"0.561718",
"0.56167746",
"0.5592917",
"0.55920655",
"0.5591464",
"0.5590594",
"0.5590435",
"0.55895936",
"0.5587937",
"0.5581626",
"0.55763006",
"0.5576209",
"0.55740327",
"0.5568633",
"0.55671585",
"0.55667996"
] |
0.64865154
|
8
|
DELETE /inputs/1 DELETE /inputs/1.json
|
def destroy
@input.destroy
respond_to do |format|
format.html { redirect_to inputs_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @input = Input.find(params[:id])\n @input.destroy\n\n respond_to do |format|\n format.html { redirect_to inputs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @input = Input.find(params[:id])\n @input.destroy\n\n respond_to do |format|\n format.html { redirect_to(inputs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @input.destroy\n respond_to do |format|\n format.html { redirect_to inputs_url, notice: 'Input was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @input.destroy\n respond_to do |format|\n format.html { redirect_to inputs_url, notice: 'Input was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @input.destroy\n respond_to do |format|\n format.html { redirect_to inputs_url, notice: 'Input was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @example_input.destroy\n respond_to do |format|\n format.html { redirect_to example_inputs_url, notice: 'Example input was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mathematical_model_input = MathematicalModelInput.find(params[:id])\n @mathematical_model_input.destroy\n\n respond_to do |format|\n format.html { redirect_to mathematical_model_inputs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @custom_input.destroy\n respond_to do |format|\n format.html { redirect_to custom_inputs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @first_input.destroy\n respond_to do |format|\n format.html { redirect_to first_inputs_url, notice: 'First input was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(id)\n @app.client.input_delete id if id.is_a? String\n @app.client.inputs_delete id if id.is_a? Array\n end",
"def destroy\n @recipe_input.destroy\n respond_to do |format|\n format.html { redirect_to recipe_inputs_url, notice: 'Recipe input was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(request)\n @connection.delete request.path do |req|\n req.body = request.params\n end\n end",
"def destroy\n @model_input.destroy\n respond_to do |format|\n format.html { redirect_to model_inputs_url, notice: 'Model input was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @input_datum.destroy\n respond_to do |format|\n format.html { redirect_to input_data_url, notice: 'Input datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @input_log.destroy\n respond_to do |format|\n format.html { redirect_to input_logs_url, notice: 'Input log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @precision_input.destroy\n respond_to do |format|\n format.html { redirect_to precision_inputs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def delete_input(input_obj)\n new_inputs = inputs.delete_if do |input|\n input_obj.name == input.name\n end\n Base.redis.del(input_obj.instance_variable_get(:@redis_key)) # delete data\n Base.redis.hset(self.name, :inputs, Marshal.dump(new_inputs)) # dump current input names\n end",
"def destroy\n @user_input.destroy\n respond_to do |format|\n format.html { redirect_to user_inputs_url, notice: 'User input was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def deleteRequest\n\n end",
"def destroy\n @input_record = InputRecord.find(params[:id])\n @input_record.destroy\n\n respond_to do |format|\n format.html { redirect_to(input_records_url) }\n format.xml { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n request(:delete)\n end",
"def delete(*args)\n Request.delete(*args)\n end",
"def delete!\n request! :delete\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def delete!(*rest) end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete(data)\n params = self.params\n data['delete']['parameters'].each { |p|\n params.delete(p) if params.has_key?(p)\n }\n write(params)\n data['delete']['parameters']\n end",
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end",
"def destroy\n @example.update_attributes(:deleted => 1)\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\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::Delete.new('/offsets/doit.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids'])\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(',')})\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 end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @input_ymd = params[:input_ymd]\n @d_fixture = DFixture.find(params[:id])\n @d_fixture.destroy\n\n respond_to do |format|\n #format.html { redirect_to d_fixtures_url }\n #format.json { head :ok }\n format.html { redirect_to :action => \"index\",:input_ymd => @input_ymd }\n format.json { head :ok }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def delete\n \n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def delete(action, **args); end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def destroy\n @out.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @bodily_output.destroy\n respond_to do |format|\n format.html { redirect_to bodily_outputs_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def delete\n\n end",
"def delete\n \n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n Todo.find(params[:id]).destroy\n render :json => {:message => \"Record deleted\", :item_id => params[:id]}\n end",
"def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end",
"def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @normal_example = NormalExample.find(params[:id])\n @normal_example.destroy\n\n respond_to do |format|\n format.html { redirect_to(normal_examples_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @file_example.destroy\n respond_to do |format|\n format.html { redirect_to file_examples_url, notice: 'File example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def input(request)\n @j_del.handle(request._to_java_request)\n end",
"def destroy\n Field.where(unique_id: params[:unique_id]).destroy_all\n respond_to do |format|\n format.html { redirect_to '/dashboard', notice: 'Form was successfully deleted.' }\n end\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete(name)\n\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def delete\n api(\"Delete\")\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end"
] |
[
"0.7373269",
"0.7045474",
"0.69982064",
"0.69982064",
"0.69982064",
"0.68879783",
"0.6537254",
"0.6522398",
"0.6506208",
"0.6461221",
"0.6440606",
"0.64076704",
"0.6401998",
"0.6374614",
"0.63727653",
"0.63696504",
"0.63326794",
"0.63042337",
"0.62839556",
"0.6283335",
"0.62770057",
"0.62419677",
"0.62325686",
"0.62184685",
"0.61892873",
"0.6188991",
"0.6173615",
"0.61727494",
"0.6168652",
"0.6134256",
"0.61221164",
"0.60924363",
"0.60865426",
"0.607128",
"0.6069198",
"0.6066518",
"0.6062833",
"0.6054033",
"0.60509974",
"0.60488987",
"0.6041573",
"0.6037546",
"0.60341793",
"0.6031772",
"0.6026589",
"0.60166264",
"0.6005412",
"0.6004333",
"0.59962165",
"0.5995497",
"0.59765005",
"0.5954799",
"0.59386605",
"0.5915192",
"0.59059227",
"0.5900528",
"0.5900528",
"0.58979094",
"0.58918846",
"0.5881764",
"0.587109",
"0.587109",
"0.587109",
"0.587109",
"0.58670074",
"0.5864498",
"0.5864064",
"0.58622986",
"0.585179",
"0.5847816",
"0.58390504",
"0.58387166",
"0.58384764",
"0.58369255",
"0.58329076",
"0.58329076",
"0.58329076",
"0.58329076",
"0.58329076",
"0.58329076",
"0.58329076",
"0.583255",
"0.58311754",
"0.5827563",
"0.58264184",
"0.58249587",
"0.5822754",
"0.58085823",
"0.5807805",
"0.58077663",
"0.58076173",
"0.57998145",
"0.579851",
"0.5797187",
"0.5796919",
"0.5796258",
"0.57938695",
"0.57935417",
"0.5791378",
"0.5791378"
] |
0.73094314
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_input
@input = Input.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def input_params
params.require(:input).permit(:key, :frameRate, :resolution, :aspectRatio, :interlaced, :container, :job_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def url_whitelist; end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.62905645",
"0.6289235",
"0.6283876",
"0.62425834",
"0.62410337",
"0.6218672",
"0.62151134",
"0.62096137",
"0.6192354",
"0.6178057",
"0.6177618",
"0.61727077",
"0.6162073",
"0.6152049",
"0.61515594",
"0.61458135",
"0.6122875",
"0.61165285",
"0.6107696",
"0.6104097",
"0.6091097",
"0.6080201",
"0.60699946",
"0.6063739",
"0.60206395",
"0.60169303",
"0.60134894",
"0.601003",
"0.6007347",
"0.6007347",
"0.6001054",
"0.59997267",
"0.5997844",
"0.5991826",
"0.5991213",
"0.59911627",
"0.5980111",
"0.5967009",
"0.59597385",
"0.5958542",
"0.595787",
"0.5957425",
"0.59522784",
"0.5951228",
"0.59423685",
"0.5939385",
"0.5939122",
"0.5939122",
"0.59325653",
"0.5930178",
"0.59248054",
"0.59243476",
"0.59164625",
"0.59106",
"0.59101933",
"0.59084356",
"0.5905666",
"0.58975077",
"0.58974737",
"0.5895128",
"0.58946574",
"0.589308",
"0.58916",
"0.5885987",
"0.58838505",
"0.58792",
"0.58723736",
"0.58684355",
"0.58677715",
"0.5865701",
"0.5865538",
"0.5865288",
"0.586385",
"0.5862139",
"0.58614355",
"0.58593005",
"0.5857459",
"0.58541363",
"0.58536613",
"0.58520085",
"0.585011"
] |
0.0
|
-1
|
def create_unique_identifier self.id = SecureRandom.uuid create_unique_identifier if self.class.exists?(:id => self.id) end
|
def detect_carrier_add_info
ups = Regexp.new(/^(1Z?[0-9A-Z]{3}?[0-9A-Z]{3}?[0-9A-Z]{2}?[0-9A-Z]{4}?[0-9A-Z]{3}?[0-9A-Z]|[\dT]\d\d\d?\d\d\d\d?\d\d\d)$/i)
usps = Regexp.new(/(\b\d{30}\b)|(\b91\d+\b)|(\b\d{20}\b)/i)
usps2 = Regexp.new(/^(E\D{1}\d{9}\D{2}$|9\d{15,21})$/i)
usps3 = Regexp.new(/^91[0-9]+$/i)
usps4 = Regexp.new(/^[A-Za-z]{2}[0-9]+US$/i)
fedex = Regexp.new(/\b((96\d\d\d\d\d ?\d\d\d\d|96\d\d) ?\d\d\d\d ?\d\d\d\d( ?\d\d\d)?)\b/i)
fedex2 = Regexp.new(/(\b96\d{20}\b)|(\b\d{15}\b)|(\b\d{12}\b)/i)
fedex3 = Regexp.new(/\b((98\d\d\d\d\d?\d\d\d\d|98\d\d) ?\d\d\d\d ?\d\d\d\d( ?\d\d\d)?)\b/i)
fedex4 = Regexp.new(/^[0-9]{15}$/i)
self.carrier = "UPS" if ups.match(self.number)
self.carrier = "USPS" if usps.match(self.number) or usps2.match(self.number) or usps3.match(self.number) or usps4.match(self.number)
self.carrier = "FedEx" if fedex.match(self.number) or fedex2.match(self.number) or fedex3.match(self.number) or fedex4.match(self.number)
self.update_track_info
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def assign_identifier\n self.id ||= SecureRandom.uuid\n end",
"def create_uuid_for_id\n if self.id.nil?\n self.id = SecureRandom.uuid\n #self.id = SecureRandom.uuid.gsub('-','').upcase\n end\n end",
"def create_guid\n self.id ||= UUIDTools::UUID.random_create.to_s\n end",
"def identify!\n self.id ||= SecureRandom.uuid\n end",
"def set_identifier\n self.identifier ||= SecureRandom.uuid\n end",
"def generate_uid\n begin\n # .uuid or .hex? both seem to do the same job\n self.uid = SecureRandom.uuid.gsub(/[-]/, '')\n end while self.class.exists?(uid: self.uid)\n end",
"def set_id\n self.id = SecureRandom.random_number(9223372036854775807)\n end",
"def assign_uuid\n self.id = UUIDTools::UUID.timestamp_create().to_s\n end",
"def create_guid\n self.guid = SecureRandom.uuid\n end",
"def create_unique_id\n\t\tself.unique_id = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64\n\t\t\tbreak random_token unless User.exists?(unique_id: random_token)\n\t\tend\n\tend",
"def generate_id\n Util::UUID.generate\n end",
"def set_uuid\n self.id ||= SecureRandom.uuid\n end",
"def set_uuid\n self.id = SecureRandom.uuid\n end",
"def set_unique_id\n self.update_column(:unique_id, Digest::MD5.hexdigest(self.id.to_s+Time.now.to_s))\n end",
"def create_uuid\n self.uuid = SecureRandom.hex(12)\n end",
"def create_uuid\n SecureRandom.uuid\n end",
"def generate_new_id\n Util::UUID.generate\n end",
"def unique_identifier\n @u_id ||= \"T1\"\n @u_id = @u_id.succ\n end",
"def generate_id \n end",
"def generate_unique_id\n \"1.3.6.1.4.1.21367.2009.5.14.#{id}.#{Time.now.to_i}\"\n end",
"def new_id\n SecureRandom.uuid\n end",
"def unique_id\n # Consider using SecureRandom.hex here, and benchmark which one is better\n (Time.now.to_f * 1000).to_i.to_s(36) + rand(1_000_000).to_s(36)\n end",
"def assign_uuid\n self.uuid ||= SecureRandom.urlsafe_base64(8)\n end",
"def generate_new_id\n UUIDTools::UUID.random_create.to_s\n end",
"def generate_id()\n return nil unless @name and @represents\n @id ||= Digest::SHA1.hexdigest(@name + @represents)[0..5].force_encoding('utf-8').to_s\n end",
"def assign_uuid\n self.uuid ||= \"_#{SecureRandom.uuid.tr('-', '_')}\"\n end",
"def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end",
"def populate_uuid\n self.uuid = SecureRandom.uuid()\n end",
"def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end",
"def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end",
"def add_uuid\n self.uuid ||= UUIDTools::UUID.timestamp_create().to_s\n end",
"def generate_uuid\n# self[:uuid] = UUID.sha1_create(UUID_OID_NAMESPACE, Time.now.utc.to_f.to_s).to_s\n end",
"def generate_id\n id_generator.call\n end",
"def generate_id\n SecureRandom.hex(8)\n end",
"def create_new_id\n @new_session = true\n self.class.generate_unique_id\n end",
"def gen_id\n SecureRandom.hex(32)\n end",
"def create_uuid\n if self.uuid.nil?\n valid_uid = false\n until valid_uid\n self.uuid = format_uuid(SecureRandom.hex(5))\n valid_uid = Voucher.find_by_uuid(self.uuid).nil?\n self.slug = self.uuid\n end\n end\n end",
"def unique_id\n $unique_id_increment = ($unique_id_increment || 0) + 1\n return (Time.new.to_f * 1000).to_i.to_s + $unique_id_increment.to_s\nend",
"def unique_id #:nodoc:\n @unique_id = (@unique_id || 0) + 1\n end",
"def generate_id\n SecureRandom.urlsafe_base64 21\n end",
"def generate_uuid\n return Digest::MD5.hexdigest \"#{SecureRandom.hex(10)}-#{DateTime.now.to_s}\"\nend",
"def set_uuid\n self.uuid = SecureRandom.uuid\n end",
"def set_uuid\n self.uuid = SecureRandom.uuid\n end",
"def generate_id\n id = @id\n @id += 1\n id\n end",
"def set_uuid\n self.uuid ||= SecureRandom.uuid\n end",
"def make_foreign_ID\r\n loop do\r\n ret = rand(2 ** 16) | rand(2 ** 16) << 16\r\n return ret if ret != @id\r\n end\r\n return 0\r\n end",
"def newId\r\n @seed = @seed + 1\r\n \"X#{@seed}\"\r\n end",
"def generate_ids\n uuid = UUID.new\n self.id = uuid.generate\n end",
"def uuid() = @uuid ||= SecureRandom.uuid",
"def generate_guid\n begin\n guid = SecureRandom.urlsafe_base64\n end while Person.where(:guid => guid).exists?\n self.guid = guid\n end",
"def generate_guid\n begin\n guid = SecureRandom.urlsafe_base64\n end while Person.where(:guid => guid).exists?\n self.guid = guid\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def generate_identifier\n self.identifier = Digest::MD5.hexdigest(\"PersonRecordIdentifier#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end",
"def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end",
"def uuid\n SecureRandom.uuid\nend",
"def unique_id\n id || @generated_dom_id || (@generated_dom_id = Time.now.to_f.to_s.gsub('.', '_'))\n end",
"def get_random_identifier\n SecureRandom.hex\n end",
"def generate_id\n @mutex.synchronize { @current_id += 1 }\n end",
"def identifier\n SecureRandom.hex(16)\n end",
"def new_resource_id!\n uuid = Viziwiki::new_uuid\n # TODO write lock with create only\n #do\n # uuid = Viziwiki::new_uuid\n #unless lock_resource (uuid)\n uuid\n end",
"def set_random_uuid\n self.uuid = SecureRandom.uuid\n end",
"def unique_id\n id = ::SecureRandom.uuid\n\n while ::Voltron::Temp.exists?(uuid: id) do\n id = ::SecureRandom.uuid\n end\n\n id\n end",
"def set_id\n\t\t\trand(111111111...999999999)\n\t\tend",
"def id_generator\n @id_generator ||= proc { SecureRandom.uuid }\n end",
"def get_new_uuid\n uuid = UUID.new\n return uuid.generate\n end",
"def before_create\n self[:GUID] = SecureRandom.uuid\n super\n end",
"def initialize\n @uuid = \"_\" + UUID.new.generate\n end",
"def generate_uid\n random_uid = rand(1000000000)\n if(HardwareItem.where(uid: random_uid)).any?\n generate_uid\n else\n random_uid\n end\n end",
"def unique_id\n object_id.abs.to_s(16)\n end",
"def basic_generate_id(str); end",
"def id_generator; end",
"def ensure_hash_id\n self.hash_id ||= unique_random_string_of_length(75 + Random.rand(26))\n end",
"def create_sha1_id\n self.sha1_id = Digest::SHA1.hexdigest(\"#{self.id}-#{self.contactable_type}-#{self.contactable_id}\")\n end",
"def generate_unique_name\n SecureRandom.uuid\n end",
"def generate_uuid\n if [nil, \"\"].include?(uuid)\n self.uuid = Vidibus::Uuid.generate\n end\n end",
"def create_new_id\n require 'securerandom'\n begin\n # by OpenSSL, or system provided entropy pool\n session_id = SecureRandom.hex(16)\n rescue NotImplementedError\n # never happens on modern systems\n require 'digest'\n d = Digest('SHA512').new\n now = Time::now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('foobar')\n session_id = d.hexdigest[0, 32]\n end\n session_id\n end",
"def assign_uuid\n self.uuid = UUIDTools::UUID.random_create.to_s\n self.document_number ||= Numerator.get_number\n end",
"def unique_id\n '%8x%s@%s' % [\n Time.now.to_i,\n Digest::SHA1.hexdigest(\n '%.8f%8x' % [ Time.now.to_f, rand(1 << 32) ]\n )[0, 32],\n Socket.gethostname\n ]\n end",
"def generate_uuid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n self.uuid = (0..UUID_LEN-1).collect { chars[Kernel.rand(chars.length)] }.join\n end",
"def generate_record_id\n @client_id + '-' + SecureRandom.uuid\n end",
"def _new_id\n @lock.synchronize do\n begin\n # Generate a random number. It's recommended to not store more than\n # 2**62 objects in the same store.\n id = rand(2**64)\n # Ensure that we don't have already another object with this ID.\n end while @in_memory_objects.include?(id) || @db.include?(id)\n\n id\n end\n end",
"def generate_uuid\n UUIDTools::UUID.random_create.to_s\n end",
"def assign_uid\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a\n uid = ''\n 1.upto(8) {\n i = rand(62)\n uid += chars[i]\n }\n self.uid = uid\n end",
"def generate_id(str); end",
"def random_uid\n SecureRandom.hex 5\n end",
"def create_random_tag_identifier\n if self.tag_identifier.nil?\n self.tag_identifier = SecureRandom.hex(6) # Generate a 12 character long random number\n end\n end",
"def gen_uid\n \"#{rand(100000)}-#{Time.now.to_i}-#{rand(100000)}\"\n end",
"def random_id\n rand(1000000) + 20000\nend",
"def unique_identifier\n Digest::SHA1.hexdigest (\"#{self.screen_name}:#{self.password}\")\n end",
"def UUID()\n uuid=SecureRandom.base64(32).gsub(\"/\",\"_\").gsub(/=+$/,\"\")\n end",
"def generate_serial_number\n self.serial_number = SecureRandom.uuid \n generate_serial_number if Product.find_by(serial_number: serial_number)\n\tend",
"def globally_unique_identifier\n super\n end",
"def generate_identity\n self.uid ||= OpenSSL::Random.random_bytes(16).unpack('H*').first\n self.secret ||= OpenSSL::Random.random_bytes(32).unpack('H*').first\n true\n end",
"def make_id\n new_id = @id\n @id += 1\n new_id\n end",
"def uuid\n abort_if_unsaved!\n\n model_name = self.class.to_s\n model_id = self.id\n\n uuid = Uuidify::Uuid.where(:model_name => model_name, :model_id => model_id).first\n\n if uuid.nil?\n new_uuid = UUIDTools::UUID.timestamp_create\n new_uuid = Uuidify::Uuid.uuid_to_sql_string(new_uuid)\n\n uuid = Uuidify::Uuid.create(:model_name => model_name, :model_id => self.id, :model_uuid => new_uuid)\n uuid.save!\n end\n\n Uuidify::Uuid.uuid_from_sql_string(uuid.model_uuid)\n end",
"def random_id\n \"#{('a'..'z').to_a.sample}-#{SecureRandom.alphanumeric(6)}\"\n end",
"def get_uuid\n rand_str = SecureRandom.hex\n timestamp = Time.now.to_i.to_s\n\n rand_str + timestamp\n end",
"def set_guid\n \tif self.guid.nil?\n \t\t# we have a create (to whom ever is reading this, I am sure I could use something like before_create instead, but I prefer this more controlled method)\n \t\tself.guid = Digest::MD5.hexdigest(\"#{uid}--#{Time.now.to_i}\")\n \t\tend\n end",
"def randomize_id\n begin\n self.id = SecureRandom.hex 5\n end while ItAsset.where(id: self.id).exists?\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{email}:#{password}\")\n end"
] |
[
"0.88206416",
"0.8664946",
"0.8613676",
"0.84424555",
"0.83321255",
"0.8260802",
"0.8228165",
"0.8225536",
"0.81548965",
"0.8125494",
"0.81214863",
"0.80941576",
"0.8077767",
"0.8049113",
"0.8032952",
"0.8001731",
"0.7998111",
"0.7955172",
"0.7881562",
"0.7876293",
"0.78601193",
"0.78456295",
"0.7842361",
"0.78292686",
"0.779598",
"0.7779918",
"0.7678942",
"0.76759094",
"0.7665702",
"0.7665702",
"0.76473844",
"0.76244813",
"0.7618847",
"0.7598031",
"0.75825703",
"0.75813633",
"0.7577398",
"0.75692034",
"0.75439775",
"0.75421286",
"0.7514604",
"0.750884",
"0.750884",
"0.7491872",
"0.74672204",
"0.74655366",
"0.7461526",
"0.7456132",
"0.7430085",
"0.7427415",
"0.7427415",
"0.7422454",
"0.7422454",
"0.7416888",
"0.740407",
"0.7389662",
"0.73789865",
"0.7375042",
"0.73424786",
"0.7335014",
"0.7331565",
"0.73284304",
"0.7328381",
"0.7314967",
"0.73137677",
"0.73122907",
"0.7310288",
"0.73079073",
"0.72990304",
"0.7295475",
"0.7294044",
"0.7282571",
"0.7269993",
"0.7264433",
"0.72510713",
"0.7233626",
"0.7228275",
"0.722707",
"0.72256804",
"0.7212506",
"0.72055274",
"0.7201669",
"0.7201508",
"0.7177463",
"0.71697474",
"0.71620923",
"0.715863",
"0.7148245",
"0.70890933",
"0.70876145",
"0.7085863",
"0.7077209",
"0.70601124",
"0.7056089",
"0.70527005",
"0.7051251",
"0.70419174",
"0.702655",
"0.7021156",
"0.7007496",
"0.7004493"
] |
0.0
|
-1
|
This method keeps executing the block called by yield until the block stops raising an error OR until x tries
|
def retry_before_failing
sleeping(NODE_QUERY_WAIT_TIME).seconds.between_tries.failing_after(MAX_NODE_QUERY_RETRIES).tries do
yield
end
yield
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def yield\n wait\n case result\n when Exception\n raise result\n else\n result\n end\n end",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def attempt(times, &block)\n n = times\n result = nil\n begin\n result = block.call(self) unless block.nil?\n rescue Exception => ex\n times -= 1\n retry if times >= 0\n raise ex\n end\n result\n end",
"def trythreetimes\n tries = 0\n begin\n yield\n rescue Exception => e \n tries += 1\n logger \"Error: #{e.message}\"\n if tries < 3\n logger \"Waiting 5 seconds and trying again...\"\n sleep(5)\n retry\n end\n logger \"Giving up and ending program!\"\n abort\n end\nend",
"def wait_for(&block)\n Retriable.retriable tries: 15, base_interval: 0.05, max_interval: 1.second do\n raise \"Exceeded max retries while waiting for block to pass\" unless block.call\n end\n end",
"def keep_trying_till_true timeout = 30\n t_begin = Time.now\n delay = 10\n loop do\n if yield\n break\n elsif (Time.now - t_begin) > timeout\n fail \"Timeout after trying for #{timeout} seconds\"\n else\n sleep delay\n end\n delay += 1\n end\nend",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def retro(tries, *args)\n tries = tries.to_i\n return false if tries == 0 || ! block_given?\n yield(*args)\n return true\n rescue Exception\n sleep(1)\n if (tries = tries - 1) > 0\n retry\n else\n return false\n end\n end",
"def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n tries > 0 ? retry : raise\n end\n end",
"def retry_block_until_true\n (0..RETRY_COUNT).each do\n return if yield\n sleep RETRY_STEP\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end",
"def one\n too { yield }\nendbegin;1;rescue => e1;e1;end",
"def error_handler(*args)\r\n puts \"1. Doing this, then yielding to the block\"\r\n yield\r\n # The following will run only if there wasn't an error.\r\n # Otherwise, we move straight to +rescue+\r\n puts \"3b. The block has finished running without an error\"\r\nrescue StandardError => ex\r\n puts ex.message\r\n puts \"4. If an error was raised, we retry this entire method, so ..\\n\"\r\n retry\r\nend",
"def retry_action (initial_wait_time_in_seconds=3, max_attempts=3, &block)\n num_tries = 0\n wait_time = 1\n successful = false\n\n while (num_tries <= max_attempts && !successful)\n begin\n block.call\n successful = true\n rescue StandardError => ex\n num_tries += 1\n wait_time *= initial_wait_time_in_seconds\n sleep(wait_time)\n end\n end\n end",
"def retry_on_uniqueness_violation(&block)\n if raises_uniqueness_violation?(&block)\n yield\n end\n end",
"def may_fail # block\n begin\n yield\n rescue\n end\nend",
"def try_three_times\n tries = 0\n begin\n yield\n rescue Exception => e\n tries += 1\n @log.error(\"Error: #{e.message}\")\n if tries < 3\n @log.error(\"Trying again\")\n retry\n end\n @log.error(\"Tried 3 times without success, aborting.\")\n return nil\n end\n end",
"def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end",
"def run\n return yield if turned_off?\n\n with_connection do\n if open?\n callback&.call CircuitOpen.new\n raise CircuitOpen\n end\n\n begin\n result = yield\n rescue Exception => error\n if exceptions.any? { |watched| error.is_a?(watched) }\n increment_counter!\n callback&.call error\n else\n reset_counter!\n end\n\n raise error\n end\n\n reset_counter!\n result\n end\n ensure\n reset_record\n end",
"def try\n if block_given?\n yield\n else\n puts 'no block'\n end\nend",
"def ensure(&block)\n raise \"catch or each must be called before ensure\" unless @used\n block.call\n raise_if_failures\n end",
"def with_limited_retry(opts)\n tries = opts.fetch :tries\n exceptions = Array(opts.fetch(:exceptions))\n\n return if tries == 0\n\n begin\n yield\n rescue *exceptions\n Chef::Log.warn('Bad response, try again...')\n if (tries -= 1) > 0\n sleep 1\n retry\n end\n end\n end",
"def retry_on_fail(args, &blk)\n success = FALSE\n if args[:times].respond_to?(:times) and block_given?\n args[:times].times do |i|\n begin\n blk.call\n success = TRUE\n break\n rescue\n puts \"An error was encountered evaluating block. Retrying..\"\n end\n end\n else\n fail \"retry_on_fail requires and arg (:times => x) where x is an Integer/Fixnum, and a block to execute\"\n end\n fail \"Block failed maximum of #{args[:times]} tries. Exiting..\" unless success\nend",
"def raise_hand\n 10.times do\n super\n end\n\n #times needs a do loop\n end",
"def f\n # This calls the block:\n yield == 2 or raise\n yield == 2 or raise\n end",
"def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend",
"def try &bk\n yield\n rescue Exception => ex\n ex\n end",
"def retry_on_transient_error\n (options.retry_count.to_i + 1).times do |n|\n logger.debug \"Attempt ##{n}\"\n begin\n result = yield\n rescue Fog::Compute::AWS::Error => e\n sleep_seconds = options.retry_interval * (n+1)\n logger.warn \"Received AWS error: #{e}\"\n logger.warn \"Sleeping #{sleep_seconds} seconds before retrying\"\n sleep sleep_seconds\n else\n return result\n end\n end\n nil\n end",
"def retryable(retries, delay)\r\n yield\r\n rescue *RETRYABLE_EXCEPTIONS.call\r\n raise unless (retries -= 1) > 0\r\n\r\n sleep(delay)\r\n retry\r\n end",
"def retry_until_ok(&block)\n # Lock usage:\n # 1. @stop.mutex\n\n begin\n yield block\n rescue OplogException, StaleCursorException\n raise\n rescue => e\n @logger.error \"#{@name}: #{get_full_exception_msg(e)}\"\n sleep @err_retry_interval\n\n do_stop = @stop.use { |stop, mutex| stop }\n if do_stop then\n raise RetryFailedException.new(e)\n else\n retry\n end\n end\n end",
"def throw_catch_example\n catch (:end_prematurely) do\n (0..100).each do |x|\n (0..100).each do |y|\n (0..100).each do |z|\n # When the following conditions hold, this will end the loop\n # as it will go the catch line above\n throw :end_prematurely if x == 9 && y == 9 && z > 10\n puts \"x: #{x} y: #{y} z: #{z}\"\n end\n end\n end\n end\nend",
"def __force__\n @mutex.synchronize do\n if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n begin\n @result = @block.call\n rescue ::Exception => e\n @error = e\n end\n end\n end if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n # BasicObject won't send raise to Kernel\n @error.equal?(NOT_SET) ? @result : ::Kernel.raise(@error)\n end",
"def x\n # ...\nrescue\n # ...\nend",
"def keep_trying_to(title)\n begin\n yield\n rescue Exception => e\n log \"failed to #{title} -- retry in #{RETRY_WAIT} seconds\"\n log e.message\n log e.backtrace\n sleep RETRY_WAIT\n retry\n end\n end",
"def retry_block(attempts: 1, sleep_for: 0.5)\n begin\n yield\n rescue Capybara::ElementNotFound => ex\n if attempts > 0\n attempts -= 1\n sleep(sleep_for)\n retry\n else\n raise ex\n end\n end\n end",
"def wait_for(waiting_message = 'something to happen')\n 30.times do\n ret = yield\n return ret if ret\n sleep 0.3\n end\n assert false, \"waiting for #{waiting_message} was not successful\"\n end",
"def execute\n @mutex.synchronize do\n loop do\n if @count < @maximum\n @count += 1\n Thread.new do\n @tg.add Thread.current\n yield\n @mutex.synchronize { @count -= 1 }\n @continue.signal\n end\n return\n else\n @continue.wait(@mutex)\n end\n end\n end\n end",
"def protected_yield\n value = if timer\n timeout_protected_yield{ yield }\n else\n yield\n end\n fulfill(value)\n rescue Exception => err\n self.class.set_backtrace(err)\n reject(err)\n end",
"def many(&block)\n return false unless try(&block)\n while try(&block); end\n true\n end",
"def wait(max_wait_minutes: 60)\n\t\t\t[3, 5, 7, 15, 30, [60] * (max_wait_minutes - 1)].flatten.each do |sec|\n\t\t\t\tbegin\n\t\t\t\t\tresult = yield\n\t\t\t\t\treturn result if result\n\t\t\t\t\tLog.warn{ \"Received result is not truthy: #{result}.\" }\n\t\t\t\t\tLog.warn{ \"Retry request in #{sec} seconds.\" }\n\t\t\t\t\tsleep sec\n\t\t\t\trescue Jenkins2::NotFoundError, Jenkins2::ServiceUnavailableError => e\n\t\t\t\t\tLog.warn{ \"Received error: #{e}.\" }\n\t\t\t\t\tLog.warn{ \"Retry request in #{sec} seconds.\" }\n\t\t\t\t\tsleep sec\n\t\t\t\tend\n\t\t\tend\n\t\t\tLog.error{ \"Tired of waiting (#{max_wait_minutes} minutes). Give up.\" }\n\t\t\tnil\n\t\tend",
"def wait_until\n until yield\n wait\n end\n end",
"def yield_rescued\n begin\n yield\n rescue Exception => e\n MONITORING_LOG.error e\n end\n end",
"def sleep_before_retry_on_limit_error\n sleep 15\n end",
"def on_retries_exhausted(&block)\n @retries_exhausted_handler = block\n end",
"def block_try2(num)\n yield\n puts \"do fourth. num is [#{num}]\"\nend",
"def wait_while\n while yield\n wait\n end\n end",
"def sample()\n begin\n puts \"do something\"\n rescue # can define type of error here if wanted\n puts \"we hit an error!\"\n retry # this will restart from the beginning of the begin body\n else\n puts \"else hit\"\n ensure\n puts \"ensure this please\"\n end\nend",
"def wait_until(timeout=10, &block)\n time = Time.now\n success = false\n until success\n if (Time.now - time) >= timeout\n raise \"Waited for #{timeout} seconds, but block never returned true\"\n end\n sleep 0.5\n success = yield\n end\n end",
"def compute_f_e(yielded, &block)\n return block.(yielded) if block_given?\n\n do_not_exist.nil? NameError\n rescue \n\n block.nil?\nend",
"def wait_until iterations = 100\n count = 0\n loop do\n raise \"criteria not met\" if count >= iterations\n break if yield\n sleep 0.0001\n count += 1\n end\n end",
"def wait_until\n until yield\n\twait\n end\n end",
"def retry_infinitely\n Observable.rescue_error(enumerator_repeat_infinitely(self))\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue Java::JavaSql::SQLException => e\n raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def test_exceptions\n pool = ThreadPool.new(10)\n\n deep_exception_block = lambda do |count|\n next raise Exception.new if ( count < 1 )\n pool.future(count-1, &deep_exception_block).value\n end\n\n assert_raises(Exception) do\n pool.future(2, &deep_exception_block).value\n end\n\n end",
"def retry_on_windows\n return yield unless windows?\n\n begin\n yield\n rescue SystemCallError\n sleep 0.1\n yield\n end\n end",
"def timeout_safe # :block\n error_n = 0\n begin\n $stderr.puts(\" try get same page again...\") if error_n > 0\n yield\n rescue Errno::EBADF, Timeout::Error\n error_n += 1\n error_name = $!.class.to_s\n if error_n >= 3\n $stderr.puts \"#{error_name} ERROR #3\"\n raise $!\n end\n sleep_for = error_n * 5\n $stderr.puts \"#{error_name} ERROR ##{error_n}, sleep #{sleep_for} seconds before next attempt\"\n sleep sleep_for\n retry\n end\nend",
"def bad\n i = 0\n begin\n if i < 10\n while i < 20\n i += 2\n end\n end\n rescue => ex\n raise \"failure is an option\"\n end\n i\nend",
"def wait_while\n while yield\n wait\n end\n end",
"def wait_until\n until yield\n wait\n end\n end",
"def expect_with_retry attempts: 5\n attempt_number ||= 0\n yield\n rescue RSpec::Expectations::ExpectationNotMetError\n attempt_number += 1\n retry if attempt_number < attempts\n raise\n end",
"def retry\n attempts = 0\n\n while true\n begin\n yield\n rescue Aws::Core::Client::NetworkError, Aws::S3::Errors::InternalError\n attempts += 1\n break if attempts >= RETRIES\n STDERR.puts \"Transfer failed, retrying (#{attempts} of #{RETRIES})\"\n next\n else\n break\n end\n end\n\n if attempts >= RETRIES\n STDERR.puts \"Transfer permanently failed. Giving up.\"\n end\n end",
"def wait_while\n while yield\n\twait\n end\n end",
"def use_blocker\n blocker do\n # next\n # break\n # return\n \"HA!\"\n # next\n # break\n # return\n end\n puts \"DONE!\"\nend",
"def trap_error(&block)\n time_secs = 0\n begin\n fail \"\\nERROR: #{e}\\n\" if time_secs > 5.0\n yield\n rescue Capybara::ElementNotFound => e\n fail \"\\nCapybara::ElementNotFound => #{e}\\n\"\n rescue Selenium::WebDriver::Error::StaleElementReferenceError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n rescue Selenium::WebDriver::Error::ObsoleteElementError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n end\n end",
"def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end",
"def retry_execution(retry_message, times = AgentConfig.max_packages_install_retries)\n count = 0\n success = false\n begin\n count += 1\n success = yield\n @audit.append_info(\"\\n#{retry_message}\\n\") unless success || count > times\n end while !success && count <= times\n success\n end",
"def waitUntil\n until yield\n sleep 0.5\n end\nend",
"def retry_block(n = MAX_NODE_QUERY_RETRIES, &block)\n begin\n block.call\n rescue Selenium::WebDriver::Error::StaleElementReferenceError, Capybara::TimeoutError, Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError, Capybara::Driver::Webkit::NodeNotAttachedError\n if (n -= 1) >= 0\n sleep(30 / (n + 1))\n retry\n else\n raise\n end\n end\nend",
"def working\n waiting.invert\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def retry_command\n (0..RETRY_COUNT).each do\n begin\n out = yield\n rescue Puppet::ExecutionFailure => e\n Puppet.debug \"Command failed: #{e.message}\"\n sleep RETRY_STEP\n else\n return out\n end\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end",
"def call\n [false, yield]\n rescue halt => e\n [true, e.payload[0]]\n end",
"def do_yield(&block)\n begin\n block.call\n rescue Exception => e\n puts \"Exception! #{e.to_s}\"\n Rails.logger.error \"Caught exception: #{e.to_s}\"\n raise e\n end\n end",
"def wait_for(wait_max: 3, step: 0.001, &block)\n stop_at = wait_max.seconds.from_now\n\n sleep step while !block.call && (@time = Time.now) < stop_at\n\n fail \"Timeout of #{wait_max} seconds exceeded!\" unless @time < stop_at\nend",
"def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end",
"def if_ready\n error = @target + @period - Time.now\n if error <= 0\n @target += @period\n elapsed = Time.now - @time_start\n yield elapsed\n end\n end",
"def waiting actual\n interval = 0.5\n i = 0\n while true\n if actual == yield\n return 'true!!'\n end\n i += interval\n puts '.'\n sleep i\n end\n 'false!!'\nend",
"def ret_block\n x = 1\n y = 2\n z = 3\n yield(x,y,z)\n yield(x)\n yield(x,x,x,x)\n yield([x,y,z])\nend",
"def ts_retry(attempts=1, &block)\n attempt = 0\n \n begin\n yield block\n rescue RSpec::Expectations::ExpectationNotMetError => e\n attempt += 1\n if attempt > attempts\n raise e\n else\n sleep 0.5\n retry\n end\n end\n end",
"def block_try1(num, &block)\n block.call\n puts \"do second. num is [#{num}]\"\nend",
"def execute_and_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend",
"def with_error_handling\n return_value = yield\n @retry_count = 0\n return_value\n\n rescue PG::Error => e\n if recoverable_error?(e.message) && @retry_count < @max_retries\n @retry_count += 1\n sleep_time = sleep_time_for_error(e.message)\n log \"Failed with recoverable error (#{e.class}): #{e.message}\"\n log \"Retry attempt #{@retry_count} will occur after #{sleep_time} seconds\"\n sleep sleep_time\n retry\n\n else\n @retry_count = 0\n @error_occurred = true\n log \"An error occurred (#{e.class}): #{e.message}\"\n\n if @print_backtrace_for_all_errors || !error_backtrace_is_not_helpful?(e.class)\n log e.backtrace.join(\"\\n\")\n end\n raise e if @abort_on_error\n end\n end",
"def retry!\n raise 'Not implemented!'\n end",
"def watch_yield\n current = currently_loaded_files\n new_exceptions = Array.new\n begin\n result = yield\n rescue Interrupt, SystemExit\n raise\n rescue Exception => e\n new_exceptions << e\n run_hook :on_exception, e\n exceptions << e\n # cross-drb exceptions are broken w.r.t. #backtrace_locations. It\n # returns a string in their case. Since it happens only on\n # exceptions that originate from the server (which means a broken\n # Roby codepath), let's just ignore it\n if !e.backtrace_locations.kind_of?(String)\n backtrace = e.backtrace_locations.map { |l| Pathname.new(l.absolute_path) }\n else\n STDERR.puts \"Caught what appears to be a cross-drb exception, which should not happen\"\n STDERR.puts e.message\n STDERR.puts e.backtrace.join(\"\\n \")\n backtrace = Array.new\n end\n error_paths.merge(backtrace)\n if e.kind_of?(LoadError) && e.path\n error_paths << Pathname.new(e.path)\n end\n end\n required_paths.merge(currently_loaded_files - current)\n return result, new_exceptions\n end",
"def with_connection\n tries = 0\n\n @locket.synchronize do\n begin\n tries += 1\n yield(socket)\n rescue IOError, Errno::EPIPE, Errno::ECONNREFUSED, InvalidResponse, Timeout::Error, Riemann::Client::TcpSocket::Error\n close\n raise if tries > 3\n retry\n rescue Exception\n close\n raise\n end\n end\n end",
"def each_invalid_attempt(&block)\n invalid_attempts.each(&block)\n end",
"def with_connection\n tries = 0\n \n @locket.synchronize do\n begin\n tries += 1\n yield (@socket || connect)\n rescue IOError => e\n raise if tries > 3\n connect and retry\n rescue Errno::EPIPE => e\n raise if tries > 3\n connect and retry\n rescue Errno::ECONNREFUSED => e\n raise if tries > 3\n connect and retry\n rescue Errno::ECONNRESET => e\n raise if tries > 3\n connect and retry\n rescue InvalidResponse => e\n raise if tries > 3\n connect and retry\n end\n end\n end",
"def each_attempt(&block)\n @attempts.each(&block)\n end",
"def regardless(&block)\n yield\nrescue\nend",
"def run_while!\n\n before_run\n\n i=1\n\n while yield i do\n\n break if maximum_round? i\n\n before_round i\n\n if i == 1\n # some things are different for the first round, namely nodes with activation = start\n run_first_round!\n else\n run_round!\n end\n\n after_round i\n i+=1\n end\n\n after_run\n\n self\n\n end",
"def protected_yield\n if env[TIMER]\n timeout_protected_yield{ yield }\n else\n yield\n end\n rescue Exception => e\n mutex.synchronize do\n self.class.set_backtrace(e)\n if done? # log user callback error\n callback_error(e)\n else # IOError, SystemCallError, etc\n begin\n rejecting(e) # would call user callback\n rescue Exception => f # log user callback error\n callback_error(f){ self.class.set_backtrace(f) }\n end\n end\n end\n end",
"def wait(key, &cantwait_proc)\n yield(key) if block_given?\n end",
"def with_connection\n tries = 0\n\n @locket.synchronize do\n tries += 1\n yield(socket)\n rescue IOError, Errno::EPIPE, Errno::ECONNREFUSED, InvalidResponse, Timeout::Error,\n Riemann::Client::TcpSocket::Error\n close\n raise if tries > 3\n\n retry\n rescue StandardError\n close\n raise\n end\n end",
"def blocks() end",
"def wait_until times: 5, delay: 1, &condition\n times.times do\n return if condition.call\n sleep delay\n end\n raise \"Condition not met. Waited #{times} times with #{delay} sec delay\"\n end",
"def retry_on_error(retry_count, &block)\n block.call\n rescue ActiveRecord::StatementInvalid\n # cope with \"Mysql2::Error: Deadlock found ...\" exception\n if retry_count > 0\n sleep 0.2\n retry_count -= 1\n puts \"Retry trade execution (#{retry_count} retry left) ..\"\n retry\n else\n puts \"Failed to execute trade: #{@payload.inspect}\"\n raise $!\n end\n end",
"def block_call\n expect :iter\n self[1]\n end",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def with_retry\n count = 0\n loop do\n response = yield\n if response.code == 403 && response['error'].any? { |e| e['error'] == 'too many requests' }\n count += 1\n delay = 2 ** count\n warn \"too many requests, sleeping for #{delay} seconds\"\n sleep delay\n else\n return response\n end\n end\n end"
] |
[
"0.68544537",
"0.62551033",
"0.6200858",
"0.61955667",
"0.6190527",
"0.6157277",
"0.6101941",
"0.6101917",
"0.60656345",
"0.6043565",
"0.5938724",
"0.58524466",
"0.58451563",
"0.5836433",
"0.5821255",
"0.57782334",
"0.57695735",
"0.57585835",
"0.5751813",
"0.5751484",
"0.574585",
"0.5741678",
"0.57416004",
"0.57218915",
"0.5713313",
"0.57112676",
"0.57078516",
"0.56976783",
"0.56557316",
"0.5642807",
"0.56355006",
"0.56324834",
"0.56246436",
"0.56201684",
"0.5613847",
"0.557439",
"0.5566401",
"0.5548066",
"0.554407",
"0.55427146",
"0.55408704",
"0.5532339",
"0.5530075",
"0.55245674",
"0.55234957",
"0.55157673",
"0.55063325",
"0.5491799",
"0.54865193",
"0.548602",
"0.5483962",
"0.5451848",
"0.54514104",
"0.544423",
"0.5443593",
"0.5438582",
"0.54334533",
"0.54290694",
"0.54272777",
"0.53977734",
"0.53907526",
"0.53881353",
"0.538505",
"0.53844756",
"0.5383843",
"0.53807414",
"0.53763914",
"0.5368512",
"0.5365783",
"0.5351889",
"0.53489655",
"0.5345876",
"0.5340014",
"0.5336732",
"0.5329126",
"0.5310424",
"0.5305743",
"0.5304954",
"0.5303084",
"0.5299319",
"0.5297314",
"0.5295184",
"0.52856296",
"0.5281302",
"0.5278815",
"0.52749056",
"0.526963",
"0.52695817",
"0.5264623",
"0.5260021",
"0.5254563",
"0.5247519",
"0.5240295",
"0.5237844",
"0.5234293",
"0.5232529",
"0.5231211",
"0.5231211",
"0.5231211",
"0.52272654"
] |
0.58023244
|
15
|
===================== METHOD MISSING =====================
|
def method_missing(name, *args, &block)
query_without_question_mark = /^has_(?<name>.+)_(?<type>#{ ELEMENT_TYPES })$/.match(name)
element_query = /^has_(?<name>.+)_(?<type>#{ ELEMENT_TYPES })\??$/.match(name)
element_find = /^(?<name>.+)_(?<type>#{ ELEMENT_TYPES })$/.match(name)
element_action = /^(?<action>click|fill_in|select|check)_(?<name>.+)_(?<type>#{ ELEMENT_TYPES })/.match(name)
if element_action
raise "Undefined method '#{ element_action[0] }'. Maybe you mean " +
"#{ self.class }##{ element_action['name'] }_#{ element_action['type'] }.#{ element_action['action'] }?"
elsif query_without_question_mark
q = query_without_question_mark
raise "#{ self.class} doesn't have a method named has_#{ q['name'] }_#{ q['type'] }. " +
"Try using 'has_#{ q['name'] }_#{ q['type'] }?' (with a trailing question mark) instead."
elsif element_query
raise_missing_element_declaration_error(element_query['name'], element_query['type'])
elsif element_find
raise_missing_element_declaration_error(element_find['name'], element_find['type'])
else
super name, args, block
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def refutal()\n end",
"def custom; end",
"def custom; end",
"def private_method\n end",
"def internal; end",
"def verdi; end",
"def suivre; end",
"def missing; end",
"def terpene; end",
"def wrapper; end",
"def operations; end",
"def operations; end",
"def weber; end",
"def berlioz; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def who_we_are\r\n end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def identify; end",
"def missing?; end",
"def extra; end",
"def ext; end",
"def ext; end",
"def zuruecksetzen()\n end",
"def operation; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def ibu; end",
"def initialize\n\n end",
"def initialize\n\n end",
"def external; end",
"def handle; end",
"def rossini; end",
"def villian; end",
"def formation; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def implemented_in; end",
"def r; end",
"def r; end",
"def public_method; end",
"def isolated; end",
"def isolated; end",
"def public; end",
"def public; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def available; end",
"def available; end",
"def overrides; end",
"def run; end",
"def run; end"
] |
[
"0.8158372",
"0.6998841",
"0.6998841",
"0.6998841",
"0.6998841",
"0.6942656",
"0.68572104",
"0.68572104",
"0.6855099",
"0.66887444",
"0.66706777",
"0.66706777",
"0.6620674",
"0.6608984",
"0.64553",
"0.644933",
"0.6438362",
"0.6405859",
"0.6332852",
"0.6294089",
"0.6294089",
"0.6282389",
"0.62820137",
"0.626419",
"0.626419",
"0.626419",
"0.626419",
"0.62467664",
"0.6236437",
"0.6236437",
"0.6236437",
"0.6236437",
"0.6236437",
"0.6236437",
"0.6236437",
"0.6236437",
"0.6233429",
"0.62302893",
"0.6211453",
"0.6197763",
"0.6197763",
"0.61950743",
"0.6145635",
"0.61444217",
"0.61444217",
"0.61444217",
"0.61444217",
"0.6125253",
"0.61109",
"0.61109",
"0.6110497",
"0.6104553",
"0.6103365",
"0.609526",
"0.6094937",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.6086887",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60768056",
"0.60766196",
"0.60741615",
"0.60741615",
"0.6072072",
"0.60622215",
"0.60622215",
"0.60619444",
"0.60619444",
"0.6056997",
"0.6056997",
"0.6056997",
"0.6056997",
"0.6056997",
"0.6056997",
"0.6056997",
"0.6056997",
"0.6056997",
"0.6056997",
"0.6056262",
"0.6056262",
"0.60545856",
"0.6053423",
"0.6053423"
] |
0.0
|
-1
|
Retry block for node.find method above.
|
def retry_block(n = MAX_NODE_QUERY_RETRIES, &block)
begin
block.call
rescue Selenium::WebDriver::Error::StaleElementReferenceError, Capybara::TimeoutError, Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError, Capybara::Driver::Webkit::NodeNotAttachedError
if (n -= 1) >= 0
sleep(30 / (n + 1))
retry
else
raise
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def retry_before_failing\n sleeping(NODE_QUERY_WAIT_TIME).seconds.between_tries.failing_after(MAX_NODE_QUERY_RETRIES).tries do\n yield\n end\n yield\n end",
"def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n tries > 0 ? retry : raise\n end\n end",
"def retry_block(attempts: 1, sleep_for: 0.5)\n begin\n yield\n rescue Capybara::ElementNotFound => ex\n if attempts > 0\n attempts -= 1\n sleep(sleep_for)\n retry\n else\n raise ex\n end\n end\n end",
"def retry_block_until_true\n (0..RETRY_COUNT).each do\n return if yield\n sleep RETRY_STEP\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end",
"def retry\n self.solved(:retry)\n end",
"def wait_for(&block)\n Retriable.retriable tries: 15, base_interval: 0.05, max_interval: 1.second do\n raise \"Exceeded max retries while waiting for block to pass\" unless block.call\n end\n end",
"def try_again(hostname)\n mirror = Mirror.find_by_hostname hostname\n\n if mirror\n mirror.tasks.each do |task|\n task.block = false\n task.save\n end\n\n puts \"done (unblocked)\"\n else\n puts \"hostname not found\"\n end\n\n nil\nend",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def retry\n super\n end",
"def source_find_by_id_fail(source, id, timeout=nil)\r\n timeout = normalize_timeout(timeout)\r\n\r\n for i in 1..timeout\r\n begin\r\n source.find_by_id(id)\r\n rescue\r\n return\r\n end\r\n\r\n sleep(1)\r\n end\r\n\r\n raise \"Found element \\\"\" + id + \"\\\" which was not supposed to exist\"\r\n end",
"def retry_until_ok(&block)\n # Lock usage:\n # 1. @stop.mutex\n\n begin\n yield block\n rescue OplogException, StaleCursorException\n raise\n rescue => e\n @logger.error \"#{@name}: #{get_full_exception_msg(e)}\"\n sleep @err_retry_interval\n\n do_stop = @stop.use { |stop, mutex| stop }\n if do_stop then\n raise RetryFailedException.new(e)\n else\n retry\n end\n end\n end",
"def retry_transaction(&block)\n tries = 3\n begin\n yield\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique\n tries -= 1\n if tries > 0\n retry\n else\n raise\n end\n end\n end",
"def retry!\n raise 'Not implemented!'\n end",
"def retry_until\n if @retry == 0\n job = yield\n else\n begin\n job = yield\n rescue DRMAA::DRMAATryLater\n STDERR.puts \"... sleeping\"\n sleep @retry\n retry\n end\n end\n return job\n end",
"def retry_query\n Rails.logger.info('Retrying EDS Search')\n @attempts += 1\n search(@query[:term], @query[:profile], @query[:facets],\n @query[:page], @query[:per_page])\n end",
"def working\n waiting.invert\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def keep_trying_to(title)\n begin\n yield\n rescue Exception => e\n log \"failed to #{title} -- retry in #{RETRY_WAIT} seconds\"\n log e.message\n log e.backtrace\n sleep RETRY_WAIT\n retry\n end\n end",
"def retryable(&block)\n RetryableRecord.retry(self, &block)\n end",
"def with_retries(&block)\n base_sleep_seconds = 0.5\n max_sleep_seconds = 300 # 5 minutes\n\n # Let's do this thing\n attempts = 0\n\n begin\n attempts += 1\n return block.call(attempts)\n\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EHOSTUNREACH,\n Errno::ENETDOWN, Errno::ENETUNREACH, Errno::ETIMEDOUT, Timeout::Error => ex\n\n raise ex if attempts >= 100\n\n # The sleep time is an exponentially-increasing function of base_sleep_seconds.\n # But, it never exceeds max_sleep_seconds.\n sleep_seconds = [base_sleep_seconds * (2 ** (attempts - 1)), max_sleep_seconds].min\n # Randomize to a random value in the range sleep_seconds/2 .. sleep_seconds\n sleep_seconds = sleep_seconds * (0.5 * (1 + rand()))\n # But never sleep less than base_sleep_seconds\n sleep_seconds = [base_sleep_seconds, sleep_seconds].max\n\n warn \"Failed to connect: #{ex}. Retrying in #{sleep_seconds.round(1)} seconds.\"\n\n snooze(sleep_seconds)\n\n retry\n end\n end",
"def set_timeout\n @not_found = true\n Timeout::timeout(@timeout) do\n while @not_found\n find_server!\n sleep(WAIT)\n end\n end\n rescue Timeout::Error => e\n raise Monga::Exceptions::Disconnected.new \"Can't find appropriate server (all disconnected)\"\n end",
"def find_with_rpc_failed\n rpc_failed('Find failed')\n end",
"def find(&block)\n return nil unless valid?\n @hops.find(&block)\n end",
"def timeout_safe # :block\n error_n = 0\n begin\n $stderr.puts(\" try get same page again...\") if error_n > 0\n yield\n rescue Errno::EBADF, Timeout::Error\n error_n += 1\n error_name = $!.class.to_s\n if error_n >= 3\n $stderr.puts \"#{error_name} ERROR #3\"\n raise $!\n end\n sleep_for = error_n * 5\n $stderr.puts \"#{error_name} ERROR ##{error_n}, sleep #{sleep_for} seconds before next attempt\"\n sleep sleep_for\n retry\n end\nend",
"def attempt_fetch_supernodes\n interval = 10 # inital interval\n incr = 30 # Incrementation\n sns = fetch_supernodes\n while sns.empty?\n Routing.log {|logger| logger.error(self.class) { \"No supernode. Retry in #{interval} seconds\"}}\n Thread.current.sleep(interval)\n interval += incr\n sns = fetch_supernodes\n end\n sns\n end",
"def rescue_connection_failure(max_retries=60)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n puts ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\nend",
"def retry_command\n (0..RETRY_COUNT).each do\n begin\n out = yield\n rescue Puppet::ExecutionFailure => e\n Puppet.debug \"Command failed: #{e.message}\"\n sleep RETRY_STEP\n else\n return out\n end\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end",
"def retry_change_requests; end",
"def retry_change_requests; end",
"def _reconnect()\r\n num_nodes = @nodes.size\r\n attempts = 0\r\n new_node_id = @node_id\r\n while attempts < num_nodes\r\n new_node_id = (new_node_id + 1) % num_nodes\r\n new_node = @nodes[new_node_id]\r\n connection = nil\r\n begin\r\n connection = _make_connection(new_node.host, new_node.socket_port)\r\n @request_count = 0\r\n return new_node_id, connection\r\n rescue SocketError => message\r\n _close_socket(connection)\r\n connection.close\r\n $LOG.warn(\"Error connecting to node #{new_node_id}: #{message}\")\r\n attempts += 1\r\n end\r\n end\r\n\r\n # If we get here all nodes have failed us, explode\r\n raise VoldemortException.new('Connections to all nodes failed.')\r\n end",
"def try(&block)\n begin\n yield\n rescue Errno::ETIMEDOUT, Timeout::Error, Net::HTTPNotFound\n log \"Connection Error\"\n rescue Exception => exc\n log exc.message\n log exc.backtrace\n end\n end",
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue Java::JavaSql::SQLException => e\n raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def lock_timeout_retries; end",
"def retro(tries, *args)\n tries = tries.to_i\n return false if tries == 0 || ! block_given?\n yield(*args)\n return true\n rescue Exception\n sleep(1)\n if (tries = tries - 1) > 0\n retry\n else\n return false\n end\n end",
"def with_retry(cluster, retries = cluster.max_retries, &block)\n begin\n block.call\n rescue Errors::ConnectionFailure => e\n if retries > 0\n Loggable.warn(\" BONES-RPC:\", \"Retrying connection attempt #{retries} more time(s).\", \"n/a\")\n sleep(cluster.retry_interval)\n cluster.refresh\n with_retry(cluster, retries - 1, &block)\n else\n raise e\n end\n end\n end",
"def retry_action (initial_wait_time_in_seconds=3, max_attempts=3, &block)\n num_tries = 0\n wait_time = 1\n successful = false\n\n while (num_tries <= max_attempts && !successful)\n begin\n block.call\n successful = true\n rescue StandardError => ex\n num_tries += 1\n wait_time *= initial_wait_time_in_seconds\n sleep(wait_time)\n end\n end\n end",
"def check_table_row_does_not_exist(id, columns, timeout=nil, recurse=true)\r\n begin\r\n page_all_xpath(\"//table[@id='\" + id + \"']/tbody/tr\").each do |row|\r\n found = { }\r\n columns.keys.sort.each do |index|\r\n found[index] = false\r\n row.all(:xpath, \"./td[\" + index + \"]/div[text()='\" + columns[index] + \"']\").each do |column|\r\n found[index] = true\r\n break\r\n end\r\n row.all(:xpath, \"./td[\" + index + \"]/div/span[text()='\" + columns[index] + \"']\").each do |column|\r\n found[index] = true\r\n break\r\n end\r\n end\r\n\r\n missingAny = false\r\n found.keys.each do |index|\r\n if not found[index]\r\n missingAny = true\r\n break\r\n end\r\n end\r\n\r\n if not missingAny\r\n # I only want to sleep if the initial check doesn't work, because it slows down the tests\r\n if (recurse)\r\n timeout = normalize_timeout(timeout)\r\n sleep(timeout)\r\n check_table_row_does_not_exist(id, columns, timeout, false)\r\n else\r\n raise \"Found row in table \\\"\" + id + \"\\\" that is not supposed to exist: \" + columns.inspect\r\n end\r\n end\r\n end\r\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\r\n retry\r\n end\r\n end",
"def attempt(times, &block)\n n = times\n result = nil\n begin\n result = block.call(self) unless block.nil?\n rescue Exception => ex\n times -= 1\n retry if times >= 0\n raise ex\n end\n result\n end",
"def find\n fail NotImplementedError\n end",
"def sleep_before_retry_on_limit_error\n sleep 15\n end",
"def trap_error(&block)\n time_secs = 0\n begin\n fail \"\\nERROR: #{e}\\n\" if time_secs > 5.0\n yield\n rescue Capybara::ElementNotFound => e\n fail \"\\nCapybara::ElementNotFound => #{e}\\n\"\n rescue Selenium::WebDriver::Error::StaleElementReferenceError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n rescue Selenium::WebDriver::Error::ObsoleteElementError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n end\n end",
"def fail!(discriminator, bantime, findtime, maxretry); end",
"def retry!\n raise RetryMessage\n end",
"def fail!(discriminator, bantime, findtime, maxretry)\n count = cache.count(\"#{key_prefix}:count:#{discriminator}\", findtime)\n if count >= maxretry\n ban!(discriminator, bantime)\n end\n # we may not block them this time, but they're banned for next time\n false\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue NativeException => e\n raise unless e.message =~ /^java\\.sql\\.SQLException: (Closed Connection|Io exception:|No more data to read from socket)/\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def retry\n self.class.enqueue(\n object,\n method_name,\n *(args << {\n :job_options => {\n :parent_id => parent_id || id,\n :run_at => Time.now + times_failed ** 4,\n :priority => priority\n }\n })\n )\n end",
"def find\n debugger\n self.lost = false\n debugger\n end",
"def retry_on_transient_error\n (options.retry_count.to_i + 1).times do |n|\n logger.debug \"Attempt ##{n}\"\n begin\n result = yield\n rescue Fog::Compute::AWS::Error => e\n sleep_seconds = options.retry_interval * (n+1)\n logger.warn \"Received AWS error: #{e}\"\n logger.warn \"Sleeping #{sleep_seconds} seconds before retrying\"\n sleep sleep_seconds\n else\n return result\n end\n end\n nil\n end",
"def retry_on_error(retry_count, &block)\n block.call\n rescue ActiveRecord::StatementInvalid\n # cope with \"Mysql2::Error: Deadlock found ...\" exception\n if retry_count > 0\n sleep 0.2\n retry_count -= 1\n puts \"Retry trade execution (#{retry_count} retry left) ..\"\n retry\n else\n puts \"Failed to execute trade: #{@payload.inspect}\"\n raise $!\n end\n end",
"def reload_pool_nodes(raise_error)\n @mutex.synchronize do\n reload_pool_nodes_unsync(raise_error)\n end\n end",
"def lock_timeout_retry_delay; end",
"def retry_read(original_error, session, server_selector, failed_server: nil, &block)\n begin\n server = select_server(cluster, server_selector, session, failed_server)\n rescue Error, Error::AuthError => e\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n \n log_retry(original_error, message: 'Read retry')\n \n begin\n yield server, true\n rescue *retryable_exceptions => e\n e.add_notes('modern retry', 'attempt 2')\n raise e\n rescue Error::OperationFailure, Error::PoolError => e\n e.add_note('modern retry')\n unless e.write_retryable?\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n e.add_note(\"attempt 2\")\n raise e\n rescue Error, Error::AuthError => e\n e.add_note('modern retry')\n original_error.add_note(\"later retry failed: #{e.class}: #{e}\")\n raise original_error\n end\n end",
"def save_with_retry\n tries ||= 3\n save\n\n rescue Errno::ECONNRESET, Net::ReadTimeout, Net::OpenTimeout => e\n raise e if tries == 0\n tries -= 1\n sleep(3)\n retry\n end",
"def wait *xpaths, &block\n #todo 3 raise_if_site_too_slow if respond_to?(:raise_if_site_too_slow)\n common_wait *xpaths, &block\n end",
"def aws_wait_for_peers\n loop do\n aws_find_peers\n\n Chef::Log.info(\"etcd_service[#{ new_resource.name }] Found \"\\\n \"#{ new_resource.peers.length + 1 }/#{ new_resource.quorum } AWS \"\\\n \"peers, #{ active_peers.length } active\")\n\n break if new_resource.peers.length >= (new_resource.quorum - 1)\n break if active_peers.length > 0\n sleep 5\n end\n end",
"def retrieve_db(attempt = 0)\n require 'rubygems'\n require 'mongo'\n\n begin\n Mongo::MongoClient.new(\n @new_resource.connection['host'],\n @new_resource.connection['port'],\n :connect_timeout => 15,\n :slave_ok => true\n )\n rescue Mongo::ConnectionFailure => e\n if(attempt) < @new_resource.connection['user_management']['connection']['retries']\n Chef::Log.warn(\"Unable to connect to MongoDB instance, retrying in #{@new_resource.connection['user_management']['connection']['delay']} second(s)...\")\n sleep(@new_resource.connection['user_management']['connection']['delay'])\n retrieve_db(attempt + 1)\n end\n end\nend",
"def retry_action_with_scroll_down\n tries ||= 2\n yield\nrescue Capybara::ElementNotFound, Selenium::WebDriver::Error::UnknownError\n navigation.scroll_down\n retry unless (tries -= 1).zero?\nend",
"def run_nonblock(&block)\n @timeout = 0\n run &block\n end",
"def attempt(block)\n # Returning self will allow chaining calls\n return self unless block\n return block.call unless AttemptThis.enabled?\n\n apply_defaults\n\n # Retriable attempts require special error handling\n result = each_retriable_attempt do\n return attempt_with_reset(&block)\n end\n\n # Final attempt\n if (result != :empty)\n @delay_policy.call unless result == :skipped\n final_attempt(&block)\n end\n end",
"def retry_request(http, *args)\n 5.times do\n begin\n return http.send(:send_request, *args)\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH\n Chef::Log.debug('couchdb connection failed')\n end\n sleep 1\n end\n Chef::Log.debug('failed to connect to couchdb after 5 tries ... failing chef run')\n fail 'unable to connect to couchdb'\n end",
"def find_with_timeout(timeout_in_seconds, *loc_args)\n timeout = timeout_in_seconds.to_s.match(/^of_(\\d+)_second.*$/).captures[0].to_f\n the_locator, *the_hash = loc_args\n start_time = Time::now ; n_attempts = 0\n while all(the_locator, the_hash).count == 0 && ((Time::now - start_time) <= timeout) # in seconds\n n_attempts += 1\n end\n p elapsed_time = Time::now - start_time\n p n_attempts\n if elapsed_time <= timeout then\n p \"found \"+loc_args.to_s\n else raise loc_args.to_s+\" not found\" end\n find(the_locator, the_hash)\nend",
"def redd_try(tries = 0)\n tries += 1\n yield\n rescue ::Redd::Error::InvalidOAuth2Credentials\n puts $ERROR_INFO.inspect, $ERROR_POSITION\n raise if tries > TRY_LIMIT\n reconnect\n sleep(30 * (tries**2))\n retry\n rescue ::Redd::Error::RateLimited => error\n puts \"Rate Limited by Reddit #{error.time}\"\n sleep(error.time)\n retry\n rescue ::Redd::Error => error\n # 5-something errors are usually errors on reddit's end.\n puts $ERROR_INFO.inspect\n raise error unless (500...600).cover?(error.code)\n retry\n rescue ::Faraday::SSLError\n puts $ERROR_INFO.inspect\n retry\n rescue ::Faraday::ConnectionFailed\n puts $ERROR_INFO.inspect, $ERROR_POSITION\n retry\n end",
"def need_rerun(node, path)\n # provide a way to evaluate and set node attributes at runtime\n failed_locks = Proc.new { node['locking_resource']['failed_locks'] }\n failed_locks_set = Proc.new do |key, val|\n node.normal['locking_resource']['failed_locks'][key] = val\n end\n\n if failed_locks.call.fetch(path, false)\n failed_locks_set.call(path,\n 'time' => failed_locks.call[path]['time'],\n 'fails' => failed_locks.call[path]['fails'] + 1)\n else\n failed_locks_set.call(path, 'time' => Time.now, 'fails' => 1)\n end\n\n failed_locks.call[path]\n end",
"def on_error_retry_delay(_exception)\n nil\n end",
"def waiting\n jobs.where(started_working_at: nil)\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def run_job(job, node)\r\n\t\t\treturn if @shutdown\r\n\t\t\tretries = 0\r\n\t\t\r\n\t\t\tbegin\r\n\t\t\t\treturn if @shutdown\r\n\t\t\t\tklass = job.class_name.constantize\r\n\t\t\t\traise NoClassError.new(\"Job cannot find class #{job.inspect}.\") if klass.to_s.empty?\r\n\t\t\t\t\r\n\t\t\t\tjob_args = YAML::load(job.yaml_args)\r\n\t\t\t\tmethod, url_args = klass.get_url(job_args)\r\n\t\t\t\t\r\n\t\t\t\t# If a hash is passed as the 2nd argument, it's a request that pulls armory data\r\n\t\t\t\tdoc, raw_xml = SystemTimer.timeout(LOCAL_TIMEOUT.to_i) do\r\n\t\t\t\t\tdoc, raw_xml = node.pull_data(job, job_args, url_args)\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif doc.blank? || raw_xml.blank?\r\n\t\t\t\t\tjob.unlock\r\n\t\t\t\t\treturn nil\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tklass.send(method, job_args, doc, raw_xml)\r\n\t\t\t\tRails.cache.delete(\"lock/#{job.id}\")\r\n\t\t\t\t\r\n\t\t\t\tif Rails.cache.read(\"maint/#{job.region}\")\r\n\t\t\t\t\ttotal = Rails.cache.read(\"maint/#{job.region}\") - 1\r\n\t\t\t\t\tRails.cache.write(\"maint/#{job.region}\", total, :expires_in => 15.minutes)\r\n\t\t\t\t\tif total <= 0\r\n\t\t\t\t\t\tRails.cache.delete(\"maint/#{job.region}\")\r\n\t\t\t\t\t\tRails.cache.delete(\"maint/checks\")\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\tjob.delete\r\n\t\t\t\treturn true\r\n\t\t\t# Shouldn't happen\r\n\t\t\trescue Errno::ECONNRESET => e\r\n\t\t\t\tsay \"#{self.name}: Connection reset by peer\"\r\n\t\t\t\tjob.unlock\r\n\t\t\t# These are bad, it means something is wrong with a node\r\n\t\t\trescue Timeout::Error, SocketError, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EHOSTUNREACH, Errno::ENETUNREACH => e\r\n\t\t\t\tsay \"#{self.name}: Timeout error #{e.message}\"\r\n\r\n\t\t\t\t# Not as accurate as increment, but increment isn't working correctly\r\n\t\t\t\ttotal = (Rails.cache.read(\"maint/#{job.region}\").to_i + 1)\r\n\t\t\t\tRails.cache.write(\"maint/#{job.region}\", total, :expires_in => 15.minutes)\r\n\t\t\t\tRails.cache.delete(\"maint/checks\") if total == 25\r\n\r\n\t\t\t\tjob.unlock\r\n\t\t\t# Armory temporarily unavailable, not too big of a deal\r\n\t\t\trescue TemporarilyUnavailableError => e\r\n\t\t\t\tsay \"#{job.region && job.region.upcase || \"??\"} Armory temporarily unavailable (#{e.message}) (try ##{job.retries}, #{node.last_url})\"\r\n\t\t\t\tif e.message =~ /503/\r\n\t\t\t\t\t# Not as accurate as increment, but increment isn't working correctly\r\n\t\t\t\t\ttotal = (Rails.cache.read(\"maint/#{job.region}\").to_i + 1)\r\n\t\t\t\t\tRails.cache.write(\"maint/#{job.region}\", total, :expires_in => 15.minutes)\r\n\t\t\t\t\tRails.cache.delete(\"maint/checks\") if total == 25\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\t# At >= 5 retries, do a priority bump\r\n\t\t\t\tjob.retries ||= 0\r\n\t\t\t\tjob.retries += 1\r\n\t\t\t\tif job.retries >= 5\r\n\t\t\t\t\tjob.retries = 0\r\n\t\t\t\t\tjob.bump_priority\r\n\t\t\t\telse\r\n\t\t\t\t\tjob.save\r\n\t\t\t\t\tjob.unlock\r\n\t\t\t\tend\r\n\r\n\t\t\t# Failure in parsing the armory\r\n\t\t\trescue ArmoryParseError => e\r\n\t\t\t\tsay \"Armory error in #{job.class_name}, #{e.message} for #{job.bnet_id}\"\r\n\t\t\t\tArmory::Error.new(:region => job.region, :error_type => e.message, :class_name => job.class_name, :bnet_id => job.bnet_id).save\r\n\t\t\t\tif e.message == \"maintenance\"\r\n\t\t\t\t\t# Not as accurate as increment, but increment isn't working correctly\r\n\t\t\t\t\ttotal = (Rails.cache.read(\"maint/#{job.region}\").to_i + 1)\r\n\t\t\t\t\tRails.cache.write(\"maint/#{job.region}\", total, :expires_in => 15.minutes)\r\n\t\t\t\t\tRails.cache.delete(\"maint/checks\") if total == 25\r\n\t\t\t\t\r\n\t\t\t\t\tif job.retries >= 100\r\n\t\t\t\t\t\tRails.cache.delete(\"lock/#{job.id}\")\r\n\t\t\t\t\t\tjob.delete\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tjob.bump_priority\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\t\tjob.delete\r\n\t\t\t\tend\r\n\t\t\trescue ActiveRecord::StatementInvalid => e\r\n\t\t\t\tlog_exception(job, node, \"SQL Exception\", e)\r\n\t\t\t\tjob.unlock\r\n\t\t\t# Generic catch-all\r\n\t\t\trescue Exception => e\r\n\t\t\t\tlog_exception(job, node, \"Exception\", e)\r\n\t\t\t\t\r\n\t\t\t\tjob.retries ||= 0\r\n\t\t\t\tjob.retries += 1\r\n\t\t\t\t\r\n\t\t\t\tif job.retries >= 50 || RAILS_ENV != \"production\"\r\n\t\t\t\t\tRails.cache.delete(\"lock/#{job.id}\")\r\n\t\t\t\t\tjob.delete\r\n\t\t\t\telsif job.retries >= 10\r\n\t\t\t\t\tjob.bump_priority\r\n\t\t\t\telse\r\n\t\t\t\t\tjob.save\r\n\t\t\t\t\tjob.unlock\r\n\t\t\t\tend\r\n\t\t\tend\r\n\r\n\t\t\tRails.cache.delete(\"lock/#{job.id}\")\r\n\t\t\treturn nil\r\n\t\tend",
"def find_with_sleep\n sleep(request.sleep || 1)\n response.name = 'Request should have timed out'\n end",
"def retry_on_uniqueness_violation(&block)\n if raises_uniqueness_violation?(&block)\n yield\n end\n end",
"def check_table_row_exists(id, columns, timeout=nil, recurse=true)\r\n begin\r\n page_all_xpath(\"//table[@id='\" + id + \"']/tbody/tr\").each do |row|\r\n found = { }\r\n columns.keys.sort.each do |index|\r\n found[index] = false\r\n row.all(:xpath, \"./td[\" + index + \"]/div[text()='\" + columns[index] + \"']\").each do |column|\r\n found[index] = true\r\n break\r\n end\r\n row.all(:xpath, \"./td[\" + index + \"]/div/span[text()='\" + columns[index] + \"']\").each do |column|\r\n found[index] = true\r\n break\r\n end\r\n end\r\n\r\n missingAny = false\r\n found.keys.each do |index|\r\n if not found[index]\r\n missingAny = true\r\n break\r\n end\r\n end\r\n\r\n if not missingAny\r\n return\r\n end\r\n end\r\n\r\n # I only want to sleep if the initial check doesn't work, because it slows down the tests\r\n if (recurse)\r\n timeout = normalize_timeout(timeout)\r\n sleep(timeout)\r\n check_table_row_exists(id, columns, timeout, false)\r\n else\r\n raise \"Did not find expected row in table \\\"\" + id + \"\\\": \" + columns.inspect\r\n end\r\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\r\n retry\r\n end\r\n end",
"def retry_method(retry_time=1.minute)\n log(:info, \"Retrying in #{retry_time} seconds\")\n $evm.root['ae_result'] = 'retry'\n $evm.root['ae_retry_interval'] = retry_time\n exit MIQ_OK\n end",
"def wait_until(timeout = 30, retry_interval = 0.1, &block)\n start = Time.now\n while (result = !block.call)\n break if (Time.now - start).to_i >= timeout\n sleep(retry_interval)\n end\n !result\nend",
"def prop_find_node(prop_find, node)\n if node.is_a?(IProperties)\n property_names = prop_find.load_404_properties\n if property_names.any?\n node_properties = node.properties(property_names)\n property_names.each do |property_name|\n if node_properties.include?(property_name)\n prop_find.set(property_name, node_properties[property_name], 200)\n end\n end\n end\n end\n end",
"def retry_job\n # get items\n query = AnalysisJobsItem.failed_for_analysis_job(id)\n\n # batch update\n query.find_in_batches(batch_size: AnalysisJob.batch_size) do |items|\n items.each(&:retry!)\n end\n end",
"def long_wait_for_element(yaml_data_key, times = 6)\n how = get_yaml_data( yaml_data_key, 0 )\n what = get_yaml_data( yaml_data_key, 1 )\n e = nil\n times.times do\n # note that find-element auto-waits\n begin\n e = $driver.find_element(how, what)\n rescue Exception => error\n $debug and print \"Got exception in long_wait_for_element: #{error}\\n\"\n end\n if e and e.displayed?\n $debug and print \"element in long_wait_for_element: #{e.inspect}\\n\"\n break\n end\n $debug and print \"waiting in long_wait_for_elemnt\\n\"\n\n sleep 10\n end\n e.should be_displayed\n return e\n end",
"def process_find_and_replace(params)\n\t\tresponse = find_and_replace(params)\n\t\tresult = json_to_hash(response.body)\n\t\tkey = result[:id]\n\t\tfinished = false\n\t\twhile finished == false\n\t\t\tsleep 2\n\t\t\tresponse = find_and_replace_status(key)\n\t\t\tresult = json_to_hash(response.body)\n\t\t\tputs result[:status]\n\t\t\tfinished = result[:finished]\n\t\tend\n\t\tresponse\n\tend",
"def with_limited_retry(opts)\n tries = opts.fetch :tries\n exceptions = Array(opts.fetch(:exceptions))\n\n return if tries == 0\n\n begin\n yield\n rescue *exceptions\n Chef::Log.warn('Bad response, try again...')\n if (tries -= 1) > 0\n sleep 1\n retry\n end\n end\n end",
"def retryable(retries, delay)\r\n yield\r\n rescue *RETRYABLE_EXCEPTIONS.call\r\n raise unless (retries -= 1) > 0\r\n\r\n sleep(delay)\r\n retry\r\n end",
"def retry\n attempts = 0\n\n while true\n begin\n yield\n rescue Aws::Core::Client::NetworkError, Aws::S3::Errors::InternalError\n attempts += 1\n break if attempts >= RETRIES\n STDERR.puts \"Transfer failed, retrying (#{attempts} of #{RETRIES})\"\n next\n else\n break\n end\n end\n\n if attempts >= RETRIES\n STDERR.puts \"Transfer permanently failed. Giving up.\"\n end\n end",
"def lock_timeout_retries=(_arg0); end",
"def legacy_read_with_retry(session, server_selector, &block)\n attempt = attempt ? attempt + 1 : 1\n yield select_server(cluster, server_selector, session)\n rescue *retryable_exceptions, Error::OperationFailure, Error::PoolError => e\n e.add_notes('legacy retry', \"attempt #{attempt}\")\n \n if is_retryable_exception?(e)\n raise e if attempt > client.max_read_retries || session&.in_transaction?\n elsif e.retryable? && !session&.in_transaction?\n raise e if attempt > client.max_read_retries\n else\n raise e\n end\n \n log_retry(e, message: 'Legacy read retry')\n sleep(client.read_retry_interval) unless is_retryable_exception?(e)\n retry\n end",
"def findExistingPieces\n id = returnAndIncrRequestId\n return id if @state == :after_stop\n @requests.push [id, :find_existing]\n @requestsSemaphore.signal\n id\n end",
"def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end",
"def find\n loop do \n @mutex.lock\n begin\n deactivate_field\n self.infinite_list_passive = block_given?\n self.crc = true\n self.parity = true\n activate_field\n tag = detect\n deselect\n ensure\n @mutex.unlock\n end\n if block_given?\n resp = yield tag\n if resp == false\n return tag\n end\n else\n return tag\n end\n end\n ensure \n @mutex.lock\n deactivate_field\n self.infinite_list_passive = false\n deselect\n @mutex.unlock \n end",
"def without_reconnect(&block); end",
"def keep_trying_till_true timeout = 30\n t_begin = Time.now\n delay = 10\n loop do\n if yield\n break\n elsif (Time.now - t_begin) > timeout\n fail \"Timeout after trying for #{timeout} seconds\"\n else\n sleep delay\n end\n delay += 1\n end\nend",
"def retry_request\n # Explore persistent connections from within AWS\n s3_conn = EM::HttpRequest.new(\"http://#{@bucket}.s3.amazonaws.com\")\n req_method = @req_options[:method]\n s3_req = s3_conn.send(req_method, @req_options)\n s3_req.callback{|cli|\n if cli.response_header.http_status < 500\n @cb.call cli.response, cli.response_header.http_status if @cb\n self.succeed cli.response, cli.response_header.http_status\n else # Some S3 issue\n self.fail cli.response, cli.response_header.http_status\n end\n }\n s3_req.errback{|cli|\n self.fail nil, nil\n }\n end",
"def find list, &block\n list.find &block\nend",
"def try_for(timeout = 30, polling_interval = 1, &block)\n start_time = Time.now\n last_error = nil\n until (duration = Time.now - start_time) > timeout\n begin\n yield\n last_error = nil\n return true\n rescue => e\n last_error = e\n end\n sleep polling_interval\n end\n raise \"Timeout after #{duration.to_i} seconds with error: #{last_error}.\" if last_error\n raise \"Timeout after #{duration.to_i} seconds.\"\n end",
"def search\n prepare_search\n catch :success do\n # Main iteration loop\n @max_iterations.times do |iteration|\n begin # RuntimeError rescue block\n # At the start of each iteration\n prepare_each_run\n if @banned_points.has_key?(path.last) && path.size == 1\n throw :success\n end\n debug_each_iteration iteration\n going = catch :keep_going do\n message = catch :jump_back do\n # cost_vector is a list of all adjacent points with their \n # respective costs\n candidate_list = get_candidate_list\n begin # IndexError rescue block\n # If we've run out of all possible points, step back and keep \n # trying. Only works when candidate_list#size is the largest\n # dimension, i.e., for a normal Array of NArrays. For NArray, \n # #size gives the total number of elements.\n if @interval_index >= candidate_list.size \n throw :jump_back, \"index #{@interval_index} is out of range\"\n end\n # Load up the candidate from the cost_vector\n candidate = candidate_list[@interval_index]\n candidate_cost = get_cost candidate\n # Skip all candidates that are banned, are already in the path, \n # or don't get us any closer.\n while (@banned_points.has_key? candidate.hash) || (@path.include? candidate) || (candidate_cost >= @current_cost)\n @interval_index += 1\n # If we've exhausted all possible intervals, jump back\n if @interval_index >= candidate_list.size\n @banned_points[candidate.hash] = 1\n throw :jump_back, \"index #{@interval_index} is out of range\"\n end\n # Get the movement that is at the current index\n candidate = candidate_list[@interval_index]\n candidate_cost = get_cost candidate\n end\n # Add it to the path!\n @path << candidate\n @current_cost = candidate_cost\n rescue IndexError => er\n puts \"\\nIndexError: #{er.message}\"\n print er.backtrace.join(\"\\n\")\n throw :jump_back\n rescue RangeError => er\n # If handle_range_error has not been defined in a subclass, any \n # call will just re-raise the exception\n handle_range_error er\n end\n # Judge success\n if @current_cost < @epsilon\n @current_point = @path.last\n prepare_result\n throw :success\n else\n @initial_run = true\n throw :keep_going, true\n end\n end # catch :jump_back\n if @debug_level > 1\n puts message\n end\n jump_back\n end # catch :keep_going\n if going\n keep_going\n going = false\n end\n rescue RuntimeError => er\n puts \"\\n#{er.message}\"\n print er.backtrace.join(\"\\n\")\n print \"\\n\\nPath: #{@path.to_a}\\n\"\n break\n end #RuntimeError block\n end # main iteration loop\n end # catch :success\n debug_final_report\n prepare_data\n @data\n end",
"def source_find_by_id_and_class_fail(source, id, css, timeout=nil)\r\n timeout = normalize_timeout(timeout)\r\n\r\n for i in 1..timeout\r\n begin\r\n element = source.find_by_id(id)\r\n if !element[:class].split(\" \").include? css\r\n return\r\n end\r\n rescue\r\n return\r\n end\r\n\r\n sleep(1)\r\n end\r\n\r\n raise \"Found element \\\"\" + id + \"\\\" with CSS class \\\"\" + css + \"\\\" which was not supposed to exist\"\r\n end",
"def retryable( options = {}, &block )\n opts = { :tries => 1, :on => Exception }.merge(options)\n\n return nil if opts[:tries] == 0\n \n retry_exception, tries = [ opts[:on] ].flatten, opts[:tries]\n \n begin\n return yield\n rescue *retry_exception\n retry if (tries -= 1) > 0\n end\n \n yield\nend",
"def not_found(&block)\n error 404, &block\n end",
"def wait_vlanid(vnet)\n retries = 5\n i = 0\n while vnet[\"VLAN_ID\"].nil?\n raise \"cannot get vlan_id\" if i >= retries\n sleep 1\n i +=1\n vnet.info\n end\nend",
"def lock_timeout_retry_delay=(_arg0); end",
"def ping\n tries = 3\n begin\n # @server.ping\n rescue Exception => e\n retry if (tries -= 1) > 1\n raise e, \"The server is not available (or you do not have permissions to access it)\"\n end\n end",
"def retry_timeout\n if !block_given?\n return @j_del.java_method(:retryTimeout, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling retry_timeout()\"\n end",
"def rescue_connection_failure(max_retries=30)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n #puts \"Rescue attempt #{retries}: from #{ex}\"\n retries += 1\n raise ex if retries > max_retries\n sleep(2)\n retry\n end\n end",
"def with_timeout(timeout, &block)\n block.call\n rescue IO::WaitReadable => e\n if IO::select([self], nil, nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue IO::WaitWritable => e\n if IO::select(nil, [self], nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue => e\n raise Aerospike::Exceptions::Connection, \"Socket error: #{e}\"\n end",
"def refresh_peers(node, &block)\n node.peers.each do |node|\n block.call(node) unless seeds.include?(node)\n peers.push(node) unless peers.include?(node)\n end\n end",
"def try_lock\n end"
] |
[
"0.669279",
"0.64966637",
"0.62885845",
"0.60105735",
"0.6005823",
"0.59410286",
"0.5929285",
"0.5856484",
"0.5844667",
"0.5785246",
"0.5763981",
"0.5679922",
"0.5641416",
"0.55891514",
"0.5549016",
"0.5540158",
"0.54744464",
"0.5470114",
"0.54663366",
"0.54635406",
"0.54549754",
"0.54512846",
"0.5447089",
"0.5410331",
"0.54062",
"0.5353379",
"0.53497833",
"0.53497833",
"0.53297335",
"0.53041583",
"0.5288202",
"0.5287857",
"0.5283895",
"0.52730227",
"0.52682453",
"0.52641493",
"0.5250953",
"0.52483785",
"0.52466214",
"0.52354425",
"0.5231212",
"0.51737607",
"0.5164693",
"0.5163395",
"0.5159517",
"0.5153889",
"0.5150844",
"0.51430327",
"0.5142791",
"0.51374125",
"0.51341814",
"0.51217115",
"0.50914013",
"0.5088803",
"0.50871867",
"0.50857794",
"0.508003",
"0.5078915",
"0.50784993",
"0.50743264",
"0.507229",
"0.50660586",
"0.5056367",
"0.505044",
"0.50481",
"0.5046026",
"0.50379735",
"0.50347716",
"0.50262636",
"0.5021332",
"0.49948204",
"0.49898756",
"0.498852",
"0.49833086",
"0.49813053",
"0.49779618",
"0.4975555",
"0.49709988",
"0.49680597",
"0.4964094",
"0.49595445",
"0.49516228",
"0.49481964",
"0.49432278",
"0.49369016",
"0.493597",
"0.4932992",
"0.49188474",
"0.4909247",
"0.49084648",
"0.4907654",
"0.48958743",
"0.48925778",
"0.48880655",
"0.48857668",
"0.48753598",
"0.4870357",
"0.48679683",
"0.48649415",
"0.48600632"
] |
0.65911436
|
1
|
Generate a "state" key that can be passed to the OAuth endpoints
|
def oauth_state
org = retrieve_organization
state = "#{org.name}:#{org.salt}:#{org.owner_email}"
Base64.urlsafe_encode64(Digest::SHA256.digest(state))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_personal_key\n self.personal_key = OaUtils.generate_random_key\n self.state = :active\n end",
"def get_key(state)\n state.sort.join('_')\n end",
"def create_auth_state\n\t auth_state = {:pathway => params[:gift_template][:pathway], \n :gift_template_id => params[:gift_template][:gift_template_id]}\n\n if session[:page_tab_id] #[Page Tab] include the page tab id\n\t auth_state[:page_tab_id] = session[:page_tab_id]\n\t end\n\t return URI.encode(ActiveSupport::JSON.encode(auth_state))\n end",
"def generate_key; end",
"def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end",
"def generate_api_key\n digest = Digest::SHA2.new(512)\n # generate a unique token\n unique_seed = SecureRandom.hex(20)\n digest.update(\"#{unique_seed} SECRET! #{Time.current.to_f}\").to_s\n end",
"def generate_access_key\n self.access_key = Digest::SHA1.hexdigest(SecureRandom.urlsafe_base64)\n end",
"def generate_access_key\n access_keys.generate_new\n end",
"def generate_keys\n self.client_id = OAuth::Helper.generate_key(40)[0,40]\n self.client_secret_hash = OAuth::Helper.generate_key(40)[0,40]\n end",
"def state_str\n MARKETPLACEAPP_STATES[state]\n end",
"def login_url(state, scope = nil)\n data = { \"response_type\" => \"code\", \"client_id\" => @client_id, \"state\" => state }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n data[\"scope\"] = scope unless scope.nil?\n return \"https://#{$api_endpoint}/auth/code?\" + URI.encode_www_form(data)\n end",
"def login_url(state, scope = nil)\n data = { \"response_type\" => \"code\", \"client_id\" => @client_id, \"state\" => state }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n data[\"scope\"] = scope unless scope.nil?\n return \"https://#{API_ENDPOINT}/auth/code?\" + URI.encode_www_form(data) \n end",
"def generate_api_key\n SecureRandom.random_number(2 ** 256).to_s(36)\n end",
"def get_state(request)\n if request.params[\"state\"].present? && request.params[\"code\"].present?\n if oauth_state = OauthState.find_by(state: request.params[\"state\"])\n [oauth_state, JSON.parse(oauth_state.payload) || {}]\n else\n raise OauthStateMiddlewareException, \"Invalid state during OAuth callback\"\n end\n end\n end",
"def get_state(request)\n if request.params[\"state\"].present? && request.params[\"code\"].present?\n if oauth_state = OauthState.find_by(state: request.params[\"state\"])\n [oauth_state, JSON.parse(oauth_state.payload) || {}]\n else\n raise OauthStateMiddlewareException, \"Invalid state during OAuth callback\"\n end\n end\n end",
"def state_sym\n return self.state.to_s.gsub(/_state$/, '').to_sym\n end",
"def generate_access_key\n return if self.access_key.present?\n self.access_key = SecureRandom.uuid\n end",
"def state_cache_key(state, key_parts={})\n expand_cache_key([controller_path, state, key_parts])\n end",
"def generate_keys\n\t\tself.token = OAuth::Helper.generate_key(20)[0,20]\n\t\tself.expires_at = 10.minutes.from_now\n\t\tself.authorized_at = Time.now\n\tend",
"def secret_key; end",
"def generate_key\n self.key ||= SecureRandom.urlsafe_base64 32\n end",
"def generate_api_key\n generate_uuid\nend",
"def generate_api_key!\n\t\t@api_key = Digest::SHA1.hexdigest((Time.now.to_f + rand(100) * rand()).to_s) \n\tend",
"def generate_auth_key\n name = \"fasdfadf\"\n puts self.name\n puts name\n end",
"def generate_token\n self.apply_code = \"#{SecureRandom.hex(4)}\"\n self.act_status_type_id = 2\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def key_for(token)\n \"afid-access-token:#{token}\".to_sym\n end",
"def create_oauth_url(cb_url, encoded_auth_state)\n oauth_url = \"https://www.facebook.com/dialog/oauth/?client_id=\" +\n \"#{APP_ID}&redirect_uri=#{cb_url}&state=#{encoded_auth_state}\"\n end",
"def key_generator; end",
"def key_generator; end",
"def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end",
"def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end",
"def secret_key\n encode_tz(:edsk, 32)\n end",
"def access_key_id\n credentials['access_key']\n end",
"def generate_api_key(length = 20)\n self.api_secret_key = SecureRandom.hex(length)\n end",
"def secret_key_base; end",
"def secret_key_base; end",
"def secret_key_base; end",
"def secret_key_base; end",
"def signing_key\n [percent_encode(@secret), percent_encode(@token)].join('&')\n end",
"def state_to_string(state)\n {\n STATE_SEARCH => 'STATE_SEARCH',\n STATE_IN_KEY => 'STATE_IN_KEY',\n STATE_EXPECT_EQUAL => 'STATE_EXPECT_EQUAL',\n STATE_EXPECT_VALUE => 'STATE_EXPECT_VALUE',\n STATE_IN_VALUE => 'STATE_IN_VALUE',\n STATE_EXPECT_END => 'STATE_EXPECT_END',\n STATE_EXPECT_COMMENT => 'STATE_EXPECT_COMMENT',\n STATE_IN_COMMENT_MULTI => 'STATE_IN_COMMENT_MULTI',\n STATE_EXPECT_COMMENT_END => 'STATE_EXPECT_COMMENT_END',\n STATE_IN_COMMENT_SINGLE => 'STATE_IN_COMMENT_SINGLE',\n STATE_EXPECT_UTF8_BOM => 'STATE_EXPECT_UTF8_BOM'\n }[state]\n end",
"def get_auth_link(state)\n data = {\n scope: \"notify\",\n response_type: \"code\",\n client_id: self.client_id,\n redirect_uri: self.redirect_uri,\n state: state\n };\n\n \"#{self.bot_origin}/oauth/authorize?#{URI.encode_www_form(data)}\"\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def state_code\n decode hash[\"StateCode\"]\n end",
"def make_token\r\n # From the restful-authentication plug-in\r\n args = [ Time.now, (1..10).map{ rand.to_s } ]\r\n Digest::SHA1.hexdigest(args.flatten.join('--'))\r\n end",
"def create_access_token\n hash = nil\n Songkick::OAuth2.generate_id do |token|\n hash = Songkick::OAuth2.hashify(token) \n end\n return hash\n end",
"def generate_validkey(from_string = nil)\n\t\tfrom_string ||= User.sha1(AuthHelper::Utils::random_string(30))\n write_attribute \"validkey\", from_string\n end",
"def short_state_str\n SHORT_MARKETPLACEAPP_STATES[state_str]\n end",
"def key_state(key)\r\n @state[@state_keys[key]]\r\n end",
"def key\n \"#{Goalkeeper.namespace}:#{label}\"\n end",
"def build_token_hash\n { 'access_token' => access_token }\n end",
"def openid_client_secret; end",
"def secret_key_base=(_arg0); end",
"def secret_key_base=(_arg0); end",
"def aws_access_key_attribute\n\t\t\"provider_account_#{Digest::MD5.hexdigest(name || 'unknown')}_aws_access_key\"\n\tend",
"def generate_key\n SecureRandom.hex(32)\nend",
"def get_state(key)\n @state[key]\n end",
"def generate_api_key\n api_key = new_token\n if AppSettings[:authentication][:key_based]\n Rails.cache.write( User.cached_api_key(api_key), self.authentication_token,\n expires_in: AppSettings[:authentication][:session_expiry] )\n api_key\n else\n secure_api_key = secured_key(api_key)\n update_hash = {}\n update_hash[:activation_digest] = User.digest(User.cached_api_key(secure_api_key))\n update_hash[:activated_at] = Time.now if self.activated_at < Time.now - 24.hours\n self.update(update_hash)\n secure_api_key\n end\n end",
"def access_key\n credentials['access_key']\n end",
"def gen_api_key\n u = UUID.new\n self.api_key = u.generate\n end",
"def access_key\n Settings.cybersource.access_key\n end",
"def create_washington_auth_request(scope)\n post user_session_path, params: {user: { \n email: users(:washington).email,\n password: \"georgepass\"\n }}\n \n context = {}\n context[\"scope\"] = scope\n context[\"state\"] = SecureRandom.urlsafe_base64(10)\n context[\"code_verifier\"] = SecureRandom.urlsafe_base64(10)\n context[\"client_id\"] = \"http://localhost:12345\"\n context[\"redirect_uri\"] = \"http://localhost:12345/redirect\"\n\n approval_params = {}\n scope.split(\" \").each {|s| approval_params[s] = 1}\n approval_params[\"code_challenge\"] = \n Base64.urlsafe_encode64(\n Digest::SHA256.digest(\n context[\"code_verifier\"])).chomp(\"=\")\n approval_params[\"commit\"] = \"Approve\"\n [\"state\", \"client_id\", \"redirect_uri\"].each do |p|\n approval_params[p] = context[p]\n end\n\n\n post indie_auth_approval_path, params: approval_params\n return context\n end",
"def build_token(name)\n # Note - sts only has ONE endpoint (not regional) so 'us-east-1'\n # hardcoding should be OK\n signer = Aws::Sigv4::Signer.new(\n service: 'sts',\n region: 'us-east-1',\n credentials_provider: @credentials\n )\n presigned_url_string = signer.presign_url(\n url: 'https://sts.amazonaws.com/?Action=GetCallerIdentity&Version=2011-06-15',\n body: '',\n expires_in: 60,\n headers: { 'X-K8s-Aws-Id' => name },\n http_method: 'GET'\n )\n\n 'k8s-aws-v1.' + Base64.urlsafe_encode64(presigned_url_string.to_s).chomp('==')\n end",
"def create_auth_token(key)\n\t\tself.auth_token = Digest::SHA1.hexdigest(\"#{random_string}--#{Time.now}---#{key}\")\n\tend",
"def generate_token\n self.token = Digest::SHA1.hexdigest([self.workplace_id, self.institute.id, Time.now, rand].join)\n end",
"def generate_url(require: nil)\n @state = Digest::MD5.hexdigest(\"#{@app}::#{@uuid.generate}\")\n params = {\n app: @app,\n state: @state,\n redirectUri: @redirect_uri\n }\n params = params.merge(require: 'profile') if require == :profile\n params = params.to_query\n \"#{self.class.base_uri}/auth/providers/#{@provider}/login?#{params}\"\n end",
"def generate_api_key(id)\n request(:post, \"/users/#{id}/make_new_api_key.json\")\n end",
"def generate_signature\n Digest::MD5.hexdigest(Configuration.hotel_api_key + \n Configuration.hotel_shared_secret + \n Time.now.to_i.to_s)\n end",
"def enrollment_code\n OpenSSL::HMAC.hexdigest(\n OpenSSL::Digest.new('sha1'),\n Rails.application.secrets.secret_key_base,\n \"#{id}\"\n ).upcase[0,8]\n end",
"def state\n module_name = self.class.name.underscore.gsub!('skej/state_logic/','')\n @STATE_KEY ||= module_name.to_sym\n end",
"def create_gift_state\n\t gift_state = {:gift_template_id => params[:gift_template_id], \n :individual_user_id => session[:individual_user_id], \n :access_token => session[:access_token]}\n\t\n\t if session[:page_tab_id] #[Page Tab] include the page tab id\n\t gift_state[:page_tab_id] = session[:page_tab_id]\n\t end\n\t return URI.encode(ActiveSupport::JSON.encode(gift_state))\n end",
"def access_key\n ENV['RANCHER_CLIENT_ID']\n end",
"def generate_api_key\n @user.api_key = BCrypt::Engine.generate_salt\n end",
"def state\n params['state']\n end",
"def openid_client_secret=(_arg0); end",
"def secret_keygen\n ('k' + Digest.hexencode(rand(9).to_s + self.message[0..2]) + self.id.to_s) \n end",
"def generate_token\n self.status = STATUS[:present]\n self.access_token = SecureRandom.urlsafe_base64(45, true)\n self.expires = Time.zone.now.to_i + TOKEN_LIFE\n self.login_time = Time.zone.now\n self.user_events.build(event_name: 'Login', event_time: Time.zone.now)\n save\n self.access_token\n end",
"def state_str\n ZONE_STATES[state]\n end",
"def create_key\n self.key = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Api.exists?(key: random_token)\n end\n end",
"def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end",
"def get_access_key\n return \"AIzaSyBUKwL2ClTAaKwn1csWuOOhNgKj5kv3QeA\"\nend",
"def state_name\n state_name = CS.states(:us)[ self.try(:state).try(:to_sym) ]\n end",
"def generate_key(store)\n store.token = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Store.exists?(token: random_token)\n end\n end",
"def generate_access_token\n self.access_token = SecureRandom.hex(64)\n end",
"def gen_key( string )\n md5 = Digest::MD5.hexdigest( string )\n return md5[0, 3] + md5[29, 31]\nend",
"def name_of(state)\n state = state.to_i\n return case state\n when -2 then \"DISCARDED\"\n when -1 then \"INIT\"\n when 0 then \"SUCCEEDED\"\n when 1 then \"WAIT\"\n when 2 then \"RUNNING\"\n when 3 then \"SUSPEND\"\n when 4 then \"FAILED\"\n else raise \"unknown state #{state}\"\n end\n end",
"def create_api_key(string, pepper = rand(9**99).to_s)\n # Hash then encrypt our seed string\n 10.times do\n # Run our string through 10 rounds of SHA512, each time \"peppering\" it with random data\n 10.times do\n string = sha512(string.to_s + pepper)\n end\n # Encrypt the end result to further obfuscate things\n string = encrypt(string + pepper)\n end\n return string[0...64] # return the end result, stripping to 64 characters\nend",
"def generate\n @key ||= begin\n parts = []\n parts << @request.scheme << \"://\"\n parts << @request.host\n\n if @request.scheme == \"https\" && @request.port != 443 ||\n @request.scheme == \"http\" && @request.port != 80\n parts << \":\" << @request.port.to_s\n end\n\n parts << @request.script_name\n parts << @request.path_info\n\n if query_string && query_string != \"\"\n parts << \"?\"\n parts << query_string\n end\n\n parts.join\n end\n end",
"def generate\n @key ||= begin\n parts = []\n parts << @request.scheme << \"://\"\n parts << @request.host\n\n if @request.scheme == \"https\" && @request.port != 443 ||\n @request.scheme == \"http\" && @request.port != 80\n parts << \":\" << @request.port.to_s\n end\n\n parts << @request.script_name\n parts << @request.path_info\n\n if query_string && query_string != \"\"\n parts << \"?\"\n parts << query_string\n end\n\n parts.join\n end\n end",
"def generate_api_key\n self.api_key = SecureRandom.hex(16)\n end",
"def generate_random_key\n SecureRandom.random_bytes(32)\n end",
"def complete_state_name()\n return engine.complete_state_name()\n end",
"def seed_api_key\n\t\t\tDoorkeeper::Application.create(name: \"sample app\", \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t uid: \"836ec399a145ffafbd7774c57e06960397b77a53bb1ccc03d4e45d95d0c31a3d\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t secret: \"cf8dc84d17c69e17a8b9d74ec971bdb636f231d3ba7d2ad2ebfca45bdc8ae3c9\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t redirect_uri: \"urn:ietf:wg:oauth:2.0:oob\")\n\t\tend",
"def generate_key\n key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)\n Base64.strict_encode64 key\n end",
"def get_state_name(states, state_code)\r\n if state_index = states.values.index(state_code)\r\n states.keys[state_index]\r\n else\r\n puts \"Invalid State Code\"\r\n end\r\nend",
"def secret_key\n \"\"\n end",
"def build_hash_code\n\t\tSecureRandom.hex(8) + (Time.now.to_f * 1000).to_i.to_s\n\tend"
] |
[
"0.69740146",
"0.6727542",
"0.63871044",
"0.636521",
"0.6336195",
"0.6336195",
"0.6229482",
"0.61574787",
"0.61331517",
"0.61231816",
"0.6086252",
"0.60823876",
"0.6042761",
"0.6024395",
"0.6024395",
"0.60148674",
"0.59776145",
"0.5924675",
"0.5914351",
"0.59079206",
"0.5854529",
"0.5836984",
"0.58271027",
"0.5821863",
"0.5820561",
"0.58190423",
"0.58190423",
"0.58190423",
"0.57827145",
"0.57821804",
"0.5774642",
"0.5774642",
"0.57654756",
"0.57654756",
"0.5755684",
"0.5734945",
"0.5733076",
"0.573246",
"0.573246",
"0.573246",
"0.573246",
"0.57319903",
"0.5730748",
"0.5712034",
"0.56839997",
"0.56839997",
"0.5682661",
"0.56546533",
"0.5653046",
"0.56451446",
"0.5632742",
"0.55886126",
"0.55843806",
"0.55816627",
"0.5581442",
"0.5579735",
"0.5579735",
"0.5578053",
"0.55761254",
"0.5572472",
"0.5566541",
"0.55581117",
"0.5552693",
"0.55513746",
"0.55474263",
"0.55448806",
"0.5539188",
"0.5538884",
"0.5536272",
"0.55341387",
"0.55334884",
"0.5532858",
"0.5532459",
"0.55225444",
"0.552238",
"0.5515392",
"0.5507335",
"0.54972875",
"0.5493726",
"0.5490616",
"0.5489984",
"0.5483456",
"0.547382",
"0.54725397",
"0.5471937",
"0.5471574",
"0.5447646",
"0.5445632",
"0.5444309",
"0.5429245",
"0.5427798",
"0.5427798",
"0.5426414",
"0.5417239",
"0.54159075",
"0.5415906",
"0.541412",
"0.5410098",
"0.54095846",
"0.5409581"
] |
0.7164228
|
0
|
Normalize a Github URL into a Cyclid style source definition
|
def normalize(url)
uri = URI.parse(url)
source = {}
source['url'] = "#{uri.scheme}://#{uri.host}#{uri.path.gsub(/.git$/, '')}"
source['token'] = uri.user if uri.user
source['branch'] = uri.fragment if uri.fragment
source
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def canonicalize_source(source)\n if source.is_a?(Hash) && source[:github]\n source = source.dup\n source[:git] = \"https://github.com/#{source[:github]}.git\"\n source.delete(:github)\n end\n source\n end",
"def parse_repo\n matches = @source_url.match @github_regexp\n return unless matches\n owner = matches[:owner]\n name = matches[:name]\n \"#{owner}/#{name}\"\n end",
"def process_source(data)\n if data['source'] =~ %r[://]\n source_uri = URI.parse(data['source'])\n else\n source_uri = URI.parse(\"http://#{data['source']}\")\n end\n\n if source_uri.host =~ /^(www\\.)?github\\.com$/\n source_uri.scheme = 'https'\n source_uri.path.sub!(/\\.git$/, '')\n data['project_page'] ||= @data['project_page'] || source_uri.to_s\n data['issues_url'] ||= @data['issues_url'] || source_uri.to_s.sub(/\\/*$/, '') + '/issues'\n end\n\n rescue URI::Error\n return\n end",
"def url_from_github_upload_url(string)\n match = string.match(/^!\\[.*\\]\\((https:\\/\\/\\S*)\\)$/)\n match[1] unless match.nil?\n end",
"def repo_slug_from_url(url)\n url[%r{github.com[/:]([^/]*/(?:(?!\\.git)[^/])*)\\.*}, 1]\nend",
"def github_url\n [homepage, source_code_uri].find do |url|\n GemsBond::Fetchers::Github.valid_url?(url)\n end\n end",
"def normalize_github_url\n return if self.github_url.blank?\n\n url = self.github_url || \"\"\n url.gsub!(/(https?:\\/\\/)?(www\\.)?github\\.com\\//, \"\")\n self.github_url = \"https://github.com/#{url}\"\n true\n end",
"def parse_github_ids full_document\n full_document.gsub(/%github(\\d+)/) do\n # Also works for PRs becuase GH figures that out.\n url = \"https://github.com/calacademy-research/antcat/issues/#{$1}\"\n link_to \"GitHub ##{$1}\", url\n end\n end",
"def normalize(sources)\n normalized = sources.map do |source|\n uri = URI.parse(source[:url])\n next unless uri.scheme =~ /\\Ahttps?\\z/\n\n s = {}\n s[:url] = \"#{uri.scheme}://#{uri.host}#{uri.path.gsub(/.git$/, '')}\"\n s[:token] = uri.user if uri.user\n s[:branch] = uri.fragment if uri.fragment\n source.merge(s)\n end\n normalized.compact\n end",
"def github_url\n \"http://github.com/280north/cappuccino/commit/#{sha1}\"\n end",
"def process\n return nil unless link_url?\n url = @url.dup\n if url = parse(url)\n return parse_relative_url unless url.host\n url.scheme ||= @source_url.scheme\n if same_source_host? || external_asset_url?\n URI.unescape(url.to_s, '%7C')\n end\n end\n end",
"def parse(url)\n matches = url.match(%r{[:/](?<user>[^/]+)/(?<repo>[^/]+)\\z})\n [matches[:user], matches[:repo].gsub(/\\.git\\z/, '')]\n rescue StandardError => e\n raise ParseError, 'Can not parse Github URL.'\n end",
"def normalize_url(url); end",
"def github_comment_file_url(file)\n [file.scm_comment.repository, 'blob', file.scm_comment.reference, file.path].join('/')\n end",
"def source\n return BASE_SOURCE_URL + '/' + repo_id unless path_extension\n BASE_SOURCE_URL + '/' + repo_id + '/' + path_extension.sub(%r{^\\s*/}, '').sub(%r{/\\s*$}, '')\n end",
"def repo_url_to_repo(repo_url)\n return unless repo_url.is_a? String\n return if !repo_url.include?(\"github.com\") or repo_url.include?(\"gist.github.com\")\n\n repo = repo_url.gsub(/^.*\\:\\/*/i, '') # Remove protocol (eg: \"http://\", \"github:\")\n .gsub(/\\.git(#.+)?$/i, '') # Remove .git (and optional branch) suffix\n .gsub(/.*github\\.com[\\/\\:]+/i, '') # Remove domain or ssh clone url\n .gsub(/([^\\/]+) \\/ ([^\\/]+) \\/? .*/x, '\\1/\\2') # Remove everything after a possible second slash\n\n repo.split(\"/\").size == 2 ? repo : nil # Check if the final value is well formatted\n end",
"def parse_url(input)\n hosts = \"github\\.com|bitbucket\\.org|gitlab\\.com\"\n\n # HTTPS/HTTP link pointing to recognised hosts\n if input =~ /^(?:https?:\\/\\/)?(?:[^.@]+@)?(?:www\\.)?(#{hosts})\\/([^\\/]+)\\/([^\\/]+)/i\n { host: $1.downcase(), user: $2, repo: $3.sub(/\\.git$/, \"\") }\n # SSH\n elsif input =~ /^git@(#{hosts}):([^\\/]+)\\/([^\\/]+)\\.git$/i\n { host: $1.downcase(), user: $2, repo: $3 }\n # provider:user/repo\n elsif input =~ /^(github|bitbucket|gitlab):\\/?([^\\/]+)\\/([^\\/]+)\\/?$/i\n { host: $1.downcase(), user: $2, repo: $3 }\n # user/repo - Common GitHub shorthand\n elsif input =~ /^\\/?([^\\/]+)\\/([^\\/]+)\\/?$/\n { host: \"github.com\", user: $1, repo: $2 }\n else\n raise \"Unsupported URL: #{input}\"\n end\nend",
"def name_to_url(name)\n \"https://github.com/#{name}.git\"\n end",
"def perform_github_source_checks(s)\n require 'uri'\n\n if git = s[:git]\n return unless git =~ /^#{URI.regexp}$/\n git_uri = URI.parse(git)\n if git_uri.host\n perform_github_uri_checks(git, git_uri) if git_uri.host.end_with?('github.com')\n end\n end\n end",
"def extract_url\n URI.extract(comment, %w[http https])[0]\n end",
"def github_url(ruby_doc)\n version, file, line = ruby_doc.source_location.split(\":\")\n\n if version == MASTER\n path = File.join version, file\n else\n github_version = version.tr(\".\", \"_\")\n path = File.join \"v#{github_version}\", file\n end\n\n URI.join(GITHUB_REPO, path, \"#L#{line}\").to_s\n end",
"def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def get_raw_uri(uri_s, branch)\n uri = URI(uri_s)\n\n case uri.host\n when 'github.com'\n uri_split = File.split(uri.path)\n return 'https://raw.githubusercontent.com/%s/%s/%s' % [uri_split[0], uri_split[1].rpartition('.')[0], branch]\n when 'bitbucket.org'\n uri_split = File.split(uri.path)\n return 'https://bitbucket.org/%s/%s/raw/%s' % [uri_split[0], uri_split[1], branch]\n end\n\n return ''\nend",
"def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def initialize(source_url)\n @source_url = source_url\n @token = Figaro.env.github_access_token\n @github_regexp = %r{\n \\A(https?:\\/\\/(w{3}\\.)?)? # protocol and www optional at start\n github\\.com\\/ # domain name\n (?<owner>[\\w\\-\\.]+)\\/ # owner of repo\n (?<name>[\\w\\-\\.]+)\\/?\\z # name of repo at end\n }x\n\n @repo = @source_url ? parse_repo : nil\n @repo_data = @repo ? request_repo_data : nil\n end",
"def github_repo\n self.github_url&.gsub(\"https://github.com/\", \"\")\n end",
"def github_url_matching(url)\n matches = /github\\.com.(.*?)\\/(.*)/.match(url)\n matches ? [matches[1], matches[2].sub(/\\.git\\z/, '')] : [nil, nil]\n end",
"def giturl(project_name, repo_name) ; end",
"def canonicalize_repo(repo)\n # if they fully-qualified it, we're good\n return repo if repo.start_with?('http', 'git@')\n\n # otherwise, ti's a shortname\n cr = \"git@#{@ghhost || 'github.com'}:#{repo}.git\"\n SugarJar::Log.debug(\"canonicalized #{repo} to #{cr}\")\n cr\n end",
"def cloud_source_repo\n # Cloud Source Repositories downcases org/repo names (e.g., Foo/Bar\n # -> foo_bar).\n (\"github_\" + @source_repo.tr(\"/\", \"_\")).downcase\n end",
"def transform_automation_url(arg)\n return arg unless arg.start_with?(\"http\")\n\n remote_file = determine_remote_filename(arg)\n github_match = GITHUB_REGEX.match(arg)\n\n arg = if arg.start_with?(\"https://gist.github.com\")\n arg.sub( # rubocop:disable Style/StringConcatenation\n \"https://gist.github.com\", \"https://gist.githubusercontent.com\"\n ) + \"/raw\"\n elsif github_match\n new_url = arg.sub(GITHUB_REGEX, \"https://raw.githubusercontent.com\")\n github_tree_match = GITHUB_TREE_REGEX.match(arg)\n github_blob_match = GITHUB_BLOB_REGEX.match(arg)\n\n if github_tree_match\n new_url.sub(\"/tree/\", \"/\")\n elsif github_blob_match\n new_url.sub(\"/blob/\", \"/\")\n else\n \"#{new_url}/#{Bridgetown::Utils.default_github_branch_name(arg)}\"\n end\n else\n arg\n end\n\n \"#{arg}/#{remote_file}\"\n end",
"def url_for_fetching\n server = Settings.git_server(url)\n if server.mirror.present?\n url.gsub(%r{(git@|https://).*?(:|/)}, server.mirror)\n else\n url\n end\n end",
"def humanish(uri)\n uri.path.split('/').last.gsub('.git', '')\n end",
"def line_to_github_url(file_path, line_str)\n return nil unless file_url = url_for(file_path)\n project_url = file_url.sub(%r{/blob/.*/#{File.basename(file_path)}$}, '')\n commit = git.find_commit_with_line(line_str)\n return nil unless commit\n file_index = commit.file_paths.index(git.relative_file(file_path))\n \"#{project_url}/commit/#{commit.to_s}#diff-#{file_index}\"\n end",
"def source_url(project)\n \"github.com/#{project.name}\"\n end",
"def human_url\n return data()['project_uri']\n end",
"def url_to_doi(value:)\n return value unless value.present? && value.start_with?('http')\n\n value.gsub(%r{^https?://do[a-z].org/}, 'doi:').strip\n end",
"def normalize_url url\n unless url.match(/https?:\\/\\//)\n url = \"http://#{url}\"\n end\n\n url\n end",
"def parse_original_url\n self.title ||= self.original_url\n case self.original_url\n when /digitalgallery\\.nypl\\.org/ && /imageID/\n self.type = \"DgImage\"\n self.remote_ref = self.original_url.gsub(/^.*imageID=([^&]+).*$/, '\\1')\n self.title.gsub!(\"NYPL Digital Gallery | \", \"\")\n when /ebooks\\.nypl\\.org/ && /ContentDetails/\n self.type = \"Ebook\"\n self.remote_ref = self.original_url.gsub(/^.*ContentDetails.htm?id=([^&]+).*$/, '\\1')\n self.title.gsub!(\"The New York Public Library, eNYPL - \", \"\")\n when /catalog\\.nypl\\.org/\n self.type = \"BibRecord\"\n when /nypl\\.org\\/locations/\n self.type = \"LibLocation\"\n self.title.gsub!(\" | The New York Public Library\", \"\")\n when /nypl\\.org\\/events\\/.*\\/\\d\\d\\d\\d\\/\\d\\d\\/\\d\\d/\n self.type = \"Event\"\n date = url.gsub(/^.*nypl\\.org\\/events\\/.*\\/(\\d\\d\\d\\d)\\/(\\d\\d)\\/(\\d\\d).*/, '\\2-\\3-\\1')\n self.title.gsub!(\" | The New York Public Library\", \"\")\n self.title = \"#{date}: #{self.title}\"\n else\n self.type = \"Bookmark\"\n self.title.gsub!(\" | The New York Public Library\", \"\")\n end\n end",
"def correct_uri( url )\n uri = URI( url )\n if uri.scheme == 'http'\n case\n when uri.host.match( 'github.com' )\n # remove possible subdomain like 'wiki.github.com'\n uri = URI \"https://github.com#{uri.path}\"\n when uri.host.match( 'bitbucket.org' )\n uri = URI \"https://#{uri.host}#{uri.path}\"\n end\n end\n\n uri\n end",
"def format_url\n self.url.chomp\n if self.url.match(\"https://\") || self.url.match(\"http://\")\n else self.url = \"http://\" + url\n end\n self.url\n end",
"def wikisource_url(metadata)\n links = metadata.split(\"\\n\")\n @url = ''\n links.each do |meta|\n if meta.include?('wikisource_url:')\n @url = meta.split('wikisource_url:').last\n end\n end \n return @url\n end",
"def url_of_file(filename)\n raw_file_url = 'https://raw.githubusercontent.com/david942j/one_gadget/@tag/@file'\n raw_file_url.sub('@tag', latest_tag).sub('@file', filename)\n end",
"def clean_source(source_uri)\n\n # remove slash from the start of the string\n if source_uri.starts_with?('/') then\n source_uri = source_uri[1, source_uri.length]\n end\n\n # remove http/ https/ ftp\n source_uri = source_uri.sub(\"(^((ht|f)tp(s|):\\/\\/))\", \"\")\n # remove domain name from the source url\n host = @request.env['SERVER_HOST']\n source_uri = source_uri.sub(host, \"\")\n host = host.sub(\"www.\", \"\")\n source_uri = source_uri.sub(host, \"\")\n\n # don't allow users the ability to use '../'\n # in order to gain access to files below document root\n\n # src should be specified relative to document root like:\n # src=images/img.jpg or src=/images/img.jpg\n # not like: src=../images/img.jpg\n\n source_uri = source_uri.sub(\"(\\.\\.+\\/)\", \"\")\n\n # get path to image on file system\n \"#{@base_path}/#{source_uri}\"\n\n end",
"def parse_url url\n case url\n when /^rdoc-label:([^:]*)(?::(.*))?/ then\n scheme = 'link'\n path = \"##{$1}\"\n id = \" id=\\\"#{$2}\\\"\" if $2\n when /([A-Za-z]+):(.*)/ then\n scheme = $1.downcase\n path = $2\n when /^#/ then\n else\n scheme = 'http'\n path = url\n url = url\n end\n\n if scheme == 'link' then\n url = if path[0, 1] == '#' then # is this meaningful?\n path\n else\n self.class.gen_relative_url @from_path, path\n end\n end\n\n [scheme, url, id]\n end",
"def relative_url(input); end",
"def parse_gist_id(link_url)\n gist_id = \n if link_url.match? '</script>' \n link_url.sub(/.js\"><\\/script>/, '') \n elsif link_url.match? '.git' \n link_url.sub(/.git$/, '') \n else \n link_url \n end \n File.basename(gist_id)\n end",
"def issue_url(api_url)\n # \"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/322\"\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n\n # https://github.com/typed-ember/ember-cli-typescript/issues/322\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..-1]\n html_url\n end",
"def parse\n JSON.parse(open(github_url).read)\n end",
"def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end",
"def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end",
"def strip_http(url)\n \n # remove scheme\n if url.start_with?('http://')\n dest_url = url[7..-1]\n elsif url.start_with?('https://')\n dest_url = url[8..-1]\n else \n dest_url = url\n end\n\n # remove trailing \"meaningless\" characters\n if dest_url.end_with?('/')\n dest_url = dest_url[0..-2]\n end\n\n if dest_url.end_with?('#')\n dest_url = dest_url[0..-2]\n end\n\n return dest_url\n end",
"def sanatize_url(url)\n uri = URI.parse(url);\n cleaned_url = \"https://\" + uri.host + uri.path\n end",
"def url\n type = File.directory?(file) ? \"tree\" : \"raw\"\n name = file.path.split('/').last\n %{#{upstream}/#{type}/#{branch}/#{folder_name}/#{name}}\n end",
"def clean(url)\n url\n end",
"def format_url(url)\n url.gsub(%r{^(https?:\\/\\/)}, '')\n end",
"def fix_isgd_url!\n self.src_url.gsub!(%r{(http://is.gd/\\w+)[-/]}, '\\1')\n end",
"def normalize_url(url)\n Addressable::URI.parse(url).normalize.to_s\n end",
"def repo_elements\n elements = @url.gsub('https://github.com/', '').split('/').compact.map(&:strip)\n end",
"def parse_uri(input)\n lines = parse_input input\n extract_uri lines\n end",
"def pull_request_url(api_url)\n # https://api.github.com/repos/typed-ember/ember-cli-typescript/pulls/334\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n pulls_index = api_url.index(\"pulls\")\n\n # https://github.com/typed-ember/ember-cli-typescript/pull/334\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..pulls_index + \"pull\".length - 1] +\n api_url[pulls_index + \"pulls\".length..-1]\n html_url\n end",
"def get_first_link(content)\n \n #Remove curly braces\n while content =~ /\\{\\{[^\\{\\\\}]+?\\}\\}/\n\t content.gsub!(/\\{\\{[^\\{\\}]+?\\}\\}/,'')\n end\n #remove info box\n content.sub!(/^\\{\\|[^\\{\\}]+?\\n\\|\\}\\n/,'')\n #remove anything in parens\n #content.gsub!(/\\(.*\\)/,'')\n content.gsub!(/(\\(.*\\))(?=^(?:(?!\\[\\])))/,'')\n #remove bold and italicized text\n content.gsub!(/'''''(.+?)'''''/,'')\n #remove italic text\n content.gsub!(/''(.+?)''/,'')\n #remove images and file links\n content.gsub!(/\\[\\[Image:.*?\\]\\]/,'')\n content.gsub!(/\\[\\[File:.*?\\]\\]/,'')\n content.gsub!(/\\[\\[image:.*?\\]\\]/,'')\n content.gsub!(/\\[\\[file:.*?\\]\\]/,'')\n #remove any link with colons in it\n #content.gsub!(/\\[\\[.*?:.*?\\]\\]/,'')\n #gets the first link\n content = content.slice(/\\[\\[.*?\\]\\]/)\n #replaces spaces with underscores (for correct resolving of links)\n content.gsub!(\" \",'_')\n #removes the trailing description (for correct resolving of links)\n content = content.gsub(/\\|.*?\\]\\]/,']]')\n return content\n end",
"def github_url\n GITHUB_ARTICLES_URL + file_name\n end",
"def github_url(payload)\n if(payload.get(:data, :code_fetcher, :info, :private))\n uri = URI.parse(payload.get(:data, :code_fetcher, :info, :url))\n uri.scheme = 'https'\n uri.user = config.fetch(:github, :access_token,\n app_config.get(:github, :access_token)\n )\n uri.to_s\n else\n payload.get(:data, :code_fetcher, :info, :url)\n end\n end",
"def converturl url\n return nil unless url\n newurl = url.sub('/wiki/','').downcase().sub('_(film)','').sub(/([12][8901].._film)/,'')\n newurl = URI.decode(newurl)\n # accept only alphanum and %\n newurl.gsub!(/[^0-9a-z%]/i,'')\n return newurl\nend",
"def copy_from_github(filename, destination: filename)\n source = \"https://raw.githubusercontent.com/chimney-rock/rails-api-template/master/#{filename}\"\n remove_file(destination) if File.exists?(destination)\n get(source, destination)\nrescue OpenURI::HTTPError\n puts \"ERROR: Unable to obtain file `#{source}`\"\nend",
"def name_for_url(url)\n base_from_host_and_path = lambda do |host, path|\n if host\n base = host.split('.')[-2] || host\n base += '-'\n else\n base = ''\n end\n\n base + path.gsub(/.git$/, '').gsub(%r{^/}, '').split('/').join('-')\n end\n\n case url.to_s.downcase\n when %r{github.com[:/]+cocoapods/specs}\n base = Pod::MasterSource::MASTER_REPO_NAME\n when %r{github.com[:/]+(.+)/(.+)}\n base = Regexp.last_match[1]\n when %r{^\\S+@(\\S+)[:/]+(.+)$}\n host, path = Regexp.last_match.captures\n base = base_from_host_and_path[host, path]\n when URI.regexp\n url = URI(url.downcase)\n base = base_from_host_and_path[url.host, url.path]\n else\n base = url.to_s.downcase\n end\n\n name = base\n infinity = 1.0 / 0\n (1..infinity).each do |i|\n break unless source_dir(name).exist?\n name = \"#{base}-#{i}\"\n end\n name\n end",
"def fix_url\n self.url = UrlNormalizer.normalize_entry_url self.url, self\n end",
"def parse_git_uri(laser_gem)\n code_uri = laser_gem.gem_spec.source_code_uri\n if code_uri\n matches = matcher(code_uri)\n return matches[1] if matches\n end\n parse_additional_uris(laser_gem)\n end",
"def test_to_s\n GIT_URLS.each do |url_data|\n url = url_data[:url]\n to_s = Git::URL.parse(url).to_s\n assert_equal(url, to_s, \"Parsed URI#to_s does not return the original URL '#{url}' correctly\")\n end\n end",
"def public_url(uri, sourcemap_directory)\n \n # puts \"\\nIMPORTER\\n\"\n # puts \"importer: uri=#{uri}\"\n # puts \"importer: sourcemap_directory=#{sourcemap_directory}\\n\"\n \n # Default to an absolute path.\n result = \"file:///#{uri}\"\n \n \n # ### !!! TESTING RELATIVE PATHS\n # # importer: uri=C:/Users/Coridyn/WidgetWorks/bankwest/bw-repayment-widget/build/assets/assets/bw-repayment-widget/stylesheets/print/_wiwo-results-manager.scss\n # # importer: sourcemap_directory=C:\\Users\\Coridyn\\WidgetWorks\\bankwest\\bw-repayment-widget\\build\\assets\\assets\\bw-repayment-widget\\stylesheets\n \n # #importer: uri= C:/Users/Coridyn/WidgetWorks/bankwest/bw-repayment-widget/build/vendor/assets/wiwo-shared-lib/dist/src/wiwo-shared-lib/stylesheets/debug/debug.css.scss\n # #importer: sourcemap_directory= C:\\Users\\Coridyn\\WidgetWorks\\bankwest\\bw-repayment-widget\\build\\vendor\\assets\\wiwo-shared-lib\\dist\\src\\wiwo-shared-lib\\stylesheets\\debug\n \n # #importer: uri= C:/Users/Coridyn/WidgetWorks/bankwest/bw-repayment-widget/build/vendor/assets/wiwo-repayment-widget/dist/src/wiwo-repayment-widget/stylesheets/print.scss\n # #importer: sourcemap_directory= C:\\Users\\Coridyn\\WidgetWorks\\bankwest\\bw-repayment-widget\\build\\assets\\assets\\bw-repayment-widget\\stylesheets\n # if (sourcemap_directory != nil)\n # #begin\n # # Normalise to forward-slashes\n # result = Pathname.new(uri).relative_path_from(Pathname.new(sourcemap_directory.gsub('\\\\', '/'))).to_s\n \n # # Replace the file extension.\n # result += '.mapped'\n \n \n # # Ignore a leading 'vendor/assets/' and 'assets/assets/' path too.\n # # result.sub!(/..\\/vendor\\/assets\\//, '../../')\n # final = result.sub(/..\\/assets\\/assets\\//, '../../assets/')\n # final.sub!(/..\\/vendor\\/assets\\//, '../../assets/')\n \n \n # if (uri.index('_repayment-summary.scss') != nil)\n # puts \"Rel path: #{result}\"\n # puts \"Final path: #{final}\"\n # end\n \n # result = final\n \n # #rescue\n # #end\n # end\n \n # Return the generated URL.\n result\n end",
"def github_repo\n # GitHub allows underscores, hyphens and dots in repo names\n # but only hyphens in user/organisation names (as well as alphanumeric).\n repository_url.scan(/:([A-Za-z0-9-]+\\/[\\w.-]+)\\.git$/).join\n end",
"def cvs_url(url, full_path)\n if /%s/ =~ url then\n sprintf url, full_path\n else\n url + full_path\n end\n end",
"def url\n source_url || reporter.photo_urlformat(uniqueid, 's')\n end",
"def parse_gist\n src = content.strip\n if src =~ /\\A\\w+(\\-\\w+)*\\/\\d+/\n src = \"https://gist.github.com/#{src}\"\n else\n src.sub! /\\A(?=gist\\.github\\.com)/, 'https://'\n end\n src.sub!(/((?<!\\.js)|\\.git)$/, '.js')\n %Q|<script src=\"#{src}\"></script>|\n end",
"def source_map_url_from(body, headers)\n if body =~ SOURCEMAP_LINE_RE\n sourcemap_url = $3.gsub(/(\\s)([^\\s]+)$/, '') # Remove the \"..map */ CSS closing comment\"\n return sourcemap_url\n elsif headers['SourceMap']\n headers['SourceMap']\n else\n headers['X-SourceMap']\n end\n end",
"def sanitized_entry_for_subset(entry, subset)\n case subset\n when :url\n entry.downcase.gsub(%r{\\Ahttps?://}, '').chomp('/')\n else\n entry.downcase\n end\n end",
"def full_url\n self.source.full.url\n end",
"def url\n RepoURL.new(@repo[:html_url]).repo_url\n end",
"def clean_url\n url = self.original_url\n url = url.gsub(' ', '')\n url = url.strip\n if url !~ REGEX_PROTOCOL\n url = \"http://#{url}\"\n end\n begin\n self.original_url = URI.parse(url).normalize.to_s\n rescue URI::InvalidURIError\n # handle urls that cannot be parsed\n self.original_url = url\n end\n end",
"def validate_source_url(spec)\n return if spec.source.nil? || spec.source[:http].nil?\n url = URI(spec.source[:http])\n return if url.scheme == 'https' || url.scheme == 'file'\n warning('http', \"The URL (`#{url}`) doesn't use the encrypted HTTPS protocol. \" \\\n 'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\\\n 'This will be an error in future releases. Please update the URL to use https.')\n end",
"def parse_content\n doc = Nokogiri::HTML(open(url.source))\n doc.css('a', 'h1', 'h2', 'h3').map do |link|\n UrlContent.new do |urlc|\n content = link.content.strip.force_encoding(\"utf-8\")\n if link.node_name == 'a'\n content = link.get_attribute(\"href\")\n if not (content.present? and (content.starts_with?(\"http\") or content.starts_with?(\"www\")))\n content = url.source+content.to_s\n end\n end\n urlc.content = content\n urlc.content_type = link.node_name\n urlc.url = self.url\n end\n end\n end",
"def cleanup_url(story)\n url = story.url\n domain = NetHelpers.get_url_domain(url)\n url.gsub!(/&?utm_(campaign|source|medium|content)=[^&]*/, '') # get rid of google analytics tracking\n url.gsub!(/\\?$/,'')\n\n if (!@@domains_with_default_fixup_rule.grep(domain).empty?)\n url.gsub!(/\\?.*/, \"\")\n elsif (fixup_rule = @@url_fixup_rules[domain])\n url.gsub!(/#{fixup_rule[:regexp]}/, \"#{fixup_rule[:repl]}\")\n return { :url_changed => true, :reset_title => fixup_rule[:reset_title] } if fixup_rule[:url_changed] \n elsif (url_extraction_rule = @@url_extraction_rules[domain])\n story.url, story.body = NetHelpers.fetch_content(story.url) if story.body.nil? || story.body.empty?\n if story.body =~ url_extraction_rule\n story.url = $1\n return { :url_changed => true, :reset_title => true }\n end\n end\n nil\n end",
"def parse_link; end",
"def url\n \"http://github.com/#{repo.owner.login}/#{repo.name}/#{name}\"\n end",
"def fetch_url(body)\n aux = body.split('<link>').last\n aux = aux.split('<pubdate>').first\n aux\n end",
"def github_url\n \"https://github.com/rails/rails/commit/#{sha1}\"\n end",
"def fn_convt(url)\n\tCGI.escape(url.gsub(/\\//,'_').gsub(/:|\\./,'_').scan(/http(.*)/)[0][0])\nend",
"def normalize_uri uri\n (uri =~ /^https?:/) ? uri : \"http://#{uri}\"\n end",
"def strip_url(tweet)\n regex = 'https://'\n current = tweet.rpartition(regex)\n\n while current.include? regex\n current = current.first.rpartition(regex)\n end\n current.last\n end",
"def github_url\n @github_url ||= \"https://github.com/#{options[:github_owner]}/#{name}\"\n end",
"def url\n \"http://github.com/#{login}\"\n end",
"def canonical_url(url)\n ld_api.canonical_url(url)\n end",
"def github_insteadof_matching(config, url)\n first_match = config.keys.collect { |key|\n [config[key], /url\\.(.*github\\.com.*)\\.insteadof/.match(key)]\n }.find { |insteadof_url, true_url|\n url.index(insteadof_url) and true_url != nil\n }\n first_match ? [first_match[0], first_match[1][1]] : [nil, nil]\n end",
"def url_(str)\n encoding = str.encoding\n str.b.gsub(/([^ a-zA-Z0-9_.-]+)/) do |m|\n '%' + m.unpack('H2' * m.bytesize).join('%').upcase\n end.tr(' ', '+').force_encoding(encoding)\n end",
"def unwatermarked_url\n return nil if api_response[\"article_image_url\"].nil?\n Source::URL.parse(api_response[\"article_image_url\"])\n end",
"def fix_html_link(link)\n return link.gsub(\"documentcloud.org\", \"assets.documentcloud.org\").sub(\"-\", \"/\").gsub(\".html\", \".pdf\").gsub(\"www.\", \"\")\n end",
"def clean_url url\n return url if url.nil?\n url.gsub('%2F', '/').gsub(/^\\/+/, '').gsub('//', '/')\n end",
"def github_comment_repository_url(comment)\n [comment.repository, 'commit', comment.reference].join('/')\n end",
"def gen_url url, text\n if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then\n type = \"link\"\n elsif url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n else\n type = \"http\"\n end\n\n if (type == \"http\" or type == \"https\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n ''\n else\n text.sub(%r%^#{type}:/*%, '')\n end\n end"
] |
[
"0.6804975",
"0.62760067",
"0.6219566",
"0.6122229",
"0.6038586",
"0.6035815",
"0.6034577",
"0.60073704",
"0.5977274",
"0.59274054",
"0.58976954",
"0.588535",
"0.5858931",
"0.58440596",
"0.5813602",
"0.5800523",
"0.5791087",
"0.5764799",
"0.5749009",
"0.5714034",
"0.57110137",
"0.56937474",
"0.5684085",
"0.56662375",
"0.5655859",
"0.56503236",
"0.55932266",
"0.5538347",
"0.5531031",
"0.5520763",
"0.5519473",
"0.55137247",
"0.5486264",
"0.54755586",
"0.54648405",
"0.54468274",
"0.5434253",
"0.5427011",
"0.542028",
"0.54182315",
"0.5416399",
"0.5413299",
"0.5381313",
"0.538105",
"0.537933",
"0.5349592",
"0.53456503",
"0.53439695",
"0.53426474",
"0.53373146",
"0.53373146",
"0.53329253",
"0.53221506",
"0.5319853",
"0.530519",
"0.5298948",
"0.52962726",
"0.52872217",
"0.5284887",
"0.52843165",
"0.5282325",
"0.5277434",
"0.5266164",
"0.52589816",
"0.52266395",
"0.5222464",
"0.52104944",
"0.52104324",
"0.5207983",
"0.520656",
"0.5206023",
"0.52013177",
"0.51988876",
"0.51977557",
"0.5194248",
"0.51869535",
"0.51850903",
"0.5177404",
"0.51750034",
"0.5174135",
"0.517099",
"0.5170849",
"0.5166345",
"0.5164468",
"0.5160932",
"0.51553744",
"0.5149266",
"0.51440495",
"0.5138164",
"0.51381195",
"0.51325744",
"0.51229376",
"0.51217014",
"0.51208293",
"0.51198167",
"0.51165265",
"0.5110104",
"0.5108357",
"0.5100862",
"0.5100761"
] |
0.67116916
|
1
|
Extract the "humanish" part from a Git repository URL
|
def humanish(uri)
uri.path.split('/').last.gsub('.git', '')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def repo_slug_from_url(url)\n url[%r{github.com[/:]([^/]*/(?:(?!\\.git)[^/])*)\\.*}, 1]\nend",
"def parse(url)\n matches = url.match(%r{[:/](?<user>[^/]+)/(?<repo>[^/]+)\\z})\n [matches[:user], matches[:repo].gsub(/\\.git\\z/, '')]\n rescue StandardError => e\n raise ParseError, 'Can not parse Github URL.'\n end",
"def repo_url_to_repo(repo_url)\n return unless repo_url.is_a? String\n return if !repo_url.include?(\"github.com\") or repo_url.include?(\"gist.github.com\")\n\n repo = repo_url.gsub(/^.*\\:\\/*/i, '') # Remove protocol (eg: \"http://\", \"github:\")\n .gsub(/\\.git(#.+)?$/i, '') # Remove .git (and optional branch) suffix\n .gsub(/.*github\\.com[\\/\\:]+/i, '') # Remove domain or ssh clone url\n .gsub(/([^\\/]+) \\/ ([^\\/]+) \\/? .*/x, '\\1/\\2') # Remove everything after a possible second slash\n\n repo.split(\"/\").size == 2 ? repo : nil # Check if the final value is well formatted\n end",
"def url_for_fetching\n server = Settings.git_server(url)\n if server.mirror.present?\n url.gsub(%r{(git@|https://).*?(:|/)}, server.mirror)\n else\n url\n end\n end",
"def parse_repo\n matches = @source_url.match @github_regexp\n return unless matches\n owner = matches[:owner]\n name = matches[:name]\n \"#{owner}/#{name}\"\n end",
"def repo_url\n svn('info', '--xml')[/<url>(.*?)<\\/url>/, 1].strip\n end",
"def canonicalize_repo(repo)\n # if they fully-qualified it, we're good\n return repo if repo.start_with?('http', 'git@')\n\n # otherwise, ti's a shortname\n cr = \"git@#{@ghhost || 'github.com'}:#{repo}.git\"\n SugarJar::Log.debug(\"canonicalized #{repo} to #{cr}\")\n cr\n end",
"def github_repo\n # GitHub allows underscores, hyphens and dots in repo names\n # but only hyphens in user/organisation names (as well as alphanumeric).\n repository_url.scan(/:([A-Za-z0-9-]+\\/[\\w.-]+)\\.git$/).join\n end",
"def repo_human(repo)\n repo.match('-') ? repo : repo.capitalize\nend",
"def url_from_github_upload_url(string)\n match = string.match(/^!\\[.*\\]\\((https:\\/\\/\\S*)\\)$/)\n match[1] unless match.nil?\n end",
"def split_url\n match = /(?:(?:git|ssh)@(.*):|(?:https?:\\/\\/(.*?)\\/))(.*).git/.match(url)\n match.captures.compact if match\n end",
"def getProjectName()\n\tcurl = 'git config --local remote.origin.url|sed -n \"s#.*/\\([^.]*\\)\\.git#\\1#p\"'\n\tresult = `#{curl}`\n\treturn result.strip()\nend",
"def parse_git_uri(laser_gem)\n code_uri = laser_gem.gem_spec.source_code_uri\n if code_uri\n matches = matcher(code_uri)\n return matches[1] if matches\n end\n parse_additional_uris(laser_gem)\n end",
"def repo_info\n # Extract user and project name from GitHub URL.\n url = git_config['remote.origin.url']\n if url.nil?\n puts \"Error: Not a git repository.\"\n return [nil, nil]\n end\n user, project = github_user_and_project(url)\n # If there are no results yet, look for 'insteadof' substitutions in URL and try again.\n unless user && project\n short, base = github_insteadof_matching(config_hash, url)\n if short and base\n url = url.sub(short, base)\n user, project = github_user_and_project(url)\n end\n end\n [user, project]\n end",
"def repository_base_url(result)\n if result['slug'] && AppConfig[:use_human_readable_urls]\n url = \"repositories/\" + result['slug']\n else\n url = result['uri']\n end\n\n return url\n end",
"def name_from_url(url)\n return '' unless url.present?\n start = url.index('original/') + 'original/'.length\n url[start..-12]\n end",
"def human_url\n return data()['project_uri']\n end",
"def page_url\n if service == 'stash' && protocol == 'ssh'\n pattern = /(.*)@([^:]*):?([^\\/]*)\\/([^\\/]*)\\/(.*)\\.git/\n replacement = 'https://\\2/projects/\\4/repos/\\5/browse?at=' +\n current_branch\n elsif service == 'stash' && protocol == 'http'\n pattern = /(.*)@([^:\\/]*)(:?[^\\/]*)\\/(.*)scm\\/([^\\/]*)\\/(.*)\\.git/\n replacement = 'https://\\2\\3/\\4projects/\\5/repos/\\6/browse?at=' +\n current_branch\n elsif protocol == 'ssh'\n pattern = /(.*)@(.*):(.*)\\.git/\n replacement = 'https://\\2/\\3/'\n elsif protocol == 'http'\n pattern = /https?\\:\\/\\/(([^@]*)@)?(.*)\\.git/\n replacement = 'https://\\3/'\n end\n origin_url.sub(pattern, replacement)\n end",
"def giturl(project_name, repo_name) ; end",
"def gitorious_remote_url\n output = `git remote -v`.scan(/^#{remote}\\s+(.*).git(.*)/)\n if output\n output.first[0]\n end\n end",
"def github_url_matching(url)\n matches = /github\\.com.(.*?)\\/(.*)/.match(url)\n matches ? [matches[1], matches[2].sub(/\\.git\\z/, '')] : [nil, nil]\n end",
"def normalize(url)\n uri = URI.parse(url)\n\n source = {}\n source['url'] = \"#{uri.scheme}://#{uri.host}#{uri.path.gsub(/.git$/, '')}\"\n source['token'] = uri.user if uri.user\n source['branch'] = uri.fragment if uri.fragment\n\n source\n end",
"def github_repo\n self.github_url&.gsub(\"https://github.com/\", \"\")\n end",
"def extract_url\n URI.extract(comment, %w[http https])[0]\n end",
"def repo_name\n return unless @url\n @repo_name ||= Octokit::Repository.from_url(@url).to_s.chomp('.git')\n end",
"def uri_to_repo(uri)\n\tparsed = URI.parse(uri)\n\tnew_uri = parsed.to_s\n\tnew_uri.gsub!(\"https\", \"http\") if parsed.scheme == \"https\"\n\tnew_uri.chop! if new_uri[-1] == \"/\"\n\tif @bigboy.value?(new_uri)\n\t\tputs \"\\nThe repo for \" + \"#{ARGV[0]} \".green + \"is \" + \"#{@bigboy.key(new_uri)}\".red\n\telsif @bigboy.values.flatten.include?(new_uri)\n\t\tarrays = @bigboy.values.select { |n| n.is_a?(Array) }\n\t\tmatches = arrays.select { |n| n.include?(new_uri) }\n\t\tputs \"\\nThe repo for \" + \"#{ARGV[0]} \".green + \"is \" + \"#{@bigboy.key(matches.flatten)}\".red\n\telse \n\t\tputs \"\\nSorry, I can't find that URI.\".magenta\n\tend\nend",
"def get_filename\n File.basename(url)[/(?:(?!\\?|#).)*/] || File.basename(url)\n end",
"def repository_display\n if ENV['EAD'].present?\n if File.directory?(Rails.root.join(ENV['EAD']))\n return ENV['EAD'].split(\"\\/\")[-1]\n else\n return ENV['EAD'].split(\"\\/\")[-2]\n end\n end\n end",
"def parse_url(input)\n hosts = \"github\\.com|bitbucket\\.org|gitlab\\.com\"\n\n # HTTPS/HTTP link pointing to recognised hosts\n if input =~ /^(?:https?:\\/\\/)?(?:[^.@]+@)?(?:www\\.)?(#{hosts})\\/([^\\/]+)\\/([^\\/]+)/i\n { host: $1.downcase(), user: $2, repo: $3.sub(/\\.git$/, \"\") }\n # SSH\n elsif input =~ /^git@(#{hosts}):([^\\/]+)\\/([^\\/]+)\\.git$/i\n { host: $1.downcase(), user: $2, repo: $3 }\n # provider:user/repo\n elsif input =~ /^(github|bitbucket|gitlab):\\/?([^\\/]+)\\/([^\\/]+)\\/?$/i\n { host: $1.downcase(), user: $2, repo: $3 }\n # user/repo - Common GitHub shorthand\n elsif input =~ /^\\/?([^\\/]+)\\/([^\\/]+)\\/?$/\n { host: \"github.com\", user: $1, repo: $2 }\n else\n raise \"Unsupported URL: #{input}\"\n end\nend",
"def username_from_cmd\n if self.is_git?\n return self.cmd_opt.gsub(\"'\",\"\").split(\"/\")[0] if !self.cmd_opt.empty?\n elsif self.is_hg?\n return self.cmd_opt.split(\" \")[1].split(\"/\")[0] if !self.cmd_opt.empty?\n end\n end",
"def extract_host(u)\n URI.split(u).compact[1]\n end",
"def parse_gist_id(link_url)\n gist_id = \n if link_url.match? '</script>' \n link_url.sub(/.js\"><\\/script>/, '') \n elsif link_url.match? '.git' \n link_url.sub(/.git$/, '') \n else \n link_url \n end \n File.basename(gist_id)\n end",
"def headsign\n url.to_s =~ /information\\/([a-z]+)\\//\n $1\n end",
"def repo_name\n if self.is_git?\n return self.cmd_opt.gsub(\"'\",\"\").split(\"/\")[-1] if !self.cmd_opt.empty?\n elsif self.is_hg?\n return self.cmd_opt.split(\" \")[1].split(\"/\")[-1] if !self.cmd_opt.empty?\n end\n end",
"def domain_name(url)\n #url.gsub(/http:|https:|www.|\\/\\/|.com.*/,'')\n url.gsub(/http:|https:|www.|\\/\\//,'').split('.').first\nend",
"def name_for_url(url)\n base_from_host_and_path = lambda do |host, path|\n if host\n base = host.split('.')[-2] || host\n base += '-'\n else\n base = ''\n end\n\n base + path.gsub(/.git$/, '').gsub(%r{^/}, '').split('/').join('-')\n end\n\n case url.to_s.downcase\n when %r{github.com[:/]+cocoapods/specs}\n base = Pod::MasterSource::MASTER_REPO_NAME\n when %r{github.com[:/]+(.+)/(.+)}\n base = Regexp.last_match[1]\n when %r{^\\S+@(\\S+)[:/]+(.+)$}\n host, path = Regexp.last_match.captures\n base = base_from_host_and_path[host, path]\n when URI.regexp\n url = URI(url.downcase)\n base = base_from_host_and_path[url.host, url.path]\n else\n base = url.to_s.downcase\n end\n\n name = base\n infinity = 1.0 / 0\n (1..infinity).each do |i|\n break unless source_dir(name).exist?\n name = \"#{base}-#{i}\"\n end\n name\n end",
"def git_ref\n `git rev-parse --short HEAD`.strip\nend",
"def exctract_locale_from_url(url)\n url[/^([^\\/]*\\/\\/)?[^\\/]+\\/(\\w{2})(\\/.*)?/,2]\n end",
"def pageTitle(url)\r\n<<<<<<< HEAD\r\n\r\nresult = open(url).read.scan(/<title>(.*?)<\\/title>/)[0]\r\n result[0]\r\n\r\n=======\r\n # Fetch and parse HTML document\r\n doc = Nokogiri::HTML(open(url))\r\n doc.search('title').children[0].text\r\n>>>>>>> d785f49315f21edd5329234273e9431f9c199eea\r\nend",
"def extract_work_id( url )\n /^.*\\/(\\d+-\\d+-.*)$/.match( url )[ 1 ]\nend",
"def extract_host(u)\n URI.split(u).compact[1]\n end",
"def parse_username_from_url\n URI.parse(url_from_attributes).path.split(\"/\")[1]\n rescue URI::BadURIError, URI::InvalidURIError\n nil\n end",
"def get_project_url(book)\n if repo_exists?(book.repo_id)\n project_url = client.repository(book.repo_id).html_url\n else\n project_url = \"https://github.com/\" + book.gh_full_name.to_s # the .to_s covers the weird situation when there may be no gh_full_name.\n end\n rescue Octokit::NotFound\n nil\n end",
"def github_repo_name path\n origin = remote_origin_url path\n\n if origin == \"\"\n raise NotGitHubRepo.new \"No remote origin URL: #{path}\"\n end\n\n clone_url = parse_url origin\n\n if clone_url.host.downcase != \"github.com\"\n raise NotGitHubRepo.new \"Not a GitHub repo: #{path}\"\n end\n\n chop_extension chop_leading_slash clone_url.path\n end",
"def parse_url(url)\n regex = /(?:.be\\/|\\/watch\\?v=|\\/(?=p\\/))([\\w\\/\\-]+)/\n url.match(regex)[1] unless url.match(regex).nil?\n end",
"def github_user_and_project(github_url)\n matches = /github\\.com.(.*?)\\/(.*)/.match(github_url)\n matches ? [matches[1], matches[2].sub(/\\.git\\z/, '')] : [nil, nil]\n end",
"def nice_url\n if homepage\n if Addressable::URI.parse(homepage)\n Addressable::URI.parse(homepage).host\n else\n homepage.first(15)\n end\n else\n \"\"\n end\n end",
"def nice_url\n if homepage\n if Addressable::URI.parse(homepage)\n Addressable::URI.parse(homepage).host\n else\n homepage.first(15)\n end\n else\n \"\"\n end\n end",
"def repository\n if ladnn?\n ['University of California, Los Angeles. Library. Department of Special Collections']\n else\n # Replace marc codes with double dashes and no surrounding spaces\n map_field(:repository)&.map { |a| a.gsub(/ \\$[a-z] /, ' ') }\n end\n end",
"def getWikiRepositoryUrl(full = true)\n\n @host = 'https://github.com/'\n\n if @conf['wikiToJekyll']['wiki_repository_url']\n url = @conf['wikiToJekyll']['wiki_repository_url'].sub('.wiki.git', '') + '/wiki'\n else\n url = @host + @conf['wikiToJekyll']['user_name'] + '/' + @conf['wikiToJekyll']['repository_name'] + '/wiki'\n end\n\n if full == false\n return url.sub(@host, '')\n else\n return url\n end\n end",
"def test_to_s\n GIT_URLS.each do |url_data|\n url = url_data[:url]\n to_s = Git::URL.parse(url).to_s\n assert_equal(url, to_s, \"Parsed URI#to_s does not return the original URL '#{url}' correctly\")\n end\n end",
"def name_to_url(name)\n \"https://github.com/#{name}.git\"\n end",
"def slashless_url(url)\n url.chomp('/')\n end",
"def repo_name\n # the repo is the last part of the path\n return self.cmd_opt.gsub(\"'\",\"\").split(\"/\")[-1] if !self.cmd_opt.empty?\n end",
"def url_of_git_repo(remote_name)\n `git config remote.#{remote_name}.url`.strip\n end",
"def social_media_name(url)\n if url.include?(\"www\")\n url_name = url.gsub(\"https://www.\",\"\")\n url_name = url_name.split(\".com\").unshift\n url_name[0]\n elsif url.include?(\"https\")\n url_name = url.gsub(\"https://\",\"\")\n url_name = url_name.split(\".com\").unshift\n url_name[0]\n else\n url_name = url.gsub(\"http://\",\"\")\n url_name = url_name.split(\".com\").unshift\n url_name[0]\n end\nend",
"def extract_accession_from_url(url)\n parts = url.split(@base_url + '/study/')\n parts.last.split('/').first\n end",
"def get_host_from_url(url)\n return url[0...url.index(\"/\")]\nend",
"def extract_git_revision\n path = File.expand_path('../..', File.dirname(__FILE__))\n `git --git-dir #{path}/.git rev-parse --short HEAD`.strip\n end",
"def full_url\n\t\tcase typ\n\t\twhen /wikipedia_(..)/\n\t\t\treturn \"http://\"+$~[1]+\".wikipedia.org/wiki/\"+url\n\t\twhen \"gutenberg.org\"\n\t\t\treturn \"http://www.gutenberg.org/author/\"+url\n\t\twhen \"gutenberg.spiegel.de\"\n\t\t\treturn \"http://gutenberg.spiegel.de/autoren/\"+url+\".htm\"\n\t\twhen \"fictionfantasy.de\"\n\t\t\treturn \"http://www.fictionfantasy.de/load.php?name=News&file=article&sid=\"+url\n\t\twhen \"homepage\", \"sonstiges\"\n\t\t\t# return url\n\t\telse\n\t\t\t# return url\n\t\tend\n\t\tif url.starts_with? \"http://\" then\n\t\t\treturn url\n\t\telse\n\t\t\treturn \"http://\"+url\n\t\tend\n\t\t# TODO\n\t\t# dsfdb.org, isfdb.org\n\t\t# perrypedia, perry-rhodan.net link\n\t\t# http://www.nemesisarchiv.de.vu/\n\tend",
"def canonical_repository_url\n \"https://#{@settings.host}/scm/#{attributes[:repository_namespace]}/#{attributes[:repository_name]}.git\"\n end",
"def project_names\n repositories.map { |s| s.match(/[^\\/]*$/)[0] }\n end",
"def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def organization\n matches = SlashDeploy::GITHUB_REPO_REGEX.match(name)\n matches[1]\n end",
"def get_protocol(url)\n url_partitioned_at_colon = url.partition(\":\")\n url_partitioned_at_colon[0]\nend",
"def get_raw_uri(uri_s, branch)\n uri = URI(uri_s)\n\n case uri.host\n when 'github.com'\n uri_split = File.split(uri.path)\n return 'https://raw.githubusercontent.com/%s/%s/%s' % [uri_split[0], uri_split[1].rpartition('.')[0], branch]\n when 'bitbucket.org'\n uri_split = File.split(uri.path)\n return 'https://bitbucket.org/%s/%s/raw/%s' % [uri_split[0], uri_split[1], branch]\n end\n\n return ''\nend",
"def issue_url(api_url)\n # \"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/322\"\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n\n # https://github.com/typed-ember/ember-cli-typescript/issues/322\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..-1]\n html_url\n end",
"def get_host_name(url)\n\tmatch = %r|(https?://)?(?<host>[^/]+)(/.*$)?|.match(url)\n\tmatch['host']\nend",
"def repo_elements\n elements = @url.gsub('https://github.com/', '').split('/').compact.map(&:strip)\n end",
"def repo_github_path\n descrip = %x{git remote -v}.match(/^.+git@github\\.com:(.+\\/.+)\\.git/)\n raise \"Could not find a Github remote\" if descrip.nil?\n descrip[1]\n end",
"def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def slug\n urlname.to_s.split('/').last\n end",
"def domain_name(url)\n url.gsub(/http(s)?:\\/\\/(www.)?/, '').match(/[^.]+/)[0]\nend",
"def nice_url\n\t\t# i want to take thr url and remove http:// and www.\n\t\t# gsub is global subsitution\n\t\turl.gsub(\"http://\", \"\").gsub(\"www.\", \"\")\n\tend",
"def uri_to_name(uri)\n uri = URI.parse(uri)\n path = uri.path\n path = path.chomp(File.extname(path))\n path = path.chomp('trunk')\n File.join(uri.host,path).split('/').reverse.join('.')\n #path.split('/').reverse.join('.')\n end",
"def full_url\n if website.match(/[A-Za-z]:\\/\\//)\n website\n else\n \"http://#{website}\"\n end\n end",
"def normalize_url(url)\n Addressable::URI.parse(url).normalize.to_s\n end",
"def fetch_url(body)\n aux = body.split('<link>').last\n aux = aux.split('<pubdate>').first\n aux\n end",
"def gitreponame\n g = Git.open(Dir.pwd)\n control_repo = g.config('remote.origin.url').to_s\n control_repo = control_repo.split('/')\n control_repo = control_repo[-1].chomp.split('.')\n control_repo = control_repo[0]\n output = \"\\\"control_repo\\\": \" + '\"' + control_repo + '\",'\n puts output\nend",
"def category\n path = @path_remote.split('/')\n return path[3] # Could require changes depending on the structure of the maps repo\n end",
"def parse_branch(es_branch)\n es_branch.chomp.split('/').last\nend",
"def normalize_url(url); end",
"def git_repo_name\n path = File.expand_path(File.dirname(__FILE__))\n # the path looks like /repos/bender.git/hooks\n path.split(%r{/})[-2]\nend",
"def domain_name(url)\n url.gsub(\"www.\",\"\").split(\"//\")[1].split(\"/\")[0].split('.')[0]\nend",
"def repo_url(path = \"\")\n if @repo.url\n url = URI::parse(@repo.url)\n url.path = (url.path + \"/\" + path).gsub(%r'//+', '/')\n url.to_s\n else\n compose_url \"/svc/repo\", @repo.name, path\n end\n end",
"def extract_author_name\n `git config user.name`.strip\n end",
"def repoSlug()\n return ENV['HOMEBREW_PIPELINE_FORMULA_REPO'].split('/')\n end",
"def drop_prefix(repo)\n repo.split('-')[1].to_s.capitalize\nend",
"def git_project_name\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} config --get remote.origin.url\")\n stdout.split('/')[-1].chomp(\".git\").chomp\n end\n end",
"def get_svn_url( dir='.' )\n\tinfo = get_svn_info( dir )\n\treturn info['URL']\nend",
"def url_or_git\n @url || @git || @svn\n end",
"def domain_name(url)\n url.match(/(http[s]?:\\/\\/[\\\\w]{3}?\\.?)(\\w+-?\\w+)/)[-1]\nend",
"def reg_url2; /(.+)\\//; end",
"def reg_url2; /(.+)\\//; end",
"def author\n name.split(/[\\/-]/).first\n end",
"def source\n return BASE_SOURCE_URL + '/' + repo_id unless path_extension\n BASE_SOURCE_URL + '/' + repo_id + '/' + path_extension.sub(%r{^\\s*/}, '').sub(%r{/\\s*$}, '')\n end",
"def clean_from_i18n(url)\n parts = url.split('/').select { |p| p && p.size > 0 }\n parts.shift if langs.map(&:to_s).include?(parts[0])\n parts.join('/')\n end",
"def owner_and_repo_name(assignment_or_submission)\n assignment_or_submission.repourl.split('/')[-2..-1].join('/')[0..-5]\n end",
"def url\n RepoURL.new(@repo[:html_url]).repo_url\n end",
"def slug\n urlname.to_s.split(\"/\").last\n end"
] |
[
"0.75882846",
"0.687914",
"0.6862683",
"0.67006266",
"0.6687775",
"0.66173285",
"0.65410864",
"0.64908105",
"0.6456824",
"0.6399951",
"0.63889337",
"0.6376433",
"0.6371352",
"0.63341993",
"0.62853706",
"0.6277719",
"0.6247843",
"0.62295043",
"0.6168993",
"0.6160706",
"0.6143234",
"0.6112895",
"0.6061886",
"0.6056642",
"0.60496235",
"0.6010632",
"0.59826016",
"0.5971137",
"0.59664917",
"0.59463346",
"0.5929745",
"0.5921112",
"0.5920098",
"0.5912945",
"0.59078634",
"0.5906738",
"0.5903197",
"0.59026515",
"0.5901042",
"0.589598",
"0.58794487",
"0.580831",
"0.58056414",
"0.57999134",
"0.5796847",
"0.5796724",
"0.57848793",
"0.57848793",
"0.57784355",
"0.57773197",
"0.5774854",
"0.57666427",
"0.5766208",
"0.5754092",
"0.5752404",
"0.5735888",
"0.5731539",
"0.57306224",
"0.5720908",
"0.5720445",
"0.5715563",
"0.56961036",
"0.56497306",
"0.5646293",
"0.56459427",
"0.56446725",
"0.56410265",
"0.5626377",
"0.562283",
"0.56154376",
"0.56120306",
"0.56112057",
"0.56053835",
"0.56044585",
"0.5597289",
"0.5594049",
"0.55908203",
"0.55837816",
"0.5579505",
"0.5571088",
"0.5569694",
"0.55643743",
"0.55607444",
"0.5550226",
"0.55445755",
"0.55398536",
"0.5538894",
"0.5536211",
"0.5535552",
"0.5533451",
"0.55194354",
"0.55180687",
"0.5508917",
"0.5508917",
"0.5508734",
"0.55056775",
"0.5501068",
"0.54993236",
"0.5496111",
"0.5487609"
] |
0.7497892
|
1
|
Indicates whether its possible to capture the payment
|
def can_capture?(payment)
(payment.pending? || payment.checkout?) && !payment.response_code.blank?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.state == 'pending' || payment.state == 'checkout'\n end",
"def can_capture?(payment)\n ['pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n ['pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n payment.checkout?\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n logger.debug \"\\n----------- #{self.invoice_number} -----------\\n\"\n ['checkout', 'pending', 'processing'].include?(payment.state) && !self.invoice_number.blank?\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n ['checkout', 'pending', 'processing'].include?(payment.state)\n end",
"def collect_payment?\n true\n end",
"def can_supply?\n payment_received? || payment_on_account?\n end",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def can_activate?\n self.authorize_payment\n end",
"def can_void?(payment)\n !payment.failed? && !payment.void?\n end",
"def can_void?(payment)\n !payment.failed? && !payment.void?\n end",
"def can_void?(payment)\n !payment.void?\n end",
"def can_void?(payment)\n !payment.void?\n end",
"def can_finish?\n self.payment_status == PTE::PaymentStatus.processing\n end",
"def payment_success?\n @fields['decision'] == 'ACCEPT'\n end",
"def in_payment?\n @in_payment\n end",
"def is_manual?\n payment_kind == 'manual'\n end",
"def can_credit?(payment)\n return false unless payment.state == 'completed'\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def guard_process_payment_from_created; true; end",
"def guard_process_payment_from_created; true; end",
"def capture_pending_payments\n success = true\n order.payments.pending.each do |payment|\n unless payment.capture!\n copy_errors(payment)\n success = false\n end\n end\n success\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def can_void?(payment)\n !%w(void failure invalid).include?(payment.state)\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n !payment.state.in?(['void', 'invalid', 'failed'])\n end",
"def can_void?(payment)\n !payment.void? && payment.pending? && !payment.response_code.blank?\n end",
"def can_void?(payment)\n !payment.void? && payment.pending? && !payment.response_code.blank?\n end",
"def can_cash?\n self.capture_and_cash\n end",
"def payment_cadence_allowed?\n begin\n config_payment_cadence = SystemConfiguration::Variable.get_value('booking.payment_cadence').to_i\n _date_from_str = \"#{self.date_from.strftime('%Y-%m-%d')}T#{self.time_from}:00#{self.date_from.strftime(\"%:z\")}\"\n _date_from = DateTime.strptime(_date_from_str,'%Y-%m-%dT%H:%M:%S%:z')\n diff_in_hours = ((_date_from.to_time - self.creation_date.to_time).to_f * 24).to_i\n allowed = diff_in_hours > 0 && (diff_in_hours >= config_payment_cadence)\n allowed || force_allow_payment\n rescue => error\n p \"Error #{id} #{date_from} #{time_from} #{date_to} #{time_to} #{driver_date_of_birth} #{driver_driving_license_date}\"\n return false\n end\n end",
"def should_request_capture?(response, requires_approval)\n !capture_requested?(response) && requires_approval != false\n end",
"def store_credit_card?\n paid?\n end",
"def payment_api_return?\n\t\ttrue\n\tend",
"def payment_received?\n payment_state == PAYMENT_RECEIVED\n end",
"def payed?\n !payment_entry.nil?\n end",
"def credit_card_needed?\n credit_card_required?\n end",
"def paid_with_card?\n payment_type == \"card\"\n end",
"def authorize_payment\n if !self.pending_purchase_order && self.payment_object\n order, payment = self.purchase_and_authorize\n if payment && payment.success?\n# self.payment_object = nil # remove payment object so we can re-validate\n self.purchase_orders.reload\n return payment.success?\n end\n end\n false\n end",
"def credit?\n (payment_method == CREDIT)\n end",
"def capture_payment(options = {})\n # transaction do\n capture = OrderTransaction.capture(amount, authorization_reference, options)\n self.save!\n self.order_transactions << capture\n\n if capture.success?\n self.payment_captured!\n else\n self.transaction_declined!\n end\n\n capture\n # end\n end",
"def succeeded?\n authorized? || paid?\n end",
"def authorize_and_capture\n \n resp = StdClass.new \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"Funds for this invoice have already been captured.\"\n else\n \n sc = self.site.store_config \n case sc.pp_name \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin\n c = Stripe::Charge.create(\n :amount => (self.total * 100).to_i,\n :currency => 'usd',\n :customer => self.customer.stripe_customer_id,\n :capture => true,\n :metadata => { :invoice_id => self.id },\n :statement_descriptor => \"#{self.site.description.truncate(22)}\"\n ) \n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.id,\n :transaction_id => c.id,\n :transaction_type => InvoiceTransaction::TYPE_AUTHCAP,\n :payment_processor => sc.pp_name,\n :amount => c.amount / 100.0,\n :captured => true,\n :date_processed => DateTime.now.utc,\n :success => c.status == 'succeeded'\n )\n if c.status == 'succeeded'\n self.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n \n end \n end \n return resp\n end",
"def authorizable_cc_payment?\n adyen_cc_payment? && amount != 0\n end",
"def payment_pending?\n payment_state == PAYMENT_PENDING\n end",
"def payment_in_progress?\n\t\t\t\t\treturn !self.payment_id.nil?\n\t\t\t\tend",
"def paid_with_card?\n order.payment_method == 'credit_card'\n end",
"def capture!\n if hpp_payment? || adyen_cc_payment?\n amount = money.money.cents\n process do\n payment_method.send(\n :capture, amount, response_code, gateway_options)\n end\n else\n super\n end\n end",
"def payment_confirmation_required?\n true\n end",
"def payment_authorized?(payment_id)\n check_payment = get_payment_intent_info(payment_id)\n status = check_payment['status']\n puts \"Current Payment Status: #{status}\"\n case status\n when 'Authorized', 'Card Verified'\n puts 'Payment has been authorized'\n return true\n # when 'Declined'\n # puts \"Reason for Decline: #{check_payment['response_summary']}\"\n # abort 'Payment has been declined so exiting this program'\n end\n puts \"3DS Flow hasn't been completed\"\n false\n end",
"def payment_profiles_supported?\n false\n end",
"def payments_in_use?\n payment_gateway.present? && payment_gateway.configured?\n end",
"def purchase!\n if ratepay?\n capture!\n elsif adyen_cc_payment?\n authorize!\n capture!\n else\n super\n end\n end",
"def requires_manual_payment?\n Paykido::Application.config.always_pay_manually or\n !self.payer.registered?\n end",
"def charge_is_allowed?\n\t\tif not customer_has_authorized_payment?\n\t\t\terrors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized')\n\t\t\tfalse\n\t\telsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount\n\t\t\ttrue\n\t\telse\n\t\t\terrors.add :charge_amount, I18n.t('views.customer_file.new_charge.invalid', amount: charge_amount_usd) if errors.empty?\n\t\t\tfalse\n\t\tend\n\tend",
"def check(payment)\n retval\n end",
"def payment_received?\n status == Enums::PaymentStatus::PAYMENT_RECEIVED\n end",
"def claim_amount_required?\n @full_repayment_of_ads != 'Y'\n end",
"def payment_failed?\n cancel_reason == PAYMENT_FAILED\n end",
"def capture!(capture_amount = nil)\n if hpp_payment? || adyen_cc_payment? || ratepay?\n amount = money.money.cents\n process do\n payment_method.send(\n :capture, amount, response_code, gateway_options)\n end\n else\n super\n end\n end",
"def require_one_click_payment?(source, shopper)\n false\n end",
"def settled_payment?\n SUCCESSFUL_PAYMENT.include?(response['payment_state'])\n end",
"def credit_card?\n (payment_method == CREDIT_CARD)\n end",
"def cc_pay?\n plan&.direct_pay && id != 3744\n end",
"def capture\n begin \n Order.transaction do\n # lock order\n Order.find_by_id(self.id, :lock => true)\n # go through all order_payments\n order_payments = self.order_payments\n if order_payments.size == 0\n p \"No order_payments to process.\"\n raise PaymentError, \"No order_payments to process.\"\n end\n for order_payment in order_payments\n order_payment.capture!\n end\n self.upgrade_coupons!\n # update order\n self.update_attributes!(:state => Order::PAID, :paid_at => Time.zone.now)\n end\n # send confirmation email\n user = User.find_by_id(self.user_id)\n if user and user.send_confirmation(self.deal_id)\n return true\n else\n logger.error \"Order.capture: Confirmation email failed to send: #{self.inspect}\"\n return false\n end\n rescue PaymentError => pe\n p \"Order.capture: Failed for Order #{self.inspect} #{pe}\"\n logger.error \"Order.capture: Failed for Order #{self.inspect} #{pe}\"\n rescue ActiveRecord::RecordInvalid => invalid\n p \"Order.capture: Failed for Order #{self.inspect} #{invalid}\"\n logger.error \"Order.capture: Failed for Order #{self.inspect} #{invalid}\"\n end\n return false\n end",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && stripe_in_use?\n end",
"def success?\n @result[:payment] === true\n end",
"def verify!\n raise \"Payment details not active anymore\" if active == false\n end",
"def payments_in_use?\n active_payment_types.present?\n end",
"def valid?\n p = build_payment\n p.valid?\n end",
"def process_with_active_merchant\n options = populate_options\n auth = authorize_payment(options)\n save!\n if APP_CONFIG['pre_and_post_authorization'] == true\n if auth.success == true\n capture_payment(options)\n save!\n end\n end\n end",
"def customer_has_authorized_payment?\n\t\tauthorized and authorized_amount.try(:>, 0) and has_customer_account?\n\tend",
"def charge?\n false\n end",
"def recording_consent_required?\n @settings.get_value(\"Require Recording Consent\") == \"true\"\n end",
"def can_request_purchase?\n true # TODO: Should this be !virginia_borrower? ?\n end",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && payments_in_use?\n end",
"def trial?\n price_is_zero = price_amount_micros == 0\n price_is_zero && payment_received?\n end",
"def pending?\n payment_status == 'Pending'\n end",
"def paid_in_full?\n !payment_outstanding?\n end",
"def allow_paypal_payments?\n paypal_credentials.present? || paypal_email.present?\n end",
"def can_pay?\n\n can_pay_deposit? or can_pay_pending? or can_pay_total?\n\n end",
"def accounts_receivable?\n type == 'ACCRECCREDIT'\n end"
] |
[
"0.85729873",
"0.85729873",
"0.85729873",
"0.85729873",
"0.85729873",
"0.8420432",
"0.8406321",
"0.83981603",
"0.83726627",
"0.829914",
"0.829914",
"0.828406",
"0.82830316",
"0.8244026",
"0.76950306",
"0.7235041",
"0.713248",
"0.713248",
"0.71195644",
"0.71080416",
"0.71080416",
"0.7005773",
"0.7005773",
"0.69779176",
"0.6975019",
"0.6921355",
"0.69058096",
"0.68789953",
"0.6876702",
"0.6876702",
"0.68762946",
"0.6872367",
"0.6872367",
"0.6854131",
"0.6854131",
"0.6842146",
"0.6827694",
"0.6827694",
"0.6827694",
"0.6827694",
"0.6827694",
"0.6827694",
"0.6827694",
"0.68064374",
"0.6796303",
"0.6796303",
"0.67894185",
"0.67650485",
"0.67424446",
"0.6704456",
"0.66925323",
"0.6680071",
"0.66567975",
"0.6649024",
"0.6637736",
"0.6599646",
"0.6593542",
"0.65555614",
"0.6555427",
"0.65268964",
"0.6496969",
"0.64766335",
"0.646978",
"0.6467526",
"0.645761",
"0.64390147",
"0.6434088",
"0.6424098",
"0.64111865",
"0.64039373",
"0.63921285",
"0.6389036",
"0.63881683",
"0.63875073",
"0.63688964",
"0.63652784",
"0.6361623",
"0.63534945",
"0.6340304",
"0.632217",
"0.6304796",
"0.6294159",
"0.6277918",
"0.627215",
"0.6268468",
"0.6257798",
"0.6255726",
"0.62518835",
"0.6241664",
"0.62287885",
"0.6182343",
"0.617595",
"0.61728007",
"0.61709654",
"0.61609876",
"0.61515343",
"0.61412215",
"0.61371917",
"0.6122616"
] |
0.83415586
|
10
|
Indicates whether its possible to void the payment.
|
def can_void?(payment)
!payment.void? && payment.pending? && !payment.response_code.blank?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n !payment.void?\n end",
"def can_void?(payment)\n !payment.void?\n end",
"def can_void?(payment)\n !payment.failed? && !payment.void?\n end",
"def can_void?(payment)\n !payment.failed? && !payment.void?\n end",
"def can_void?(payment)\n !payment.state.in?(['void', 'invalid', 'failed'])\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n payment.state != 'void'\n end",
"def can_void?(payment)\n !%w(void failure invalid).include?(payment.state)\n end",
"def can_finish?\n self.payment_status == PTE::PaymentStatus.processing\n end",
"def try_void(payment)\n transaction = braintree.transaction.find(payment.response_code)\n if transaction.status.in? SolidusBraintree::Gateway::VOIDABLE_STATUSES\n # Sometimes Braintree returns a voidable status although it is not voidable anymore.\n # When we try to void that transaction we receive an error and need to return false\n # so Solidus can create a refund instead.\n begin\n void(payment.response_code, nil, {})\n rescue ActiveMerchant::ConnectionError => e\n e.message.match(NON_VOIDABLE_STATUS_ERROR_REGEXP) ? false : raise(e)\n end\n else\n false\n end\n end",
"def payed?\n !payment_entry.nil?\n end",
"def payment_failed?\n cancel_reason == PAYMENT_FAILED\n end",
"def payment_pending?\n payment_state == PAYMENT_PENDING\n end",
"def cancel_payment\n\n\t\t\t\t\t# Delete payment id\n\t\t\t\t\tself.payment_id = nil\n\t\t\t\t\t\n\t\t\t\t\t# Save\n\t\t\t\t\tself.override_accept_terms\n\t\t\t\t\tif !self.save\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\treturn true\n\t\t\t\tend",
"def void_payment(event)\n payment = extract_payment_from_event(event)\n reason = event.data.object.cancellation_reason\n\n payment.with_lock do\n break if payment.void?\n\n payment.void!.tap do\n SolidusStripe::LogEntries.payment_log(\n payment,\n success: true,\n message: \"Payment was voided after payment_intent.voided webhook (#{reason})\"\n )\n end\n end\n end",
"def void_transaction!(authorization)\n response = provider_payment_gateway.void(authorization)\n log_gateway_response(response, \"void [transaction: #{authorization}]\")\n response.success?\n end",
"def paid_in_full?\n !payment_outstanding?\n end",
"def can_supply?\n payment_received? || payment_on_account?\n end",
"def void\n @order.void_payment\n render 'status'\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def paid_up?\n if payment_item.is_a? GeneralPaymentItem\n outstanding_amount <= 0.0\n else\n nil\n end\n end",
"def settled_payment?\n SUCCESSFUL_PAYMENT.include?(response['payment_state'])\n end",
"def payment_in_progress?\n\t\t\t\t\treturn !self.payment_id.nil?\n\t\t\t\tend",
"def collect_payment?\n true\n end",
"def pending?\n payment_status == 'Pending'\n end",
"def in_payment?\n @in_payment\n end",
"def incomplete_payment?\n past_due || incomplete\n end",
"def donor_can_cancel?\n !received?\n end",
"def can_capture?(payment)\n payment.state == 'pending' || payment.state == 'checkout'\n end",
"def can_capture?(payment)\n ['pending'].include?(payment.state)\n end",
"def prepaid?\n not postpaid?\n end",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && payments_in_use?\n end",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def trial?\n price_is_zero = price_amount_micros == 0\n price_is_zero && payment_received?\n end",
"def can_capture?(payment)\n ['pending'].include?(payment.state)\n end",
"def charge?\n false\n end",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && stripe_in_use?\n end",
"def can_capture?(payment)\n (payment.pending? || payment.checkout?) && !payment.response_code.blank?\n end",
"def can_capture?(payment)\n (payment.pending? || payment.checkout?) && !payment.response_code.blank?\n end",
"def payment_intent_cancelled?\n status == 'Payment Intent Cancelled'\n end",
"def unredeemable?\n payment_owed? && !(ProductStrategy === self.order.promotion.strategy) \n end",
"def payment_success?\n @fields['decision'] == 'ACCEPT'\n end",
"def succeeded?\n authorized? || paid?\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n ['checkout', 'pending', 'processing'].include?(payment.state)\n end",
"def can_capture?(payment)\n logger.debug \"\\n----------- #{self.invoice_number} -----------\\n\"\n ['checkout', 'pending', 'processing'].include?(payment.state) && !self.invoice_number.blank?\n end",
"def payment_api_return?\n\t\ttrue\n\tend",
"def can_credit?(payment)\n return false unless payment.state == 'completed'\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def is_deletable\n not is_default_cash_gift\n end",
"def payment_authorized?(payment_id)\n check_payment = get_payment_intent_info(payment_id)\n status = check_payment['status']\n puts \"Current Payment Status: #{status}\"\n case status\n when 'Authorized', 'Card Verified'\n puts 'Payment has been authorized'\n return true\n # when 'Declined'\n # puts \"Reason for Decline: #{check_payment['response_summary']}\"\n # abort 'Payment has been declined so exiting this program'\n end\n puts \"3DS Flow hasn't been completed\"\n false\n end",
"def delete_permitted(mem)\n unless mem.suspended? || mem.mem_state.strip == StateNameTable::WaitPayment\n error \"Only TeamPaks awaiting payment can be deleted\"\n return false\n end\n\n @orders = Order.list_for_membership(mem.mem_id)\n\n @orders.each do |order|\n pays = Pays.for_order(order)\n unless pays.empty?\n error \"Cannot delete a TeamPak after orders associated with it have been paid\"\n return false\n end\n LineItem.items_for_order(order.order_id) do |li|\n if li.li_date_shipped\n error \"Cannot delete: '#{li.li_desc}' has been shipped\"\n return false\n end\n end\n end\n true\n end",
"def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def user_must_pay?\n !journal_will_pay? &&\n !institution_will_pay? &&\n (!submitter_affiliation.present? || !submitter_affiliation.fee_waivered?)\n end",
"def test_credit_card_purchase_and_void_amount_not_specified\n assert purchase = @gateway.purchase(@amount, @credit_card, @options)\n assert_success purchase\n assert_equal 'Approved', purchase.message\n assert void = @gateway.void(nil, purchase.authorization, @credit_card, @options)\n assert_failure void\n assert_equal 'TRANSACTION AMOUNT IS REQUIRED', void.message\n end",
"def awaiting_disbursement?\n financial_aid_approved? && !disbursed?\n end",
"def user_must_pay?\n !journal&.will_pay? && !institution_will_pay? && !funder_will_pay?\n end",
"def descriptively_ok?\n acceptance & DESCRIPTIVE == DESCRIPTIVE\n end",
"def process_cancellation!\n if payment.settled?\n # If we have the money, refund it.\n if payment.refund!\n return_stock\n IslayShop::OrderMailer.cancelled(self).deliver\n next!(\"Credited #{formatted_total}\")\n else\n fail!(\"Could not refund payment due to a problem with the payment provider\")\n end\n else\n # If the payment provider supports voiding, void\n if payment.can_void?\n if payment.void!\n return_stock\n IslayShop::OrderMailer.cancelled(self).deliver\n next!(\"Payment has been voided\")\n else\n fail!(\"Could not void payment due to a problem with the payment provider\")\n end\n else\n # Let the authorization expire:\n return_stock\n IslayShop::OrderMailer.cancelled(self).deliver\n next!(\"Payment can't be voided: the authorization will expire, usually within 7 days.\")\n end\n end\n end",
"def may_purchase?(_company)\n false\n end",
"def payment_received?\n payment_state == PAYMENT_RECEIVED\n end",
"def void(unique_id)\n request('payment/void', :void => {:unique_id => unique_id} )\n end",
"def can_submit?\n # First check the state machine to see if it is Ok to submit based on the\n # current state\n b = super()\n if b\n # Now check that the CP has funding\n b = false unless total_cost > 0\n #b = false unless funding_difference <= 0\n end\n b\n end",
"def deal_with_payment\n if human_amount_due <= 0\n update_attributes!(active: false)\n lease.mark_next_active_from_date(self.due_date)\n else\n true\n end\n end",
"def destroy\n if delete_payment_profile and super\n return true\n else\n return false\n end\n end",
"def approved?\n !self.pending\n end",
"def test_authorization_and_void\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert void = @gateway.void(authorization.authorization)\n assert_success void\n assert_match(/This transaction has been approved/, void.message)\n end",
"def pending?\n payment_at.nil?\n end",
"def can_reject?\n !accepted? && !rejected? && !withdrawn?\n end",
"def reject!\n return false if self.approved == true\n self.destroy\n end",
"def can_pay_pending?\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n conf_payment_pending = SystemConfiguration::Variable.get_value('booking.allow_pending_payment', 'false').to_bool\n if (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and conf_payment_pending and self.status != :cancelled\n self.total_paid > 0\n else\n return false\n end\n end",
"def authorizable_cc_payment?\n adyen_cc_payment? && amount != 0\n end",
"def cc_pay?\n plan&.direct_pay && id != 3744\n end",
"def pending?\n !self.canceled?\n end",
"def technically_paid?\n unconfirmed_value_paid >= value_needed\n end",
"def can_capture?(payment)\n payment.checkout?\n end",
"def is_manual?\n payment_kind == 'manual'\n end",
"def verify!\n raise \"Payment details not active anymore\" if active == false\n end",
"def paid?\n current_transaction\n end",
"def approved?\n !pending\n end",
"def free?\n cost == 0.0 || payment_not_required\n end",
"def pending_deletable?\n !pending_delete_prohibited?\n end",
"def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end",
"def require_one_click_payment?(source, shopper)\n false\n end",
"def canceled_by_user?\n cancel_reason == PAYMENT_CANCELED\n end"
] |
[
"0.8435381",
"0.8435381",
"0.8435381",
"0.8435381",
"0.8435381",
"0.8435381",
"0.8435381",
"0.8414637",
"0.8414637",
"0.83615565",
"0.83615565",
"0.8343824",
"0.83381695",
"0.83381695",
"0.8314558",
"0.7034634",
"0.67792964",
"0.6753569",
"0.66845626",
"0.6645172",
"0.655368",
"0.6535386",
"0.6432738",
"0.6413752",
"0.6403974",
"0.6372271",
"0.6345093",
"0.6345093",
"0.6345093",
"0.6345093",
"0.6345093",
"0.62849617",
"0.6275267",
"0.62740374",
"0.6247822",
"0.6243406",
"0.62250245",
"0.62244344",
"0.6211772",
"0.62077403",
"0.6204708",
"0.6200113",
"0.6193152",
"0.61879605",
"0.61879605",
"0.61803544",
"0.6160425",
"0.61593497",
"0.61517215",
"0.6149852",
"0.6149852",
"0.6140135",
"0.6123242",
"0.6090431",
"0.6086983",
"0.6083711",
"0.6083711",
"0.60602254",
"0.60448337",
"0.6035236",
"0.60326016",
"0.60308975",
"0.60161155",
"0.600306",
"0.59985423",
"0.599123",
"0.599123",
"0.5986141",
"0.5981576",
"0.59602255",
"0.5958762",
"0.5958155",
"0.5950703",
"0.5949185",
"0.59418577",
"0.594106",
"0.5934158",
"0.5928771",
"0.59253037",
"0.5919024",
"0.5916805",
"0.59145993",
"0.5911992",
"0.5880878",
"0.5859505",
"0.5856417",
"0.5855412",
"0.58510274",
"0.5847799",
"0.5844867",
"0.5844511",
"0.5842209",
"0.58274215",
"0.5824397",
"0.58237207",
"0.58166313",
"0.58160883",
"0.581278",
"0.58058405"
] |
0.82425183
|
16
|
Indicates whether its possible to credit the payment. Note that most gateways require that the payment be settled first which generally happens within 1224 hours of the transaction.
|
def can_credit?(payment)
return false unless payment.completed?
return false unless payment.order.payment_state == 'credit_owed'
payment.credit_allowed > 0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n return false unless payment.state == 'completed'\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def credit?\n (payment_method == CREDIT)\n end",
"def credit_card_needed?\n credit_card_required?\n end",
"def can_supply?\n payment_received? || payment_on_account?\n end",
"def payment_cadence_allowed?\n begin\n config_payment_cadence = SystemConfiguration::Variable.get_value('booking.payment_cadence').to_i\n _date_from_str = \"#{self.date_from.strftime('%Y-%m-%d')}T#{self.time_from}:00#{self.date_from.strftime(\"%:z\")}\"\n _date_from = DateTime.strptime(_date_from_str,'%Y-%m-%dT%H:%M:%S%:z')\n diff_in_hours = ((_date_from.to_time - self.creation_date.to_time).to_f * 24).to_i\n allowed = diff_in_hours > 0 && (diff_in_hours >= config_payment_cadence)\n allowed || force_allow_payment\n rescue => error\n p \"Error #{id} #{date_from} #{time_from} #{date_to} #{time_to} #{driver_date_of_birth} #{driver_driving_license_date}\"\n return false\n end\n end",
"def credit_card_editable?\n # HACK: HACK HACK\n return false if master?\n provider_account.payment_gateway_configured? && provider_account.billing_strategy.try!(:charging_enabled?)\n end",
"def authorizable_cc_payment?\n adyen_cc_payment? && amount != 0\n end",
"def cc_pay?\n plan&.direct_pay && id != 3744\n end",
"def charge_credit_card(amount)\n true\n end",
"def charge_credit_card(amount)\n true\n end",
"def is_credit_card?\n return true if @lending_type == \"Credit\"\n false\n end",
"def credit_card?\n (payment_method == CREDIT_CARD)\n end",
"def accounts_payable?\n type == 'ACCPAYCREDIT'\n end",
"def store_credit_card?\n paid?\n end",
"def can_cash?\n if self.tier && self.tier.piggy_bank\n if rate = find_bonus_rate\n # transfer cents\n if rate.cents.to_i > 0 && rate.funding_source.piggy_bank &&\n cashed_events_limit_not_reached?(rate.max_events_per_month)\n result = rate.funding_source.piggy_bank.transfer(self.receiver.piggy_bank, \n Money.new(rate.cents, rate.default_currency))\n if result.success?\n self.description = result.message \n return true\n end\n end\n end\n end\n false\n end",
"def settled_payment?\n SUCCESSFUL_PAYMENT.include?(response['payment_state'])\n end",
"def credit_check(proposed_hours)\n credits >= proposed_hours\n end",
"def paid_with_card?\n order.payment_method == 'credit_card'\n end",
"def charge_is_allowed?\n\t\tif not customer_has_authorized_payment?\n\t\t\terrors.add :base, I18n.t('views.customer_file.new_charge.you_are_not_authorized')\n\t\t\tfalse\n\t\telsif valid? and charge_amount.present? and authorized_amount and charge_amount.to_i <= authorized_amount\n\t\t\ttrue\n\t\telse\n\t\t\terrors.add :charge_amount, I18n.t('views.customer_file.new_charge.invalid', amount: charge_amount_usd) if errors.empty?\n\t\t\tfalse\n\t\tend\n\tend",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_capture?(payment)\n payment.pending? || payment.checkout?\n end",
"def can_cash?\n self.capture_and_cash\n end",
"def payment_success?\n @fields['decision'] == 'ACCEPT'\n end",
"def credit_card_missing?\n credit_card_needed? && !credit_card_stored?\n end",
"def can_submit?\n # First check the state machine to see if it is Ok to submit based on the\n # current state\n b = super()\n if b\n # Now check that the CP has funding\n b = false unless total_cost > 0\n #b = false unless funding_difference <= 0\n end\n b\n end",
"def payed?\n !payment_entry.nil?\n end",
"def customer_has_authorized_payment?\n\t\tauthorized and authorized_amount.try(:>, 0) and has_customer_account?\n\tend",
"def can_capture?(payment)\n payment.state == 'pending' || payment.state == 'checkout'\n end",
"def cash?\n (payment_method == CASH)\n end",
"def deal_with_payment\n if human_amount_due <= 0\n update_attributes!(active: false)\n lease.mark_next_active_from_date(self.due_date)\n else\n true\n end\n end",
"def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end",
"def can_pay_pending?\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n conf_payment_pending = SystemConfiguration::Variable.get_value('booking.allow_pending_payment', 'false').to_bool\n if (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and conf_payment_pending and self.status != :cancelled\n self.total_paid > 0\n else\n return false\n end\n end",
"def can_pay?\n\n can_pay_deposit? or can_pay_pending? or can_pay_total?\n\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def can_activate?\n self.authorize_payment\n end",
"def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end",
"def can_capture?(payment)\n (payment.pending? || payment.checkout?) && !payment.response_code.blank?\n end",
"def can_capture?(payment)\n (payment.pending? || payment.checkout?) && !payment.response_code.blank?\n end",
"def can_capture?(payment)\n ['pending'].include?(payment.state)\n end",
"def charge?\n false\n end",
"def can_capture?(payment)\n ['pending'].include?(payment.state)\n end",
"def can_finish?\n self.payment_status == PTE::PaymentStatus.processing\n end",
"def payment_pending?\n payment_state == PAYMENT_PENDING\n end",
"def collect_payment?\n true\n end",
"def is_purchasing_credit?\n sku_type.to_s == Product::SKU_TYPE_PURCHASING_CREDIT && self.internal?\n end",
"def active?(active_because_dd)\n active_as_credit_card = (payment_method == 'Credit Card' && !gpo_processed)\n active_as_check_or_cash = !payment_received\n active = (active_as_credit_card || active_as_check_or_cash)\n should_display = (active_because_dd || slot.semester == Semester.current_semester)\n return active && should_display\n end",
"def locked?\n\t\t\t\t\treturn payment_in_progress? || paid?\n\t\t\t\tend",
"def can_capture?(payment)\n ['checkout', 'pending', 'processing'].include?(payment.state)\n end",
"def accounts_payable?\n type == 'ACCPAY'\n end",
"def pending?\n payment_at.nil?\n end",
"def can_capture?(payment)\n payment.checkout?\n end",
"def charged?\n compliance_data[:charge].to_f > 0.0\n end",
"def can_capture?(payment)\n logger.debug \"\\n----------- #{self.invoice_number} -----------\\n\"\n ['checkout', 'pending', 'processing'].include?(payment.state) && !self.invoice_number.blank?\n end",
"def charge_paypal_account(amount)\n true\n end",
"def charge_paypal_account(amount)\n true\n end",
"def amount_is_valid_for_outstanding_balance_or_credit\n end",
"def charges?\n true\n end",
"def credit_account\n if @invoice.amount\n result = @invoice.bank_account.credit_account(seller_amount) rescue false\n else\n false\n end\n end",
"def paid?\n payment_at?\n end",
"def claim_amount_required?\n @full_repayment_of_ads != 'Y'\n end",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && payments_in_use?\n end",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && stripe_in_use?\n end",
"def charged?\n stripe_charge_id.present?\n end",
"def succeeded?\n authorized? || paid?\n end",
"def in_payment?\n @in_payment\n end",
"def payment_required?\n billing_total.to_f > 0.0\n end",
"def overdue?\n !self.attempt_next_contact_by.nil? && self.attempt_next_contact_by < Time.current\n end",
"def needs_handling_charge?\n true\n end",
"def paid_with_card?\n payment_type == \"card\"\n end",
"def payment_failed?\n cancel_reason == PAYMENT_FAILED\n end",
"def payment_in_progress?\n\t\t\t\t\treturn !self.payment_id.nil?\n\t\t\t\tend",
"def can_charge_subscription?\n # * cannot charge subscription until trial period is running\n # * can only charge with a valid shipped_at or panic event\n !order.blank? && !subscription_deferred? && ( senior.any_panic_received? || !shipped_at.blank?)\n end",
"def valid_account(sports_centre) # pass in current_sports_centre\n if sports_centre != nil\n return true if Date.current <= sports_centre.nextPaymentDue\n else\n return false\n end\n end",
"def to_be_performed?\n self.research_billing_qty > 0\n end",
"def authorize_payment\n if !self.pending_purchase_order && self.payment_object\n order, payment = self.purchase_and_authorize\n if payment && payment.success?\n# self.payment_object = nil # remove payment object so we can re-validate\n self.purchase_orders.reload\n return payment.success?\n end\n end\n false\n end",
"def paid_in_full?\n !payment_outstanding?\n end",
"def can_rent_truck?\n !license.expired? && age >= 60 && license.to_drive_truck?\n end",
"def trial?\n price_is_zero = price_amount_micros == 0\n price_is_zero && payment_received?\n end",
"def payable?\n %w(confirmed bookkept).include?(workflow_state)\n end",
"def cheque?\n (payment_method == CHEQUE)\n end",
"def can_pay_deposit?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_deposit = (['deposit','deposit_and_total'].include?(SystemConfiguration::Variable.get_value('booking.payment_amount_setup', 'deposit')))\n\n if self.status == :pending_confirmation\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and ((!expired? and payment_cadence_allowed?) or force_allow_payment)\n elsif self.status == :confirmed # Confirmed in the back-office without payment\n (conf_payment_enabled or force_allow_payment) and conf_payment_deposit and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end",
"def castle_challenge?\n castle_risk_response&.dig(:policy, :action) == \"challenge\"\n end",
"def charge_donor\n return true unless (self.amount and (self.amount > 0))\n\n begin\n Stripe::Charge.create({\n # amount is in dollars, stripe takes cents\n :amount => self.amount * 100,\n :currency => \"usd\",\n :card => self.stripe_token,\n :description => \"Donation to #{participation.volunteer.name} for #{participation.event.name}\"\n }, self.participation.event.organization.stripe_token)\n return true\n rescue Stripe::StripeError => e\n # Something went wrong. Report that billing failed.\n errors.add(:billing, \"Failed: #{e.message}\")\n return false\n end\n end",
"def technically_paid?\n unconfirmed_value_paid >= value_needed\n end",
"def free?\n cost == 0.0 || payment_not_required\n end",
"def payment_on_account?\n status == Enums::PaymentStatus::PAYMENT_ON_ACCOUNT\n end",
"def user_must_pay?\n !journal&.will_pay? && !institution_will_pay? && !funder_will_pay?\n end",
"def pending?\n payment_status == 'Pending'\n end",
"def minimal_charge_enabled?\n minimal_charge != 0\n end",
"def is_pending?\n generated_at.nil? && !paid_on.nil?\n end",
"def donate?\n\t\t!Rails.env.development? and do_donate && can_donate?\n\tend",
"def pay_by_phone?\n status == Enums::PaymentStatus::PAY_BY_PHONE\n end",
"def is_charge_card?\n return true if @lending_type == \"Charge\"\n false\n end"
] |
[
"0.8107375",
"0.8107375",
"0.7975822",
"0.76718765",
"0.744201",
"0.7196401",
"0.71344215",
"0.6983333",
"0.6979606",
"0.6941891",
"0.6914664",
"0.6914664",
"0.6888789",
"0.68877214",
"0.6849643",
"0.67881995",
"0.67854303",
"0.6768373",
"0.6766829",
"0.6719905",
"0.6660727",
"0.6647179",
"0.6647179",
"0.6647179",
"0.6647179",
"0.6647179",
"0.6629986",
"0.6628843",
"0.66116613",
"0.6562701",
"0.6524958",
"0.65090203",
"0.6504689",
"0.6503788",
"0.64731956",
"0.64609957",
"0.6458839",
"0.64452475",
"0.64409643",
"0.64409643",
"0.64386725",
"0.6431433",
"0.6427419",
"0.6427419",
"0.64241433",
"0.64137775",
"0.6412358",
"0.63661885",
"0.6355688",
"0.6348448",
"0.63466036",
"0.63375443",
"0.63368225",
"0.6331482",
"0.63129705",
"0.63070947",
"0.6303128",
"0.62912065",
"0.6271396",
"0.6268149",
"0.6268149",
"0.62612253",
"0.62533027",
"0.62519413",
"0.6251778",
"0.624942",
"0.62451255",
"0.62404335",
"0.6229509",
"0.622637",
"0.62198627",
"0.6209052",
"0.6194378",
"0.61862093",
"0.6185362",
"0.61835164",
"0.6180189",
"0.61748904",
"0.61562306",
"0.6149142",
"0.6146066",
"0.6144541",
"0.6141605",
"0.61380196",
"0.61324024",
"0.6131936",
"0.6122321",
"0.61181027",
"0.61104333",
"0.60951996",
"0.60876215",
"0.6082396",
"0.6069419",
"0.60381466",
"0.60211575",
"0.60147405",
"0.6011912",
"0.60047525",
"0.60046923"
] |
0.7957724
|
4
|
Returns a unique, deterministically reproducible index into an array We are hashing based on strings, let's use the ascii value of each string as a starting point.
|
def index(key, size)
key.sum % size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend",
"def generateKey(string)\r\n key = {}\r\n stringIterator = 0\r\n\r\n (string.length).times do\r\n charactersIterator = string[stringIterator] - 1\r\n divisorsIterator = 0\r\n divisors = {} # Possible divisors of the array's numbers\r\n\r\n # Check which numbers are possible divisors\r\n while charactersIterator > 0\r\n\r\n if string[stringIterator] % charactersIterator == 0\r\n divisors[divisorsIterator] = charactersIterator\r\n divisorsIterator += 1\r\n end\r\n charactersIterator -= 1\r\n end\r\n key[stringIterator] = divisors[rand(divisors.length)] # Choosing random divisor to be the primary key\r\n stringIterator += 1\r\n end\r\n\r\n return key\r\nend",
"def dupe_indices(array)\n hash = Hash.new{ |k, v| k[v] = [] }\n\n array.each_with_index do |char, i|\n hash[char] << i\n end\n\n return hash.select { |k, v| v.length > 1 }\n\nend",
"def index(key, size)\n MurmurHash3::V32.str_hash(key.to_s, size) % size\n end",
"def index(key, size)\n hash_code = 0\n array_of_characters = key.split('')\n array_of_characters.each do |letter|\n hash_code += letter.ord\n end\n hash_code % size\n end",
"def test_array_hash\r\n # a = %w(brendan baird billy)\r\n # assert_equal(1047868961, a.hash)\r\n end",
"def hash_offset(array, offset)\r\n hash = {}\r\n \r\n i = 0\r\n while i < array.length \r\n if i >= (array.length - offset) #if i >= 22, in this case. So this condition applies for the last 4 elements of the array\r\n hash[array[i-array.length + offset]] = array[i] # hash[array[22-26+4]] --> hash[array[0]] --> hash[\"a\"]=array[22] --> hash[\"a\"]=\"w\"\r\n else\r\n hash[(array[i].ord + offset).chr] = array[i] #otherwise do the normal offset by 4\r\n end\r\n i += 1\r\n end\r\n return hash\r\nend",
"def find_uniq_int(array)\n\tuniq_id = 0\n\n\tarray.each do |element|\n\t\tuniq_id ^= element\n\tend \n\n\treturn uniq_id\nend",
"def first_non_repeating(input)\n input_array = input.chars\n index = 0\n input_hash = {}\n for char in input_array do\n # If it's not in the hash already\n if input_hash.key?(char)\n # add char as key to input_hash\n # increment 1 to value of the char key in input_hash\n input_hash[char] += 1\n else\n # create a new key in input_hash and assign value as one\n input_hash[char] = 1\n end\n end\n p input_hash.key(1)\nend",
"def find_unique_integer(id_array)\n unique_id = 0 \n id_array.each do |id|\n unique_id ^= id\n end\n\n return unique_id\nend",
"def generate_random_array \n big_array = []\n i = set_array_size.to_i\n \n while i >= 1 \n big_string = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n big_array << big_string\n i = i - 1 \n end\n big_array \n end",
"def lookuptable\n res = Hash.new\n (0..255).each do |c|\n res[c] = unscramble(c)\n end\n res\n end",
"def index(key, size)\n ascii_value = 0\n hash_key = 0\n\n key.split(\"\").each do |letter|\n ascii_value += letter.ord #Method to retrieve ascii\n end\n\n hash_key = ascii_value % size\n\n return hash_key\n end",
"def random_hash(size)\n characters = ('A'..'Z').to_a + (2..9).to_a - [ 'I', 'O' ]\n Array.new(size) { characters[ rand(characters.size) ] }.join\n end",
"def inject_evil_symbols(array)\n array.insert(\n rand(0..array.length),\n [rand(9999), 9999]\n ).flatten!\nend",
"def index(key, size)\n #sums up the ascii values of each char in a string\n code = key.sum\n return code % size\n end",
"def unoptimized_find_unique_integer(id_array)\n histogram = Hash.new(0)\n id_array.each do |id|\n histogram[id] += 1\n end\n histogram.keys.each do |key|\n return key if histogram[key] == 1\n end\n return nil\nend",
"def array_to_indices_hash(array)\n array.inject({}) {|hash,e| hash[hash.size] = e; hash }\n end",
"def index(key, size)\n #true_index = hash(key) % k\n code = 0\n key.split(%r{\\s*}).each do |letter|\n code += letter.ord \n end\n puts code\n return code % size\n\n end",
"def random_string_in(arr)\n return nil if arr.empty?\n index = random_number(0, arr.length-1)\n arr[index]\n end",
"def where_to_put_secret(index)\n (0...48).each do |b|\n if index[b] == 1\n return b\n end\n end\n # I = 0, this is the seed.\n 48\n end",
"def dupe_indices(array)\n #ht = Hash.new {|h,k| h[k]=[]}\n #ht[\"cats\"] << \"Jellicle\"\n #ht[\"cats\"] << \"Mr. Mistoffelees\"\n hash = Hash.new { |h,k| h[k]=[] }\n array.each_with_index do |char, i|\n hash[char] << i\n end\n \n # puts \"Hash b select form : #{b.select{|key, value| value < 200}}\\n\\n\n hash.select{ |k,v| v.length > 1}\n\n\nend",
"def my_uniq(arr)\n answer = Hash.new\n arr.each_with_index do |el, i|\n answer[el] = 1\n end\n answer.keys\nend",
"def to_indices_hash(arr)\n #::Hash[*(0..arr.length - 1).to_a.zip(arr).flatten]\n arr.inject({}) {|hash,e| hash[hash.size] = e; hash }\n end",
"def hashify(key)\n array = key.split('')\n count = array.count\n index = array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n index % 89\n end",
"def index(key, size)\n # Takes the string 'key', creates an array of individual characters (split), maps to an array of ascii values (map), and then sums them (reduce)\n # Reaminder from dividing above amount by array size produces the array index\n (key.split(//).map { |char| char.ord }.reduce(:+)) % size\n end",
"def test_hash_correct\n\t\n\t\tString test_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\n\t\tx = test_array1[0].unpack('U*') + test_array1[1].unpack('U*') + test_array1[2].unpack('U*') + test_array1[3].unpack('U*')\n\t\tsum = 0\n\t\t# x.each { |i| puts x[i] }\n\t\t# x.delete(\"\")\n\t\tx.each { |i| sum += ((x[i].to_i ** 2000) * ((x[i].to_i + 2) ** 21) - ((x[i].to_i + 5) ** 3)) }\n\t\thash = (sum % 65536)\n\t\tputs hash.to_s(16)\n\t\t\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\t\n\t\t# assert_equal test_str[2,2], '0|'\t\n\tend",
"def hashit\n n = 0\t \n (\"A\"..\"Z\").each do |x|\n @rotor_hash[x] = @rotor_array[n]\n n += 1\n end \n return @rotor_hash\n end",
"def random_index(len)\n rand(1..len) - 1\nend",
"def uniqueness_dictionary\n [*(:A..:Z), *(:a..:z), *(0..9)].map(&:to_s)\n end",
"def uniques(array)\n hash = Hash[array.map {|x| [x, nil]}]\n print hash.keys\nend",
"def from_index\n Indexer.index[probably_unique_id]\n end",
"def weighted_random_index(array)\n idx = rand(array.length)\nend",
"def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend",
"def create_key_a\n @key_chars[0..1].join.to_i\n end",
"def hash()\n #This is a stub, used for indexing\nend",
"def my_uniq(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] = 1} #value doesnt matter this case\n hash.keys\nend",
"def hash()\n #This is a stub, used for indexing\n end",
"def hashit\n n = 0\n Chars.split(\"\").each do |x|\n @rotor_hash[x] = @rotor_array[n]\n n += 1\n end \n @rotor_hash\n end",
"def my_uniq(arr)\n hsh = Hash.new(0)\n arr.each do |el|\n hsh[el] += 1\n end\n hsh.keys\nend",
"def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end",
"def unique_elements(array)\n hash = Hash.new(0)\n array.each { |ele| hash[ele] += 1 }\n\n hash.keys\nend",
"def rand_index\n SecureRandom.random_number(size)\n end",
"def uniq_integer(input_array)\n unique = 0\n input_array.each do |num|\n unique = unique ^ num\n end\n\n unique\nend",
"def ifind_magic(arr)\n return false if arr.size == 0\n s = arr[0]\n e = arr[-1]\n magic_arr = []\n i = 0\n while s < e\n return magic_arr if arr[i] != i\n if arr[i] == i\n magic_arr[i] = i\n end\n i += 1\n end\nend",
"def gen_first_path(path_length)\n # we will now generate an array with path_length number of elements\n # the elements will be randomly selected numbers from (1.. path_length ^ 2)\n # to avoid duplicate numbers we will kepp track of which ones have already been used\n # in another local array\n\n used = []\n\n path = {}\n\n path_length.times do |k, v|\n random = gen_uniq_rand(path_length ** 2, used)\n used << random\n path[random] = 0\n end\n\n path\nend",
"def create_index1(word)\n word.chars.sort!.join\n end",
"def random_entry(arr)\n arr[rand(arr.size)]\n end",
"def first_unique_char(s)\n\n hash = Hash.new(0)\n\n s.each_char.with_index(0) {|char, i|\n if hash[char] != nil\n hash[char] = hash[char] + 1\n else\n hash[char] = 1\n end\n\n # p hash\n }\n\n s.each_char.with_index(0) {|char, i|\n if hash[char] == 1\n return i\n end\n }\n return -1\n\nend",
"def initialize(seed)\n @index = 0\n @mt = []\n @mt[0] = seed\n (1...ARRAY_LENGTH).each do |i|\n @mt[i] = (2 **32 -1) & (INIT_CONST * (@mt[i-1] ^ (@mt[i-1] >> 30)) + i)\n end\n end",
"def dupe_indices(arr)\n idxs = Hash.new { |h, k| h[k] = [] }\n \n arr.each_with_index do |ele, i|\n idxs[ele] << i\n end\n\n return idxs.select { |ele, arr| arr.length > 1 }\nend",
"def generate_unique_id\n Digest::SHA256.hexdigest unique_id_elements.join\n end",
"def get_auto_hash\n hash = get_hash(Time.now.to_s)\n zeros = rand(5)\n (0..zeros).each do |z|\n hash[z] = \"0\"\n end\n\n return hash\nend",
"def make_artist unique_index\n artist_name = (0...8).map{ 65.+(rand(26)).chr }.join\n return \"INSERT INTO artists VALUES (#{rand(500)}, '#{artist_name}');\"\nend",
"def SHA256 arr\n Digest::SHA256.digest(arr.map(&:chr).join).bytes\nend",
"def array_to_hash(array) \n count=0\n\n hash = Hash.new\n (array.length).times do \n hash[count+1] = array[count]\n count += 1\n end\n return hash\n end",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend",
"def unique_in_order(string)\n string.each_char.with_index.reduce([]) do |arr, (el, i)|\n if el == string.chars[i+1]\n arr\n else\n arr << el\n end\n end\nend",
"def array_gen(hash)\n array = []\n hash.each do |key, value|\n value.times do\n array << key.to_s\n end\n end\n return array\nend",
"def index(key, size)\n ascii = 0\n \n key.each_byte do |x|\n ascii += x\n end\n \n return ascii % size\n end",
"def unique_elements(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] += 1}\n return hash.keys\n\nend",
"def weighted_random_index(array)\n\nend",
"def unique_in_order(iterable) \n# create an empty array\ncontent = []\n\n # check each letter/number of `iterable` \n for e in (0..iterable.length()-1) \n\n# compare current element to previous element\n# if array is empty\n if e == 0 or \n# \n# if current element is not the same with previous element, push current index to content array\n iterable[e] != iterable[e-1] \n content.push(iterable[e])\n end\n end\n# return new content array\n return content\nend",
"def get_first_recurring_char(arr)\n hash = {}\n\n arr.each do |ele|\n key = ele.is_a?(Integer) ? ele.to_s : ele.to_sym\n return ele if hash[key]\n\n hash[key] = 'e'\n end\n 'The array is unique. No recurring character!!!'\nend",
"def index(key, size)\n char_value = 0\n # Adds together all of the ASCII values for each character into char_value.\n for letter in key.chars do\n char_value += letter.ord\n end\n # Increments char_value until its length equals desired size.\n until char_value.to_s.length == 7\n char_value*=11\n end\n\n return char_value%size\n end",
"def unique_index\n @unique_index\n end",
"def tiles_array_to_hash(array)\n tiles = Hash.new\n i = 0\n until i == array.length\n tiles[array[i]] = i\n i += 1\n end\n tiles\nend",
"def index(key, size)\n hash_code = 0\n key.each_byte do |c|\n hash_code += c\n end\n hash_code % @size\n end",
"def unique_elements(arr)\n hash = Hash.new(0)\n arr.each { |ele| hash[ele] += 1}\n hash.keys\nend",
"def my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend",
"def Unique(string)\n\n # assumes alphabet of size 128\n return false if string.length > 128\n \n hash={}\n \n for i in 0..string.length-1\n return false if hash[string[i]] \n hash[string[i]]=true\n end\n \n \nreturn true\n\nend",
"def hashing(i)\n \n return ALPHABET[0] if i == 0\n hash = ''\n base = ALPHABET.length\n while i > 0\n hash<< ALPHABET[i.modulo(base)]\n i /= base\n end\n hash.reverse\n end",
"def index_of(item)\n hash_value = 0\n item.each_byte { |byte| hash_value += byte }\n hash_value % @table.size\n end",
"def index(key, size)\n ascii_sum = 0\n key.split(\"\").each do |word|\n ascii_sum += word.ord\n end\n ascii_sum % size\n end",
"def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n\n end",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n if val === index\n return index\n end\n end\nend",
"def using_uniq(array)\n\n \nend",
"def initialize(seed=42)\n @arr = []\n @size = 0\n r = Random.new(seed)\n @cardinality = 1000\n @hash_a = ((r.rand(PRIME_NUMBER-1)+1)%PRIME_NUMBER) % @cardinality\n @hash_b = r.rand(PRIME_NUMBER)\n end",
"def make_hash\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n string = \"\"\n 20.times do\n string << chars[rand(chars.size-1)]\n end\n hash = Digest::SHA2.hexdigest(string)\n end",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n end",
"def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n end",
"def yale_row_as_hash i\n h = yale_nd_row(i, :hash)\n return h if i >= self.shape[1] || self[i,i].nil? || self[i,i] == 0\n h[i] = self[i,i]\n end",
"def Hash_Func( str )\n hash = 0\n i = 0\n while i < str.length\n c = str[i]\n hash = hash * 31 + c.ord\n i = i + 1\n end\n hash = hash.abs\n return PaddGUID( hash )\n end",
"def non_repeating_char_index(string) \n hash = {}\n\n string.length.times do |i|\n if !hash.has_key?(string[i])\n hash[string[i]] = 1\n else\n hash[string[i]] += 1\n end\n end\n\n char = hash.select { |char, occurence| occurence == 1}\n .map { |char, occurence| char }[0]\n\n return string.index(char) \nend",
"def test_index_one_repeated_word\n #assert false # bogus assert -- remove or comment out\n @concordance.index!(['zero','zero','zero'])\n assert_equal({'zero'=>[1]},@concordance.hash)\n end",
"def hard(string)\n hasher = KnotHash.new(256, string.bytes + [17, 31, 73, 47, 23])\n 64.times { hasher.round }\n hasher.hash\nend",
"def test_index_array\r\n\t\tarr = [\"a\", \"b\", \"c\", \"a\", \"b\", \"d\", \"c\"]\r\n\t\tassert_equal({\"a\"=>[0,3], \"b\"=>[1,4], \"c\"=>[2,6], \"d\"=>[5]}, arr.find_values_index())\r\n\tend",
"def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n sum % size\n end",
"def first_uniq_char(s)\n hash_table = {}\n (0..s.length-1).each do |i|\n if hash_table.include? (s[i])\n hash_table[s[i]] = hash_table[s[i]] + 1\n else\n hash_table[s[i]] = 1\n end\n end\n\n (0..s.length-1).each do |i|\n if hash_table[s[i]] == 1\n return i\n end\n end\n return -1\nend",
"def key_for_string str\n Digest::MD5.hexdigest(str).to_i(16) & KEY_MAX\n end",
"def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end",
"def random_key\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n (0...8).map { o[rand(o.length)] }.join\n end",
"def my_uniq(arr)\n \n output = []\n hash = Hash.new(false)\n \n arr.each do |x|\n output << x if !hash[x]\n hash[x] = true\n end\n output\n end",
"def index(key, size)\n value = ascii_value(key) % size\n return value\n end",
"def unique(arr)\n uniq = Hash.new(0)\n arr.each { |x| uniq[x] += 1 }\n uniq.select { |k, v| v == 1 }.keys\nend",
"def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\nend",
"def generate_key(size = 6)\n charset = %w{ 2 3 4 6 7 9 A C D E F G H J K L M N P Q R T V W X Y Z}\n (0...size).map{ charset.to_a[rand(charset.size)] }.join\nend",
"def gimme(input_array)\n input_array.index(input_array.sort[1])\nend",
"def index\n @array = [45, 6, 32, 0]\n end",
"def unique_elements(arr)\n my_hash = Hash.new(0)\n arr.each do |element|\n my_hash[element] += 1\n end\n return my_hash.keys\nend"
] |
[
"0.6383203",
"0.62403595",
"0.6144129",
"0.60989696",
"0.6059703",
"0.6045736",
"0.6044741",
"0.602797",
"0.59923834",
"0.59066594",
"0.5871428",
"0.58396715",
"0.58258843",
"0.5814923",
"0.5766527",
"0.57525396",
"0.57516277",
"0.5742264",
"0.5731274",
"0.5711685",
"0.5707308",
"0.5702227",
"0.569984",
"0.56833184",
"0.5671828",
"0.565937",
"0.56176966",
"0.5611315",
"0.5610367",
"0.56084204",
"0.558748",
"0.5557678",
"0.55551636",
"0.55400074",
"0.5534896",
"0.5534609",
"0.5519652",
"0.5512244",
"0.55090743",
"0.5502652",
"0.54923487",
"0.5490679",
"0.54898167",
"0.548655",
"0.54684347",
"0.5453182",
"0.5449455",
"0.54427904",
"0.54372454",
"0.54297227",
"0.5429287",
"0.54289335",
"0.54286104",
"0.54221296",
"0.54206306",
"0.54186493",
"0.541616",
"0.5415262",
"0.5410006",
"0.5407206",
"0.54053",
"0.54047656",
"0.5396665",
"0.5389979",
"0.53894234",
"0.538856",
"0.5384915",
"0.5377987",
"0.53683996",
"0.53626806",
"0.5357649",
"0.53567314",
"0.5352883",
"0.5351851",
"0.5350427",
"0.53158605",
"0.5309652",
"0.5301233",
"0.5296372",
"0.5294634",
"0.52945703",
"0.52945703",
"0.52872205",
"0.52843666",
"0.5283555",
"0.5282786",
"0.5268535",
"0.5268516",
"0.5268242",
"0.5266913",
"0.52666116",
"0.5265202",
"0.5255535",
"0.5255214",
"0.5252612",
"0.5250214",
"0.5248098",
"0.52466565",
"0.5245347",
"0.52395093",
"0.52383506"
] |
0.0
|
-1
|
Simple method to return the number of items in the hash
|
def size
@items.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def size\n return @hash.length\n end",
"def length\n hash.keys.length\n end",
"def size\n @hash.size\n end",
"def size\n @hash.size\n end",
"def size\n @hash.size\n end",
"def size\n @hash_array.length\n end",
"def size\n @hash_array.length\n end",
"def size\n @hash_table.keys.length\n end",
"def size\n keys.size\n end",
"def length\n @internal_hash.length\n end",
"def count\n @hash_tags.count\n end",
"def count(list)\n list.each do |hash|\n total += 1\n end\n return total\n end",
"def length()\n return self.keys.get_length()\n end",
"def size\n @keys.size\n end",
"def hlen(key); end",
"def hlen(key); end",
"def length()\n return @i_keys.get_length()\n end",
"def length\n keys.length\n end",
"def num_keys\n end",
"def length\n return @ghash.length\n end",
"def value_count(hash, value)\n hash.select { |_k, v| v == value }.length\nend",
"def test_Hash_InstanceMethods_size\n\t\th={1=>'a', 2=>'b', 3=>'c'}\n\t\tassert_equal(3, h.size)\n\tend",
"def count\r\n items.size\r\n end",
"def size\n @hash.size + @converted.size\n end",
"def hash_size\n hashref_size * num_hashes\n end",
"def length\n @driver_instance.count_list_value(@key)\n end",
"def nitems() end",
"def size\n @redis.llen @key\n end",
"def count_objects\n count = 0\n @objects.keys.each do |key|\n count += @objects[key].length\n end\n\n return count\n end",
"def item_count\n item_values.values.compact.sum { |v| v.is_a?(Array) ? v.size : 1 }\n end",
"def size\n @buckets.length\n end",
"def get_size\n @buckets.length\n end",
"def count_items\n @items.size\n end",
"def item_count\n @items.length \n end",
"def size\n self.data.keys.size\n end",
"def size\n @index.keys.uniq.count\n end",
"def length\n @results.keys.length\n end",
"def item_count\n @items.length\n end",
"def count\n redis { |conn| conn.llen(key) }\n end",
"def count; @value.size; end",
"def size\n @store.keys.count { |k| Time.now - @store[k].stamp < @lifetime }\n end",
"def count\n @item_list.size\n end",
"def count\n values.inject(0){|m, v| m + v.length}\n end",
"def size\n @keys.length - 1\n end",
"def length\n stash.length\n end",
"def size(hash1=self.orderJSON)\n sum = 0\n unless hash1.class == Hash\n hash1 = eval(hash1)\n end\n hash1.each do |k1,v1|\n v1.each do |k2,v2|\n sum += v2.to_i\n end\n end\n return sum \n end",
"def value_count(hash, value)\n count = 0\n hash.each { |elem| count += 1 if elem[1]==value }\n count\nend",
"def key_count\n $capitals.keys.length\nend",
"def size\n @items.count\n end",
"def size\n @items.count\n end",
"def count\n each.size\n end",
"def count(data)\n return data.length\n end",
"def size\n return @items.size\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end",
"def size\n entries.length\n end",
"def hit_count\n item_hash.deep_find(:hit_count, 0)\n end",
"def hashref_size\n hashptr_size + length_size\n end",
"def size\n\t\treturn @items.size\n end",
"def size\n return @items.size\n end",
"def size\n entries.size\n end",
"def count_items(name)\n @items[name].size\n end",
"def size\n @references_to_keys_map.count do |_, ref|\n ref.object\n end\n end",
"def size\n return @items.length\n end",
"def size\n counter = 0\n @items.each do |item|\n if item.nil?\n counter += 1\n else\n counter += item.length - 1\n end\n end\n counter\n end",
"def print_counts(hash)\n hash.each { |key, count| puts \"#{key} -- #{count}\\n---------\\n\" }\nend",
"def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend",
"def count\n @data.size\n end",
"def item_count()\n @names.count\n end",
"def size\n @count\n end",
"def size\n @count\n end",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].length\nend",
"def num_buckets\n @store.length\n end",
"def size\n data.values.inject(0){|m,v| m+=v.size}\n end",
"def length\n each.count\n end",
"def count\n to_a.size\n end",
"def count\n to_a.size\n end",
"def size\n items.size\n end",
"def size\n items.size\n end",
"def item_count\n collection.length\n end",
"def size\n @clients.keys.length\n end",
"def my_count\n if block_given?\n num = 0\n self.my_each{|item| num += 1 if yield(item)}\n num\n else\n # if no block given return size of array\n self.length\n end\n end",
"def size\n\n @items.size\n end",
"def count\n @map.count\n end",
"def size\n entries.length\n end",
"def count\n items.compact.count.to_d\n end",
"def size\n @size ||= (@key_map || @row || []).size\n end",
"def item_count\n @collection.length\n end",
"def count\n @obj['count'].to_i\n end",
"def size\n entries.size\n end",
"def size\n entries.size\n end",
"def size\n @items.length\n end",
"def cardinality\n redis.hget(bucket_key, RedisBackend::COUNT_FIELD).to_i\n end",
"def size\n @items.length \n end",
"def size\n count = 0\n @properties.each do |gid, values|\n if ! values.empty?\n count += 1\n end\n end\n return count\n end"
] |
[
"0.828291",
"0.82106453",
"0.8109857",
"0.8109857",
"0.8109857",
"0.79691637",
"0.79691637",
"0.78121144",
"0.7748515",
"0.7684302",
"0.76763284",
"0.7656088",
"0.76353997",
"0.7629738",
"0.7615592",
"0.7615592",
"0.75738573",
"0.75696003",
"0.74785894",
"0.74441725",
"0.7398291",
"0.73481745",
"0.73238206",
"0.7303972",
"0.72776085",
"0.725276",
"0.72425216",
"0.7217496",
"0.72155786",
"0.7211896",
"0.716233",
"0.71536815",
"0.7152829",
"0.7140681",
"0.7140127",
"0.7114385",
"0.71131",
"0.70923793",
"0.7091298",
"0.70767915",
"0.70740783",
"0.7066361",
"0.7046343",
"0.7046298",
"0.70352197",
"0.70349413",
"0.7025411",
"0.7012994",
"0.7006075",
"0.7006075",
"0.69972867",
"0.6983811",
"0.6983444",
"0.6981107",
"0.6981107",
"0.6981107",
"0.6981107",
"0.6981107",
"0.6981107",
"0.6981107",
"0.6981004",
"0.69801587",
"0.6956823",
"0.69529295",
"0.6950879",
"0.69494075",
"0.69417405",
"0.6937736",
"0.69376606",
"0.69346714",
"0.6934461",
"0.6933228",
"0.6928837",
"0.69213086",
"0.6919095",
"0.6901045",
"0.6901045",
"0.6895948",
"0.6894081",
"0.6891968",
"0.6886094",
"0.6884534",
"0.6884534",
"0.68775696",
"0.68775696",
"0.6876399",
"0.6873197",
"0.68692714",
"0.6844841",
"0.68410355",
"0.6837606",
"0.6836955",
"0.68362325",
"0.6835276",
"0.68308276",
"0.682937",
"0.682937",
"0.6819412",
"0.6818986",
"0.6818638",
"0.68132484"
] |
0.0
|
-1
|
=begin As a user, upon starting the CRM, I am presented with a prompt to add, modify, delete, display all, search by attribute, and exit. =end
|
def print_main_menu
puts "[1] Add a new contact"
puts "[2] Modify an existing contact"
puts "[3] Delete a contact"
puts "[4] Display all contacts"
puts "[5] Search by attribute"
puts "[6] delete_all"
puts "[7] exit"
puts "Enter a number: "
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def search_by_attribute\n puts \"\\nPlease select a contact attribute to search by.\"\n print_search_by_attribute_options\n user_attribute = gets.chomp.downcase\n #Attepted to loop back through function after contacts displayed\n # if user_attribute == 5\n # display_all_contacts\n # search_by_attribute\n if user_attribute == \"cancel\"\n puts \"\\e[H\\e[2J\"\n return\n end\n\n puts \"Please enter the contact's info: \"\n user_value = gets.chomp\n contact = Contact.find_by(user_attribute => user_value)\n # Attempting safeguard\n # if contact == \"invalid\"\n # return \"INVALID OPTION\"\n # end\n puts \"\\e[H\\e[2J\"\n puts \"\\n------------------------------\"\n puts \"Name: #{contact.first_name} #{contact.last_name}\\nEmail: #{contact.email}\\nNote: #{contact.note}\"\n puts \"------------------------------\\n\\n\"\n return contact\n end",
"def search_by_attribute #search by first name \n p \"enter first name\"\n enter_name = gets.chomp\n contact = Contact.find_by_first_name(enter_name)\n puts \"name: #{contact.full_name}\"\n puts \"----------------------------------\"\n puts \"email: #{contact.email}\"\n puts \"----------------------------------\"\n puts \"notes: #{contact.notes}\"\n puts \"----------------------------------\"\n puts \"unique ID: #{contact.id_reader}\"\n \n return \n end",
"def search_by_attribute\n attribute_list\n puts \" Choose number for Search attribute\"\n while user_selected =gets.to_i\n\n case user_selected\n when 1 then puts \"Enter First Name\"\n search_result = Contact.find_by(:first_name, value = gets.chomp.to_s)\n unless search_result\n puts\"========================\"\n puts \"first name not found\"\n puts\"=======================\"\n return\n end\n puts\n search_result.display_contact\n puts\n break\n\n when 2 then puts \"Enter Last Name\"\n search_result = Contact.find_by(:last_name, value = gets.chomp.to_s)\n puts\n search_result.display_contact\n unless search_result\n puts\"========================\"\n puts \"last name not found\"\n puts\"=======================\"\n return\n end\n puts\n break\n\n when 3 then puts \"Enter Email Address\"\n search_result = Contact.find_by(:email, value = gets.chomp)\n unless search_result\n puts\"========================\"\n puts \"email not found\"\n puts\"=======================\"\n return\n end\n puts\n search_result.display_contact\n puts\n break\n\n when 4 then puts \"Enter Note\"\n search_result = Contact.find_by(:note, value = gets.chomp)\n unless search_result\n puts\"========================\"\n puts \"note not found\"\n puts\"=======================\"\n return\n end\n puts\n search_result.display_contact\n puts\n break\n\n else\n puts \"---------------------------------------\"\n puts \"please enter a number between 1 and 4\"\n puts \"=======================================\"\n attribute_list\n\n end\n end\n end",
"def show_edit_menu\n puts \" You are now in edit mode\"\n puts \" edit name - edit the name of this contact\"\n puts \" edit email - edit the email of this contact\"\n puts \" add phone - add a phone number to this contact\"\n puts \" edit importance - edit the importance of this contact\"\n print \"> \"\n end",
"def displayUpdateInstr\n puts \"Type a letter to execute the corresponding command:\"\n puts \"a - update name\"\n puts \"b - update number\"\n puts \"c - update e-mail address\"\n puts \"d - update relation to you\"\n puts \"e - update city\"\nend",
"def show_main_menu\n puts \"Welcome to Contacts APP, What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" update - Enter ID to update a contact\"\n puts \" show - Enter ID to show detail of a contact\"\n puts \" find - Find contacts by name\"\n puts \" save - Save contact to CSV file\"\n puts \" quit - Save & Exit Application\"\n print \"> \"\n end",
"def display_attribute\n puts \"Please enter an attribute: \"\n attribute = gets.chomp\n @rolodex.display_attribute(attribute)\n\tend",
"def prompt_sub_1_1_search\n print_line\n puts \"Please Enter Search Query:\"\n print_line\nend",
"def display_info_by_attribute(contact)\n puts \"Enter attribute you want to display\"\n puts \"(1) First name\"\n puts \"(2) Last name\"\n puts \"(3) Email\"\n puts \"(4) Note\"\n att = gets.chomp.to_i\n print \"Is this the correct contact y/n?: \"\n user_choice = gets.chomp\n if user_choice.upcase() == 'Y'\n if att == 1\n puts \"#{contact.id}: #{contact.first_name}\"\n elsif att == 2\n puts \"#{contact.id}: #{contact.last_name}\"\n elsif att == 3\n puts \"#{contact.id}: #{contact.email}\"\n elsif att == 4\n puts \"#{contact.id}: #{contact.note}\"\n else\n puts \"I'm sorry but there is no such attribute\"\n end\n elsif user_choice.upcase() == 'N'\n main_menu\n end\n puts \"Press ENTER to continue....\"\n end",
"def print_main_menu\t\n\t puts\n\t puts \"[1] Add a new contact\"\n\t puts \"[2] Modify an existing contact\"\n\t puts \"[3] Search and display a contact\"\n\t puts \"[4] Delete a contact\"\n\t puts \"[5] Display all contacts\"\n\t puts \"[6] Display a list by attribute\"\n\t puts \"[7] Exit this system\"\n\t puts\n\t puts \"Please enter a number from the above options: \"\n\tend",
"def show_main_menu\n puts \"Welcome to Contacts APP, What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Enter ID to show detail of a contact\"\n puts \" find - Find contacts by name\"\n puts \" add - Add phone numbers\"\n puts \" save - Save contact to CSV file\"\n puts \" quit - Save & Exit Application\"\n print \"> \"\n end",
"def modify_contact\n\t\tprint_modify_contact\n \tmodify_attribute = gets.chomp.to_i\n\n \tif modify_attribute == 5 \t\n \t\tmain_menu \n \telse \n\t \tputs \"Are you sure you want to change this attribute [Y/N]\"\n\t \tconfirm = gets.chomp\n\t \tif confirm.downcase == \"y\"\n\t \t\tmodify_contact_option(modify_attribute)\n\t \telse\n\t \t\tmodify_contact\n\t \tend\n\t end\n\tend",
"def print_main_menu\n puts '[1] Add a new contact'\n puts '[2] Modify an existing contact'\n puts '[3] Delete a contact'\n puts '[4] Display all the contacts'\n puts '[5] Search by attribute'\n puts '[6] Exit'\n puts 'Enter a number: '\n\n end",
"def main_menu\n puts \"Here is a list of available commands:\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Show a contact\"\n puts \" search - Search contacts\"\n puts \" delete - Deletes a contact\"\n end",
"def print_main_menu\n puts \"1. Add a contact\"\n puts \"2. Modify a contact\"\n puts \"3. Display all contacts\"\n puts \"4. Display a contact\"\n puts \"5. Display contact attributes\"\n puts \"6. Delete a contact\"\n puts \"7. Exit\"\n end",
"def show_main_menu\n puts \"What would you like do next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" delete - Delete a contact\"\n puts \" show - Display contact details\"\n # puts \" find - Find a contact\"\n print \"> \"\n end",
"def display_by_attribute\n\t\tputs \"\\nEnter attribute to display (ID, first name, last name, email):\"\n\t\tattribute = gets.chomp.downcase\n\t\tif attribute == \"id\"\n\t\t\t@database_array.each {|x| puts x.id}\n\t\telsif attribute == \"first name\"\n\t\t\t@database_array.each {|x| puts x.first_name}\n\t\telsif attribute == \"last name\"\n\t\t\t@database_array.each {|x| puts x.last_name}\n\t\telsif attribute == \"email\"\n\t\t\t@database_array.each {|x| puts x.email}\n\t\telse\n\t\t\tputs \"Please try again!\" rescue nil\n\t\tend\t\t\n\tend",
"def add_tenant()\n system \"clear\"\n puts \"Enter Tenant:\"\n puts \"=================\"\n print \"Apartment Reference : \"\n appt_ref = gets\n print \"Tenant name : \"\n tenant_name = gets\n print \"Tenant age : \"\n tenant_age = gets\n print \"Tenant gender : \"\n tenant_gender = gets\n wait = puts\n print \"Select Option : \"\nend",
"def print_update\n puts \"Attribute to Change\"\n puts \"[1] First Name\"\n puts \"[2] Last Name\"\n puts \"[3] E-mail\"\n puts \"[4] Note\"\n puts \"Enter a number\"\n end",
"def list_options\n puts \"Here is a list of available commands:\"\n puts \"new - Create a new contact\"\n puts \"list - List all contacts\"\n puts \"show - Show a contact\"\n puts \"search - Search contacts\"\n\n choice = gets.chomp\n\n case choice\n when \"list\"\n puts Contact.all\n when \"new\"\n puts \"Enter Name:\"\n new_name = gets.chomp\n puts \"Enter Email\"\n new_email = gets.chomp\n puts Contact.create(new_name, new_email)\n when \"show\"\n puts \"Enter ID:\"\n id = gets.chomp.to_i\n puts Contact.find(id)\n when \"search\"\n puts \"Enter a keyword\"\n term = gets.chomp\n puts Contact.search(term)\n end\n end",
"def print_main_menu\n\t\tputs \"[1] Add a contact\"\n\t\tputs \"[2] Modify a contact\"\n\t\tputs \"[3] Display all contacts\" \n\t\tputs \"[4] Display one contact\"\n\t\tputs \"[5] Display an attribute\"\n\t\tputs \"[6] Delete a contact\"\n\t\tputs \"[7] Exit\"\n\t\tputs \"Enter a number\"\n\tend",
"def modify_existing_contact\n display_all_contacts\n puts \"Choose the ID you would like to modify\"\n id = gets.chomp.to_i\n modify_contact = Contact.find(id)\n unless modify_contact\n puts \"ID not found\"\n return\n end\n\n attribute_list\n\n while user_selected =gets.to_i\n\n case user_selected\n when 1 then puts \"Enter New First Name\"\n new = modify_contact.update(:first_name, value = gets.chomp)\n puts\n modify_contact.display_contact\n puts\n break\n\n when 2 then puts \"Enter New Last Name\"\n new = modify_contact.update(:last_name, value = gets.chomp)\n puts\n modify_contact.display_contact\n puts\n break\n\n when 3 then puts \"Enter New Email Address\"\n new = modify_contact.update(:email, value = gets.chomp)\n puts\n modify_contact.display_contact\n puts\n break\n\n when 4 then puts \"Enter New Note\"\n new =modify_contact.update(:note, value = gets.chomp)\n puts\n modify_contact.display_contact\n puts\n break\n\n else\n puts \"=======================================\"\n puts \"please enter a number between 1 and 4\"\n puts \"=======================================\"\n attribute_list\n end\n end\n end",
"def options\n\tputs \"[A]dd employee\"\n\tputs \"[D]isplay the employee details\"\n\tputs \"[Q]uit\"\n\tputs \"\"\nend",
"def display_by_attribute\n\t\tputs \"Please enter desired attribute to be displayed: \"\n\t\tputs \"[1] First name\"\n\t\tputs \"[2] Last name\"\n\t\tputs \"[3] Email\"\n\t\tputs \"[4] Note\"\n\t\tputs \"[5] ID\" \n\t\tattribute = gets.chomp.to_i\n\t\tcase attribute\n\t\twhen 1\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.first_name}\"\n\t\t\tend\n\t\twhen 2\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.last_name}\"\n\t\t\tend\n\t\twhen 3\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.email}\"\n\t\t\tend\n\t\twhen 4\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.note}\"\n\t\t\tend\n\t\twhen 5\n\t\t\t@rolodex.contacts.each do |contact|\n\t\t\t\tputs \"#{contact.id}\"\n\t\t\tend\n\t\tend\n\tend",
"def show_main_menu\n puts \"Welcome to the app. What would you like to do?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" quit - Exit Application\"\n puts \" show - shows contact with specific id\"\n puts \" find - find a user\"\n print \"> \"\n end",
"def homeScreen\n puts \"######################################################################\"\n puts \"# #\"\n puts \"# ~~~~~~~~~~~~ Coder Academy 2018 Student Directory ~~~~~~~~~~~~ #\"\n puts \"# #\"\n puts \"######################################################################\"\n puts \"\"\n puts \"\"\n puts \"Type the first name and last name of any student to search\"\n puts \"\"\n puts \"For a list of students, enter 'help'\"\n puts \"To randomise all student data, enter 'randomise!'\"\n puts \"To exit, type 'exit':\"\nend",
"def launch!\n\t\tintroduction\n\t\t\taction = nil\n\t\t\tuntil action == :quit\n\t\t\t# action loop\n\t\t\t# what do you want to do? (list, find, add, quit)\n\t\t\tprint \"> \"\n\t\t\tuser_response = gets.downcase.strip!.split(' ')\n\t\t\t# do that action\n\t\t\taction,args = do_action(user_response[0],user_response[1])\n\t\tend\n\t\tconclusion\n\tend",
"def menu\n\tputs\n\tputs\n puts \"Welcome to the Real Estate search engine\"\n puts \"To list all available apartments, please press 1\"\n puts \"Press Q to quit\"\nend",
"def list_stock_search_menu\n choice_num = 1\n puts_blanks\n puts \"::: #{@company_name} STOCK MENU :::\".colorize( :blue )\n blank\n puts \"What would you like to view about #{@company_name}?\"\n blank\n @@company_choices.each do |choice|\n puts \"[#{choice_num}] #{choice[:title]}\"\n choice_num += 1\n end\n\n puts \"[a] to run all\"\n puts \"[x] Exit Program\"\n end",
"def modify_existing_contact\n display_all_contacts\n puts \"What ID would you like to modify?\"\n id = gets.to_i\n modify_existing_contact = Contact.find(id)\n\n attribute_list\n\n case user_selected\n when 1 then puts \"Edit First Name\"\n edit = modify_existing_contact.update(:first_name, value =gets.chomp)\n puts\n modify_existing_contact.display_contact\n\n\n\n when 2 then puts \"Edit Last Name\"\n edit = modify_existing_contact.update(:last_name, value =gets.chomp)\n puts\n modify_existing_contact.display_contact\n\n\n\n when 3 then puts \"Edit Email\"\n edit = modify_existing_contact.update(:email, value =gets.chomp)\n puts\n modify_existing_contact.display_contact\n\n\n\n when 4 then puts \"Edit Note\"\n edit = modify_existing_contact.update(:note, value =gets.chomp)\n puts\n modify_existing_contact.display_contact\n\nelse\n puts \"Please select an attribute from 1 to 4\"\n attribute_list\n end\n end",
"def print_main_menu\n\t\tputs \"[1] Add a new contact\"\n\t\tputs \"[2] Modify an existing contact\"\n\t\tputs \"[3] Delete a contact\"\n\t\tputs \"[4] Display all the contacts\"\n\t\tputs \"[5] Display an attribute\"\n\t\tputs \"[6] Exit\"\n\t\tputs \"Enter a number: \"\n \tend",
"def enter\n acps = ACP.where('id < 100').order(:id)\n options = acps.map { |acp| \"#{acp.id.to_s.rjust(2)}: #{acp.name}\" }\n\n puts \"Select ACP context: (empty for no ACP)\"\n puts options\n\n selection = gets.strip.presence\n acp = acps.detect { |acp| acp.id == selection.to_i } if selection\n\n Apartment::Tenant.reset if Apartment::Tenant.current != 'public'\n if acp\n ACP.enter!(acp.tenant_name)\n puts \"Entered #{acp.name} context.\"\n else\n puts 'No ACP selected.'\n end\nend",
"def main_menu(companyname=\"Unknown\",username=\"Unknown\",client_hash)\n prompt = TTY::Prompt.new(symbols: {marker: \">\"})\n input = \"\"\n while input != \"Exit\"\n system('clear')\n Debug.show \"Debug ON\\ninput: #{input} | company_name: #{companyname} | username: #{username}\"\n menuoptions = [\"Add new client\",\"Search client\",\"Exit\"]\n menuoptions.delete(\"Add new client\") if username == \"guest\"\n input = prompt.select(\"#{companyname} accounts\\n\\nLogged in as user #{username}\\n\\nTotal clients: #{client_hash[:clients].length}\\n\\n\", menuoptions)\n \n if input == \"Add new client\"\n client_hash = add_new_client(client_hash)\n end\n\n if input == \"Search client\"\n clientsearch(client_hash,username)\n end\n end\n return input\nend",
"def launch!\n\t\tintroduction\n\n\t\tresult = nil\n\t\tuntil result == :quit\n\t\t\tprint \"> Choose one of these options: List, Sort, Find or Add.\\n\\n\"\n\t\t\tuser_response = gets.chomp\n\t\t\tresult = do_action(user_response)\n\t\tend\n\t\tconclusion\n\tend",
"def modify_contact\n\t\tputs \"Please enter the id of the contact to modify: \"\n\t\tid = gets.chomp.to_i\n puts \"Please confirm 'yes' or 'no' to modify this contact: \"\n puts @rolodex.display_contact(id)\n answer = gets.chomp.downcase\n if answer == 'yes'\n puts \"Please enter the number of the attribute you would like to edit: \\n\n 1. First Name \\n\n 2. Last Namme \\n\n 3. Email \\n\n 4. Note\"\n option = gets.chomp.to_i\n puts \"Please provide the edit:\"\n new_attribute = gets.chomp\n @rolodex.modify_contact(id, option, new_attribute)\n puts \"Edit complete: \"\n puts @rolodex.display_contact(id)\n elsif answer == 'no'\n return\n else\n puts \"That is not a valid answer, please try again.\"\n end\n\tend",
"def execute()\n\t\n\t\t# Retrieve a single entry from CHG:Infrastructure Change based on Remedy Login ID\n\t\tentry = @@remedy_forms['CHG:Infrastructure Change'].find_entries(\n\t\t :single,\n\t\t :conditions => [%|'#{@search_by_field}' = \"#{@parameters['search_value']}\"|],\n\t\t :fields => :all\n\t\t)\n\t\tif entry.nil?\n\t\t raise(%|Could not find entry on CHG:Infrastructure Change with '#{@search_by_field}'=\"#{@parameters['search_value']}\"|)\n\t\tend\n\t\t\n\n\t\t#For backwards compability with ArsModels prior to v2 as prior versions do not have a .to_s method for the EnumFieldValue class.\n\t\t#Only Enum & non-remedy types are included in the temp hash of field values.\n\t\thash_entry = {}\n\t\tentry.to_h.each do |key, value|\n\t\t\tif value.is_a? ArsModels::FieldValues::EnumFieldValue\n\t\t\t\thash_entry[key] = value.value\n\t\t\telsif !entry[key].is_a? ArsModels::FieldValues\n\t\t\t\thash_entry[key] = value\n\t\t\tend\n\t\tend\n\n\t\t# Build the results to be returned by this handler\n\t\tresults = <<-RESULTS\n\t\t<results>\n\t\t\t<result name=\"Actual Start Date\">#{escape(hash_entry['Actual Start Date'])}</result>\n\t\t\t<result name=\"Actual End Date\">#{escape(hash_entry['Actual End Date'])}</result>\n\t\t\t<result name=\"Change Timing\">#{escape(hash_entry['Change Timing'])}</result>\n\t\t\t<result name=\"Change Type\">#{escape(hash_entry['Change Type'])}</result>\n\t\t\t<result name=\"Company\">#{escape(hash_entry['Company'])}</result>\n\t\t\t<result name=\"Company3\">#{escape(hash_entry['Company3'])}</result>\n\t\t\t<result name=\"Completed Date\">#{escape(hash_entry['Completed Date'])}</result>\n\t\t\t<result name=\"Description\">#{escape(hash_entry['Description'])}</result>\n\t\t\t<result name=\"Detailed Description\">#{escape(hash_entry['Detailed Description'])}</result>\n\t\t\t<result name=\"Earliest Start Date\">#{escape(hash_entry['Earliest Start Date'])}</result>\n\t\t\t<result name=\"First Name\">#{escape(hash_entry['First Name'])}</result>\n\t\t\t<result name=\"Impact\">#{escape(hash_entry['Impact'])}</result>\n\t\t\t<result name=\"Last Name\">#{escape(hash_entry['Last Name'])}</result>\n\t\t\t<result name=\"Location Company\">#{escape(hash_entry['Location Company'])}</result>\n\t\t\t<result name=\"Risk Level\">#{escape(hash_entry['Risk Level'])}</result>\n\t\t\t<result name=\"Scheduled End Date\">#{escape(hash_entry['Scheduled End Date'])}</result>\n\t\t\t<result name=\"Scheduled Start Date\">#{escape(hash_entry['Scheduled Start Date'])}</result>\n\t\t\t<result name=\"Status\">#{escape(hash_entry['Change Request Status'])}</result>\n\t\t\t<result name=\"SRID\">#{escape(hash_entry['SRID'])}</result>\n\t\t\t<result name=\"SRInstanceID\">#{escape(hash_entry['SRInstanceID'])}</result>\n\t\t\t<result name=\"SRMSAOIGuid\">#{escape(hash_entry['SRMSAOIGuid'])}</result>\n\t\t\t<result name=\"Submitter\">#{escape(hash_entry['Submitter'])}</result>\n\t\t\t<result name=\"Support Group Name\">#{escape(hash_entry['Support Group Name'])}</result>\n\t\t\t<result name=\"Support Organization\">#{escape(hash_entry['Support Organization'])}</result>\n\t\t\t<result name=\"Urgency\">#{escape(hash_entry['Urgency'])}</result>\n\t\t</results>\n\t\tRESULTS\n\t\tputs(results) if @debug_logging_enabled\t\n\n\t\t# Return the results String\n\t\treturn results\n\tend",
"def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what I have coming up'\n puts '4. Delete my account'\n puts '5. Exit'\n space(1)\n pick_option\nend",
"def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend",
"def show_main_menu\n puts \" Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" list important - List all contacts\"\n puts \" show :id - Display contact details\"\n puts \" delete - Delete an entry\"\n puts \" find - Find an entry\"\n print \"> \"\n end",
"def execute()\n # Retrieve a single entry from SIT:Site based on provided site\n siteEntry = @@remedy_forms['SIT:Site'].find_entries(\n :single,\n :conditions => [%|'Site' = \"#{@parameters['site']}\"|],\n :fields => :all\n )\n\n # Raise error if unable to locate the entry\n raise(\"No matching entry on the SIT:Site form for the given site [#{@parameters['site']}]\") if siteEntry.nil?\n\n #Get values out of Site into fields\n\t@field_values[\"Site ID\"] = siteEntry[\"Site ID\"]\n\t@field_values[\"Site City\"] = siteEntry[\"City\"]\n\t@field_values[\"Site Country\"] = siteEntry[\"Country\"]\n\t@field_values[\"Site State Province\"] = siteEntry[\"State Province\"]\n\t@field_values[\"Site Street\"] = siteEntry[\"Street\"]\n\t@field_values[\"Site Zip/Postal Code\"] = siteEntry[\"Zip/Postal Code\"]\n\t@field_values[\"Time Zone\"] = siteEntry[\"Time Zone\"]\n\t\n\t@create = 1\n\tbegin\n\t# Create the CTM:People record using the @field_values hash\n # that was built up. Pass 'Person ID' and 'InstanceId' to the fields\n # argument because these fields will be used in the results xml.\n entry = @@remedy_forms['CTM:People'].create_entry!(\n :field_values => @field_values,\n :fields => ['Person ID']\n )\n\trescue Exception => e\n\t\tputs(\"Exception: #{e.message}\") if @debug_logging_enabled\n\t\tputs(\"END OF EXCEPTION MESSAGE\") if @debug_logging_enabled\n\t\tif e.message.include?(\"is already in use, please choose another Login ID\")\n\t\t\t entry = @@remedy_forms['CTM:People'].find_entries(\n\t\t\t :single,\n\t\t\t :conditions => [%|'Remedy Login ID' = \"#{@parameters['remedy_login_id']}\"|],\n\t\t\t :fields => ['Person ID']\n\t\t\t)\n\t\t\t@create = 0\n\t\tend\n\tend\n\t\n # Create a notes string that will be stored within the audit record. It\n # contains the author of the modifications as well as details about each of\n # the modified values.\n notes = \"The CTM:People record was created by #{@parameters['author']}\"\n @field_values.each do |field_id, value|\n notes << \"\\nfield '#{field_id}' was entered as '#{value}'\"\n end\n\n # If any of the values were we checked are to be modified we save the\n # CTM:People record. Then we create an entry in CTM:People WorkLog to audit\n # this modification.\n if !entry.nil? && @create == 1\n @@remedy_forms['CTM:People WorkLog'].create_entry!(:field_values => {\n 'Person ID' => entry.id,\n 'Description' => 'Created by BmcItsm7PersonCreate handler.',\n 'Work Log Type' => 'General Information',\n 'Detailed Description' => notes,\n 'Work Log Submitter' => @parameters['author']\n },\n :fields => [])\n\telsif @create == 0\n\t\tputs(\"Did not create new user, login ID Already in use: #{@parameters['remedy_login_id']}\") if @debug_logging_enabled\n elsif entry.nil?\n\t\t# Raise error if unable to create the entry\n\t\traise(\"Unable to create people record for [#{@parameters['remedy_login_id']}]\")\n\tend\n \n\t\n # Build the results xml that will be returned by this handler.\n results = <<-RESULTS\n <results>\n <result name=\"Person ID\">#{escape(entry['Person ID'])}</result>\n </results>\n RESULTS\n puts(\"Results: \\n#{results}\") if @debug_logging_enabled\n #puts(\"Results: \\n#{results}\")\n\n # Return the results String\n return results\n end",
"def start_menu\n printf \"\\nPrograma para a disciplina de LPD\\n\"\n printf \"Choose one option\\n\"\n printf \"------------------------------------\\n\"\n printf \"1) Insert user\\n\"\n printf \"2) Login user\\n\"\n printf \"3) Delete user\\n\"\n printf \"0) Exit\\n\"\nend",
"def display_contact\n print \"Input contact ID\"\n contact_id = gets.chomp.to_i\n contact = @rolodex.find(contact_id)\n puts \"#{contact}\" + \"\\n \\n\"\n puts \"Press Return to continue\"\n button = gets.chomp\n puts \"\\e[H\\e[2J\"\n main_menu\n end",
"def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" find - Find by name\"\n puts \" delete - Delete by ID\"\n puts \" quit - Exit Application\"\n print \"> \"\n end",
"def menu\n puts \"Here is a list of available commands:\"\n puts \"\\tnew\\t- Create a new contact\"\n puts \"\\tlist\\t- List all contacts\"\n puts \"\\tshow\\t- Show a contact\"\n puts \"\\tsearch\\t- Search contacts\"\n @user_input = gets.chomp\n end",
"def main_menu(owner_name, owner)\n puts \"#{page_break}\\n\n Select from the following menu options to get started:\\n\n 1 - Make New Appointent\n 2 - Reschedule Appointment\n 3 - Cancel Appointment\n 4 - Search for a Groomer\n 5 - Exit\n \"\n end",
"def init # entry method to the CLI \n greeting \n menu_list\n menu_selection\nend",
"def prompt(operation)\n # get the parameters\n if( @entity )\n data = self.parameters\n else\n data = self.default_parameters\n end\n if( not data )\n puts \"No parameters attached to the entity\"\n return nil\n end\n title = \"(* values will not import)\"\n prompts = [\"Length*\", \"Type*\",\"Width*\",\"pitch*\",\"Set\"]\n types = [\"Gable\", \"Hip\"]\n\tboolean = [\"Yes\",\"No\"]\n sets = [\"Awning#1\",\"Awning#2\",\"Awning#3\"]\n values = [data[\"w\"], types[data[\"t\"]],data[\"l\"],data[\"p\"],data[\"s\"]]\n popups = [nil, types.join(\"|\"),nil,nil,sets.join(\"|\")]\n results = inputbox( prompts, values, popups, title )\n return nil if not results\n \n # Store the results back into data\n data[\"w\"] = results[0]\n t = types.index(results[1])\n data[\"t\"] = t ? t : 0\n\tdata[\"l\"] = results[2]\n\tdata[\"p\"] = results[3]\n data[\"s\"] = results[4]\n \n # update the defaults values\n if( not @entity )\n data.each {|k, v| @@defaults[k] = v }\n end\n\n data\nend",
"def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" find - Find by name\"\n puts \" quit - Exit Application\"\n print \"> \"\n end",
"def display_menu\n\t\n\tputs \" \"\n\tputs \"Would you like to (a)dd a new apartment, (c)reate a new person?, or (q)uit?\"\n\tputs \" \"\n\tgets.chomp.downcase\nend",
"def help\n puts 'Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n search - Search contacts'\n end",
"def items_menu_prompt(**)\n 'Select an EMMA user account' # TODO: I18n\n end",
"def load_search_acquisitions_form\n click_search_link\n click_clear_button\n select_record_type_option 'Acquisitions'\n end",
"def display_attribute\n\t\tprint_display_attribute\n\t\tshow_attribute = gets.chomp.to_i\n\n\t\tif show_attribute == 5 \t\n \t\tmain_menu \n \telse \n \t\tprint_attribute(show_attribute)\n \tend\n\tend",
"def print_help\n puts 'Here is a list of available commands:'\n puts '- new - Create a new contact'\n puts '- list - List all contacts'\n puts '- show - Show a contact'\n puts '- find - Find a contact'\n end",
"def add_new_customer_menu\n begin\n puts \"Enter customer first name: \"\n p \">\"\n @first_name = set_field\n\n puts \"Enter customer last name: \"\n p \">\"\n @last_name = set_field\n\n puts \"Enter Phone Number: \"\n p \">\"\n @phone_number = set_field\n\n puts \"Enter street address: \"\n p \">\"\n @street_address = set_field\n\n puts \"Enter City: \"\n p \">\"\n @city = set_field\n\n puts \"Enter State: \"\n p \">\"\n @us_state = set_field\n\n puts \"Enter Zip code: \"\n p \">\"\n @zip_code = set_field\n\n add_new_customer\n rescue SQLite3::Exception => e\n p \"Exception with add_new_customer_menu: #{e}\"\n end\n end",
"def help\n \n \"Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n find - Find a contact\"\n\nend",
"def main_display\n puts \"Please choose the action you would like to perform?\" \\\n \"\\n1. Enroll into a department\" \\\n \"\\n2. Change your department\" \\\n \"\\n3. Change your section\" \\\n \"\\n4. View details\"\nend",
"def att_get #DEFINE NEW FUNCTION TO RETRIEVE ATTRIBUTES\r\n model=Sketchup.active_model #RETRIEVE THE ACTIVE MODEL\r\n# view=model.active_view #SET THE ACTIVE VIEW\r\n# ents=model.active_entities #GET ALL THE ENTITIES FROM THE MODEL\r\n $ss=[] #INITIALIZE A NEW ARRAY TO HOLD SELECTED ENTITIES\r\n model.selection.each {|e| $ss.push(e)} #ADD EACH SELECTED ENTITY TO THE ARRAY\r\n $ss.freeze #FREEZE THIS ARRAY TO AVOID CHANGES\r\n model.selection.clear #CLEAR THE SELECTION SET\r\n for $e in $ss #FOR EACH ITEM IN THE ARRAY, DO THE FOLLOWING...\r\n $dict_names=[] #INITIALIZE AN ARRAY TO HOLD DICTIONARY NAMES\r\n model.selection.add($e) #HIGHLIGHT THIS ENTITY FROM THE ARRAY SO USER KNOWS WHAT IS SELECTED\r\n dicts = $e.attribute_dictionaries #GET THE ATTRIBUTE DICTIONARIES FOR THIS ENTITY\r\n if dicts != nil #IF THERE WERE AD'S FOR THIS ENTITY, DO THE FOLLOWING...\r\n dicts.each {|f| $dict_names.push(f.name)} #ADD EACH ATTRIBUTE DICTIONARY TO THE ARRAY $dict_names\r\n for $ad in $dict_names #FOR EACH ITEM IN $dict_names, DO THE FOLLOWING...\r\n $prompts=$e.attribute_dictionary($ad).keys #SET THE PROMPTS FOR THE DIALOG BOX\r\n $values=$e.attribute_dictionary($ad).values #SET THE VALUES FOR THE DIALOG BOX\r\n $results = inputbox $prompts, $values, $ad #DO THE DIALOG BOX (ONLY FOR DISPLAY OF VALUES)\r\n if $results != $values && $results != false # [ADD SECTION TO UPDATE CHANGED VALUES]\r\n 0.upto($prompts.length-1) do |xx|\r\n if $results[xx] != \"\"\r\n $e.set_attribute($ad,$prompts[xx],$results[xx])\r\n end\r\n end\r\n end\r\n end #END THE 'FOR' LOOP\r\n model.selection.clear #CLEAR THE SELECTION SET AND GET READY FOR THE NEXT ONE\r\n end #END THE 'IF' STATEMENT\r\n end #END THE 'FOR' LOOP\r\nend",
"def trail_options\n menu = [\"View All Trails\", \n \"Search for Trail\", \n \"Exit\"]\n system 'clear'\n puts \"------TRAILS------\"\n choice = @prompt.select(\"Which action would you like to take?\", menu)\n case choice\n when \"View All Trails\"\n print_trail_info(Trail.all)\n when \"Search for Trail\"\n search_for_trail(Trail.all)\n end\n @prompt.keypress(\"Press any key to continue\")\nend",
"def prompt_department\n prompt_by_index 0\n end",
"def display_by_keyword(attractions_array)\n if attractions_array.length == 0\n puts \"Sorry, your search returned no results. Try again.\"\n present_menu_options\n end\n attractions_array.each_with_index do |attraction, index|\n puts (index+1).to_s + '.'\n line\n name = attraction[\"name\"] || 'nil'\n date = attraction[\"dates\"][\"start\"][\"localDate\"] || 'nil'\n url = attraction[\"url\"] || 'nil'\n puts \"Name: #{name}\\nDate: #{date}\\nURL: #{url}\\n\" \n if Event.find_by(event_type: url) == nil\n $event = create_event(name, date , url)\n end\n line\n space(2)\n end\n click?\nend",
"def items_menu_prompt(user: nil, **)\n case user\n when nil, :all then 'Select an existing manifest' # TODO: I18n\n else 'Select a manifest you created' # TODO: I18n\n end\n end",
"def prompt(operation)\n # get the parameters\n if( @entity )\n data = self.parameters\n else\n data = self.default_parameters\n end\n if( not data )\n puts \"No parameters attached to the entity\"\n return nil\n end\n title = \"(* values will not import)\"\n $colorOptions = [\"Brite\", \"Roman\", \"Clay\", \"Beige\", \"Bronze\", \"Ash\", \"Sand\", \"Autumn\", \"Tudor\", \"Smoke\", \"Evergreen\", \"BrandyWin\", \"Terratone\", \"Matte Black\", \"Antique Ivory\", \"Hartford Green\"]\n csColorOptions = [\"Black\",\"Charcoal\",\"Taupe\",\"Gray\",\"Alamo\",\"Brilliant\",\"Arctic\",\"Forest\",\"Hunter\",\"Gold\",\"Crimson\",\"Rustic\",\"Burgundy\",\"Gallery\",\"Ocean\",\"Ivory\",\"Light Stone\",\"Tan\",\"Brown\",\"Burnished Slate\",\"Copper Metallic\"]\n sets = [\"set1\",\"set2\",\"set3\"]\n prompts = [\"Width (feet)*\", \"Height (feet)*\", \"Number of Window*\", \"Color*\",\"set\"]\n values = [data[\"w\"], data[\"h\"], data[\"n\"], data[\"c\"], data[\"s\"]]\n popups = [nil, nil,nil,($colorOptions + csColorOptions).join(\"|\"),sets.join(\"|\")]\n results = inputbox( prompts, values, popups, title )\n return nil if not results\n \n # Store the results back into data\n data[\"w\"] = results[0]\n data[\"h\"] = results[1]\n\tdata[\"n\"] = results[2]\n data[\"c\"] = results[3]\n data[\"s\"] = results[4]\n \n # update the defaults values\n if( not @entity )\n data.each {|k, v| @@defaults[k] = v }\n end\n\n data\nend",
"def help\n puts ''\n puts 'Input \"exit\" for exit'\n puts 'Input \"create_test_data\" for create test data'\n puts 'Input \"create_station\" for create a station'\n puts 'Input \"create_train for create a train'\n puts 'Input \"add_carriage\" for add a carriage'\n puts 'Input \"delete_carriage\" for delete a carriage'\n puts 'Input \"move_train\" for move a train'\n puts 'Input \"display_stations\" for display your stations'\n puts 'Input \"display_station_trains\" for display the trains on the station'\n puts 'Input \"display_train_carriages\" for display the carriages of the train'\n puts 'Input \"take_a_place\" for take a place'\n puts 'Input \"fill_capacity\" for fill some capacity'\n puts ''\n end",
"def welcome\n puts \"Welcome to the BookSearcher\"\n puts \"Please enter a term:\"\nend",
"def show_main_menu\n puts \"Welcome to the app. What's next?\".yellow\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - display details via index\"\n puts \" find - find someone by name\"\n puts \" quit - Exit Application\"\n print \"> \"\n end",
"def prompt_after_search\n puts \"\"\n puts \"--------------------| Search Completed |----------------------\"\n puts \" Type 'start' to start over or 'exit' to exit search \"\n input = gets.strip\n if input == \"exit\"\n puts \"Search Ended....\"\n elsif input == \"start\"\n puts \"Enter New Search\"\n self.define_scraper\n end\n end",
"def search_designer\n end",
"def edit_ingredients\n @prompt.select(\"Do you want to add or delete ingredients?\") do |menu|\n menu.choice \"Add ingredient(s)\", -> {add_ingredients}\n menu.choice \"Delete ingredient(s)\", -> {delete_ingredients}\n menu.choice \"Back to menu\", -> {nav_menu}\n end\n end",
"def client_form\n\tclient_pref = {\n\t\tname: \"\",\n\t\tage: '',\n\t\tchildren: '',\n\t\tdecor: \"\",\n\t}\n\tputs \"Hello, welcome to Interior Solutions. Please help us help you by answering the following questions.\"\n\tclient_pref[:name] = name\n\tclient_pref[:age] = age\n\tclient_pref[:children] = children\n\tclient_pref[:decor] = decor\n\tclient_pref[:color] = color\n\t# Run \"update\" method to determine if any changes need to be made to program\n\tclient_pref = update(client_pref)\n\t# Print the latest version of the hash, and exit the program.\n\tputs \"Here is a summary of your client's information: #{client_pref}.\"\nend",
"def print_menu\n puts \"1. List patients\"\n # ....\n end",
"def start_recipe\n @recipe.delete_recipes\n puts File.foreach(\"ingredient_list.txt\") { |line| puts line }\n puts \"What Ingredients do you have?\".colorize(:yellow)\n user_input = gets.chomp\n @recipe.search(user_input)\n self.print_recipe\n self.recipe_ask_for_options()\n end",
"def interface\r\n clear\r\n menu_banner\r\n puts\r\n options = [\r\n { name: 'New Game', value: -> { get_user_selection } },\r\n { name: 'Custom quiz collections', value: -> { custom_collection } },\r\n { name: 'History', value: -> { history_select } },\r\n { name: 'Exit', value: lambda {\r\n clear\r\n exit_banner\r\n exit\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options.\\n\\n\", options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always)\r\n end",
"def execute\n # These hashes, added to by the various gadget creators, of\n # field-name=>Proc. Calling the get proc will return the field value\n # that was in the dialog. Calling the put proc will set the value.\n @data_get_hash = {}\n @data_put_hash = {}\n\n # Construct the dialog from the gadgets given to othe constructor\n make_dialog_and_display\n\n # OK. It got displayed and we blocked until they hit OK or\n # Cancel. If OK, then we grab the values from the dialog, persist\n # the new values to disk, and return them. If Cancel, we return\n # nil.\n\n # Clicking on the OK button set @result to 1; Cancel set it to 0.\n if @result == 1\n @mgr.commit_defaults\n return @mgr.current_dialog_values\n else\n return nil\n end\n end",
"def login_menu_display\n puts \"Welcome to Ticket Search app!\"\n login_choice = @prompt.select(\"What would you like to do?\", [\"Create Account\", \"Login\", \"Exit\"])\n case login_choice\n when \"Create Account\"\n user_create\n system \"clear\"\n when \"Login\"\n account_login\n system \"clear\"\n when \"Exit\"\n exit\n end\n end",
"def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show id - Show info for contact id number\"\n puts \" quit - Exit Application\"\n print \"> \"\n end",
"def show\n\t\t@attrib_keys = [\"desc\", \"higher_level\", \"range\", \"components\", \"material\", \"ritual\", \"duration\", \"concentration\", \"casting_time\", \"level\", \"school\", \"class_names\", \"archetype\", \"domains\", \"oaths\", \"circles\", \"patrons\"]\n\tend",
"def new_search\n puts \"Would you like to see other types of artists? If not, type 'exit' to exit or hit any key to see more careers.\"\n @input = gets.strip\n end",
"def ask_classes\n format=\"rdoc\"\n str = get_string_with_history(\"Enter a class name: \")\n if str && str != \"\"\n #lines = `ri -f #{format} #{str}`.split(\"\\n\")\n lines = get_data str\n if lines.size == 0\n alert \"Nothing came through for #{str}\"\n ## Nothing returned, lets see if we can match something from the class list\n li = @form.by_name[\"mylist\"]; \n values = li.list\n values = values.grep(/^#{str}/i)\n if values.size > 0\n ix = popuplist(values)\n if ix\n str = values[ix]\n #lines = `ri -f #{format} #{str}`.split(\"\\n\")\n lines = get_data str\n end\n else\n alert \"Nothing came through for #{str}\"\n $message.value = \"Nothing came through for #{str}\"\n end\n elsif lines.first.index(\".#{str} not found\")\n ## we are returned something with some choices, lets prompt user with choices\n lines.shift\n lines.shift\n ix = popuplist(lines)\n if ix\n str = lines[ix]\n #lines = `ri -f #{format} #{str}`.split(\"\\n\")\n lines = get_data str\n end\n end\n return if lines.size == 0\n w = @form.by_name[\"tv\"]; \n w.add_content(lines, :content_type => :ansi, :title => str)\n #w.add_content(lines, :title => str)\n w.buffer_last\n set_focus_on str\n end\nend",
"def display_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Add Code'\n menu.choice 'Edit Code'\n menu.choice 'Remove Code'\n menu.choice 'Search'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend",
"def main_menu\n prompt.select(\"What would you like to do today #{user.name}?\") do |menu|\n menu.choice \"Choose Protein\", -> {choose_protein}\n menu.choice \"Exit!\", -> {exit_helper}\n menu.choice \"Delete Account!?!?\", -> {delete_account_helper}\n end\n end",
"def menu_list \n puts \"Please select from the following options: \"\n puts \" Enter '1' to create a new donation!\"\n puts \" Enter '2' to see a list of the organizations accepting donations\"\n puts \" Enter 'exit' if you changed your mind and wish to leave the app\"\n puts \" To see the menu options again, please enter 'menu'\"\nend",
"def search_stock_options\n blank\n puts \"[1-10] from the company menu options\".colorize( :gray )\n puts \"[a] to run all\"\n puts \"[m] to view menu again\".colorize( :gray )\n puts \"[b] to view company menu again\".colorize( :gray )\n puts \"[x] to exit\".colorize( :gray )\n end",
"def help\r\n\tputs \"-to add new student: add student\"\r\n\tputs \"-to display all students: display students\"\r\n\tputs \"-to display all subjects: display subjects\"\r\n\tputs \"-to update a grade: update grade\"\r\n\tputs \"-to display grades of a student: check grade\"\r\n\tputs \"-to quit: done, exit\"\r\nend",
"def vampire_questions\n \tputs @prompt\n vampire_name\n vampire_age\n vampire_birth_year\n garlic_bread\n health_insurance\n allergie_checker\n end",
"def record_edit_display\n \"1. Name: #{name}\\n\"\\\n \"2. Email: #{email}\\n\"\\\n \"3. Library: #{libraries_edit_display}\"\n end",
"def help\n puts \"\"\n puts 'Input \"exit\" for exit'\n puts 'Input \"create_station\" for create a station'\n puts 'Input \"create_train for create a train'\n puts 'Input \"add_carriage\" for add a carriage'\n puts 'Input \"delete_carriage\" for delete a carriage'\n puts 'Input \"move_train\" for move a train'\n puts 'Input \"display_stations\" for display your stations'\n puts \"\"\n end",
"def show\n load_variables\n initialize_variables\n \n check_user\n \n match_cards_and_programs\n \n sort_results\n end",
"def doit\n puts \"\\nadd user to ALL workflows\"\n netid = ask('Netid ? ')\n\n p = DEPerson.find(netid)\n\n if !p\n puts \"no such account #{netid}\"\n else\n DSpace.login DConstants::LOGIN\n create_tasks p\n if 'Y' == ask('Commit changes: Yes or No (Y/N) ')\n DSpace.commit\n else\n DSpace.context_renew\n end\n end\n doit\nend",
"def introduction\n puts \"1. Create a customer account\\n2. Choose active customer\\n3. Create a payment option\\n4. Add product to sell\\n5. Add product to shopping cart\\n6. Complete an order\\n7. Remove customer product\\n8. Update product information\\n9. Show stale products\\n10. Show customer revenue report\\n11. Show overall product popularity\\n12. Leave Bangazon!\"\n end",
"def edit\n puts \"******* edit *******\"\n end",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end",
"def initial_prompt\n puts \"How would you like to explore?\"\n puts \"---------------------------------\"\n puts \"\"\n puts \"1) Search by Year\"\n puts \"2) Search by production title\"\n puts \"\\n\\t ** or type Exit **\"\n input = gets.strip.downcase\n case input\n when \"exit\"\n goodbye\n when \"1\"\n year_search\n when \"2\"\n production_search\n else \n unclear\n end\n end",
"def options\n puts \"Here are your options:\"\n puts \" \"\n puts \"1 : Create a new apartment.\"\n puts \"2 : Create a new person.\"\n puts \"3 : List all appartments in your building.\"\n puts \"4 : List all the people in an apartment.\"\n puts \"5 : Quit\"\n puts \" \"\n puts \"What would you like to? (Type a number)\"\nend",
"def list\n\nputs \"------------------------------------------------\nThis is the list of voters created:\"\nPolitician.list_politician\nPerson.list_people\nmain_menu\nend",
"def print_instructions\n puts \"Type 'find 1' to display candidate with id 1.\"\n puts \"Type 'all' to see all candidates.\"\n puts \"Type 'qualified' to print only qualified candidates.\"\n puts \"Type 'quit' to exit.\"\n puts \"Type 'help' to see these instructions again.\"\nend",
"def view_existing_entry()\n\t# Print overview of existing entries\n\tentry_valid = 0\n\taddr_book_array = []\n\tAddr_book.each do |entry_name, entry|\n\t\taddr_book_array.push entry_name\n\tend\n\tputs \"---\"\n\taddr_book_array.each_with_index do |element, index|\n\t\tputs index.to_s + \" \" + element\n\tend\n\t# Prompt user for entry\n\twhile entry_valid == 0\n\t\tputs \"Which entry would you like to view? <0, 1, 2, etc.>\"\n\t\tentry_to_view = gets.chomp.to_i\n\t\tentry_name = addr_book_array[entry_to_view]\n\t\tif Addr_book.key?(entry_name) == true\n\t\t\tAddr_book[entry_name].each do |key, value|\n\t\t\t\tputs key.to_s + \": \" + value\n\t\t\tend\n\t\t\tputs \"---\"\n\t\t\tentry_valid = 1\n\t\telse \n\t\t\tputs \"That entry is bogus. Try again.\"\n\t\tend\n\tend\n\t# Exit this workflow and return to main menu\nend",
"def perform_pahma_adv_search_for_all(data_set)\n click_clear_button\n select_adv_search_all_option\n enter_pahma_object_id_search_data data_set\n click_search_button\n end",
"def index\n \t@document = PrismicService.get_document(api.bookmark(\"homepage\"), api, ref)\n @user_friendly_arguments = api.form(\"arguments\")\n .query(%([[:d = at(document.tags, [\"userfriendly\"])][:d = at(document.tags, [\"featured\"])]]))\n .orderings(\"[my.argument.priority desc]\")\n .submit(ref)\n @design_arguments = api.form(\"arguments\")\n .query(%([[:d = at(document.tags, [\"design\"])][:d = at(document.tags, [\"featured\"])]]))\n .orderings(\"[my.argument.priority desc]\")\n .submit(ref)\n @questions = api.form(\"questions\")\n .query(%([[:d = at(document.tags, [\"featured\"])]]))\n .orderings(\"[my.faq.priority desc]\")\n .submit(ref)\n set_minimum_price\n end"
] |
[
"0.59970486",
"0.5993395",
"0.58798575",
"0.58658797",
"0.58514714",
"0.5840038",
"0.58260834",
"0.5770405",
"0.5764896",
"0.5757198",
"0.5747621",
"0.5744629",
"0.572875",
"0.5710119",
"0.5688425",
"0.56677926",
"0.5645955",
"0.5633703",
"0.56207925",
"0.56119686",
"0.5592392",
"0.55629206",
"0.55615693",
"0.55603224",
"0.5543799",
"0.55392015",
"0.5514144",
"0.55039144",
"0.5489204",
"0.5483396",
"0.547604",
"0.54611015",
"0.5444693",
"0.5440211",
"0.5438251",
"0.5434176",
"0.5417836",
"0.5413753",
"0.54084414",
"0.54043597",
"0.54021084",
"0.5400432",
"0.53989416",
"0.53735065",
"0.53655213",
"0.5335451",
"0.5324343",
"0.5315223",
"0.52968144",
"0.529654",
"0.52826095",
"0.52812403",
"0.52746814",
"0.52730346",
"0.52730024",
"0.5269588",
"0.52560574",
"0.5235805",
"0.52312124",
"0.522815",
"0.5226968",
"0.5225449",
"0.52253944",
"0.5221063",
"0.5221041",
"0.5218784",
"0.52147645",
"0.5213076",
"0.52070355",
"0.5206517",
"0.5195522",
"0.51927555",
"0.51925385",
"0.518145",
"0.5178914",
"0.51785195",
"0.5159663",
"0.515341",
"0.51453567",
"0.5142141",
"0.51397836",
"0.5139663",
"0.51391584",
"0.51382816",
"0.51336473",
"0.5127586",
"0.5127544",
"0.5123299",
"0.51225626",
"0.5121943",
"0.5118455",
"0.511354",
"0.511354",
"0.5112973",
"0.5112654",
"0.51066595",
"0.5098456",
"0.5095891",
"0.5095252",
"0.5094994"
] |
0.5662488
|
16
|
=begin As a user, if I select add I am prompted to enter a 'first name', 'last name', 'email' and 'note'. =end
|
def add_new_contact
puts "\e[H\e[2J"
p "enter firstname"
first_name = gets.chomp
p "enter lastname"
last_name = gets.chomp
p "enter email address"
email = gets.chomp
p "enter note: optional"
note = gets.chomp
contact = Contact.create(
first_name: first_name,
last_name: last_name,
email: email,
note: note
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_new_contact\nprint \"Contact first name:\"\nfirst_name = gets.chomp\n\nprint \"Contact last name:\"\nlast_name = gets.chomp\n\nprint \"Enter Contact's Email Address\"\nemail = gets.chomp\n\nprint \"Enter Note\"\nnote = gets.chomp\n\nContact.create(first_name, last_name, email, note)\n end",
"def add_patron\n\tputs \"\\nTo add a new patron please enter the following requested information:\\n\"\n\tprint \"Name \"\n\tname = gets.chomp\n\tprint \"Email Address \"\n\temail_address = gets.chomp\n\tPatron.create(name: name, email_address: email_address)\nend",
"def manual_add_entry\n address_book.add_entry(enter_name, enter_phone, enter_email)\n end",
"def add_contact\n print \"First name:\"\n first_name = gets.chomp\n\n print \"Last Name:\"\n last_name = gets.chomp\n\n print \"Email:\"\n email = gets.chomp\n\n print \"Notes:\"\n notes = gets.chomp\n\n Contact.create(first_name, last_name, { email: email, notes: notes })\n end",
"def enter_personal_info_plus_email(first_name, last_name, email_address, phone_number)\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n # enter_personal_info_plus_email(first_name, last_name, phone_number)\n first_name_hops_field.value = first_name\n last_name_hops_field.value = last_name\n email_address_hops_field.value = email_address\n # confirm_email_address_hops_field.value = email_address\n phone_number_hops_field.value = phone_number\n\n end",
"def add_new_contact\n print \"First Name:\"\n first_name = gets.chomp\n print \"last name:\"\n last_name = gets.chomp\n print \"Email:\"\n email = gets.chomp\n print \"Note:\"\n note = gets.chomp\n contact = Contact.new(first_name, last_name, email, note)\n add_contact(contact)\n end",
"def user(name:\"\", email:\"\")\n puts \"New user #{name}, email: #{email}\"\nend",
"def get_release_notes_input()\nreleaseNotes = prompt(\n text: \"Do you want to add any release notes?\",\n multi_line_end_keyword: \"END\",\n ci_input: ''\n )\nreturn releaseNotes\nend",
"def add_client(shelter, client)\n puts \"*** Client registration form ***\"\n client.id = prompt {\"ID number:\"}\n client.name = prompt {\"Name:\"}\n client.age = prompt {\"Age:\"}\n client.gender = validate_simple_input(%w(m f)) {prompt {\"Gender (m , f):\"}}\n #Break if user wants to quit\n if client.gender != 'q'\n client.kids = prompt {\"Number of kids:\"}\n client.pets = prompt {\"Other pets:\"}\n if client.pets != 'n'\n client.pets = client.pets.split(',')\n end\n\n shelter.clients[client.id] = client\n else\n puts \"Registration aborted.\"\n end\nend",
"def add_test_prompt\n\tputs \"Which test would you like to add to?\"\n\ttest = gets.chomp\n\tputs \"What is the student's first name?\"\n\tfirst_name = gets.chomp\n\tputs \"What is the student's last name?\"\n\tlast_name = gets.chomp\n\tputs \"What is the students grade out of 100?\"\n\tgrade = gets.chomp\n\tadd_to_test(test, first_name, last_name, grade)\nend",
"def add_person\n puts \"Enter Name:\"\n name = gets.chomp\n puts \"Enter Job:\"\n job = gets.chomp\n puts \"Enter Gender:\"\n gender = gets.chomp\n puts \"Enter Age:\"\n age = gets.chomp\n\n $db.execute(\"INSERT INTO people (name, job, gender, age) VALUES (?, ?, ?, ?)\", name, job, gender, age)\nend",
"def createnewuser_prompt\n header\n puts \"\\n\\nPlease enter a username.\\n\"\n self.createnewuser_input = STDIN.gets.strip\n self.createnewuser_valid?\nend",
"def add_a_contact\r\n print 'Enter a name: '\r\n name = gets.chomp\r\n phone_numbers = []\r\n email = []\r\n\r\n print 'Enter the phone number: '\r\n phone_num = gets.chomp\r\n phone_numbers.push phone_num\r\n while phone_num != 'x'\r\n print 'Enter additional phone number or type \"x\" to stop: '\r\n phone_num = gets.chomp\r\n end\r\n\r\n print 'Enter the email address: '\r\n email = gets.chomp\r\n while email != 'x'\r\n emails.push email\r\n print 'Enter additional email address or type \"x\" to stop: '\r\n email = gets.chomp\r\n end\r\n\r\n @contact_book.add_contact(name, phone_numbers, emails)\r\n end",
"def add_note\n puts \"Enter your note: \"\n note = $stdin.gets.chomp\n\nend",
"def new_game\n\n enter_name\n nter_name\n user_name = gets.chomp\n current_user = find_or_add_user(user_name)\n space\n element = prompt.select('What is your element?', [\"Water\", \"Earth\", \"Air\"])\n current_user.update(element: element)\n space\n space\n\n ### intro method ###\n\nend",
"def adduser(journal)\n\tputs \"What is the username that you want to add?\"\n\tuser_name = gets.chomp.capitalize\n\tjournal.execute(\"INSERT INTO users (name) VALUES (?)\", [user_name])\nend",
"def add_contact(list)\n\n puts \"Please enter new contact name:\"\n add_name = gets.chomp.downcase\n\n puts \"Please enter new contact phone number:\"\n add_phone = gets.chomp.downcase\n\n puts \"please enter new contact email address:\"\n add_email = gets.chomp.downcase\n\n puts \"please enter new contact occupation:\"\n add_occupation = gets.chomp.downcase\n\n puts \"please enter how you know new contact:\"\n add_group = gets.chomp.downcase\n\n list.execute(\"INSERT INTO contacts(name, occupation, association, phone_number, email) VALUES ('#{add_name}', '#{add_occupation}','#{add_group}', '#{add_email}', '#{add_phone}') \")\nend",
"def create_new_entry()\n\tputs \"You are adding a new entry.\"\n\tentry = {}\n\tputs \"First name:\"\n\tentry[:first_name] = gets().chomp\n\tputs \"Last name:\"\n\tentry[:last_name] = gets().chomp\n\tputs \"Phone number:\"\n\tentry[:phone_number] = gets().chomp\n\tputs \"Email:\"\n\tentry[:email] = gets().chomp\n\t# entry.each do |entry_field, value|\n\t# \tputs \"Enter the person's #{entry_field}:\"\n\t# \tvalue = gets.chomp\n\t# \tputs entry.inspect\n\t# \tputs \"---\"\n\t# end\n\tentry_name = entry[:last_name] + \", \" + entry[:first_name]\n\tAddr_book[entry_name] = entry\n\tputs Addr_book.inspect\n\t# Exit workflow and return to main menu.\nend",
"def add_new_customer_menu\n begin\n puts \"Enter customer first name: \"\n p \">\"\n @first_name = set_field\n\n puts \"Enter customer last name: \"\n p \">\"\n @last_name = set_field\n\n puts \"Enter Phone Number: \"\n p \">\"\n @phone_number = set_field\n\n puts \"Enter street address: \"\n p \">\"\n @street_address = set_field\n\n puts \"Enter City: \"\n p \">\"\n @city = set_field\n\n puts \"Enter State: \"\n p \">\"\n @us_state = set_field\n\n puts \"Enter Zip code: \"\n p \">\"\n @zip_code = set_field\n\n add_new_customer\n rescue SQLite3::Exception => e\n p \"Exception with add_new_customer_menu: #{e}\"\n end\n end",
"def add_person\n puts \"Enter name: \"\n name = gets.chomp\n puts \"Enter job: \"\n job = gets.chomp\n puts \"Enter gender: \"\n gender = gets.chomp\n puts \"Enter age: \"\n age = gets.chomp\n\n # insert_person_to_db\n $db.execute(\"INSERT INTO people (name, job, gender, age) VALUES (?, ?, ?, ?)\", name, job, gender, age)\nend",
"def add_staff_member\n\tputs \"\\nTo add a new staff member please enter the following requested information:\\n\"\n\tprint \"Name \"\n\tname = gets.chomp\n\tprint \"Email Address \"\n\temail_address = gets.chomp\n\tprint \"Library branch assigned to \"\n\tlibrary_id = gets.chomp.to_i\n\tlibrary_id = verify_library_exists(library_id)\n\tStaffMember.create(name: name, email_address: email_address, \n\t\t\tlibrary_id: library_id)\nend",
"def add_new_contact \t\n\t print \"Enter First Name: \"\n\t first_name = gets.chomp\n\t print \"Enter Last Name: \"\n\t last_name = gets.chomp\n\t print \"Enter Email Address: \"\n\t email = gets.chomp\n\t print \"Enter a Note: \"\n\t note = gets.chomp\n\n\t contact = Contact.new(first_name, last_name, email, note)\n\t @rolodex.add_contact(contact)\n\tend",
"def ask_name\n PROMPT.ask(\"Choose your name: \") do |q|\n q.required true\n q.modify :capitalize\n end\nend",
"def add_user_personal_info(email, first_name, last_name, phone=nil)\n user_email.set email\n user_first_name.set first_name\n user_last_name.set last_name\n user_phone.set phone if phone\n end",
"def add_member(lineup)\n puts \"you have chosen to add a spice girl. Enter the name of the girl: \"\n lineup.list_names2\n pick_newby = gets.chomp\n lineup.name_check=(pick_newby)\n lineup.add_girl(pick_newby)\n puts \"your new lineup is :\"\n lineup.list_names\nend",
"def new_note(db)\n puts \"\\nWhat category would you like this note to be saved under?? examples html, css, ruby.....ect.\"\n category = gets.chomp\n\n puts \"\\nWhat would you like to name this note?? examples how to make a new line, how to round to the nearest whole number, ...ect \"\n name = gets.chomp\n\n puts \"\\nAdd your note below\"\n note = gets.chomp\n\n create_note(db, category, name, note)\nend",
"def add_contact\n puts \"What contact would you like to add?\"\n input = gets.strip\n @contacts.push(input)\n # \"Would you like to see the new contact list? yes/no\"\n # yn = gets.strip\n # if yn == yes\n # view_contacts\n # elsif yn == no\n main_menu\nend",
"def task_name\n puts \"What is the task name?\"\n user = gets.chomp.downcase\n puts \"You have added a task: '#{user}' \"\nend",
"def user_input\n\t#set variables\nname, cohort, city, hobby = placeholder\n\t#prompt the user for input\n\tputs \"Please enter the name of the student you'd like to add to the database \\n\".center(50).green\n name = gets.chomp\n \n puts \"Please enter the cohort of the student you'd like to add to the database \\n\".center(50).green\n cohort_input = gets.chomp\n cohort = cohort_input.capitalize\n \n puts \"Please enter the home city of the student you'd like to add to the database \\n\".center(50).green\n city = gets.chomp\n \n puts \"Please enter the hobby of the student you'd like to add to the database \\n\".center(50).green\n hobby = gets.chomp\n\n validate_user_input(name, cohort, city, hobby)\nend",
"def edit\n puts \"\\nSelect field to edit in Personal Details\"\n ch = \"1\"\n until ch == \"6\" do\n puts \" 1 => Name\\n 2 => Date Of Birth\\n 3 => Marital Status\\n 4 => Mobile Number\\n 5 => Email\\n 6 => Exit\"\n ch = gets.chomp\n case ch\n when \"1\"\n print \" Name : \"\n name = gets.chomp\n update({:name => name}) unless name == \"\"\n when \"2\"\n print \" Date Of Birth : \"\n dob = gets.chomp\n update({:dob => dob}) unless dob == \"\"\n when \"3\"\n print \" Marital Status : \"\n marital_status = gets.chomp\n update({:marital_status => marital_status}) unless marital_status == \"\"\n when \"4\"\n print \" Mobile Number : \"\n mobile_number = gets.chomp\n update({:mobile_number => mobile_number}) unless mobile_number == \"\"\n when \"5\"\n print \" Email : \"\n email = gets.chomp\n update({:email => email}) unless email == \"\"\n when \"6\"\n \n else\n puts \"Wrong Choice\"\n end\n end\n end",
"def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend",
"def enter_profile_info(firstname, gender, grade, month, day, year)\n # Input child profile info\n create_profile_form.first_name_txt.set firstname\n create_profile_form.gender_cbo.select gender\n create_profile_form.grade_cbo.select grade\n create_profile_form.month_cbo.select month\n create_profile_form.day_cbo.select day\n create_profile_form.year_cbo.select year\n\n # Click Save and Continue button\n create_profile_form.save_btn.click\n sleep(2)\n end",
"def list_or_continue_prompt\n puts \"For list, enter: 'list' ! To continue adding user, press enter! Type 'menu' to go back to the menu!\".center(50)\n answer = STDIN.gets.chomp\n if answer.downcase == \"list\" ; return student_list_print(@students) end\n if answer.downcase == \"menu\" ; return interactive_menu end\n put_in_user\nend",
"def bestnotes_ui(users)\r\n selected_user = nil\r\n\r\n loop do\r\n while selected_user.nil?\r\n print \"\\e[H\\e[2J\"\r\n puts \"Welcome to BestNotes!\"\r\n if users.empty?\r\n puts \"No accounts found!\"\r\n else\r\n print \"Press (l) to login, (r) to register or (q) to quit.\\n\"\r\n auth_menu_entry = Readline.readline(\"> \").strip.downcase\r\n end\r\n\r\n if users.empty? || auth_menu_entry == \"r\"\r\n new_user_id = users.length + 1\r\n new_user = add_user(new_user_id, users)\r\n\r\n unless new_user.nil?\r\n users.push(new_user)\r\n user_index = users.length - 1\r\n selected_user = users[user_index].auth\r\n end\r\n elsif auth_menu_entry == \"l\"\r\n user_index = login_dialogue(users)\r\n if user_index.nil?\r\n print \"\\e[H\\e[2J\"\r\n puts \"Sorry, that username does not exist in our database. Please try again.\"\r\n puts \"Press any key to continue.\"\r\n STDIN.getch\r\n else\r\n print \"Password: \"\r\n selected_user = users[user_index].auth\r\n end\r\n elsif auth_menu_entry == \"q\"\r\n return users\r\n else\r\n puts \"#{auth_menu_entry} is an invalid option, please try again.\"\r\n puts \"Press any key to continue.\"\r\n STDIN.getch\r\n end\r\n end\r\n\r\n # Updates selected user with any changes made\r\n selected_user.menu\r\n selected_user = nil\r\n end\r\nend",
"def ask_first_name\n puts \"\\n\" + \"====\" + \"\\n\" + \"ASK FIRST NAME\" + \"\\n\" + \"====\"\n puts \"Quel est ton nom?\" \nend",
"def add_user\r\n user_name = \"\"\r\n user_un = \"\"\r\n user_pass = \"\"\r\n\r\n while (user_name.empty?) \r\n puts \"Please input your name:\"\r\n user_name = gets.chomp\r\n end\r\n\r\n while (user_un.empty?)\r\n puts \"Please input user name:\"\r\n user_un = gets.chomp\r\n end\r\n\r\n while (user_pass.empty?)\r\n puts \"Please input user password:\"\r\n user_pass = gets.chomp\r\n end\r\n\r\n users = User.create(:name => user_name,:username => user_un, :password => user_pass)\r\nend",
"def prompt_for_first_name\n puts \"Enter a first name:\"\n @firstname = gets.chomp\nend",
"def input_data\n\tputs \"Please enter any data you'd like to save\"\n\tputs \"To finish, just hit return twice\"\n\tinfo = gets.chomp\n\twhile !info.empty? do\n\t\tputs \"Add a note to this entry\"\n\t\tnote = STDIN.gets.chomp\n\t\tnote = \"N/A\" if note.empty?\n\t\t@document << {:info => info, :note => note}\n\t\tputs \"Now we have #{@document.length} pieces of information. Any more?\"\n\t\tinfo = STDIN.gets.chomp\n\tend\nend",
"def record_edit_display\n \"1. Name: #{name}\\n\"\\\n \"2. Email: #{email}\\n\"\\\n \"3. Library: #{libraries_edit_display}\"\n end",
"def print_update\n puts \"Attribute to Change\"\n puts \"[1] First Name\"\n puts \"[2] Last Name\"\n puts \"[3] E-mail\"\n puts \"[4] Note\"\n puts \"Enter a number\"\n end",
"def user_sign_in\n clear\n puts 'Create new user.'\n puts 'Enter [0] to exit'\n print 'Username*: '\n in_uname = non_blank_input\n return if in_uname == '0'\n\n print 'Password*: '\n in_psw = non_blank_input\n return if in_psw == '0'\n\n print 'Name*: '\n in_name = non_blank_input\n return if in_name == '0'\n\n print 'Surname*: '\n in_surname = non_blank_input\n return if in_surname == '0'\n\n print 'Email*: '\n in_email = non_blank_input\n return if in_email == '0'\n\n print 'Phone: '\n in_phone = gets.chomp\n return if in_phone == '0'\n\n role_input = role_option('New account role:')\n if role_input == '1'\n teacher_sign_in(in_uname, in_psw, in_name, in_surname, in_email, in_phone)\n elsif role_input == '2'\n student_sign_in(in_uname, in_psw, in_name, in_surname, in_email, in_phone)\n elsif role_input == '0'\n return\n end\nend",
"def edit_patron_email_address(selected)\n\tp = Patron.find(selected)\n\tprint \"To edit the patron email address please enter here: \"\n\temail_address = gets.chomp\n\tp.update_attributes(email_address: email_address)\nend",
"def can_enter_mentee(name:, email:)\n click_link 'Add New Mentee'\n\n expect(body).not_to include(email)\n\n fill_in 'Email', with: email\n fill_in 'Name', with: name\n click_button('Save')\n\n visit current_path # reload\n\n expect(body).to include(email)\n end",
"def add_name\n\t\tputs \"What\\'s your name?\"\n\t\t@name = gets.chomp.capitalize \n\tend",
"def ask_for_name\n puts \"what s the name of the task you want to create?\"\n name = gets.chomp\n end",
"def add_new_contact\n\n\t\t# Getting information from user\n\t\tputs \"Enter your firstname\"\n\t\tfirstName = gets\n\n\t\tputs\"Enter your Lastname\"\n\t\tlastName = gets\n\n\t\tputs\"Enter Email\"\n\t\temail = gets\n\n\t\tputs \"Enter notes\"\n\t\tnotes = gets\n\n\t # Making a contact object\n\t contact = Contact.new(firstName, lastName, email, notes)\n\t @contacts << contact # Putting newly created object in array.\n\tend",
"def prompt_user_song\n puts \"Please enter a song name or number:\"\nend",
"def add_contact\n\t\tprint \"First Name: \".pink\n\t\tfirst_name = gets.chomp\n\t\tprint \"Last Name: \".pink\n\t\tlast_name = gets.chomp\n\t\tprint \"Email :\".pink\n\t\temail = gets.chomp\n\t\tprint \"Note :\".pink\n\t\tnote = gets.chomp #could use a hash but it is not ideal - if you need a cutstom piece of data to be repeated you need to create a new class for that method to call on\n\n\t\tcontact = Contact.new(first_name, last_name, email, note)\n\t\t@rolodex.add_contact(contact)\n\n\tend",
"def ask_questions\n print \"What is your name? \"\n self.name = gets.strip.chomp\n print \"What is your email? \"\n self.email = gets.strip.chomp\n end",
"def intro(data)\r\n\tputs\"\r\n╔═════════════════════════════════════════════════════════════════════════╗\r\n║ ║\r\n║#{\"WELCOME TO HABIT TRACKER\".center(73)}║\r\n║ ║\"\r\ninsertquote()\r\nputs\"║ ║\r\n║ ║\r\n║ ║\r\n║ 1. Create New Account ║\r\n║ 2. Login to Existing Account ║\r\n║ 3. Learn More About Habit Tracker ║\r\n║ ║\r\n╚═════════════════════════════════════════════════════════════════════════╝\"\r\n\tvalidinput = false\r\n\r\n\tuntil validinput\r\n\t \tinput = gets.chomp\r\n\t\tif input == \"1\"\r\n\t\t\tvalidinput = true\r\n\t\t\tnewuser(data)\t\t\r\n\t\telsif input == \"2\"\r\n\t\t\tvalidinput = true\r\n\t\t\tlogin(data)\r\n\t\telsif input == \"3\"\r\n\t\t\tvalidinput = true\r\n\t\t\tlearnmore()\r\n\t\telse\r\n\t\t\tputs \"Enter 1 to create an account, 2 to log into your account, or 3 to learn about how Habit Tracker works.\"\r\n\t\tend\t\t\r\n\tend \r\nend",
"def add_new_input(db)\n\tputs \"-\" * 50\n\tputs \"Add New Horse Information: \"\n\tprint \"Name: \"\n\thorse_name = gets.split.map(&:capitalize).join(' ')\n\tprint \"Breed: \"\n\thorse_breed = gets.split.map(&:capitalize).join(' ')\n\tprint \"Color: \"\n\thorse_color = gets.split.map(&:capitalize).join(' ')\n\tprint \"Age: \"\n\thorse_age = gets.to_i\n\tprint \"Rideable (y/n): \"\n\thorse_rideable_input = gets.chomp.downcase\n\tif horse_rideable_input == \"y\"\n\t\thorse_rideable = \"true\"\n\telse\n\t\thorse_rideable = \"false\"\n\tend\n\tadd_new(db, horse_name, horse_breed, horse_color, horse_age, horse_rideable)\nend",
"def user()\nputs \"enter the name\"\nname=gets\nputs \"enter the age\"\nage=gets\nputs \"hello#{name} your age is #{age}\"\nend",
"def add args\n db = get_db\n if args.empty?\n print \"Enter a short summary: \"\n STDOUT.flush\n text = gets.chomp\n if text.empty?\n exit ERRCODE\n end\n else\n # if you add last arg as P1..P5, I'll update priority automatically\n if args.last =~ /P[1-5]/\n $default_priority = args.pop\n end\n text = args.join \" \"\n end\n # convert actual newline to C-a. slash n's are escapes so echo -e does not muck up.\n #atitle=$( echo \"$atitle\" | tr -cd '\\40-\\176' )\n text.tr! \"\\n\", '\u0001'\n title = text\n desc = nil\n if $prompt_desc\n # choice of vim or this XXX also how to store in case of error or abandon\n # and allow user to edit, so no retyping. This could be for mult fields\n message \"Enter a detailed description (. to exit): \"\n desc = Cmdapp.get_lines\n #message \"You entered #{desc}\"\n end\n type = $default_type || \"bug\"\n severity = $default_severity || \"normal\"\n status = $default_status || \"open\"\n priority = $default_priority || \"P3\"\n if $prompt_type\n type = Cmdapp._choice(\"Select type:\", %w[bug enhancement feature task] )\n #message \"You selected #{type}\"\n end\n if $prompt_priority\n #priority = Cmdapp._choice(\"Select priority:\", %w[normal critical moderate] )\n priority = ask_priority\n #message \"You selected #{severity}\"\n end\n if $prompt_severity\n severity = Cmdapp._choice(\"Select severity:\", %w[normal critical moderate] )\n #message \"You selected #{severity}\"\n end\n if $prompt_status\n status = Cmdapp._choice(\"Select status:\", %w[open started closed stopped canceled] )\n #message \"You selected #{status}\"\n end\n assigned_to = $default_assigned_to\n if $prompt_assigned_to\n message \"Assign to:\"\n #assigned_to = $stdin.gets.chomp\n assigned_to = Cmdapp._gets \"assigned_to\", \"assigned_to\", $default_assigned_to\n #message \"You selected #{assigned_to}\"\n end\n project = component = version = nil\n # project\n if $use_project\n project = Cmdapp.user_input('project', $prompt_project, nil, $valid_project, $default_project)\n end\n if $use_component\n component = Cmdapp.user_input('component', $prompt_component, nil, $valid_component, $default_component)\n end\n if $use_version\n version = Cmdapp.user_input('version', $prompt_version, nil, $valid_version, $default_version)\n end\n\n start_date = @now\n due_date = default_due_date\n comment_count = 0\n priority ||= \"P3\" \n description = desc\n fix = nil #\"Some long text\" \n #date_created = @now\n #date_modified = @now\n body = {}\n body[\"title\"]=title\n body[\"description\"]=description\n body[\"type\"]=type\n body[\"status\"]=status\n body[\"start_date\"]=start_date.to_s\n body[\"due_date\"]=due_date.to_s\n body[\"priority\"]=priority\n body[\"severity\"]=severity\n body[\"assigned_to\"]=assigned_to\n body[\"created_by\"] = $default_user\n # only insert if its wanted by user\n body[\"project\"]=project if $use_project\n body[\"component\"]=component if $use_component\n body[\"version\"]=version if $use_version\n\n rowid = db.table_insert_hash(\"bugs\", body)\n puts \"Issue #{rowid} created\"\n logid = db.sql_logs_insert rowid, \"create\", \"#{rowid} #{type}: #{title}\"\n body[\"id\"] = rowid\n mail_issue nil, body\n \n 0\n end",
"def create_email \n puts \"Please enter email category:\"\n \tcat = gets.chomp\n puts \"Please enter email: \"\n \tad = gets.chomp\n email = Email.create({category: cat, address: ad})\nend",
"def user_already_exists\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Please type your name (first and last).\"\n puts \"\"\n user_name_response = gets.chomp.split.map(&:capitalize).join(' ')\n self.quit if user_name_response == \"quit\"\n User.name_search_and_greeting(user_name_response, self)\n self.where_are_you_at?\n end",
"def data()\n\t\tputs(\"Please enter the name of the employee\")\n\t\t@name = gets\n\t\tputs(\"Now the age\")\n\t\t@age = gets\n\t\tputs(\"Finally his social number\")\n\t\t@social_n = gets\n\tend",
"def add_new_patron\n p = Patron.new\n print \"Name: \"\n p.name = gets.chomp\n print \"Email: \"\n p.email = gets.chomp\n print \"ISBN: \"\n p.isbn = gets.chomp\n p.save\n found_it(record)\nend",
"def username\n puts 'Please enter your full name and press ENTER:'\n gets.chomp\nend",
"def add_tenant()\n system \"clear\"\n puts \"Enter Tenant:\"\n puts \"=================\"\n print \"Apartment Reference : \"\n appt_ref = gets\n print \"Tenant name : \"\n tenant_name = gets\n print \"Tenant age : \"\n tenant_age = gets\n print \"Tenant gender : \"\n tenant_gender = gets\n wait = puts\n print \"Select Option : \"\nend",
"def create_new_user\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Tell us a little about yourself. It will only take a moment.\"\n puts \"\"\n puts \"What is your name?\"\n puts \"\"\n new_user_full_name = gets.strip\n self.quit if new_user_full_name == \"quit\"\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Is there something you'd like to be called, other than your first name?\"\n puts \"\"\n puts \" 1. Yes\"\n puts \" 2. No\"\n puts \"\"\n nick_name = gets.strip\n if nick_name == \"1\"\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"What would you like us to call you? (In other words, what is your nickname?)\"\n puts \"\"\n new_user_nickname = gets.chomp.split.map(&:capitalize).join(' ')\n User.name_search_and_greeting_new(new_user_full_name, new_user_nickname, self)\n elsif nick_name == \"2\"\n User.name_search_and_greeting_new(new_user_full_name, nil, self)\n user_name_array = new_user_full_name.split(\" \")\n elsif nick_name == \"quit\"\n self.quit\n end\n self.where_are_you_at?\n end",
"def input_students\r\n puts \"Please enter names of students. \\nAfter each name hit enter. \\nTo exit press enter twice.\"\r\n puts 'If you make a mistake, enter \"typo\" in the next entry and then try again' #What if the user makes a typo?\r\n students = []\r\n name = gets.chomp.downcase.to_sym\r\n while !name.empty?\r\n p \"Which cohort are they in?\"\r\n cohort = gets.chomp.downcase.to_sym \r\n if cohort.empty?\r\n cohort = :unknown \r\n elsif cohort == :typo\r\n redo\r\n end\r\n students << {name: name,\r\n cohort: cohort\r\n }\r\n p \"Added info for #{students.last[:name]}\"\r\n p \"There are now #{students.count} students.\"\r\n p \"Please enter the next student's name.\"\r\n name = gets.chomp.downcase.to_sym\r\n end\r\n students\r\nend",
"def modify_existing_contact \n\t\t contact = display_one_contact\t\n\t\t print \"Change First Name: \"\n\t\t first_name = gets.chomp\n\t\t print \"Change Last Name: \"\n\t\t last_name = gets.chomp\n\t\t print \"Change Email Address: \"\n\t\t email = gets.chomp\n\t\t print \"Change your Note: \"\n\t\t note = gets.chomp\n\t\t contact = Contact.new(first_name, last_name, email, note)\n\tend",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def prompt_user\n puts \"Please type in a path:\"\nend",
"def edit_ingredients\n @prompt.select(\"Do you want to add or delete ingredients?\") do |menu|\n menu.choice \"Add ingredient(s)\", -> {add_ingredients}\n menu.choice \"Delete ingredient(s)\", -> {delete_ingredients}\n menu.choice \"Back to menu\", -> {nav_menu}\n end\n end",
"def addContact(db)\r\n\tputs \"******************************New Contact*********************************\"\r\n\tputs \"Enter name:\"\r\n\tname = gets.chomp\r\n\tputs \"Enter Phone Number (No dashes/parens):\"\r\n\tnum = gets.chomp.to_i\r\n\tputs \"Enter Address:\"\r\n\tadd = gets.chomp\r\n\tdb.execute(\"INSERT INTO contacts (name, phone, address) VALUES (?, ?, ?)\", [name, num, add])\r\nend",
"def client_form\n\tclient_pref = {\n\t\tname: \"\",\n\t\tage: '',\n\t\tchildren: '',\n\t\tdecor: \"\",\n\t}\n\tputs \"Hello, welcome to Interior Solutions. Please help us help you by answering the following questions.\"\n\tclient_pref[:name] = name\n\tclient_pref[:age] = age\n\tclient_pref[:children] = children\n\tclient_pref[:decor] = decor\n\tclient_pref[:color] = color\n\t# Run \"update\" method to determine if any changes need to be made to program\n\tclient_pref = update(client_pref)\n\t# Print the latest version of the hash, and exit the program.\n\tputs \"Here is a summary of your client's information: #{client_pref}.\"\nend",
"def edit_staff_member_email_address(selected)\n\ts = StaffMember.find(selected)\n\tprint \"To edit the staff member email address please enter here: \"\n\temail_address = gets.chomp\n\ts.update_attributes(email_address: email_address)\nend",
"def req_name\n\t\tputs \"What is your name?\"\n\t\t@name = gets.chomp\n\tend",
"def input_students(current_students) # Ex 7 - Requests name, cohort, hobbies, deals with empty value, allows user to edit.\n# Ex 10 - Replace chomp with .gsub(\"\\n\", \"\")\n finished = false\n until finished\n puts \"add - adds student, edit - edits student, exit - exits program\"\n choice = gets.gsub(\"\\n\", \"\")\n if choice == \"add\"\n puts \"name?\"\n name = gets.gsub(\"\\n\", \"\")\n if name == \"\"\n name = \"no name entered\"\n end\n puts \"cohort?\"\n cohort = gets.gsub(\"\\n\", \"\")\n if cohort == \"\"\n cohort = \"no cohort entered\"\n end\n puts \"hobbies?\"\n hobbies = gets.gsub(\"\\n\", \"\")\n if hobbies == \"\"\n hobbies = \"no hobbies entered\"\n end\n current_students << {name: name.to_sym, cohort: cohort.to_sym, hobbies: hobbies.to_sym}\n elsif choice == \"edit\"\n puts \"enter name of student\"\n edit_student = gets.gsub(\"\\n\", \"\")\n current_students.each do |h|\n if h[:name] == edit_student\n puts \"what would you like to edit?\"\n puts \"name, cohort or hobbies\"\n edit_variable = gets.gsub(\"\\n\", \"\")\n if edit_variable == \"name\"\n puts \"enter what you wish the name to be\"\n name = gets.gsub(\"\\n\", \"\")\n h[:name] = name\n elsif edit_variable == \"cohort\"\n puts \"enter desired cohort\"\n cohort = gets.gsub(\"\\n\", \"\")\n h[:cohort] = cohort\n elsif edit_variable == \"hobbies\"\n puts \"enter desired hobby\"\n hobby = gets.gsub(\"\\n\", \"\")\n h[:hobbies] = hobby\n end\n end\n end\n elsif choice == \"exit\"\n finished = true\n end\n end\n current_students\nend",
"def add\n\t\tputs \"\\nEnter the name of the item you would like to add:\"\n\t\tnew_item = gets.chomp\n\t\tputs \"\\nHow many #{new_item} would you like?\"\n\t\tnew_qty = gets.chomp\n\t\t@grocery_list.add(new_item, new_qty)\n\t\tputs \"\\nAdding #{new_item} to list...\"\n\t\tputs \"#{new_qty} #{new_item} were added to your Grocery List!\"\n\tend",
"def add_notifier_field\n html_options = {\n :size => \"12\",\n :title => _(\"Add users by name or email\"),\n :class => \"tooltip\"\n }\n text_field_with_auto_complete(:user, :name, html_options,\n :after_update_element => \"addUserToTask\")\n end",
"def doit\n puts \"\\nadd user to ALL workflows\"\n netid = ask('Netid ? ')\n\n p = DEPerson.find(netid)\n\n if !p\n puts \"no such account #{netid}\"\n else\n DSpace.login DConstants::LOGIN\n create_tasks p\n if 'Y' == ask('Commit changes: Yes or No (Y/N) ')\n DSpace.commit\n else\n DSpace.context_renew\n end\n end\n doit\nend",
"def new_user first_name: \"first\", last_name: \"last\"\n puts \"Welcome to our site, #{first_name} #{last_name}!\"\nend",
"def fill_users(name, phone, email, cpf)\r\n if @home_screen = page(HomeScreen)\r\n @home_screen.create_new_user\r\n else\r\n p 'try'\r\n end\r\n\r\n enter_text(\"* id:'#{user_name}'\", name)\r\n enter_text(\"* id:'#{user_phone}'\", phone)\r\n enter_text(\"* id:'#{user_email}'\", email)\r\n enter_text(\"* id:'#{user_cpf}'\", cpf)\r\n # enter_text(\"* id:'#{user_description}'\", description)\r\n end",
"def add_contact\n puts \"Please provide the information specified below\"\n print \"First name: \"\n first_name = gets.chomp\n print \"Last name: \"\n last_name = gets.chomp\n print \"E-mail: \"\n email = gets.chomp\n print \"Notes: \"\n notes = gets.chomp \n contact = @rolodex.add_contact(first_name, last_name, email, notes)\n puts \"\\nContact successfully added to Rolodex:\\n#{contact}\\n\"\n return contact\n end",
"def new_user greeting=\"Welcome\", first_name: \"first\", last_name: \"last\"\r\n puts \"#{greeting}, #{first_name} #{last_name}\"\r\nend",
"def new\n puts \"who would you like to add?\"\n puts \"name: ?\"\n name = $stdin.gets.chomp\n puts \"email: ?\"\n email = $stdin.gets.chomp\n Contact.create(name,email)\n puts \"contact #{name} with the email #{email} has been added!\"\n end",
"def prompt; end",
"def prompt; end",
"def prompt; end",
"def prompt; end",
"def user_prompt\n print \"(or \\\"add\\\" or \\\"exit\\\"): \"\n user_input = gets.chomp.downcase\n return user_input\nend",
"def mad_lib\n user_inputs = []\n required_data = %w(noun verb adjective adverb)\n required_data.each do |question|\n puts \"Enter a #{question}:\"\n user_inputs << gets.chomp\n end\n puts \"Do you #{user_inputs[1]} your #{user_inputs[2]} #{user_inputs[0]} #{user_inputs[3]}? That's hilarious!\"\nend",
"def give_animal(shelter, animal)\n\n puts \"***Pet's registration details***\"\n animal.name = prompt {\"Enter pet's name:\"}\n\n animal.age = prompt {\"Enter pet's age:\"}\n\n animal.gender = validate_simple_input(%w(m f)) {prompt {\"Enter pet's gender: (m , f)\"}}\n \n if animal.gender != 'q' \n animal.breed = prompt {\"Enter pet's breed:\"}\n\n toys = prompt {\"Enter pet's toys: (separate with a comma)\"}\n animal.toys << toys.split(',')\n \n animal.adoption = validate_simple_input(%w(y n)) {prompt {\"For adoption? (y , n)\"}}\n\n if animal.adoption != 'q'\n shelter.animals[animal.name] = animal\n else\n puts \"Abort. Try agiain.\"\n end\n\n else\n puts \"Abort. Try agiain.\"\n end\n\nend",
"def confirm_input(loan_amt, annual_rate, loan_duration_in_years)\n puts prompt(:confirmation).sub('{loan_amt}', add_commas(loan_amt.to_s))\\\n .sub('{annual_rate}', annual_rate.to_s)\\\n .sub('{loan_duration}', loan_duration_in_years.to_s)\n gets.chomp\nend",
"def sign_up\n puts \"What's your username\"\n username = gets.chomp\n puts \"What's your password\"\n password = gets.chomp\n puts \"Confirm the password\"\n password_confirmation = gets.chomp\n \nend",
"def full_name_greeting\n puts 'Please type your first name.'\n first_name = gets.chomp\n puts 'Please type your middle name.'\n middle_name = gets.chomp\n puts 'Please type your last name.'\n last_name = gets.chomp\n\n puts \"Hello, #{first_name} #{middle_name} #{last_name}!\"\nend",
"def multiple_user_inputer(*students)\n\t\n name = \"placeholder\"\n chort = \"placeholder\"\n city = \"placeholder\"\n hobby = \"placeholder\"\n answer = \"\"\n\n while !name.empty? do\n \tputs \"Please enter the name of the student you'd like to add to the database \\n\".center(50)\n \tname = gets.chomp\n \tputs \"Please enter the cohort of the student you'd like to add to the database \\n\".center(50)\n \tcohort = gets.chomp\n \tputs \"Please enter the home city of the student you'd like to add to the database \\n\".center(50)\n \tcity = gets.chomp\n \tputs \"Please enter the hobby of the student you'd like to add to the database \\n\".center(50)\n \thobby = gets.chomp\n\n if !name.empty? && !cohort.empty? && !city.empty? && !hobby.empty? \n\n each_student = {:name => name, :cohort => cohort, :city => city, :hobby => hobby}\n @students << each_student\n puts \"For Student List, enter 'List' Or, to continue adding students, enter: 'Next'\"\n answer = gets.chomp\n if answer.downcase == \"list\" ; return display(@students) end\n else\n puts \"Your entry was incomplete and will not be saved, you must complete all fiends\"\n return multiple_user_inputer\n end\n end\nend",
"def greeting\n puts \"\\n Welcome to my GPA calculator\"\n puts $divide\n\n puts \"\\nDo you want instructions. (Y/N)\"\n ins = gets.chomp.upcase\n\n instructions if ins[0] == \"Y\"\n\n print \"Please enter your first name: \\n\"\n $first = gets.chomp\n print \"Please enter your last name: \\n\"\n $last = gets.chomp\nend",
"def pet_sitter_edit(pet_sitter)\n if @prompt.select(\"Edit name? \", @yes_or_no)\n pet_sitter[\"name\"] = @prompt.ask(\"Name: \") do |q|\n # error handling requiring input\n q.required true\n q.validate /[a-z]+/\n # error handling message\n q.messages[:valid?] = \"Name need to start with a letter.\"\n q.messages[:required?] = \"Required name\"\n q.modify :capitalize\n end\n end\n\n if @prompt.select(\"Edit Email? \", @yes_or_no)\n pet_sitter[\"contact\"] = @prompt.ask(\"Email: \") do |q|\n # error handling requiring input\n q.required true\n q.messages[:required?] = \"Required email address\"\n # error handling message\n q.validate(/\\A\\w+@\\w+\\.\\w+\\Z/, \"Invalid email address\")\n end\n end\n\n if @prompt.select(\"Edit Post Code? \", @yes_or_no)\n pet_sitter[\"post_code\"] = @prompt.ask(\"Post code: \", convert: :integer) do |q|\n q.messages[:valid?] = \"Post code has to be a number\"\n end\n end\n\n if @prompt.select(\"Edit ABN? \", @yes_or_no)\n pet_sitter[\"abn\"] = @prompt.ask(\"ABN: \", convert: :integer) do |q|\n q.messages[:convert?] = \"ABN has to be a number (no spaces)\"\n end\n end\n \n @db.edit(\"pet_sitters\", pet_sitter)\n return pet_sitter\n end",
"def get_customer_first_name\n puts \"What's your first name?\"\n print \"> \"\n set_customer_first_name(gets.chomp)\n end",
"def edit_data\n puts \"1-add student\"\n puts \"2-delete student\"\n puts \"3-edit student data\"\n user_selection = gets.chomp\n case user_selection\n when \"1\"\n add_student\n when \"2\"\n delete_student\n when \"3\"\n edit_student_data\n else\n puts @dash+\"error-invalid-selection\"+@dash\n user_menu\n end\n end",
"def input_students\n puts \"please put the names of the students, their cohort, their hobby and country of birth, seperated by a comma and space\".center(100)\n puts \"To finish just hit the return twice\".center(100)\n student_info = STDIN.gets.chomp\n # push student info into student adding loop\n student_loop(student_info)\n @students\nend",
"def ask_name\n listing\n puts \"please input your recipe name\"\n recipe_name = gets.chomp\n end",
"def request_user_name\n puts \"Please enter your name: \"\n name = gets.chomp\n end",
"def prompt_greeting(namehere)\n print(namehere)\n gets\nend",
"def show_edit_menu\n puts \" You are now in edit mode\"\n puts \" edit name - edit the name of this contact\"\n puts \" edit email - edit the email of this contact\"\n puts \" add phone - add a phone number to this contact\"\n puts \" edit importance - edit the importance of this contact\"\n print \"> \"\n end",
"def enter_name\n name = ''\n while name.empty?\n print 'Enter a valid name <first_name> <last_name>: >> '\n name = gets.chomp\n end\n name\n end",
"def getFullName\r\n\tfirst_name = ask \"\\nWhat is your first name?\"\r\n\tfirst_name.delete! \" \"\r\n\tfirst_name.downcase!\r\n\r\n\tlast_name = ask \"\\nWhat is your last name?\"\r\n\tlast_name.delete! \" \"\r\n\tlast_name.downcase!\r\n\r\n\tfull_name = first_name + \"_\" + last_name\r\nend"
] |
[
"0.6682645",
"0.6556868",
"0.6545092",
"0.6487292",
"0.63802725",
"0.63300973",
"0.6308948",
"0.62953323",
"0.61733705",
"0.6155862",
"0.6113139",
"0.6099168",
"0.6095556",
"0.60854536",
"0.6066083",
"0.60628515",
"0.6060296",
"0.6023926",
"0.6006099",
"0.60005045",
"0.5989745",
"0.59876263",
"0.59840363",
"0.59734994",
"0.59733635",
"0.59684694",
"0.59479254",
"0.59044355",
"0.5880433",
"0.5855224",
"0.5850583",
"0.58447033",
"0.5844656",
"0.58355284",
"0.58280414",
"0.58190084",
"0.58004427",
"0.5785947",
"0.5785855",
"0.576831",
"0.5766856",
"0.5766683",
"0.57661253",
"0.57625794",
"0.57618225",
"0.5756783",
"0.5755605",
"0.5750147",
"0.57471186",
"0.57426673",
"0.5739157",
"0.5737381",
"0.57316834",
"0.5729566",
"0.5721823",
"0.57169646",
"0.57080936",
"0.5707308",
"0.57055104",
"0.56973016",
"0.5696133",
"0.56921047",
"0.56746495",
"0.5670553",
"0.5666572",
"0.5649407",
"0.5649264",
"0.5648028",
"0.56386983",
"0.5624531",
"0.5614574",
"0.5609246",
"0.5606676",
"0.56058717",
"0.5604851",
"0.5601089",
"0.55989355",
"0.55933726",
"0.558877",
"0.558877",
"0.558877",
"0.558877",
"0.5588251",
"0.55796784",
"0.5573206",
"0.5573032",
"0.5561593",
"0.55568296",
"0.5556684",
"0.55562776",
"0.5553645",
"0.55511916",
"0.5550707",
"0.554676",
"0.55391353",
"0.553605",
"0.5535044",
"0.553047",
"0.552837",
"0.55235285"
] |
0.6863274
|
0
|
Overrides the original Devise method
|
def reset_password_instructions(record, token, opts={})
I18n.locale = opts[:locale].to_sym if opts[:locale].present?
@receiver = record
# must call super at the end
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def devise_controller?; end",
"def current_user\n #super the main class of devise current_user\n super || guest_user\n end",
"def devise_scope(scope); end",
"def devise_parameter_sanitizer; end",
"def current_user\n # if a user is logged in we just use devise's implementation.\n super || guest_user\n end",
"def devise_mappings; end",
"def devise_modules_hook!; end",
"def user_authentication\n end",
"def authentication_method\n super\n end",
"def authenticate_user!\n if user_signed_in?\n super\n else\n redirect_to new_user_registration_path\n end\n end",
"def fetch_details_from_devise\n self.username = 'devise_user'\n self.save\n end",
"def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the user is logged in, super is true,\n # then call super treat everything normal, and ignore right hand side\n # if super == false, call right hand side\n\n # super comes from devise class\n # meanwhile the r.h.s comes from open struct class\n super || guest_user\n end",
"def auth_options\n # Use Devise's first authentication method (e.g. email or username) to\n # get the sign in parameter\n authn_method = serialize_options(resource)[:methods].first\n authn_value = sign_in_params[authn_method]\n\n # Look for a user matching that email/username\n user = resource_class.find_for_authentication(authn_method => authn_value)\n\n super.merge(\n sign_in_params: sign_in_params.except(\"password\"),\n user: user\n )\n end",
"def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n end",
"def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n end",
"def send_devise_notification(notification, *args); end",
"def ensure_password\n self.password ||= Devise.friendly_token[0,20]\n end",
"def devise_parameter_sanitizer\n if resource_class == Host\n Host::ParameterSanitizer.new(Host, :host, params)\n else\n ParameterSanitizer.new(User, :user, params)\n # super # Use the default one\n end\n end",
"def authenticate_user_devise!\n raise Errors::AuthorizationError, 'Token authentication is not correct' unless current_user_devise\n end",
"def authenticated?; super; end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password) }\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:email, :password, :password_confirmation, :current_password) }\n end",
"def authentication_profile\n super\n end",
"def devise_mapping\n @devise_mapping ||= Devise.mappings[:user]\n end",
"def devise_mapping\n @devise_mapping ||= Devise.mappings[:user]\n end",
"def devise_mapping\n @devise_mapping ||= Devise.mappings[:user]\n end",
"def sign_in\n\n end",
"def sign_in\n trait()\n end",
"def user_key\n send(Devise.authentication_keys.first)\n end",
"def user_key\n send(Devise.authentication_keys.first)\n end",
"def sign_in\n end",
"def signingIn (authentication)\n\n if authentication.instance_of?(Authentications)\n user = Customer.where(:id => authentication.user_id).first\n session[:user_id] = user.id\n current_user.sign_in_count +=1\n current_user.last_sign_in_at = Time.now\n current_user.current_sign_in_at = Time.now\n current_user.last_sign_in_ip = request.remote_ip \n current_user.current_sign_in_ip = request.remote_ip \n current_user.save\n @@logingIn=0\n redirect_to root_path, :notice => \"Logged in successfully\"\n else\n @@logingIn=0\n redirect_to root_path, :notice => \"Sorry! You need to register first \"\n\n end\n\n\nend",
"def authenticate_user!\n \tif user_signed_in?\n \t super\n else\n redirect_to new_user_session_path, notice: 'Debes iniciar sesión'\n end\n end",
"def sign_in\n trait\n end",
"def skip_pundit?\n devise_controller?\n end",
"def sign_in\n\tend",
"def authenticate_name\n super\n end",
"def active_for_authentication?\n super\n end",
"def login_attribute\n super\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n # super\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: [:email, :password])\n end",
"def new\n session.delete('devise.omniauth_data')\n super\n end",
"def handle_unverified_request\n\tsign_out\n\tsuper\nend",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:email, :password, :remember_me)\n end\n\n devise_parameter_sanitizer.permit(:sign_up) do |user_params|\n user_params.permit(:email, :password, :password_confirmation)\n end\n end",
"def sign_in_user user\n @request.env[\"devise.mapping\"] = Devise.mappings[:user]\n sign_in user\n end",
"def after_inactive_sign_up_path_for(resource)\n super(resource)\nend",
"def after_inactive_sign_up_path_for(resource)\n super(resource)\nend",
"def super_user_authentication\n\t\tunless super_user_signed_in?\n\t\t\tflash[:alert] = t(:no_permission_to_access) \n\t\t\tredirect_to super_user_signin_path\n\t\tend\n\tend",
"def resource_class\n devise_mapping.to\n end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def apply_devise_schema(name, type, options={})\n raise NotImplementedError\n end",
"def authenticated_with_devise?(current_resource)\n devise_resource = notification_devise_resource\n unless current_resource.blank? or current_resource.is_a? devise_resource.class\n raise TypeError,\n \"Different type of current resource #{current_resource.class} \"\\\n \"with devise resource #{devise_resource.class} has been passed to #{self.class}##{__method__}. \"\\\n \"You have to override #{self.class}##{__method__} method or set devise_resource in acts_as_target.\"\n end\n current_resource.present? && current_resource == devise_resource\n end",
"def sign_in(*args)\n warden.set_user *args\n end",
"def configure_permitted_parameters\n #devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :first_name, :last_name) }\n if resource_class == User\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :first_name, :last_name) }\n elsif resource_class == Company\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :name, :details) }\n else\n super\n end\n end",
"def authenticate!\n warden.authenticate!\n end",
"def resource_name\n devise_mapping.name\n end",
"def fetchable_fields\n super - [:password, :password_confirmation]\n # if (context[:current_user].guest)\n # super - [:email]\n # else\n # super\n # end\n end",
"def create\n super do\n resource.authentication_token = Devise.friendly_token\n resource.save\n end\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def handle_unverified_request\n \tsign_out\n \tsuper\n end",
"def sign_in\n current_session || sign_user_in\nend",
"def sign_in(resource_or_scope, resource, role_name)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n last_login = resource.last_sign_in_at.strftime(\"%A, %B %d %Y at %I:%M %p.\") unless resource.last_sign_in_at.nil?\n warden.set_user(resource, :scope => scope) \n current_user.update_attribute(:is_signedin, true)\n #create_sessions(role_name,resource)\n set_flash_message :notice,\"Signed in successfully. Your last login was on #{last_login}\"\n end",
"def authenticate_user\n current_user\n end",
"def custom_user_auth\n\t\t\tunless student_signed_in? || admin_signed_in?\n\t\t\t\tredirect_to root_path, notice: \"You have to sign in.\"\n\t\t\tend\n\t\tend",
"def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end",
"def after_sign_up_path_for(resource)\n super(resource)\nend",
"def handle_unverified_request\n sign_out_user\n super\n end",
"def ensure_signed_up!\n # current_user\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password) }\n end",
"def devise_mapping\n @devise_mapping ||= request.env[\"devise.mapping\"]\n end",
"def handle_unverified_request\n super\n sign_out_user\n end",
"def handle_inverified_request\n \tsignout\n \tsuper\n end",
"def handle_unverified_request\n# sign_out\n super\n end",
"def authentication\n raise NotImplementedError\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_in, keys: %i[login username password])\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[username email password password_confirmation])\n devise_parameter_sanitizer.permit(:account_update, keys: %i[username email password password_confirmation])\n end",
"def auth_trap_state\n super\n end",
"def password\n Devise.friendly_token[0, 20]\n end",
"def rails_authenticate\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation, :current_password)\n end\n end",
"def authenticate_scope!\n super\n end",
"def signin\n end",
"def capable_login_auth?; end",
"def current_user\n super\n end",
"def current_user\n super\n end",
"def resource_params\n params.permit(devise_parameter_sanitizer.for(:sign_in))\n end",
"def active_for_authentication?\n super && self.active? # i.e. super && self.active\n end",
"def configure_permitted_parameters\ndevise_parameter_sanitizer.for(:sign_up) do |u|\nu.permit(:email, :password, :password_confirmation,:role)\nend\ndevise_parameter_sanitizer.for(:account_update) do |u|\nu.permit(:email, :password, :password_confirmation, :current_password,:role)\nend\nend",
"def clean_up_passwords(user)\n super unless user.authentications.present?\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end"
] |
[
"0.739315",
"0.6953081",
"0.68864566",
"0.6857896",
"0.6856911",
"0.6697071",
"0.6537552",
"0.6502013",
"0.64766014",
"0.64046663",
"0.6390906",
"0.6355852",
"0.63541466",
"0.6305523",
"0.6305523",
"0.6276121",
"0.6175761",
"0.6147142",
"0.61254966",
"0.612492",
"0.6090527",
"0.60823053",
"0.6078607",
"0.6078607",
"0.6078607",
"0.60333925",
"0.60272545",
"0.5993769",
"0.5993769",
"0.5973199",
"0.5961386",
"0.595865",
"0.5958067",
"0.59488887",
"0.5934096",
"0.5914199",
"0.59117734",
"0.5900788",
"0.58957887",
"0.5893859",
"0.5886583",
"0.5883607",
"0.58699197",
"0.5865108",
"0.5856112",
"0.5856112",
"0.58551335",
"0.58441776",
"0.5840149",
"0.5840149",
"0.58389175",
"0.5838266",
"0.58374316",
"0.5834078",
"0.58336836",
"0.5825638",
"0.5813057",
"0.57988787",
"0.5797355",
"0.5797355",
"0.5797355",
"0.5797355",
"0.5797355",
"0.5797355",
"0.579602",
"0.5786809",
"0.576851",
"0.5765905",
"0.57648337",
"0.575576",
"0.57551134",
"0.5749011",
"0.574494",
"0.5739087",
"0.5736629",
"0.5732132",
"0.5731208",
"0.57182944",
"0.5713604",
"0.5712981",
"0.57112783",
"0.5708041",
"0.56956416",
"0.56933814",
"0.5692887",
"0.5691925",
"0.5689637",
"0.5689637",
"0.5689118",
"0.56859094",
"0.5685092",
"0.5684554",
"0.5683503",
"0.5683503",
"0.5683503",
"0.5683503",
"0.5683503",
"0.5683503",
"0.5683503",
"0.5683503",
"0.5683503"
] |
0.0
|
-1
|
GET /rent_images GET /rent_images.json
|
def index
@rent_images = RentImage.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end",
"def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end",
"def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end",
"def images\n IbmCloudRest.get \"#{@uri}/images\"\n end",
"def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end",
"def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def images\n images = []\n JSON.parse(resource['/offerings/image'].get)[\"images\"].each do |img|\n images << Image.new(img)\n end\n return images\n end",
"def index\n @images = Image.all\n\n render json: @images\n end",
"def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end",
"def retrieveImages\n posting = Posting.find(params[:id])\n post_attachments = posting.post_attachments.all\n respond_to do |format|\n format.json { render json: {\n status: 'ok',\n rowcount: post_attachments.length,\n results: post_attachments.map { |b| {\n id: b.id,\n imageData: b.image,\n description: b.description\n }}\n }}\n end\n end",
"def rover_images(roverName, **parameters)\n uri = URI(\"#{@rover_url}#{roverName}/photos.html\")\n parameters[:api_key] = @api_key\n uri.query = URI.encode_www_form(parameters)\n response = Net::HTTP.get_response(uri)\n\n return [] unless response.is_a?(Net::HTTPSuccess) # if requests fails, returns empty array\n\n JSON.parse(response.body)['photos']\n end",
"def list\n @api.get(\"#{@api.path}/Images\")\n end",
"def index\n @images = @owner.images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end",
"def get_images\n {}\n end",
"def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end",
"def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end",
"def images\n @images ||= Image.find_all_by_listing_id(listing_id, oauth)\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def status_images\n response = JSON.parse(@client.get(\"/api/v1/status-images\").body)\n return response[\"images\"] || response\n end",
"def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def get_img_tags\n @tp = Temp.find_by_id(params[:id])\n @tp.included_images \n render :json => @tp.included_images\n # render :text => @tp.included_images \n end",
"def room_images(request)\n room_images = RoomImage.select(\n :id,\n :pos_x,\n :pos_y,\n :width,\n :height,\n :blob_id\n ).where(escape_room_id: request.escape_room_id)\n\n return GetRoomImagesResponse.new(false, 'Could not get rooms', nil) if room_images.nil?\n\n user = User.find_by_id(EscapeRoom.find_by_id(request.escape_room_id).user_id)\n data = room_images.map do |k|\n blob_url = if (k.blob_id != 0) && !ActiveStorageBlobs.find_by_id(k.blob_id).nil?\n Rails.application.routes.url_helpers.polymorphic_url(\n user.graphic.blobs.find_by_id(k.blob_id), host: ENV.fetch('BLOB_HOST', 'localhost:3000')\n )\n else\n './assets/images/room1.png'\n end\n { room_image: k,\n src: blob_url }\n end\n GetRoomImagesResponse.new(true, 'Room Images Obtained', data)\n rescue StandardError\n GetRoomImagesResponse.new(false, 'Could not get room images', nil)\n end",
"def index\n @web_display_car_images = WebDisplayCarImage.all\n\n render json:@web_display_car_images\n end",
"def index\n @images = Image.all\n respond_with @images\n end",
"def update\n respond_to do |format|\n if @rent.update(rent_params)\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n \n format.html { redirect_to @rent, notice: 'Rent was successfully updated.' }\n format.json { render :show, status: :ok, location: @rent }\n else\n format.html { render :edit }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n render json:@web_display_car_image\n end",
"def images\n @assets = filtered_assets.where(type: \"Image\").order(\"created_at DESC\").paginate(params)\n @assets = @assets.search(params[:q], fuzzy: true) if params[:q].present?\n respond_to do |format|\n format.html do\n render template: \"/dash/chooser/images\"\n end\n format.js do\n render template: \"/dash/chooser/images_search\"\n end\n end\n end",
"def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end",
"def get_all_images(env)\n images_json = get(env, \"#{@session.endpoints[:image]}/images\")\n images = JSON.parse(images_json)['images']\n\n return images if images.empty?\n\n is_v1 = false\n unless images[0].key? 'visibility'\n is_v1 = true\n images_json = get(env, \"#{@session.endpoints[:image]}/images/detail\")\n images = JSON.parse(images_json)['images']\n end\n\n images.map do |i|\n i['visibility'] = i['is_public'] ? 'public' : 'private' if is_v1\n Image.new(i['id'], i['name'], i['visibility'], i['size'], i['min_ram'], i['min_disk'])\n end\n end",
"def images\n if @group.is_member?(@user)\n @images = @group.uploads.images.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n else\n @images = @group.uploads.images.public.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n end\n respond_to do |format|\n format.js { render :json => basic_uploads_json(@images) }\n end\n end",
"def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend",
"def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end",
"def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end",
"def index\n @images = @owner.images\n end",
"def images\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def list_images\n if params[:page].to_s.to_i > 1000\n render(\n status: :too_many_requests,\n content_type: \"text/plain\",\n plain: \"Your queries are killing our server. \" \\\n \"There are much better ways to scrape the images \" \\\n \"from our site. \" \\\n \"Please contact the webmaster.\" \\\n \"And please stop hammering our server!\"\n )\n return\n end\n\n query = create_query(:Image, :all, by: :created_at)\n show_selected_images(query)\n end",
"def images(artist, options={})\n get(:standard, {:method => \"artist.getImages\", :artist => artist}.merge(options))\n end",
"def search_for_images\n request = {\n :RequestHeader => { :Token => @authenticator.token},\n :SearchForImages2RequestBody => {\n :Query => { :SearchPhrase => @search_query},\n :ResultOptions => {\n :ItemCount => @max_num_images,\n :EditorialSortOrder => 'MostPopular'\n },\n :Filter => {\n :ImageFamilies => [\"editorial\"],\n :GraphicStyles => [\"Photography\"]\n }\n }\n }\n response = post_json(request)\n if response[\"ResponseHeader\"][\"Status\"]\n response[\"SearchForImagesResult\"][\"Images\"]\n else\n raise \"No images returned #{response['ResponseHeader']['Status']}\"\n end\n end",
"def index\n @img_lists = ImgList.all\n render json: @img_lists\n end",
"def index\n @recipe_images = RecipeImage.all\n end",
"def show\n @review_image = ReviewImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review_image }\n end\n end",
"def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end",
"def images\n TheWalters::ArtObject.get_images(self.ObjectID)\n end",
"def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end",
"def show\n @rental = Rental.find(params[:id])\n @json = @rental.to_gmaps4rails\n @images = @rental.photos\n @message = Message.new\n\n @rentals = Rental.scoped.limit(4).order(\"RANDOM()\")\n\n add_breadcrumb \"#{@rental.destination.name}\", destination_path(@rental.destination)\n add_breadcrumb \"Vacation Rentals\", rentals_path\n\n add_breadcrumb \"#{@rental.name}\", rental_path\n\n #@photo = @rental.photos.build\n @photos = Photo.scoped(:conditions => [ 'rental_id = ?', @rental.id ] )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rental }\n end\n end",
"def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end",
"def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @images = @user.images.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end",
"def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @article, methods: [:image_url] }\n end\n end",
"def create\n @rent = Rent.new(rent_params)\n @rentpar = rent_params\n respond_to do |format|\n if @rent.save\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n\n format.html { redirect_to @rent, notice: 'Rent was successfully created.' }\n format.json { render :show, status: :created, location: @rent }\n else\n format.html { render :new }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def images\n []\n end",
"def _state_photos(state_id)\n get('state/photos', state_id, options: { type: :array })\n end",
"def product_images\n user_id, product = params[:user_id], params[:id]\n return bad_request if !user_id || !product\n # returns all images for a given user and product\n images = UserProduct.find_images(user_id, product)\n # create json array\n img = images ? images.collect { |i| i.js_serialize } : []\n render :json => img\n end",
"def show\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate_agent_image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def index\n\n per_page = 10\n \n # Total number of images\n @total_num_of_images = Image.all.length\n \n @server_info = request.host_with_port\n \n # Params => Search\n @images = _index_1_search_text(per_page)\n \n @contentArray = _index_get_log()\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end",
"def set_rent_image\n @rent_image = RentImage.find(params[:id])\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n render json: Picture.all\n end",
"def index\n @market_segment_images = @market_segment_imageable.market_segment_images\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def grab_the_images\n get_the_url = RestClient.get(@url)\n doc = Nokogiri::HTML(get_the_url)\n images = doc.search('img').map{ |img| img['src'] }\n images\n end",
"def pet_image_index\n\n @pet_id = params[:pet_id]\n @images = PetImageRepo.pet_images(@pet_id)\n end",
"def images()\n\t\treturn Images.new(@credentials.client_key, @credentials.get_access_token)\n\tend",
"def show\n @image = ImagePost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end"
] |
[
"0.747183",
"0.73400784",
"0.7327491",
"0.72308004",
"0.716566",
"0.7116451",
"0.7109326",
"0.7036103",
"0.70052963",
"0.7003318",
"0.6969881",
"0.6957036",
"0.6905841",
"0.6882117",
"0.68696594",
"0.685551",
"0.6818415",
"0.6799595",
"0.675445",
"0.6732359",
"0.6704539",
"0.66933244",
"0.66897726",
"0.668743",
"0.66469705",
"0.6638508",
"0.6626414",
"0.6616872",
"0.6615714",
"0.6610029",
"0.65996546",
"0.6596932",
"0.6596932",
"0.6594868",
"0.6587996",
"0.6587638",
"0.65846217",
"0.6579265",
"0.65759355",
"0.6572554",
"0.6572153",
"0.65716124",
"0.65604794",
"0.65547276",
"0.6535453",
"0.6534709",
"0.65325975",
"0.6525951",
"0.65233535",
"0.6517203",
"0.65033",
"0.64984643",
"0.649523",
"0.6491965",
"0.64830047",
"0.64661837",
"0.6466066",
"0.6462729",
"0.6457788",
"0.6437517",
"0.643058",
"0.6427308",
"0.64179194",
"0.6411546",
"0.6396773",
"0.6396679",
"0.6393347",
"0.6392292",
"0.6387334",
"0.6387334",
"0.6387334",
"0.6387334",
"0.6379218",
"0.6351132",
"0.63448155",
"0.6344379",
"0.6344024",
"0.6343662",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63436437",
"0.63401365",
"0.6332949",
"0.63314974",
"0.6327082",
"0.6321793",
"0.6318666",
"0.63108134"
] |
0.7560634
|
0
|
GET /rent_images/1 GET /rent_images/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @rent_images = RentImage.all\n end",
"def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end",
"def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end",
"def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end",
"def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end",
"def index\n @images = Image.all\n\n render json: @images\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end",
"def images\n IbmCloudRest.get \"#{@uri}/images\"\n end",
"def show\n @image = Image.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @review_image = ReviewImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review_image }\n end\n end",
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def retrieveImages\n posting = Posting.find(params[:id])\n post_attachments = posting.post_attachments.all\n respond_to do |format|\n format.json { render json: {\n status: 'ok',\n rowcount: post_attachments.length,\n results: post_attachments.map { |b| {\n id: b.id,\n imageData: b.image,\n description: b.description\n }}\n }}\n end\n end",
"def images\n images = []\n JSON.parse(resource['/offerings/image'].get)[\"images\"].each do |img|\n images << Image.new(img)\n end\n return images\n end",
"def index\n @images = @owner.images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end",
"def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end",
"def update\n respond_to do |format|\n if @rent.update(rent_params)\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n \n format.html { redirect_to @rent, notice: 'Rent was successfully updated.' }\n format.json { render :show, status: :ok, location: @rent }\n else\n format.html { render :edit }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rover_images(roverName, **parameters)\n uri = URI(\"#{@rover_url}#{roverName}/photos.html\")\n parameters[:api_key] = @api_key\n uri.query = URI.encode_www_form(parameters)\n response = Net::HTTP.get_response(uri)\n\n return [] unless response.is_a?(Net::HTTPSuccess) # if requests fails, returns empty array\n\n JSON.parse(response.body)['photos']\n end",
"def list\n @api.get(\"#{@api.path}/Images\")\n end",
"def show\n render json:@web_display_car_image\n end",
"def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end",
"def set_rent_image\n @rent_image = RentImage.find(params[:id])\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def show\n @image_url = ImageUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_url }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = ImagePost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end",
"def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end",
"def show\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate_agent_image }\n end\n end",
"def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagem }\n end\n end",
"def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def show\n @motivational_image = MotivationalImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivational_image }\n end\n end",
"def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end",
"def show\n # proxy to GET /roi/id\n @result = ImageServer.get('/roi/'+params[:id]);\n render :json => @result\n end",
"def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end",
"def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end",
"def index\n @recipe_images = RecipeImage.all\n end",
"def show\n @combined_image = CombinedImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @combined_image }\n end\n end",
"def image\n\t\t@image ||= Image.joins(:album)\n .where(id: params[:id], :albums => {:user_id => user_id})\n .take || halt(404)\n\tend",
"def get_img_tags\n @tp = Temp.find_by_id(params[:id])\n @tp.included_images \n render :json => @tp.included_images\n # render :text => @tp.included_images \n end",
"def index\n @images = @owner.images\n end",
"def get_images\n {}\n end",
"def show\r\n @car_image = CarImage.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @car_image }\r\n end\r\n end",
"def index\n @web_display_car_images = WebDisplayCarImage.all\n\n render json:@web_display_car_images\n end",
"def status_images\n response = JSON.parse(@client.get(\"/api/v1/status-images\").body)\n return response[\"images\"] || response\n end",
"def show\n @entry = Entry.find(params[:id])\n hash = {:folder_index => 7, :entry_path => 1}\n @index_count = @entry.getImgCount(hash)\n\n hash.delete(\"entry_path\")\n hash[:count] = 5;\n @image_array = @entry.getRndImgFromDir(hash)\n @image_name = @entry.image.split(\"/\").last().split(\"_\").last().split(\".\").first()\n img = @entry.image\n #@image_name = img[img.rindex('/')+1, img.length][img.rindex('_'), img.length]\n #.split(\".\")[0]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end",
"def show\n @image_datum = ImageDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_datum }\n end\n end",
"def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @article, methods: [:image_url] }\n end\n end",
"def get_all_images(env)\n images_json = get(env, \"#{@session.endpoints[:image]}/images\")\n images = JSON.parse(images_json)['images']\n\n return images if images.empty?\n\n is_v1 = false\n unless images[0].key? 'visibility'\n is_v1 = true\n images_json = get(env, \"#{@session.endpoints[:image]}/images/detail\")\n images = JSON.parse(images_json)['images']\n end\n\n images.map do |i|\n i['visibility'] = i['is_public'] ? 'public' : 'private' if is_v1\n Image.new(i['id'], i['name'], i['visibility'], i['size'], i['min_ram'], i['min_disk'])\n end\n end",
"def show\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n @images = Image.all\n respond_with @images\n end",
"def show\n @image = @account.images.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def index\n @img_lists = ImgList.all\n render json: @img_lists\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n @previous = @image.previous_image\n @next = @image.next_image\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end",
"def pet_image_index\n\n @pet_id = params[:pet_id]\n @images = PetImageRepo.pet_images(@pet_id)\n end",
"def images\n @assets = filtered_assets.where(type: \"Image\").order(\"created_at DESC\").paginate(params)\n @assets = @assets.search(params[:q], fuzzy: true) if params[:q].present?\n respond_to do |format|\n format.html do\n render template: \"/dash/chooser/images\"\n end\n format.js do\n render template: \"/dash/chooser/images_search\"\n end\n end\n end",
"def show\n @rental = Rental.find(params[:id])\n @json = @rental.to_gmaps4rails\n @images = @rental.photos\n @message = Message.new\n\n @rentals = Rental.scoped.limit(4).order(\"RANDOM()\")\n\n add_breadcrumb \"#{@rental.destination.name}\", destination_path(@rental.destination)\n add_breadcrumb \"Vacation Rentals\", rentals_path\n\n add_breadcrumb \"#{@rental.name}\", rental_path\n\n #@photo = @rental.photos.build\n @photos = Photo.scoped(:conditions => [ 'rental_id = ?', @rental.id ] )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rental }\n end\n end",
"def images\n @images ||= Image.find_all_by_listing_id(listing_id, oauth)\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def images\n end",
"def show\n @garment_image = GarmentImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @garment_image }\n end\n end",
"def create\n @rent = Rent.new(rent_params)\n @rentpar = rent_params\n respond_to do |format|\n if @rent.save\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n\n format.html { redirect_to @rent, notice: 'Rent was successfully created.' }\n format.json { render :show, status: :created, location: @rent }\n else\n format.html { render :new }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_images\n @specification = Specification.where(florist_id: session[\"found_florist_id\"]).where(id: params[\"specification_id\"]).first \n render(:images) and return\n end",
"def image\n response[\"image\"]\n end",
"def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end",
"def search_for_images\n request = {\n :RequestHeader => { :Token => @authenticator.token},\n :SearchForImages2RequestBody => {\n :Query => { :SearchPhrase => @search_query},\n :ResultOptions => {\n :ItemCount => @max_num_images,\n :EditorialSortOrder => 'MostPopular'\n },\n :Filter => {\n :ImageFamilies => [\"editorial\"],\n :GraphicStyles => [\"Photography\"]\n }\n }\n }\n response = post_json(request)\n if response[\"ResponseHeader\"][\"Status\"]\n response[\"SearchForImagesResult\"][\"Images\"]\n else\n raise \"No images returned #{response['ResponseHeader']['Status']}\"\n end\n end",
"def show\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_gallery }\n end\n end",
"def show\n @hotel_pic = HotelPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotel_pic }\n end\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end",
"def index\n @images = Image.all\n end"
] |
[
"0.7404441",
"0.72153795",
"0.70960164",
"0.70257413",
"0.70108265",
"0.70108265",
"0.69930077",
"0.69541675",
"0.6943511",
"0.6939472",
"0.6924728",
"0.6915424",
"0.6830568",
"0.6829322",
"0.6809298",
"0.6808921",
"0.67889327",
"0.6783966",
"0.6783966",
"0.6783966",
"0.6783966",
"0.6766642",
"0.6744644",
"0.6720236",
"0.669061",
"0.66816115",
"0.66736215",
"0.6673579",
"0.6669566",
"0.665688",
"0.66291964",
"0.66243637",
"0.66234505",
"0.6622041",
"0.66219825",
"0.6621571",
"0.6618847",
"0.66187114",
"0.66172725",
"0.6608133",
"0.6585265",
"0.6559242",
"0.654762",
"0.65269876",
"0.65229994",
"0.6519305",
"0.65181977",
"0.65078163",
"0.64939475",
"0.64871323",
"0.6483796",
"0.64831024",
"0.6481637",
"0.6476176",
"0.6475321",
"0.6474697",
"0.64745396",
"0.64708394",
"0.645719",
"0.64564824",
"0.64534146",
"0.64492923",
"0.64435685",
"0.6442586",
"0.64385235",
"0.64306164",
"0.6430154",
"0.6414101",
"0.64137375",
"0.6412368",
"0.6412368",
"0.64107054",
"0.6406244",
"0.64038235",
"0.6401122",
"0.6399356",
"0.63688815",
"0.6368454",
"0.6366599",
"0.63663304",
"0.63615066",
"0.63613135",
"0.6357896",
"0.6354633",
"0.6350542",
"0.6345108",
"0.634157",
"0.6333218",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139",
"0.6333139"
] |
0.0
|
-1
|
POST /rent_images POST /rent_images.json
|
def create
@rent_image = RentImage.new(rent_image_params)
respond_to do |format|
if @rent_image.save
format.html { redirect_to @rent_image, notice: 'Rent image was successfully created.' }
format.json { render :show, status: :created, location: @rent_image }
else
format.html { render :new }
format.json { render json: @rent_image.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @rent = Rent.new(rent_params)\n @rentpar = rent_params\n respond_to do |format|\n if @rent.save\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n\n format.html { redirect_to @rent, notice: 'Rent was successfully created.' }\n format.json { render :show, status: :created, location: @rent }\n else\n format.html { render :new }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rent.update(rent_params)\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n \n format.html { redirect_to @rent, notice: 'Rent was successfully updated.' }\n format.json { render :show, status: :ok, location: @rent }\n else\n format.html { render :edit }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@rental = Rental.new(params[:rental])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n @rental = Rental.new(rental_data)\n\n respond_to do |format|\n if @rental.save\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully created.' }\n format.json { render json: @rental, status: :created, location: @rental }\n else\n @object_new = Photo.new\n format.html { render action: \"new\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end",
"def create\n @apartment = current_user.apartments.new(apartment_params)\n\n respond_to do |format|\n if @apartment.save\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n @apartment.pictures.create(image: image)\n }\n end\n format.html { redirect_to @apartment, notice: 'Propiedad creada correctamente.' }\n format.json { render :show, status: :created, location: @apartment }\n else\n format.html { render :new }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rent_image_params\n params.fetch(:rent_image, {})\n end",
"def create\n\n post = Post.new(post_params)\n post.location = Location.create(name: params[:post][:location][:name], lat: params[:post][:location][:lat], long: params[:post][:location][:long])\n if post.save\n params[:post][:images].each do |i|\n img = Image.find(i[:id])\n img.update(active: 1, post_id: post.id)\n end\n\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n\n else\n render json: post.errors, status: 404\n end\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.json { render :json => { url: @image.image.url} }\n else\n \n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n\n if @post.save && params[:images]\n params[:images].each { |image|\n @post.images.create(image: image)\n }\n end\n\n redirect_to @post\n end",
"def create\n image = Image.create(image_params)\n\n if image.new_record?\n render json: { errors: image.errors.messages }, status: 422\n else\n render json: image, status: 201\n end\n end",
"def create\n @results = []\n\n unless params[:files].nil?\n params[:files].each do |data|\n img = Image.new\n img.filename = data.original_filename\n img.data = data.read\n img.upload_id = params[:uuid]\n img.visitation_form_id = params[:formId]\n img.image_type = params[:imageType]\n img.content_type = data.content_type\n #img.temp_index = params[:birdIndex]\n img.bird_id = params[:birdId]\n\n if !img.save\n render :json => { :errors => img.errors.full_messages }, :status => 400 and return\n else\n @results << { name: img.filename, imageType: img.image_type, id: img.id }\n end\n end\n end\n\n render json: { files: @results }\n end",
"def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end",
"def create\n @truck = Truck.new(truck_params)\n\n if @truck.images.count>0\n @truck.images.attach(params[:truck][:images])\n end\n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload_img\n result = RestaurantManage.upload_img(@restaurant, params[:qqfile], request.body.read)\n get_restaurant()\n render json: result\n end",
"def create\n @rent_post = RentPost.new(rent_post_params)\n # @post_attachment = @rent_post.post_attachments.build\n\n respond_to do |format|\n if @rent_post.save\n if params[:post_attachments]!=nil\n params[:post_attachments]['image'].each do |a|\n @post_attachment = @rent_post.post_attachments.create!(:image => a, :rent_post_id => @rent_post.id)\n end\n else\n @post_attachment = @rent_post.post_attachments.create!(:image => nil, :rent_post_id => @rent_post.id)\n end\n format.html { redirect_to @rent_post, notice: 'Rent post was successfully created.' }\n format.json { render :show, status: :created, location: @rent_post }\n else\n format.html { render :new }\n format.json { render json: @rent_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend",
"def create \n @image ||= Image.new(image_params)\n if @image.save\n render json: {\"url\" => @image.image_url(:resized), \"success\" => true}\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n @item.images.delete_all\n unless params.require(:item)[:images_id].nil?\n params.require(:item)[:images_id].each do |id|\n image = Image.find_by_id(id)\n (@item.images << image) unless image.nil?\n end\n end\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.json { render json: @image, status: :created, location: [:admin, @image] }\n else\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @rent_images = RentImage.all\n end",
"def set_rent_image\n @rent_image = RentImage.find(params[:id])\n end",
"def create\n @post = Post.new(params[:post])\n @post.user_id = session[:user_id]\n \n respond_to do |format|\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n \n if params[:images]\n counter = 0\n for image in params[:images][\"file_data\"]\n if image != \"\"\n @image = Image.create(:file_data => image, :owner_id => @post.id, :owner_type => 'Post', :filename => image.original_filename, \n :body => params[:images][\"body\"][counter] )\n counter = counter + 1\n end\n end\n end\n \n format.html { redirect_to :controller => \"posts\" }\n format.xml { head :created, :location => post_url(:id => @post) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n if (image!=nil)\n @apartment.pictures.create(image: image)\n \n end\n }\n end\n format.html { redirect_to @apartment, notice: 'La propiedad se actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @review_image = ReviewImage.new(params[:review_image])\n\n respond_to do |format|\n if @review_image.save\n format.html { redirect_to @review_image, notice: 'Review image was successfully created.' }\n format.json { render json: @review_image, status: :created, location: @review_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n flash[:notice] = 'Image Created' if @owner.images << @image\n respond_with @owner, @image\n end",
"def create\n @smartphone = Smartphone.new(smartphone_params)\n\n respond_to do |format|\n if @smartphone.save\n if params[:images]\n params[:images].each do |val|\n @smartphone.pictures.create(image: val)\n end\n end\n\n format.html { redirect_to @smartphone, notice: 'Smartphone was successfully created.' }\n format.json { render :show, status: :created, location: @smartphone }\n else\n format.html { render :new }\n format.json { render json: @smartphone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @experience = Experience.new(experience_params)\n @experience.trip_id = @trip.id\n @experience.nomad_id = current_nomad.id\n\nif @experience.save\n\n if params[:images] \n params[:images].each do |image|\n @experience.photos.create(image: image)\n end\n end\n\n @photos = @experience.photos\n redirect_to edit_trip_experience_path(@trip, @experience), notice: \"Saved...\"\n else\n render :new\n end\n end",
"def create\n @image = Spree::Image.new(params[:image])\n\n respond_to do |format|\n if @upload.save\n format.html {\n render :json => [@image.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@image.to_jq_upload]}, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to aquarium_images_url, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gallery = find_gallery\n @gallery.save! unless @gallery.persisted?\n @image = Image.new params[:image]\n @image.image_gallery_id = @gallery.id\n @images = @gallery.images\n \n respond_to do |format|\n if @image.save \n format.js\n format.json { render json: @image, status: :created, location: @image }\n else\n format.js\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n # fetch tags from google vision API\n helpers.fetch_tags(image_params)\n\n @image.image_file.attach(image_params[:image_file])\n\n respond_to do |format|\n if @image.save()\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n @note.user = current_user\n\n respond_to do |format|\n if @note.save\n if params[:images]\n @note.image = params[:images].first\n @note.save!\n note_image_params.each do |ima|\n @note_image = NoteImage.new()\n @note_image.image = ima\n @note_image.note_id = @note.id\n @note_image.save!\n end\n # raise \"#{@note.to_json} #{@note.note_images.to_json}\"\n end\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end",
"def uploader\n @doctor = Doctor.find(params[:id])\n image = @doctor.create_image(file: params[:image])\n if image.present?\n render json: {doctor: image.file},status: 200\n else\n render json: {errors: @doctor}, status: 422\n end\n\n end",
"def add_image\n obtain_product_image_params\n pi = ProductImage.new(picture: @image_params)\n @product.product_images << pi\n render json: @product.simple_info, status: :ok\n rescue => e\n render json: { error: e }, status: :bad_request\n end",
"def create\n @imageable = find_imageable\n @image = @imageable.images.build(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: t('.notice', image: @image) }\n format.json\n else\n format.html { render :new }\n format.json {\n render json: @image.errors[:attachment], status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n @car = Car.new(car_params)\n\n respond_to do |format|\n if @car.save\n params[:photos]['image'].each do |p|\n @photo = @car.photos.create!(:image => p, :car_id => @car.id)\n end\n format.html { redirect_to @car, notice: 'Car was successfully added.' }\n format.json { render :show, status: :created, location: @car }\n else\n format.html { render :new }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @post = Post.new\n 2.times { @post.post_images.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def postEntityImage( entity_id, filedata, image_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['filedata'] = filedata\n params['image_name'] = image_name\n return doCurl(\"post\",\"/entity/image\",params)\n end",
"def update\n respond_to do |format|\n if @tour.update(tour_params)\n\n if params[:images]\n params[:images].each { |image|\n @tour.tour_days.create(images: image)\n }\n end\n\n format.html { redirect_to @tour, notice: 'Tour was successfully updated.' }\n format.json { render :show, status: :ok, location: @tour }\n else\n format.html { render :edit }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @add_image_to_review = AddImageToReview.new(add_image_to_review_params)\n\n respond_to do |format|\n if @add_image_to_review.save\n format.html { redirect_to @add_image_to_review, notice: 'Add image to review was successfully created.' }\n format.json { render :show, status: :created, location: @add_image_to_review }\n else\n format.html { render :new }\n format.json { render json: @add_image_to_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @salon_image = @salon.salon_images.new(salon_image_params)\n\n respond_to do |format|\n if @salon_image.save\n format.html { redirect_to salon_salon_image_path(@salon, @salon_image), notice: 'Salon image was successfully created.' }\n format.json { render :show, status: :created, location: @salon_image }\n else\n format.html { render :new }\n format.json { render json: @salon_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end",
"def add_images\n\t\tif @current_user.present?\n\t\t\t@property = Property.find(params[:property_id])\n\t\t\tif @property.present?\n\t\t\t\t# if @property.images.present?\n\t\t\t\t# \t@property.images.destroy_all\n\t\t\t\t# end\n\t\t\t\tparams[:images].each { |image|\n\t i = @property.images.create(image: image)\n\t if i.save\n\t else\n\t \trender_json({\"status\" => \"Fail\", \"message\" => i.errors.full_messages.first}.to_json)\n\t \treturn\n\t end\n\t }\n\t @property.images.first.update_attributes(is_starred: true)\n\t render :file => 'api/v1/property/add_image'\n\t else\n\t \trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n\t end\n\t\tend\n\tend",
"def create\n @guardario = Guardario.new(guardario_params)\n @guardario.user_id = current_user.id\n\n respond_to do |format|\n if @guardario.save\n if params[:images]\n params[:images].each { |image|\n GuardarioImage.create(image: image, guardario_id: @guardario.id)\n }\n end\n format.html { redirect_to @guardario, notice: 'O seu avistamento foi reportado com sucesso.' }\n format.json { render :show, status: :created, location: @guardario }\n else\n format.html { render :new }\n format.json { render json: @guardario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_img = PostImg.new(post_img_params)\n\n respond_to do |format|\n if @post_img.save\n format.html { redirect_to @post_img, notice: 'Post img was successfully created.' }\n format.json { render :show, status: :created, location: @post_img }\n else\n format.html { render :new }\n format.json { render json: @post_img.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restaurant_image\n if !check_step_info(@restaurant)\n return\n end\n\n render json: {:success => true, :attachmentPartial => render_to_string('restaurant_manage/restaurant_image', :layout => false ) }\n end",
"def create\n request_image = params[:image]\n url_hash = SecureRandom.urlsafe_base64(6)\n name = url_hash + \"-\" + request_image.original_filename.downcase\n\n File.open(\"#{Rails.root}/public/theta/#{name}\", 'wb') do |f|\n f.write(request_image.read)\n end\n\n theta = Theta.create!(url_hash: url_hash, image_url: name)\n render json: {url: \"http://www.rakugaki.tk/h/#{theta.url_hash}\"}, status: 201\n end",
"def add_images\n @parent = get_parent(params[:parent_id])\n\n #Images to Add\n if(!@parent.images.nil?)\n @parent.images.clear\n end\n if(!params[:Image_ids].nil?)\n for id in params[:Image_ids]\n @parent.images.push(Image.find(id))\n end\n end\n respond_to do |format|\n if @parent.save\n #Uses a session variable for reloading the current page assigned to the variable\n format.html { redirect_to session[:rq], notice: 'Image(s) successfully added.' }\n format.json { render json: @parent, status: :created, location: @parent }\n else\n format.html { render action: \"\" }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @imovel = Imovel.new\n @imovel.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imovel }\n end\n end",
"def create\n # @taxi_photo = TaxiPhoto.new(taxi_photo_params)\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @tour_photo = TourPhoto.new(image:image)\n @tour_photo.save\n }\n \n end\n redirect_to \"/tour_photos/gallery\"\n end",
"def create\n @image = Image.new(params[:image])\n type = @image.url_type\n #response.headers[\"Content-type\"] = \"text/plain\"\n if @image.save\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else \n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n end\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n flash[:notice] = 'Image was successfully created.'\n format.html { redirect_to(@image) }\n format.json { render :json => @image, :status => :created, :location => @image }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @gallery = find_gallery\n @gallery.save! unless @gallery.persisted?\n @image = Image.new image_params\n @image.image_gallery_id = @gallery.id\n\n respond_to do |format|\n if @image.save\n format.js\n format.json { render json: @image, status: :created, location: @image }\n else\n format.js\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commission = Commission.new(commission_params)\n respond_to do |format|\n if @commission.save\n if params[:commission_images]\n params[:commission_images].each { |commission_image| @commission.commission_images.create(path: commission_image) }\n end\n format.html { redirect_to @commission, notice: 'Commission was successfully created.' }\n format.json { render :show, status: :created, location: @commission }\n else\n format.html { render :new }\n format.json { render json: @commission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_remote\n img = {}\n data = {}\n if params[:data].present?\n data = JSON.parse(params[:data]).symbolize_keys\n img = data[:image].symbolize_keys\n else\n img = params[:image]\n end\n model = @imageable.class\n former_image = @imageable.respond_to?(:images) ? nil : @imageable.image\n kind = img[:kind]\n kind = model::IMAGE_KINDS.keys.first if kind.blank? && model.const_defined?(:IMAGE_KINDS)\n image = Image.new(imageable: @imageable, kind: kind, legend: img[:legend].to_s, zoomable: (img[:zoomable].present? ? img[:zoomable] : true))\n if Figaro.env.s3_enabled.to_bool\n # Special field for carrierwave_direct's business\n image.img.key = data[:key]\n end\n if request.xhr?\n if image.save_and_process!\n former_image.try :destroy if former_image\n #image[:url] = image.img.url\n return render(json: image, status: :ok)\n end\n Rails.logger.error \"[Image Creation Error #{Time.zone.now.xmlschema}] #{image.errors.full_messages}\"\n errors = image.errors[:img]\n render json: [{ error: errors }], status: :error\n else\n if image.save_and_process!\n former_image.try :destroy if former_image\n #image[:url] = image.img.url\n if Figaro.env.s3_enabled.to_bool && Figaro.env.js_upload_enabled.to_bool && Figaro.env.js_s3_iframe_enabled.to_bool\n return render(nothing: true)\n end\n return redirect_to({ action: :assist, id: image })\n end\n Rails.logger.error \"[Image Creation Error #{Time.zone.now.xmlschema}] #{image.errors.full_messages}\"\n redirect_to parent_url, alert: \"L’image n’a pas pu être créée\"\n end\n end",
"def image_cover_save\n result = RestaurantManage.image_cover_save(@restaurant, params[:cover_id])\n get_restaurant()\n render json: result\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def retrieveImages\n posting = Posting.find(params[:id])\n post_attachments = posting.post_attachments.all\n respond_to do |format|\n format.json { render json: {\n status: 'ok',\n rowcount: post_attachments.length,\n results: post_attachments.map { |b| {\n id: b.id,\n imageData: b.image,\n description: b.description\n }}\n }}\n end\n end",
"def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def images\n end",
"def create\n @document = Document.new(document_params)\n # @document.images.attach(params[:document][:images])\n respond_to do |format|\n if @document.save\n @records = Document.all.with_attached_images\n\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @icesled = Icesled.new(icesled_params)\n @icesled.manufacturer_id ||= Manufacturer.where(name: 'не указан', category: 'icesled').first_or_create.id\n respond_to do |format|\n if @icesled.save\n if params[:images]\n @icesled.gallery ||= Gallery.new\n params[:images].each do |image|\n @icesled.gallery.images.create(image: image)\n end\n unless @icesled.image_file_size\n @icesled.update(image: @icesled.gallery.images.first.image)\n end\n end\n format.html { redirect_to @icesled, notice: 'Icesled was successfully created.' }\n format.json { render :show, status: :created, location: @icesled }\n else\n format.html { render :new }\n format.json { render json: @icesled.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(params[:image])\n @image.account_id = @oeaccount.id\n respond_to do |format|\n if @image.save\n format.html { redirect_to images_url, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spot = Spot.new(spot_params)\n\n respond_to do |format|\n if @spot.save\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n format.html { redirect_to [@country,@spot], notice: \"Spot was successfully created.\" }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @spot = Spot.new(spot_params)\n\n respond_to do |format|\n if @spot.save\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n format.html { redirect_to [@country,@spot], notice: \"Spot was successfully created.\" }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @raw_image = RawImage.new(raw_image_params)\n @raw_image.save\n \n redirect_to admin_raw_images_path\n #respond_to do |format|\n # if @raw_image.save\n # format.html { redirect_to @raw_image, notice: 'Raw image was successfully created.' }\n # format.json { render :show, status: :created, location: @raw_image }\n # else\n # format.html { render :new }\n # format.json { render json: @raw_image.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def create\n respond_to do |format|\n @pix.images.attach(params[:images]) if params[:images]\n if @pix.save\n format.html do\n redirect_to go_to_pix(@pix),\n flash: { success: 'Pix was successfully saved.' }\n end\n format.json { render :show, status: :created, location: @pix }\n else\n format.html { render :new }\n format.json { render json: @pix.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @driver = Driver.new(driver_params)\n\n if @driver.images.count>0\n @driver.images.attach(params[:driver][:images])\n end\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render :show, status: :created, location: @driver }\n else\n format.html { render :new }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_images\n @specification = Specification.where(florist_id: session[\"found_florist_id\"]).where(id: params[\"specification_id\"]).first \n render(:images) and return\n end",
"def create\n add_more_images(image_params[:thing_images])\n flash[:error] = \"Failed uploading images\" unless @thing.save\n redirect_to :back\n end",
"def postEntityImageBy_url( entity_id, image_url, image_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['image_url'] = image_url\n params['image_name'] = image_name\n return doCurl(\"post\",\"/entity/image/by_url\",params)\n end",
"def create\n @taxi_image = TaxiImage.new(taxi_image_params)\n\n respond_to do |format|\n if @taxi_image.save\n format.html { redirect_to @taxi_image, notice: 'Taxi image was successfully created.' }\n format.json { render :show, status: :created, location: @taxi_image }\n else\n format.html { render :new }\n format.json { render json: @taxi_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@experience_image = ExperienceImage.new(experience_image_params)\n logger.debug \"The params coming in are:#{params.inspect}\"\n @experience_image = ExperienceImage.new(experience_image_params)\n logger.debug \"The file created is: #{@experience_image.inspect}\"\n\n\n respond_to do |format|\n if @experience_image.save\n format.json{ render :json => @experience_image }\n else\n format.json { render json: @experience_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = @owner.images.build(params[:image])\n\n respond_to do |format|\n if @image.save\n flash[:success] = 'Image was successfully created.'\n format.html { redirect_to([:admin, @parents, :images]) }\n format.xml { render :xml => @image, :status => :created, :location => @image }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end",
"def create\n @gallery = Gallery.new(gallery_params)\n\n respond_to do |format|\n if @gallery.save\n if params[:images]\n params[:images].each { |image|\n pic = @gallery.pics.create(image: image)\n data = Cloudinary::Uploader.upload(image,@auth)\n pic.public_id = data['secure_url']\n pic.image_file_size = data['bytes']\n pic.save\n }\n end\n\n format.html { redirect_to @gallery, notice: 'Gallery was successfully created.' }\n format.json { render json: @gallery, status: :created, location: @gallery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gallery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n if @post.save\n # write out the address in the console\n puts @post.image\n render json: { image_url: @post.image }, status: 200\n else\n logger.info @post.errors.full_messages\n render json: { error: @post.errors.full_messages }, status: :not_acceptable\n end\n end",
"def create\n @image = Image.new(image_params)\n @image.name = params[:image][:picture].original_filename\n @image.picture = params[:image][:picture].read\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to images_path, success: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: images_path }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @postimage = Postimage.new(postimage_params)\n\n respond_to do |format|\n if @postimage.save\n format.html { redirect_to @postimage, notice: 'Postimage was successfully created.' }\n format.json { render :show, status: :created, location: @postimage }\n \n else\n format.html { render :new }\n format.json { render json: @postimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@img = ReportImage.new(img_params)\n\n\t\tif @img.save\n\t\t\trender :json => @img\n\t\telse\n\t\t\trender :json => @img.errors\n\t\tend\n\tend",
"def image_params\n params.require(:image).permit(:image, :description, :has_images_type, :has_images_id, :remote_image_url)\n end",
"def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end",
"def upload_image\n image_file = ImageFile.new(params)\n\n delete_image() unless @collection.image.nil?\n\n @image = @collection.build_image({ extension: image_file.extension })\n\n unless @image.save\n render json: @image.errors, status: :unprocessable_entity; return\n end\n\n image_file.name = @image._id\n image_processor = CollectionImageProcessor.new(collection_id, image_file)\n\n if image_processor.save_image\n render json: @collection, status: :ok#, location: @collection\n else\n render json: image_processor.errors, status: :unprocessable_entity\n end\n end",
"def create\n @image = current_user.images.build(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to user_images_path(current_user), notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n @listing.published_at = DateTime.now\n respond_to do |format|\n if @listing.save\n if params[:images]\n @uploaded_images = params[:images]\n @uploaded_images.each { |image, object|\n @listing.pictures.create(image: object)\n }\n end\n @listing.search_tags << @listing.city << @listing.state << @listing.postal_code << @listing.country\n @listing.save\n flash[:notice] = \"new listing\"\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = current_admin.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n\n if params[:pictures]\n #===== The magic is here ;)\n params[:pictures].each { |image|\n @listing.pictures.create(file: image)\n }\n end\n\n format.html { redirect_to admin_listings_url, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n flash[:success] = 'Image was successfully created.'\n format.html { redirect_to new_admin_image_preview_url(image_id: @image.id) }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7920986",
"0.7389348",
"0.6688687",
"0.66749704",
"0.66384786",
"0.6632397",
"0.65949714",
"0.65824157",
"0.652193",
"0.6501194",
"0.6450269",
"0.6432711",
"0.63987696",
"0.6365365",
"0.6342925",
"0.63413274",
"0.63358325",
"0.6332496",
"0.6314013",
"0.6300564",
"0.62921244",
"0.62883294",
"0.62475103",
"0.6223346",
"0.6222322",
"0.62190425",
"0.61951697",
"0.61937493",
"0.61844146",
"0.6172949",
"0.6152437",
"0.61398995",
"0.6130734",
"0.612901",
"0.6125924",
"0.6112462",
"0.6110987",
"0.60986453",
"0.6074553",
"0.60738176",
"0.60718906",
"0.6068368",
"0.6065737",
"0.6058668",
"0.60552615",
"0.6050639",
"0.60413975",
"0.6024067",
"0.6020807",
"0.6019511",
"0.60133725",
"0.60105306",
"0.6006049",
"0.6006049",
"0.6006049",
"0.6006049",
"0.5999295",
"0.599904",
"0.5997836",
"0.5988324",
"0.5979492",
"0.59696656",
"0.59635943",
"0.5959266",
"0.5959266",
"0.5959266",
"0.5959266",
"0.5959266",
"0.59559345",
"0.5954403",
"0.5951549",
"0.5951549",
"0.59505314",
"0.59342986",
"0.59216994",
"0.5918468",
"0.59112316",
"0.59112316",
"0.5893189",
"0.58905864",
"0.58827835",
"0.5881949",
"0.58818775",
"0.58745486",
"0.58738583",
"0.58726066",
"0.587242",
"0.58670187",
"0.58628136",
"0.58609587",
"0.5858482",
"0.5858478",
"0.58522177",
"0.5851825",
"0.5851395",
"0.5850777",
"0.5847835",
"0.5847456",
"0.5840543",
"0.58391064"
] |
0.7184774
|
2
|
PATCH/PUT /rent_images/1 PATCH/PUT /rent_images/1.json
|
def update
respond_to do |format|
if @rent_image.update(rent_image_params)
format.html { redirect_to @rent_image, notice: 'Rent image was successfully updated.' }
format.json { render :show, status: :ok, location: @rent_image }
else
format.html { render :edit }
format.json { render json: @rent_image.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @rent.update(rent_params)\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n \n format.html { redirect_to @rent, notice: 'Rent was successfully updated.' }\n format.json { render :show, status: :ok, location: @rent }\n else\n format.html { render :edit }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rental = Rental.find(params[:id])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n\n respond_to do |format|\n if @rental.update_attributes(rental_data)\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @icesled.update(icesled_params)\n if params[:images]\n @icesled.gallery ||= Gallery.new\n params[:images].each do |image|\n @icesled.gallery.images.create(image: image)\n end\n unless @icesled.image_file_size\n @icesled.update(image: @icesled.gallery.images.first.image)\n end\n end\n format.html { redirect_to @icesled, notice: 'Icesled was successfully updated.' }\n format.json { render :show, status: :ok, location: @icesled }\n else\n format.html { render :edit }\n format.json { render json: @icesled.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, :notice => 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n @item.images.delete_all\n unless params.require(:item)[:images_id].nil?\n params.require(:item)[:images_id].each do |id|\n image = Image.find_by_id(id)\n (@item.images << image) unless image.nil?\n end\n end\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food.build_image(params['image']) do |t|\n if params['food']['image']['data']\n t.data = Base64.encode64(params['food']['image']['data'].read)\n t.filename = params['food']['image']['data'].original_filename\n t.mime_type = params['food']['image']['data'].content_type\n end\n end \n @food.name = @food.name.capitalize\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @review_image = ReviewImage.find(params[:id])\n\n respond_to do |format|\n if @review_image.update_attributes(params[:review_image])\n format.html { redirect_to @review_image, notice: 'Review image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @adoption = Adoption.find(params[:id])\n @races = Race.all\n respond_to do |format|\n if params[:images_attributes]\n if params[:images_attributes]['image'].length <= 10\n if @pet.update(pet_params)\n if params[:images_attributes]\n params[:images_attributes]['image'].each do |a|\n @image_attachment = @pet.images.create!(:picture => a, :name => @pet.name)\n end\n \n format.html { redirect_to admin_pets_path}\n format.json { render :show, status: :ok, location: @pet }\n end\n \n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n else\n flash.now[:danger] = \"El Producto debe tener un máximo de 10 imágenes\"\n # @user = Role.all\n render 'edit'\n end\n else\n if @pet.update(pet_params)\n flash[:success] = \"Producto Actualizado exitosamente\"\n format.html { redirect_to admin_pets_path}\n format.json { render :show, status: :ok, location: @pet }\n else\n flash[:warnig] = \"Producto no Actualizado\"\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_image.update(recipe_image_params)\n format.html { redirect_to @recipe_image, notice: 'Recipe image was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_image }\n else\n format.html { render :edit }\n format.json { render json: @recipe_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n if (image!=nil)\n @apartment.pictures.create(image: image)\n \n end\n }\n end\n format.html { redirect_to @apartment, notice: 'La propiedad se actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update_attributes(image_params)\n flash[:notice] = 'Image was successfully updated.'\n format.html { redirect_to(@image) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @img.update(img_params)\n format.html { redirect_to @img, notice: \"Img was successfully updated.\" }\n format.json { render :show, status: :ok, location: @img }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @img.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to mypictures_path}\n format.json { head :no_content }\n flash[:success] = \"Image updated\"\n\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if image.update(image_params)\n format.html { redirect_to image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: image }\n else\n format.html { render :edit }\n format.json { render json: image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html {redirect_to @image, notice: 'Image was successfully updated.'}\n format.json {render :show, status: :ok, location: @image}\n else\n format.html {render :edit}\n format.json {render json: @image.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_type.update(vehicle_type_params)\n images\n\n format.html { redirect_to @vehicle_type, notice: 'Vehicle type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n type = @image.url_type\n if @image.update_attributes!(params[:image])\n if request.xhr?\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else\n redirect_to console_images_path\n end\n else \n if request.xhr?\n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n else\n redirect_to edit_console_image_path(@image)\n end\n end\n end",
"def update\n respond_to do |format|\n if @smartphone.update(smartphone_params)\n if params[:images]\n params[:images].each do |val|\n temp = @smartphone.pictures.find_by(image_file_name: val.original_filename)\n if temp\n temp.update_attributes(:image => val)\n else\n @smartphone.pictures.create(image: val)\n end\n end\n end\n format.html { redirect_to @smartphone, notice: 'Smartphone was successfully updated.' }\n format.json { render :show, status: :ok, location: @smartphone }\n else\n format.html { render :edit }\n format.json { render json: @smartphone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n if @image.update(image_params)\n render json: {status: \"success\", data: {image:@image}}, status: :ok\n else\n render json: @comment.errors, status: 404\n end\n end",
"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",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to '/galleries/' + params[:galery_id].to_s, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet_image_repo.update(pet_image_repo_params)\n format.html { redirect_to @pet_image_repo, notice: 'Image successfully updated.' }\n format.json { render :show, status: :ok, location: @pet_image_repo }\n else\n format.html { render :edit }\n format.json { render json: @pet_image_repo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taxi_image.update(taxi_image_params)\n format.html { redirect_to @taxi_image, notice: 'Taxi image was successfully updated.' }\n format.json { render :show, status: :ok, location: @taxi_image }\n else\n format.html { render :edit }\n format.json { render json: @taxi_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image.update(image_params)\n redirect_to '/images'\n end",
"def update\n\n params = image_params\n params[\"tags\"] = params[\"tags\"].delete_suffix(',')\n\n respond_to do |format|\n if @image.update(params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @img = Img.find(params[:id])\n\n respond_to do |format|\n if @img.update_attributes(params[:img])\n format.html { redirect_to(@img, :notice => 'Img was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @img.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @apartment.photos.create!(:image => a, :apartment_id => @apartment.id)\n end\n end\n format.html { redirect_to @apartment, notice: 'Apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n if @slider_image.update_attributes(params[:slider_image])\n format.html { redirect_to slider_images_path, notice: 'Slider image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slider_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @image.update(image_params)\r\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @image }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @image.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to [@gallery,@image], notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @product_image.update_attributes(product_image_params)\n render json: @product_image, status: 200\n else\n render_error 400, @product_image.errors.full_messages\n end\n end",
"def update\n respond_to do |format|\n if @animal_image.update(animal_image_params)\n format.html { redirect_to @animal_image, notice: \"Animal image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @animal_image }\n else\n format.html { render :edit }\n format.json { render json: @animal_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = 'Image Successfully updated' if @image.update_attributes! params[:image]\n respond_with @owner, @image\n end",
"def update\n @image = Image.find(params[:id])\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to images_url, notice: 'Image was successfully updated.' }\n format.js {} \n else\n format.html { render action: 'edit' }\n format.js {} \n end\n end\n end",
"def update\n respond_to do |format|\n if @electriccar.update(electriccar_params)\n if params[:images]\n @electriccar.gallery ||= Gallery.new\n params[:images].each do |image|\n @electriccar.gallery.images.create(image: image)\n end\n unless @electriccar.image_file_size\n @electriccar.update(image: @electriccar.gallery.images.first.image)\n end\n end\n format.html { redirect_to @electriccar, notice: 'Electriccar was successfully updated.' }\n format.json { render :show, status: :ok, location: @electriccar }\n else\n format.html { render :edit }\n format.json { render json: @electriccar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @car.update(car_params)\n unless params[:photos].blank?\n params[:photos]['image'].each do |p|\n @photo = @car.photos.create!(:image => p, :car_id => @car.id)\n end\n end\n format.html { redirect_to @car, notice: 'Car was successfully updated.' }\n format.json { render :show, status: :ok, location: @car }\n else\n format.html { render :edit }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n post = Post.find(params[:post][:id])\n post.body = params[:post][:body]\n\n # //location\n post.location.name = params[:post][:location][:name]\n post.location.lat = params[:post][:location][:lat]\n post.location.long = params[:post][:location][:long]\n # images\n for new_img in params[:post][:images]\n flag = 0\n for old_img in post.images\n if old_img.id == new_img[:id]\n flag = 1\n break\n end\n end\n if flag == 0\n img = Image.find new_img[:id]\n img.update_attributes(post_id: post.id, active: 1)\n end\n end\n\n for old_img in post.images\n flag = 0\n for new_img in params[:post][:images]\n if old_img.id == new_img[:id]\n flag = 1\n break\n end\n end\n if flag == 0\n old_img.destroy\n end\n end\n\n if post.save\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n else\n render json: post.errors, status: 404\n end\n\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n flash[:success] = 'Image was successfully updated.'\n format.html { redirect_to([:admin, @parents, :images]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n parms = ski_params\n parms[:color] = parms[:color].split(', ') if parms[:color]\n respond_to do |format|\n if @ski.update(parms)\n if params[:images]\n @ski.gallery ||= Gallery.new\n params[:images].each do |image|\n @ski.gallery.images.create(image: image)\n end\n unless @ski.image_file_size\n @ski.update(image: @ski.gallery.images.first.image)\n end\n end\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { render :show, status: :ok, location: @ski }\n else\n format.html { render :edit }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_photo.update(recipe_photo_params)\n format.html { redirect_to @recipe_photo, notice: 'Recipe photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_photo }\n else\n format.html { render :edit }\n format.json { render json: @recipe_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo1 = Photo1.find(params[:id])\n\n respond_to do |format|\n if @photo1.update_attributes(params[:photo1])\n format.html { redirect_to @photo1, notice: 'Photo1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = ServiceImage.find(params[:id])\n respond_to do |format|\n if @image.update(car_image_params)\n flash[:success] = \"Car Image was successfully updated.\"\n format.html { redirect_to admin_car_car_images_path(@image.car) }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to :back, notice: 'Imagen actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @experience.update(experience_params)\n\n if params[:images] \n params[:images].each do |image|\n @experience.photos.create(image: image)\n end\n end\n\n redirect_to edit_trip_experience_path(@trip,@experience), notice: \"Updated...\"\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @image_file.update(image_file_params)\n format.html { redirect_to @image_file, notice: 'Image file was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_file }\n else\n format.html { render :edit }\n format.json { render json: @image_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n new_images = params[:images]||[]\n\n @intention = Intention.find_by_uuid(params[:id])\n @intention.image_urls = IntentionsHelper.strip_duplicate_images(new_images)\n @intention.save\n\n points = VISBD_INTENTION_IMAGE_POINTS*new_images.count\n track_event(current_action_item(Intention::COMPONENT_TYPE)||current_enrollment, Intention::VISUALIZED_EVENT, target:@intention, points:points)\n\n render nothing: true\n end",
"def set_rent_image\n @rent_image = RentImage.find(params[:id])\n end",
"def update\n @request = Request.find(params[:id])\n\n if params[:images_attributes]\n if @request.update(request_params)\n if params[:images_attributes]\n params[:images_attributes]['image'].each do |a|\n @image_attachment = @request.images.create!(:picture => a, :name => 'RequestApp')\n end\n end\n\n redirect_to action: 'show'\n flash[:success] = \"Su solicitud ha sido editada con exito\"\n else\n render 'edit'\n flash.now[:danger] = \"Revise los siguentes errores\"\n end\n else\n flash.now[:danger] = \"La solicitud requiere de una imagen\"\n render 'edit'\n end\n end",
"def update\n @variant_image = VariantImage.find(params[:id])\n\n respond_to do |format|\n if @variant_image.update_attributes(params[:variant_image])\n format.html { redirect_to @variant_image, notice: 'Variant image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @variant_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @car_image = CarImage.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @car_image.update_attributes(params[:car_image])\r\n format.html { redirect_to @car_image, notice: 'Car image 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: @car_image.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @itemimage.update(itemimage_params)\n format.html { redirect_to @itemimage, notice: 'Itemimage was successfully updated.' }\n format.json { render :show, status: :ok, location: @itemimage }\n else\n format.html { render :edit }\n format.json { render json: @itemimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"index\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_image_to_review.update(add_image_to_review_params)\n format.html { redirect_to @add_image_to_review, notice: 'Add image to review was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_image_to_review }\n else\n format.html { render :edit }\n format.json { render json: @add_image_to_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n if @estate_agent_image.update_attributes(params[:property_image])\n format.html { redirect_to @estate_agent_image, notice: 'Property image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estate_agent_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(photo_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @experience_image.update(experience_image_params)\n format.html { redirect_to @experience_image, notice: 'Experience image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @experience_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @cafe, notice: 'image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @loc_image.update(loc_image_params)\n format.html { redirect_to @loc_image, notice: 'Loc image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @loc_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image_reference.update_attributes image_reference_params\n format.html { redirect_to @image_reference, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_reference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:product][:photos_attributes][:'0'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'0'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'0'][:image])\n end\n if params[:product][:photos_attributes][:'1'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'1'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'1'][:image])\n end\n if params[:product][:photos_attributes][:'2'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'2'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'2'][:image])\n end\n if params[:product][:photos_attributes][:'3'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'3'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'3'][:image])\n end\n if params[:product][:photos_attributes][:'4'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'4'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'4'][:image])\n end\n\n respond_to do |format|\n if @product.update(product_update_params)\n\tformat.html { redirect_to products_url, notice: '产品已审核成功' }\n\tformat.json { render :show, status: :ok, location: @product }\n else\n\tformat.html { render :edit }\n\tformat.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @combined_image = CombinedImage.find(params[:id])\n\n respond_to do |format|\n if @combined_image.update_attributes(params[:combined_image])\n format.html { redirect_to @combined_image, notice: 'Combined image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @combined_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = current_user.photos.find_by_id(params[:id])\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n elsif @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end",
"def update\n images_arr = params[:images]\n params[:list_item].delete(:image)\n @list_item = ListItem.find(params[:id])\n @image = Image.new(images_arr)\n @list_item.images << @image\n\n respond_to do |format|\n if @list_item.update_attributes(params[:list_item])\n format.html { redirect_to user_url(current_user), notice: t('list_items.updated') }\n format.json { render :json => @list_item }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_image\n # wish image can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n @wish.image.purge\n @wish.image.attach(wish_params[:image])\n render json: url_for(@wish.image)\n end\n end",
"def update\n photo_params = params[:photo].clone\n if photo_params[:retakeable]\n photo_params[:retakeable] = %(yes true 1).include?(photo_params[:retakeable].to_s.downcase)\n photo_params[:retakeable] = nil if params[:photo][:retakeable] == 'unknown'\n end\n if photo_params[:accessibility]\n photo_params[:accessibility] = nil if params[:photo][:accessibility] == 'unknown'\n end\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n if @imagem.update_attributes(params[:imagem])\n format.html { redirect_to @imagem, notice: 'Imagem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imagem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n data = snarf_image_data\n if @beverage.update(beverage_params)\n if data\n STDERR.puts \"UPDATING DATA\"\n @beverage.image_data = Base64.encode64(data)\n @beverage.save\n end\n if mid = motor_id_param\n new_motor = Motor.find(mid)\n pp new_motor.id\n pp new_motor.uuid\n @beverage.motor = new_motor if new_motor\n @beverage.save\n end\n\n format.html { redirect_to @beverage, notice: \"Beverage was successfully updated.\" }\n format.json { render :show, status: :ok, location: @beverage }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @beverage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @salon_image.update(salon_image_params)\n format.html { redirect_to salon_salon_image_url(@salon, @salon_image), notice: 'Salon image was successfully updated.' }\n format.json { render :show, status: :ok, location: @salon_image }\n else\n format.html { render :edit }\n format.json { render json: @salon_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n save_to_json\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = ImagePost.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:imagest_po])\n track_activity @image\n format.html { redirect_to @image, notice: 'Image post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @property_image = PropertyImage.find(params[:id])\n\n respond_to do |format|\n if @property_image.update_attributes(params[:property_image])\n format.html { redirect_to property_images_path, notice: 'Property image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n if @image_gallery.update_attributes(params[:image_gallery])\n format.html { redirect_to @image_gallery, notice: 'Image gallery was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_gallery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trfileimage.update(trfileimage_params)\n format.html { redirect_to @trfileimage, notice: 'Trfileimage was successfully updated.' }\n format.json { render :show, status: :ok, location: @trfileimage }\n else\n format.html { render :edit }\n format.json { render json: @trfileimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_image.update(client_image_params)\n format.html { redirect_to client_client_images_path(params[:client_id]), notice: 'Client image was successfully updated.' }\n # format.json { render :show, status: :ok, location: @client_image }\n else\n format.html { redirect_to client_client_images_path(params[:client_id]), notice: 'Client image was successfully updated.' }\n format.json { render json: @client_image.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.74965835",
"0.7282379",
"0.7064539",
"0.69201183",
"0.6819811",
"0.6818851",
"0.6658328",
"0.6658328",
"0.6658328",
"0.6658328",
"0.6639258",
"0.6572188",
"0.6571129",
"0.65608907",
"0.65608907",
"0.65608907",
"0.65608907",
"0.65608907",
"0.65608907",
"0.65608907",
"0.6540009",
"0.6531042",
"0.6519769",
"0.65162545",
"0.6463509",
"0.64527893",
"0.64496243",
"0.64441377",
"0.6440753",
"0.64398247",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6410949",
"0.6409295",
"0.6405124",
"0.64021283",
"0.6392768",
"0.6391821",
"0.6362393",
"0.63545835",
"0.6345406",
"0.6333819",
"0.6327585",
"0.63251376",
"0.632476",
"0.632411",
"0.63200164",
"0.63064533",
"0.6303313",
"0.62990654",
"0.6294083",
"0.6280462",
"0.6276085",
"0.6264275",
"0.6258234",
"0.62562394",
"0.62526715",
"0.6251432",
"0.6249905",
"0.6243314",
"0.624135",
"0.62390196",
"0.6233894",
"0.6231938",
"0.62267727",
"0.6225785",
"0.62190884",
"0.6213576",
"0.6212581",
"0.6209395",
"0.62080145",
"0.6204182",
"0.6203548",
"0.62012976",
"0.61967003",
"0.61861044",
"0.6176004",
"0.61741066",
"0.6170032",
"0.6167795",
"0.6167069",
"0.61658025",
"0.61503345",
"0.61478704",
"0.6140863",
"0.61404985",
"0.6138823",
"0.61363924",
"0.6133642",
"0.61333215",
"0.6128788",
"0.6127919"
] |
0.7180967
|
2
|
DELETE /rent_images/1 DELETE /rent_images/1.json
|
def destroy
id = @rent_image.rent_id
@rent_image.destroy
respond_to do |format|
format.html { redirect_to "/rents/gallery/"+id.to_s, notice: 'Rent image was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"def image_destroy\n result = RestaurantManage.image_destroy(@restaurant, params[:pic_id])\n get_restaurant()\n render json: result\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n @estate_agent_image.destroy\n\n respond_to do |format|\n format.html { redirect_to estate_agent_image_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was deleted successfully.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Image.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @review_image = ReviewImage.find(params[:id])\n @review_image.destroy\n\n respond_to do |format|\n format.html { redirect_to review_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @img = Img.find(params[:id])\n @img.destroy\n\n respond_to do |format|\n format.html { redirect_to(imgs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n image = Image.find(params[:id])\n if image.user_id == current_user.id\n image.destroy\n render json:{}, status:201\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_image.destroy\n respond_to do |format|\n format.html { redirect_to recipe_images_url, notice: 'Recipe image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @img.destroy\n respond_to do |format|\n format.html { redirect_to imgs_url, notice: \"Img was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banner_img = BannerImg.find(params[:id])\n @banner_img.destroy\n\n respond_to do |format|\n format.html { redirect_to banner_imgs_url }\n format.json { head :no_content }\n end\n end",
"def deleteEntityImage( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/image\",params)\n end",
"def destroy\n @loc_image.destroy\n respond_to do |format|\n format.html { redirect_to loc_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.image.destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n file_url = @image.url\n @image.destroy\n\n File.delete(\"public/uploads/#{file_url}\")\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = ImagePost.find(params[:id])\n @image.destroy\n track_activity @image\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: \"Image was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_path = ImagePath.find(params[:id])\n @image_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_paths_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end",
"def destroy\n id = @taxi_image.taxi_sevice_id\n @taxi_image.destroy\n respond_to do |format|\n format.html { redirect_to \"/taxi_sevices/\" + id.to_s, notice: 'Taxi image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy()\n respond_to do |format|\n format.html { redirect_to images_url, notice: \"Image was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Imagen eliminada correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_upload = ImageUpload.find(params[:id])\n @image_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to image_uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @salon_image.destroy\n respond_to do |format|\n format.html { redirect_to salon_salon_images_url(@salon), notice: 'Salon image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @motivational_image = MotivationalImage.find(params[:id])\n @motivational_image.destroy\n\n respond_to do |format|\n format.html { redirect_to motivational_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_url = ImageUrl.find(params[:id])\n @image_url.destroy\n\n respond_to do |format|\n format.html { redirect_to image_urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal_image.destroy\n respond_to do |format|\n format.html\n format.js {}\n format.json { render json: { ok: true } }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_image(id)\n uri = URI.parse(\"http://\" + @location.host + \":\" + @location.port.to_s + \"/v2/images/\" + id)\n return delete_request(uri, @token)\n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to @photo.item }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rock_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @slider_image = SliderImage.find(params[:id])\n @slider_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slider_images_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @slider_image = SliderImage.find(params[:id])\n @slider_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slider_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n cloud = Oecloud.new(:zone => @image.zone, :image => @image)\n if cloud.deregisterimage\n @image.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html {redirect_to admin_path, notice: 'Image was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @trfileimage.destroy\n respond_to do |format|\n format.html { redirect_to trfileimages_url, notice: 'Trfileimage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admins_images_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @experience_image.destroy\n respond_to do |format|\n format.html { redirect_to experience_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @car_image = CarImage.find(params[:id])\r\n @car_image.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to car_images_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = \"Image Successfully deleted\"\n redirect_to :back\n end\n format.json do\n render json: 'success'\n end\n end\n\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n redirect_to console_images_path\n end",
"def destroy\n @pet_image_repo.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Image was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = @account.images.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n flash[:notice] = 'Image trashed'\n format.html { redirect_to(account_mediafiles_path(@account)) }\n format.js { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @imagem = Imagem.find(params[:id])\n @imagem.destroy\n\n respond_to do |format|\n format.html { redirect_to imagems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to @cafe, notice: 'image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_reference.destroy\n respond_to do |format|\n format.html { redirect_to image_references_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to mypictures_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide_image = SlideImage.find(params[:id])\n @slide_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slide_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_img.destroy\n respond_to do |format|\n format.html { redirect_to post_imgs_url, notice: 'Post img was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bwimage = Bwimage.find(params[:id])\n @bwimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bwimages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @restaurant_photo.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_photos_url, notice: 'Restaurant photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story_image.destroy\n respond_to do |format|\n format.html { redirect_to story_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_file.destroy\n respond_to do |format|\n format.html { redirect_to image_files_url, notice: 'Image file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text2_image = Text2Image.find(params[:id])\n @text2_image.destroy\n\n respond_to do |format|\n format.html { redirect_to text2_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # todo: maybe I should also have this uncommented instead of the next?\n # @image = current_user.images.find(params[:id])\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # todo: maybe I should also have this uncommented instead of the next?\n # @image = current_user.images.find(params[:id])\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: t('.notice', image: @image) }\n format.json { head :no_content }\n format.js\n end\n end"
] |
[
"0.74352014",
"0.73909354",
"0.7364131",
"0.7344567",
"0.73016953",
"0.72948766",
"0.7286952",
"0.7286952",
"0.7286952",
"0.7286952",
"0.7286952",
"0.7286952",
"0.7282794",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72614497",
"0.72614497",
"0.7224768",
"0.71353674",
"0.7135074",
"0.7120927",
"0.71055055",
"0.70910114",
"0.7087989",
"0.7082466",
"0.7052335",
"0.7046292",
"0.704607",
"0.70407575",
"0.70358485",
"0.7032737",
"0.70317477",
"0.70240194",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.7012554",
"0.70117563",
"0.70080644",
"0.6998239",
"0.69960266",
"0.6989348",
"0.69876367",
"0.6956901",
"0.6956514",
"0.69555104",
"0.69555104",
"0.69555104",
"0.6954754",
"0.69544137",
"0.69491863",
"0.6941165",
"0.6938385",
"0.6925778",
"0.6923123",
"0.69204146",
"0.6919492",
"0.68970597",
"0.68957824",
"0.68940973",
"0.68867016",
"0.688665",
"0.6883214",
"0.68799365",
"0.68793815",
"0.68785805",
"0.6874634",
"0.6868801",
"0.686651",
"0.6864759",
"0.6862821",
"0.68618846",
"0.68584436",
"0.68572277",
"0.6856698",
"0.6855644",
"0.6854917",
"0.68541753",
"0.68533516",
"0.68477046",
"0.6845215",
"0.6841124",
"0.68400073",
"0.68391764",
"0.6835748",
"0.68333125",
"0.6817824",
"0.6817824",
"0.6806368"
] |
0.7583723
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_rent_image
@rent_image = RentImage.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def rent_image_params
params.fetch(:rent_image, {})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
GET /giveadvices GET /giveadvices.json
|
def index
#limits to show only current users adviceposts! - works - does it work if its null? -it should return a nil
@adviceposts = current_advisor.adviceposts
#limits to show only current users new messages! - works -
@messages = current_advisor.messages.page(params[:page]).order('created_at DESC').where("status = ?", 'New')
#show past messages with current user where status is Responded or Cancelled
@messagesp = current_advisor.messages.page(params[:page]).order('created_at DESC').where("status = ? OR status
= ? OR status = ? OR status = ?", 'Responded', 'Canceled', 'New', 'Rated')
if @adviceposts.count >= 1
respond_to do |format|
format.html # index.html.erb
format.json { render json: @giveadvices }
end
else
redirect_to new_advicepost_path
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @sevices = Sevice.all\n end",
"def show\n @advicepost = Advicepost.find(params[:id])\n\n @products = Product.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advicepost }\n end\n end",
"def show\n @getadvice = Getadvice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @getadvice }\n end\n end",
"def index\n @vices = Vice.all\n end",
"def index\n return if @team.blank?\n Vortrics.config[:advices].each_key do |key|\n @team.advices.create_by_key(key) if (@team.respond_to?(key) && @team.send(key))\n end\n @advices = @team.advices.reject(&:read?)\n @advice = Advice.new\n end",
"def index\n\t@aservices = Aservice.all #@aservices variable de clase\n end",
"def apnew\n @advicepost = Advicepost.find(params[:id])\n\n respond_to do |format|\n format.html # apnew.html.erb\n format.json { render json: @advicepost }\n end\n end",
"def index\n @advertises = current_user.advertises.page(params[:page])\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end",
"def show\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advocacy }\n end\n end",
"def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end",
"def index\n @advertisements = Advertisement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end",
"def new\n @getadvice = Getadvice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @getadvice }\n end\n end",
"def index\n @advertisements = Advertisement.where(merchant_id: params[:merchant_id])\n\n render json: @advertisements\n end",
"def index\n respond_with(accessible_services)\n end",
"def create\n @sevice = Sevice.new(sevice_params)\n\n respond_to do |format|\n if @sevice.save\n format.html { redirect_to @sevice, notice: 'Sevice was successfully created.' }\n format.json { render :show, status: :created, location: @sevice }\n else\n format.html { render :new }\n format.json { render json: @sevice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @admittings = Admitting.all\n render json: @admittings\n end",
"def index\n @advertises = Advertise.all\n render 'index', formats: 'json', handlers: 'jbuilder'\n end",
"def show\n render json: @service\n end",
"def acl_services\n authorize!(:view_service_acl)\n\n validate_params({\n :client_id => [:required]\n })\n\n client = get_client(params[:client_id])\n\n services = {}\n client.wsdl.each do |wsdl|\n wsdl.service.each do |service|\n services[service.serviceCode] = {\n :service_code => service.serviceCode,\n :title => service.title\n }\n end\n end\n\n services_sorted = services.values.sort do |x, y|\n x[:service_code] <=> y[:service_code]\n end\n\n render_json(services_sorted)\n end",
"def index\n services = accessible_services.includes(:proxy, :account).order(:id).paginate(pagination_params)\n respond_with(services)\n end",
"def index\n services = accessible_services.includes(:proxy, :account).order(:id).paginate(pagination_params)\n respond_with(services)\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def index\n @services = @page.services.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end",
"def index\n @services = Service.find_all_by_user_id(current_user.account_id)\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @services }\n end\n end",
"def show\n #@service is already loaded and authorized\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @service }\n end\n end",
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def new\n @advertise = Advertise.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advertise }\n end\n end",
"def advocates\r\n AdvocatesController.instance\r\n end",
"def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end",
"def index\n @ideas = Idea.all\n\n render json: @ideas\n end",
"def create\n @getadvice = Getadvice.new(params[:getadvice])\n\n respond_to do |format|\n if @getadvice.save\n format.html { redirect_to @getadvice, notice: 'Getadvice was successfully created.' }\n format.json { render json: @getadvice, status: :created, location: @getadvice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @getadvice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @advert\n end",
"def show\n @service = current_user.pro.services.find(params[:id])#Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def index\n @associates = Associate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @associates }\n end\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def show\n @advertise = Advertise.find(params[:id])\n authorize! :show, @advertise, :message => 'Acceso denegado.'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advertise }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def show\n @adv = Advantage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adv }\n end\n end",
"def show\n @services = Service.where(user: current_user.building.users)\n @my_posts = @service.service_posts.select{|p| p.user == current_user }\n respond_to do |format| \n format.html \n format.json do \n render json: @services\n end \n end \n \n end",
"def show\n render json: @admitting\n end",
"def index\n @ads = Ad.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end",
"def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ads }\n end\n end",
"def new\n @apunte = Apunte.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apunte }\n end\n end",
"def index\n @manage_advertisements = ManageAdvertisement.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @representante_athlete }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @additional_service = AdditionalService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @additional_service }\n end\n end",
"def index\n render json: EndService.paginate(page: params[:page], per_page: 25)\n end",
"def index\n @ideas = current_user.ideas.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @adoption_responses = AdoptionResponse.all\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end",
"def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end",
"def index\n @point_services = PointService.all\n end",
"def new\n @paise = Paise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paise }\n end\n end",
"def index\n @services = Service.all\n @services_hash = @services.map do |s|\n {service: s, medium: s.medium.map { |media|\n media.as_json.merge({ media: url_for(media) })\n }, user: s.user.username, categories: s.categories}#, galleries: s.galleries\n \n end\n render json: @services_hash\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def show\n render json: @service_booking\n end",
"def index\n @services = Service.where(user: current_user.building.users)\n if params[:search].present?\n @services = @services.where(\"description = ? OR more_information = ?\", params[:search], params[:seach])\n end\n respond_to do |format|\n format.html \n format.json do \n render json: {\n services: @services.map{|s|s.attributes.merge(image: url_for(s.user.profile.pic), ownerId: s.user.id)}\n }\n end\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def index\n @medical_services = MedicalService.all\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def index\n @advertises = Advertise.all\n end",
"def index\n @advertises = Advertise.all\n end",
"def index\n respond_with Ad.all \n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def show\n @audience = Audience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audience }\n end\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def meal\n @meals = Meal.all\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @meals, :only => [:id, :name, :price], :include => { :items => {:only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}} }\n end\n end",
"def show\n render json: @adopter\n end",
"def index\n @awards = Award.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @awards }\n end\n end",
"def meals\n get(\"/user/#{@user_id}/meals.json\")\n end",
"def new\n @advocacy = Advocacy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @advocacy }\n end\n end",
"def index\n @offers = getmydata(\"Offer\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def meal_params\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params, only: [:name, :notes, :category, :serves])\n end",
"def new\n @service = Service.new\n @vendors = Vendor.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"def show\n render json: @responsavel\n end",
"def show\n @mensalist = Mensalist.find(params[:id])\n @services = Service.select(:id, :price, :name)\n\n @selected_services = @mensalist.services.map{ |e| \n JSON.parse(e).with_indifferent_access \n }\n \n @selected_services_ids = @selected_services.map{ |e| e[\"id\"] }\n render layout: \"application\"\n end",
"def adcreatives(options = {})\n\t\t\tself.id = self.id + \"/adcreatives\"\n\t\t\tread options\n\t\tend",
"def show\n @advertisement = Advertisement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advertisement }\n end\n end",
"def index\n @audiences = Audience.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audiences }\n end\n end",
"def alistings\n #limits to show only current users adviceposts! - works - does it work if its null? -it should return a nil \n @adviceposts = current_advisor.adviceposts\n \n\n respond_to do |format|\n format.html # apnew.html.erb\n format.json { render json: @advicepost }\n end\n end",
"def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @advertisements = Advertisement.where(user: current_user).order(updated_at: :desc).with_attached_images\n\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end",
"def index\n @attendees = Attendees.all\n render json: @attendees\n end",
"def index\n client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end",
"def index\n render json: Apartment.all\n end",
"def index\n @services = Service.all.order('created_at DESC')\n render json: @services\n end",
"def index\n @encriptions = Encription.all\n respond_to do |format|\n \n format.html \n format.json { render json: @encriptions }\n \n end\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def index\n @advances = user_capabilities(Advance).current_advances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advances }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advert }\n end\n end"
] |
[
"0.6525906",
"0.6212388",
"0.6140065",
"0.6123995",
"0.60115737",
"0.59691435",
"0.5951241",
"0.59421253",
"0.59218425",
"0.583918",
"0.58373415",
"0.58373415",
"0.57983017",
"0.57941705",
"0.5781153",
"0.5761263",
"0.5748194",
"0.5745087",
"0.57441366",
"0.57438904",
"0.5741496",
"0.5741496",
"0.5708979",
"0.56865054",
"0.56586486",
"0.56450087",
"0.56375986",
"0.5626807",
"0.5611888",
"0.55864197",
"0.55784565",
"0.55496347",
"0.5538353",
"0.55324334",
"0.5512396",
"0.5507652",
"0.55053306",
"0.55031276",
"0.54966164",
"0.54898936",
"0.5482817",
"0.54750144",
"0.54721916",
"0.54663",
"0.5465349",
"0.5464155",
"0.54543716",
"0.5445087",
"0.5435085",
"0.543197",
"0.5431162",
"0.5423952",
"0.5423952",
"0.5423952",
"0.54208237",
"0.54186046",
"0.5415992",
"0.5408138",
"0.54034907",
"0.5401367",
"0.5398947",
"0.53883904",
"0.5387439",
"0.5386887",
"0.53783345",
"0.5377943",
"0.53738594",
"0.53706867",
"0.5362063",
"0.5362063",
"0.5360782",
"0.5359914",
"0.53598315",
"0.5356794",
"0.5350926",
"0.5345814",
"0.5340921",
"0.5338707",
"0.53378445",
"0.53365",
"0.53347343",
"0.53299767",
"0.5327849",
"0.53236455",
"0.5318044",
"0.5317425",
"0.53165853",
"0.5315438",
"0.53153944",
"0.5315181",
"0.53118604",
"0.53113955",
"0.53113484",
"0.530803",
"0.5303901",
"0.52948505",
"0.5294024",
"0.5290416",
"0.52893496",
"0.52842766",
"0.5278143"
] |
0.0
|
-1
|
step 1: reverse the integer step 2: compare the reversed integer to the given number Time Complexity: O(n) Space complexity: O(n)
|
def is_palindrome(number)
return false if number.class != Integer || number < 0
# create a varibale to store the result number
result = 0
prev_result = 0
copy_num = number
while copy_num != 0
current_digit = copy_num % 10
result = result * 10 + current_digit
# This is to handle overflow
return false if ((result - current_digit) / 10) != prev_result
prev_result = result
copy_num = copy_num / 10
end
return result == number
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def palindromic_number?(int)\n arr = int.to_s\n if arr == arr.reverse\n p true\n else\n p false\n end\n\nend",
"def palindromic_number?(int)\r\n int.to_s == int.to_s.reverse\r\nend",
"def palindromic_number?(int)\n int.to_s == int.to_s.reverse\nend",
"def compare_number_after_swap(num)\n swap_num = num.to_s\n\n swap_num = swap_num.reverse()\n\n return swap_num[1].to_i > swap_num[0].to_i\nend",
"def solve(num)\n return num.to_s == num.to_s.reverse\nend",
"def palindromic_number?(int)\n new_integer = int.to_s.reverse\n new_integer == int.to_s\nend",
"def palindromic_number?(integer)\n integer.to_s == integer.to_s.reverse\nend",
"def palindromic_number?(integer)\n integer.to_s == integer.to_s.reverse!\nend",
"def palindromic_number?(integer)\n string = integer.to_s\n string == string.reverse\nend",
"def palindromic_number?(int)\n str = int.to_s\n str == str.reverse\nend",
"def palindromic_number?(num)\n num == num.to_s.reverse.to_i\nend",
"def palindromic_number?(num)\n num == num.to_s.reverse.to_i\nend",
"def palindromic_number?(int)\n new_int = int.to_s\n new_int = new_int.reverse\n new_int = new_int.to_i\n int == new_int\nend",
"def palindromic_number?(n)\n n.to_s == n.to_s.reverse\nend",
"def interesting_number(number)\n numbers = number.digits.reverse\n puts false if numbers.length < 3 \n i = 0\n# Descending\nif numbers[0] > numbers[1]\n numbers.each - 1 do |num|\n numbers[i] == numbers[i+1] - 1 ? i+1 : false\n end \n puts true\n# Ascending \nelsif numbers[0] < numbers[1]\n numbers.each do |num|\n numbers[i] == numbers[i+1] + 1 ? i+1 : false\n end\n puts true \nelse \n puts false\nend",
"def palindromic_number?(int)\n string_num = int.abs.to_s\n string_num == string_num.reverse\nend",
"def palindromic_number?(number)\n number.to_s.reverse.to_i\nend",
"def palindromic_number?(integer)\n digits = integer.to_s\n digits == digits.reverse\nend",
"def palindromic_number?(num)\n\tstr = num.to_s\n\n\tnum == str.reverse.to_i\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def is_palindrome(number)\n return false if number == nil\n return true if number == 0\n reverse = 0\n while number > 0\n temp = number # can check if temp = reverse\n digit = number % 10\n reverse = reverse * 10 + digit\n number = number / 10\n # number_even = number * 10 + digit\n p \"temp: #{temp}\"\n p \"digit: #{digit}\"\n p \"reverse: #{reverse}\"\n p \"number: #{number}\"\n\n return true if number == reverse || temp == reverse\n # return true if number == reverse\n end\n return false\nend",
"def palindromic_number?(num)\n string = num.to_s\n string == string.reverse\nend",
"def palindromic_number?(num)\n num = num.to_s\n num == num.reverse\nend",
"def palindrome_integer(num)\n if num > 0 \n str_num = num.to_s\n return true if str_num == str_num.reverse\n end \n false \n \nend",
"def sequential(number)\r\n # number.digits.reverse.each_with_index do |num, idx|\r\n # if idx + 1 == num\r\n # return true\r\n # end\r\n # end\r\n \r\n number.digits.reverse.all? {|num| num.index + 1 == num }\r\nend",
"def palindromic?(number)\n number.to_s == number.to_s.reverse\nend",
"def palindromic?(number)\n if number.to_s == number.to_s.reverse\n return true\n end\nend",
"def palindromic?(number)\n num = number.to_s.split('')\n (1..(num.size/2)).all? do |index|\n num[index-1] == num[index*(-1)]\n end\nend",
"def pals\n sum = 0\n\n 1.upto(1000000) do |num|\n n_array = num.to_s.split(\"\")\n \n next unless n_array == n_array.reverse\n\n b_array = num.to_s(2).split(\"\")\n\n next unless b_array == b_array.reverse\n\n puts \"#{num} is double base palindrome\"\n\n sum += num\n end\n sum\nend",
"def palindromic_number?(integer)\n int_to_string = integer.to_s\n if integer == int_to_string.to_i\n true\n else\n false\n end\nend",
"def palindrome?(argument)\n argumen.reverse == argument\nend",
"def palindromic_number?(num)\n num.to_s.chars.join(\"\").reverse.to_i == num\nend",
"def palin?(n)\n n.to_s == n.to_s.reverse\nend",
"def palindromic_number?(number)\n index = -1\n rev_array = Array.new(\"#{number}\".length)\n \"#{number}\".chars.each do |char|\n rev_array[index] = char.to_i\n index -= 1\n end\n number == rev_array.join.to_i\nend",
"def reverse(x)\n return 0 if x == 0\n ans = x.to_s.reverse.to_i\n return 0 if ans > 2147483647 #(2^32) \n x > 0 ? ans : ans * -1\nend",
"def palindromic(num) \n if num.to_s.split(\"\") == num.to_s.split(\"\").reverse\n true \n else \n false \n end \nend",
"def checkPallindrome(value)\r\n\r\ni=0\r\nflag=true\r\n\r\n while i<value.length/2 do\r\n\r\n if value[i]!=value[value.length-i-1] then\r\n flag=false\r\n break\r\n end\r\n\r\n i+=1\r\n end\r\nreturn flag\r\nend",
"def palindromic?(i)\n i.to_s == i.to_s.reverse\nend",
"def reverse_pass(array, compare)\n swapped = false\n (array.length - 2).downto(0) do |i|\n if compare.call(array[i], array[i + 1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n [array, swapped]\nend",
"def palindrome?( num )\n num.to_s == num.to_s.reverse\nend",
"def Palindrome? (number)\r\n nstr = number.to_s()\r\n nstr == nstr.reverse\r\nend",
"def is_palindrome?(num)\n binary = num.to_s(2)\n num = num.to_s\n\n num.reverse == num && binary == binary.reverse\nend",
"def reverse(x)\n negative = false\n negative = true if x < 0 \n result = 0\n divisor = 10\n x = x.abs\n while(x > 0)\n result = (result * 10) + x % divisor\n x = x / divisor \n end\n result = result * -1 if negative\n return 0 if (result > 2147483648 || result < -2147483647)\n result\nend",
"def IsPalindromic(value)\r\n @value = value\r\n @n = @value\r\n @rev = 0\r\n \r\n while @value > 0\r\n @digit = @value % 10\r\n \r\n @rev = @rev * 10 + @digit\r\n @value = @value / 10\r\n end\r\n \r\n return (@n == @rev)\r\n end",
"def pallindrome? n\n n.to_s == n.to_s.reverse\nend",
"def is_palindrome(n)\n string = n.to_s\n string == string.reverse\nend",
"def palindrome?(num)\n num.to_s == num.to_s.reverse\nend",
"def is_palindrome?(number) # step 2\n digit_array = number.to_s.split('')\n return true if digit_array.reverse == digit_array\nend",
"def is_palindrome? number\n num_string = number.to_s\n counter = num_string.length / 2\n\n palindromic = true\n counter.times {|n| palindromic &&= ( num_string[n] == num_string[-n-1])}\n\n palindromic\nend",
"def palindrome?(arg)\n arg == arg.reverse\nend",
"def palindrome?(arg)\n arg == arg.reverse\nend",
"def palindromic?(input)\n input == input.reverse\nend",
"def left_to_right(number)\n arr = number.to_s.split(//)\n length = arr.length\n\n (length-1).times do\n arr.shift\n return false if !is_prime?(arr.join.to_i)\n end\n\n return true\nend",
"def Palindrome? (number)\r\n nstr = number.to_s()\r\n nstr == nstr.reverse\r\n end",
"def palindromic?(x)\n x.to_s == x.to_s.reverse\nend",
"def palindrome?(param)\n param == param.reverse\nend",
"def palindrome_index(string)\n\tcheck = ->(str){\n\t\tdeletions = 0\n\t\tleft = 0\n\t\tright = str.length-1\n\t\td_index = 0\n\t\twhile left < right #&& deletions < 2\n\t\t\tif str[left] == str[right]\n\t\t\t\tleft += 1\n\t\t\t\tright -= 1\n\t\t\telsif str[left + 1] == str[right] #delete left \n\t\t\t\tdeletions += 1\n\t\t\t\td_index = left\n\t\t\t\tleft += 1\n\t\t\telsif str[left] == str[right - 1] #delete right\n\t\t\t\tdeletions += 1\n\t\t\t\td_index = right\n\t\t\t\tright -= 1\n\t\t\telse\n\t\t\t\treturn -1\n\t\t\tend\n\t\tend\n\t\tif deletions == 0\n\t\t\treturn -1\n\t\telse\n\t\t\treturn d_index\n\t\tend\n\t}\n\tif check.call(string) == -1 && check.call(string.reverse) == -1\n return -1\n elsif check.call(string) != -1 && check.call(string.reverse) != -1\n return check.call(string)\n elsif check.call(string.reverse) != -1 && check.call(string) == -1\n return (string.length - 1) - check.call(string.reverse)\n elsif check.call(string.reverse) == -1 && check.call(string) != -1\n return check.call(string)\n end\nend",
"def palindrome?(number)\n number_array = number.abs.to_s.split(\"\")\n index = number_array.size-1\n (0..number_array.size/2).each do |index|\n if number_array.at(index) != number_array.at(number_array.size-(index+1))\n return false\n end\n end\n return true\nend",
"def solution(x)\n reverse = 0\n sign = x < 0 ? -1 : 1\n number = x.abs\n while(number > 0) do\n last_digit = number % 10\n reverse = (reverse * 10) + last_digit\n number = number / 10\n end\n reverse * sign\nend",
"def palindrome?(sequence)\n sequence == sequence.reverse\nend",
"def pali?(arg)\n arg == arg.reverse\nend",
"def palindrome(st1)\n if st1.reverse == st1\n return true\n else\n return false\n end\nend",
"def is_even_palindrome?(nums)\n counter = 0\n nums.map {|num| counter += 1 if num == num.to_s.reverse.to_i}\n if counter % 2 == 0 then return counter else return 0 end\nend",
"def reverse(n)\n reversed = 0\n while n > 0\n reversed = 10 * reversed + n % 10\n n = n / 10\n end\n reversed\nend",
"def is_palindrome (n) #Checks to see if the number is a palindrome\n if n == n.reverse\n return true\n end\nend",
"def palindrome? x\n # convert into string\n y = x.to_s\n look = y.length / 2\n y[0..(look-1)] == y[-look..-1].reverse\nend",
"def palindrome?\n n = self\n\n digit_array = n.to_s.each_char.map(&:to_i)\n digit_array.shift if n < 0\n\n start_index = 0\n end_index = digit_array.length - 1\n\n palindrome = true\n loop do\n break if end_index < start_index\n\n if digit_array[start_index] == digit_array[end_index]\n start_index += 1\n end_index -= 1\n\n break if end_index == start_index\n else\n palindrome = false\n break\n end\n end\n\n return palindrome\n end",
"def double?(int)\n array = int.to_s.chars\n first = []\n last = []\n if array.size.odd?\n false\n else\n loop do\n break if array.empty?\n first << array.shift\n last << array.pop\n end\n first == last.reverse ? true : false\n end\n \nend",
"def is_palindrome(number)\n # Special cases.\n if number.nil? or number < 0\n return false\n end\n if number == 0\n return true\n end\n # Get number of digits in number.\n num_digits = Math.log10(number).to_i + 1\n if num_digits == 1\n return true\n end\n # Reverse the last half of the number's digits.\n last_half = 0\n (num_digits / 2).to_i.downto(1) do |digit_index|\n digit = number % 10\n last_half += digit * 10**(digit_index - 1)\n number = (number / 10).to_i\n end\n # Ignore middle digit in number with odd num digits.\n if num_digits % 2 == 1\n number = (number / 10).to_i\n end\n return last_half == number\nend",
"def palindrom?(string)\n string == string.reverse\nend",
"def int_check(inputs, flag)\n inc = false\n dec = false\n i = 0\n if flag == 1\n while i < inputs.length - 1\n if inputs[i] + 1 == inputs[i + 1]\n inc = true\n elsif (inputs[i] == inputs[-2]) && (inputs[i+1] == 0)\n inc = true\n else\n # puts \"inc false\"\n return inc = false\n end\n i += 1\n end\n return true if inc\n elsif flag == -1\n while i < inputs.length - 1\n if inputs[i] - 1 == inputs[i + 1]\n dec = true\n else\n # puts \"dec false\"\n return dec = false\n end\n i += 1\n end\n return true if dec\n end\n # puts \"last flase\"\n return false\nend",
"def lychrel_number?(number)\n iterations = 0\n if palindrome?(number + reverse(number))\n return false\n end\n begin\n number = number + reverse(number)\n iterations += 1\n if iterations >50\n return true\n end\n end while(!palindrome?(number + reverse(number)))\n return false\nend",
"def palindromic(num)\n # lazy = (1..Float::INFINITY).lazy.select(&:odd?).drop(10).take_while\n # { |i| i < (Float::INFINITY) }\n Prime.lazy.select { |a| a.to_s == a.to_s.reverse }.first(num)\nend",
"def palindrome?(n)\n n.to_s == n.to_s.reverse\nend",
"def is_palindrome_num(x)\n return false if x < 0\n return true if x == 0\n\n digits = (Math.log(x) / Math.log(10)).floor + 1\n\n (digits / 2).times do |i|\n return false unless (x % 10) == x / (10 ** (digits - 2*i - 1)) % 10\n x /= 10\n end\n\n true\n\nend",
"def hack?(n)\n binary_n = n.to_s(2).to_i\n palindrome? binary_n and sum_digits(binary_n).odd?\nend",
"def right_to_left(number)\n arr = number.to_s.split(//)\n length = arr.length\n\n (length-1).times do\n arr.pop\n return false if !is_prime?(arr.join.to_i)\n end\n\n return true\nend",
"def test_reverse_number_in_arbitary_order\n assert_equal(234567, NumberReverse.new.get_reverse_number(765432))\n end",
"def is_palindrome(number)\n return false if number == nil || number < 0\n\n num = number\n reverse = 0\n\n while num > 0\n last = num % 10\n reverse = (reverse * 10) + last\n num /= 10\n end\n\n reverse == number ? true : false\n\nend",
"def is_palindrome(number)\n number.to_s.reverse == number.to_s\nend",
"def palindrome?(element)\r\nelement == element.reverse\r\nend",
"def palindromic_number?(number)\n palindrome?(number.to_s)\nend",
"def palindrome?(input)\n input == input.reverse\nend",
"def palindrome?(input)\n input == input.reverse\nend",
"def palindrome?(input)\n input == input.reverse\nend",
"def palindrome?(input)\n input == input.reverse\nend",
"def is_palindrome?(num)\n\tdigit_array = num.to_s.chars.map(&:to_i)\n\tlength = digit_array.length\n\teach_half = digit_array.each_slice(length/2).map(&:to_a)\n\treturn each_half[0] == each_half[1].reverse\nend",
"def reversed_number(num)\n\nend",
"def opposite n\n\t\tif n%2 == 0\n\t\t\treturn n+1\n\t\telse\n\t\t\treturn n-1\n\t\tend\n\tend",
"def single_number2(nums)\n nums.sort!\n \n i = 0\n length = nums.length\n \n while i < length\n if nums[i] != nums[i+1]\n return nums[i]\n end\n i += 2\n end \nend",
"def palindromic_number?(num)\n palindrome?(num.to_s)\nend",
"def lucas_numbers(n)\n comparison = [2,1]\n if n > 1\n (n - 1).times do\n new = comparison.inject(:+)\n comparison = [comparison.last, new]\n end\n return comparison.last\n elsif n < 0\n n.abs.times do\n new = comparison.pop - comparison.first\n comparison.unshift(new)\n end\n return comparison.first\n else\n return comparison[n]\n end\nend",
"def reverse(number)\n if number < 10\n return number\n end\n \n multiplier = 10\n \n until multiplier > number / 10\n multiplier *= 10\n end\n \n return ((number % 10) * multiplier) + reverse(number / 10) \n \nend",
"def integer_reverse (i)\n y = 0\n #reversed = []\n\n while i > 0 do\n y = y*10\n y += (i%10)\n i /= 10\n #reversed << y\n end\n\n #return reversed[-1]\n return y\nend",
"def palindrome?(object)\n object.reverse == object\nend",
"def palindromic_number?(int)\n int_arr = []\n \nend",
"def reversed_number2(num)\n num.to_s.reverse.to_i\nend",
"def palindrome?\n x = 0\n y = input.length - 1\n ((input.length/2) + 1).times do\n if input[x] != input[y]\n return false\n end\n x += 1\n y -= 1\n end\n return true\nend"
] |
[
"0.7056397",
"0.69901043",
"0.696128",
"0.69337785",
"0.692998",
"0.6928756",
"0.69241786",
"0.6918968",
"0.68833476",
"0.6875919",
"0.6831247",
"0.6831247",
"0.682575",
"0.68248963",
"0.6756652",
"0.6720304",
"0.67196804",
"0.6708567",
"0.6697651",
"0.66513556",
"0.66513556",
"0.6650908",
"0.6635403",
"0.6601186",
"0.6588852",
"0.65874606",
"0.6519762",
"0.65176183",
"0.6511513",
"0.6439927",
"0.63918656",
"0.63886636",
"0.63572323",
"0.63527143",
"0.6327499",
"0.6324298",
"0.62800807",
"0.6278854",
"0.6267058",
"0.62626135",
"0.6260031",
"0.6243309",
"0.6234492",
"0.6222563",
"0.62187964",
"0.61998254",
"0.6189224",
"0.61888033",
"0.6184484",
"0.6175831",
"0.6174442",
"0.6172688",
"0.6172688",
"0.61651665",
"0.61638606",
"0.61635625",
"0.6155478",
"0.61552835",
"0.61518955",
"0.6140431",
"0.61375254",
"0.61375046",
"0.6127938",
"0.61267036",
"0.6117017",
"0.6109679",
"0.6101432",
"0.6077814",
"0.6071394",
"0.60694695",
"0.6068496",
"0.605774",
"0.60566974",
"0.6052005",
"0.60519904",
"0.605158",
"0.60484535",
"0.60468775",
"0.60371184",
"0.6027469",
"0.60190296",
"0.6013961",
"0.6010636",
"0.5995195",
"0.59915274",
"0.59915274",
"0.59915274",
"0.59915274",
"0.59874934",
"0.59817123",
"0.5980028",
"0.59788346",
"0.5969403",
"0.59461004",
"0.5944879",
"0.59430665",
"0.5941967",
"0.59376234",
"0.5923827",
"0.59163463"
] |
0.6062599
|
71
|
formats to a string
|
def format
"#{amount} #{currency}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s ; format ; end",
"def to_s\n format\n end",
"def format(text); end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format!; end",
"def to_s\n @source_string || format\n end",
"def format(args = {})\n to_s\n end",
"def formats; end",
"def formats; end",
"def to_s\n format_chars.join\n end",
"def cdr_to_fmt\n '%s'\n end",
"def to_s(format = nil)\n return '' if to_str.empty?\n return to_str if to_str.length == 5\n \"#{to_str[0..4]}-#{to_str[5..8]}\"\n end",
"def old_to_s(format = :default)\n format = FORMATS[format] if format.is_a?(Symbol)\n\n result = format.dup\n FORMAT_METHODS.each_pair do |key, value|\n result.gsub!( key, value.call( self )) if result.include? key\n end\n\n # Remove any leading \"/-,\" chars.\n # Remove double white spaces.\n # Remove any duplicate \"/-,\" chars and replace with the single char.\n # Remove any trailing \"/-,\" chars.\n # Anything else - you're on your own ;-)\n lead_trim = (year != 0 && format.lstrip.start_with?(\"%Y\")) ? /\\A[\\/\\,\\s]+/ : /\\A[\\/\\,\\-\\s]+/ \n result = result.gsub(lead_trim, '').gsub(/\\s\\s/, ' ').gsub(/[\\/\\-\\,]([\\/\\-\\,])/, '\\1').gsub(/[\\/\\,\\-\\s]+\\z/, '')\n end",
"def format(*args)\n to_s % [*args]\n end",
"def to_s\n sprintf(FORMAT,*to_a)\n end",
"def format\n @_format\n end",
"def to_s\n return unless errors.empty?\n\n self.name = PericopeFormatter.new(self).format\n end",
"def to_s\n @to_s ||= format(to_h)\n end",
"def formats\n format\n end",
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def format(fmt, *rest) end",
"def format\n f = @item_attributes.first.format\n f.to_s unless f.nil?\n end",
"def to_s( le_format = nil )\n le_format ||= '%-2I: %-20N (%L) - Puissance: %O' # Format long\n vrai_format, arguments = generer_format_et_args( le_format )\n\n format( vrai_format, *arguments )\n end",
"def to_s\n Formatter::ToString.format(self)\n end",
"def format_str(value)\n value ||= '<none>'\n value = fmt ? (fmt % [value]) : value\n if max_length && (value.is_a? String) && value.length > max_length\n value = value[0..(max_length - 4)]\n value += ('.' * (max_length - value.length))\n end\n value\n end",
"def c_build_format_string(mne, tokens, field_format)\n fmt_a = []\n\n tokens.each{|t|\n if (field_format.include?(t))\n fmt_a << field_format[t][0]\n else\n fmt_a << t\n end\n }\n\n fmt_s = mne\n\n if (!fmt_a.empty?)\n fmt_s += ' ' + fmt_a.join\n end\n\n return '\"' + fmt_s + '\"'\nend",
"def format\n @item_attributes.first.format.collect {|f| f.to_s}\n end",
"def format\n @format\n end",
"def format_feedback(elmt)\n str = String.new\n str << transform_integer_to_peg(elmt)\n str\n end",
"def to_s(format = 'full_name')\n #use CASE statement to find the format\n case format\n when 'full_name'\n full_name\n when 'last_first'\n last_first\n when 'first'\n first_name\n when 'last'\n last_name\n else\n first_last\n end\n end",
"def formato\n \"\n Queso Cada 100g o 100ml IR\n \n Valor energético #{nrg_kj} kj #{nrg_kj_ir}%\n (kj/kcal) #{nrg_cal} kcal\n \n Grasas de las #{@grasa} g #{grasa_ir}%\n cuales:\n Saturadas #{@saturada} g #{saturada_ir}%\n Monoinsaturadas #{@monoinsat} g -\n Poliinsaturadas #{@poliinsat} g -\n \n Hidratos de #{@hidrato} g #{hidrato_ir}% \n carbono de los\n cuales:\n Azucares #{@azucar} g #{azucar_ir}%\n Polialcoholes #{@polialco} g -\n Almidones #{@almidon} g -\n \n Fibra alimentaria #{@fibra} g -\n \n Proteinas #{@proteina} g #{proteina_ir}%\n \n Sal #{@sal} g #{sal_ir}%\"\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s(format = 'v%M.%m.%p%s%d')\n result = format.gsub '%M', @major.to_s\n result.gsub! '%m', @minor.to_s\n result.gsub! '%p', @patch.to_s\n result.gsub!('%s', prerelease? ? \"-#{@special}\" : '')\n result.gsub!('%d', metadata? ? \"+#{@metadata}\" : '')\n result\n end",
"def format_source(source); end",
"def to_str() end",
"def to_str() end",
"def to_s()\n prettify()\n end",
"def to_s(*) end",
"def to_s(*) end",
"def to_s(*) end",
"def format_str(value)\n value ||= '<none>'\n fmt ? (fmt % [value]) : value\n end",
"def to_s\n @string || @object.strftime(FORMAT)\n end",
"def format(input)\n input\n end",
"def format\n raise NotImplementedError\n end",
"def cdr_from_fmt\n '%s'\n end",
"def to_s(fmt = nil)\n if fmt\n # needs work to include distance as well as angle fmt.\n return \"#{@bearing.strf(fmt)} #{distance.round(4)}m\"\n else\n return \"#{@bearing.strf} #{distance.round(4)}m\"\n end\n end",
"def fix_format_string(fmt)\n\t\t\tfmt.gsub(\"__\",\"%s\").gsub(\"_\",\"%s\")\n\tend",
"def _to_s\n sprintf(\"%-8s %-20s %-8s %-9s\\n%-11s %-22s %-8s %-9s\",\n \"Status\",\"Realm\",\"Type\",\"Population\",\n status,name,type,pop)\n end",
"def format\n display_name = if @display_name.nil?\n\t\t nil\n\t\t elsif @display_name =~ /^[-\\/\\w=!#\\$%&'*+?^`{|}~ ]+$/\n\t\t @display_name\n\t\t else\n\t\t '\"' + @display_name.gsub(/[\"\\\\]/, '\\\\\\\\\\&') + '\"'\n\t\t end\n local = if (@local !~ /^[-\\w=!#\\$%&'*+?^`{|}~\\.\\/]+$/ ||\n\t\t @local =~ /^\\./ ||\n\t\t @local =~ /\\.$/ ||\n\t\t @local =~ /\\.\\./)\n\t\t'\"' + @local.gsub(/[\"\\\\]/, '\\\\\\\\\\&') + '\"'\n\t else\n\t\t@local\n\t end\n domain = if (!@domain.nil? and\n\t\t (@domain !~ /^[-\\w=!#\\$%&'*+?^`{|}~\\.\\/]+$/ ||\n\t\t @domain =~ /^\\./ ||\n\t\t @domain =~ /\\.$/ ||\n\t\t @domain =~ /\\.\\./))\n\t then\n\t\t '[' + if @domain =~ /^\\[(.*)\\]$/\n\t\t\t $1\n\t\t else\n\t\t\t @domain\n\t\t end.gsub(/[\\[\\]\\\\]/, '\\\\\\\\\\&') + ']'\n\t else\n\t\t @domain\n\t end\n address = if domain.nil?\n\t\t local\n\t\telsif !display_name.nil? or domain[-1] == ?]\n\t\t '<' + local + '@' + domain + '>'\n\t\telse\n\t\t local + '@' + domain\n\t\tend\n comments = nil\n comments = unless @comments.nil?\n\t\t @comments.collect { |c|\n\t '(' + c.gsub(/[()\\\\]/, '\\\\\\\\\\&') + ')'\n\t}.join(' ')\n\t\t end\n [display_name, address, comments].compact.join(' ')\n end",
"def to_formatted_s(format = :default)\n RANGE_FORMATS[format] ? RANGE_FORMATS[format].call(first, last) : to_default_s\n end",
"def format_string(record, attribute, val)\n val\n end",
"def formatted_string\n format.dup.tap do |str|\n variables.each {|v| str.gsub!(\"%#{v}\", \"%{#{v}}\") }\n end\n end",
"def format_string(format, params = {})\n format % params\n end",
"def format\n spacify(postcode.upcase)\n end",
"def to_format\n @format ||= lookup.last \n end",
"def format_string(val, istruct, width = nil)\n val = istruct.nil_text if val.nil?\n val =\n case istruct.case\n when :lower\n val.downcase\n when :upper\n val.upcase\n when :title\n # Note: fat_core entitle keeps all uppercase words as upper case,\n val.downcase.entitle\n when :none\n val\n end\n if width && aligned?\n pad = width - width(val)\n case istruct.alignment\n when :left\n val += ' ' * pad\n when :right\n val = ' ' * pad + val\n when :center\n lpad = pad / 2 + (pad.odd? ? 1 : 0)\n rpad = pad / 2\n val = ' ' * lpad + val + ' ' * rpad\n else\n val = val\n end\n val = ' ' + val + ' '\n end\n val\n end",
"def format_string(val, istruct, width = nil)\n val = istruct.nil_text if val.nil?\n val =\n case istruct.case\n when :lower\n val.downcase\n when :upper\n val.upcase\n when :title\n # Note: fat_core entitle keeps all uppercase words as upper case,\n val.downcase.entitle\n when :none\n val\n end\n if width && aligned?\n pad = [width - width(val), 0].max\n case istruct.alignment\n when :left\n val += ' ' * pad\n when :right\n val = ' ' * pad + val\n when :center\n lpad = pad / 2 + (pad.odd? ? 1 : 0)\n rpad = pad / 2\n val = ' ' * lpad + val + ' ' * rpad\n else\n val = val\n end\n val = ' ' + val + ' '\n end\n val\n end",
"def format; :n3; end",
"def format\n return @format\n end",
"def format\n return @format\n end",
"def format\n return @format\n end",
"def to_s\n valid? ? \"%s%s %s%s%s %s%s%s %s%s%s\" % @abn.split('') : \"\"\n end",
"def pretty(format = '%12.4e')\n str = String.new()\n to_a.each{|i| str += sprintf(format, i)} \n return str\n end",
"def format(format, *arguments); end",
"def _process_format(format); end",
"def _process_format(format); end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end"
] |
[
"0.80628",
"0.7460919",
"0.74485403",
"0.73777455",
"0.73777455",
"0.73777455",
"0.73777455",
"0.73777455",
"0.73777455",
"0.73777455",
"0.73777455",
"0.70901006",
"0.7045552",
"0.6943127",
"0.6922438",
"0.6922438",
"0.6857778",
"0.68269295",
"0.6792616",
"0.67666805",
"0.669963",
"0.66989845",
"0.6660708",
"0.6653053",
"0.6602397",
"0.66012526",
"0.6596716",
"0.6596716",
"0.6596716",
"0.6585867",
"0.655461",
"0.65464914",
"0.65214854",
"0.64827025",
"0.6481278",
"0.6467924",
"0.64633673",
"0.6455991",
"0.645314",
"0.6431352",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6429743",
"0.6420194",
"0.64185643",
"0.6400327",
"0.6400327",
"0.63984364",
"0.63957804",
"0.63957804",
"0.63957804",
"0.63873386",
"0.638482",
"0.6384413",
"0.6374119",
"0.6358776",
"0.635602",
"0.63502306",
"0.6348053",
"0.6336016",
"0.6322065",
"0.63081163",
"0.6305069",
"0.62956655",
"0.62933195",
"0.6289045",
"0.6280642",
"0.6273545",
"0.62631166",
"0.62411106",
"0.62411106",
"0.62411106",
"0.62390435",
"0.6237137",
"0.62184775",
"0.621784",
"0.621784",
"0.6214963",
"0.6214963",
"0.6214963",
"0.6214963",
"0.6214963",
"0.6214963",
"0.6214963",
"0.6214963",
"0.6214963"
] |
0.0
|
-1
|
to get the currency object of money
|
def currency
money.currency
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def currency\n number_to_currency(self)\n end",
"def money(amount, name)\n Currency::Money.new(amount, name)\n end",
"def to_base_currency(money)\n bank.exchange_with(money, price_currency)\n end",
"def currency; end",
"def currency; end",
"def currency\n order.currency\n end",
"def getCurrencyObjName\r\n\t\t\treturn \"mfiforce__Currency__c\"\r\n\t\tend",
"def currency\n 'usd'\n end",
"def money\n Spree::Money.new(amount, { currency: currency })\n end",
"def to_currency(amount)\n\n decimal = BigDecimal.new(amount.to_s)\n\n full_integer = (decimal * 100)\n\n return currency = Money.new(full_integer)\n\n end",
"def money\n to_d.money.to_s\n end",
"def money\n to_d.money.to_s\n end",
"def currency\n\t\t\"USD\"\n\tend",
"def money_to_currency(money)\n if money && numeric?(money)\n #number_to_currency(money.to_d, unit: money.currency.symbol)\n number_to_currency(money.to_d, unit: current_tenant.default_currency.symbol)\n else\n number_to_currency(Monetize.parse(\"0\"))\n end\n end",
"def convert_to(to_currency)\n Money.new(self.amount * exchange_rate(to_currency), to_currency)\n end",
"def currency_symbol\n Currency.new(currency).symbol\n end",
"def currency_as_string; end",
"def currency\n nil\n end",
"def currency\n nil\n end",
"def currency\n \"USD\"\n end",
"def currency_unit\n @currency_unit\n end",
"def get(value)\n # Rails.logger.debug \"CurrencyAmount#get(#{value.inspect})\"\n return nil if value.nil?\n value.is_a?(self) ? value : self.new(value)\n end",
"def money\n Money.from_amount(amount.to_f)\n end",
"def get_current_currency\r\r\n $game_party.current_currency[:sym]\r\r\n end",
"def money(key)\n Money.new @config.fetch(key)\n end",
"def currency\n \"EUR\"\n end",
"def get_Currency()\n \t return @outputs[\"Currency\"]\n \tend",
"def currency_as_string\n self.currency.to_s\n end",
"def currency_as_string\n self.currency.to_s\n end",
"def get_currency(params)\n return params[:currency] unless params[:type] == 'transfer'\n\n return Account.get_from_name(params[:from_account], @current_user).currency\n end",
"def currency\n if currency_id.blank?\n self.company.currency_code\n else\n Currency.find(currency_id).currency_code\n end\n end",
"def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end",
"def with_currency(new_currency); end",
"def currency_code\n @currency_code\n end",
"def currency_code\n data.currency_code\n end",
"def current_currency(checkout_obj)\n symbol = ExchangeRateService.currency_symbol_mappings[checkout_obj.currency.downcase.to_sym]\n { code: checkout_obj.currency, symbol: symbol }\n end",
"def get_currency_name\n \"euro\"\n end",
"def currency\n @ipn['mc_currency']\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def as_ca_dollar\n exchange_to(\"CAD\")\n end",
"def currency(amount)\n number_to_currency amount.to_s, {:unit => \"\", :delimiter => ',', :seperator => '.'}\n end",
"def currency_as_string\n currency.to_s\n end",
"def currency_as_string\n currency.to_s\n end",
"def value\r\r\n @currency[:amount]\r\r\n end",
"def currency_exchanges\n self.invoice.currency_exchanges\n end",
"def ot_currency_code\n end",
"def instantiate amount, currency\n if amount.is_a?(BigDecimal)\n amount\n else\n BigDecimal(amount.to_s, precision_for(amount, currency))\n end\n end",
"def money(amount)\n Money.new((amount * 100).to_i)\n end",
"def currency\n return nil unless (extended_currency = read_attribute(:currency))\n encrypt_remove_pre_and_postfix(extended_currency, 'currency', 10)\n end",
"def currency\n return nil unless (extended_currency = read_attribute(:currency))\n encrypt_remove_pre_and_postfix(extended_currency, 'currency', 10)\n end",
"def price_currency_code\n @subscription_purchase.price_currency_code\n end",
"def from_dollars(currency_code, amount)\n curr = RATES.fetch(currency_code)\n total = amount / curr\n return total.round(2)\nend",
"def to_currency\n reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end",
"def currency\n raise 'Redefine this method in your billing model.'\n end",
"def currency\n raise 'Redefine this method in your billing model.'\n end",
"def base_currency_to_currency(date, to_currency)\n currency_rate(date, to_currency)\n end",
"def currency\n 'INR'\n end",
"def acc_currency\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.currency.to_s\n end",
"def currency_code\n h.e_system_currency\n end",
"def currency\n 'INR'\n end",
"def cash\n @cash ||= Money.new(0)\n end",
"def in (currency)\n self * (1/@@currencies[nomalizeCurrency currency])\n end",
"def collection_currency\n card_prices = []\n current_user.cards.each do |card|\n price = remove_dot(card.usd_price)\n card_prices << Money.new(price) * card.quantity \n end\n # call `format`\n card_prices.inject(:+) \n end",
"def currency\n @currency ||= 'AUD'\n end",
"def money\n end",
"def money(m)\n \"#{m.format(symbol: false)} #{m.currency.to_s}\"\n end",
"def to_currency(amount)\n number_to_currency amount, :precision => 0\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def as_us_dollar\n exchange_to(\"USD\")\n end",
"def price\n BigDecimal('3.0')\n end",
"def currency\n params[\"Currency\"]\n end",
"def default_currency\n self.person ? self.person.default_currency : 'USD'\n end",
"def currency\n params['currency']\n end",
"def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end",
"def conv_exchange_rate\n currency_exchange.exchange_rate\n end",
"def get_data(currency_type)\n # Will be overriden on Currency subclasses\n end",
"def to_currency(num)\n format(\"$%.2f\",num)\nend",
"def convert_to(to_currency)\n\t\tfrom_currency = self.currency\n\t\trate = Money.getRate(from_currency, to_currency)\n\n\t\tconverted_amount = self.amount * rate\n\n\t\tMoney.new(converted_amount, to_currency)\n\tend",
"def money(amount)\n number_to_currency amount.to_s, {:unit => 'R ', :delimiter => ',', :seperator => '.'}\n end",
"def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend",
"def price\n MoneyUtils.format(self.price_basis)\n end",
"def wrap(object)\n if object.nil?\n nil\n elsif object.is_a?(Currency)\n object\n else\n Currency.new(object)\n end\n end",
"def convert_money(from_currency,to_currency)\n exchanger = Exchanger.new(find_wallet_account(from_currency),find_wallet_account(to_currency), find_exchange_rate(from_currency, to_currency))\n exchanger.exchange(:all)\n end",
"def find_price_by_currency(currency)\n self.prices.find_by_currency(currency)\n end",
"def retrieve(currency_pair)\n price = Client.get(\"#{path}¤cy=#{currency_pair}\").body\n { currency_pair => price.to_f }\n end",
"def initialize (amount, currency)\n\n #Amount is stored in BigDecimal for better precision in currency operations\n @amount_bigdecimal = BigDecimal.new(amount,0)\n\n @currency = currency\n\n end",
"def curr\n Currency.where('client_id = ? and default_currency = ?', current_user.client_id, \"t\").first.try(:currency_symbol)\n end",
"def money; end",
"def total_to_currency\n amount_to_currency(@invoice_json['total'])\n end",
"def to_dollars(currency_code, amount)\n curr = RATES.fetch(currency_code)\n total = amount * curr\n return total.round(2)\nend",
"def payment_currency\n\t\t\t\t\treturn \"cs\"\n\t\t\t\tend",
"def to_currency_z(val, currency=:usd)\n if currency == :usd\n ApplicationController.helpers.number_with_precision(val,\n precision: 2, separator: '.')\n else\n val\n end\n end",
"def currency\n :TWD\n end",
"def price\n basic = Spree::Currency.basic.char_code\n price = prices.where(currency: basic).limit(1)[0]\n if price\n amount = price.amount\n else\n amount = read_attribute(:price) || 0\n end\n Spree::Currency.conversion_to_current(amount)\n end",
"def get_currency_used(item)\r\r\n @currency.nil? ? item_currency(item) : @currency\r\r\n end",
"def to_currency(value)\n go = (value/1000000000).floor\n mo = ((value - go*1000000000)/1000000).floor\n ko = ((value - go*1000000000 - mo*1000000)/1000).floor\n o = (value - go*1000000000 - mo*1000000 - ko*1000).floor\n\n o = \"00.#{o}\" if ( (o.length) == 1 )\n o = \"0.#{o}\" if ( (o.length) == 2 )\n\n result_string = o\n result_string = \"#{ko}...#{result_string}\" if ( ko != 0 )\n result_string = \"#{mo}...#{result_string}\" if ( mo != 0 )\n result_string = \"#{go}...#{result_string}\" if ( go != 0 )\n\n result_string = @currency.result_strin\n return(result_string)\n end"
] |
[
"0.7613107",
"0.743933",
"0.7408067",
"0.7406263",
"0.7406263",
"0.7369911",
"0.73444813",
"0.7232111",
"0.7223922",
"0.7180694",
"0.7167575",
"0.7167575",
"0.7150755",
"0.7145329",
"0.71406937",
"0.71224636",
"0.70858604",
"0.7085225",
"0.7085225",
"0.70794135",
"0.70429695",
"0.70237195",
"0.7013829",
"0.7003221",
"0.69981",
"0.6994098",
"0.6965222",
"0.69434226",
"0.69434226",
"0.6928449",
"0.69083774",
"0.68988216",
"0.68951225",
"0.68747675",
"0.68687373",
"0.6848782",
"0.68487746",
"0.6837588",
"0.68101245",
"0.68101245",
"0.68101245",
"0.68101245",
"0.6796386",
"0.6786185",
"0.6786185",
"0.67817867",
"0.6779459",
"0.67697716",
"0.6761876",
"0.6761612",
"0.6739922",
"0.6739922",
"0.67204595",
"0.67165333",
"0.6713392",
"0.67055756",
"0.67055756",
"0.66960514",
"0.66951126",
"0.669365",
"0.6670625",
"0.66627276",
"0.66501904",
"0.6643336",
"0.66424245",
"0.66394514",
"0.66306126",
"0.66264004",
"0.6625832",
"0.6610106",
"0.6610106",
"0.6610106",
"0.6610106",
"0.6590971",
"0.658623",
"0.6583431",
"0.6539736",
"0.65370107",
"0.6535546",
"0.6534343",
"0.653348",
"0.6519719",
"0.6513009",
"0.6507563",
"0.6490743",
"0.64884335",
"0.6484007",
"0.64839286",
"0.6477305",
"0.64771175",
"0.6471364",
"0.6457723",
"0.6452529",
"0.64479053",
"0.6441717",
"0.6433476",
"0.6415976",
"0.6413998",
"0.6408988",
"0.63932467"
] |
0.8082185
|
0
|
get the amount part of money
|
def amount
money.format(symbol: false)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def money\n Money.from_amount(amount.to_f)\n end",
"def money\n to_d.money.to_s\n end",
"def money\n to_d.money.to_s\n end",
"def amount\n\n @amount_bigdecimal.to_f.round(2)\n\n end",
"def money(amount)\n number_to_currency amount.to_s, {:unit => 'R ', :delimiter => ',', :seperator => '.'}\n end",
"def extract_amount(value)\n value.match(/[\\d.,]*\\d+[.,]\\d+/)[0].gsub(/[.,]/,'').to_f/100\n end",
"def amount\n price\n end",
"def to_money amount\n\t\t\tamount.to_f.round(2) rescue 0.0\n\t\tend",
"def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend",
"def amount_in_cents\r\n read_attribute(:amount) \r\n end",
"def amount\n data['amount'].to_f / 100\n end",
"def amt\n amount.gsub(/,|\\)'/, '')\n end",
"def parse_amount_owed text_amount\n (parse_amount_cents text_amount).abs\n end",
"def real_amount()\n Bankjob.string_to_float(amount, @decimal)\n end",
"def money(amount)\n Money.new((amount * 100).to_i)\n end",
"def get_amount\n\t\t@amount\n\tend",
"def activemerchant_amount\n (amount * 100).to_i\n end",
"def value\r\r\n @currency[:amount]\r\r\n end",
"def currency\n money.currency\n end",
"def prepare_amount amount\n BigDecimal.new(amount)/100\n end",
"def net_amount\n ((transaction_value - 0.2) / 1.034).floor_with_two_decimal_places\n end",
"def money\n end",
"def tobeamount(obj)\n\t\tif obj.to_s =~ /(\\d+)([.]\\d{1,2})?/\n\t\t\tamt = $1 + ($2 || '.00')\n\t\t\treturn amt.to_f\n\t\tend\n\t\treturn nil\n\tend",
"def currency_amount\n # define this elsewhere\n currencymark = '$'\n if self.credit?\n sprintf(\"%s%0.2f\",currencymark,self.amount)\n else\n # put minus sign before dollar\n sprintf(\"-%s%0.2f\", currencymark, self.amount.abs)\n end\n end",
"def money; end",
"def cents\n (amount * 100).to_i\n end",
"def price\n MoneyUtils.format(self.price_basis)\n end",
"def amount\n @amount\n end",
"def amount\n difference\n end",
"def amount\n case mode\n when 'set', 'fixed' then money\n when 'percentage' then percentage\n end\n end",
"def dollar_total\n total / 100.0\n end",
"def to_d\n amount\n end",
"def cents; end",
"def transaction_amount(currency_and_amount)\n currency = parse(currency_and_amount).first\n if currency == 'USD'\n amount = parse(currency_and_amount).last.to_f\n else\n amount = currency.to_f unless amount == 0.0\n end\n# self.amount = amount \n end",
"def amount\n @amount.to_i\n end",
"def money(m)\n \"#{m.format(symbol: false)} #{m.currency.to_s}\"\n end",
"def amount_cents \n (self.amount.to_f * 100).round.to_i\n end",
"def amount_i\n @amount\n end",
"def payment\n number_with_precision(amount, :precision => 2 )\n end",
"def total_amount\n (total * 100).to_i\n end",
"def credit_amount\n sum( credits )\n end",
"def donation_amount\n number_to_currency(self.value)\nend",
"def subamount unit_price , quantity\n unit_price.to_f * quantity.to_i\n end",
"def amount\n v = state[:amount] and BigDecimal(v.to_s)\n end",
"def money\n Spree::Money.new(amount, { currency: currency })\n end",
"def money\n @calculator.amount\n end",
"def acc_balance\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.to_f\n end",
"def eth_portfolio\n return @@client.accounts[1].balance.amount.to_f\n end",
"def amount\n bid.amount\n end",
"def total\n format_money(@total)\n end",
"def to_ps_money\n return nil if self.nil?\n return \"00\" if self.to_f == 0\n \n value = self.to_s\n\n # obtem a parte fracionaria e transforma em string.\n frac = value.to_f - value.to_i\n frac = frac.to_s + \"0\" \n frac = frac[2..3]\n # Se tiver parte inteira, concatena com a parte fracionaria\n inteiro = \"\"\n inteiro = value.to_i.to_s if value.to_f.truncate > 0\n inteiro + frac\n end",
"def amount_owed\n total_price - amount_paid\n end",
"def cents(amount)\n (amount * 100).to_i\n end",
"def get_value(value)\n value.instance_of?(HappyMoney::Money) ? value.convert_to(self.currency).amount : value\n end",
"def loan_amt\n (self.buying_price*1000) * (1 - (self.deposit/100))\n end",
"def amount_in_cents\n return 0 if amount.nil?\n (amount * 100).to_i\n end",
"def money(number)\n return number_to_currency(number, :format => \"%n\")\n end",
"def acc_currency\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.currency.to_s\n end",
"def amount\n params['amount_net']\n end",
"def to_f\n amount.to_f\n end",
"def cost_in_dollars\n self.cost / 100.to_f\n end",
"def amount; end",
"def amount_owed\n invoice_total - total_amount_paid\n end",
"def amount\n\t\t\t\t@amount\n\t\t\tend",
"def getamt(input) \n usdollaramt = input.to_s.gsub(/[^0-9.]+/, '')\n @amount = usdollaramt.to_i\n if @amount.between?(100,100000000)\n @output.puts 'The principal amount you entered is: ' + @amount.to_s\n @status = 'valid'\n else\n @output.puts 'Oops, Principal Amount must be between $100 and $100M!'\n end\n return @amount \n end",
"def deposit_quantity\n money.to_d.divmod(market.settle_price(currency)).first\n end",
"def prettymoney(amount)\n '$%.2f' % cents_to_dollars(amount).to_s\n end",
"def effective_total\n total = effective_total_money\n \"#{total.currency} #{total.format}\"\n end",
"def amount\n quantity * price\n end",
"def amount_in_cents(amount)\n (100 * amount).to_i\n end",
"def format_money(amount)\n amount = '%.2f' % amount.to_f\n return \"$#{amount}\"\nend",
"def amount(money)\n return nil if money.nil?\n cents = money.respond_to?(:cents) ? money.cents : money \n\n if money.is_a?(String) or cents.to_i < 0\n raise ArgumentError, 'money amount must be either a Money object or a positive integer in cents.' \n end\n\n case self.money_format\n when :cents\n cents.to_s\n else\n sprintf(\"%.2f\", cents.to_f/100)\n end\n end",
"def dollars\n cents.to_f / 100\n end",
"def withdraw(amount_of_money)\n return @balance - amount_of_money\n end",
"def amount\n return self.fee['amount'].to_f\n end",
"def credit_in_cents\n (user.credit * 100).to_i\n end",
"def normalize_amount( amount )\n\t\tamount = Money( amount )\n\t\treturn amount.exchange_to( 'ZMZ' ).fractional\n\tend",
"def charged_fee(amount)\n (amount * merchant.fee)\n end",
"def pull_currency( amount, &block )\n amount_str = Float( amount ).to_s\n idx = amount_str.index( \".\" )\n currency = block.call( amount_str, idx )\n currency.to_i\n end",
"def amount\n @percent\n end",
"def amount\n @percent\n end",
"def format_money(num)\n if num == WebScraper::NOT_APPLICABLE\n num\n else\n num[num.length] = '0' if num.index('.') == num.length - 2 # add a 0 if only 1 decimal place given\n WebScraper::MONEY_UNITS + num.gsub(WebScraper::COMMAS_REG_EXP, '\\\\1,')\n end\n end",
"def total_amount\r\n quantity * unit_price\r\n end",
"def tip_amount (bill_amount)\n\treturn bill_amount * (0.2)\nend",
"def amount\n @amount ||= begin\n amount = Txaction.calculate_amount(params[:amount]).to_d.abs\n amount = -amount if params[:amount_type] == 'spent'\n amount\n end\n end",
"def balance\n res = dollars\n\n fund_transactions.each do |tran|\n res += tran.dollars\n end\n\n return res\n end",
"def gross\n \"%.2f\" % params['amount'].to_f\n end",
"def amount\n params['amount']\n end",
"def dollar amt\n #TOOD: need commas in the right places\n sprintf \"$%0.02f\", amt\nend",
"def price_in_cents\n\t\tInteger(price * 100 + 0.50)\n\tend",
"def show_decimal_budget()\n return Money.convert_to_decimal_string(@budget)\n end",
"def to_f\n @amount.to_f\n end",
"def to_s\n s = sprintf(\"%0.#{@currency.decimal_places}f\", amount)\n s.gsub(\".\", decimal_mark)\n end",
"def amount\n credit.zero? ? -debit : credit\n end",
"def round_dollar_amt ( dollar_amt )\n dollar_amt.slice!(/\\..*$/)\n dollar_amt = Integer(dollar_amt)\n end",
"def original\n original_amount\n end",
"def convert_money(currency)\n return currency.to_f / 100\n # if currency.to_s.include?(\".\")\n # return currency\n # else\n # return currency.to_f / 100\n # end\n end",
"def to_dollar(amount)\n # round_to(@balance)\n format('%.2f', amount)\n end",
"def amount\n params[\"Amount\"]\n end",
"def payment\n loan_amount / 12\n end"
] |
[
"0.7837267",
"0.75090575",
"0.75090575",
"0.7503321",
"0.7444543",
"0.7396598",
"0.73729944",
"0.73411286",
"0.7313585",
"0.7292622",
"0.72870016",
"0.72558576",
"0.7247728",
"0.7246833",
"0.7244398",
"0.72305894",
"0.7210818",
"0.71861583",
"0.7177771",
"0.7158744",
"0.715616",
"0.71486926",
"0.7110748",
"0.70968395",
"0.70820045",
"0.7078779",
"0.7057766",
"0.70547414",
"0.7042344",
"0.6999317",
"0.69698876",
"0.69639105",
"0.69464344",
"0.6929034",
"0.69188136",
"0.69144416",
"0.6910269",
"0.6895547",
"0.68758446",
"0.6873259",
"0.6859283",
"0.68590415",
"0.68554246",
"0.68547595",
"0.6840998",
"0.6829623",
"0.68295705",
"0.6828537",
"0.6824526",
"0.6806313",
"0.67961705",
"0.67818487",
"0.6778584",
"0.6771248",
"0.67700124",
"0.6769075",
"0.6760462",
"0.675576",
"0.6740492",
"0.6727696",
"0.67252076",
"0.6720034",
"0.6715282",
"0.67098635",
"0.66969717",
"0.6691403",
"0.66857404",
"0.6678367",
"0.6671819",
"0.66707814",
"0.6660349",
"0.66465473",
"0.6634055",
"0.6633587",
"0.66199315",
"0.66159415",
"0.66152924",
"0.66136914",
"0.6606946",
"0.65982425",
"0.65982425",
"0.65949005",
"0.6592485",
"0.6590344",
"0.6589458",
"0.6575542",
"0.6554669",
"0.6553984",
"0.65538406",
"0.655326",
"0.65345263",
"0.6533893",
"0.6532343",
"0.6529881",
"0.65269226",
"0.6524003",
"0.65162337",
"0.6515465",
"0.6514575",
"0.65124816"
] |
0.71273696
|
22
|
imperials is the imperials value
|
def metrics
standard.unit.convert_to_metric imperials
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def convert_imperial_to_metric(measurement, conversion_factor)\n measurement * conversion_factor\nend",
"def imperial\n weight = get_weight(\"pounds\")\n height = get_height(\"inches\")\n\n bmi = \"#{(weight * 703) / (height * height) }\"\n puts \"Your BMI is: #{bmi}\"\n return bmi\nend",
"def ics( temps )\n temps_moy, temps_min, temps_max = temps\n\n ecart = temps_moy - temps_min\n\n ecart_type = Math.sqrt(40) * ecart / 2.023\n\n\n ecart_type_2 = 2.0 * ecart_type\n ic_min = temps_moy - ecart_type_2\n ic_max = temps_moy + ecart_type_2\n\n # Verification\n #ic_min = temps_moy - ((temps_moy - ic_min) / 2.0) / Math.sqrt(40) * 2.023\n #ic_max = temps_moy + ((ic_max - temps_moy) / 2.0) / Math.sqrt(40) * 2.023\n\n [temps_moy, ic_min, ic_max]\nend",
"def saturadasIR\n\t\t((valorEnergeticoKJ.to_f*20)/8400).round(2)\n\tend",
"def ir_hidratos \n\t\t@hidratos_ir = hidratos\n\t\t@ir_hidratos = (@hidratos_ir/260.to_f)*100\n\t\t@ir_hidratos.round(1)\n\tend",
"def km_in_mi\n 0.621371192\n end",
"def in_celsius\n if @type == :c\n @temp\n else\n (@temp.to_f - 32.0) * (5.0/9.0)\n end\n end",
"def to_celcius(temp)\n temp - 273.15\n end",
"def celsius? = unit == 'celsius'",
"def gear_inches\n\tratio * (rim + (tire * 2))\nend",
"def in_celsius\n\t\tif(@unit.to_s == \"c\")\n\t\t\t@degree\n\t\telse\n\t\t\t(@degree - 32) * (5.0/9.0)\n\t\tend\n\tend",
"def units\n attribute('yweather:units')\n end",
"def iralmidon\n vag=(almidon * 100) / 90\n vag.round(2)\n end",
"def si_unit\n return Unit.steridian if describe == 'solid angle'\n return Unit.radian if describe == 'plane angle'\n\n val = si_base_units\n return nil unless val\n return val[0] if val.length == 1\n val = val.inject(Unit.unity) do |compound,unit|\n compound * unit\n end\n val = val.or_equivalent unless val.acts_as_equivalent_unit\n end",
"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",
"def ir_grasa_saturada \n\t\t@ir_grasa_saturada = (@saturadas/20.to_f)*100\n\t\t@ir_grasa_saturada.round(1)\n\tend",
"def miles_to_kilometers(miles)\n miles * 1.60934\nend",
"def swap_units(unit)\n case unit\n when 'imperial'\n 'metric'\n when 'metric'\n 'imperial'\n end\n end",
"def ir_azucares \n\t\t@ir_azucares = (@azucares/90.to_f)*100\n\t\t@ir_azucares.round(1)\n\tend",
"def hidratosIR\n\t\t((valorEnergeticoKJ.to_f*260)/8400).round(2)\n\tend",
"def get_temperature_unit\n\t\t@tempUnit\n\tend",
"def extraterrestrial_irradiance\n earth_orbit_angle_in_radian = BigDecimal('2') * BigDecimal(Math::PI.to_s) * @day_of_year / BigDecimal('365')\n sun_earth_distance_factor_square = BigDecimal('1.00011') + BigDecimal('0.034221') * bigdecimal_cos(earth_orbit_angle_in_radian) + BigDecimal('0.001280') * bigdecimal_sin(earth_orbit_angle_in_radian) +\n BigDecimal('0.000719') * bigdecimal_cos(BigDecimal('2') * earth_orbit_angle_in_radian) + BigDecimal('0.000077') * bigdecimal_sin(BigDecimal('2') * earth_orbit_angle_in_radian)\n AVEARGE_EXTRATERRESTRIAL_IRRADIANCE * sun_earth_distance_factor_square\n end",
"def convert_temp(value,unit)\n if unit.chomp == \"f\"\n puts \"fahrenheit: #{value}\"\n puts \"to Celcius: #{((value.to_i - 32) / 1.8).round(2)}\"\n puts \"to Kelvin: #{((value.to_i + 459.67) / 1.8).round(2)}\"\n elsif unit.chomp == \"C\"\n puts \"Celcius: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 + 32).round(2)}\"\n puts \"to Kelvin: #{(value.to_i + 273.15).round(2)}\"\n else\n puts \"Kelvin: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 - 459.67).round(2)}\"\n puts \"to Celcius: #{(value.to_i - 273.15).round(2)}\"\n end\nend",
"def irhidratos\n vag=(hcarbono * 100) / 260\n vag.round(2)\n end",
"def azucaresIR\n\t\t((valorEnergeticoKJ.to_f*90)/8400).round(2)\n\tend",
"def units(metric=nil)\n (metric || (metric.nil? && self.metric?)) ? METRIC_UNITS : IMPERIAL_UNITS\n end",
"def iralmidonp\n vag=(valoralmidonp * 100) / 90\n vag.round(2)\n end",
"def miles\n# 1 meter = 0.000621371 miles\n if self.u == 'meters'\n self.distance * 0.000621371\n elsif self.u == 'miles' # mile in mile\n self.distance\n# 1 kilometer = 0.621371 miles\n elsif self.u == 'kilometers'\n self.distance * 0.621371\n# 1 yard = 0.000568182 miles\n elsif self.u == 'yards'\n self.distance * 0.000568182\n end\n end",
"def get_metals_value(space_units_array, metal, credits)\n\tnumeral = get_numeral_from_space_unit(space_units_array)\n\t@metals_values[metal] = credits.to_i / numeral.to_f\nend",
"def Celsius(intemp, inunit)\n if inunit == 'f'\n ((intemp - F_TO_C_CONVERSION1) / F_TO_C_CONVERSION2)\n elsif inunit == 'k'\n intemp - K_TO_C_CONVERSION\n elsif inunit == 'r'\n ((intemp - R_TO_C_CONVERSION1) / R_TO_C_CONVERSION2)\n end\n end",
"def m(as_integer=true)\n m = (@miles || Data::Distance.km_to_m(@kilometers))\n m ? (as_integer ? m.to_i : (100*m).round/100.0) : nil\n end",
"def airspeeds(unit = :mph)\n @airspeeds ||= float_fields('Airspeed')\n end",
"def meters\n if self.u == 'meters' # meter in meter\n self.distance\n# 1 mile = 1609.344 meters\n elsif self.u == 'miles' # meter in mile\n self.distance * 1609.34\n# 1 kilometer = 1000 meters \n elsif self.u == 'kilometers' # meter in kilometer\n self.distance * 1000\n# 1 yard = 0.9144 meters\n elsif self.u == 'yards' # meter in yard\n self.distance * 0.9144\n end\n end",
"def metric_ton? = unit == 'metric-ton'",
"def in_celsius\n (@fahrenheit - 32) * (5.0/9.0)\n end",
"def moonIntensity \n \"moonIntensity\" \n end",
"def in_t60(t60)\n 1.0 - (0.001 ** (1.0 / t60 / mus_srate))\n end",
"def on_earth\n @n / 31_557_600\n end",
"def band_a\n 1000\n end",
"def initialize\n @unit = 'f'\n @celsius = false; #11/10/15 PS-Changed from 'true'.\n @temperature = nil\n end",
"def get_distance_unit\n\t\t@kilometers\n\tend",
"def monetize\n (object.unit_price * 0.01).to_s\n end",
"def atmosphere\n atm = attribute('yweather:atmosphere')\n do_convertions(atm, [:humidity, :to_f], [:visibility, :to_f], [:pressure, :to_f], [:rising, :to_f])\n end",
"def pixel_per_meter? = unit == 'pixel-per-meter'",
"def no_Units\n val = self.no_inch\n val = val.no_foot\n val = val.no_cm\n val = val.no_mm\n val = val.gsub(/[~]/,\"\")\n return val\n end",
"def charging_temperature; end",
"def irpolialcoholesp\n vag=(valorpolialcoholesp * 100) / 90\n vag.round(2)\n end",
"def meter_per_second? = unit == 'meter-per-second'",
"def in_celsius()\n\t\treturn @opts[:c] if @opts[:c] != nil\n\t\tTemperature.ftoc(@opts[:f])\n\tend",
"def in_celsius\n \t@c ? @c : (@f - 32) * 5.0 / 9.0\n end",
"def gear_inches\n\tratio * diameter\nend",
"def humidity(weather_info)\n\tweather_info[\"currently\"][\"humidity\"]*100\nend",
"def vitaminasIR\n\t\t((valorEnergeticoKJ.to_f*260)/8400).round(2)\n\tend",
"def prec_i() end",
"def imaginary_compass\n {\n 'W' => Complex(0, -1),\n 'E' => Complex(0, 1),\n 'N' => Complex(1, 0),\n 'S' => Complex(-1, 0)\n }\nend",
"def in_to_cm(inches)\n inches_to_centimeters = inches * 2.54\n puts \"Your measurement in centimeters is #{inches_to_centimeters} centimeters.\"\nend",
"def get_monoin\n @_100=((@monoin*100)/@peso)\n @ir_100=(@_100/25)*100\n @porcion=((@monoin*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/25)*100\n [ @monoin , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end",
"def convert_to_celcius(temp)\n\t (temp - 32) * 5/9\nend",
"def convert_temp(value, fromUnits)\t\n\t\tif fromUnits == \"F\"\n\t\t\tconverted_value = (value - 32) / 1.8\n\t\telsif fromUnits == \"C\"\n\t\t\tconverted_value = (1.8 * value) + 32\n\t\tend\t\t\n\t\treturn converted_value.round\n\tend",
"def irmonograsas\n vag=(grasasmono * 100) / 70\n vag.round(2)\n end",
"def ir_energetico \n\t\t@ener_ir = ener_kj\n\t\t@ir_energetico = (@ener_ir/8400.to_f) * 100\n\t\t@ir_energetico.round(1)\n\tend",
"def initialize(latitude=nil, longitude=nil, decimal_notation=true, imperial=false)\n self.latitude = latitude\n self.longitude = longitude\n self.decimal_notation = decimal_notation\n self.imperial = imperial\n end",
"def gear_inches\n ratio * diameter\nend",
"def irvitaminas\n vag=(vitymin * 100) / 50\n vag.round(2)\n end",
"def irpolialcoholes\n vag=(polialcoholes * 100) / 90\n vag.round(2)\n end",
"def toK\n if @unit == 'F' then\n @unit = 'K'\n @value = 5.0 / 9.0 * (@value + 459.67)\n elsif @unit == 'C' then\n @unit = 'K'\n @value += 273.15\n elsif @unit == 'R' then\n @unit = 'K'\n @value *= 5.0 / 9.0\n end\n self\n end",
"def fuel_per_hour\n 10\n end",
"def si_unit\n return self if self.dimensions.is_dimensionless?\n @dimensions.si_unit\n end",
"def gear_inches\n ratio * wheel.diameter\nend",
"def sunrise(weather_info)\n\tnonunix= Time.at(weather_info[\"daily\"][\"data\"][0][\"sunriseTime\"]).to_datetime\n\tnonunix.strftime(\"%-I:%M\" \"%p\")\nend",
"def ip_to_si(number, ip_unit_string, si_unit_string) \n ip_unit = OpenStudio::createUnit(ip_unit_string, \"IP\".to_UnitSystem).get\n si_unit = OpenStudio::createUnit(si_unit_string, \"SI\".to_UnitSystem).get\n #puts \"#{ip_unit} --> #{si_unit}\"\n ip_quantity = OpenStudio::Quantity.new(number, ip_unit)\n si_quantity = OpenStudio::convert(ip_quantity, si_unit).get\n puts \"#{ip_quantity} = #{si_quantity}\" \n return si_quantity.value\n end",
"def get_tires\n 18\n end",
"def to_i(metric=nil)\n (metric || (metric.nil? && self.metric?)) ? self.km : self.m\n end",
"def to_s(metric=nil)\n (metric || (metric.nil? && self.metric?)) ? \"#{self.km} #{METRIC_UNITS}\" : \"#{self.m} #{IMPERIAL_UNITS}\"\n end",
"def revolution_per_meter? = unit == 'revolution-per-meter'",
"def Kelvin(intemp, inunit)\n if inunit == 'f'\n (((intemp - F_TO_K_CONVERSION1) / F_TO_K_CONVERSION2) + F_TO_K_CONVERSION3)\n elsif inunit == 'c'\n intemp + C_TO_K_CONVERSION\n elsif inunit == 'r'\n intemp / R_TO_K_CONVERSION\n end\n end",
"def operating_temperature; end",
"def convert_inches_to_cm length\n in_to_cm = 2.54\n length * in_to_cm\nend",
"def convert_inches_to_cm length\n in_to_cm = 2.54\n length * in_to_cm\nend",
"def convert_inches_to_cm length\n in_to_cm = 2.54\n length * in_to_cm\nend",
"def convert_temperature\n\n temp = @temperature*1.8 + 32\n\n end",
"def change_to_celcuis(temperature)\n ((temperature - 32) * 5.0 / 9.0).ceil\n end",
"def fahrenheit? = unit == 'fahrenheit'",
"def convert(fahrenheit_temp)\n @celsius_temp = (fahrenheit_temp - 32) * 5 / 9\nend",
"def get_unit(key)\n round_to(super, @nearest)\n end",
"def boil_off_gallons\n (@boil_minutes.to_f / 60.to_f) * boil_off_gallons_per_hour.to_f\n end",
"def as unit\n check_unit! unit\n dist = self.dup\n dist.number = convert_to_meters * meters_map[unit]\n dist.unit = unit\n dist \n end",
"def unit_conversion\n if user.metric_system?\n self.distance = Goal.kms_to_miles(distance) if distance.present?\n self.vertical_gain = Goal.meters_to_feet(vertical_gain) if vertical_gain.present?\n end\n end",
"def humidity(info)\n\treturn info[\"currently\"][\"humidity\"]*100\nend",
"def precipIntensity(weather_info)\n\tweather_info[\"currently\"][\"precipIntensity\"]\nend",
"def bmi_imperials\n puts \"What is your weight in pounds?\"\n weight = gets.chomp.to_f\n\n puts \"What is your height in inches?\"\n height = gets.chomp.to_f\n\n bmi = (weight / power(height, height)) * 703\n bmi_range(bmi)\nend",
"def grasaIR\n\t\t((valorEnergeticoKJ.to_f*70)/8400).round(2)\n\tend",
"def totalMeters\n (self.floor_width*self.floor_length)\n end",
"def irsalp\n vag=(valorsalp * 100) / 6\n vag.round(2)\n end",
"def is_si_unit?\n self.is_a? SI\n end",
"def convert_to_internal_value value\n value = fix_ambigious_value value, true\n\n if day_unit?\n (BigDecimal(value.to_time.to_i) / SECONDS_PER_DAY)\n elsif values_unit == Integer\n value.to_i\n else\n raise \"Unexpected unit: #{values_unit()}\"\n end\n end",
"def getCelsius()\n if scale =~ /f/ then\n Temperature.new((@degrees-32)*(5.0/9), \"c\")\n elsif scale =~ /c/ then\n Temperature.new(@degrees, @scale)\n else\n Temperature.new(@degrees - 273.15, \"c\")\n end\n end",
"def imag\n complexget :imag\n end",
"def celsius(f)\n #(f - 32) / 1.8 = c.to_i\n c = ((f.to_i) - 32) * 5 / 9\n \"The temperature in Celsius is #{c}.\"\nend",
"def fahrenheit_to_celsius(fartemp)\n return (fartemp - 32) * 5/9\nend"
] |
[
"0.6674475",
"0.5988048",
"0.58842003",
"0.57024825",
"0.5697752",
"0.5692208",
"0.5636939",
"0.5604348",
"0.56018656",
"0.56018054",
"0.55756456",
"0.5559663",
"0.55584055",
"0.550088",
"0.54956603",
"0.548406",
"0.5449152",
"0.5412982",
"0.5405265",
"0.5403666",
"0.5392998",
"0.53803074",
"0.5361971",
"0.53418",
"0.534175",
"0.5324654",
"0.5322622",
"0.5314709",
"0.53068566",
"0.5303725",
"0.52942944",
"0.526871",
"0.52623403",
"0.52598244",
"0.52573067",
"0.5239789",
"0.5238036",
"0.5235531",
"0.523475",
"0.52295744",
"0.52291006",
"0.52178425",
"0.5215853",
"0.5205229",
"0.5203549",
"0.5199783",
"0.51965255",
"0.519609",
"0.5164939",
"0.5163217",
"0.5161485",
"0.5155502",
"0.5154578",
"0.5126745",
"0.5123891",
"0.5118383",
"0.50955826",
"0.50885767",
"0.50853246",
"0.5083163",
"0.5080513",
"0.50735104",
"0.50721604",
"0.5068894",
"0.50628906",
"0.50607264",
"0.50492376",
"0.5044758",
"0.504449",
"0.50432706",
"0.50386024",
"0.5036868",
"0.50359905",
"0.5027887",
"0.5026974",
"0.5026539",
"0.50200635",
"0.50192654",
"0.50192654",
"0.50192654",
"0.50114506",
"0.5008308",
"0.500724",
"0.50042963",
"0.49958098",
"0.4988891",
"0.498885",
"0.49847674",
"0.4975676",
"0.49699306",
"0.49687597",
"0.4966824",
"0.4965304",
"0.49644718",
"0.49625546",
"0.49555263",
"0.49481186",
"0.4943066",
"0.49425706",
"0.49417302"
] |
0.70229995
|
0
|
replaces a function with the arguments passed in command: the command to do the substitution in name: the name of the function args: the argument list expression: the expression of the function
|
def args_replace command, name, args, expression
initial_offset = offset = (command =~ /\b#{Regexp.escape name}\(/) + name.length + 1
bracket_count = 1
# find the last bracket
while offset < command.length
if command[offset] == ?(
bracket_count += 1
elsif command[offset] == ?)
bracket_count -= 1
break if bracket_count == 0
end
offset += 1
end
args_expr = command[initial_offset..(offset - 1)].split(",").map(&:strip)
# passed the wrong number of arguments to this function
if args_expr.length != args.length
raise Exception.new("Error: wrong number of arguments for call to #{name} in command '#{command}'")
end
# do the substitutions
command[0..(initial_offset - name.length - 2)] + "(" + args.zip(args_expr).inject(expression) do |result, (find, repl)|
result.gsub(/\b#{Regexp.escape find}\b/, "(" + repl + ")")
end + ")" + command[(offset + 1)..-1]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def replace_sexp(sexp, predicate, function)\n Macro.new.replace(sexp, predicate, function)\nend",
"def expandify_element(element, *args)\n match = //\n to_process = nil\n args_index = 0\n\n # handle ${#} input replacement\n if (element =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN)\n args_index = ($2.to_i - 1)\n\n if (args.nil? or args[args_index].nil?)\n @streaminator.stderr_puts(\"ERROR: Tool '#{@tool_name}' expected valid argument data to accompany replacement operator #{$1}.\", Verbosity::ERRORS)\n raise\n end\n\n match = /#{Regexp.escape($1)}/\n to_process = args[args_index]\n end\n\n # simple string argument: replace escaped '\\$' and strip\n element.sub!(/\\\\\\$/, '$')\n element.strip!\n\n # handle inline ruby execution\n if (element =~ RUBY_EVAL_REPLACEMENT_PATTERN)\n element.replace(eval($1))\n end\n\n build_string = ''\n\n # handle array or anything else passed into method to be expanded in place of replacement operators\n case (to_process)\n when Array then to_process.each {|value| build_string.concat( \"#{element.sub(match, value.to_s)} \" ) } if (to_process.size > 0)\n else build_string.concat( element.sub(match, to_process.to_s) )\n end\n\n # handle inline ruby string substitution\n if (build_string =~ RUBY_STRING_REPLACEMENT_PATTERN)\n build_string.replace(@system_wrapper.module_eval(build_string))\n end\n\n return build_string.strip\n end",
"def update!(**args)\n @function_name = args[:function_name] if args.key?(:function_name)\n end",
"def call(*command); end",
"def do_expression(expr, vars)\n parse_expression(expr).each do |k|\n expr = expr.gsub(\"$(#{k})\", vars[k])\n end\n expr\nend",
"def transformed_argname; end",
"def reformat_math_functions\n funcs = %w(min max sum avg count round rounddown roundup sin cos tan)\n regex = /\\b(?<func>#{funcs}.join('|'))\\((?<expr>[^()]+)\\)/\n match = @expression.match(regex)\n\n if match\n func = match.named_captures[\"func\"]\n expr = match.named_captures[\"expr\"]\n @expression = \"#{func.upcase}(#{expr})\"\n end\n end",
"def substitute( method_binding )\n sub = Transformation.factory.substitution(method_binding)\n\n return unless sub\n @previous_value = value\n @value = previous_value.gsub(sub.pattern.to_s, sub.replacement.to_s)\n end",
"def manipulate!(args={})\n tokens = [\"mogrify\"]\n tokens << convert_to_arguments(args) if args\n tokens << \" '#{@file}#{\"[#{args[:layer].to_s}]\" if args[:layer]}'\"\n tokens << \" -annotate #{args[:annotate].to_s}\" if args[:annotate]\n tokens = convert_to_command(tokens)\n success = run(tokens)[1]\n replace_file(args[:format].to_s.downcase, args[:layer]) if success && args[:format]\n success\n end",
"def transformed_argname=(_); end",
"def execute_functions\n # match functions like func(args);\n @output = @output.gsub(/(\\w+)\\(\"?(.*)\"?\\)\\;/) {|row|\n function_name = Regexp.last_match[1]\n function_parameters = Regexp.last_match[2]\n\n return_content = \"\"\n\n functions = FunctionCollection.new\n args = function_parameters.split(/,/)\n if functions.respond_to? :\"#{function_name}\"\n functions.send(\"#{function_name}\", *args)\n else\n row\n end\n }\n end",
"def replace(exp, predicate, function)\n if predicate.call(exp) and array?(exp)\n function.call(exp.collect { |item| replace(item, predicate, function) })\n elsif predicate.call(exp) and (not(array?(exp)))\n function.call(exp)\n elsif not(predicate.call(exp)) and array?(exp)\n exp.collect { |item| replace(item, predicate, function) }\n else\n exp\n end\n end",
"def redefine_command_block(obj, command)\n object_methods(obj)[command.name] ||= begin\n obj.method(command.name)\n rescue NameError\n raise Error, \"No method exists to redefine command '#{command.name}'.\"\n end\n lambda {|*args|\n Scientist.analyze(obj, command, args) {|args|\n Scientist.object_methods(obj)[command.name].call(*args)\n }\n }\n end",
"def substitute( method_binding )\n sub = Transformer.factory.substitution(method_binding)\n\n return unless sub\n @previous_value = value\n @value = previous_value.gsub(sub.pattern.to_s, sub.replacement.to_s)\n end",
"def process_defn(exp)\n make_function exp\n end",
"def substitute_and_apply (fexp, template, workitem)\n\n re = RawExpression.new_raw(\n fexp.fei,\n fexp.parent_id,\n fexp.environment_id,\n application_context,\n template)\n\n update(re)\n\n apply(re, workitem)\n end",
"def function_eval(f,i)\n eval(f.gsub(\"x\",i.to_s))\nend",
"def update_function(name, args)\n version = args[:version]\n sql_definition = args[:sql_definition]\n revert_to_version = args[:revert_to_version]\n\n if version.nil? && sql_definition.nil?\n raise(\n ArgumentError,\n \"version or sql_definition must be specified\",\n )\n end\n\n sql_definition = sql_definition.strip_heredoc if sql_definition\n sql_definition ||= Fx::Definition.new(\n name: name,\n version: version,\n ).to_sql\n\n Fx.database.update_function(name, sql_definition)\n end",
"def update!(**args)\n @function = args[:function] if args.key?(:function)\n @line_number = args[:line_number] if args.key?(:line_number)\n end",
"def subs(re, *args)\n args.inject(self) do |s,arg|\n s.sub(re, arg)\n end\n end",
"def replace_placeholder_string(expression, variable_old, variable_new)\n if expression.is_a? Yarpler::Models::Expression\n expression.left = replace_placeholder_string(expression.left, variable_old, variable_new)\n expression.right = replace_placeholder_string(expression.right, variable_old, variable_new)\n elsif expression.is_a? Yarpler::Models::Field\n expression.variable = variable_new if expression.variable == variable_old\n end\n expression\n end",
"def execute_hook(command); end",
"def execute(operation, new_bindings)\n operation_inputs = []\n if operation.input.empty?\n operation_inputs = []\n else\n operation_inputs = operation.input.map{|i| execute(i, new_bindings)} \n end\n operation_args = operation.args\n\n if(new_bindings.has_key? operation.args[:id])\n operation_args = operation_args.merge(new_bindings[operation.args[:id]]){|param, value, new_value| new_value}\n end\n operation_args[:input] = operation_inputs\n return Operation.new(operation_args)\nend",
"def replace(*args)\n @replacements ||= {}\n\n if args.size == 2\n @replacements[args[0]] = args[1]\n\n else\n @replacements.update(args.first)\n end\n end",
"def irregular_function_sql(f)\n \"#{f.f}(#{literal(f.arg1)} #{f.joiner} #{literal(f.arg2)})\"\n end",
"def f( arg )\n \"output.push( 'f #{ arg }' )\"\n end",
"def invoke(fun, args, normal, exception, name = \"\")\n invoke2(nil, fun, args, normal, exception, name)\n end",
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.singleton_class.send(:define_method, e, cmd_block)\n }\n rescue Error\n warn \"Error: #{$!.message}\"\n end",
"def create_method_from_expressions; end",
"def expand_command(command)\n @alias_hash.each_pair do |alias_, real|\n if used_subcommand?(command, alias_)\n command = command.sub(alias_, real)\n end\n end\n command\n end",
"def update!(**args)\n @expression = args[:expression] if args.key?(:expression)\n @name = args[:name] if args.key?(:name)\n @tag_color = args[:tag_color] if args.key?(:tag_color)\n end",
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.instance_eval(\"class<<self;self;end\").send(:define_method, e, cmd_block)\n }\n end",
"def eval(*args); end",
"def commandFire _obj, _args\n \"_obj commandFire _args;\" \n end",
"def gsub(*)\n self\n end",
"def change_arg_name(old_name, new_name)\n if @old_args.include?(\"<\"+new_name+\">\")\n puts \"ERROR: New arg name already exists for %s\" % new_name\n return\n end\n if not @old_args.include?(\"<\"+old_name+\">\")\n puts \"ERROR: Old arg name does not exist for %s\" % old_name\n return\n end\n i = @old_args.index(\"<\"+old_name+\">\")\n @old_args[i] = \"<\"+new_name+\">\"\n if [\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"].include?(old_name[1].chr)\n old_name = \"_\" + old_name\n end\n old_name = old_name.gsub(/(\\W)+/,\"\").downcase\n\n i = @arglist.index(old_name)\n @arglist[i] = new_name\n for cell in @cells\n cell.change_arg_name(i, new_name)\n end\n\n end",
"def substitute(bound_variable, replacement)\n if self.kind == :variable\n if self.value == bound_variable\n return replacement\n else\n return self\n end\n elsif self.kind == :abstraction\n self.body = self.body.substitute(bound_variable, replacement)\n return self\n elsif self.kind == :application\n self.function = self.function.substitute(bound_variable, replacement)\n self.argument = self.argument.substitute(bound_variable, replacement)\n return self\n else raise ArgumentError, \"First argument is not a LambdaExpression or has no kind.\"\n end\n end",
"def expr_subst(new_members)\n self\n end",
"def invoke_original(method, args)\n method_proc = @method_definitions[method]\n method_proc.call(*args)\n end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def replace_this_with_appropriate_code(x) end",
"def __replace_eval__(line, gen_code)\n # class_eval\n if line =~ \n /(.*)((class_eval)|(module_eval)|(instance_eval)|(eval)) ?\\(?\"(.*)\"\\)? ?(.*)/\n printf \"%s%s {%s} %s\\n\", $1, $2, gen_code[:code], $8\n end\nend",
"def prepare_exec(text, command)\n prepare_exec_f(text) if command =~ /\\$f/\n prepare_exec_d(text) if command =~ /\\$d/\n prepare_exec_F(text) if command =~ /\\$F/\n prepare_exec_i(text) if command =~ /\\$i/\n prepare_exec_c(text) if command =~ /\\$c/\n prepare_exec_s(text) if command =~ /\\$s/\n end",
"def expr_subst!(new_members)\n self\n end",
"def replace_symbols(script_name, *args)\n args_new = []\n args_copy = args.clone\n\n url = args[0].clone\n modifiers = args_copy[1]\n if modifiers.class == Hash\n modifiers.delete_if do |key, value|\n delete = url.include? (\":\" + key.to_s)\n if delete\n url.sub!( (\":\" + key.to_s), value.to_s )\n end\n delete\n end\n end\n\n i = 1\n result = [url]\n while args_copy[i]\n unless args_copy[i].empty?\n\n if args_copy[i].class == Array\n value = args_copy[i]\n else\n value = [args_copy[i]]\n end\n\n if args_copy[i] != '/?' && url =~ /\\*/\n url.sub!(\"*\", value.join(''))\n else\n result.concat(value)\n end\n\n end\n i+= 1\n end\n result\n end",
"def substitute_command_variables(cmd)\n substitutions = {\n /@APPLICATION@/ => @application.name,\n /@APP@/ => @application.name,\n /@ENVIRONMENT@/ => @environment.name,\n /@ENV@/ => @environment.name,\n /@RUBY@/ => @instance_paths.ruby_path,\n /@GEM@/ => @instance_paths.gem_path,\n /@CHEF@/ => @instance_paths.chef_path,\n /@KNIFE@/ => @instance_paths.knife_path\n }\n substitutions.keys.each {|key| cmd.gsub!(key, substitutions[key]) }\n cmd\n end",
"def exp _args\n \"exp _args;\" \n end",
"def recursively_find_and_replace_command_substitutions(input)\n input = input.dup\n Parser.each_command_substitution_for(input) do |substitution_result, start_position, end_position|\n debug_log \"found command substitution at position=#{(start_position..end_position)} #{substitution_result.inspect}\"\n result = recursively_find_and_replace_command_substitutions(substitution_result.str)\n position = substitution_result.position\n ast = Parser.parse(result)\n with_standard_streams do |stdin, stdout, stderr|\n r,w = IO.pipe\n @stdout = w\n ast.accept(self)\n\n output = r.read.chomp\n\n # Treat consecutive newlines in output as a single space\n output = output.gsub(/\\n+/, ' ')\n\n # Double quote the output and escape any double quotes already\n # existing\n output = %|\"#{output.gsub(/\"/, '\\\\\"')}\"|\n\n # Put thd output back into the original input\n debug_log \"replacing command substitution at position=#{(position.min...position.max)} with #{output.inspect}\"\n input[position.min...position.max] = output\n end\n end\n input\n end",
"def call_internal(command,args)\n return @commands[command].clone.run(args)\n end",
"def redefine_command_block(obj, command)\n lambda {|*args|\n Boson::Scientist.translate_and_render(obj, command, args) {|args| super(*args) }\n }\n end",
"def gsub_functions(text)\n\tlast_function_end = 0\n\n\tresult = text\n\tadjust = 0\n\n\tscan_ignore_comments(/((\\w+)::)?(\\w+)\\s*\\(([^\\)]*?)\\)\\s*\\{/m, text) do |match|\n\t\toffset = match.pre_match.length\n\n\t\tif offset > last_function_end\n\t\t\tclass_name = match[2]\n\t\t\tname = match[3]\n\t\t\tend_offset = find_block_end(text, offset) + 1\n\n\t\t\tblock = text[offset, end_offset - offset]\n\n\t\t\t# Get replacement text.\n\n\t\t\treplacement = yield class_name, name, block\n\n\t\t\t# Substitute old text for new text:\n\n\t\t\tbefore_text = result[0, offset + adjust]\n\t\t\tafter_text = result[end_offset + adjust,\n\t\t\t result.length]\n\t\t\tresult = before_text + replacement + after_text\n\t\t\tadjust += replacement.length - block.length\n\n\t\t\t# Save end position of function so that we won't\n\t\t\t# change anything in this block again.\n\n\t\t\tlast_function_end = end_offset\n\t\tend\n\tend\n\n\tresult\nend",
"def expression=(_arg0); end",
"def call (function, *args)\n\treturn[\n\t\"POP ECX\",function,\n\t\"MOV EAX, [ECX]\",\n\t\"PUSH EAX\", \"NOP\"\n\t].concat(args)\nend",
"def on_call_translate(context, input, find, replace)\n input_str = on_call_string(context, input)\n find_chars = on_call_string(context, find).chars.to_a\n replace_chars = on_call_string(context, replace).chars.to_a\n replaced = input_str\n\n find_chars.each_with_index do |char, index|\n replace_with = replace_chars[index] ? replace_chars[index] : ''\n replaced = replaced.gsub(char, replace_with)\n end\n\n return replaced\n end",
"def replace_pattern\n id = Readline.readline(\"ID of task to perform replace: \").to_i\n old_pattern = Readline.readline('replace : ').chomp\n new_pattern = Readline.readline('with : ').chomp\n ok = ReplacePattern.new(id, old_pattern, new_pattern).execute\n puts \"No such task\" if !ok\n end",
"def replace_sexp_with_type(sexp, type, function)\n Macro.new.replace_sexp_with_type(sexp, type, function)\nend",
"def eval(input)\n return if input.strip.empty?\n\n args = input.split(/\\s+/)\n command = args.first.to_s.downcase.to_sym\n arguments = args.last\n\n raise ArgumentError, 'Invalid command' unless COMMANDS.include?(command)\n\n case command\n when :place\n raise ArgumentError, 'Invalid command' if arguments.nil?\n\n tokens = arguments.split(/,/)\n\n raise ArgumentError, 'Invalid command' unless tokens.count > 2\n\n x = tokens[0].to_i\n y = tokens[1].to_i\n direction = tokens[2].downcase.to_sym\n\n place(x, y, direction)\n when :move\n move\n when :left\n rotate_left\n when :right\n rotate_right\n when :report\n report\n else\n raise ArgumentError, 'Invalid command'\n end\n\n end",
"def eval(input)\n return if input.strip.empty?\n\n args = input.split(/\\s+/)\n command = args.first.to_s.downcase.to_sym\n arguments = args.last\n\n raise ArgumentError, 'Invalid command' unless COMMANDS.include?(command)\n\n case command\n when :place\n raise ArgumentError, 'Invalid command' if arguments.nil?\n\n tokens = arguments.split(/,/)\n\n raise ArgumentError, 'Invalid command' unless tokens.count > 2\n\n x = tokens[0].to_i\n y = tokens[1].to_i\n direction = tokens[2].downcase.to_sym\n\n place(x, y, direction)\n when :move\n move\n when :left\n rotate_left\n when :right\n rotate_right\n when :report\n report\n else\n raise ArgumentError, 'Invalid command'\n end\n\n end",
"def process_xstr(exp)\n command = exp.shift\n return \"rb_funcall(rb_mKernel, rb_intern(\\\"`\\\"), 1, rb_str_new2(#{command.inspect}))\"\n end",
"def run(str)\n # Consume the elements of the transform spec until there are none left.\n transform = @transform\n while transform && transform.length > 0\n if transform.start_with?('replace<') || transform.start_with?('r<')\n close_bracket = transform.index('>')\n m = Sutil.head(transform, close_bracket + 1).sub!('replace', 'r')\n str = StandardMethods.run_method(m, str)\n # Consume the subst clause\n close_bracket = transform.index('>')\n transform = Sutil.tail(transform, close_bracket + 2)\n elsif transform.start_with?('trim') || transform.start_with?('t<')\n close_bracket = transform.index('>')\n m = Sutil.head(transform, close_bracket + 1).sub!('trim', 't')\n str = StandardMethods.run_method(m, str)\n # Consume the trunc clause\n close_bracket = transform.index('>')\n transform = Sutil.tail(transform, close_bracket + 2)\n elsif transform.start_with?('initcap') || transform.start_with?('i')\n str = StandardMethods.run_method('i', str)\n transform = Sutil.after(transform, '.')\n elsif transform.start_with?('upcase') || transform.start_with?('u')\n str = StandardMethods.run_method('u', str)\n transform = Sutil.after(transform, '.')\n elsif transform.start_with?('downcase') || transform.start_with?('d')\n str = StandardMethods.run_method('d', str)\n transform = Sutil.after(transform, '.')\n elsif transform.start_with?('sentence') || transform.start_with?('s')\n str = StandardMethods.run_method('s', str)\n transform = Sutil.after(transform, '.')\n elsif transform.start_with?('urlencode') || transform.start_with?('e')\n str = StandardMethods.run_method('e', str)\n transform = Sutil.after(transform, '.')\n else\n raise InterpreterError, 'NOT IMPLEMENTED'\n end\n end\n str\n end",
"def call (fn, *args)\n elisp([fn.to_sym, *args])\n end",
"def invoke(*values, &proc)\n if values.first.is_a? Binding\n bind = values.shift\n else\n bind = Kernel.binding()\n end\n rewritten_sexp = rewrite_sexp(proc.to_sexp, values)\n ruby = generate_ruby(rewritten_sexp)\n p ruby\n rewritten_proc = eval(ruby, bind)\n super(values, &rewritten_proc)\n end",
"def eval(input)\n return if input.strip.empty?\n\n args = input.split(/\\s+/)\n command = args.first.to_s.downcase.to_sym\n arguments = args.last\n\n raise ArgumentError, 'Invalid command' unless Constant::COMMANDS.include?(command)\n\n case command\n when :place\n raise ArgumentError, 'Invalid command' if arguments.nil?\n\n tokens = arguments.split(/,/)\n\n raise ArgumentError, 'Invalid command' unless tokens.count > 2\n\n x = tokens[0].to_i\n y = tokens[1].to_i\n direction = tokens[2].downcase.to_sym\n\n place(x, y, direction)\n when :move\n move\n when :left\n rotate_left\n when :right\n rotate_right\n when :report\n report\n else\n raise ArgumentError, 'Invalid command'\n end\n end",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabega')\n an_array_param = ['pumpkins', 'rutabega']\nend",
"def run_transforms(method_binding)\n default( method_binding ) if value.blank?\n\n override( method_binding )\n\n substitute( method_binding )\n\n prefix( method_binding )\n\n postfix( method_binding )\n\n # TODO: - enable clients to register their own transformation methods and call them here\n end",
"def method_missing(command, *args)\n execute(command.to_s, *args)\n end",
"def method_missing(command, *args)\n execute(command.to_s, *args)\n end",
"def hook_func_name(command)\n command.tr('-', '_') << '_cli_hook'\n end",
"def update_function(name, options = {})\n version = options[:version]\n sql_definition = options[:sql_definition]\n\n if version.nil? && sql_definition.nil?\n raise(\n ArgumentError,\n \"version or sql_definition must be specified\"\n )\n end\n\n sql_definition = sql_definition.strip_heredoc if sql_definition\n sql_definition ||= Fx::Definition.function(name: name, version: version).to_sql\n\n Fx.database.update_function(name, sql_definition)\n end",
"def process_function f, args, options = {}\n fn_reg = 'temp1'\n self_reg = 'temp2'\n args_reg = 'temp3'\n\n block = CompiledBlock.new\n CODE_MGR.add_block block\n block.add_instr [INIT]\n block.add_instr [WRITE, fn_reg, f]\n\n if options[:self]\n block.add_instr [WRITE, self_reg, options[:self]]\n end\n\n # Create argument object and add to a register\n args_obj = Gene::Lang::Object.new\n args_obj.data = args\n block.add_instr [WRITE, args_reg, args_obj]\n\n block.add_instr [DEFAULT, f.body]\n\n # Call function\n if options[:self]\n block.add_instr [CALL, 'default', {\n 'fn_reg' => fn_reg,\n 'self_reg' => self_reg,\n 'args_reg' => args_reg,\n 'return_reg' => 'default',\n }]\n else\n block.add_instr [CALL, 'default', {\n 'fn_reg' => fn_reg,\n 'args_reg' => args_reg,\n 'return_reg' => 'default',\n }]\n end\n\n process block, options\n end",
"def try_and_execute_command(command)\n command_array = command.split(' ')\n method_name = command_array.shift\n args = \"\"\n command_array.each{|k| args << \"'#{k}',\"}\n args.chomp!(',')\n output = eval(\"#{method_name.downcase}(#{args})\")\n puts output if output\n end",
"def new_function_text(line, matchdata, randomized_name)\n \"#{line}\n record = {}\n method(__method__).parameters.each{|arg| record[arg[1].to_s] = (eval arg[1].to_s)}\n RECORDER.push([\\\"#{matchdata[2]}\\\", record, \\\"called\\\"])\n x = #{randomized_name}(*(record.values))\n RECORDER.push([\\\"#{matchdata[2]}\\\", x, \\\"returned\\\"])\n return x\nend\n\n#{matchdata[1]}#{randomized_name}#{matchdata[3]}\n \"\nend",
"def substText(text,bodyStack)\n if(text.kind_of?(Text)) \n rawtext = text.string ;\n elsif(text.kind_of?(Attribute))\n rawtext = text.value ;\n elsif(text.kind_of?(String))\n rawtext = text ;\n else\n return ;\n end\n\n result = rawtext.clone() ;\n\n# result.gsub!(ArgFormat) {|dat| \n# getSubstText($1,bodyStack,dat) ;\n# }\n substTextBody(result,bodyStack) ;\n\n return result ;\n end",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def apply_args_conventions(*args)\n if args.size == 1 and args[0].kind_of?(CodeTree::AstNode)\n args[0]\n elsif args.size > 1 and args[0].kind_of?(Symbol)\n function = args.shift\n children = args.collect{|c| apply_args_conventions(c)}.flatten\n CodeTree::AstNode.coerce([function, children])\n elsif args.all?{|a| a.kind_of?(CodeTree::AstNode)}\n args\n elsif args.size == 1\n args[0]\n else\n raise ArgumentError, \"Unable to apply on #{args.inspect} (#{args.size})\", caller\n end\n end",
"def apply(input_text)\n if input_text =~ /GraphQL::Relay::Mutation\\.define/\n named_proc_processor = apply_processor(input_text, ProcToClassMethodTransform::NamedProcProcessor.new(@proc_name))\n resolve_proc_processor = apply_processor(input_text, ResolveProcToMethodTransform::ResolveProcProcessor.new)\n proc_body = input_text[named_proc_processor.proc_body_start..named_proc_processor.proc_body_end]\n method_defn_indent = \" \" * named_proc_processor.proc_defn_indent\n\n obj_arg_name, args_arg_name, ctx_arg_name = resolve_proc_processor.proc_arg_names\n # This is not good, it will hit false positives\n # Should use AST to make this substitution\n if obj_arg_name != \"_\"\n proc_body.gsub!(/([^\\w:.]|^)#{obj_arg_name}([^\\w:]|$)/, '\\1object\\2')\n end\n if ctx_arg_name != \"_\"\n proc_body.gsub!(/([^\\w:.]|^)#{ctx_arg_name}([^\\w:]|$)/, '\\1context\\2')\n end\n\n method_defn = \"def #{@proc_name}(**#{args_arg_name})\\n#{method_defn_indent} #{proc_body}\\n#{method_defn_indent}end\\n\"\n method_defn = trim_lines(method_defn)\n # Update usage of args keys\n method_defn = method_defn.gsub(/#{args_arg_name}(?<method_begin>\\.key\\?\\(?|\\[)[\"':](?<arg_name>[a-zA-Z0-9_]+)[\"']?(?<method_end>\\]|\\))?/) do\n method_begin = $~[:method_begin]\n arg_name = underscorize($~[:arg_name])\n method_end = $~[:method_end]\n \"#{args_arg_name}#{method_begin}:#{arg_name}#{method_end}\"\n end\n # replace the proc with the new method\n input_text[named_proc_processor.proc_defn_start..named_proc_processor.proc_defn_end] = method_defn\n end\n input_text\n end",
"def process_call(exp)\n receiver_node_type = exp.first.nil? ? nil : exp.first.first\n receiver = process exp.shift\n receiver = \"(#{receiver})\" if ASSIGN_NODES.include? receiver_node_type\n\n name = exp.shift\n args = []\n\n # this allows us to do both old and new sexp forms:\n exp.push(*exp.pop[1..-1]) if exp.size == 1 && exp.first.first == :arglist\n\n @calls.push name\n\n in_context :arglist do\n until exp.empty? do\n arg_type = exp.first.sexp_type\n is_empty_hash = (exp.first == s(:hash))\n arg = process exp.shift\n\n next if arg.empty?\n\n strip_hash = (arg_type == :hash and\n not BINARY.include? name and\n not is_empty_hash and\n (exp.empty? or exp.first.sexp_type == :splat))\n wrap_arg = Ruby2Ruby::ASSIGN_NODES.include? arg_type\n\n arg = arg[2..-3] if strip_hash\n arg = \"(#{arg})\" if wrap_arg\n\n args << arg\n end\n end\n\n case name\n when *BINARY then\n # CUSTOM\n \"#{receiver}#{name}#{args.join(', ')}\"\n when :[] then\n receiver ||= \"self\"\n \"#{receiver}[#{args.join(', ')}]\"\n when :[]= then\n receiver ||= \"self\"\n rhs = args.pop\n \"#{receiver}[#{args.join(', ')}] = #{rhs}\"\n when :\"-@\" then\n \"-#{receiver}\"\n when :\"+@\" then\n \"+#{receiver}\"\n # CUSTOM\n when :lambda then\n '->'\n # CUSTOM\n when :call then\n args = if args.empty?\n nil\n elsif args\n args.join(',')\n end\n\n \"#{receiver}[#{args}]\"\n else\n args = nil if args.empty?\n\n # CUSTOM\n args = if args and args.size == 1\n # It's safe to map a single arg to be spaced from\n # the receiver w/out parens in this context\n \" #{ args.first }\"\n elsif args\n \"(#{args.join(', ')})\"\n end\n\n receiver = \"#{receiver}.\" if receiver\n\n \"#{receiver}#{name}#{args}\"\n end\n ensure\n @calls.pop\n end",
"def rubify\n %Q{\n @proc_for_#{placeholder} = Proc.new do |resource|\n begin\n input = resource.send \"#{input}\"\n #{decorations.collect {|d| d.rubify }}\n input\n rescue Exception => ex\n ex.message\n end\n end\n }\n end",
"def call(name, *args)\n unless name.is_a?(Sass::Script::Value::String) ||\n name.is_a?(Sass::Script::Value::Function)\n assert_type name, :Function, :function\n end\n if name.is_a?(Sass::Script::Value::String)\n name = if function_exists(name).to_bool\n get_function(name)\n else\n get_function(name, \"css\" => bool(true))\n end\n Sass::Util.sass_warn(<<WARNING)\nDEPRECATION WARNING: Passing a string to call() is deprecated and will be illegal\nin Sass 4.0. Use call(#{name.to_sass}) instead.\nWARNING\n end\n kwargs = args.last.is_a?(Hash) ? args.pop : {}\n funcall = Sass::Script::Tree::Funcall.new(\n name.value,\n args.map {|a| Sass::Script::Tree::Literal.new(a)},\n Sass::Util.map_vals(kwargs) {|v| Sass::Script::Tree::Literal.new(v)},\n nil,\n nil)\n funcall.line = environment.stack.frames.last.line\n funcall.filename = environment.stack.frames.last.filename\n funcall.options = options\n perform(funcall)\n end",
"def prepare_arguments(expression, arguments)\n case expression\n when Array\n expression.each do |item|\n prepare_arguments(item, arguments)\n end\n when Fast::FindFromArgument\n expression.arguments = arguments\n when Fast::Find\n prepare_arguments expression.token, arguments\n end\n end",
"def recursively_find_and_replace_command_substitutions(parser, input)\n input = input.dup\n parser.each_command_substitution_for(input) do |substitution_result, start_position, end_position|\n result = recursively_find_and_replace_command_substitutions(parser, substitution_result.str)\n position = substitution_result.position\n ast = parser.parse(result)\n with_standard_streams do |stdin, stdout, stderr|\n r,w = IO.pipe\n @stdout = w\n ast.accept(self)\n input[position.min...position.max] = r.read.chomp\n end\n end\n input\n end",
"def on_iter( node )\n descend( node )\n target, args, block = node\n \n func = build_function( args, block )\n block.delete!\n \n case target.type\n when CALL, NEW\n arg_node = target.last\n if placeholder = arg_node.find { | child | child.type == FUNC_ARG }\n placeholder.replace!( func )\n else\n append_argument( arg_node, func )\n end\n else\n if target.type == ID and target.text == 'eval'\n node.replace!( \"(#{ func })()\" )\n else\n target.append!( '( ' << func << ' )' )\n end\n end\n end",
"def add_function(key, aString, op, table)\n counts = aString.downcase.to_counts\n src = 'lambda { |targ| '\n counts.each_with_index do |n,i|\n src += \"targ[#{i}] #{op}= #{n}; \" if (n > 0)\n end\n src += '}'\n table[key] = eval(src)\n end",
"def register_command command\n @commands ||= {}\n @commands[command.expression.to_regexp] = command\n end",
"def dehashify_argument_elements(hash)\n build_string = ''\n elements = []\n\n # grab the substitution string (hash key)\n substitution = hash.keys[0].to_s\n # grab the string(s) to squirt into the substitution string (hash value)\n expand = hash[hash.keys[0]]\n\n if (expand.nil?)\n @streaminator.stderr_puts(\"ERROR: Tool '#{@tool_name}' could not expand nil elements for substitution string '#{substitution}'.\", Verbosity::ERRORS)\n raise\n end\n\n # array-ify expansion input if only a single string\n expansion = ((expand.class == String) ? [expand] : expand)\n\n expansion.each do |item|\n # code eval substitution\n if (item =~ RUBY_EVAL_REPLACEMENT_PATTERN)\n elements << eval($1)\n # string eval substitution\n elsif (item =~ RUBY_STRING_REPLACEMENT_PATTERN)\n elements << @system_wrapper.module_eval(item)\n # global constants\n elsif (@system_wrapper.constants_include?(item))\n const = Object.const_get(item)\n if (const.nil?)\n @streaminator.stderr_puts(\"ERROR: Tool '#{@tool_name}' found constant '#{item}' to be nil.\", Verbosity::ERRORS)\n raise\n else\n elements << const\n end\n elsif (item.class == Array)\n elements << item\n elsif (item.class == String)\n @streaminator.stderr_puts(\"ERROR: Tool '#{@tool_name}' cannot expand nonexistent value '#{item}' for substitution string '#{substitution}'.\", Verbosity::ERRORS)\n raise\n else\n @streaminator.stderr_puts(\"ERROR: Tool '#{@tool_name}' cannot expand value having type '#{item.class}' for substitution string '#{substitution}'.\", Verbosity::ERRORS)\n raise\n end\n end\n\n # expand elements (whether string or array) into substitution string & replace escaped '\\$'\n elements.flatten!\n elements.each do |element|\n build_string.concat( substitution.sub(/([^\\\\]*)\\$/, \"\\\\1#{element}\") ) # don't replace escaped '\\$' but allow us to replace just a lonesome '$'\n build_string.gsub!(/\\\\\\$/, '$')\n build_string.concat(' ')\n end\n\n return build_string.strip\n end",
"def expand_placeholders(text)\n text \\\n .gsub(\"REPO_NAME\", repo_name) \\\n .gsub(\"BRANCH_NAME\", @branch_name) \\\n .gsub(\"FILE_NAMES\", @file_names) \\\n .gsub(\"FILE_DIFFS\", @file_diffs)\n end",
"def mess_with_vars(one, two, three)\n one.gsub!(\"one\", \"two\")\n two.gsub!(\"two\", \"three\")\n three.gsub!(\"three\", \"one\")\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'pumpkinsrutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend",
"def update!(**args)\n @function = args[:function] if args.key?(:function)\n @interaction = args[:interaction] if args.key?(:interaction)\n @load_indicator = args[:load_indicator] if args.key?(:load_indicator)\n @parameters = args[:parameters] if args.key?(:parameters)\n end",
"def test_method_calls_can_take_and_execute_fn_parm\n result = interpret 'a=~{foo: ->(fn) { %fn }};%a.foo(->() {4})'\n assert_eq result, 4\n end",
"def normalize_arg(arg , statements)\n sol_arg = arg.to_sol\n return sol_arg if sol_arg.is_a?(Sol::Expression)\n if( sol_arg.is_a?(Sol::Statements))\n while(sol_arg.length > 1)\n statements << sol_arg.shift\n end\n sol_arg = sol_arg.shift\n end\n assign = Sol::LocalAssignment.new( \"tmp_#{arg.object_id}\".to_sym, sol_arg)\n statements << assign\n return Sol::LocalVariable.new(assign.name)\n end",
"def process_cmd(command, input_tokens)\n send command, input_tokens\n end",
"def mess_with_vars(one, two, three)\n one.gsub!(\"one\",\"two\")\n two.gsub!(\"two\",\"three\")\n three.gsub!(\"three\",\"one\")\nend",
"def mess_with_vars(one, two, three)\n one.gsub!(\"one\",\"two\")\n two.gsub!(\"two\",\"three\")\n three.gsub!(\"three\",\"one\")\nend",
"def mess_with_vars(one, two, three)\n one.gsub!(\"one\",\"two\")\n two.gsub!(\"two\",\"three\")\n three.gsub!(\"three\",\"one\")\nend",
"def mess_with_vars(one, two, three)\n one.gsub!(\"one\",\"two\")\n two.gsub!(\"two\",\"three\")\n three.gsub!(\"three\",\"one\")\nend",
"def mess_with_vars(one, two, three)\n one.gsub!(\"one\",\"two\")\n two.gsub!(\"two\",\"three\")\n three.gsub!(\"three\",\"one\")\nend"
] |
[
"0.60614115",
"0.59935087",
"0.58503205",
"0.57638806",
"0.56547594",
"0.56185436",
"0.5611285",
"0.5553941",
"0.5503618",
"0.5503504",
"0.54755974",
"0.545029",
"0.54123527",
"0.5400505",
"0.5373905",
"0.5370587",
"0.53671026",
"0.53323203",
"0.5287228",
"0.5283144",
"0.52713877",
"0.52528906",
"0.5228478",
"0.52264863",
"0.5215285",
"0.51989836",
"0.51840764",
"0.5167793",
"0.51639247",
"0.5157995",
"0.51525146",
"0.5143504",
"0.5135174",
"0.51175255",
"0.51122206",
"0.5110287",
"0.51073647",
"0.5084126",
"0.5081339",
"0.5079055",
"0.5066636",
"0.50531805",
"0.5046834",
"0.5034104",
"0.5019148",
"0.5011845",
"0.50085664",
"0.5007164",
"0.5005318",
"0.49952996",
"0.49856895",
"0.4983998",
"0.49822888",
"0.49717087",
"0.49652168",
"0.4963483",
"0.49502838",
"0.49502838",
"0.49434745",
"0.49427423",
"0.49413863",
"0.49356002",
"0.49331722",
"0.49306127",
"0.49265027",
"0.4925332",
"0.4925332",
"0.4925063",
"0.49199834",
"0.49187604",
"0.4917145",
"0.49119067",
"0.49104252",
"0.48983946",
"0.48983946",
"0.48983946",
"0.48983946",
"0.4894781",
"0.48920187",
"0.48878723",
"0.48831716",
"0.48764548",
"0.48763794",
"0.48757833",
"0.48644513",
"0.48588458",
"0.48579955",
"0.48529637",
"0.48513445",
"0.48465636",
"0.48437452",
"0.4822302",
"0.48155472",
"0.4813843",
"0.4812392",
"0.4810789",
"0.4810789",
"0.4810789",
"0.4810789",
"0.4810789"
] |
0.79910326
|
0
|
This method helps with building options_for_select for an object that has an association to a nested_set model returns options_for_select with the following rules: class_or_item must be a class (or object of a class) that uses acts_as_nested_set items listed in excluded_items array will not be included in the list (to be used for items already associated to the object the drop down is for) all leaf nodes (ie items without subitems) not included in the excluded_items array will appear in the dropdown and be selectable items that have children will be added to the list but will be disabled items with children who have ALL their children included in the excluded_items array will not be shown (as there are no selectable children)
|
def nested_set_association_options_for_select(class_or_item, excluded_items=[], prompt="Please select..." )
throw ArgumentError.new "nested_set_association_options_for_select - class_or_item must use acts_as_nested_set" unless class_or_item.respond_to?(:roots)
def get_children(node, excluded_items = [] )
result = []
collection = nil
if node.is_a?(Class)
collection = Array(node.roots)
else
collection = Array(node.children)
end
collection.each do |child|
if child.children.empty?
result << ["#{ '-' * child.level} #{child.to_label}", child.id.to_s] unless excluded_items.include?(child)
else
children = get_children(child, excluded_items)
unless children.empty?
@disabled << child.id.to_s
result << ["#{ '-' * child.level} #{child.to_label}", child.id.to_s]
result += children
end
end
end
result
end
result = [[prompt, ""]]
@disabled = []
result += get_children(class_or_item, excluded_items)
options_for_select(result, {:disabled => @disabled })
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def nested_select(object, method, collection, options = {}, html_options = {})\n choices = nested_as_options(collection) { |record| [\"#{@indent} #{record.name}\", record.id] }\n select(object, method, choices, options, html_options)\n end",
"def items_for_select_menu(options = {}) \n # clean out the various parts\n html_options = options.slice(:prompt, :divider, :show_root, :root_text)\n sql_options = options.except(:prompt, :divider, :show_root, :root_text)\n \n # defaults\n html_options = {\n :prompt => \"Select #{self.name}\",\n :divider => true,\n :show_root => true,\n :root_text => \"Top Level #{self.name}\",\n }.merge(html_options)\n \n sql_options = {\n :order => [self.select_field.to_sym],\n }.merge(sql_options)\n \n mi = self.select_options[:is_tree] ? all({ :parent_id => nil }.merge(sql_options) ) : all(sql_options)\n \n res = []\n if html_options[:prompt]\n res << [nil, html_options[:prompt]] \n res << ['nil', \" ------ \"] if html_options[:divider]\n if self.select_options[:is_tree]\n if html_options[:show_root]\n res << [0, html_options[:root_text]] \n res << ['nil',\" ------ \"] if html_options[:divider]\n end\n end\n end\n \n if self.select_options[:is_tree]\n mi.each do |x|\n res << [x.send(self.value_field), x.send(self.select_field)]\n unless x.children.blank?\n x.children.each do |child|\n res << [child.send(self.value_field), \"-- #{child.send(self.select_field)}\"]\n child.children.each do |grand_child| \n res << [ grand_child.send(self.value_field), \"-- -- #{grand_child.send(self.select_field)}\"] \n end unless child.children.blank?\n end\n end\n end\n else\n mi.each do |x|\n res << [x.send(self.value_field), x.send(self.select_field)]\n end\n end\n res\n end",
"def build_options_and_select(type, selected, options = {})\n build_select(type, build_options(selected, options))\n end",
"def options_for_category_select(collection={}, category = Category.new)\n \n html_code = \"<option value=\"\">None</option>\"\n \n if collection.empty?\n html_code\n else\n parents = collection.select{ |kategory| kategory.parent_id.nil? }\n parents.each do |parent|\n options = {:value => parent.id}\n options = options.merge({:selected=>\"selected\"}) if parent == category\n html_code += tag(\"option\", options, true) + parent.name + \"</option>\" + indent_child_options_for_category_select(parent, category)\n end\n html_code\n end\n\n end",
"def chain_select_model_options(model_name, options = {})\n ar_model = constantize_model(model_name)\n \n # always display the data for the 1st drop-down\n if ar_model.is_chain_select_root?\n options[:select_txt_only] = nil\n options[:value] = options[:values][model_name] if options[:values] and options[:values][model_name]\n \n # for succeeding drop-downs, either display a plain \"-- Select --\"\n # or display a selected value\n else\n # user specified a value so we need to retrieve all data that are related to it\n if options[:values] and options[:values][model_name]\n options[:value] = options[:values][model_name]\n options[:parent] = [options[:values][ar_model.chain_select_from], ar_model.chain_select_from.to_s]\n else\n options[:select_txt_only] = true\n end\n end\n \n options\n end",
"def all_children(options = {})\n conditions = \"(#{nested_set_left} > #{self[nested_set_left]}) and (#{nested_set_right} < #{self[nested_set_right]})\"\n if options[:exclude]\n transaction do\n # exclude some items and all their children\n options[:exclude] = [options[:exclude]] if !options[:exclude].is_a?(Array)\n # get objects for ids\n options[:exclude].collect! {|s| s.is_a?(nested_set_class) ? s : nested_set_class.find(s)}\n # get all subtrees and flatten the list\n exclude_list = options[:exclude].map{|e| e.full_set.map{|ee| ee.id}}.flatten.uniq\n conditions += \" AND id NOT IN (#{exclude_list.join(',')})\" unless exclude_list.empty?\n end\n end\n nested_set_class.find_with_nested_set_scope(:all, :conditions => conditions, :order => nested_set_left)\n end",
"def build_select(type, select_options_as_html); end",
"def options_for_multiselect_selected( object, method, ids, options = {} )\n return [] if ( ids.nil? or ids.empty? )\n class_name = options[:class_name] || object\n model = get_object(class_name)\n items = get_selected_items(:model => model, :options => options, :ids => ids, :method => method)\n options_from_collection_for_select(items, :to_param, options[:display_value] ||= method)\n end",
"def user_nested_field_set(f, assoc, options = {})\n nested_field_set(f, assoc, options.merge(label: false, inner_partial: \"shared/user_select\"))\n end",
"def all_children(special=nil)\n if special && special[:exclude]\n transaction do\n # exclude some items and all their children\n special[:exclude] = [special[:exclude]] if !special[:exclude].is_a?(Array)\n # get objects for ids\n special[:exclude].collect! {|s| s.is_a?(self.class) ? s : self.class.find(s)}\n # get all subtrees and flatten the list\n exclude_list = special[:exclude].map{|e| e.full_set.map{|ee| ee.id}}.flatten.uniq.join(',')\n if exclude_list.blank?\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n else\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND id NOT IN (#{exclude_list}) AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n end\n end\n else\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n end\n end",
"def build_cloneable_options_tree(resource, path = [])\n cloneable_options = resource.cloneable_options\n\n # Iterate over the resource's cloneable options' :include array and recursively\n # add nested included resources to its own included resources.\n options = cloneable_options[:include].each_with_object({}) do |reflection_name, hash|\n # This avoids cyclic dependencies issues by stopping nested association\n # inclusions before the cycle starts.\n #\n # For example, if a post includes its author, and the author includes its posts,\n # this would make the system fail with a stack level too deep error. Here this\n # guard allows the inclusion to stop at :\n #\n # { posts: { author: { posts: { author: {}}}}}\n #\n # Which ensures that, using the dictionary strategy of deep_cloneable, all\n # posts' authors' posts will have their author mapped to an already cloned\n # author when it comes to cloning the \"author\" 4th level of the include tree.\n #\n # This is not the most optimized solution, but works well enough as if the\n # author's posts match previously cloned posts, they won't be cloned as they'll\n # exist in the cloned resources dictionary.\n next if path.length >= 4 &&\n path[-4] == path[-2] &&\n path[-2] == reflection_name &&\n path[-3] == path[-1]\n\n hash[reflection_name] = {}\n\n unless (reflection = resource.class.reflections[reflection_name.to_s])\n next\n end\n\n reflection_options = hash[reflection_name]\n association_target = resource.send(reflection_name)\n\n if reflection.collection?\n association_target.each do |nested_resource|\n add_reflection_options(\n reflection_options,\n nested_resource,\n [*path, reflection_name]\n )\n end\n else\n add_reflection_options(\n reflection_options,\n association_target,\n [*path, reflection_name]\n )\n end\n end\n\n # Add the :except array from the resource to the current options hash and merge\n # it if one already exist from another resource of the same class.\n options[:except] ||= []\n options[:except] |= Array.wrap(cloneable_options[:except])\n\n options\n end",
"def get_collection_select_options(c, level=0)\n retval = []\n#=begin\n #TODO: will have to pass in user instead of using current_user\n if not collection_is_viewable(c, current_user)\n return retval\n end\n#=end\n retval << [('-' * level) + c.name, c.id]\n c.children.each do |child_c|\n get_collection_select_options(child_c, level + 1).each do |child_c|\n retval << child_c\n end\n end\n \n return retval\n end",
"def build_options_and_select(type, selected, options = T.unsafe(nil)); end",
"def select_options\n (first_level_options || []).map { |o| [o.name, o.id] }\n end",
"def grouped_elements_for_select(elements, object_method = 'name')\n return \"\" if elements.blank?\n cells_definition = @page.cell_definitions\n return \"\" if cells_definition.blank?\n options = {}\n celled_elements = []\n cells_definition.each do |cell|\n cell_elements = elements.select { |e| cell['elements'].include?(e.class.name == 'Element' ? e.name : e['name']) }\n celled_elements += cell_elements\n optgroup_label = Cell.translated_label_for(cell['name'])\n options[optgroup_label] = cell_elements.map do |e|\n element_array_for_options(e, object_method, cell)\n end\n end\n other_elements = elements - celled_elements\n unless other_elements.blank?\n optgroup_label = _t(:main_content)\n options[optgroup_label] = other_elements.map do |e|\n element_array_for_options(e, object_method)\n end\n end\n return grouped_options_for_select(options)\n end",
"def association_ajax_select_tag(id, record, reflection)\n if reflection.klass.scaffold_use_auto_complete\n scaffold_text_field_tag_with_auto_complete(id, reflection.klass)\n else\n singular_class = record.class\n foreign_key = reflection.options[:foreign_key] || singular_class.table_name.classify.foreign_key\n association_foreign_key = reflection.options[:association_foreign_key] || reflection.klass.table_name.classify.foreign_key\n join_table = reflection.options[:join_table] || ( singular_class.table_name < reflection.klass.table_name ? '#{singular_class.table_name}_#{reflection.klass.table_name}' : '#{reflection.klass.table_name}_#{singular_class.table_name}')\n items = reflection.klass.find(:all, :order => reflection.klass.scaffold_select_order, :conditions =>[\"#{reflection.klass.table_name}.#{reflection.klass.primary_key} NOT IN (SELECT #{association_foreign_key} FROM #{join_table} WHERE #{join_table}.#{foreign_key} = ?)\", record.id], :include=>reflection.klass.scaffold_include)\n select_tag(id, \"<option></option>\" << items.collect{|item| \"<option value='#{item.id}' id='#{id}_#{item.id}'>#{h item.scaffold_name}</option>\"}.join(\"\\n\"))\n end\n end",
"def select_with_grouped_options(object, method, choices, selected_key = nil, prompt = nil)\n name = object.class.name.downcase\n html = \"<select id=\\\"#{name}_#{method}\\\" name=\\\"#{name}[#{method}]\\\">\"\n html += grouped_options_for_select(choices, selected_key, prompt)\n html += \"</select>\"\n end",
"def nested_options_for(record)\n if self.parent\n association = self.association\n attr_name = [:one,:many_to_many].include?(association.macro) ? :id : association.foreign_key\n association_record = if association.through? && record.send(association.through)\n record.send(association.through)\n elsif association.macro == :one\n record.send(association.name)\n else\n record\n end\n attr_value = association_record && association_record.id\n base_options = {\n attr_name => attr_value,\n :parent => self.root.dbi.klass.to_s,\n :path => self.parents.map{|parent| parent.is_a?(Lolita::Configuration::List) ? \"l_\" : \"c_#{parent.name}\"}\n }\n if association.macro == :many_to_many\n base_options.merge({\n :association => association.name\n })\n end\n {:nested => base_options}\n end\n end",
"def create_from_select(model_handle, field_set, select_ds, override_attrs = {}, opts = {})\n # TODO: temp for debugging; there are top level objects that can mistakenly trigger this\n unless model_handle[:parent_model_name]\n unless (not Model.has_group_id_col?(model_handle)) || TOP_LEVEL_MODEL_NAMES.include?(model_handle[:model_name])\n Log.info_pp(['missing :parent_model_name in create_from_select', model_handle, caller[0..10]])\n end\n end\n\n duplicate_refs = opts[:duplicate_refs] || :allow #other alternatives: #:no_check | :error_on_duplicate | :prune_duplicates\n overrides = override_attrs.dup #because can remove elements\n set_updated_at!(overrides)\n set_created_at!(overrides)\n # TODO: benchmark point pp [:create_from_select,duplicate_refs]\n user_info_assigns = DB.user_info_for_create_seleect(overrides, model_handle)\n\n # modify ds and its columns in concert\n select_info = { cols: field_set.cols, ds: select_ds.sequel_ds.ungraphed.from_self } #ungraphed and from_self just to be safe\n # processing to take into account c\n add_cols_to_select!(select_info, { c: user_info_assigns[:c] }, from_self: [:end])\n\n # parent_id_col can be null\n parent_id_col = model_handle.parent_id_field_name?()\n\n db_rel = DB_REL_DEF[model_handle[:model_name]]\n ds = dataset(db_rel)\n # modify sequel_select to reflect duplicate_refs setting\n unless duplicate_refs == :no_check\n match_cols = [:c, :ref, parent_id_col].compact\n # need special processing of ref override; need to modify match_cols and select_on_match_cols\n if ref_override = overrides.delete(:ref)\n add_cols_to_select!(select_info, { ref: ref_override }, dont_add_cols: true, from_self: [:end])\n end\n\n case duplicate_refs\n when :prune_duplicates\n # TODO: bug here\n select_info[:ds] = select_info[:ds].join_table(:left_outer, ds, match_cols, table_alias: :existing).where(existing__c: nil)\n when :error_on_duplicate\n # TODO: not right yet\n duplicate_count = select_info[:ds].join_table(:inner, ds, match_cols).count\n if duplicate_count > 0\n # TODO: make this a specfic error\n fail Error.new(\"found #{duplicate_count} duplicates\")\n end\n when :allow\n ds_to_group = select_info[:ds].join_table(:inner, ds, match_cols, table_alias: :existing)\n max_col = SQL::ColRef.max { |o| o.coalesce(:existing__ref_num, 1) }\n max_ref_num_ds = ds_to_group.group(*match_cols).select(*(match_cols + [max_col]))\n\n add_cols_to_select!(select_info, ref_num: SQL::ColRef.case { [[{ max: nil }, nil], :max + 1] })\n select_info[:ds] = select_info[:ds].join_table(:left_outer, max_ref_num_ds, match_cols)\n end\n end\n\n # process overrides\n # TODO: may need a from self prefix instead of optional from_self post fix and in general try to remove unnecessay from selfs\n add_cols_to_select!(select_info, user_info_assigns.merge(overrides), from_self: [:beg])\n\n # final ones to select and add\n sequel_select_with_cols = select_info[:ds]\n columns = select_info[:cols]\n\n # fn tries to return ids depending on whether db adater supports returning_id\n ret = nil\n if ds.respond_to?(:insert_returning_sql)\n returning_ids = []\n\n returning_sql_cols = [:id, :display_name]\n returning_sql_cols << parent_id_col.as(:parent_id) if parent_id_col\n if opts[:returning_sql_cols]\n returning_sql_cols += opts[:returning_sql_cols]\n returning_sql_cols.uniq!\n end\n\n sql = ds.insert_returning_sql(returning_sql_cols, columns, sequel_select_with_cols)\n\n if Model.debug_flag?\n Model.pp_sql_debug(sql, 'INSERT STATMENT')\n end\n\n # TODO: benchmark point pp [:create_from_select,sql]\n fetch_raw_sql(sql) { |row| returning_ids << row }\n IDInfoTable.update_instances(model_handle, returning_ids) unless opts[:do_not_update_info_table]\n ret = opts[:returning_sql_cols] ?\n process_json_fields_in_returning_ids!(returning_ids, db_rel) :\n ret_id_handles_from_create_returning_ids(model_handle, returning_ids)\n else\n ds.import(columns, sequel_select_with_cols)\n # TODO: need to get ids and set\n fail Error.new('have not implemented create_from_select when db adapter does not support insert_returning_sql not set')\n end\n ret\n end",
"def options_for_select(option_items, state = {})\n return [] if option_items.count == 0\n option_items.map do |caption, value, attributes|\n html_attributes = { :value => value || caption }.merge(attributes||{})\n html_attributes[:selected] ||= option_is_selected?(html_attributes[:value], caption, state[:selected])\n html_attributes[:disabled] ||= option_is_selected?(html_attributes[:value], caption, state[:disabled])\n content_tag(:option, caption, html_attributes)\n end\n end",
"def effective_selection_set\n ids = Set.new\n items.map do |parent, children|\n if selected.include?(parent.id)\n ids << parent.id\n ids += children.map(&:id)\n else\n ids += children.select do |child|\n selected_children.include?(child.id)\n end.map(&:id)\n end\n end\n ids.to_a\n end",
"def indent_child_options_for_category_select(parent, category, child_indent = \" \")\n html_code = \"\"\n parent.children.each do |child|\n options = {:value => child.id}\n options = options.merge({:selected=>\"selected\"}) if child == category\n html_code += tag(\"option\", options, true) + child_indent + child.name + \"</option>\" + indent_child_options_for_category_select(child, category, child_indent + child_indent)\n end\n html_code\n end",
"def option_foreign_key_choices(object, foreign_key, foreign_key_choices_array)\n html = []\n foreign_key_choices_array.each do |choice|\n html <<\n \"<option value = #{choice.id} \n #{is_selected_html?(object, foreign_key, choice)}>\n #{choice.name}\n </option>\"\n end\n html.join\n end",
"def build_select(type, select_options_as_html)\n select_options = {\n id: input_id_from_type(type),\n name: input_name_from_type(type)\n }.merge!(@html_options)\n select_options[:disabled] = \"disabled\" if @options[:disabled]\n select_options[:class] = css_class_attribute(type, select_options[:class], @options[:with_css_classes]) if @options[:with_css_classes]\n\n select_html = +\"\\n\"\n select_html << content_tag(\"option\", \"\", value: \"\", label: \" \") + \"\\n\" if @options[:include_blank]\n select_html << prompt_option_tag(type, @options[:prompt]) + \"\\n\" if @options[:prompt]\n select_html << select_options_as_html\n\n (content_tag(\"select\", select_html.html_safe, select_options) + \"\\n\").html_safe\n end",
"def merge_finder_options_with_or!(options={})\n options.reject! {|k,v| v.blank?}\n self[:select] = [self[:select], options.delete(:select)].compact.join(\", \")\n self[:conditions] = ActiveRecord::Base.sanitize_and_merge_conditions_with_or(self[:conditions], options.delete(:conditions))\n self[:order] = ActiveRecord::Base.sanitize_and_merge_order(self[:order], options.delete(:order))\n self[:joins] = ActiveRecord::Base.sanitize_and_merge_joins(self[:joins], options.delete(:joins))\n self.reject! {|k,v| v.blank?}\n self.merge!(options)\n end",
"def options_from_tree(tree, options={})\n option_list = []\n depth = options[:depth] || 0\n exception = options[:except]\n tree.each_pair do |key, values|\n unless key == exception\n option_list << [\". \" * depth + key.name, key.id]\n option_list << options_from_tree(values, :depth => depth + 1, :except => exception) if values.any?\n end\n end\n option_list.compact\n end",
"def build_options(selected, options = T.unsafe(nil)); end",
"def merge_finder_options_with_or(options={})\n result = self.dup\n options.reject! {|k,v| v.blank?}\n result[:select] = [self[:select], options.delete(:select)].compact.join(\", \")\n result[:conditions] = ActiveRecord::Base.sanitize_and_merge_conditions_with_or(self[:conditions], options.delete(:conditions))\n result[:order] = ActiveRecord::Base.sanitize_and_merge_order(self[:order], options.delete(:order))\n result[:joins] = ActiveRecord::Base.sanitize_and_merge_joins(self[:joins], options.delete(:joins))\n result.reject {|k,v| v.blank?}.merge(options)\n end",
"def option_tags_for(options_array = [], assoc = nil, object = nil, attribute = nil, prompt = nil, selected = nil)\n option_tags = prompt ? [\"<option value=''>#{prompt}</option>\"] : []\n\n case assoc\n when :models_views\n models_view = self.models_views.find_by_view_id(object)\n\n options_array.each do |option|\n option_tags << _option_tag(attribute, option, (models_view && models_view.view_type == option.to_s))\n end\n \n else # => no assoc object, or the blocks_model_object\n options_array.each do |option|\n option_tags << _option_tag(attribute, option, _should_be_selected?(object, attribute, option, selected))\n end\n end\n\n option_tags\n end",
"def get_category_select_options(c, level=0)\n retval = []\n retval << [('-' * level) + c.name, c.id]\n c.categories.each do |child_c|\n get_category_select_options(child_c, level + 1).each do |child_c|\n retval << child_c\n end\n end\n \n return retval\n end",
"def project_tree_options_for_select_with_multiple_selected(projects, selected, options = {})\n options = project_tree_options_for_select(projects) do |project|\n { :selected => (selected.include?(project) ? 'selected' : nil) }\n end\n return options\n end",
"def add_association_keys_to_select_sub(klass, options)\n select_table_fields = class_primary_key_fields(klass)\n \n if options[:include].class == Symbol || options[:include].class == String\n select_table_fields.concat association_keys_for(klass, options[:include].to_sym)\n elsif options[:include].class == Array\n options[:include].each do |s|\n if s.class == Hash # {:user => :favorites} or {:user => {:favorites => [:books, :movies]}}\n select_table_fields.concat association_keys_for(klass, s.keys[0].to_sym)\n \n # this :include has a nested :include, so continue recursively\n if r = klass.reflections[s.keys[0].to_sym]\n nested_add_options = options.dup\n nested_add_options[:include] = s.values[0]\n select_table_fields.concat add_association_keys_to_select_sub(r.klass, nested_add_options)\n end\n elsif s.class == Symbol || s.class == String\n select_table_fields.concat association_keys_for(klass, s.to_sym)\n end\n end\n elsif options[:include].class == Hash\n select_table_fields.concat association_keys_for(klass, options[:include].keys[0].to_sym)\n \n # this :include has a nested :include, so continue recursively\n if r = klass.reflections[options[:include].keys[0].to_sym]\n nested_add_options = options.dup\n nested_add_options[:include] = options[:include].values[0]\n select_table_fields.concat add_association_keys_to_select_sub(r.klass, nested_add_options)\n end\n end\n \n select_table_fields.uniq\n end",
"def to_dropdown(options = {})\r\n acts_as_dropdown(options) unless options.empty?\r\n find(:all, :conditions => self.conditions_string, :order => self.order_string).to_dropdown(self.dropdown_text_attr.to_sym, self.dropdown_value_attr.to_sym)\r\n end",
"def indent_child_options_for_parent_category_select(category, parent, child_indent = \" \")\n html_code = \"\"\n parent.children.each do |child|\n options = {:value => child.id}\n options = options.merge({:selected=>\"selected\"}) if child == category.parent\n html_code += tag(\"option\", options, true) + child_indent + child.name + \"</option>\" + indent_child_options_for_parent_category_select(category, child, child_indent + child_indent) unless child==category\n end\n html_code\n end",
"def unassigned_if_allowed(klass, relationship, items)\n return \"<option value='nil' #{'selected' unless items}>Unassigned</option>\" unless klass.respond_to?(\"reflect_on_validations_for\")\n require 'facet/module/alias_method_chain' unless Module.respond_to?('alias_method_chain')\n return \"<option value='nil' #{'selected' unless items}>Unassigned</option>\" unless Module.respond_to?('alias_method_chain')\n \n if klass.reflect_on_validations_for(relationship).collect {|v| v.macro}.include?(:validates_associated)\n return \"\"\n else\n return \"<option value='nil' #{'selected' unless items}>Unassigned</option>\"\n end\n end",
"def format_select\n @attr[:multiple] = :multiple if @opts[:multiple]\n copy_options_to_attributes([:size])\n\n os = process_select_optgroups(:_format_select_optgroup) do |label, value, sel, attrs|\n if !value.nil? || sel\n attrs = attrs.dup\n attrs[:value] = value unless value.nil?\n attrs[:selected] = :selected if sel\n end\n tag(:option, attrs, [label])\n end\n tag(:select, @attr, os)\n end",
"def find_options_for_type(options={})\n {:conditions => [\"kases.type IN (?)\", self_and_subclasses.map(&:name)]}.merge_finder_options(options)\n end",
"def child_options\n @child_options ||= sorted_children.includes(:option).map(&:option)\n end",
"def as_json(options = {})\n super(options.merge(except: %w[association_class unfiltered_collection collection]))\n end",
"def options_with_specifications\n @options_with_specs ||= options.select{|x| x.has_input?}.sort_by{|x| x.option_set.name}\n end",
"def build_selects_from_types(order)\n select = +\"\"\n first_visible = order.find { |type| !@options[:\"discard_#{type}\"] }\n order.reverse_each do |type|\n separator = separator(type) unless type == first_visible # don't add before first visible field\n select.insert(0, separator.to_s + public_send(\"select_#{type}\").to_s)\n end\n select.html_safe\n end",
"def valid_times_as_select_options()\n self.valid_times.size()==0 ? \n ValidTime.default.select_options() :\n self.valid_times_sorted.inject([]){|opt,vt| opt + vt.select_options()}\n end",
"def option_tags_for(select_options, options = {})\r\n select_options.insert(0,[as_('- select -'),nil]) if options[:include_blank]\r\n select_options.collect do |option|\r\n label, value = option[0], option[1]\r\n value.nil? ? \"<option value=\"\">#{label}</option>\" : \"<option value=\\\"#{value}\\\">#{label}</option>\"\r\n end\r\n end",
"def setup\n FightTheMelons::Helpers::FormMultipleSelectHelperConfiguration.outer_class = nil\n FightTheMelons::Helpers::FormMultipleSelectHelperConfiguration.inner_class = nil\n FightTheMelons::Helpers::FormMultipleSelectHelperConfiguration.level_class = nil\n FightTheMelons::Helpers::FormMultipleSelectHelperConfiguration.alternate_class = 'alt'\n FightTheMelons::Helpers::FormMultipleSelectHelperConfiguration.alternate = false\n FightTheMelons::Helpers::FormMultipleSelectHelperConfiguration.position = :right\n end",
"def build_forum_chooser_options(forums, selected = nil, options = [])\n for forum in forums\n if forum.is_root? && !forum.is_forum.nil?\n options.push([\"#{forum.title}\", forum.id])\n build_child_chooser_options(forum.descendants.arrange(:order => :display_order), options)\n end\n end\n\n options_for_select(options, :selected => selected)\n end",
"def resolve_inclusions(items)\n items.combination(2){|parent, child|\n if parent.include? child\n items.delete(child)\n end\n }\n items\n end",
"def filter_options(attr_class_option_ids)\n sql = %{\n SELECT DISTINCT CASE WHEN attributable_type=:product THEN\n attributable_id ELSE product_id END AS p_id\n FROM product_attributes pa\n JOIN attribute_options ao ON ao.id=pa.value_id\n LEFT JOIN product_search_products psp\n ON psp.search_product_id=attributable_id\n AND pa.attributable_type=:search_product\n WHERE attributable_type IN (:product, :search_product)\n AND value_type=:attribute_options\n AND ao.attribute_class_option_id IN (:attr_class_option_ids)\n }\n query = sanitize_sql_array [sql,\n {\n product: SitescanCommon::Product,\n search_product: SitescanCommon::SearchProduct,\n attribute_options: SitescanCommon::AttributeOption,\n attr_class_option_ids: attr_class_option_ids\n }]\n connection.select_values query\n end",
"def reset_options_for_select\n Specification.reset_options_for_select\n end",
"def build_drop_down_for_klasses\n @drop_down_for_klasses = @klasses.inject([]) do |result,klass|\n result << [klass.name, admin_data_list_url(:klass => klass.name)]\n end\n end",
"def form_tr_select_cat_from_tree(form, obj, root, name, col, id, display_name, selected_obj, *args)\n options = args.extract_options!\n out = ''\n out += '<tr><td class=\"label\">'\n out += form.label col.to_sym, name\n out += ' : </td>'\n out += '<td class=\"field\">'\n out += select_cat_from_tree(obj, col, root, selected_obj, options)\n out += '</td></tr>'\n return out\n end",
"def find_options_for_visible(options={})\n {:conditions => [\"kases.status NOT IN (?) AND kases.template != ?\", [\"created\", \"suspended\", \"deleted\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end",
"def indented_child_options type, parent, depth=0, selected_id\n\n result = []\n unless parent.children.empty?\n parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|\n child_path = send(\"#{type.model_name.underscore}s_path\", :uri=>child.term_uri, :label=> child.title)\n assay_stat = child.assays.size == 0 ? \"\" : \"<span style='color: #666666;'>(#{child.assays.count} assays)</span>\".html_safe\n ontology_term_li = link_to(child.title, child_path).html_safe\n user_defined_term_li = link_to(child.title, child_path, {:style => \"color:green;font-style:italic\"}) + \"*\" + \" \" +\n (child.can_edit? ? link_to(image(\"edit\"), edit_polymorphic_path(child), {:style => \"vertical-align:middle\"}) : \"\") + \" \" +\n (child.can_destroy? ? (child.assays.count == 0 && child.children.empty? ? link_to(image(\"destroy\"), child, :confirm =>\n \"Are you sure you want to remove this #{child.class.name}? This cannot be undone.\",\n :method => :delete, :style => \"vertical-align:middle\") : \"\") : \"\").html_safe\n child_link = (child.respond_to?(:is_user_defined) && child.is_user_defined) ? user_defined_term_li : ontology_term_li\n\n result << (\"<li style=\\\"margin-left:#{12*depth}px;#{child.id == selected_id ? \"background-color: lightblue;\" : \"\"}\\\">\"+ (depth>0 ? \"└ \" : \" \") + child_link + assay_stat +\n \"</li>\")\n result = result + indented_child_options(type, child, depth+1,selected_id) if child.has_children?\n end\n end\n return result\n end",
"def create_select_options(choice, collection, options={})\n options[:text] ||= 'name'\n options[:value] ||= 'id'\n options[:include_blank] = true if options[:include_blank].nil?\n options[:clear] ||= []\n pre = options[:include_blank] ? \"<option value=\"\">\"\"</option>\" : \"\"\n collection.each { |c| pre << \"<option value=#{c.send(options[:value])} #{\"selected=\\\"selected\\\"\" if choice == c.send(options[:value])}>#{c.send(options[:text])}</option>\" }\n pre\n end",
"def selected_options\n options.select { |e| e.selected? }\n end",
"def grouped_options_for_select(collection, state = {})\n collection.map do |item|\n caption = item.shift\n attributes = item.last.kind_of?(Hash) ? item.pop : {}\n value = item.flatten(1)\n attributes = value.pop if value.last.kind_of?(Hash)\n html_attributes = { :label => caption }.merge(attributes||{})\n content_tag(:optgroup, options_for_select(value, state), html_attributes)\n end\n end",
"def licence_options_for_select\n LicenceDictionary.instance.options_for_select\n end",
"def options_for_select_with_style( container, selected=nil )\n container = container.to_a if Hash === container\n options_for_select = container.inject([]) do |options, element|\n text, value = option_text_and_value(element)\n selected_attribute = ' selected=\"selected\"' if option_value_selected?(value, selected)\n style = \" style=\\\"#{element[1]}\\\"\" if element[1] && element[1]!=value\n options << %(<option value=\"#{html_escape(value.to_s)}\"#{selected_attribute}#{style}>#{html_escape(text.to_s)}</option>)\n end\n options_for_select.join(\"\\n\")\n end",
"def nested_has_many_classes\n has_many_classes.select{|k| nested_attributes.include?(k)}\n end",
"def selected_options\n options.select { |e| e.selected? }\n end",
"def selected_options\n @_node.getSelectedOptions.map { |node| Node.new(node) }\n end",
"def select_cat_from_tree(obj, col, root, selected_obj, *args)\n options = args.extract_options!\n select_name = obj + '[' + col.to_s + ']'\n out = \"<select name='#{select_name}' onchange => update_category('#{obj}', facture)>\"\n out << select_cat_from_tree_recurs(root, selected_obj)\n out << \"</select>\"\n end",
"def grouped_collection_select(object, method, collection, group_method, group_label_method, option_key_method, option_value_method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end",
"def options_for_multiselect_match( object, method, match = \"\", options = {} )\n #allow specifying fully qualified class name for model object\n class_name = options[:class_name] || object\n model = get_object(class_name)\n items = get_autocomplete_items(:model => model, :options => options, :term => match, :method => method)\n options_from_collection_for_select(items, :to_param, options[:display_value] ||= method)\n end",
"def options_for_select_with_out(container, selected = nil, out = nil)\n if out.blank?\n options_for_select container, selected\n elsif out.is_a?(Array) && out.all?{|s| s.is_a?(String)}\n container = container.to_a if Hash === container\n new_container = container.inject([]) do |sum, element|\n unless out.include?(element) || (element.is_a?(Array) && out.include?(element.first))\n sum << element\n end\n sum\n end\n options_for_select new_container, selected\n else\n fail \"out '#{out}' is not adequate.\"\n end\n end",
"def collect_tier_categories_for_select(klass, select=true)\n result = klass.find_all_categories.map {|c| [c.name, c.id]}\n result.insert(0, [\"Select...\".t, nil])\n result\n end",
"def selected_options\n @options.find_all { |o| o.selected? }\n end",
"def full_set(options = {})\n return [self] if new_record? or self[nested_set_right]-self[nested_set_left] == 1\n [self] + all_children(options)\n end",
"def nested_belongs_to_classes\n belongs_to_classes.select{|k| nested_attributes.include?(k)}\n end",
"def selected_options\n options.select(&:selected?)\n end",
"def add_association_keys_to_select(options)\n return options[:select] unless options[:include]\n select_table_fields = split_table_fields(options[:select])\n select_table_fields.concat add_association_keys_to_select_sub(self, options)\n reform_select_from_fields(select_table_fields.uniq)\n end",
"def prepare_select\n @group_items = GroupItem.all\n end",
"def build_selected_options options=nil\n options ||= vote_proposal_options\n options.map(&:name).sort.join(\"|\") \n end",
"def assignee_menu( mt_req, building, tag_name = \"mtreq_assignee\" )\n # build the array from which we will build the select\n arr = [];\n if building!=nil && building.has_mt_company?\n \n if building.has_mt_manager?\n arr << [ \"#{building.mt_manager.hr_name} (#{ loc.term(Localization::BUILDING_MANAGER)})\",\n unique_obj_id(building.mt_manager) ];\n else\n #arr << [ \"mt_building_manager == nil\", \"xxx\"];\n end\n \n building.mt_company.workers.each do | wkr | \n if ( wkr.role.professional? )\n arr << [ \"#{wkr.role.name} (#{wkr.hr_name})\", unique_obj_id(wkr) ];\n end\n end\n \n arr << [ \"#{building.mt_company.name} (#{loc.term(Localization::MT_COMPANY)})\", \n unique_obj_id(building.mt_company) ];\n else\n if mt_req.has_mt_company?\n mt_req.mt_company.workers.each do | wkr | \n if ( wkr.role.professional? )\n arr << [ \"#{wkr.role.name} (#{wkr.hr_name})\", unique_obj_id(wkr) ];\n end\n end \n end \n end\n \n if building.respond_to?(:has_owner) && building.has_owner?\n arr << [ \"#{building.building_owner} (#{loc.term(Localization::BUILDING_OWNER)})\",\n unique_obj_id(building.building_owner) ];\n end\n \n # TODO add vaad.\n \n selected_id = \"\";\n selected_id = unique_obj_id(mt_req.assignee) unless mt_req.nil?\n \n return \"<select id='#{tag_name.gsub(\"[\",\"_\").gsub(\"]\",\"\")}' name='#{tag_name}'>\n #{options_for_select(arr, selected_id)}\n </select>\"; \n end",
"def tag_select_cat_from_tree(obj, root, col, id, display_name, selected_obj, *args)\n options = args.extract_options!\n out = ''\n out += select_cat_from_tree_for_tag(obj, col, root, selected_obj, options)\n return out\n end",
"def objectify_options(options)\n super.except(:label)\n end",
"def to_search_options\n @options.select { |key, value| value.present? }\n end",
"def options_for_select\n choices.map do |choice|\n data = {}\n data[\"choice-category\"] = choice.category_id if choice.category_id\n\n content_tag(\n :option,\n choice.short_name,\n :value => choice.id,\n :selected => selected_choice?(item, choice),\n :data => data\n )\n end.join.html_safe\n end",
"def option_sets_for_instances\n opt_sets = enabled_questionings.map do |qing|\n if qing.default.present? && qing.default =~ ODK::DynamicPatternParser::VALUE_REGEX\n referenced_option_sets(qing)\n end\n end\n opt_sets.flatten.compact.uniq\n end",
"def merge_finder_options_with_and!(options={})\n options.reject! {|k,v| v.blank?}\n self[:select] = [self[:select], options.delete(:select)].compact.join(\", \")\n self[:conditions] = ActiveRecord::Base.sanitize_and_merge_conditions_with_and(self[:conditions], options.delete(:conditions))\n self[:order] = ActiveRecord::Base.sanitize_and_merge_order(self[:order], options.delete(:order))\n self[:joins] = ActiveRecord::Base.sanitize_and_merge_joins(self[:joins], options.delete(:joins))\n self.reject! {|k,v| v.blank?}\n self.merge!(options)\n end",
"def unchosen\n the_set = []\n self.itemlist.each { |k,v| the_set << self.object(k).unchosen }\n the_set\n end",
"def ancestry_options(items, &block)\n return ancestry_options(items){ |i| \"#{'-' * i.depth} #{i.name}\" } unless block_given?\n\n result = []\n items.map do |item|\n result << {\"name\" => yield(item), \"id\" => item.id}\n end\n result\n end",
"def select_options values, options = {}\n normalize_select_prompt values, options\n values.map do |key, value|\n if value.is_a? Hash\n Tagz.tag :optgroup, select_options(value, options), :label => key\n elsif option_selected? key, options[:selected]\n select_option key, value, :selected => true\n else\n select_option key, value\n end\n end.join\n end",
"def without_empty_sets\n collection = clone\n collection.sets.reject!(&:empty?)\n collection\n end",
"def fee_roles_options_for_select(selected)\n options_for_select([[l(:label_all), ''],\n [l(:role_manager), FeeConst::ROLE_MANAGER.to_s],\n [l(:role_author), FeeConst::ROLE_AUTHOR.to_s],\n [l(:role_vip), FeeConst::ROLE_VIP.to_s],\n [l(:role_abbonato), FeeConst::ROLE_ABBONATO.to_s],\n [l(:role_registered), FeeConst::ROLE_REGISTERED.to_s],\n [l(:role_renew), FeeConst::ROLE_RENEW.to_s],\n [l(:role_expired), FeeConst::ROLE_EXPIRED.to_s],\n [l(:role_archivied), FeeConst::ROLE_ARCHIVIED.to_s]\n ], selected.to_s)\n end",
"def api_add_select(model, association, klass, options, html_options = nil)\n html_options ||= {}\n name, url, i18n_key = get_api_relationship_info(model, association, :add)\n new_options = {\n title: t(i18n_key % 'button'),\n data: {\n class: 'SelectPicker', live_search: true, size: 5, type: :jsonapi,\n handling: {method: 'POST', url: url, data: [type: klass.model_name.plural, id: '{id}']},\n 'success-message': t((i18n_key % 'message') + 'Success', model: get_name_for(model))\n }\n }\n select_tag name, options, html_options.deep_merge(new_options)\n end",
"def list_selected_options\n list_selected_options = []\n @selected_options.each do |option|\n list_selected_options << option.type\n end\n return list_selected_options\n end",
"def selected_options; end",
"def selected_options; end",
"def roots\n self.find(:all, :conditions => \"(#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end",
"def nested_options(name, options = {})\n nested = []\n yield(nested) if block_given?\n options.merge!(name => nested) unless nested.empty?\n options\n end",
"def get_query_options(&block)\n ActsAsRecursiveTree::Options::QueryOptions.from(&block)\n end",
"def options_html(type, is_person, super_entity, cid=\"00\", return_type=\"html\")\n sel_flag = true\n sel_str = \"\"\n\n poa_str = \" (Principal Entity) \"\n poa_str = \" (Principal Individual) \" if is_person == \"true\"\n\n array_result = []\n select_one_html = \"<option value=''>Select One...</option>\"\n result = \"\"\n\n if is_person == \"true\"\n groups = {}\n\n case type\n when \"stockholder\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n when \"principal\"\n person_true_entities = current_user.entities_list(super_entity).where(type_: [1, 2, 4]).order(type_: :asc)\n when \"agent\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2]).where('id != ?', super_entity.principal.entity_id).order(type_: :asc)\n when \"settlor\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n when \"trustee\"\n if super_entity.beneficiaries.select(:entity_id).map(&:entity_id).blank?\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 3, 4]).order(type_: :asc)\n else\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 3, 4]).where('id not in (?)', super_entity.beneficiaries.select(:entity_id).map(&:entity_id)).order(type_: :asc)\n end\n when \"beneficiary\"\n if super_entity.trustees.select(:entity_id).map(&:entity_id).blank?\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n else\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).where('id not in (?)', super_entity.trustees.select(:entity_id).map(&:entity_id)).order(type_: :asc)\n end\n when \"member\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n when \"manager\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n when \"general-partner\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n when \"limited-partner\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n when \"partner\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 3, 4]).order(type_: :asc)\n when \"limited-liability-partner\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 3, 4]).order(type_: :asc)\n when \"director\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 3]).order(type_: :asc)\n when \"officer\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 3]).order(type_: :asc)\n when \"tenant-in-common\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n when \"spouse\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 3, 4]).order(type_: :asc)\n when \"joint-tenant\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1, 2, 3, 4]).order(type_: :asc)\n when \"guardian\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1]).order(type_: :asc)\n when \"ward\"\n person_true_entities = current_user.entities_list(super_entity.id).where(type_: [1]).order(type_: :asc)\n else\n person_true_entities = []\n end\n\n person_true_entities.each do |entity|\n key = \"#{MemberType.member_types[entity.type_]}\"\n key = key + poa_str if !key.match(\"ttorney\").nil?\n if groups[key].nil?\n groups[key] = [entity]\n else\n groups[key] << entity\n end\n end\n\n case type\n when \"stockholder\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Corporate Stockholder', user_id: current_user.id)\n when \"principal\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Principal', user_id: current_user.id)\n when \"agent\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Agent', user_id: current_user.id)\n when \"settlor\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Settlor', user_id: current_user.id)\n when \"trustee\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Trustee', user_id: current_user.id)\n when \"beneficiary\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Beneficiary', user_id: current_user.id)\n when \"member\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'LLC Member', user_id: current_user.id)\n when \"manager\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'LLC Outside Manager', user_id: current_user.id)\n when \"general-partner\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'LP General Partner', user_id: current_user.id)\n when \"limited-partner\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'LP Limited Partner', user_id: current_user.id)\n when \"partner\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Partner', user_id: current_user.id)\n when \"limited-liability-partner\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Limited Liability Partner', user_id: current_user.id)\n when \"director\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Corporate Director', user_id: current_user.id)\n when \"officer\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Corporate Officer', user_id: current_user.id)\n when \"tenant-in-common\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Tenant in Common', user_id: current_user.id)\n when \"spouse\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Tenant by Entirety', user_id: current_user.id)\n when \"joint-tenant\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Joint Tenant', user_id: current_user.id)\n when \"judge\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Judge', user_id: current_user.id)\n when \"guardian\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Guardian', user_id: current_user.id)\n when \"ward\"\n person_true_contacts = Contact.all.where(is_company: false, contact_type: 'Client Participant', role: 'Ward', user_id: current_user.id)\n else\n person_true_contacts = []\n end\n\n groups.each do |k,v|\n result += \"<optgroup label='#{k}'>\"\n v.each do |entity|\n if (sel_flag && \"e#{entity.id}\" == cid) || (person_true_entities.count + person_true_contacts.count == 1)\n sel_flag = false\n sel_str = \" selected='selected' \"\n else\n sel_str = \"\"\n end\n result += \"<option value='e#{entity.id}' data-type='entity' #{sel_str}>#{entity.name} </option>\"\n array_result << [entity.id, entity.name]\n end\n result += \"</optgroup>\"\n end\n\n result += \"<optgroup label='Contacts'>\"\n\n person_true_contacts.each do |contact|\n if (sel_flag && \"c#{contact.id}\" == cid) || (person_true_entities.count + person_true_contacts.count == 1)\n sel_flag = false\n sel_str = \" selected='selected' \"\n else\n sel_str = \"\"\n end\n result += \"<option value='c#{contact.id}' data-type='contact' #{sel_str}>#{contact.name}</option>\"\n array_result << [contact.id, contact.name]\n end\n\n result += \"</optgroup>\"\n if return_type == 'html'\n if array_result.length > 1\n return (select_one_html + result).html_safe\n else\n return result.html_safe\n end\n else\n return array_result\n end\n\n else\n groups = {}\n\n case type\n when \"stockholder\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [6, 10, 11, 12, 13, 14]).order(type_: :asc)\n when \"principal\"\n person_false_entities = current_user.entities_list(super_entity).where(type_: [6, 10, 11, 12, 13, 14]).order(type_: :asc)\n when \"agent\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [10, 11, 12, 13, 14]).where('id != ?', super_entity.principal.entity_id).order(type_: :asc)\n when \"trustee\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [10, 11, 12, 13, 14]).order(type_: :asc)\n when \"beneficiary\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [6]).order(type_: :asc)\n when \"member\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [6, 10, 11, 12, 13, 14]).order(type_: :asc)\n when \"manager\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [10, 11, 12, 13, 14]).order(type_: :asc)\n when \"general-partner\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [10, 11, 12, 13, 14]).order(type_: :asc)\n when \"limited-partner\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [10, 11, 12, 13, 14]).order(type_: :asc)\n when \"tenant-in-common\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [6, 10, 11, 12, 13, 14]).order(type_: :asc)\n when \"guardian\"\n person_false_entities = current_user.entities_list(super_entity.id).where(type_: [14]).order(type_: :asc)\n else\n person_false_entities = []\n end\n\n person_false_entities.each do |entity|\n key = \"#{MemberType.member_types[entity.type_]}\"\n key = key + poa_str if !key.match(\"ttorney\").nil?\n if groups[key].nil?\n groups[key] = [entity]\n else\n groups[key] << entity\n end\n end\n\n case type\n when \"stockholder\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'Corporate Stockholder', user_id: current_user.id)\n when \"principal\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'Principal', user_id: current_user.id)\n when \"agent\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'Agent', user_id: current_user.id)\n when \"trustee\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'Trustee', user_id: current_user.id)\n when \"member\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'LLC Member', user_id: current_user.id)\n when \"manager\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'LLC Outside Manager', user_id: current_user.id)\n when \"general-partner\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'LP General Partner', user_id: current_user.id)\n when \"limited-partner\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'LP Limited Partner', user_id: current_user.id)\n when \"tenant-in-common\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'Tenant in Common', user_id: current_user.id)\n when \"judge\"\n person_false_contacts = Contact.all.where(is_company: true, contact_type: 'Client Participant', role: 'Judge', user_id: current_user.id)\n else\n person_false_contacts = []\n end\n\n groups.each do |k,v|\n result += \"<optgroup label='#{k}'>\"\n v.each do |entity|\n if (sel_flag && \"e#{entity.id}\" == cid) || (person_false_entities.count + person_false_contacts.count == 1)\n sel_flag = false\n sel_str = \" selected='selected' \"\n else\n sel_str = \"\"\n end\n result += \"<option value='e#{entity.id}' data-type='entity' #{sel_str}>#{entity.name} </option>\"\n array_result << [entity.id, entity.name]\n end\n result += \"</optgroup>\"\n end\n\n result += \"</optgroup><optgroup label='Contacts '>\"\n\n person_false_contacts.each do |contact|\n if (sel_flag && \"c#{contact.id}\" == cid) || (person_false_entities.count + person_false_contacts.count == 1)\n sel_flag = false\n sel_str = \" selected='selected' \"\n else\n sel_str = \"\"\n end\n result += \"<option value='c#{contact.id}' data-type='contact' #{sel_str}>#{contact.name}</option>\"\n array_result << [contact.id, contact.name]\n end\n\n result += \"</optgroup>\"\n if return_type == 'html'\n if array_result.length > 1\n return (select_one_html + result).html_safe\n else\n return result.html_safe\n end\n else\n return array_result\n end\n\n end\n end",
"def choices\n choices = serialization_options[:choices]\n ActiveModel::ArraySerializer.new(choices, each_serializer: ChoiceTreeSerializer)\n end",
"def format_select\n @attr[:disabled] = :disabled\n super\n end",
"def select_html(type, options, prefix = nil, include_blank = false, discard_type = false, disabled = false)\n select_html = %(<select name=\"#{prefix || 'date'})\n select_html << \"[#{type}]\" unless discard_type\n select_html << %(\")\n select_html << %( disabled=\"disabled\") if disabled\n select_html << %(>\\n)\n select_html << %(<option value=\"\"></option>\\n) if include_blank\n select_html << options.to_s\n select_html << \"</select>\\n\"\n select_html.html_safe\n end",
"def language_options_for_select(selected = nil, priority_languages = nil)\n language_options = \"\".html_safe\n\n if priority_languages then\n priority_languages_options = priority_languages.map do |code|\n [\n ::LanguageSelect::LANGUAGES[code],\n code\n ]\n end\n\n language_options += options_for_select(priority_languages_options, selected)\n language_options += '<option value=\"\" disabled=\"disabled\">-------------</option>\\n'.html_safe\n #\n # prevents selected from being included\n # twice in the HTML which causes\n # some browsers to select the second\n # selected option (not priority)\n # which makes it harder to select an\n # alternative priority language\n #\n selected = nil if priority_languages.include?(selected)\n end\n\n return language_options + options_for_select(::LanguageSelect::LANGUAGES_FOR_SELECT, selected)\n end",
"def selection_group(fieldname, options={})\n labels = options.delete(:labels)\n title = options.delete(:title) || build_title(fieldname)\n choices = options.delete(:choices)\n selected = options.delete(:selected)\n\n # TODO: Uses option_groups_from_collection_for_select here!\n select_options = ''\n choices.each_with_index do |v,k| #build optiongroup for each given object group\n unless v.empty?\n select_options << \"<optgroup label='#{labels[k]}'>\"\n select_options << @template.options_from_collection_for_select(v, :id, :to_s, selected) #still hardcoded\n select_options << \"</optgroup>\"\n end\n end\n tag_wrapper title, select_tag(fieldname, select_options.html_safe, options)\n end",
"def sel_opts_from_objs(objs, options = {})\n # set default method names\n id_m = options[:id_method] ||= \"id\"\n name_m = options[:name_method] ||= \"name\"\n \n # get array of arrays\n arr = objs.collect do |o| \n # get id and name array\n id = id_m.is_a?(Proc) ? id_m.call(o) : o.send(id_m)\n name = name_m.is_a?(Proc) ? name_m.call(o) : o.send(name_m)\n [name, id]\n end\n \n # wrap in tags if requested\n options[:tags] ? options_for_select(arr) : arr\n end",
"def tree_select_box(nodes, selected= nil, hide= nil, label=\"Parent\", add_initial=false)\n level = 0\n select_box = add_initial ? \"<option value=0>No #{label}</option>\\n\" : \"\"\n selected = nodes[0].id if selected.nil? and not add_initial\n nodes.each {|node| select_box += add_select_tree_node(node, selected, level, hide) }\n select_box += ''\n end",
"def allowed_options(object_type, options)\n Hash[ options.select {|option, value| ALLOWED_OPTIONS[object_type].include?(option) }]\n end"
] |
[
"0.5853356",
"0.58169144",
"0.56734586",
"0.5573087",
"0.54456633",
"0.53816307",
"0.5375258",
"0.53659135",
"0.53654087",
"0.5328789",
"0.5318871",
"0.529789",
"0.5257301",
"0.5209802",
"0.52038795",
"0.5149186",
"0.5141086",
"0.5134187",
"0.5129201",
"0.51081806",
"0.50745785",
"0.5032206",
"0.49967068",
"0.4993041",
"0.4989272",
"0.49801147",
"0.4975181",
"0.49668998",
"0.49557498",
"0.4953729",
"0.49421948",
"0.49352205",
"0.49238265",
"0.48975578",
"0.4887402",
"0.48826894",
"0.4836144",
"0.48100686",
"0.48054996",
"0.48034146",
"0.47864458",
"0.47859746",
"0.4772624",
"0.47560877",
"0.4755932",
"0.47455093",
"0.47452417",
"0.4743284",
"0.47323993",
"0.47225797",
"0.47082767",
"0.46959883",
"0.46947423",
"0.4691544",
"0.46908402",
"0.46826917",
"0.46825528",
"0.4679795",
"0.46733087",
"0.46710297",
"0.46679178",
"0.46564335",
"0.46394095",
"0.4633138",
"0.4631825",
"0.4631181",
"0.46270186",
"0.46009016",
"0.46002644",
"0.45966506",
"0.45742026",
"0.45713314",
"0.45710018",
"0.45694268",
"0.45641133",
"0.4560595",
"0.4558628",
"0.45505965",
"0.45468754",
"0.45435238",
"0.4537908",
"0.45321965",
"0.45272496",
"0.45156467",
"0.45127067",
"0.44971615",
"0.44949305",
"0.44949305",
"0.44885924",
"0.4487115",
"0.44764847",
"0.44734097",
"0.4465955",
"0.44639194",
"0.44595134",
"0.44582546",
"0.44526383",
"0.44514441",
"0.4451403",
"0.44505227"
] |
0.8240456
|
0
|
setter for adding songs to playlist
|
def song_tokens=(tokens)
self.song_ids = Song.ids_from_tokens(tokens)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_songs tracklist, playlist_object\n playlist_object.add_tracks!(tracklist)\n end",
"def add_song(song)\n @songs << song \n end",
"def add_song(song)\n songs << song\n end",
"def add_song(song)\n songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song_to_be_added)\n @songs << song_to_be_added\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n\n end",
"def add_song(x)\n \t@songs << x\n end",
"def add_song(song)\n @songs << song\nend",
"def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n song.artist= self\n @songs << song\n end",
"def add_song(song)\n @@songs << song\n song.artist = self\n end",
"def add_song(song_name)\n songs << song_name\n end",
"def add_song(song)\n @songs << song\n song.artist = self\nend",
"def song_ids=(ids)\n ids.each do |id|\n song = Song.find(id)\n self.songs << song\n end\n end",
"def add_song(song)\n\t\t@songs <<(song)\n\t\t\n\tend",
"def add_song(song)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n\n end",
"def add_song(song)\n song.artist = self unless song.artist == self\n @songs << song unless @songs.include? song\n end",
"def add_song(song) ### arg is song instance ###\n\t\tsong.artist = self\n\t\tsong.artist.songs << song\n\tend",
"def add_song(song)\n @song_list.push(song)\n end",
"def add_song(song)\n song.artist = self unless song.artist == self #the song's artist property here\n @songs << song unless @songs.include?(song)\n end",
"def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end",
"def set_Playlist(value)\n set_input(\"Playlist\", value)\n end",
"def song_ids=(ids)\n ids.each do |id|\n if !id.blank?\n song = Song.find(id)\n \n self.songs << song\n end \n end\n end",
"def add_song(song)\n # Add song to @songs if it doesn't already exist\n @songs << song if !@songs.include?(song)\n # Add artist if not already assigned\n song.artist = self if song.artist ==nil\n save\n end",
"def add_song(song_instance)\n songs << song_instance\n end",
"def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end",
"def add_song(song)\n if song.artist!=self\n song.artist = self\n elsif !@songs.include?(song)\n @songs << song\n end\n end",
"def add_song(song)\n if(!song.artist)\n song.artist = self\n end\n \n if(!self.songs.include?song)\n self.songs << song\n end\n end",
"def add_songs(songs)\n songs.each { |song| add_song(song) }\n end",
"def add_songs(songs)\n songs.each { |song| add_song(song) }\n end",
"def add_songs(songs)\n songs.each { |song| add_song(song) }\n end",
"def add_song(song)\n if self.songs.include?(song) == false\n @songs << song\n end\n\n if song.artist.nil? || song.artist == false\n song.artist = self\n end\n\n end",
"def add_song(song)\n song.artist = self \n end",
"def add_track(new_song)\n if AVAILABLE_SONGS.include?(new_song)\n @playlist << new_song\n else\n return false\n end\n end",
"def add_a_song(song)\n @list_of_songs.push(song)\n end",
"def add_song(song) #song = #<Song:0x007fc75eb94420 @genre=#<Genre:0x007fc75eb94498 @name=\"rap\", @songs=[]>, @name=\"99 Problems\">\n\n self.songs << song\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end",
"def add_song(song)\n @songs.push(song)\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n @song = song\n @songs << song\n\n @@song_count = @@song_count + 1\n song.artist = self\n end",
"def set_playlist_song\n @playlist_song = PlaylistSong.find(params[:id])\n end",
"def add_song_to_playlist(song)\n if @playlist.include? song\n return #exit out of function if already exits\n end\n @playlist << song #else add song to playlist array\n end",
"def add_song(song)\n @@song_count += 1\n @songs << song\n song.artist = self #self refers to Artist\n\n end",
"def artist= (artist)\n @artist = artist\n artist.add_song(self)\n end",
"def set_song_list\n @song_list_song = SongListSong.find(params[:id])\n end",
"def add_song(song)\n if song.artist == nil #does not assign the song if the song already has an artist\n song.artist = self #assigns current artist to songs artist property\n else\n nil\n end\n if @songs.include?(song)\n nil\n else\n @songs << song #adds song, does not add the song if already exists\n end\n song\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n self.songs << song\n new_song = Song.new(song)\n new_song.artist = self\n end",
"def initialize\n super\n @songs = []\n end",
"def initialize\n super\n @songs = []\n end",
"def artist=(artist_obj)\n @artist = artist_obj\n\n #self is a song obj\n artist_obj.songs.push(self)\n end",
"def set_playlist\n @playlist = Playlist.find_by(id:params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find params[:id]\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def add_song(song)\n song.artist = self #associate the song with this artist\n end",
"def add_new_song(new_song)\n @bar_songlist.push(new_song)\n end",
"def add_song(song)\n if(!songs.include?song)\n songs.add(song)\n end\n end",
"def add_song(song)\n @songs << song\n #here we use the self keyword to refer to the artist on which we are calling this method. We call the =artist method onto the song that is being passed as an argument and set that to self (the artist)\n song.artist = self\n#once we add a new song we want to increase the class array song count\n @@song_count +=1\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def add_song(song)\n song.genre = self unless song.genre\n @songs << song unless @songs.include?(song)\n end",
"def set_songs\n @mix = Mix.find(params[:mix_id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def set_playlist\n @playlist = Playlist.find(params[:playlist_id])\n end"
] |
[
"0.7577467",
"0.7299398",
"0.7255439",
"0.72231287",
"0.7222883",
"0.7222883",
"0.7222883",
"0.7222883",
"0.7222883",
"0.7222883",
"0.7200994",
"0.7167695",
"0.7165535",
"0.716155",
"0.7127934",
"0.71273637",
"0.71273637",
"0.7107736",
"0.7107736",
"0.7107736",
"0.7107736",
"0.7107736",
"0.7107736",
"0.7107736",
"0.7107736",
"0.7107736",
"0.7107736",
"0.7107736",
"0.70767766",
"0.7074381",
"0.7073298",
"0.7048691",
"0.7032547",
"0.7016149",
"0.7000788",
"0.69959116",
"0.69943386",
"0.6945176",
"0.69396675",
"0.69303",
"0.69228494",
"0.6919751",
"0.6886307",
"0.6874219",
"0.68642616",
"0.6862607",
"0.684465",
"0.68432313",
"0.68432313",
"0.68432313",
"0.6842226",
"0.68348366",
"0.6810306",
"0.68051314",
"0.68002",
"0.679364",
"0.679364",
"0.679364",
"0.679364",
"0.679364",
"0.679364",
"0.6789378",
"0.6785241",
"0.6781818",
"0.6781818",
"0.6781818",
"0.67680377",
"0.6753745",
"0.6739541",
"0.6732488",
"0.67313653",
"0.6728091",
"0.6726442",
"0.67088157",
"0.6698304",
"0.66855174",
"0.66855174",
"0.6681602",
"0.66275585",
"0.66083163",
"0.6597843",
"0.6597843",
"0.6597843",
"0.6597843",
"0.6597843",
"0.6597843",
"0.6597843",
"0.6597843",
"0.6597843",
"0.6597843",
"0.6584145",
"0.65670496",
"0.6565563",
"0.6564677",
"0.65436006",
"0.6538471",
"0.653544",
"0.6524374",
"0.6524374",
"0.6524374",
"0.6513247"
] |
0.0
|
-1
|
prepends the root section path to the path if the given pattern matches
|
def around_recognition(route, path, env, &block)
unless path =~ %r(^/admin) # TODO ... should be defined through the dsl in routes.rb
if match = path.match(@@pattern)
section = Site.find_by_host(env[:host_with_port]).sections.root
path.sub! /^#{match[0]}/, "#{match[1]}/#{section.type.pluralize.downcase}/#{section.id}#{match[2]}"
end
end
yield path, env
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def path_section\n $1 if @basename.to_s =~ /\\.(\\d\\w*)\\./\n end",
"def add_path_matcher(sections)\n match_path = ''\n sections.each do |section|\n if section[0] == '{' && section[-1] == '}'\n match_path = match_path + \"[^\\\\/]+\"\n else\n match_path = match_path + section\n end\n end\n\n @path_matchers << (/^#{match_path}$/)\n end",
"def route\n [namespace, path].reject(&:blank?).join('/').prepend('/')\n end",
"def relativize_root_path(path)\n path.to_s.sub(/^#{Regexp.escape(@root)}/, '$root')\n end",
"def expand_root_path(path)\n path.to_s.sub(/^\\$root/, @root)\n end",
"def rootify_path path\n path = normalize_path(path, true)\n path.size > 0 ? '/%s/' % path : '/'\n end",
"def prepare(path)\n path.delete_prefix('/').gsub(%r{//}, '/').gsub(%r{/+\\z}, '')\n end",
"def template_path(key, partial_root)\n path = key.split(\".\")\n path.delete_at(0) if path[0] == \"activity\"\n path.unshift partial_root\n path.join(\"/\")\n end",
"def join_path segments, root = nil\n root ? %(#{root}#{segments * SLASH}) : segments * SLASH\n end",
"def root(*args)\n where = ''\n where = @config.send(\"#{args.shift.to_s}_path\") if args[0].class == Symbol\n path = args\n File.expand_path File.join([@root, where, path].reject { |s| s.empty? })\n end",
"def root_path(*path) File.join(root, *path) end",
"def section\n clean_path(params[:section])\n end",
"def ensure_leading_slash(path); end",
"def check candidate_path\n # Convert dynamic segments into regexp captures\n matchable_path = candidate_path.gsub(/:\\w+/, '([^/]+)')\n\n # Don't match a partial segment. For example,\n # don't match /widget for /widgets.\n path.match(Regexp.new(\"^/?#{matchable_path}(?:/|$)\"))\n end",
"def root( *args )\n if self.home =~ /^[a-zA-Z]:/\n self.home.to_s[0..3].fwf_filepath.join( *args )\n else\n \"/\".fwf_filepath.join( *args )\n end\n end",
"def partialize_path(path)\n if path.basename.to_s !~ /\\A_/\n Pathname.new path.to_s.sub(/([^\\/]+)\\Z/, '_\\1')\n end\n end",
"def partialize_path(path)\n if path.basename.to_s !~ /\\A_/\n Pathname.new path.to_s.sub(/([^\\/]+)\\Z/, '_\\1')\n end\n end",
"def rewrite_path # :nodoc:\n if uri.path[0] != ?/\n prepend_path File.join('/', options[:dir].to_s)\n end\n end",
"def subsection\n clean_path((params[:subsection] || params[:id]).sub(/\\.md$/, ''))\n end",
"def normalise_path(url)\n url == :home_page && \"/\" || \"/\" << url.to_s\n end",
"def unmatched_path\n path = unescaped_path\n path[0,0] = '/' if (path[0] != '/' && matched_path[-1] == '/') || path.empty?\n path\n end",
"def exact_path(p, &blk)\n p = p[1, part.size] if p[0] == ?/\n part(/^\\/#{Regexp.quote(p)}/, &blk)\n end",
"def process_path_for_provides(path)\n path << \"(.:format)?\" unless path[-11, 11] == '(.:format)?'\n end",
"def remove_leading_slash(path); end",
"def format_path(entry)\n server_path = entry.path\n if base_path && server_path[0,base_path.length] == base_path\n if server_path == base_path\n return \".\"\n elsif server_path[base_path.length,1] == \"/\"\n return server_path[base_path.length + 1, server_path.length - base_path.length - 1]\n elsif base_path == \"/\" && server_path[0,1] == \"/\"\n return server_path[1, server_path.length - 1]\n end\n end\n server_path\n end",
"def check_path_re\n check = (self.path_re == '^/$' || self.path_re.blank?) && self.path.present?\n self.path_re = ['^', Regexp.escape(self.path), '$'].join() if check\n end",
"def path_with_prefix(path)\n path.to_s.start_with?('/') ? path : \"#{path_prefix}#{path}\"\n end",
"def map_dynamic_segments(route)\n segments = route.to_s.split('/')\n segments.map! do |segment|\n if segment =~ /:/\n '.*'\n else\n segment\n end\n end\n\n segments.join('/')\n end",
"def cleanup_paths(*paths)\n #.gsub(%r{#{@locations[:root]}/#{@locations[:root]}}, @locations[:root])\n paths.join('/').gsub(/[\\/]{2,}/,'/')\n end",
"def urlpath\n path = cleanpath\n path.blank? ? '/root' : '/' + path\n end",
"def relativize_path(path)\n path.to_s.gsub(/^\\/?#{Regexp.escape(root_path.to_s)}\\/?/, '')\n end",
"def prepend_url(input, path='')\n path += '/' unless path.match /\\/$/\n if input.match /^!/\n input.gsub(/^(!)(.+)/, '\\2')\n else\n input.gsub(/^(\\/)?([^:]+?)$/, \"#{path}\"+'\\2')\n end\n end",
"def munge(value)\n if value.is_a?(String) && value =~ /[\\\\\\/]$/\n @path_ends_with_slash = true\n end\n super\n end",
"def root_path=(_arg0); end",
"def root_path=(_arg0); end",
"def root_path=(_arg0); end",
"def replace_root_in *paths\n paths.each do |path|\n next unless File.exists? normalize(path)\n jspec_root = root\n jspec_root = '.' if vendorized? and path.include? '.html'\n contents = File.read(normalize(path)).gsub 'JSPEC_ROOT', jspec_root\n File.open(normalize(path), 'w') { |file| file.write contents }\n end\n end",
"def virtual_path(path, partial)\n return path unless partial\n if index = path.rindex(\"/\")\n path.insert(index + 1, \"_\")\n else\n \"_#{path}\"\n end\n end",
"def root_path(*path)\n File.join(root, *path)\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root_path(path) File.join(root, path) end",
"def path(root, *parts)\n send(root).join(*parts)\n end",
"def combined_app_root_regexp(include_gen_root=true)\n regexp_root = '^('\n regexp_root << combined_app_root(include_gen_root).map do |dir|\n Regexp.escape(dir)\n end.join('|')\n regexp_root << ')/?'\n Regexp.new(regexp_root)\n end",
"def update_path(path, choice)\n if( choice.start_with?(\"a\") ) #category was chosen\n if(path != \"\")\n path += \"|\"\n end\n\n path += choice + \"|p\"\n\n for product in Category.find(choice[1..choice.length]).products\n path += \":#{product.id}\"\n end\n\n return path\n end\n\n path = path.split(\"|\")\n\n for part in path\n if(part[0] == choice[0] && part.match(\"#{choice[0]}(:|$)\") != nil) #find the part in the path that will be replaced\n if(choice.start_with?(\"p\"))\n comp = Product.find(choice[1..choice.length])\n elsif(choice.start_with?(\"c\"))\n comp = Component.find(choice[1..choice.length])\n else #valuefield\n index = path.index(part)\n path[index] = \"#{choice}\"#insert component + valuefields + choices here\n return path.join(\"|\") #no children so return\n end\n\n #first sort the valuefields for the entry and create a sub path to be inserted\n valuefield_hash = sort_valuefield_children(comp.valuefields)\n\n val_entry = generate_entry(valuefield_hash,\"v\")\n\n #then sort the children for the entry and create a sub path to be inserted\n child_hash = sort_component_children(comp.components)\n\n comp_entry = generate_entry(child_hash,\"c\")\n\n index = path.index(part)\n\n path[index] = comp_entry\n path.insert(index, val_entry)\n path.insert(index, \"#{choice}\") # insert ...entry | val_entry | comp_entry... in proper place\n\n path.delete(\"\")\n return path.join(\"|\")\n end\n end\n logger.info(\"\\n\\n\\n\\n\\n no match found \\n\\n\\n\\n\\n\\n\")\n end",
"def format_path(path)\n path.blank? ? '' : path.gsub(%r{^/+}, '')\n end",
"def create_subset_route(path)\n SUBSET_ROUTE_REGEX.each do |regex|\n if regex.match(path)\n subset_id = get_hash(get_machines)\n path.gsub(regex) do |s|\n api_version = Regexp.last_match[1]\n if api_version\n path = s.sub(api_version, \"#{api_version}/subsets/#{subset_id}\")\n else\n path = \"subsets/#{subset_id}/#{s}\"\n end\n end\n return path\n end\n end\n nil\n end",
"def path_prefix=(value); end",
"def rewrite_base_path(path) # :nodoc:\n prefix = if options[:prefix].respond_to? :call\n options[:prefix].call path\n else\n options[:prefix].to_s\n end\n\n File.join prefix, path\n end",
"def rewrite_base_path(path) # :nodoc:\n if path !~ %r(^/)\n File.join('/', dir, path)\n else\n path\n end\n end",
"def clean_path(path)\n if path\n (path[0] != '/' ? path.insert(0, '/') : path).gsub(/\\/{2,}/, '/')\n end\n end",
"def root_path(basename = nil)\n join(root, basename)\n end",
"def expand_path(path)\n if m = path.match(/^([^:]+)::((..)(..)(..)(..).*)/)\n pairtree = m[3..6].join('/')\n path = \"#{m[1]}/#{pairtree}/#{m[2]}\"\n end\n path.gsub(':', '/')\n end",
"def __build_path(entries)\n parts = entries[0][:path].split('/')\n parts.pop(entries[0][:chunks].length)\n parts.join('/') # stitch parts together to form a path\n end",
"def set_default_path\n unless @resource_config[:path]\n suffix = self.to_s.split('::').last\n @resource_config[:path] = Utility.underscore(suffix)\n end\n end",
"def match_root_folder(path)\n SETTINGS.each_key do |key|\n return SETTINGS[key] if path.index(SETTINGS[key]['path'])\n end\n return nil\nend",
"def path(path)\n return self if path.nil?\n return root.path(path[1..-1]) if path[0] == ?/\n root.path(\"#{@path}#{path}\")\n end",
"def create_url(subpath='')\n paths = [ api_version, resources_path, subpath ]\n paths.select{|s| s != ''}.join('/')\n end",
"def template_path(template, opts)\n t = template.to_s\n if (v = @_view_subdir) && t !~ /\\//\n template = \"#{v}/#{t}\"\n end\n super\n end",
"def part(p)\n p = /\\/?#{Regexp.quote(p)}/ if p.is_a?(String)\n if match = env['PATH_INFO'][p]\n with_path_part(match) { yield }\n end\n end",
"def relative!\n @string.gsub!(/(?<!:)#{separator * 2}/, separator)\n @string[/\\A#{separator}|^/] = \"\"\n\n self\n end",
"def trim_segment(re)\n @key_path.sub!(re, '')\n @key_path << '$' if @key_path == '' # add back the $ if we trimmed it off\n debug \" trimmed off #{re}\"\n end",
"def path_string\n pattern\n end",
"def root sub_nav=nil\n raise 'Does not accept blocks' if block_given?\n sub_nav ? ('%s/%s' % [@path.first, sub_nav]) : @path.first\n end",
"def fix_path(path)\n\t\t\tpath ||= \"\"\n\t\t\tpath = \"/#{path}\" unless path.start_with?(\"/\")\n\t\t\tpath = \"#{path}gitcommits.atom\" if path.end_with?(\"/\")\n\t\t\treturn path\n\t\tend",
"def cleanpath\n path = @path\n names = []\n pre = path\n while r = chop_basename(pre)\n pre, base = r\n case base\n when '.'\n when '..'\n names.unshift base\n else\n if names[0] == '..'\n names.shift\n else\n names.unshift base\n end\n end\n end\n if /#{SEPARATOR_PAT}/o =~ File.basename(pre)\n names.shift while names[0] == '..'\n end\n self.class.new(prepend_prefix(pre, File.join(*names)))\n end",
"def append_to_home_if_not_absolute( p )\n path = Pathname.new( p )\n unless path.absolute? then\n path = Pathname.new( home_dir ) + path\n end\n return path.to_s\n end",
"def prepend_path(path)\n mutate_config(:paths) do |paths|\n path = File.expand_path(path, root).dup.freeze\n paths.unshift(path)\n end\n end",
"def figure_rootpath()\n name = File.basename(path)\n dirname = File.dirname(path)\n extname = File.extname(path)\n raise(\"Invalid property file name: '#{path}': too many underscores.\") if name.count(\"_\") > 2\n \n first_underscore = name.index('_')\n if first_underscore\n @rootpath = File.join(dirname, name[0, first_underscore] + extname)\n else\n @rootpath = path\n end\n end",
"def build_path(path_template, params)\n params.inject(path_template) do |path, (key, value)|\n path.gsub(\":#{key}\", value)\n end\n end",
"def expand_path path\n path_segments, path_root = partition_path path\n if path.include? DOT_DOT\n resolved_segments = []\n path_segments.each do |segment|\n segment == DOT_DOT ? resolved_segments.pop : resolved_segments << segment\n end\n join_path resolved_segments, path_root\n else\n join_path path_segments, path_root\n end\n end",
"def effective(p)\n\t\t\tp = if(p.is_a?(Pathname)) then p else Pathname.new(p) end\n\t\t\tif(p.absolute?) then p else @root + p end\n\t\tend",
"def root?\n !!(chop_basename(@path) == nil && /#{SEPARATOR_PAT}/o =~ @path)\n end",
"def prepend_path(path)\n @paths.unshift(File.expand_path(path, root))\n end",
"def reconstruct_path(came_from, current)\n while came_from.include?(current)\n current = came_from[current]\n current.path!\n end\n @start.start!\n @end.end!\n end",
"def path_part(part)\n @_path_parts ||= app.blog.drafts.path_matcher.match(path).captures\n\n @_path_parts[app.blog.drafts.matcher_indexes[part]]\n end",
"def full_path\n @full_path ||= path ? File.join(root, path) : root\n end",
"def absolutize_path(path = nil)\n \"#{root_path}#{path}\"\n end",
"def dir_path=(template_file)\n\t\t@dir_path = (/^(.*)\\//.match(template_file)? Regexp.last_match[1]: '.')\n\tend",
"def root?; path == '' end",
"def shortpath(fullpath); end",
"def path_prefix=(value)\n if value\n value.chomp! \"/\"\n value.replace \"/#{value}\" if value !~ /^\\//\n end\n @path_prefix = value\n end",
"def expand(path)\n (root_path/trim(path)).to_s\n end",
"def prepend_view_path(path); end",
"def prepend_view_path(path); end",
"def remove_prefix(conten)\n conten.gsub(/#{path_prefix}([^\"]*)/, \"\\\\1.json\")\n end",
"def expand_path(path, root=opts[:root])\n ::File.expand_path(path, root)\n end",
"def expand_path(path, root=opts[:root])\n ::File.expand_path(path, root)\n end",
"def update_path(path)\n return path_nodes(path).insert(1, \"data\").join(\"/\") if path_nodes(path)[1] != \"data\"\n\n path\n end",
"def root path = nil\n if path && configurable?\n @root = normalize_path(path)\n # resetting path to an empty string cause root should be an absolute path to templates.\n @path, @setup[:path] = nil\n path ''\n end\n @setup[:root] ||= @root ||\n (@controller.ctrl.slice.view.root if @controller) ||\n Presto::App.root\n end",
"def addNameToPath(name)\n @root = name if @currentPath.empty?\n @currentPath.addName(name)\n end",
"def full_path_for(path)\n path = \"/#{path}\" unless path[0..0] == '/'\n path\n end",
"def path_mapped(script_name, *args)\n return cleanup_paths(\"/#{script_name}/#{@locations[:root]}\") if args.empty?\n a = replace_symbols(script_name, *args)\n cleanup_paths(\"/#{script_name}/#{@locations[:root]}/#{a.join('/')}\")\n end",
"def matches_path?(pattern, path); end",
"def ensure_in_path( *args )\n args.each do |path|\n path = File.expand_path(path)\n $:.unshift(path) if test(?d, path) and not $:.include?(path)\n end\n end",
"def ensure_in_path( *args )\n args.each do |path|\n path = File.expand_path(path)\n $:.unshift(path) if test(?d, path) and not $:.include?(path)\n end\nend",
"def add_path(s, val)\n if s.empty?\n s = val.to_s\n else\n s = s + \"->\" + val.to_s\n end\n return s\nend",
"def expand_magic_path(aPath, aBasePath=nil)\n\t\t\t\taBasePath ||= Dir.pwd\n\t\t\t\tpath = aPath\n\t\t\t\tif path.begins_with?('...')\n\t\t\t\t\trel_part = path.split3(/\\.\\.\\.[\\/\\\\]/)[2]\n\t\t\t\t\tpath = find_upwards(aBasePath, rel_part)\n\t\t\t\tend\n\t\t\tend",
"def path_setup\n raise ArgumentError, \"Required path param missing\" unless path_params?\n path_params.values.join(\".\")\n end",
"def path_from_start_elements(start, elements = [])\n (start.empty? ? '/' : '') + elements.join('/')\nend"
] |
[
"0.5989368",
"0.5977211",
"0.5696764",
"0.56438255",
"0.5519941",
"0.54989153",
"0.54899365",
"0.5470857",
"0.5405657",
"0.5335277",
"0.5334511",
"0.53320706",
"0.53275424",
"0.52744454",
"0.52606744",
"0.5249739",
"0.5249739",
"0.52397794",
"0.5238244",
"0.5214252",
"0.52069557",
"0.52065897",
"0.520266",
"0.5178806",
"0.517238",
"0.5160868",
"0.5134451",
"0.51157117",
"0.51075816",
"0.51044494",
"0.51043814",
"0.50998366",
"0.5073287",
"0.50574803",
"0.50574803",
"0.50574803",
"0.5045949",
"0.50454575",
"0.5044988",
"0.5020082",
"0.5020082",
"0.5016418",
"0.50145817",
"0.4971067",
"0.4955837",
"0.49544266",
"0.49472588",
"0.49453425",
"0.49260673",
"0.49202928",
"0.4899595",
"0.4894617",
"0.48799083",
"0.48681855",
"0.48564452",
"0.4853344",
"0.48488235",
"0.48435402",
"0.48423225",
"0.4834359",
"0.48319837",
"0.4818438",
"0.48171452",
"0.48154125",
"0.4812055",
"0.48050502",
"0.48010635",
"0.48005804",
"0.47987035",
"0.477205",
"0.477022",
"0.4768832",
"0.47672075",
"0.4757348",
"0.47556287",
"0.4755438",
"0.47491056",
"0.4740869",
"0.4735123",
"0.4731879",
"0.47299862",
"0.47231272",
"0.47227964",
"0.47176248",
"0.47176248",
"0.4711916",
"0.47107342",
"0.47107342",
"0.47100705",
"0.4709318",
"0.47066444",
"0.47054145",
"0.47028822",
"0.4701429",
"0.46948135",
"0.46924156",
"0.4686965",
"0.46644762",
"0.46635848",
"0.46599093"
] |
0.5597394
|
4
|
GET /card GET /card.json
|
def index
if Card.where(authorization_id: Authorization.current_id).count == 0 then
# Create default cards & tasks if empty for this authorization
tasks = Task.create([{name:"ContactList Example", done:true, authorization_id: Authorization.current_id},{name:"Kanban Example", done:false, authorization_id: Authorization.current_id},{name:"My own experiments", done:false, authorization_id: Authorization.current_id}])
cards = Card.create([{title: "Read the Book", description: "I should read the **whole** book", color: '#BD8D31', status: "in-progress",authorization_id: Authorization.current_id}, {title: "Write some code", description: "Code along with the samples in the book at [github](https://github.com/pro-react)",color: '#3A7E28',status: "todo",tasks: tasks,authorization_id: Authorization.current_id}])
end
@cards = Card.rank(:row_order).where(authorization_id: Authorization.current_id).includes(:tasks)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n render json: @card\n end",
"def show\n render json: @card\n end",
"def show\n @card = PkCard.find(params[:id])\n render json: @card\n end",
"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",
"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",
"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",
"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",
"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",
"def show\n render json: @card, status: :ok\n end",
"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",
"def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end",
"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",
"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",
"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",
"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",
"def card\n Card.from_response client.get(\"/actions/#{action_id}/card\")\n end",
"def show \n mtgcard = Mtgcard.find(params[:id])\n render json: mtgcard\n end",
"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",
"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",
"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",
"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",
"def show\n @scorecard = Scorecard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scorecard }\n end\n end",
"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",
"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",
"def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end",
"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",
"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",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safety_card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"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",
"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",
"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",
"def show\n @flashcard = Flashcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flashcard }\n end\n end",
"def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end",
"def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end",
"def new\n #@card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @card }\n end\n end",
"def random\n random_card = self.class.get('/cards/random')\n end",
"def get_card\n end",
"def show\n list = policy_scope(List).includes(:cards).find(params[:id])\n authorize list\n json_response(list.decorate.as_json(cards: true), :ok)\n end",
"def show\n @credit_card_terminal = CreditCardTerminal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit_card_terminal }\n end\n end",
"def get_card(card_id)\n http_request = Client::HTTP::Request.new(\n method: HTTP::Request::GET,\n endpoint: \"/#{Card::VC_VERSION}/card/#{card_id}\",\n )\n raw_response = self.read_cards_connection.send_request(http_request)\n card = Card.from_response(raw_response)\n self.validate_cards([card]) if self.card_validator\n card\n end",
"def show\n @item_cardapio = ItemCardapio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item_cardapio }\n end\n end",
"def cards\n @cards ||= @client.resource['creditCards']\n end",
"def id(id)\n req = Request.new(params = nil,\n headers = nil,\n body = nil)\n\n Scryfall::Card.new JSON.parse(connection.get(\"/cards/#{id}\", req).body)\n end",
"def show\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cards_question }\n end\n end",
"def uri\n 'cards'\n end",
"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",
"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",
"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",
"def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\n end",
"def show\n @flash_card = FlashCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @flash_card }\n format.xml { render :xml => @flash_card }\n end\n end",
"def scorecard\n\n teetime_id = params.require :teetime_id\n\n @scorecard = Score.where(teetime_id: teetime_id).order(:hole)\n\n\n\n render json: @scorecard,root: :scorecard\n\n end",
"def show\n respond_to do |format|\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount}\n format.json { render json: response_json, status: 200 }\n end\n end",
"def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def new\n @cruno_card = CrunoCard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cruno_card }\n end\n end",
"def show\n @student_scorecard = StudentScorecard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_scorecard }\n end\n end",
"def index\n #@cards = Card.all\n end",
"def show\n @deck = current_user.decks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end",
"def show\n @card_id = params[:card_id]\n @picture = Picture.find(params[:id])\n respond_with do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge }\n end\n end",
"def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract }\n end\n end",
"def new\n @flashcard = Flashcard.new\n @deck = Deck.find(params[:deck_id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flashcard }\n end\n end",
"def show\n if can? :read, DoorLog then\n card_num_R = @card.card_number.to_i(16)%32767\n @door_logs = DoorLog.where('key = ? AND data = ?', \"G\", card_num_R).order(\"created_at DESC\")\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @card }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @safety_cards }\n end\n end",
"def read_card\n @format.read_card(@card_data)\n end",
"def create\n @card = Card.new(card_params)\n\n if @card.save\n render json: @card, status: :created, location: @card\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def show\n @collection_card = CollectionCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection_card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n @actions = [{\"YGO战网\" => users_path}, {\"卡片列表\" => cards_path}, @card]\n respond_to do |format|\n format.html { redirect_to \"http://www.ourocg.cn/Cards/View-#{@card.id}\"}\n format.json { render json: @card }\n format.png { redirect_to @card.image }\n end\n end",
"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",
"def creditCardIndex\n render json: Approved.allCreditCard\n end",
"def show\n @vehicle_passcard = VehiclePasscard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_passcard }\n end\n end",
"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",
"def show\n @structure_decorator = @structure.decorate\n # 301 for Google\n if @indexable_card.nil?\n redirect_to structure_path(@structure), status: 301\n return\n end\n @course = @indexable_card.course\n if @indexable_card.place.present?\n @place = @indexable_card.place.decorate\n @city = @place.city\n end\n @serialized_structure = SmallStructureSerializer.new(@structure)\n @card_redux = {\n id: @indexable_card.id,\n slug: @indexable_card.slug,\n subjects: @indexable_card.subjects.pluck(:slug),\n position: { lat: @indexable_card.place_latitude, lng: @indexable_card.place_longitude }\n }\n\n if current_user\n @favorited = current_user.favorites.cards.where(indexable_card_id: @indexable_card.id).present?\n else\n @favorited = false\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @indexable_card, serializer: IndexableCardSerializer }\n end\n end",
"def index\n @cards = @deck.cards\n end",
"def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"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",
"def show\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",
"def show\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",
"def card_list(card_id, options = {})\n card_resource(card_id, \"list\", options)\n end",
"def check_card\n @card = Card.where(uid: params[:card], user_id: nil).first\n if @card\n head :ok\n else\n head :forbidden\n end\n end",
"def cards\n\t\t@cards.each do |card|\n\t\t\tputs card.card\n\t\tend\n\tend",
"def new\n @card_set = CardSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_set }\n end\n end",
"def show\n @cardbox = current_user.cardboxes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cardbox }\n end\n end",
"def new\n @card_set = CardSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @card_set }\n end\n end",
"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",
"def first\n @cards = Card.where(:first => params[:first])\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @cards }\n end\n end",
"def new\n @card_number = CardNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_number }\n end\n end",
"def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def update\n if @card.update(card_params)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def set_card # not private: taken out of private for accessibility\n begin\n @card = Card.find(params[:id])\n rescue\n render json: {error: \"The movie or series that you are looking for does not exist \"}, status: 404\n end\n end",
"def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end",
"def index\n @cards = @deck.cards.all\n end",
"def show\n\n # @card_type = CardType.find(params[:id])\n @card_type = CardType.find(:all, :conditions => {:price_model => params[:id]})\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @card_type }\n format.json { render :json => @card_type }\n end\n end"
] |
[
"0.8177671",
"0.8177671",
"0.81750333",
"0.80657166",
"0.80657166",
"0.80657166",
"0.80657166",
"0.80657166",
"0.805333",
"0.7898989",
"0.7884809",
"0.7831511",
"0.7773713",
"0.7414047",
"0.7391497",
"0.73547995",
"0.73455405",
"0.73202395",
"0.7317396",
"0.73155516",
"0.7266992",
"0.7251631",
"0.72348475",
"0.71826977",
"0.7139672",
"0.7138888",
"0.71085006",
"0.705579",
"0.7036418",
"0.7036418",
"0.7036418",
"0.7036418",
"0.7036418",
"0.70346457",
"0.70287144",
"0.7023389",
"0.6960867",
"0.6934475",
"0.69124186",
"0.6899038",
"0.68783087",
"0.68305093",
"0.68043524",
"0.67754114",
"0.6750735",
"0.67317456",
"0.6719499",
"0.6718589",
"0.66922563",
"0.6688942",
"0.6684016",
"0.66561604",
"0.6651226",
"0.65901077",
"0.6582025",
"0.6554537",
"0.6550212",
"0.654262",
"0.6535197",
"0.6535197",
"0.6535197",
"0.6535197",
"0.6528421",
"0.6516428",
"0.65128803",
"0.65100336",
"0.6502089",
"0.64994353",
"0.6494853",
"0.6468771",
"0.6468356",
"0.6467106",
"0.64633286",
"0.64574736",
"0.6453621",
"0.6453484",
"0.6450815",
"0.6423301",
"0.64220184",
"0.6417263",
"0.63958526",
"0.63943136",
"0.6360604",
"0.6357681",
"0.6343001",
"0.6343001",
"0.6324193",
"0.63226247",
"0.6320721",
"0.6318294",
"0.63175404",
"0.6316806",
"0.63155484",
"0.6308839",
"0.63039035",
"0.6299302",
"0.6298015",
"0.6279741",
"0.62756354",
"0.62721413",
"0.62689716"
] |
0.0
|
-1
|
GET /card/1 GET /card/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @card = PkCard.find(params[:id])\n render json: @card\n end",
"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",
"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",
"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",
"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",
"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",
"def show\n render json: @card\n end",
"def show\n render json: @card\n end",
"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",
"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",
"def show\n render json: @card, status: :ok\n end",
"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",
"def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end",
"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",
"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",
"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",
"def show \n mtgcard = Mtgcard.find(params[:id])\n render json: mtgcard\n end",
"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",
"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",
"def show\n @scorecard = Scorecard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scorecard }\n end\n end",
"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",
"def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end",
"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",
"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",
"def first\n @cards = Card.where(:first => params[:first])\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @cards }\n end\n end",
"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",
"def id(id)\n req = Request.new(params = nil,\n headers = nil,\n body = nil)\n\n Scryfall::Card.new JSON.parse(connection.get(\"/cards/#{id}\", req).body)\n end",
"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",
"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",
"def card\n Card.from_response client.get(\"/actions/#{action_id}/card\")\n end",
"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",
"def random\n random_card = self.class.get('/cards/random')\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end",
"def show\n @flashcard = Flashcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flashcard }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safety_card }\n end\n end",
"def show\n @item_cardapio = ItemCardapio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item_cardapio }\n end\n end",
"def new\n #@card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @card }\n end\n end",
"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",
"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",
"def show\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cards_question }\n end\n end",
"def uri\n 'cards'\n end",
"def show\n @credit_card_terminal = CreditCardTerminal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit_card_terminal }\n end\n end",
"def show\n @card_id = params[:card_id]\n @picture = Picture.find(params[:id])\n respond_with do |format|\n format.html # show.html.erb\n end\n end",
"def get_card(card_id)\n http_request = Client::HTTP::Request.new(\n method: HTTP::Request::GET,\n endpoint: \"/#{Card::VC_VERSION}/card/#{card_id}\",\n )\n raw_response = self.read_cards_connection.send_request(http_request)\n card = Card.from_response(raw_response)\n self.validate_cards([card]) if self.card_validator\n card\n end",
"def get_card\n end",
"def index\n #@cards = Card.all\n end",
"def show\n list = policy_scope(List).includes(:cards).find(params[:id])\n authorize list\n json_response(list.decorate.as_json(cards: true), :ok)\n end",
"def show\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charge }\n end\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"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",
"def show\n @flash_card = FlashCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @flash_card }\n format.xml { render :xml => @flash_card }\n end\n end",
"def show\n @card = Card.find(params[:id])\n @actions = [{\"YGO战网\" => users_path}, {\"卡片列表\" => cards_path}, @card]\n respond_to do |format|\n format.html { redirect_to \"http://www.ourocg.cn/Cards/View-#{@card.id}\"}\n format.json { render json: @card }\n format.png { redirect_to @card.image }\n end\n end",
"def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @safety_cards }\n end\n end",
"def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract }\n end\n end",
"def show\n if can? :read, DoorLog then\n card_num_R = @card.card_number.to_i(16)%32767\n @door_logs = DoorLog.where('key = ? AND data = ?', \"G\", card_num_R).order(\"created_at DESC\")\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @card }\n end\n end",
"def show\n @collection_card = CollectionCard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @collection_card }\n end\n end",
"def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\n end",
"def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end",
"def show\n @student_scorecard = StudentScorecard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_scorecard }\n end\n end",
"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",
"def index\n @card = @deck.cards.find(:first, :order => 'RAND()')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cards }\n end\n end",
"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",
"def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def show\n @structure_decorator = @structure.decorate\n # 301 for Google\n if @indexable_card.nil?\n redirect_to structure_path(@structure), status: 301\n return\n end\n @course = @indexable_card.course\n if @indexable_card.place.present?\n @place = @indexable_card.place.decorate\n @city = @place.city\n end\n @serialized_structure = SmallStructureSerializer.new(@structure)\n @card_redux = {\n id: @indexable_card.id,\n slug: @indexable_card.slug,\n subjects: @indexable_card.subjects.pluck(:slug),\n position: { lat: @indexable_card.place_latitude, lng: @indexable_card.place_longitude }\n }\n\n if current_user\n @favorited = current_user.favorites.cards.where(indexable_card_id: @indexable_card.id).present?\n else\n @favorited = false\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @indexable_card, serializer: IndexableCardSerializer }\n end\n end",
"def new\n @flashcard = Flashcard.new\n @deck = Deck.find(params[:deck_id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flashcard }\n end\n end",
"def set_card # not private: taken out of private for accessibility\n begin\n @card = Card.find(params[:id])\n rescue\n render json: {error: \"The movie or series that you are looking for does not exist \"}, status: 404\n end\n end",
"def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end",
"def new\n @cruno_card = CrunoCard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cruno_card }\n end\n end",
"def show\n @deck = current_user.decks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end",
"def show\n @hand = Hand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hand }\n end\n end",
"def show\n @hand = Hand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hand }\n end\n end",
"def index\n @cards = @deck.cards\n end",
"def show\n @creative = Creative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creative }\n end\n end",
"def index\n @card_details = CardDetail.where(user_id: params[:user_id])\n end",
"def show\n @make_card = MakeCard.find(params[:id])\n @rechargeable_cards_ids = @make_card.rechargeable_cards.ids\n @rechargeable_cards = RechargeableCard.find(@rechargeable_cards_ids)\n @rechargeable_cards = RechargeableCard.paginate(page: params[:page])\n\n end",
"def new\n @card_set = CardSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @card_set }\n end\n end",
"def new\n @card_set = CardSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_set }\n end\n end",
"def show\n\n # @card_type = CardType.find(params[:id])\n @card_type = CardType.find(:all, :conditions => {:price_model => params[:id]})\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @card_type }\n format.json { render :json => @card_type }\n end\n end",
"def show\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",
"def show\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",
"def show\n respond_to do |format|\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount}\n format.json { render json: response_json, status: 200 }\n end\n end",
"def scorecard\n\n teetime_id = params.require :teetime_id\n\n @scorecard = Score.where(teetime_id: teetime_id).order(:hole)\n\n\n\n render json: @scorecard,root: :scorecard\n\n end",
"def show\n @credito = Credito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credito }\n end\n end",
"def creditCardIndex\n render json: Approved.allCreditCard\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def set_card\n puts '39393', request.path_parameters, '94358{394'\n @card = Card.find(params[:id])\n end",
"def check_card\n @card = Card.where(uid: params[:card], user_id: nil).first\n if @card\n head :ok\n else\n head :forbidden\n end\n end",
"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",
"def show\n @card_one = Card.find( params[:id] )\n setup_for_display \n end",
"def read_card\n @format.read_card(@card_data)\n end",
"def show\n @vehicle_passcard = VehiclePasscard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_passcard }\n end\n end"
] |
[
"0.7984984",
"0.79203784",
"0.79203784",
"0.79203784",
"0.79203784",
"0.79203784",
"0.7761157",
"0.7761157",
"0.77027035",
"0.76910007",
"0.76730764",
"0.76043975",
"0.7580899",
"0.7285507",
"0.72545516",
"0.72154176",
"0.7148023",
"0.712589",
"0.7112218",
"0.7091622",
"0.7078662",
"0.7057886",
"0.7049564",
"0.7002958",
"0.69887877",
"0.69510514",
"0.6941327",
"0.6939828",
"0.69356984",
"0.6935615",
"0.69157356",
"0.686009",
"0.6856721",
"0.6856721",
"0.6856721",
"0.6856721",
"0.6856721",
"0.6817122",
"0.681543",
"0.6790666",
"0.67744654",
"0.675656",
"0.67068195",
"0.66546375",
"0.6649569",
"0.65469974",
"0.65420055",
"0.6541761",
"0.6540724",
"0.65306383",
"0.65158457",
"0.6510238",
"0.65090555",
"0.6493406",
"0.6493406",
"0.6493406",
"0.6493406",
"0.6487397",
"0.64810675",
"0.64711523",
"0.64687383",
"0.6468097",
"0.64456755",
"0.64419484",
"0.64411855",
"0.64395934",
"0.6381319",
"0.63772255",
"0.6368654",
"0.63667893",
"0.63618946",
"0.6360852",
"0.6360596",
"0.63580793",
"0.63488704",
"0.634663",
"0.634331",
"0.6340216",
"0.63222426",
"0.63222426",
"0.63195115",
"0.6308563",
"0.6306895",
"0.6306373",
"0.6306023",
"0.6305441",
"0.6305221",
"0.6299238",
"0.6299238",
"0.6296461",
"0.6288078",
"0.62877417",
"0.6280614",
"0.6275607",
"0.6274542",
"0.6238305",
"0.6236552",
"0.62356853",
"0.6232048",
"0.6227141",
"0.621294"
] |
0.0
|
-1
|
POST /card POST /card.json
|
def create
@card = Card.new(card_params)
@card[:authorization_id] = Authorization.current_id
respond_to do |format|
if @card.save
format.html { redirect_to @card, notice: 'Card was successfully created.' }
format.json { render :show, status: :created }
else
format.html { render :new }
format.json { render json: @card.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @card = Card.new(card_params)\n\n if @card.save\n render json: @card, status: :created, location: @card\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def create\n @card = Card.create(card_params)\n if @card.errors.any?\n render json: @card.errors, status: :unprocessable_entity\n else\n render json: @card, status: 201\n end\n end",
"def create\n @card = Card.new(card_params)\n @card.user = current_user\n respond_to do |format|\n if @card.save\n format.json { render json: @card, status: :created }\n else\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to cards_url, :notice => 'Card was successfully created.' }\n format.json { render :json => @card, :status => :created, :location => @card }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to cards_path, notice: t(\".successfully_created\") }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n @card.deck_id = params[:deck_id] \n \n if @card.save!\n render :show, status: :created\n else\n render json: @card.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n respond_to do |format|\n if @card.save\n format.html { redirect_to action: :index, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = @deck.cards.build(card_params)\n respond_to do |format|\n if @card.save\n format.html { redirect_to deck_path(@deck), notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: deck_card_path(@deck, @card) }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = @deck.cards.build(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to deck_cards_path(@deck, @card), notice: 'Card was successfully created.' }\n# format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n# format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n # todo violation\n @wallet.cards << @card\n respond_to do |format|\n if @wallet.save\n format.html { redirect_to wallet_path, notice: 'Card was successfully created.' }\n format.json { render json: @wallet, status: :ok, location: wallet_path }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tarot.cards << Card.new(card_params)\n\n respond_to do |format|\n if @tarot.save\n format.html { redirect_to tarot_cards_path(@tarot), notice: 'Card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @card }\n else\n format.html { render action: 'new' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Cartão criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @card }\n else\n format.html { render action: 'new' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n notify_admin(\"Card Created (#{@card.last_three_digits})\", @card.as_json)\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @Point2Card = Point2Card.create(:card_id => params[:card_id], :value => params[:value], :suit => params[:suit])\n\n if @Point2Card.save\n render json: {}, status: :created\n else\n render json: @Point2Card.errors, status: :unprocessable_entity\n end\n end",
"def create\n @card = check_params_and_create(params)\n\n if @card != nil\n render json: {\n :api_key => @card.api_key ,\n :barcode => @card.cardnumber,\n :is_active => @card.is_active,\n :current_balance => @card.balance,\n :balance_total => @card.balance_total,\n :max_balance => @card.program.punch_card}, status:201\n else\n render json: \"Kan de stempelkaart niet aanmaken!\", status:409\n end #@card != nil\n\n end",
"def create\n @Point3Card = Point3Card.create(:card_id => params[:card_id], :value => params[:value], :suit => params[:suit])\n\n if @Point3Card.save\n render json: {}, status: :created\n else\n render json: @Point3Card.errors, status: :unprocessable_entity\n end\n end",
"def registerCard\n parameters={user_id: (@current_user[\"id\"]).to_i, number: (params[:number]).to_i, amount: (params[:amount]).to_i, expiration_month: (params[:expiration_month]).to_i, expiration_year: (params[:expiration_year]).to_i}\n puts (parameters)\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.104:3003/credit_cards\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n end",
"def create\n @card = Card.new(params[:card])\n @current_user = User.find_by_id(session[:user_id])\n\n unless @current_user.admin?\n flash[:error] = \"You do not have permission to create a card\"\n redirect_to cards_path(@cards)\n return\n end\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry_card = EntryCard.new(entry_card_params)\n\n respond_to do |format|\n if @entry_card.save\n format.html { redirect_to @entry_card, notice: 'Entry card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @entry_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_card = UserCard.new(user_card_params)\n\n respond_to do |format|\n if @user_card.save\n format.html { redirect_to @user_card, notice: 'User card was successfully created.' }\n format.json { render :show, status: :created, location: @user_card }\n else\n format.html { render :new }\n format.json { render json: @user_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_creditcard\n \n @creditcard = Creditcards.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creditcard }\n end\n end",
"def create\n token = params[:stripeToken]\n @card = AddStripeCard.call(current_user, card_params, card_additional_params, token)\n # debugger\n respond_to do |format|\n if @card.errors.blank?\n format.html { redirect_to cards_path, notice: \"Card #{current_user.cards.last.card_last_four} was successfully created.\" }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new, alert: \"There was an issue with your card, please try again.\"}\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card_instance = CardInstance.new(card_instance_params)\n\n respond_to do |format|\n if @card_instance.save\n format.html { redirect_to @card_instance, notice: 'Card owner was successfully created.' }\n format.json { render :show, status: :created, location: @card_instance }\n else\n format.html { render :new }\n format.json { render json: @card_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end",
"def create\n response.headers[\"Content-Type\"] = \"text/javascript\"\n @card = @plan.cards.new(card_params)\n @card.save\n $redis.publish('messages.create', @card.to_json)\n end",
"def create_card\n\t\t@card = Card.new(params[:card])\n\t\t@card.cardsort_id = params[:cardsort_id]\n\t\trespond_to do |format|\n\t\t\tif (@card.save)\n\t\t\t\tformat.js {render \"new_card\", :status => :created}\n\t\t\telse\n\t\t\t\tformat.js {render \"new_card\", :status => :ok}\n\t\t\tend\n\t\tend\n\tend",
"def create\n # @card = current_user.cards.new(user_params)\n @card = Card.new(user_params)\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, flash: { success: \"Succeed to create card!\" } }\n format.json {\n render json: @card.as_json(include: [:book, :user]),\n status: :created\n }\n else\n format.html {\n flash[:danger] = \"Error : Failed to create card.\"\n render :new\n }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(params[:card])\n @card.user_id = session[:user_id]\n\n respond_to do |format|\n if @card.save\n listingcard = ListingCard.new do |m|\n m.memoword_id = session[:memoword_id]\n m.card_id = @card.id\n m.memorized = false\n end\n listingcard.save\n #format.html {render action: \"new\" }\n format.html { redirect_to new_card_url, notice: 'カードは作成されBookに登録されました' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @namecard = Namecard.new(namecard_params)\n\n respond_to do |format|\n if @namecard.save\n format.html { redirect_to @namecard, notice: 'Namecard was successfully created.' }\n format.json { render :show, status: :created, location: @namecard }\n else\n format.html { render :new }\n format.json { render json: @namecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @keycard = Keycard.new(keycard_params)\n\n respond_to do |format|\n if @keycard.save\n format.html { redirect_to keycards_path, notice: 'keycard was successfully created.' }\n format.json { render :show, status: :created, location: @keycard }\n else\n format.html { render :new }\n format.json { render json: @keycard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @deck_of_card = DeckOfCard.new(deck_of_card_params)\n\n respond_to do |format|\n if @deck_of_card.save\n format.html { redirect_to @deck_of_card, notice: 'Deck of card was successfully created.' }\n format.json { render :show, status: :created, location: @deck_of_card }\n else\n format.html { render :new }\n format.json { render json: @deck_of_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_card\n trello = trello_api\n card_options = {\n :name => card_title,\n :list => list_id,\n :description => card_body,\n }\n trello.create_card(card_options)\n end",
"def create\n @tcard = Tcard.new(tcard_params)\n\n respond_to do |format|\n if @tcard.save\n format.html { redirect_to @tcard, notice: 'Tcard was successfully created.' }\n format.json { render :show, status: :created, location: @tcard }\n else\n format.html { render :new }\n format.json { render json: @tcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @card.update(card_params)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def create\n @eno_card = EnoCard.new(eno_card_params)\n\n respond_to do |format|\n if @eno_card.save\n format.html { redirect_to @eno_card, notice: 'Eno card was successfully created.' }\n format.json { render :show, status: :created, location: @eno_card }\n else\n format.html { render :new }\n format.json { render json: @eno_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment_card = PaymentCard.new(payment_card_params)\n\n respond_to do |format|\n if @payment_card.save\n format.html { redirect_to payment_cards_url, notice: 'Payment card was successfully created.' }\n format.json { render :show, status: :created, location: @payment_card }\n else\n format.html { render :new }\n format.json { render json: @payment_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cruno_card = CrunoCard.new(params[:cruno_card])\n\n respond_to do |format|\n if @cruno_card.save\n format.html { redirect_to @cruno_card, notice: 'Cruno card was successfully created.' }\n format.json { render json: @cruno_card, status: :created, location: @cruno_card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cruno_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_card\n card = @device.cards.where(:card_type => params[:card_type], :native_url => params[:native_url]).first_or_initialize\n parent_card = @device.cards.where(:native_url => params[:parent_native_url]).first\n begin\n params_card = {\n :path => params[:path],\n :name => params[:name],\n :desc => params[:desc]\n }\n params_card = params_card.merge(:parent_id => parent_card.id) if parent_card.present?\n card.update_attributes!(params_card)\n render :json => card\n rescue Exception => e\n puts \"Error in Uploading Contact Photo: \" + e.message.split('for')[0]\n render :json => e.message.split('for')[0], :status => :unprocessable_entity\n end\n end",
"def create\n @name_card = NameCard.new(name_card_params)\n\n respond_to do |format|\n if @name_card.save\n format.html { redirect_to @name_card, notice: 'Name card was successfully created.' }\n format.json { render :show, status: :created, location: @name_card }\n else\n format.html { render :new }\n format.json { render json: @name_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(params[:card])\n\n respond_to do |format|\n if @card.save\n flash[:notice] = 'Card was successfully created.'\n format.html { redirect_to(deck_card_path(@deck, @card)) }\n format.xml { render :xml => @card, :status => :created, :location => @card }\n else\n @decks = Deck.all(:order => 'title')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ccard = Ccard.new(ccard_params)\n\n respond_to do |format|\n if @ccard.save\n format.html { redirect_to @ccard, notice: 'Ccard was successfully created.' }\n format.json { render :show, status: :created, location: @ccard }\n else\n format.html { render :new }\n format.json { render json: @ccard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def card_params\n params.require(:card).permit(:number, :name, :text, :description)\n end",
"def create\n @card = @cards.new(card_params)\n @card.assign_attributes(parent: Card.find_by_id(params[:card][:parent_id])) if params[:card][:parent_id]\n if @card.save\n @card.add_sr_event(1)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def create\n respond_to do |format|\n if @safety_card.save\n format.html { redirect_to @safety_card, notice: 'Safety card was successfully created.' }\n format.json { render json: @safety_card, status: :created, location: @safety_card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safety_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @Waste2Card = Waste2Card.create(:card_id => params[:card_id], :value => params[:value], :suit => params[:suit])\n\n if @Waste2Card.save\n render json: {}, status: :created\n else\n render json: @Waste2Card.errors, status: :unprocessable_entity\n end\n end",
"def create\n @inden_card = IndenCard.new(inden_card_params)\n\n respond_to do |format|\n if @inden_card.save\n format.html { redirect_to @inden_card, notice: (t 'inden_cards.title2')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @inden_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @inden_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @creativitycard = Creativitycard.new(creativitycard_params)\n\n respond_to do |format|\n if @creativitycard.save\n format.html { redirect_to @creativitycard, notice: 'Creativitycard was successfully created.' }\n format.json { render :show, status: :created, location: @creativitycard }\n else\n format.html { render :new }\n format.json { render json: @creativitycard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n @card.user_id = current_user.id\n\n respond_to do |format|\n if @card.save_with_ocr\n format.html { redirect_to action: :index }\n format.json { render json: @card, status: :created, location: @card }\n flash[:notice] = 'Card was successfully created.'\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @request = CardDetail.new.verify_transaction(params[:trxref]).parsed_response\n\n @user = User.find_by_email(@request['data']['customer']['email'])\n\n @card_detail = CardDetail.new(auth_code: @request['data']['authorization']['authorization_code'],\n bin: @request['data']['authorization']['bin'],\n last_four: @request['data']['authorization']['last4'],\n bank: @request['data']['authorization']['bank'],\n brand: @request['data']['authorization']['brand'],\n country_code: @request['data']['authorization']['country_code'],\n user: @user)\n respond_to do |format|\n if @card_detail.save\n format.html { redirect_to user_card_details_path(@user.id), notice: 'Card detail was successfully created.' }\n format.json { render json: request.headers['Content-Type'], head: :ok }\n else\n format.html { render :new }\n format.json { render json: @card_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_card_using_post(card_request, opts = {})\n data, _status_code, _headers = create_card_using_post_with_http_info(card_request, opts)\n data\n end",
"def create\n @debit_card = DebitCard.new(debit_card_params)\n\n respond_to do |format|\n if @debit_card.save\n format.html { redirect_to @debit_card, notice: 'Debit card was successfully created.' }\n format.json { render :show, status: :created, location: @debit_card }\n else\n format.html { render :new }\n format.json { render json: @debit_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @poker_card = PokerCard.new(poker_card_params)\n\n respond_to do |format|\n if @poker_card.save\n format.html { redirect_to @poker_card, notice: 'Poker card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @poker_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @poker_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @make_card = MakeCard.new(make_card_params)\n\n respond_to do |format|\n if @make_card.save\n format.html { redirect_to @make_card, notice: 'Make card was successfully created.' }\n format.json { render :show, status: :created, location: @make_card }\n else\n format.html { render :new }\n format.json { render json: @make_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def card_params\n params.require(:card).permit(:title, :description)\n end",
"def create\n @mtb_card = MtbCard.new(params[:mtb_card])\n\n respond_to do |format|\n if @mtb_card.save\n format.html { redirect_to @mtb_card, notice: 'Mtb card was successfully created.' }\n format.json { render json: @mtb_card, status: :created, location: @mtb_card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mtb_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.find(params[:card_id])\n params[:deck_card][:card_id] = @card.id\n @deck_card = DeckCard.new(deck_card_params)\n if @deck_card.save\n flash[:success] = \"Card successfully added to deck!\"\n redirect_to @deck_card.deck\n else\n flash[:danger] = \"Card and deck are not compatible\"\n redirect_to @card\n end\n end",
"def create\n @bcard = Bcard.new(params[:bcard])\n\n respond_to do |format|\n if @bcard.save\n format.html { redirect_to @bcard, notice: 'Bcard was successfully created.' }\n format.json { render json: @bcard, status: :created, location: @bcard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # new instance of a card with parameters of card details\n @card = Card.create(card_params)\n # current user info gets associated with card?? ASK\n # if card is valid based on our criteria (validations)\n # then the card will be saved and added to list of all cards\n # and user will be redirected to list of all cards\n if @card.valid?\n @card.save!\n \n redirect_to cards_path\n # if card doesn't fit our criteria, then user will get an\n # error message\n else\n render :new\n flash[:alert] = \"There was an error with your submission\"\n end\n end",
"def create\n @side_card = SideCard.new(side_card_params)\n\n respond_to do |format|\n if @side_card.save\n format.html { redirect_to @side_card, notice: 'Side card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @side_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @side_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reg_card = RegCard.new(params[:reg_card])\n\n respond_to do |format|\n if @reg_card.save\n flash[:success] = \"Card Created Successfully!\"\n format.html { redirect_to group_path(@reg_card.group) }\n format.json { render json: @reg_card, status: :created, location: @reg_card }\n else\n format.html { redirect_to group_path(@reg_card.group) }\n format.json { render json: @reg_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_card_using_post_with_http_info(card_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardApi.create_card_using_post ...'\n end\n # verify the required parameter 'card_request' is set\n if @api_client.config.client_side_validation && card_request.nil?\n fail ArgumentError, \"Missing the required parameter 'card_request' when calling CardApi.create_card_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/card'\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(card_request)\n auth_names = ['oauth2']\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 => 'Card')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardApi#create_card_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(list_id, name, description = \"\")\n Trello::Card.create(name: name, list_id: list_id, desc: description)\n end",
"def create\n @creditcard = Creditcard.new(creditcard_params)\n\n respond_to do |format|\n if @creditcard.save\n format.html { redirect_to @creditcard, notice: 'Creditcard was successfully created.' }\n format.json { render :show, status: :created, location: @creditcard }\n else\n format.html { render :new }\n format.json { render json: @creditcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(card_params)\n \n if params[:file].present?\n preloaded = Cloudinary::PreloadedFile.new(params[:file], angle: 'a_ignore') \n raise \"Invalid upload signature\" if !preloaded.valid?\n @card.front_image_url = preloaded.identifier\n end\n\n respond_to do |format|\n if @card.save\n \n #@card.card_players.create(card_params[:player_ids].collect { |id| { card_id: @card.id, player_id: id.to_i } } )\n\n \n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render :show, status: :created, location: @card }\n else\n format.html { render :new }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @flashcard = Flashcard.new(params[:flashcard])\n @deck = Deck.find(params[:deck_id]) \n @flashcard.deck = @deck\n respond_to do |format|\n if @flashcard.save\n format.html { redirect_to @flashcard, notice: 'Flashcard was successfully created.' }\n format.json { render json: @flashcard, status: :created, location: @flashcard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flashcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def card_params\n params.require(:card).permit(:title, :origin, :posted_at, :user_id)\n end",
"def create\n @scorecard = Scorecard.new(params[:scorecard])\n\n respond_to do |format|\n if @scorecard.save\n format.html { redirect_to @scorecard, notice: 'Scorecard was successfully created.' }\n format.json { render json: @scorecard, status: :created, location: @scorecard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scorecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"def new\n @card = Card.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card }\n end\n end",
"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",
"def postWebcard( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"post\",\"/webcard\",params)\n end",
"def create\n @timecard = Timecard.new(timecard_params)\n\n respond_to do |format|\n if @timecard.save\n format.html { redirect_to @timecard, notice: 'Timecard was successfully created.' }\n format.json { render :show, status: :created, location: @timecard }\n else\n format.html { render :new }\n format.json { render json: @timecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @card = Card.new(params[:card])\n @card.user_id = current_user.id\n respond_to do |format|\n if @card.save\n flash[:notice] = 'Card was successfully created.'\n format.html { redirect_to(@card.category) }\n format.xml { render :xml => @card, :status => :created, :location => @card }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fate_card = FateCard.new(fate_card_params)\n\n respond_to do |format|\n if @fate_card.save\n format.html { redirect_to @fate_card, notice: 'Fate card was successfully created.' }\n format.json { render :show, status: :created, location: @fate_card }\n else\n format.html { render :new }\n format.json { render json: @fate_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bdcard = Bdcard.new(params[:bdcard])\n profile_info\n\n respond_to do |format|\n if @bdcard.save\n format.html { redirect_to @bdcard, notice: 'Bdcard was successfully created.' }\n format.json { render json: @bdcard, status: :created, location: @bdcard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bdcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @excuse_card = ExcuseCard.new(excuse_card_params)\n\n respond_to do |format|\n if @excuse_card.save\n format.html { redirect_to @excuse_card, notice: 'Excuse card was successfully created.' }\n format.json { render :show, status: :created, location: @excuse_card }\n else\n format.html { render :new }\n format.json { render json: @excuse_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @credit_card = CreditCard.new(credit_card_params)\n @credit_card.student = @student\n\n respond_to do |format|\n if @credit_card.save\n format.html { redirect_to @credit_card, notice: 'Credit card was successfully created.' }\n format.json { render :show, status: :created, location: @credit_card }\n else\n format.html { render :new }\n format.json { render json: @credit_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @Waste3Card = Waste3Card.create(:card_id => params[:card_id], :value => params[:value], :suit => params[:suit])\n\n if @Waste3Card.save\n render json: {}, status: :created\n else\n render json: @Waste3Card.errors, status: :unprocessable_entity\n end\n end",
"def card_params\n params.require(:card).permit(:full_name, :identification, :password, :cpf, :email, :phone, :card_type)\n end",
"def create_json\n @card = Card.new(card_params)\n\n respond_to do |format|\n if @card.limit.nil?\n msg = { id: @card.id, error: 'Must have limit on card' }\n format.json { render json: msg }\n elsif @card.limit <= 0\n msg = { id: @card.id, error: 'Cannot have a zero or negative limit' }\n format.json { render json: msg }\n elsif @card.save\n msg = { id: @card.id, limit: @card.limit }\n format.json { render json: msg }\n else\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def card_params\n params.require(:card).permit(:front, :back, :status, :deck_id, :image)\n end",
"def create\n @owned_card = OwnedCard.new(owned_card_params)\n @owned_card.user = current_user\n\n respond_to do |format|\n if @owned_card.save\n format.html { redirect_to @owned_card, notice: 'Owned card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @owned_card }\n else\n @cards = @owned_card.printing.card.printings\n format.html { render action: 'new' }\n format.json { render json: @owned_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @m_card = MCard.new(m_card_params)\n respond_to do |format|\n if @m_card.save\n format.html { redirect_to m_cards_path, notice: 'カード追加しました' }\n format.json { render action: 'show', status: :created, location: m_cards_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @m_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_card\n raise StandardError, 'Cliente null' if @client.nil?\n # la instancia de card recibe como parametro el @client al que se le va asociar la tarjeta\n card = PayuLatam::Card.new(@client)\n # hay un metodo card_params que genera el objeto a enviar con los datos correctos\n # se asignan los params correctos para la peticion\n card.params.merge! card_params\n\n # intento de creacion de tarjeta\n card.create!\n # si todo bien\n if card.success?\n # se llena la variable @card con la instancia de la clase PayuLatam::Card\n @card = card\n\n # no me acuerdo XD\n @client.remove_cards\n \n # se agrega la tarjeta al array de tarjetas del usuario. Ojo este array esta en memoria no necesariamente\n # es el mismo array de payu\n @client.add_card( card.response )\n\n # la respuesta de creacion de payu solo incluye el token de la tarjeta, entonces\n # volvemos a consultar la info almacenada en payu para recibier un poco mas de detalle y almacenarlo\n _card = card.load(card.response['token'])\n # se crea un registro de payu_card con la info publica de la tarjeta y el token de payu de la tarjeta\n @current_user.payu_cards.create(token: @card.response['token'], last_4: _card['number'], brand: _card['type'])\n else\n raise StandardError, \"Error generando token de tarjeta: #{card.error}\"\n end\n end",
"def card_params\n params.require(:card).permit(:result_no, :generate_no, :e_no, :s_no, :name, :possession, :kind, :card_id)\n end",
"def card_params\n params.require(:card).permit(:title, :body, :board_id, :user_id)\n end",
"def update\n @card.update(card_params)\n if @card.errors.any?\n render json: @card.errors, status: :unprocessable_entity\n else\n render json: @card, status: 201\n end\n end",
"def card_params\n params.require(:card).permit(:id, :card_number, :security_type, :security_code, :expires_end)\n end",
"def create\n @time_card = TimeCard.new(time_card_params)\n respond_to do |format|\n if @time_card.save\n format.html { redirect_to @time_card, notice: 'Time card was successfully created.' }\n format.json { render :show, status: :created, location: @time_card }\n else\n format.html { render :new }\n format.json { render json: @time_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def card_params\n params.require(:card).permit(:name, :year, :description, :sku, :price, :serial_number, :front_image_url, :available, :back_image_url, :team_ids => [], :c_attribute_ids => [], :card_manufacturer_ids => [], :player_ids => [])\n end",
"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"
] |
[
"0.8007552",
"0.785746",
"0.77633536",
"0.76443434",
"0.76374334",
"0.76257706",
"0.75999326",
"0.7595438",
"0.7566431",
"0.7566431",
"0.7566431",
"0.7566431",
"0.75103617",
"0.74918365",
"0.7449733",
"0.74182576",
"0.73416245",
"0.7326067",
"0.72852075",
"0.727796",
"0.7238983",
"0.7057788",
"0.70525366",
"0.70196587",
"0.70047253",
"0.70033747",
"0.70006084",
"0.6978698",
"0.6959949",
"0.69575113",
"0.6955069",
"0.69362366",
"0.69290894",
"0.6924931",
"0.6912498",
"0.6912167",
"0.6911796",
"0.69082314",
"0.689585",
"0.6880487",
"0.686546",
"0.6860532",
"0.68383664",
"0.6833987",
"0.6828546",
"0.6793582",
"0.6789838",
"0.6781228",
"0.678052",
"0.67761445",
"0.67747575",
"0.67731506",
"0.6764812",
"0.67588556",
"0.6747489",
"0.6741918",
"0.6734063",
"0.67330927",
"0.6717224",
"0.67035234",
"0.6700236",
"0.6699271",
"0.66892385",
"0.66766036",
"0.66547376",
"0.66460395",
"0.6644342",
"0.6630391",
"0.6628034",
"0.6620686",
"0.66175926",
"0.66139734",
"0.6613283",
"0.661203",
"0.661203",
"0.661203",
"0.661203",
"0.661203",
"0.6609491",
"0.66066086",
"0.66063094",
"0.66019315",
"0.6596288",
"0.6585785",
"0.65848726",
"0.65808755",
"0.6580843",
"0.6577668",
"0.65553916",
"0.65549594",
"0.6552302",
"0.6546448",
"0.65419054",
"0.6524136",
"0.65225273",
"0.65166366",
"0.65118116",
"0.65115505",
"0.6508333",
"0.65079474"
] |
0.7441925
|
15
|
PATCH/PUT /card/1 PATCH/PUT /card/1.json
|
def update
respond_to do |format|
puts "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
puts card_params
if @card.update(card_params)
format.html { redirect_to @card, notice: 'Card was successfully updated.' }
format.json { render :show, status: :ok, location: @card }
else
format.html { render :edit }
format.json { render json: @card.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n # @card = Card.find(params[:id])\n # @card.update(card_params)\n # render json: @card\n end",
"def update\n @card.update(card_params)\n if @card.errors.any?\n render json: @card.errors, status: :unprocessable_entity\n else\n render json: @card, status: 201\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to cards_url, :notice => 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @card.update(card_params)\n render json: @card, status: :created\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to tarot_cards_path(@tarot), notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n if @card.update(card_params)\n head :no_content\n else\n render json: @card.errors, status: :unprocessable_entity\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(card_params)\n format.html { redirect_to action: :index }\n format.json { head :no_content }\n flash[:notice] = 'Card was successfully updated.'\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to cards_path, notice: t(\".successfully_updated\") }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n notify_admin(\"Card Updated (#{@card.last_three_digits})\", @card.as_json)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = @deck.cards.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(card_params)\n format.html { redirect_to deck_path(@deck), notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: deck_card_path(@deck, @card) }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to plan_path(@plan), notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, flash: { success: \"Updated the card!\" } }\n format.json { render json: @card, status: :ok }\n else\n format.html {\n flash[:danger] = \"Error : Failed to update card.\"\n render :edit\n }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to deck_cards_path(@deck, @card), notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Tarjeta Actualizada Satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to @card, notice: 'Cartão atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @card = Card.find(params[:id])\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(@card) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xmll => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry_card.update(entry_card_params)\n format.html { redirect_to @entry_card, notice: 'Entry card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wallet.update_card(params[:id], card_params)\n format.html { redirect_to wallet_path, notice: 'Card was successfully updated.' }\n format.json { render json: @wallet, status: :ok, location: wallet_path }\n else\n @card = @wallet.find_card(params[:id])\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n respond_to do |format|\n if @card.update_attributes(params[:card])\n flash[:notice] = 'Card was successfully updated.'\n format.html { redirect_to(deck_card_url(@deck, @card)) }\n format.xml { head :ok }\n else\n @decks = Deck.find(:all, :order => 'title')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @m_card.update(m_card_params)\n format.html { redirect_to @m_card, notice: 'M card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @m_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card_detail.update(card_detail_params)\n format.html { redirect_to @card_detail, notice: 'Card detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_detail }\n else\n format.html { render :edit }\n format.json { render json: @card_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card_set = CardSet.find(params[:id])\n\n respond_to do |format|\n if @card_set.update_attributes(params[:card_set])\n format.html { redirect_to @card_set, notice: 'Card set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poker_card.update(poker_card_params)\n format.html { redirect_to @poker_card, notice: 'Poker card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poker_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @side_card.update(side_card_params)\n format.html { redirect_to @side_card, notice: 'Side card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @side_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @card = args[:card] if args.key?(:card)\n @card_id = args[:card_id] if args.key?(:card_id)\n end",
"def updateCard\n if !(Integer(params[:id]) rescue false)\n renderError(\"Not Acceptable (Invalid Params)\", 406, \"The parameter id is not an integer\")\n return -1\n end\n resultsGet = HTTParty.get(\"http://192.168.99.104:3003/credit_card?id=\"+params[:id])\n userA = (resultsGet[\"user_id\"])\n puts(userA)\n puts( @current_user[\"id\"])\n if userA != (@current_user[\"id\"])\n renderError(\"Forbidden\",403,\"current user has no access\")\n return -1\n else\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.put(\"http://192.168.99.104:3003/credit_cards?id=\"+params[:id], options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n end\n end",
"def update\n respond_to do |format|\n if @safety_card.update_attributes(params[:safety_card])\n format.html { redirect_to @safety_card, notice: 'Safety card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safety_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vote_card.update(vote_card_params)\n format.html { redirect_to @vote_card, notice: 'VoteCard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vote_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card_instance.update(card_instance_params)\n format.html { redirect_to @card_instance, notice: 'Card owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_instance }\n else\n format.html { render :edit }\n format.json { render json: @card_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @owned_card.user == current_user && @owned_card.update(owned_card_params)\n format.html { redirect_to owned_cards_path, notice: 'Owned card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @owned_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n if @bcard.update_attributes(params[:bcard])\n format.html { redirect_to @bcard, notice: 'Bcard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_card(id, params)\n card = find_card(id)\n if card\n card.update(params)\n save\n end\n end",
"def update\n respond_to do |format|\n if @inden_card.update(inden_card_params)\n format.html { redirect_to @inden_card, notice: (t 'inden_cards.title2')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inden_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card_in_column.update(card_in_column_params)\n format.json { render json: @card_in_column.as_json(include: { card: { only: [:id, :name, :description, :project_id, :type] } }), status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card_set.update(card_set_params)\n format.html { redirect_to @card_set, notice: 'Card set was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_set }\n else\n format.html { render :edit }\n format.json { render json: @card_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n @current_user = User.find_by_id(session[:user_id])\n\n unless @current_user.admin?\n flash[:error] = \"You do not have permission to update a card\"\n redirect_to cards_path(@cards)\n return\n end\n\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scorecard = Scorecard.find(params[:id])\n\n respond_to do |format|\n if @scorecard.update_attributes(params[:scorecard])\n format.html { redirect_to @scorecard, notice: 'Scorecard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scorecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @keycard.update(keycard_params)\n format.html { redirect_to keycards_path, notice: 'keycard ' + @keycard.id.to_s + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @keycard }\n else\n format.html { render :edit }\n format.json { render json: @keycard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @note_card.update(note_card_params)\n format.html { redirect_to @note_card, notice: 'Note card was successfully updated.' }\n format.json { render :show, status: :ok, location: @note_card }\n else\n format.html { render :edit }\n format.json { render json: @note_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @deck_of_card.update(deck_of_card_params)\n format.html { redirect_to @deck_of_card, notice: 'Deck of card was successfully updated.' }\n format.json { render :show, status: :ok, location: @deck_of_card }\n else\n format.html { render :edit }\n format.json { render json: @deck_of_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if !(params[:id].nil?)\n if(CompanyCard.exists?(params[:id]))\n card = CompanyCard.find(params[:id])\n card.update(card_params)\n render status: 200, json:{\n message: \"Successfully updated\",\n company_cards: card\n }.to_json\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",
"def update\n respond_to do |format|\n if @name_card.update(name_card_params)\n format.html { redirect_to @name_card, notice: 'Name card was successfully updated.' }\n format.json { render :show, status: :ok, location: @name_card }\n else\n format.html { render :edit }\n format.json { render json: @name_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_card.update(user_card_params)\n format.html { redirect_to @user_card, notice: 'User card was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_card }\n else\n format.html { render :edit }\n format.json { render json: @user_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @deck_card.update(deck_card_params)\n flash[:success] = \"Deck card was successfully updated.\"\n redirect_to @deck_card.deck\n format.json { render :show, status: :ok, location: @deck_card }\n else\n format.html { render :edit }\n format.json { render json: @deck_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card_instance.update(card_instance_params)\n format.html { redirect_to @card_instance, notice: 'Card instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @card_instance }\n else\n format.html { render :edit }\n format.json { render json: @card_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @make_card.update(make_card_params)\n format.html { redirect_to @make_card, notice: 'Make card was successfully updated.' }\n format.json { render :show, status: :ok, location: @make_card }\n else\n format.html { render :edit }\n format.json { render json: @make_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eno_card.update(eno_card_params)\n format.html { redirect_to @eno_card, notice: 'Eno card was successfully updated.' }\n format.json { render :show, status: :ok, location: @eno_card }\n else\n format.html { render :edit }\n format.json { render json: @eno_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cruno_card = CrunoCard.find(params[:id])\n @cruno_card.player = Player.find(2)\n\n respond_to do |format|\n if @cruno_card.update_attributes(params[:cruno_card])\n format.html { redirect_to @cruno_card, notice: 'Cruno card was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cruno_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tcard.update(tcard_params)\n format.html { redirect_to @tcard, notice: 'Tcard was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcard }\n else\n format.html { render :edit }\n format.json { render json: @tcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reg_card = RegCard.find(params[:id])\n\n respond_to do |format|\n if @reg_card.update_attributes(params[:reg_card])\n flash[:success] = \"Card Updated!\"\n format.html { redirect_to group_path(@reg_card.group) }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @reg_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_card.update(vehicle_card_params)\n format.html { redirect_to @vehicle_card, notice: (t 'vehicle_cards.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @namecard.update(namecard_params)\n format.html { redirect_to @namecard, notice: 'Namecard was successfully updated.' }\n format.json { render :show, status: :ok, location: @namecard }\n else\n format.html { render :edit }\n format.json { render json: @namecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @old_card = OldCard.find(params[:id])\n\n respond_to do |format|\n if @old_card.update_attributes(params[:old_card])\n format.html { redirect_to(@old_card, :notice => 'Old card was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @old_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n if @bizcard.update_attributes(params[:bizcard])\n format.html { redirect_to @bizcard, notice: 'Bizcard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bizcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card_number = CardNumber.find(params[:id])\n\n respond_to do |format|\n if @card_number.update_attributes(params[:card_number])\n format.html { redirect_to @card_number, notice: 'Broj kartice je uspjesno azuriran.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:image_id].present?\n preloaded = Cloudinary::PreloadedFile.new(params[:image_id]) \n raise \"Invalid upload signature\" if !preloaded.valid?\n @model.image_id = preloaded.identifier\n end\n \n respond_to do |format|\n if @card.update(card_params)\n format.html { redirect_to cards_path, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mtb_card = MtbCard.find(params[:id])\n\n respond_to do |format|\n if @mtb_card.update_attributes(params[:mtb_card])\n format.html { redirect_to @mtb_card, notice: 'Mtb card was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mtb_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @feeling_card.update(feeling_card_params)\n format.html { redirect_to @feeling_card, notice: 'Feeling card was successfully updated.' }\n format.json { render :show, status: :ok, location: @feeling_card }\n else\n format.html { render :edit }\n format.json { render json: @feeling_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flashcard = Flashcard.find(params[:id])\n\n respond_to do |format|\n if @flashcard.update_attributes(params[:flashcard])\n format.html { redirect_to @flashcard, notice: 'Flashcard was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flashcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flash_card = FlashCard.find(params[:id])\n\n respond_to do |format|\n if @flash_card.update_attributes(params[:flash_card])\n format.html { redirect_to(@flash_card, :notice => 'Flash card was successfully updated.') }\n format.json { render :json => [] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @flash_card.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @flash_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_plain_card(id, params)\n card = find_plain_card(id)\n card.update(params)\n if card.valid?\n save\n end\n end",
"def update\n respond_to do |format|\n if @fate_card.update(fate_card_params)\n format.html { redirect_to @fate_card, notice: 'Fate card was successfully updated.' }\n format.json { render :show, status: :ok, location: @fate_card }\n else\n format.html { render :edit }\n format.json { render json: @fate_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection_card = CollectionCard.find(params[:id])\n\n respond_to do |format|\n if @collection_card.update_attributes(params[:collection_card])\n format.html { redirect_to(@collection_card, :notice => 'Collection card was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @collection_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @expansion_of_card = ExpansionOfCard.find(params[:id])\n\n respond_to do |format|\n if @expansion_of_card.update_attributes(params[:expansion_of_card])\n flash[:notice] = 'ExpansionOfCard was successfully updated.'\n format.html { redirect_to(@expansion_of_card) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expansion_of_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to deck_cards_url(@deck), notice: 'Deck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = UpdateStripeCard.call(current_user, card_params, card_additional_params)\n\n respond_to do |format|\n if @card.errors.blank?\n format.html { redirect_to card_path(@card), notice: \"Card \\# #{current_user.cards.last.card_last_four} was updated!\" }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity, alert: 'Unable to update #{current_user.cards.last.card_last_four}!' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @excuse_card.update(excuse_card_params)\n format.html { redirect_to @excuse_card, notice: 'Excuse card was successfully updated.' }\n format.json { render :show, status: :ok, location: @excuse_card }\n else\n format.html { render :edit }\n format.json { render json: @excuse_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company_card.update(company_card_params)\n format.html { redirect_to @company_card, notice: 'Company card was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_card }\n else\n format.html { render :edit }\n format.json { render json: @company_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @score_card.update(score_card_params)\n format.html { redirect_to project_score_card_path(@project, @score_card), notice: 'Scorecard was successfully updated.' }\n format.json { render :show, status: :ok, location: @score_card }\n else\n format.html { render :edit }\n format.json { render json: @score_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fleet_card = FleetCard.find(params[:id])\n\n respond_to do |format|\n if @fleet_card.update_attributes(params[:fleet_card])\n format.html { redirect_to(@fleet_card, :notice => 'Fleet Card was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fleet_card.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if params[:user][:cards_attributes]\n cards = []\n params[:user][:cards_attributes].each do |_, v|\n card = Card.where(uid: v[:uid]).first\n cards << card if card && v[:_destroy] == 'false'\n end\n @user.cards = cards.uniq\n end\n if @user.update(user_params)\n format.html { redirect_to @user, notice: t('user.update.success') }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_credit_card\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @deck = Deck.find(params[:id])\n\n respond_to do |format|\n if @deck.update_attributes(params[:deck])\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card_purch.update(card_purch_params)\n format.html { redirect_to @card_purch, notice: 'Card purch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @card_purch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @card = Card.find(params[:id])\n @card.project.actions.create! activity: \"#{current_user.name} chanded \\\"#{@card.story}\\\" to #{params[:card][:story]} Card story\"\n respond_to do |format|\n if @card.update_attributes(params[:card])\n format.html { redirect_to project_url(@card.project), notice: 'Card updated' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cards_partial_update_with_http_info(id, data, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CardsApi.cards_partial_update ...'\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 CardsApi.cards_partial_update\"\n end\n # verify the required parameter 'data' is set\n if @api_client.config.client_side_validation && data.nil?\n fail ArgumentError, \"Missing the required parameter 'data' when calling CardsApi.cards_partial_update\"\n end\n # resource path\n local_var_path = '/cards/{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 # 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(data) \n\n # return_type\n return_type = opts[:return_type] || 'Card' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CardsApi#cards_partial_update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @timecard.update(timecard_params)\n format.html { redirect_to @timecard, notice: 'Timecard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @timecard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @credit_card.update(credit_card_params)\n format.html { redirect_to @credit_card, notice: 'Credit card was successfully updated.' }\n format.json { render :show, status: :ok, location: @credit_card }\n else\n format.html { render :edit }\n format.json { render json: @credit_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @credit_card.update(credit_card_params)\n format.html { redirect_to @credit_card, notice: 'Credit card was successfully updated.' }\n format.json { render :show, status: :ok, location: @credit_card }\n else\n format.html { render :edit }\n format.json { render json: @credit_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @cards = args[:cards] if args.key?(:cards)\n end",
"def update\n respond_to do |format|\n if @payment_card.update(payment_card_params)\n format.html { redirect_to payment_cards_url, notice: 'Payment card was successfully updated.' }\n format.json { render :show, status: :ok, location: @payment_card }\n else\n format.html { render :edit }\n format.json { render json: @payment_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @job_card.update(job_card_params)\n format.html { redirect_to @job_card, notice: 'Job card was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_card }\n else\n format.html { render :edit }\n format.json { render json: @job_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flash_card_set ||= FlashCardSet.find params[:id]\n\n if @flash_card_set.update_attributes update_params\n render :show, status: 200\n else\n render json: { resource: \"flashCardSet\", errors: @flash_card_set.errors }, status: 409\n end\n end",
"def update\n respond_to do |format|\n if @creativitycard.update(creativitycard_params)\n format.html { redirect_to @creativitycard, notice: 'Creativitycard was successfully updated.' }\n format.json { render :show, status: :ok, location: @creativitycard }\n else\n format.html { render :edit }\n format.json { render json: @creativitycard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @card.update(card_params)\n #params[:card_parameters].each do |card_parameter|\n # puts @card\n # puts @card.card_parameters.each.update(card_parameter\n # @card.card_parameters.find_by_id(card_parameter).update(card_parameter)\n # puts card_parameter\n #end\n @card.card_parameters.each do |card_parameter|\n puts \"my param is\"\n # Find the corresponding form entry\n new_value = params[:card_parameters][card_parameter.id.to_s][\"value\"]\n card_parameter.update(value: new_value)\n #update(card_parameter\n end\n \n format.html { redirect_to @card, notice: 'Card was successfully updated.' }\n format.json { render :show, status: :ok, location: @card }\n else\n format.html { render :edit }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @deck.update(deck_params)\n format.html { redirect_to @deck, notice: 'Deck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cardbox = current_user.cardboxes.find(params[:id])\n\n respond_to do |format|\n if @cardbox.update_attributes(params[:cardbox])\n format.html { redirect_to(@cardbox, :notice => _('Der Karteikasten wurde geändert')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cardbox.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7463383",
"0.7452306",
"0.7431029",
"0.74097556",
"0.73259944",
"0.7316192",
"0.7316192",
"0.7316192",
"0.7282309",
"0.7244808",
"0.7238653",
"0.7135418",
"0.7109382",
"0.7100514",
"0.7100514",
"0.7100514",
"0.7100514",
"0.7100514",
"0.7100514",
"0.7084221",
"0.7065368",
"0.70625204",
"0.6944388",
"0.6924663",
"0.691931",
"0.6868077",
"0.6774618",
"0.6768974",
"0.6738523",
"0.6732697",
"0.66945404",
"0.66938275",
"0.6691564",
"0.660971",
"0.66022843",
"0.66015095",
"0.6592729",
"0.6572559",
"0.65681404",
"0.6508069",
"0.6499605",
"0.64986235",
"0.6496487",
"0.64943105",
"0.6489293",
"0.6486499",
"0.6483224",
"0.64747655",
"0.6464291",
"0.64517975",
"0.6446407",
"0.6436907",
"0.6419386",
"0.6406512",
"0.64062995",
"0.6397514",
"0.6393455",
"0.63921577",
"0.63816357",
"0.63660944",
"0.6362529",
"0.636023",
"0.6357429",
"0.6355199",
"0.6344164",
"0.6342653",
"0.63414943",
"0.6334655",
"0.632782",
"0.63193494",
"0.6318897",
"0.6312672",
"0.6308637",
"0.630621",
"0.63001686",
"0.62992615",
"0.62952137",
"0.6291025",
"0.6288626",
"0.62852055",
"0.6281039",
"0.6272696",
"0.62705183",
"0.62705183",
"0.6264132",
"0.62598234",
"0.62437713",
"0.62348944",
"0.6219095",
"0.6219095",
"0.6205883",
"0.61996865",
"0.6194075",
"0.6190299",
"0.61830705",
"0.618016",
"0.6178856",
"0.61647904",
"0.61638016",
"0.61594063"
] |
0.7084596
|
19
|
DELETE /card/1 DELETE /card/1.json
|
def destroy
@card.destroy
respond_to do |format|
format.html { redirect_to card_url, notice: 'Card was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n # @card = Card.destroy(params[:id])\n # render json: 200\n end",
"def destroy\n @card.delete\n render json: {messsage: \"Movie/Series Card was successfully deleted.\"}, status: 204\n end",
"def destroy\n #@card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url, :notice => 'Card successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.update!(deleted_at: Time.now)\n head :no_content\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to tarot_cards_path(@tarot) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n \n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n notify_admin(\"Card Removed (#{@card.last_three_digits})\", @card.as_json)\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n card = Card.find( params[:id] )\n card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n\n head :no_content\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: t(\".successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.card_parameters.destroy_all\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = @deck.cards.find(params[:id])\n @card.destroy\n respond_to do |format|\n format.html { redirect_to deck_path(@deck), notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to plan_path(@plan) }\n format.json { head :no_content }\n end\n end",
"def destroy\n if(params.has_key?(:card_id))\n @Waste3Card = Waste3Card.find_by_card_id(params[:card_id])\n @Waste3Card.destroy\n else\n Waste3Card.delete_all\n end\n render json: {}, status: :no_content\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to request.referer, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry_card.destroy\n respond_to do |format|\n format.html { redirect_to entry_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if(params.has_key?(:card_id))\n @Point3Card = Point3Card.find_by_card_id(params[:card_id])\n @Point3Card.destroy\n elsif(params.has_key?(:id))\n @Point3Card = Point3Card.find_by_card_id(params[:id])\n @Point3Card.destroy\n else\n Point3Card.delete_all\n end\n render json: {}, status: :no_content\n end",
"def destroy\n @inden_card.destroy\n respond_to do |format|\n format.html { redirect_to inden_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Tarjeta Creada Satisfactoriamente' }\n format.json { render :show, status: :ok, location: @card }\n end\n end",
"def destroy\n @wallet.destroy_card(params[:id])\n respond_to do |format|\n format.html { redirect_to wallet_path, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @card_detail.destroy\n respond_to do |format|\n format.html { redirect_to card_details_url, notice: 'Card detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if(params.has_key?(:card_id))\n @Waste2Card = Waste2Card.find_by_card_id(params[:card_id])\n @Waste2Card.destroy\n else\n Waste2Card.delete_all\n end\n render json: {}, status: :no_content\n end",
"def destroy\n @pk_card.destroy\n respond_to do |format|\n format.html { redirect_to pk_cards_url, notice: 'Pk card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteCard\n if !(Integer(params[:id]) rescue false)\n renderError(\"Not Acceptable (Invalid Params)\", 406, \"The parameter id is not an integer\")\n return -1\n end\n resultsGet = HTTParty.get(\"http://192.168.99.104:3003/credit_card?id=\"+params[:id])\n userA = (resultsGet[\"user_id\"])\n puts(userA)\n puts( @current_user[\"id\"])\n if userA != (@current_user[\"id\"])\n renderError(\"Forbidden\",403,\"current user has no access\")\n return -1\n else\n results = HTTParty.delete(\"http://192.168.99.104:3003/credit_cards?id=\"+params[:id])\n if results.code == 200\n head 200\n else\n render json: results.parsed_response, status: results.code\n end\n end\n end",
"def destroy\n if(params.has_key?(:card_id))\n @Point2Card = Point2Card.find_by_card_id(params[:card_id])\n @Point2Card.destroy\n elsif(params.has_key?(:id))\n @Point2Card = Point2Card.find_by_card_id(params[:id])\n @Point2Card.destroy\n else\n Point2Card.delete_all\n end\n render json: {}, status: :no_content\n end",
"def destroy\n @cruno_card = CrunoCard.find(params[:id])\n @cruno_card.destroy\n\n respond_to do |format|\n format.html { redirect_to cruno_cards_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @make_card.destroy\n RechargeableCard.where(make_card_id: params[:id]).delete_all\n respond_to do |format|\n format.html { redirect_to make_cards_url, notice: 'Make card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to deck_cards_path(@deck, @card), notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_m_card\n @m_card.destroy\n respond_to do |format|\n format.html { redirect_to m_cards_url }\n format.json { head :no_content }\n end\n end",
"def delete card\n @hand.delete(Card.new(card))\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to(deck_cards_url(@deck)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @card_purch.destroy\n respond_to do |format|\n format.html { redirect_to card_purches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if Card.find(params[:id]).destroy\n format.html { redirect_to cards_path, notice: \"Card deleted!\" }\n format.json { head :no_content }\n else\n format.html {\n flash[:danger] = \"Error : Failed to delete card.\"\n render :index\n }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @bcard = Bcard.find(params[:id])\n @bcard.destroy\n\n respond_to do |format|\n format.html { redirect_to bcards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bizcard = Bizcard.find(params[:id])\n @bizcard.destroy\n\n respond_to do |format|\n format.html { redirect_to bizcards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n @card.project.actions.create! activity: \"#{current_user.name} destroyed \\\"#{@card.story}\\\" Card\"\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n if !(params[:id].nil?)\n if (CompanyCard.exists?(params[:id]))\n card = CompanyCard.find(params[:id])\n card.destroy\n render status: 200, json:{\n message: \"Successfully deleted that card.\"\n }.to_json\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",
"def destroy\n @keycard.destroy\n respond_to do |format|\n format.html { redirect_to keycards_url, notice: 'keycard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eno_card.destroy\n respond_to do |format|\n format.html { redirect_to eno_cards_url, notice: 'Eno card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_cardapio = ItemCardapio.find(params[:id])\n @item_cardapio.destroy\n\n respond_to do |format|\n format.html { redirect_to item_cardapios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card_instance.destroy\n respond_to do |format|\n format.html { redirect_to card_instances_url, notice: 'Card owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @side_card.destroy\n respond_to do |format|\n format.html { redirect_to side_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @five_card = FiveCard.find(params[:id])\n @five_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(five_card_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vehicle_card.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mtb_card = MtbCard.find(params[:id])\n @mtb_card.destroy\n\n respond_to do |format|\n format.html { redirect_to mtb_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @namecard.destroy\n respond_to do |format|\n format.html { redirect_to namecards_url, notice: 'Namecard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tcard.destroy\n respond_to do |format|\n format.html { redirect_to tcards_url, notice: 'Tcard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bdcard = Bdcard.find(params[:id])\n @bdcard.destroy\n profile_info\n\n respond_to do |format|\n format.html { redirect_to bdcards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ccard.destroy\n respond_to do |format|\n format.html { redirect_to ccards_url, notice: 'Ccard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @safety_card.destroy\n\n respond_to do |format|\n format.html { redirect_to safety_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expansion_of_card = ExpansionOfCard.find(params[:id])\n @expansion_of_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(expansion_of_cards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bank_card = BankCard.find(params[:id])\n @bank_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(bank_cards_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end",
"def destroy\n @card_page.destroy\n respond_to do |format|\n format.html { redirect_to card_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poker_card.destroy\n respond_to do |format|\n format.html { redirect_to poker_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vote_card.destroy\n respond_to do |format|\n format.html { redirect_to vote_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @excuse_card.destroy\n respond_to do |format|\n format.html { redirect_to excuse_cards_url, notice: 'Excuse card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creativitycard.destroy\n respond_to do |format|\n format.html { redirect_to creativitycards_url, notice: 'Creativitycard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @name_card.destroy\n respond_to do |format|\n format.html { redirect_to name_cards_url, notice: 'Name card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fate_card.destroy\n respond_to do |format|\n format.html { redirect_to fate_cards_url, notice: 'Fate card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card_in_column.destroy\n respond_to do |format|\n format.html { redirect_to card_in_columns_url, notice: 'Card in column was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card = Card.find(params[:id])\n\n @current_user = User.find_by_id(session[:user_id])\n\n unless @current_user.admin?\n flash[:error] = \"You do not have permission to update a card\"\n redirect_to cards_path(@cards)\n return\n end\n\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @debit_card.destroy\n respond_to do |format|\n format.html { redirect_to debit_cards_url, notice: 'Debit card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timecard.destroy\n respond_to do |format|\n format.html { redirect_to timecards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deck_of_card.destroy\n respond_to do |format|\n format.html { redirect_to deck_of_cards_url, notice: 'Deck of card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @user_card.destroy\n respond_to do |format|\n format.html { redirect_to user_cards_url, notice: 'User card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scorecard = Scorecard.find(params[:id])\n @scorecard.destroy\n\n respond_to do |format|\n format.html { redirect_to scorecards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card_number = CardNumber.find(params[:id])\n @card_number.destroy\n\n respond_to do |format|\n format.html { redirect_to card_numbers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flashcard = Flashcard.find(params[:id])\n @flashcard.destroy\n\n respond_to do |format|\n format.html { redirect_to flashcards_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @creditcard.destroy\n respond_to do |format|\n format.html { redirect_to creditcards_url, notice: 'Creditcard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @card_set = CardSet.find(params[:id])\n @card_set.destroy\n\n respond_to do |format|\n format.html { redirect_to card_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flash_card = FlashCard.find(params[:id])\n @flash_card.destroy\n\n respond_to do |format|\n format.html { redirect_to(flash_cards_url) }\n format.json { render :json => [] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deck = Deck.find(params[:id])\n @deck.destroy\n\n respond_to do |format|\n format.html { redirect_to decks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deck = Deck.find(params[:id])\n @deck.destroy\n\n respond_to do |format|\n format.html { redirect_to decks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @graphic_card.destroy\n respond_to do |format|\n format.html { redirect_to graphic_cards_url, notice: 'Graphic card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @greeting_card.destroy\n respond_to do |format|\n format.html { redirect_to greeting_cards_url, notice: 'Greeting card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_card.destroy\n respond_to do |format|\n format.html { redirect_to time_cards_url, notice: 'Time card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deck.destroy\n respond_to do |format|\n format.html { redirect_to decks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deck = Deck.find(params[:id])\n @deck.destroy\n\n respond_to do |format|\n format.html { redirect_to user_root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bcard = Bcard.find(params[:id])\n @bcard.destroy\n\n respond_to do |format|\n format.html { redirect_to(bcards_url) }\n format.xml { head :ok }\n end\n end",
"def delete_card\n\t\t@card = Cardsort.find(params[:cardsort_id]).cards.find(params[:card_id]);\n\t\t@card.destroy\n\t\trespond_to do |format|\n\t\t\tformat.js { render \"delete_card\"}\n\t\tend\n\tend",
"def destroy\n if @owned_card.user == current_user\n @owned_card.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to owned_cards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog_card.destroy\n respond_to do |format|\n format.html { redirect_to blog_cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bank_card_type.destroy\n respond_to do |format|\n format.html { redirect_to bank_card_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_card.destroy\n respond_to do |format|\n format.html { redirect_to company_cards_url, notice: 'Company card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @credit_card.destroy\n respond_to do |format|\n format.html { \n redirect_to edit_student_path(@student), notice: 'Credit card was successfully deleted.' \n }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end"
] |
[
"0.79048026",
"0.77135766",
"0.7698533",
"0.76649034",
"0.76649034",
"0.76649034",
"0.7621165",
"0.7590184",
"0.75511134",
"0.7539759",
"0.7500963",
"0.7495693",
"0.74601656",
"0.7455783",
"0.7440562",
"0.74256694",
"0.74256694",
"0.74256694",
"0.74256694",
"0.74256694",
"0.74256694",
"0.74256694",
"0.73933166",
"0.73907137",
"0.7386194",
"0.7356584",
"0.734016",
"0.7331041",
"0.7324528",
"0.72985077",
"0.7293343",
"0.72701085",
"0.7255481",
"0.724423",
"0.7243232",
"0.7227677",
"0.7197606",
"0.719056",
"0.7189336",
"0.7181121",
"0.7180255",
"0.7175945",
"0.7169719",
"0.7158438",
"0.71337724",
"0.7130553",
"0.7125767",
"0.7110423",
"0.71086913",
"0.7106142",
"0.7071565",
"0.7069625",
"0.70596933",
"0.70254576",
"0.7025116",
"0.7023555",
"0.7014405",
"0.7012986",
"0.697725",
"0.69762343",
"0.69759125",
"0.69721174",
"0.69721",
"0.6960021",
"0.6949318",
"0.69437236",
"0.69400823",
"0.6936778",
"0.693191",
"0.69158566",
"0.6913576",
"0.6907359",
"0.6897388",
"0.6891132",
"0.68900096",
"0.68869585",
"0.6886172",
"0.68721133",
"0.6865295",
"0.6854905",
"0.6850263",
"0.6846434",
"0.6843935",
"0.6828869",
"0.6811745",
"0.6810114",
"0.68072766",
"0.67921245",
"0.6789559",
"0.6784212",
"0.67830426",
"0.6778647",
"0.67785716",
"0.6776795",
"0.6759774",
"0.6753479",
"0.67518073",
"0.6749553",
"0.6746355",
"0.6741687"
] |
0.72505146
|
33
|
Use callbacks to share common setup or constraints between actions.
|
def set_card
@card = Card.where(authorization_id: Authorization.current_id).find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def card_params
params.require(:card).permit(:title, :description, :color, :status, :row_order_position)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
minutes before appointment Notify our appointment attendee X minutes before the appointment time
|
def alert
# @twilio_number = ENV['TWILIO_NUMBER']
# @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']
# binding.pry
number_to_send_to = self.phone_number
twilio_sid = "ACca4bce79e5cdb95990cdf5a84b89c45b"
twilio_token = "5f5703217d9812afe53c1fceea9d0b3f"
twilio_phone_number = "5404694050"
@twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token
# time_str = ((self.time).localtime).strftime("%I:%M%p on %b. %d, %Y")
reminder = "Hi 😍 This is a reminder from the Shiviti App. Happy Meditating 🙏"
# @twilio_client.account.sms.messages.create
message = @twilio_client.account.messages.create(
:from => "+1#{twilio_phone_number}",
:to => number_to_send_to,
:body => reminder,
)
puts message.to
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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",
"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",
"def appt_follow_up_email_time\n self.start_time + 4.hours\n end",
"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",
"def remaining_appointments_today\n Appointment.today.with_doctor(doctor_id).\n where(appointment_time: appointment_time+1.minute...DateTime.tomorrow)\n end",
"def make_reminder(minutes_before = 510)\n Google::Apis::CalendarV3::EventReminder.new({\n minutes: minutes_before,\n reminder_method: 'popup'\n })\nend",
"def add_delay\n appointment = Appointment.find(params[:appointment_id])\n time_to_add = params[:delay_time].to_i\n new_time = appointment.appointment_delayed_time + time_to_add.minutes\n if appointment.update_attribute(:appointment_delayed_time, new_time)\n flash[:success] = \"Appointments updated\"\n appointment.send_delay_email\n appointment.push_delay_notification\n if params.keys.include?(\"apply_to_all\")\n appointment.update_remaining_appointments!(time_to_add)\n end\n render status: 200, json: {\n message: 'Appointments updated'\n }\n else\n render status: 400, json: {\n message: 'An error has occured please try again'\n }\n end\n end",
"def ask_fill_appointment(user, orig_appointment, new_time)\n @user = user\n @orig_appointment = orig_appointment\n @new_time = new_time\n\n mail to: user.email, subject: 'Appointment time change request'\n end",
"def appointment_time_in_future\n if appointment_time.nil?\n errors.add(:appointment_time, \"No Date/time entered.\")\n else\n errors.add(:appointment_time, \"Date/Time must be set in the future.\") if\n appointment_time < DateTime.now.in_time_zone(clinic_timezone)\n end\n end",
"def meeting_time_later_than_now?\n\t\tif self.meeting_time < DateTime.now\n errors.add(:meeting_time, \"Meeting time must be later than now!\")\n\t\tend\n\tend",
"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",
"def min_available_talks_time_in_a_day\n 6*60\n end",
"def test_time_of_schedule_reminders\n @reminder.scheduled_reminders.each{|x| assert_equal x.run_at.hour, @reminder.fq_time.hour}\n @reminder.scheduled_reminders.each{|x| assert_equal x.run_at.min, @reminder.fq_time.min}\n end",
"def appointment_reschedule_for_tutor(appointment_id, original_time)\n @appt = Appointment.find(appointment_id)\n @original_time = original_time\n set_appt_variables\n mail(to: @tutor.email, subject: \"Your Axon tutoring appointment has changed\")\n end",
"def appointment_reminder_for_tutor(appointment_id)\n @appt = Appointment.find(appointment_id)\n set_appt_variables \n mail(to: @tutor.email, subject: \"Your upcoming Axon tutoring appointment\")\n end",
"def delivery_time_can_not_be_too_soon\n if time < Time.now + @@starttime\n errors.add(\"Ora di consegna:\", \"ci vogliono almeno #{@@starttime/60} minuti per l\\'elaborazione.\n Quindi ordinazioni prima delle #{(Time.now + @@starttime).strftime(\"%H:%M\")} non possono essere accettate.\")\n end\n end",
"def reminder(person, time_slots)\n @person = person\n @time_slot_text = \"#{time_slots.first.day} #{time_slots.first.time.strftime('%l:%M%P')} - #{(time_slots.last.time + 30.minutes).strftime('%l:%M%P')}\"\n\n mail to: @person.email, subject: 'Adoration Reminder'\n end",
"def before_midnight(time)\n total_minutes = after_midnight(time)\n total_minutes == 0 ? 0 : 1440 - total_minutes\nend",
"def appointment_complete\n end",
"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 = \"tripalink.dev@gmail.com\" if !@appointment.expert\n mail to: email, subject: \"Appointment schedule confirmation\"\n end\n end",
"def appointment\n ReminderMailer.appointment\n end",
"def appointment_time(appt)\n case appt.user_response\n when \"1\"\n return appt.option_one\n when \"2\"\n return appt.option_two\n else\n return appt.option_three\n end\n end",
"def create\n @appointment = Appointment.new(appointment_params)\n if @appointment.starts_at != nil\n @appointment.ends_at = @appointment.starts_at + 30.minutes\n end\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to new_appointment_path, notice: 'Agendamento realizado.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :schedule }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def passcode_minutes_of_inactivity_before_lock=(value)\n @passcode_minutes_of_inactivity_before_lock = value\n end",
"def shift_start_hour\n if self.start_time.hour > 2 && self.start_time.hour < 7\n errors.add(:start_time, 'must be between 7am and 2am')\n end \n end",
"def appointment_pending(appoint_obj)\n @doctor = Doctor.find_by_id(appoint_obj.doctor_id)\n @patient = Patient.find_by_id(appoint_obj.patient_id)\n mail(:to => @doctor.email, :subject => \"New Appointment\")\n end",
"def time_notification\n \"You have #{@time_to_answer / 60} min #{@time_to_answer % 60} sec left\"\n end",
"def has_appointment?(date, time)\n datetime = Temporal.generate_datetime(date, time)\n\n !is_available?(datetime, 20) #the time is broken up into 20 minute blocks\n end",
"def test_minute_set\n clock = Clock.new 0, -1\n alarm = AlarmClock.new 0, -1\n puts 'Wrong hour set' if clock.get_minute != 0\n puts 'Wrong hour set' if alarm.get_alarm_minute != 0\n clock.set_time 26, 0\n alarm.set_alarm 26, 0\n puts 'Wrong hour set' if clock.get_minute != 23\n puts 'Wrong hour set' if alarm.get_alarm_minute != 23\n end",
"def timer_update(event)\n if (event)\n tc = DateTime.now.to_i - event.created_at.to_i\n tu = DateTime.now.to_i - event.updated_at.to_i\n [tu, tc].min > 4\n end\n end",
"def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end",
"def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end",
"def next_meeting(after_time = Time.now.utc )\n # puts \"Looking up next meeting after #{after_time}\"\n if recurrence_frequency.blank?\n return start_time\n end\n\n if after_time < start_time\n return start_time\n end \n\n after_time = after_time.local_from_utc(self.time_zone) \n\n\n # Advance the starting time in the case when it falls after the beginning of\n # a meeting on the same day. We do this so that we can use \"day precision\"\n # (PDate.day) in the Runt library instead of \"minute precision\" (PDate.min),\n # which performs terribly.\n start_time = start_time_local\n if(after_time.hour > start_time.hour or ( after_time.hour == start_time.hour and after_time.min > start_time.min))\n after_time = after_time + 1.day\n after_time = Time.gm(after_time.year, after_time.month, after_time.day, 0, 0)\n end\n\n case recurrence_frequency\n when 'daily'\n end_time = after_time + 25.hours \n # after_time -= 1.day\n start_date = PDate.day(after_time.year, after_time.month, after_time.day , after_time.hour, after_time.min)\n end_date = PDate.day(end_time.year, end_time.month, end_time.day, end_time.hour, end_time.min)\n when 'weekdays'\n # Make the range over 3 days so that Friday night searches will still turn\n # up Monday as the next day.\n end_time = after_time + 3.days\n start_date = PDate.day(after_time.year, after_time.month, after_time.day, after_time.hour, after_time.min)\n end_date = PDate.day(end_time.year, end_time.month, end_time.day, end_time.hour, end_time.min)\n when 'monthly'\n eom = (after_time + 40.days)\n start_date = PDate.day(after_time.year, after_time.month, after_time.day)\n end_date = PDate.day(eom.year, eom.month, eom.day)\n when 'weekly'\n eow = (after_time + 8.days)\n start_date = PDate.day(after_time.year, after_time.month, after_time.day)\n end_date = PDate.day(eow.year, eow.month, eow.day)\n when 'yearly'\n # Just doing \"after_time + 367.days\" results in a bit of a performance hit\n # as hundreds of days are compared. We'll try to narrow it a bit. Not too\n # much, because we don't have time to actually write unit tests and make\n # sure the narrowing code works. :) Which is why the comment is here.\n st = after_time + 250.days\n et = st + 150.days\n start_date = PDate.day(st.year, st.month, st.day)\n end_date = PDate.day(et.year, et.month, et.day)\n end \n # puts \" Range #{start_date.to_s} - #{end_date.to_s}\"\n d_range = DateRange.new(start_date, end_date)\n sched = Schedule.new\n event = Event.new((self.invitation.name rescue \"no name\"))\n sched.add(event,self.runt_expression)\n dates = sched.dates(event,d_range)\n\n next_mtg = dates.first\n next_mtg_time = Time.gm(next_mtg.year, next_mtg.month, next_mtg.day, start_time_local.hour, start_time_local.min)\n result = nil\n begin\n result = next_mtg_time.local_to_utc(self.time_zone)\n rescue TZInfo::PeriodNotFound\n # This only happens when the time is during the one hour which is skipped\n # during the transition to DST. For example, only on Sun Mar 08 02:15:00\n # (see ticket #744).\n next_hour = start_time_local.hour + 1\n next_mtg_time = Time.gm(next_mtg.year, next_mtg.month, next_mtg.day, next_hour, start_time_local.min)\n retry\n end\n return result\n end",
"def passcode_minutes_of_inactivity_before_screen_timeout=(value)\n @passcode_minutes_of_inactivity_before_screen_timeout = value\n end",
"def send_day_before_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end",
"def lead_time\n 4\n end",
"def add_reminder; end",
"def valid_appointments(base_time)\n transform_blocks_to_appointments(valid_blocks(base_time))\n end",
"def time_period_for_room_reservation\n time_period = (self.start_date.year * 12 + self.start_date.month) - (Date.today.year * 12 + Date.today.month)\n errors.add(:start_date, \"you can book your room before 6 months only\") if time_period > 6\n end",
"def send_delay_email\n PatientMailer.appointment_delayed_email(patient,\n appointment_delayed_time).deliver_later\n end",
"def minutes_running_low(tenant)\n ActsAsTenant.current_tenant = nil\n @tenant = tenant\n @plan = tenant.plan_bid.to_s\n @days = (tenant.next_due - Date.today).to_i\n mail(subject: 'Minutes Running Low', to: @tenant.owner.email, bcc: APP_CONFIG['admin_emails'])\n end",
"def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end",
"def max_slack_before(begins_at)\n previous_reservation = Reservation.new(entity: self, begins_at: begins_at).previous\n (begins_at - previous_reservation.ends_at - previous_reservation.slack_after.minutes) / 1.minute if previous_reservation.present?\n end",
"def evaulate_schedule\n 5\n end",
"def send_one_week_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end",
"def extendbythirthydays\n update_at = update_at + 14.days.from_now\n end",
"def reminder_sent\n end",
"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",
"def should_send_opening_reminder\n time_now = Time.zone.now\n return false if start_at && start_at_was && start_at < time_now && start_at_was < time_now\n\n true\n end",
"def reschedule_appointment\n if @patient.appointments.length < 1\n puts \"You currently have no appointments\"\n sleep(2)\n else\n @prompt.select \"Which appointment would you like to Reschedule?\" do |menu|\n @patient.appointments.each do |appt|\n menu.choice appt.time, -> { change_appt(appt) }\n end\n menu.choice \"<Go Back>\", -> { appointment_system } #back \n end\n end\n @patient.reload\n appointment_system\n end",
"def time_collision_validation\n\t\tappointments = Appointment.all\n\n\t\t#if duration is equals to 0, it means it is fixed pay. \n\t\t#Here, duration is set to 0 so it will not be validated \n\t\t#This will execute if is_pay_per hour is set to 0\n\t\tif @start_date.present? && @start_time.present? && duration == 0.to_s\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\n\t\t\tappointments.each do |a|\n\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t# compare fixed-pay input to pay per hour appointment\n\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && start_at >= a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"An appointment is already \n\t\t\t\t\t\t\tset at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\n\n\t\t\t\t\t\t#compare fixed-pay input to fixed pay appointment\n\t\t\t\t\telsif !a.task.is_pay_per_hour && start_at == a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend \t\n\t\t\t\tend \t\n\t\t\tend\n\n\n\t\t\t\t#Here, duration should be present and will be always validated\n\t\t\t\t#This will execute if is_pay_per hour is set to 1\n\t\t\telsif @start_date.present? && @start_time.present? && duration.present?\n\t\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\tend_at = Time.parse(\"#{@start_date} #{@start_time}\") + (@duration.to_f.hours+ (1.hours))\n\n\t\t\t\tappointments.each do |a|\n\t\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t\t# compare pay per hour input to pay per hour appointment\n\t\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && a.start_at < end_at \n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"An appointment already \n\t\t\t\t\t\t\t\texists at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\n\n\t\t\t\t\t\t\t#compare pay per hour input to fixed pay appointment\n\t\t\t\t\t\telsif !a.task.is_pay_per_hour && a.start_at <= end_at && a.start_at >= start_at\n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\t\t\t\t\n\t\t\t\t\t\tend\t\t\t\n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\tend \n\t\tend",
"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",
"def exit_reminder_mail(horafinal, correo, placa, numspace, floorspace)\n @numspace = numspace\n @floorspace = floorspace\n @horafinal = ((Time.parse(horafinal) - Time.now) / 60).to_i\n @placa = placa\n mail(to: correo, subject: 'Your car reminder')\n end",
"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",
"def cancel_appointment appointment\n time_range = TimeRange.new appointment.started_at, appointment.finished_at\n if appointment.daily_schedule_id == self.id\n self.free time_range\n true\n end\n false\n end",
"def expected\n (@terminated_at - @started_at).to_i * @schedule.pill_times.size\n end",
"def before(time)\n time - self\n end",
"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",
"def block_delivery_start_time\n unless delivery_slots_from.blank?\n delivery_slots_from.round_up(60.minutes)\n end\n end",
"def test_onetimeappointment\n \n appt = OneTimeAppointment.new(\"Room 202\", \"ISM210\", 1, 30, 26, 2, 2018)\n \n assert_equal \"Room 202\", appt.location()\n assert_equal 1,appt.hour\n assert_equal \"ISM210\", appt.purpose()\n assert_equal 30,appt.min\n assert_equal 26,appt.day\n assert_equal 2018,appt.year\n assert_equal \"Room 202 ISM210 1 30 26 2 2018\", appt.to_s\n assert_equal true, appt.occurs_on?(2018, 2, 26)\n assert_equal false, appt.occurs_on?(2015, 6, 17)\n \n end",
"def push_next_try_at\r\n self.next_try_at = 15.minutes.from_now\r\n end",
"def get_time_required\n 0 # number of minutes\n end",
"def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end",
"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",
"def break_appointments\n on RegistrationWindowsCreate do |page|\n page.break_appointments(@appointment_window_info_name, @period_key)\n page.confirm_break_appointments\n end\n end",
"def time_cannot_be_in_the_past\n time1 = DateTime.now - 300.minutes\n time2 = self.time \n if time1 > time2 \n errors.add(:time, \"can't be in the past \")\n end\n end",
"def month_before(a_time)\nend",
"def send_three_week_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end",
"def eats_at\n if meal_time <= 11\n \"#{meal_time + 1}AM\"\n elsif meal_time > 12\n \"#{meal_time - 11}PM\"\n else\n \"Please put a number \"\n end\n end",
"def push_delay_notification\n droid_destinations = patient.devices.map do |device|\n device.token if device.platform == 'android' && device.enabled\n end\n data = {:type => \"DELAY\", :appointment_id => id, :message =>\n \"Your appointment time has changed. Your appointment with #{clinic.name}\" +\n \" is now set to #{delayed_date_time_ampm}\" }\n Thread.new do\n GCM.send_notification(droid_destinations, data) unless droid_destinations.empty?\n end\n end",
"def notify_on_difference(new_pct,avg_pct,limit)\n mapping = self.map\n instructor = mapping.assignment.instructor \n Mailer.deliver_message(\n {:recipients => instructor.email,\n :subject => \"Expertiza Notification: A review score is outside the acceptable range\",\n :body => { \n :first_name => ApplicationHelper::get_user_first_name(instructor),\n :reviewer_name => mapping.reviewer.fullname,\n :type => \"review\",\n :reviewee_name => mapping.reviewee.fullname,\n :limit => limit,\n :new_pct => new_pct,\n :avg_pct => avg_pct,\n :types => \"reviews\",\n :performer => \"reviewer\",\n :assignment => mapping.assignment, \n :partial_name => 'limit_notify'\n }\n }\n ) \n end",
"def when_to_run\n time - @@REMINDER_TIME\n end",
"def preferred_time\n which_day = if notification.created_at < TIME_LENGTH.ago\n (Time.now.hour < 17) ? Time.now : TIME_LENGTH.from_now\n else\n TIME_LENGTH.from_now\n end\n which_day.beginning_of_day + 13.hours + rand(4).hours\n end",
"def appointment_on_is_valid\n return if appointment_on.nil? || !appointment_on_changed?\n\n unless (appointment_on.to_date - Date.today) >= MINIMUM_DAYS\n errors[:appointment_on] << \"should be at least #{MINIMUM_DAYS} days from today\"\n end\n end",
"def set_appointments\n @appointments = []\n latest_message = Message.order('created_at').last\n lines = latest_message.message_lines.where(order: params[:Body].split(' ').map(&:to_i))\n lines.each do |line|\n @appointments << line.appointment\n end\n end",
"def trial_ending(user)\n mail to: user.email, subject: \"Only 72 Hours Left of Review Alerts!\"\n end",
"def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end",
"def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end",
"def due_next_week_warning_mail\n PetitionMailer.due_next_week_warning_mail(Petition.live.first)\n end",
"def appointment_unique_with_doctor_in_clinic\n times_taken = []\n begin\n self.doctor.appointments.confirmed.each do |appt|\n unless appt.id == self.id\n times_taken << appt.appointment_time\n end\n end\n rescue NoMethodError\n errors.add(:doctor_id, 'No doctor specified')\n end\n errors.add(:appointment_time, \"Time not available\") if times_taken.include?(appointment_time)\n end",
"def new\n\n\t\t\n\t\t\t@appointments = Appointment.all\n\t\t\t@taken_slots = []\n\n\t\t\t@appointments.each do |appt|\n\t\t\t\t\t#@taken_slots << [appt.time.strftime(\"%I:%M %p\")]\n\t\t\tend\n\n\t\t\t# @appointments.each do |appt|\n\t\t\t# \tif is_taken?(appt)\n\t\t\t# \t\t@taken_times << appt.time.strftime(\"%I:%M %p\")\n\t\t\t# \tend\n\t\t\t# end\n\t\t\t\n\t\t\t@appointment = Appointment.new\n\t\t\t\n\t\tif current_user.present?\n\t\t\t@appointment.user_id = current_user.id\n\t\t\t@appointment.save\n\n\t\tend\n\n\tend",
"def prep_time_passed\n return \"7:34\"\n end",
"def appointment_cancellation_for_tutor(appointment_id)\n @appt = Appointment.find(appointment_id)\n set_appt_variables\n mail(to: @tutor.email, subject: \"One of your Axon appointments has been cancelled\")\n end",
"def get_time_tutor_can_help\n start_time = self.student_requests.where(status:\"active\").first.start_time\n if(Time.now-start_time)/60>30 #if a tutor has been working longer than 30 min\n return Time.now.in_time_zone + 60*30\n end\n return start_time + 60*30\n end",
"def lead_time\n 1\n end",
"def create\n #@appointment = Appointment.new(params[:appointment])\n \n #@appointment = Appointment.new\n @length_options = (30..360).step(30).map { |d| [ d < 60 ? \"#{d.to_s} minutes\" : \"#{(d/60.round(1)).to_s} #{\"hour\".pluralize(d/60.round(1))}\" , d.to_s ] }\n\n @host = User.find(params[:user_id])\n @attendee = current_user\n\n @fee = @host.profile.expertise_hourly\n\n #generate random string to identify appointment\n o = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten\n @hash = (0...10).map{ o[rand(o.length)] }.join\n\n # put in appointment request attributes\n @appointment = Appointment.new\n @appointment_params = params[:appointment]\n @appointment.host = User.find(@appointment_params[:host_id])\n @appointment.attendee = User.find(@appointment_params[:attendee_id])\n @appointment.time = @appointment_params[:time]\n @appointment.fee = @appointment_params[:fee]\n @appointment.length = @appointment_params[:length]\n @appointment.attendee_confirmed = true\n @appointment.chat_key = @hash\n\n #send notice/message for appointment\n recipient_ids = params[:conversation][:recipients].split(',')\n recipients = User.where(slug: recipient_ids).all\n\n respond_to do |format|\n if @appointment.save\n conversation = current_user.\n send_message(recipients, params[:conversation][:body], \"Appointment Request: #{@appointment.fee * (@appointment.length.to_f/60)} credits / #{@appointment.length} minutes\").conversation\n\n @appointment.conversation_id = conversation.id\n @appointment.save\n\n format.html { redirect_to appointment_path(id: @appointment.id, user_id: current_user.slug), notice: 'Appointment was successfully created.' }\n format.json { render json: @appointment, status: :created, location: @appointment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def passcode_minutes_of_inactivity_before_screen_timeout\n return @passcode_minutes_of_inactivity_before_screen_timeout\n end",
"def add_reminder(event, reminderMinutes, reminderMethod)\r\n event[:reminders] = event[:reminders].to_s + \r\n \"<gd:reminder minutes='#{reminderMinutes}' method='#{reminderMethod}' />\\n\"\r\n end",
"def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end",
"def get_appointment_duration(start_time)\n duration = self.doctor.doctor_profile.appointment_duration\n self.finish_time = (start_time.to_time + duration.to_i).strftime(\"%H:%M:%S\").to_time.strftime(\"%H:%M:%S\") if start_time.present?\n duration\n end",
"def confirm_reschedule\n reschedule = ApptRescheduler.new(@appt.id, params).format_new_time\n if reschedule[:success] == true\n @new_start_time = reschedule[:new_start_time]\n @new_slot_id = reschedule[:new_slot_id]\n end\n render layout: '../dashboard/student/home/confirm_reschedule'\n end",
"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",
"def prebooking_reminder(service)\n notification = Notification.find_by_name(\"Pre booking reminder\")\n vehicle = service.fleet\n setting = vehicle.truck_fleet.setting.email_notifications.find_by_notification_id(notification.id)\n emails = self.find_emails(vehicle, setting)\n if emails.present?\n mail :to => emails,\n :subject => \"Prebooking reminder. For #{vehicle.fleet_number}\"\n end\n end",
"def reminder\n RequestMailer.reminder\n end",
"def test_ut_t5_sef_con_002\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:time_out]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:time_out],OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.include?(\"for more than maximum time\")\n end",
"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",
"def cutoff\n Time.now - (60 * 60 * HOURS)\n end",
"def appointment_confirmation_for_tutor(appointment_id)\n @appt = Appointment.find(appointment_id)\n set_appt_variables\n mail(to: @tutor.email, subject: \"You have a new appointment with Axon\")\n end",
"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: \"hugohelp@conzealand.nz\", subject: subject)\n end",
"def active_minutes\n return self.minutes_attended if self.started_at.nil?\n\n if self.active?\n # If we're active, we need to use the last known started_at as well as\n # adding any existing minutes_attended (in case they were stopped and then\n # restarted)\n self.minutes_attended + ((Time.now - self.started_at)/60).floor\n else\n self.minutes_attended\n end\n end",
"def cancel_appointment(appointment)\n @appointment = appointment\n if which == 1\n mail to: @appointment.user.email, subject: \"Appointment cancel confirmation\"\n else\n mail to: @appointment.expert.email, subject: \"Appointment cancel confirmation\"\n end\n end"
] |
[
"0.7341507",
"0.7205398",
"0.6692888",
"0.66680723",
"0.6648208",
"0.6289941",
"0.62241244",
"0.6103053",
"0.6059005",
"0.5996214",
"0.59829277",
"0.5951747",
"0.5945291",
"0.5890815",
"0.5878209",
"0.5867546",
"0.5843747",
"0.58108234",
"0.5771476",
"0.57576025",
"0.57400644",
"0.5716563",
"0.56819427",
"0.5619279",
"0.5590179",
"0.55838305",
"0.55258095",
"0.5519484",
"0.5496618",
"0.5494243",
"0.5473964",
"0.5473964",
"0.54731655",
"0.54634655",
"0.5454081",
"0.54511666",
"0.5446388",
"0.5422603",
"0.5416858",
"0.54068667",
"0.54004425",
"0.53710455",
"0.53594846",
"0.5340431",
"0.5332755",
"0.53268355",
"0.532544",
"0.53247476",
"0.5320263",
"0.5319029",
"0.53190243",
"0.5318616",
"0.53131753",
"0.5309658",
"0.5304088",
"0.52886355",
"0.5284983",
"0.528024",
"0.5277902",
"0.5277251",
"0.52767277",
"0.52762675",
"0.5268897",
"0.5267933",
"0.5264591",
"0.52609384",
"0.5257683",
"0.5245608",
"0.52434987",
"0.52401245",
"0.5239847",
"0.5235667",
"0.523536",
"0.52225983",
"0.5221439",
"0.5216145",
"0.52083683",
"0.52083683",
"0.52006066",
"0.51894903",
"0.51880574",
"0.51798964",
"0.51755273",
"0.5173972",
"0.5173246",
"0.51716244",
"0.5167075",
"0.5165024",
"0.5158757",
"0.5157739",
"0.51566905",
"0.5151769",
"0.51460576",
"0.5141375",
"0.51385045",
"0.51382655",
"0.5137746",
"0.5135269",
"0.51339084",
"0.512871",
"0.5126564"
] |
0.0
|
-1
|
GET /batches GET /batches.json
|
def index
@batches = Batch.all
respond_to do |format|
format.html {}
format.json {
data = Hash.new
data["batches"] = @batches
return_success_response(data, "Request Successful", 200)
}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @batches = Batch.page(params[:page]).per(15)\n @page = params[:page] || 1\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batches }\n end\n end",
"def list_batches_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.list_batches ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/batches'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\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] || 'ListBatchesResponseBody' \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: BatchesApi#list_batches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @batches = Batch.all\n end",
"def index\n @batches = @zone.batches\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batches }\n end\n end",
"def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end",
"def index\n @batches = Batch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @batches }\n end\n end",
"def index\n @batches = Batch.all\n @batches.each do |batch|\n authorize! :read, batch\n end\n render json: @batches\n end",
"def index\n # Получаем список всех загруженных файлов\n @batches = Batch.all\n end",
"def index\n @batches = BatchSearch.search_batches(params)\n # Return Batches after Search\n # @batches.each do |m|\n # @course = m.course\n # end\n # @batches_update = @course.batches if @course.present?\n add_breadcrumb \"Batches\"\n end",
"def list_batches(opts = {})\n data, _status_code, _headers = list_batches_with_http_info(opts)\n data\n end",
"def show\n respond_to do |format|\n format.html { render layout: false }\n format.json do\n batches = Batch.where(item_id: params[:id])\n render json: batches\n end\n end\n end",
"def batch\n # conditions => in Url item should be available\n # Url generated from Js script function => getbatch() of _form.html.erb file under Views of different controllers\n @batch = Stock.where('item_name = ? and user_id = ?' , params[:name], current_user.id).distinct.pluck(:batch_number )\n # send batch_number in form of json\n render json: @batch\n end",
"def index\n @ready_for_shipment_batches = ReadyForShipmentBatch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ready_for_shipment_batches }\n end\n end",
"def index\n @batches = Batch.all\n @tab_title = \"brewery_batches\"\n end",
"def index\n @batches = Batch.all.order(created_at: :desc)\n end",
"def get_organization_action_batches(organization_id)\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'organization_id' => organization_id\r\n )\r\n # Prepare query url.\r\n _path_url = '/organizations/{organizationId}/actionBatches'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'organizationId' => organization_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def show\n render json: @batch\n end",
"def show\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batch }\n end\n end",
"def action_batches\r\n ActionBatchesController.instance\r\n end",
"def index\n @batch_files = BatchFile.all\n end",
"def get_query_batches(customer_po, \n count = 100000)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/queryBatches'\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'customerPO' => customer_po,\n 'count' => count\n }\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json'\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return QueryBatchesResponseModel.from_hash(decoded)\n end",
"def load_batches\n if params[:course_id].present?\n unless params[:course_id] == 'all'\n @batches = Batch.active.all(:conditions=>[\"course_id in (?)\", params[:course_id]])\n else\n @course = 'all'\n @batches = _all_batch\n end\n else\n @batches = []\n end\n render :update do |page|\n page.replace_html \"list_batches\", :partial => \"finance_reports/filters/multi_select_batch\"\n end\n end",
"def index\n @batch = Batch.new\n\n # Display only the current user's batches\n if current_user.present?\n @batches = current_user.batches\n else\n @batches = Batch.all\n end\n end",
"def get_batch_by_id_with_http_info(batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.get_batch_by_id ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.get_batch_by_id\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.get_batch_by_id, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.get_batch_by_id, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.get_batch_by_id, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'GetBatchByIdResponseBody' \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: BatchesApi#get_batch_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def batch(*requests)\n Batch.new(requests)\n end",
"def index\n @own_batches = [Batch.all(:conditions => [\"user_id = ?\", current_user.id],\n :order => \"brewed_on DESC\")].flatten.compact\n @others_batches = [Batch.all(:conditions => [\"user_id != ?\", current_user.id],\n :order => \"brewed_on DESC\")].flatten.compact\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @batches }\n end\n end",
"def show\n @tengine_batch = Tengine::Batch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tengine_batch }\n end\n end",
"def batch options = {}\n Diffbot::APIClient::Batch.new self, options\n end",
"def restFetchBatch(dbName, idListStr, formatName='default', styleName='default')\n printDebugMessage('restFetchBatch', 'Begin', 1)\n url = \"#{baseUrl}/#{dbName}/#{idListStr}/#{formatName}?style=#{styleName}\"\n retVal = restRequest(url)\n printDebugMessage('restFetchBatch', 'End', 1)\n return retVal\n end",
"def batch_params\n params[:batch]\n end",
"def batch_of_items\n @catalog=Catalog.find(params[:id])\n \n # set a reasonable default for the current page\n @page=params[:page]\n @page=1 if @page.nil?\n \n # set a reasonable default for the current size\n @size=params[:size]\n @size=12 if @size.nil?\n \n # grab the batch of items corresponding to the page and size\n @items = @catalog.get_batch_of_items(@page, @size)\n \n respond_to do |format|\n # wouldn't make sense to call this API method as html, but for debugging purposes\n # just return json anyway\n format.html { render json: {:items => @items, :page => @page, :size => @size }}\n format.json { render json: {:items => @items, :page => @page, :size => @size }}\n end\n end",
"def index\n @batting_lines = BattingLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batting_lines }\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n add_breadcrumb \"Batches\", batches_url\n add_breadcrumb \"New Batch\"\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n flash[:alert] = @batch.errors.full_messages.to_sentence\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @mc_batches = McBatch.order(created_at: :desc)\n end",
"def send_batch_request(batch)\n post_data = batch.to_json\n resp = RestClient.post(@url, post_data, content_type: 'application/json', user_agent: \"syncano-ruby-#{Syncano::VERSION}\")\n if resp.nil? || resp.body.nil? || resp.body.empty?\n raise Jimson::ClientError::InvalidResponse.new\n end\n\n return resp.body\n end",
"def checkout\n @batches = Batch.all\n end",
"def create_batch urls\n function = 'batch/'\n\n post_data = {}\n post_data[:urls] = urls.join(',')\n\n request(@resource, function, nil, 'post', post_data)\n end",
"def send_batch\n batch = @batch.map(&:first) # get the requests\n response = send_batch_request(batch)\n\n begin\n responses = JSON.parse(response)\n rescue\n raise Jimson::ClientError::InvalidJSON.new(json)\n end\n\n process_batch_response(responses)\n responses = @batch\n\n @batch = []\n\n responses\n end",
"def show\n add_breadcrumb \"Batches\", batches_url\n add_breadcrumb \"Details\"\n end",
"def new\n @batch = Batch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @batch }\n end\n end",
"def get_batch_by_external_id_with_http_info(external_batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.get_batch_by_external_id ...'\n end\n # verify the required parameter 'external_batch_id' is set\n if @api_client.config.client_side_validation && external_batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'external_batch_id' when calling BatchesApi.get_batch_by_external_id\"\n end\n # resource path\n local_var_path = '/v1/batches/external_batch_id/{external_batch_id}'.sub('{' + 'external_batch_id' + '}', CGI.escape(external_batch_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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'GetBatchByExternalIdResponseBody' \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: BatchesApi#get_batch_by_external_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json {\n\n data = Hash.new\n data[\"batch\"] = @batch\n return_success_response(data, \"Request Successful\", 200)\n }\n end\n end",
"def show\n @packages = @batch.packages.in_progress.where(:requires_approval => true).order(\"status_id desc\").page(params[:page])\n @failures = @batch.tasks.where(status_id: Status.failed.id).count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batch }\n end\n end",
"def index\n params[:q] = Batch.fix_params(params[:q]) if params[:q]\n @q = Batch.page(params[:page]).search(params[:q])\n # @q.range_selector_cont ||= \"Last 13 Weeks\"\n @q.sorts = \"date_collected desc\" if @q.sorts.empty?\n @range = params[:q][:range_selector_cont] if params[:q]\n @batches = @q.result(:distinct => true)\n end",
"def make_batch \n batch = (0...@opts[:batch_size]).to_a.map do |i|\n { :depth=> 0 }\n end\n \n return batch\n end",
"def show\n @product_batch = ProductBatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_batch }\n end\n end",
"def set_batch\n begin\n @batch = Batch.find(params[:id])\n rescue Exception => e\n return return_error_response(e.exception.to_s,404)\n end\n\n end",
"def index\n limit = params[:limit] || 10\n @page = { page: params[:page], per_page: limit.to_i }\n @order = params[:order] || \"created_at DESC\"\n\n @bingo_games = BingoGame.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bingo_games, callback: params[:callback] }\n format.xml { render xml: @bingo_games }\n format.rss { render 'feed' }\n end\n end",
"def batch(request, request_options = {})\n client.post(Protocol.batch_uri(name), request.to_json, :batch, request_options)\n end",
"def fees_submission_batch\n @batches = Batch.find(:all, :conditions => {:is_deleted => false, :is_active => true},\n :joins => :course,\n :select => \"`batches`.*,CONCAT(courses.code,'-',batches.name) as course_full_name\",\n :order => \"course_full_name\")\n @inactive_batches = Batch.find(:all, :conditions => {:is_deleted => false, :is_active => false},\n :joins => :course,\n :select => \"`batches`.*,CONCAT(courses.code,'-',batches.name) as course_full_name\",\n :order => \"course_full_name\")\n @dates = []\n render \"finance/fees_payment/fees_submission_batch\"\n end",
"def serialize_batch(batch)\n batch.to_json\n end",
"def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end",
"def retrieve_all_items(batch)\n unless batch.is_a?(Hash) && batch.has_key?(\"data\") && batch[\"data\"].is_a?(Hash) && batch[\"data\"].has_key?(\"items\")\n raise \"jawbone_up_api retrieve_all_items() was given a bad batch: #{batch}\"\n end\n\n items = batch[\"data\"][\"items\"]\n while batch[\"data\"].has_key?(\"links\") do\n unless batch[\"data\"][\"links\"].has_key?(\"next\")\n raise \"jawbone_up_api retrieve_all_items() has links but no next: #{batch}\"\n end\n batch = get_path(batch[\"data\"][\"links\"][\"next\"])\n items += batch[\"data\"][\"items\"]\n end\n\n items\n end",
"def create_batch\n begin\n # create the new batch\n batch = BatchJob.new\n batch.name = params[:name]\n batch.job_type = params[:type_id]\n batch.ocr_engine_id = params[:engine_id]\n batch.font_id = params[:font_id]\n batch.parameters = params[:params]\n batch.notes = params[:notes]\n batch.save!\n \n # populate it with pages from the selected works\n json_payload = ActiveSupport::JSON.decode(params[:json])\n json_payload['works'].each do | work_id |\n pages = Page.where(\"pg_work_id = ?\", work_id)\n pages.each do | page |\n job = JobQueue.new\n job.batch_id = batch.id\n job.page_id = page.pg_page_id\n job.job_status = 1\n job.work_id=work_id\n job.save!\n end\n end\n\n # get a new summary for the job queue\n status = get_job_queue_status()\n render :json => ActiveSupport::JSON.encode(status), :status => :ok \n \n rescue => e\n render :text => e.message, :status => :error\n end \n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"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",
"def create\n @batch = Batch.new(params[:batch])\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render json: @batch, status: :created, location: @batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end",
"def bulk_APIrequests(uri_end, request_type, hash_arr)\r\n\tif(hash_arr.length>0) then\r\n\t\thash_arr.each_slice(99) do |x|\r\n\t\t\tjson = JSON.generate({uri_end => x})\r\n\t\t\t#puts json\r\n\t\t\tres = make_API_request(uri_end,request_type,json)\r\n\t\tend\r\n\telse puts \"No data for #{request_type.capitalize} in array\" end\r\nend",
"def new\n @tengine_batch = Tengine::Batch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tengine_batch }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def all_works\n #start = numeric( params[:start], DEFAULT_START )\n #limit = numeric( params[:limit], DEFAULT_LIMIT )\n\n works = batched_get( {} )\n respond_to do |format|\n format.json do\n if works.empty?\n render_json_works_response(:not_found )\n else\n # dont provide fileset information here, it takes too long and we just want work information\n render_json_works_response(:ok, work_transform( works, EXCLUDE_FILESETS ) )\n end\n end\n format.csv do\n # provide fileset information here because this is used for work export\n render_csv_works_response( work_transform( works, INCLUDE_FILESETS ) )\n end\n end\n\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_batch(page=1, per_page=30, order_by=\"created_at\", order_type=\"desc\")\n method(__method__).parameters.map do |param|\n param[1].to_s + \"=\" + binding.local_variable_get(param[1]).to_s\n end.join(\"&\")\n # => page=1&per_page=30&order_by=\"created_at\"&order_type=\"desc\"\nend",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end",
"def batch b\n raise ArgumentError, \"Invalid batch size. Must be a positive integer.\" unless b.is_a?(Fixnum) && b > 0\n spawn :@batch, b\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @batch }\n else\n format.html { render action: 'new' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @batch }\n else\n format.html { render action: 'new' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: \"Batch was successfully created.\" }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @batch }\n end\n end",
"def training_runs\n ensure_full_data!\n Array @gapi_json[:trainingRuns]\n end",
"def findClothesWithBatchFolder(num,batch_folder)\n clothes =[]\n Clothing.where(number: num).each do |clothing|\n clothing.batch_information.each do |batch_type|\n if batch_type.include?(batch_folder)\n clothes.push(clothing)\n break\n end\n end\n end\n return clothes\n end",
"def process_batch_with_http_info(batch_id, process_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.process_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.process_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.process_batch, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'process_batch_request_body' is set\n if @api_client.config.client_side_validation && process_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'process_batch_request_body' when calling BatchesApi.process_batch\"\n end\n # resource path\n local_var_path = '/v1/batches/{batch_id}/process/labels'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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(process_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'String' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#process_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n render json: Bill.all\n end",
"def batch(*spec)\n Batch.new(self, spec.flatten)\n end",
"def index\n @request_calls = RequestCall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_calls }\n end\n end",
"def batch_retrieve_orders(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/orders/batch-retrieve',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def batch!(request, request_options = {})\n res = batch(request, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n res\n end",
"def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end",
"def show\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @batch }\n end\n end",
"def show\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @batch }\n end\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def show\n @batch\n end",
"def documents_batch_details(guids)\n get \"/api/documents/#{guids.join(',')}/batch_details.xml\"\n end",
"def on_all_in_batches(num_batches, &block)\n on_each_shard do |shard_class|\n next if shard_class.first.blank? # Skip if shard is empty\n\n # Current shard\n shard = shard_class.shard\n\n # Max and starting point\n max = shard_class.order(\"id desc\").first.id\n start = shard_class.order(\"id asc\").first.id\n max_batch_index = num_batches - 1\n\n # Increment value\n batch_size = (max - start) / num_batches\n\n # Find what is left for the last batch\n # (in case num_batches didn't divide evenly)\n last_batch_size = (max - start) - (max_batch_index - 1) * batch_size\n\n # \"times\" method always starts with 0 so index will be correct\n num_batches.times do |index|\n\n if index == max_batch_index\n block.call(shard.id, start, last_batch_size)\n else\n block.call(shard.id, start, batch_size)\n end\n\n start += batch_size\n end\n end\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def get_movie_batch\n\t\tmovies_array = []\n\t\tmovie_ids = params[:id].split(',').map{ |number| number.to_i }\n\t\t\n\t\t# Get an array of Movie objects from batch ids passed here\n\t\tmovies = Movie.find(movie_ids)\n\n\t\t# Iterate through each movie and capitalize the title\n\t\tmovies.each do | movie | \n\t\t\tmovie.title = movie.title.split.map(&:capitalize).join(' ');\n\t\tend\n\n\t\t# Convert to json\n\t\tmovies = movies.to_json\n\t\trender :json => movies\n\tend",
"def in_batches(of: DEFAULT_BATCH_SIZE, &block)\n per_page = of\n\n if block_given?\n each_batch(of, &block)\n else\n Enumerator.new do |result|\n each_batch(of) do |batch|\n batch.each { |entity| result << entity }\n end\n end\n end\n end",
"def set_batch\n @batch = Batch.find(params[:id]) unless params[:id].to_i.zero?\n @batch = Batch.find(params[:batch_id]) unless params[:batch_id].to_i.zero?\n end",
"def index\r\n @batch = Batch.find(params[:batch_id])\r\n if current_user.try(:is_admin?)\r\n @batch_sets = BatchSet.all\r\n elsif current_user.try(:is_user?)\r\n @batch_sets = BatchSet.where('batch_id = ?', @batch)\r\n end\r\n end",
"def index\n @search = ProductBatch.search(params[:search])\n @product_batches = @search.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_batches }\n end\n end",
"def processed_batches(w)\n dir = join(@basedir, DIR_PROCESSED)\n w.sftp.dir[dir, '*'].map do |entry|\n Model::Batch.new(:path => join(dir, entry.name), :state => :processed)\n end\n end",
"def get_work\n works = batched_get( { id: params[:id] } )\n if works.empty?\n render_json_works_response(:not_found )\n else\n # provide fileset information here\n render_json_works_response(:ok, work_transform(works, INCLUDE_FILESETS ) )\n end\n end",
"def create_batch_with_http_info(create_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.create_batch ...'\n end\n # verify the required parameter 'create_batch_request_body' is set\n if @api_client.config.client_side_validation && create_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'create_batch_request_body' when calling BatchesApi.create_batch\"\n end\n # resource path\n local_var_path = '/v1/batches'\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(create_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'CreateBatchResponseBody' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#create_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @bids = Bid.includes(:user, :game_round).order(created_at: :desc).paginate(:page => params[:page])\n respond_to do |format|\n format.html\n format.csv do\n csv_file_name = \"bid_records.csv\"\n send_data Bid.generate_csv(@bids, col_sep: \",\"), filename: csv_file_name\n end\n end\n end"
] |
[
"0.75632226",
"0.7415398",
"0.73286897",
"0.711194",
"0.70886123",
"0.6862114",
"0.6839725",
"0.6813342",
"0.677585",
"0.65964687",
"0.64586616",
"0.63962585",
"0.63733006",
"0.6344917",
"0.6290671",
"0.6246177",
"0.62068826",
"0.61685944",
"0.61382574",
"0.61215985",
"0.61172116",
"0.6014409",
"0.6008212",
"0.59546196",
"0.59263486",
"0.58865297",
"0.58850515",
"0.5875961",
"0.58433473",
"0.5759921",
"0.574789",
"0.57392037",
"0.5702731",
"0.56860816",
"0.5680242",
"0.56614536",
"0.56515396",
"0.56379116",
"0.5614674",
"0.5611118",
"0.5608291",
"0.56050706",
"0.55822545",
"0.5489315",
"0.5464135",
"0.5458681",
"0.54403526",
"0.5438002",
"0.5435698",
"0.543332",
"0.5431919",
"0.5419094",
"0.5413799",
"0.5410293",
"0.54011256",
"0.53993195",
"0.53952205",
"0.53939086",
"0.5392108",
"0.5387795",
"0.5380242",
"0.5375324",
"0.53752506",
"0.5365185",
"0.5350481",
"0.5349547",
"0.534279",
"0.53421813",
"0.5340682",
"0.533739",
"0.53320575",
"0.5329178",
"0.53044033",
"0.5302139",
"0.52926177",
"0.52901757",
"0.5287916",
"0.52875084",
"0.527607",
"0.5268479",
"0.5267214",
"0.5267214",
"0.52645016",
"0.52645016",
"0.52645016",
"0.52645016",
"0.52645016",
"0.52615476",
"0.526114",
"0.5258856",
"0.52586037",
"0.52571213",
"0.52559114",
"0.5254685",
"0.52496386",
"0.52476996",
"0.52458876",
"0.52322435",
"0.523214",
"0.5223623"
] |
0.7686503
|
0
|
GET /batches/1 GET /batches/1.json
|
def show
respond_to do |format|
format.html {}
format.json {
data = Hash.new
data["batch"] = @batch
return_success_response(data, "Request Successful", 200)
}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @batches = Batch.all\n respond_to do |format|\n format.html {}\n format.json {\n\n data = Hash.new\n data[\"batches\"] = @batches\n return_success_response(data, \"Request Successful\", 200)\n }\n end\n end",
"def index\n @batches = Batch.all\n end",
"def index\n @batches = Batch.page(params[:page]).per(15)\n @page = params[:page] || 1\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batches }\n end\n end",
"def list_batches_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.list_batches ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/batches'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\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] || 'ListBatchesResponseBody' \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: BatchesApi#list_batches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @batches = @zone.batches\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batches }\n end\n end",
"def show\n respond_to do |format|\n format.html { render layout: false }\n format.json do\n batches = Batch.where(item_id: params[:id])\n render json: batches\n end\n end\n end",
"def show\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batch }\n end\n end",
"def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end",
"def index\n @batches = Batch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @batches }\n end\n end",
"def index\n # Получаем список всех загруженных файлов\n @batches = Batch.all\n end",
"def index\n @batches = Batch.all\n @batches.each do |batch|\n authorize! :read, batch\n end\n render json: @batches\n end",
"def show\n render json: @batch\n end",
"def index\n @batches = BatchSearch.search_batches(params)\n # Return Batches after Search\n # @batches.each do |m|\n # @course = m.course\n # end\n # @batches_update = @course.batches if @course.present?\n add_breadcrumb \"Batches\"\n end",
"def index\n @batches = Batch.all\n @tab_title = \"brewery_batches\"\n end",
"def batch\n # conditions => in Url item should be available\n # Url generated from Js script function => getbatch() of _form.html.erb file under Views of different controllers\n @batch = Stock.where('item_name = ? and user_id = ?' , params[:name], current_user.id).distinct.pluck(:batch_number )\n # send batch_number in form of json\n render json: @batch\n end",
"def show\n @tengine_batch = Tengine::Batch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tengine_batch }\n end\n end",
"def get_batch_by_id_with_http_info(batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.get_batch_by_id ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.get_batch_by_id\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.get_batch_by_id, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.get_batch_by_id, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.get_batch_by_id, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'GetBatchByIdResponseBody' \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: BatchesApi#get_batch_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @batches = Batch.all.order(created_at: :desc)\n end",
"def index\n @ready_for_shipment_batches = ReadyForShipmentBatch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ready_for_shipment_batches }\n end\n end",
"def action_batches\r\n ActionBatchesController.instance\r\n end",
"def new\n @batch = Batch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @batch }\n end\n end",
"def index\n @batch_files = BatchFile.all\n end",
"def create\n @batch = Batch.new(batch_params)\n add_breadcrumb \"Batches\", batches_url\n add_breadcrumb \"New Batch\"\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n flash[:alert] = @batch.errors.full_messages.to_sentence\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @batch = Batch.new\n\n # Display only the current user's batches\n if current_user.present?\n @batches = current_user.batches\n else\n @batches = Batch.all\n end\n end",
"def show\n @product_batch = ProductBatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_batch }\n end\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def show\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @batch }\n end\n end",
"def show\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @batch }\n end\n end",
"def create\n @batch = Batch.new(params[:batch])\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render json: @batch, status: :created, location: @batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_batch_by_external_id_with_http_info(external_batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.get_batch_by_external_id ...'\n end\n # verify the required parameter 'external_batch_id' is set\n if @api_client.config.client_side_validation && external_batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'external_batch_id' when calling BatchesApi.get_batch_by_external_id\"\n end\n # resource path\n local_var_path = '/v1/batches/external_batch_id/{external_batch_id}'.sub('{' + 'external_batch_id' + '}', CGI.escape(external_batch_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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'GetBatchByExternalIdResponseBody' \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: BatchesApi#get_batch_by_external_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_batch\n begin\n @batch = Batch.find(params[:id])\n rescue Exception => e\n return return_error_response(e.exception.to_s,404)\n end\n\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @batch }\n else\n format.html { render action: 'new' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @batch }\n else\n format.html { render action: 'new' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(params[:batch])\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to recipe_path(@batch.recipe_id)}\n format.json { render json: @batch, status: :created, location: @batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def checkout\n @batches = Batch.all\n end",
"def list_batches(opts = {})\n data, _status_code, _headers = list_batches_with_http_info(opts)\n data\n end",
"def batch_params\n params[:batch]\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: \"Batch was successfully created.\" }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_batch\n @batch = Batch.find(params[:id]) unless params[:id].to_i.zero?\n @batch = Batch.find(params[:batch_id]) unless params[:batch_id].to_i.zero?\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @batch }\n end\n end",
"def show\n add_breadcrumb \"Batches\", batches_url\n add_breadcrumb \"Details\"\n end",
"def get_organization_action_batches(organization_id)\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'organization_id' => organization_id\r\n )\r\n # Prepare query url.\r\n _path_url = '/organizations/{organizationId}/actionBatches'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'organizationId' => organization_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def show\n @packages = @batch.packages.in_progress.where(:requires_approval => true).order(\"status_id desc\").page(params[:page])\n @failures = @batch.tasks.where(status_id: Status.failed.id).count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batch }\n end\n end",
"def get_work\n works = batched_get( { id: params[:id] } )\n if works.empty?\n render_json_works_response(:not_found )\n else\n # provide fileset information here\n render_json_works_response(:ok, work_transform(works, INCLUDE_FILESETS ) )\n end\n end",
"def send_batch_request(batch)\n post_data = batch.to_json\n resp = RestClient.post(@url, post_data, content_type: 'application/json', user_agent: \"syncano-ruby-#{Syncano::VERSION}\")\n if resp.nil? || resp.body.nil? || resp.body.empty?\n raise Jimson::ClientError::InvalidResponse.new\n end\n\n return resp.body\n end",
"def batch(*requests)\n Batch.new(requests)\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end",
"def batch options = {}\n Diffbot::APIClient::Batch.new self, options\n end",
"def create_batch\n begin\n # create the new batch\n batch = BatchJob.new\n batch.name = params[:name]\n batch.job_type = params[:type_id]\n batch.ocr_engine_id = params[:engine_id]\n batch.font_id = params[:font_id]\n batch.parameters = params[:params]\n batch.notes = params[:notes]\n batch.save!\n \n # populate it with pages from the selected works\n json_payload = ActiveSupport::JSON.decode(params[:json])\n json_payload['works'].each do | work_id |\n pages = Page.where(\"pg_work_id = ?\", work_id)\n pages.each do | page |\n job = JobQueue.new\n job.batch_id = batch.id\n job.page_id = page.pg_page_id\n job.job_status = 1\n job.work_id=work_id\n job.save!\n end\n end\n\n # get a new summary for the job queue\n status = get_job_queue_status()\n render :json => ActiveSupport::JSON.encode(status), :status => :ok \n \n rescue => e\n render :text => e.message, :status => :error\n end \n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def show\n @ready_for_shipment_batch = ReadyForShipmentBatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ready_for_shipment_batch }\n end\n end",
"def update\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n if @batch.update_attributes(params[:batch])\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { respond_with_bip(@batch) }\n else\n format.html { redirect_to @batch }\n format.json { respond_with_bip(@batch) }\n end\n end\n end",
"def new\n @tengine_batch = Tengine::Batch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tengine_batch }\n end\n end",
"def get_query_batches(customer_po, \n count = 100000)\n\n # prepare query url\n _query_builder = Configuration.base_uri.dup\n _query_builder << '/rest/tag/queryBatches'\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'customerPO' => customer_po,\n 'count' => count\n }\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json'\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n BasicAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise APIException.new 'Unexpected error in API call. See HTTP response body for details.', _context\n elsif _context.response.status_code == 401\n raise APIException.new '', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return QueryBatchesResponseModel.from_hash(decoded)\n end",
"def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end",
"def process_batch_with_http_info(batch_id, process_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.process_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.process_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.process_batch, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'process_batch_request_body' is set\n if @api_client.config.client_side_validation && process_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'process_batch_request_body' when calling BatchesApi.process_batch\"\n end\n # resource path\n local_var_path = '/v1/batches/{batch_id}/process/labels'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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(process_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'String' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#process_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_batch\n @batch = Batch.find_by_batch_id(params[:id])\n end",
"def index\n @own_batches = [Batch.all(:conditions => [\"user_id = ?\", current_user.id],\n :order => \"brewed_on DESC\")].flatten.compact\n @others_batches = [Batch.all(:conditions => [\"user_id != ?\", current_user.id],\n :order => \"brewed_on DESC\")].flatten.compact\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @batches }\n end\n end",
"def index\n @mc_batches = McBatch.order(created_at: :desc)\n end",
"def show\n @batch\n end",
"def set_batch\n begin\n @batch = Batch.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to batches_url, :flash => { :error => \"Record not found.\" }\n end\n end",
"def serialize_batch(batch)\n batch.to_json\n end",
"def load_batches\n if params[:course_id].present?\n unless params[:course_id] == 'all'\n @batches = Batch.active.all(:conditions=>[\"course_id in (?)\", params[:course_id]])\n else\n @course = 'all'\n @batches = _all_batch\n end\n else\n @batches = []\n end\n render :update do |page|\n page.replace_html \"list_batches\", :partial => \"finance_reports/filters/multi_select_batch\"\n end\n end",
"def index\n @batting_lines = BattingLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batting_lines }\n end\n end",
"def destroy\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end",
"def send_batch\n batch = @batch.map(&:first) # get the requests\n response = send_batch_request(batch)\n\n begin\n responses = JSON.parse(response)\n rescue\n raise Jimson::ClientError::InvalidJSON.new(json)\n end\n\n process_batch_response(responses)\n responses = @batch\n\n @batch = []\n\n responses\n end",
"def restFetchBatch(dbName, idListStr, formatName='default', styleName='default')\n printDebugMessage('restFetchBatch', 'Begin', 1)\n url = \"#{baseUrl}/#{dbName}/#{idListStr}/#{formatName}?style=#{styleName}\"\n retVal = restRequest(url)\n printDebugMessage('restFetchBatch', 'End', 1)\n return retVal\n end",
"def destroy\n @tengine_batch = Tengine::Batch.find(params[:id])\n @tengine_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to tengine_batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to(batches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to(batches_url) }\n format.xml { head :ok }\n end\n end",
"def delete_batch_with_http_info(batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.delete_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.delete_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.delete_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.delete_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.delete_batch, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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] || 'String' \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#delete_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_batch\n # Находим данные объекта Batch по id\n @batch = Batch.find(params[:id])\n end",
"def update\n if @batch.update(batch_params)\n render json: @batch, status: :ok\n else\n render json: @batch.errors, status: :unprocessable_entity\n end\n end",
"def show\n @batch_sampling = BatchSampling.find(params[:id])\n @title = \"Batch upload of Sampling data\"\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @batch_sampling }\n end\n end",
"def new\n @batch = Batch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @batch }\n end\n end",
"def new\n @batch = Batch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @batch }\n end\n end",
"def batch b\n raise ArgumentError, \"Invalid batch size. Must be a positive integer.\" unless b.is_a?(Fixnum) && b > 0\n spawn :@batch, b\n end",
"def update\n add_breadcrumb \"Batches\", batches_url\n add_breadcrumb \"Edit Batch\"\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch }\n else\n format.html { render :edit }\n flash[:alert] = @batch.errors.full_messages.to_sentence\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_batch_with_http_info(batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.update_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.update_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.update_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.update_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.update_batch, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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] || 'String' \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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#update_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n redirect_to batches_path\n end",
"def create\n batch = Batch.new(batch_params)\n # Setting reference number\n batch[:reference_batch] = Faker::Code.nric\n\n # Getting all orders for purchase_channel\n orders = Order.where(\"purchase_channel = ?\", batch[:purchase_channel_batch])\n if batch.save\n # Setting batch id in orders\n orders.update(batch_id: batch[:id])\n # Changing orders status\n orders.update(status: Order.statuses['production'])\n\t\t\t\t\trender json: {status: 'SUCCESS', message: 'Saved Batch', number_of_orders_in_batch: orders.size, data: batch}, status: :ok\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message: 'Batch not saved', data:batch.errors}, status: :unprocessable_entity\n\t\t\t\tend\n end",
"def set_batch_set\r\n @batch_set = BatchSet.find(params[:id])\r\n end",
"def create\n @tengine_batch = Tengine::Batch.new(params[:tengine_batch])\n\n respond_to do |format|\n if @tengine_batch.save\n format.html { redirect_to @tengine_batch, notice: 'Batch was successfully created.' }\n format.json { render json: @tengine_batch, status: :created, location: @tengine_batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tengine_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_batchid\n if @version == 'BANK_OF_AMERICA'\n if @new_batch_flag == 1\n InputBatch.get_batchid\n else\n batch = Batch.find(:last,:conditions=>\"client_id = #{client.id} and file_name = '#{@zip_file_name}'\")\n if !batch.blank?\n batch.batchid\n else\n InputBatch.get_batchid\n end\n end\n else\n get_batchid_general\n end\n end",
"def documents_batch_details(guids)\n get \"/api/documents/#{guids.join(',')}/batch_details.xml\"\n end",
"def destroy\n @batch.destroy\n render json: @batch, status: :ok\n end",
"def create\n @batch = Batch.new(batch_params)\n team_member_ids = params[:team_member_ids]\n\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def batch_of_items\n @catalog=Catalog.find(params[:id])\n \n # set a reasonable default for the current page\n @page=params[:page]\n @page=1 if @page.nil?\n \n # set a reasonable default for the current size\n @size=params[:size]\n @size=12 if @size.nil?\n \n # grab the batch of items corresponding to the page and size\n @items = @catalog.get_batch_of_items(@page, @size)\n \n respond_to do |format|\n # wouldn't make sense to call this API method as html, but for debugging purposes\n # just return json anyway\n format.html { render json: {:items => @items, :page => @page, :size => @size }}\n format.json { render json: {:items => @items, :page => @page, :size => @size }}\n end\n end",
"def show\n \t @recipe = Recipe.find(params[:id], :include => :recipe_ingredients)\n# \t @current_batch_size = $1 if( (! is_blank?(params[:batch_size])) && params[:batch_size] =~ /\\A([1-9][0-9]?(\\/[1-9][0-9]?)?)\\Z/ )\n\t@current_batch_size = \"#{$1}#{$4 ? \"/#{$4}\" : ''}\" if( (! is_blank?(params[:batch_size])) && params[:batch_size] =~ /\\A([1-9][0-9]?)((\\/|%2F)([1-9][0-9]?))?\\Z/ )\n#Rails.logger.warn(\"PARAM=[#{params[:batch_size]}] @current=[#{@current_batch_size}]\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"def bulk_APIrequests(uri_end, request_type, hash_arr)\r\n\tif(hash_arr.length>0) then\r\n\t\thash_arr.each_slice(99) do |x|\r\n\t\t\tjson = JSON.generate({uri_end => x})\r\n\t\t\t#puts json\r\n\t\t\tres = make_API_request(uri_end,request_type,json)\r\n\t\tend\r\n\telse puts \"No data for #{request_type.capitalize} in array\" end\r\nend",
"def create\n @batch = Batch.new(batch_params)\n authorize! :create, @batch\n if @batch.save\n render json: @batch, status: :created\n else\n render json: @batch.errors, status: :unprocessable_entity\n end\n end",
"def run_batch\n make_run_batch_call\n end"
] |
[
"0.73848814",
"0.71466523",
"0.711173",
"0.6936448",
"0.6916473",
"0.6729072",
"0.66923904",
"0.66800314",
"0.6679577",
"0.6555929",
"0.6404666",
"0.6400949",
"0.6339662",
"0.63126767",
"0.62823004",
"0.625739",
"0.6252372",
"0.61928767",
"0.6159479",
"0.614748",
"0.6057155",
"0.605053",
"0.6000792",
"0.5972468",
"0.59525764",
"0.59390485",
"0.58640474",
"0.58640474",
"0.58565795",
"0.5838082",
"0.5825206",
"0.5806167",
"0.5794706",
"0.5793753",
"0.57879823",
"0.57868445",
"0.5779565",
"0.5776257",
"0.57711047",
"0.5755642",
"0.5751312",
"0.5751312",
"0.5751312",
"0.5751312",
"0.5751312",
"0.5738513",
"0.5734393",
"0.5721061",
"0.57141066",
"0.5709673",
"0.56625503",
"0.5656415",
"0.5644209",
"0.56399924",
"0.5631803",
"0.5618962",
"0.5616586",
"0.5613124",
"0.56055343",
"0.5600486",
"0.5596021",
"0.55935943",
"0.5582848",
"0.5580363",
"0.5571413",
"0.5570548",
"0.55271816",
"0.5517174",
"0.549971",
"0.5494234",
"0.5484888",
"0.54604566",
"0.54604566",
"0.5456191",
"0.54540724",
"0.5434266",
"0.5401419",
"0.5401419",
"0.5389964",
"0.53877646",
"0.53790545",
"0.53736216",
"0.53530407",
"0.53530407",
"0.53458667",
"0.5343649",
"0.53335375",
"0.5324357",
"0.53115",
"0.5304173",
"0.5303849",
"0.52972746",
"0.5271113",
"0.5269486",
"0.52616864",
"0.5252449",
"0.5247848",
"0.5243351",
"0.5237986",
"0.5232391"
] |
0.5976446
|
23
|
POST /batches POST /batches.json
|
def create
@batch = Batch.new(batch_params)
team_member_ids = params[:team_member_ids]
respond_to do |format|
if @batch.save
format.html { redirect_to @batch, notice: 'Batch was successfully created.' }
format.json { render :show, status: :created, location: @batch }
else
format.html { render :new }
format.json { render json: @batch.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @batches = Batch.all\n respond_to do |format|\n format.html {}\n format.json {\n\n data = Hash.new\n data[\"batches\"] = @batches\n return_success_response(data, \"Request Successful\", 200)\n }\n end\n end",
"def batch(request, request_options = {})\n client.post(Protocol.batch_uri(name), request.to_json, :batch, request_options)\n end",
"def create\n @batch = Batch.new(batch_params)\n add_breadcrumb \"Batches\", batches_url\n add_breadcrumb \"New Batch\"\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n flash[:alert] = @batch.errors.full_messages.to_sentence\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_batches_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.list_batches ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/batches'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\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] || 'ListBatchesResponseBody' \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: BatchesApi#list_batches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @batch = Batch.new(params[:batch])\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render json: @batch, status: :created, location: @batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: \"Batch was successfully created.\" }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n batch = Batch.new(batch_params)\n # Setting reference number\n batch[:reference_batch] = Faker::Code.nric\n\n # Getting all orders for purchase_channel\n orders = Order.where(\"purchase_channel = ?\", batch[:purchase_channel_batch])\n if batch.save\n # Setting batch id in orders\n orders.update(batch_id: batch[:id])\n # Changing orders status\n orders.update(status: Order.statuses['production'])\n\t\t\t\t\trender json: {status: 'SUCCESS', message: 'Saved Batch', number_of_orders_in_batch: orders.size, data: batch}, status: :ok\n\t\t\t\telse\n\t\t\t\t\trender json: {status: 'ERROR', message: 'Batch not saved', data:batch.errors}, status: :unprocessable_entity\n\t\t\t\tend\n end",
"def create_batch urls\n function = 'batch/'\n\n post_data = {}\n post_data[:urls] = urls.join(',')\n\n request(@resource, function, nil, 'post', post_data)\n end",
"def create\n @batch = Batch.new(params[:batch])\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to recipe_path(@batch.recipe_id)}\n format.json { render json: @batch, status: :created, location: @batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @batch }\n else\n format.html { render action: 'new' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render action: 'show', status: :created, location: @batch }\n else\n format.html { render action: 'new' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @batches = Batch.page(params[:page]).per(15)\n @page = params[:page] || 1\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batches }\n end\n end",
"def index\n @batches = Batch.all\n end",
"def send_batch_request(batch)\n post_data = batch.to_json\n resp = RestClient.post(@url, post_data, content_type: 'application/json', user_agent: \"syncano-ruby-#{Syncano::VERSION}\")\n if resp.nil? || resp.body.nil? || resp.body.empty?\n raise Jimson::ClientError::InvalidResponse.new\n end\n\n return resp.body\n end",
"def send_batch\n batch = @batch.map(&:first) # get the requests\n response = send_batch_request(batch)\n\n begin\n responses = JSON.parse(response)\n rescue\n raise Jimson::ClientError::InvalidJSON.new(json)\n end\n\n process_batch_response(responses)\n responses = @batch\n\n @batch = []\n\n responses\n end",
"def create_batch_with_http_info(create_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.create_batch ...'\n end\n # verify the required parameter 'create_batch_request_body' is set\n if @api_client.config.client_side_validation && create_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'create_batch_request_body' when calling BatchesApi.create_batch\"\n end\n # resource path\n local_var_path = '/v1/batches'\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(create_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'CreateBatchResponseBody' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#create_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @batch = Batch.new(batch_params)\n authorize! :create, @batch\n if @batch.save\n render json: @batch, status: :created\n else\n render json: @batch.errors, status: :unprocessable_entity\n end\n end",
"def batch_create\n @values = record_batch_params.values.reject { |p| p.values.all?(&:blank?) }\n @records = record_class.create(@values)\n\n respond_to do |format|\n if @records.all?(&:valid?)\n format.html { redirect_to url_for(action: 'index'), notice: \"#{record_class.model_name.plural.humanize} were successfully created.\" }\n format.json { render :index, status: :created }\n else\n @records = @records.fill(@records.size..BATCH_SIZE) { record_class.new }\n\n format.html { render :batch_new }\n format.json { render json: @records.map(&:errors), status: :unprocessable_entity }\n end\n end\n end",
"def batch_params\n params.require(:batch).permit(:id, :date_collected, :count_total, :contributions_num, :comments)\n end",
"def create\n @tengine_batch = Tengine::Batch.new(params[:tengine_batch])\n\n respond_to do |format|\n if @tengine_batch.save\n format.html { redirect_to @tengine_batch, notice: 'Batch was successfully created.' }\n format.json { render json: @tengine_batch, status: :created, location: @tengine_batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tengine_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def batch_params\n params.require(:batch).permit(:size, :brew_date, :bottle_date, :aog, :afg, :aabv, :aaroma, :aibu, :image, :aflavpro, :recipe_id)\n end",
"def create\n @batch = Batch.new(params[:batch])\n \n ActiveRecord::Base.transaction do\n @batch.save!\n DownloadCode.create_in_bulk!(@batch)\n end\n\n respond_to do |format|\n flash[:notice] = 'Batch was successfully created.'\n format.html { redirect_to(@batch) }\n format.xml { render :xml => @batch, :status => :created, :location => @batch }\n end\n rescue ActiveRecord::RecordInvalid\n @batch.errors.add_to_base \"There was an error creating this batch of downloads\"\n \n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @batch.errors, :status => :unprocessable_entity }\n end\n end",
"def create_batch\n begin\n # create the new batch\n batch = BatchJob.new\n batch.name = params[:name]\n batch.job_type = params[:type_id]\n batch.ocr_engine_id = params[:engine_id]\n batch.font_id = params[:font_id]\n batch.parameters = params[:params]\n batch.notes = params[:notes]\n batch.save!\n \n # populate it with pages from the selected works\n json_payload = ActiveSupport::JSON.decode(params[:json])\n json_payload['works'].each do | work_id |\n pages = Page.where(\"pg_work_id = ?\", work_id)\n pages.each do | page |\n job = JobQueue.new\n job.batch_id = batch.id\n job.page_id = page.pg_page_id\n job.job_status = 1\n job.work_id=work_id\n job.save!\n end\n end\n\n # get a new summary for the job queue\n status = get_job_queue_status()\n render :json => ActiveSupport::JSON.encode(status), :status => :ok \n \n rescue => e\n render :text => e.message, :status => :error\n end \n end",
"def batch_params\n params.require(:batch).permit(:name,\n :beer_style_id,\n :description,\n :projected_volume_in_gallons,\n :projected_alcohol_by_volume,\n :projected_original_gravity,\n :projected_final_gravity,\n :projected_secondary_transition_date,\n :projected_bottle_date,\n :projected_condition_date,\n :actual_original_gravity,\n :actual_final_gravity,\n :actual_alcohol_by_volume,\n :actual_brew_date,\n :actual_secondary_transition_date,\n :actual_bottle_date,\n :actual_condition_date,\n :color,\n :difficulty,\n :recipe_id)\n end",
"def batch_params\n # Инициализация параметров объекта Batch\n params.require(:batch).permit(:batch_id, :creation_date, :guid, :batch_file)\n end",
"def batch(*requests)\n Batch.new(requests)\n end",
"def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end",
"def batch_params\n params[:batch]\n end",
"def create\n @batch = Batch.new(batch_params)\n @batch.user = current_user\n\n respond_to do |format|\n if @batch.save\n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def serialize_batch(batch)\n batch.to_json\n end",
"def batch_params\n params.require(:batch).permit(:item_id, :user_id, :count)\n end",
"def batch_params\n params.require(:batch).permit(:description, :committed_at, :total_cents, :total_currency, :status)\n end",
"def post(batch)\n last_response, exception = retry_with_backoff(@retries) do\n status_code, body, message = send_request(batch)\n\n should_retry = should_retry_request?(status_code, body)\n\n [Response.new(status_code, message), should_retry]\n end\n\n if exception\n logger.error(exception.message)\n exception.backtrace.each { |line| logger.error(line) }\n Response.new(-1, \"Connection error: #{exception}\")\n else\n last_response\n end\n end",
"def batch_params\n params.require(:batch).permit(:name,:background_type,:job_type,:job_count,:worker_count,:thread_count,:modified_run)\n end",
"def index\n @batches = @zone.batches\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batches }\n end\n end",
"def batch(serial_only=false)\n @batch_request=true\n Thread.current[:facebooker_current_batch_queue]=[]\n yield\n # Set the batch request to false so that post will execute the batch job\n @batch_request=false\n BatchRun.current_batch=Thread.current[:facebooker_current_batch_queue]\n post(\"facebook.batch.run\",:method_feed=>BatchRun.current_batch.map{|q| q.uri}.to_json,:serial_only=>serial_only.to_s)\n ensure\n @batch_request=false\n BatchRun.current_batch=nil\n end",
"def batch\n # conditions => in Url item should be available\n # Url generated from Js script function => getbatch() of _form.html.erb file under Views of different controllers\n @batch = Stock.where('item_name = ? and user_id = ?' , params[:name], current_user.id).distinct.pluck(:batch_number )\n # send batch_number in form of json\n render json: @batch\n end",
"def api_v11_batch_post(opts = {})\n api_v11_batch_post_with_http_info(opts)\n return nil\n end",
"def make_batch \n batch = (0...@opts[:batch_size]).to_a.map do |i|\n { :depth=> 0 }\n end\n \n return batch\n end",
"def list_batches(opts = {})\n data, _status_code, _headers = list_batches_with_http_info(opts)\n data\n end",
"def batch_params\n params.require(:batch).permit(:course_id, :batch_name, :start_date,:end_date)\n end",
"def batch!(request, request_options = {})\n res = batch(request, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n res\n end",
"def create\n \n \n @batch = Batch.new(params[:batch])\n \n if not params[:batch].has_key? :title\n @batch.title = Time.now.getutc\n end\n \n cards = params[:card]\n\n respond_to do |format|\n if @batch.save\n \n for c in cards\n Card.update c[:id], :status_id=>2, :batch_id => @batch.id\n end\n \n \n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render json: @batch, status: :created, location: @batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def batch options = {}\n Diffbot::APIClient::Batch.new self, options\n end",
"def create\n @batch_file = BatchFile.new(batch_file_params)\n\n respond_to do |format|\n if @batch_file.save\n format.html { redirect_to @batch_file, notice: \"Batch file was successfully created.\" }\n format.json { render :show, status: :created, location: @batch_file }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @batch_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def batch b\n raise ArgumentError, \"Invalid batch size. Must be a positive integer.\" unless b.is_a?(Fixnum) && b > 0\n spawn :@batch, b\n end",
"def batch_new\n end",
"def create_batch_job(job_id)\n request = Net::HTTP::Put.new(\"/jobs/#{job_id}\")\n response = http.request(request)\n handle_response({ request_method: request.method, request_path: request.path }, response)\n end",
"def index\n # Получаем список всех загруженных файлов\n @batches = Batch.all\n end",
"def perform(&block)\n raise Exception.new(\"You must have at least 2 requests\") unless @requests.length > 1\n @responses.clear\n requests.each_slice(Limit).to_a.each do |batch|\n body = {\n :batch => Yajl::Encoder.encode(batch),\n :access_token => Baloo.client_credentials\n }\n Client.post(\"/\", :body => body).each do |response|\n # response['headers'] = Yajl::Parser.parse(response['headers'])\n response['body'] = Yajl::Parser.parse(response['body'])\n yield response\n end\n end\n end",
"def create\n @batch = Batch.new(batch_params)\n @batch.author = current_user\n @batch.actual_brew_date = Time.now\n\n respond_to do |format|\n if @batch.save\n track_activity @batch\n format.html { redirect_to edit_user_batch_path(@batch.author, @batch), notice: 'Batch was successfully created.' }\n format.json { render :show, status: :created, location: @batch }\n else\n format.html { render :new }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def batch_params\n params.require(:batch).permit(:course_id, :name, :price, :start_date, :schedule, :strength, :status ,:team_member_ids => [])\n end",
"def batch(*requests)\n body = requests.map do |request|\n {method: request[0], params: request[1..-1], jsonrpc: '2.0', id: SecureRandom.uuid}\n end\n parsed_response = parse_response(post(body))\n errors = parsed_response.select{|response| response[:error]}\n raise Error, errors if !errors.empty?\n parsed_response.map{|response| response[:result]}\n end",
"def create\n @product_batch = ProductBatch.new(params[:product_batch])\n worksheet = Worksheet.find(params[:product_batch][:worksheet_id])\n \n game = worksheet.game\n @product_batch.state = 'initial'\n @product_batch.game = game\n \n #根据印刷单元的数量和game的参数配置,算出总的票数\n print_unit_count = params[:product_batch][:print_unit_count]\n @product_batch.ticket_count = game.poolcount_per_printunit * game.pool_size * print_unit_count.to_i\n\n respond_to do |format|\n if @product_batch.save\n Feed.create owner_type: \"product_batch\", owner_id: @product_batch.id, user_id: current_user.id, operation: \"create\", desc: \"创建生产批次\"\n format.html { redirect_to @product_batch, notice: 'Product batch was successfully created.' }\n format.json { render json: @product_batch, status: :created, location: @product_batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batch = Batch.new(params[:batch])\n @batch.user = current_user\n respond_to do |format|\n if @batch.save\n flash[:notice] = 'Batch was successfully created.'\n format.html { redirect_to(@batch) }\n format.xml { render :xml => @batch, :status => :created, :location => @batch }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @batch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @batches = Batch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @batches }\n end\n end",
"def run_batch\n make_run_batch_call\n end",
"def batch\n req = create_batch_request\n if block_given?\n yield req\n req.execute\n else\n req\n end\n end",
"def batch(*spec)\n Batch.new(self, spec.flatten)\n end",
"def create\n # @transport_batch = TransportBatch.new(params[:transport_batch])\n @prodcut_batch = ProductBatch.find(params[:product_batch_id])\n @transport_batch = TransportBatch.new\n @transport_batch.product_batch = @prodcut_batch\n # @transport_batch.start_pool_no = 100\n # @transport_batch.end_pool_no = 300\n @transport_batch.pool_totals = [12, 18, 20]\n @transport_batch.code = SecureRandom.random_number(10**6)\n array = Array.new\n 3.times {array << rand(10)}\n @transport_batch.print_unit_completes = array.to_s\n @transport_batch.state = 'initial'\n\n respond_to do |format|\n if @transport_batch.save\n Feed.create owner_type: \"transport_batch\", owner_id: @transport_batch.id, user_id: current_user.id, operation: \"create\", \n desc: \"获取运输批次文件\"\n format.html { redirect_to @prodcut_batch, notice: 'Transport batch was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end",
"def index\n @batches = BatchSearch.search_batches(params)\n # Return Batches after Search\n # @batches.each do |m|\n # @course = m.course\n # end\n # @batches_update = @course.batches if @course.present?\n add_breadcrumb \"Batches\"\n end",
"def track_events(events)\n url = \"v2/#{account_id}/events/batches\"\n make_json_api_request :post, url, private_generate_resource(\"batches\", { \"events\" => events })\n end",
"def index\n @batches = Batch.all\n @tab_title = \"brewery_batches\"\n end",
"def batch_params\n params.require(:batch).permit(:job_class, :timestamps)\n end",
"def action_batches\r\n ActionBatchesController.instance\r\n end",
"def create\n @ready_for_shipment_batch = ReadyForShipmentBatch.new(params[:ready_for_shipment_batch])\n\n respond_to do |format|\n if @ready_for_shipment_batch.save\n format.html { redirect_to @ready_for_shipment_batch, notice: 'Ready for shipment batch was successfully created.' }\n format.json { render json: @ready_for_shipment_batch, status: :created, location: @ready_for_shipment_batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ready_for_shipment_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def create_batch(create_batch_request_body, opts = {})\n data, _status_code, _headers = create_batch_with_http_info(create_batch_request_body, opts)\n data\n end",
"def process_batch_with_http_info(batch_id, process_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.process_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.process_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.process_batch, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'process_batch_request_body' is set\n if @api_client.config.client_side_validation && process_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'process_batch_request_body' when calling BatchesApi.process_batch\"\n end\n # resource path\n local_var_path = '/v1/batches/{batch_id}/process/labels'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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(process_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'String' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#process_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @batch = Batch.new\n @batch.item = Item.find(params[:item_id])\n @batch.company = current_user.company if current_user.company?\n @batch.count = params[:amount].to_i\n @batch.count *= 1000 if @batch.item.have_weight\n @batch.price = params[:price].to_i\n @batch.supplier_price = params[:supplier_price].to_i\n @batch.barcode = Barcode.find_by_code params[:barcode]\n @batch.user = current_user\n respond_to do |format|\n if @batch.save\n format.json { render json: nil, status: :created }\n else\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_batch(batch)\n return if batch.empty?\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n begin\n resp = @http_client.post @solr_update_url, json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if exception || resp.status != 200\n error_message = exception ? \n Traject::Util.exception_to_log_message(exception) : \n \"Solr response: #{resp.status}: #{resp.body}\"\n\n logger.error \"Error in Solr batch add. Will retry documents individually at performance penalty: #{error_message}\"\n \n batch.each do |c|\n send_single(c)\n end\n end\n end",
"def index\n @batches = Batch.all.order(created_at: :desc)\n end",
"def batch_create(request = nil, manifest: nil, items: nil, **opt)\n self.request = request ||= pre_flight(manifest, items, **opt)\n self.start_time = request[:start_time] ||= timestamp\n opt[:manifest_id] = request[:manifest_id] ||= manifest\n result_data = submit_batch(**opt)\n self.end_time = timestamp\n self.result = post_flight(result_data, **opt)\n end",
"def update_batch_statuses\n current_batches = decode(batch_statuses)\n \n if current_batches.keys.count > 20\n current_batches.keys[0..15].each do |batch_id|\n current_batches.delete(batch_id)\n end\n end\n\n current_batches.each do |id, status|\n case batch_status(id)\n when \"finished\"\n current_batches.delete(id)\n else\n current_batches[id] = batch_status(id)\n end\n end\n update_attribute(:batch_statuses, encode(current_batches))\n end",
"def submit_batches!(lock_object=nil)\n File.makedirs(cache_location)\n batches_submitted = 0\n with_ftp do # causes all batches to be uploaded in a single session\n # 1) Gather all payments for this client.\n batches.each do |batch| # 2) For each file type (ach, cc) yet to be uploaded:\n batches_submitted += 1 if submit_batch!(batch, lock_object)\n end\n end\n batches_submitted\n end",
"def set_batch\n begin\n @batch = Batch.find(params[:id])\n rescue Exception => e\n return return_error_response(e.exception.to_s,404)\n end\n\n end",
"def index\n @batches = Batch.all\n @batches.each do |batch|\n authorize! :read, batch\n end\n render json: @batches\n end",
"def checkout\n @batches = Batch.all\n end",
"def test_create_batch\n batch_upload = uploaded_file(\"#{File.expand_path(Rails.root)}/test/fixtures/batch_import.csv\")\n count = Batch.count\n post :create, {:upload => {'file' => batch_upload}, :type => 'batch'}, {:user => 15}\n new_count = Batch.count\n last_batch = Batch.find(:all).last\n assert_equal(last_batch.arrival_time, Time.parse(\"9/19/2007 21:45\"))\n assert_equal(count + 1, new_count)\n assert_redirected_to :controller => '/admin/upload', :action => 'upload', :batch => nil, :type => 'batch'\n end",
"def set_batch\n @batch = Batch.find(params[:id]) unless params[:id].to_i.zero?\n @batch = Batch.find(params[:batch_id]) unless params[:batch_id].to_i.zero?\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def batch_day_params\n params.require(:batch_day).permit(:batch_id, :title)\n end",
"def new_batch(opts={})\n Batch.new(self, opts)\n end",
"def set_batch\n # Находим данные объекта Batch по id\n @batch = Batch.find(params[:id])\n end",
"def batch(requests)\n data = requests.map { |request| Request.new(*request).data }\n RPC.log \"CLIENT ENCODE BATCH #{data.inspect}\"\n data.to_json\n end",
"def execute_batch(batch, options={})\n headers = {\n 'Content-Type' => \"multipart/mixed; boundary=#{batch.batch_id}\",\n 'Accept' => 'application/atom+xml,application/xml',\n 'Accept-Charset'=> 'UTF-8'\n }\n\n query = { }\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n body = batch.to_body\n response = call(:post, generate_uri('/$batch', query), body, headers, options)\n batch.parse_response(response)\n rescue => e\n raise_with_response(e, response)\n end",
"def create_in_batch(events)\n @connection.request(:create_in_batch, {:events => events.map { |e| e.to_send }})\n end",
"def new\n @batch = Batch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @batch }\n end\n end",
"def batch_create\n if @loan_items = ObservationMatrixColumnItem.batch_create(batch_params)\n render :index\n else\n render json: {success: false}\n end \n end",
"def batch_job\n @job = Job.new\n session[:batch_job] = true\n end",
"def batch_retrieve_orders(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/orders/batch-retrieve',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def index\n @ready_for_shipment_batches = ReadyForShipmentBatch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ready_for_shipment_batches }\n end\n end",
"def processing_batches(w)\n dir = join(@basedir, DIR_PROCESSING)\n w.sftp.dir[dir, '*'].map do |entry|\n Model::Batch.new(:path => join(dir, entry.name), :state => :processing)\n end\n end"
] |
[
"0.6826564",
"0.6633915",
"0.6613268",
"0.65939456",
"0.6576259",
"0.657434",
"0.6560965",
"0.65256315",
"0.64826053",
"0.64776236",
"0.64512837",
"0.6449646",
"0.6444541",
"0.6424523",
"0.6405577",
"0.6363698",
"0.6327292",
"0.63068825",
"0.6279624",
"0.6279484",
"0.6255258",
"0.6240839",
"0.6229864",
"0.6227619",
"0.62138313",
"0.61846906",
"0.61650485",
"0.612752",
"0.61243474",
"0.61142576",
"0.6052794",
"0.6042117",
"0.6038933",
"0.60188603",
"0.59869325",
"0.5968941",
"0.59379476",
"0.58901256",
"0.58666575",
"0.58646137",
"0.58590543",
"0.5828487",
"0.5823231",
"0.5812283",
"0.5805559",
"0.57996917",
"0.57855964",
"0.5773901",
"0.5771612",
"0.5769378",
"0.5766453",
"0.57573414",
"0.5751617",
"0.5750149",
"0.5712348",
"0.5694903",
"0.5691901",
"0.56898206",
"0.5688084",
"0.5676244",
"0.56727904",
"0.5668328",
"0.56501323",
"0.56494826",
"0.5633193",
"0.56302536",
"0.5625327",
"0.5621819",
"0.5604084",
"0.56031734",
"0.56031734",
"0.56031734",
"0.56031734",
"0.56031734",
"0.5603084",
"0.56017745",
"0.55816275",
"0.5576995",
"0.5570835",
"0.5559708",
"0.5554984",
"0.55540025",
"0.55471027",
"0.5533691",
"0.5531339",
"0.5517852",
"0.55138636",
"0.5499615",
"0.54929256",
"0.54926646",
"0.54842603",
"0.54799134",
"0.547759",
"0.5469843",
"0.5468486",
"0.54604244",
"0.5459446",
"0.5455795",
"0.5451117",
"0.54493845"
] |
0.6360841
|
16
|
PATCH/PUT /batches/1 PATCH/PUT /batches/1.json
|
def update
respond_to do |format|
if @batch.update(batch_params)
format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }
format.json { render :show, status: :ok, location: @batch }
else
format.html { render :edit }
format.json { render json: @batch.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n if @batch.update_attributes(params[:batch])\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { respond_with_bip(@batch) }\n else\n format.html { redirect_to @batch }\n format.json { respond_with_bip(@batch) }\n end\n end\n end",
"def update\n if @batch.update(batch_params)\n render json: @batch, status: :ok\n else\n render json: @batch.errors, status: :unprocessable_entity\n end\n end",
"def update\n add_breadcrumb \"Batches\", batches_url\n add_breadcrumb \"Edit Batch\"\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch }\n else\n format.html { render :edit }\n flash[:alert] = @batch.errors.full_messages.to_sentence\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n if @batch.update_attributes(params[:batch])\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @batch.update_attributes(params[:batch])\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_batch_with_http_info(batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.update_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.update_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.update_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.update_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.update_batch, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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] || 'String' \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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#update_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: \"Batch was successfully updated.\" }\n format.json { render :show, status: :ok, location: @batch }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tengine_batch = Tengine::Batch.find(params[:id])\n\n respond_to do |format|\n if @tengine_batch.update_attributes(params[:tengine_batch])\n format.html { redirect_to @tengine_batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tengine_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # При редактировании объекта Batch, используем уиолчания Rails\n respond_to do |format|\n if @batch.update(batch_params)\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch }\n else\n format.html { render :edit }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @batch.update(batch_params)\n track_activity @batch\n format.html { redirect_to edit_user_batch_path(@batch.author, @batch), notice: 'Batch was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch }\n else\n format.html { render :edit }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n batch = Batch.where(\"reference_batch = ?\", params[:reference_batch])\n if params[:action_batch] == \"Close\"\n # Find all orders for this batch id\n orders = Order.where(\"batch_id = ?\", batch[0].id)\n # Update status of orders to closing\n orders.update(status: Order.statuses['closing'])\n render json: {status: 'SUCCESS', message: 'Orders closed for batch', number_of_orders_in_batch: orders.size, data: batch}, status: :ok\n elsif params[:action_batch] == \"Send\"\n if params[:delivery_service]\n # Find all orders for this batch id and delivery service\n orders = Order.where(\"batch_id = ? AND delivery_service = ?\", batch[0].id, params[:delivery_service])\n # Update status of orders to sent\n orders.update(status: Order.statuses['sent'])\n render json: {status: 'SUCCESS', message: 'Orders sent for batch', delivery_service_sent: params[:delivery_service], number_of_orders_in_sent: orders.size, data: batch}, status: :ok\n else\n render json: {status: 'ERROR', message: 'Please provide a delivery service!!'}\n end\n else\n render json: {status: 'ERROR', message: 'I do not know this action!!'}\n end\n end",
"def update\n respond_to do |format|\n if @batch_file.update(batch_file_params)\n format.html { redirect_to @batch_file, notice: \"Batch file was successfully updated.\" }\n format.json { render :show, status: :ok, location: @batch_file }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @batch_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @batch = Batch.find(params[:id])\n if @batch.update( batch_params )\n redirect_to @batch\n else\n render 'edit'\n end\n end",
"def update\n @ready_for_shipment_batch = ReadyForShipmentBatch.find(params[:id])\n\n respond_to do |format|\n if @ready_for_shipment_batch.update_attributes(params[:ready_for_shipment_batch])\n format.html { redirect_to @ready_for_shipment_batch, notice: 'Ready for shipment batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ready_for_shipment_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_batch\n @batch = Batch.find(params[:id]) unless params[:id].to_i.zero?\n @batch = Batch.find(params[:batch_id]) unless params[:batch_id].to_i.zero?\n end",
"def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = arr_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n set_batch_time batch, arr_time\n if batch.date.blank?\n batch.date = facility.index_file_parser_type.to_s.downcase == 'boa_bank'? @@batch_date : Date.today\n end\n batch.correspondence = true if type == 'CORRESP'\n if !@corresp_flag\n last_batch = Batch.find(:last, :conditions => [\"file_name = ? \", @zip_file_name])\n last_batch_corresp = Batch.find(:last, :conditions => [\"file_name = ? and correspondence = 'true'\", @zip_file_name])\n @index_condition = ((type == 'CORRESP' and (!(last_batch.nil?)) and (last_batch_corresp.nil?)) or (type == 'CORRESP' and (!(last_batch.nil?)) and !(last_batch_corresp.nil?) and (last_batch.id>last_batch_corresp.id)))\n batch.index_batch_number = @index_condition ? (last_batch.index_batch_number.to_i + 1) : 2\n end\n batch.lockbox = batch.lockbox.split('-').last if batch.lockbox\n return batch\n end",
"def update\n @batch = Batch.find(params[:id])\n @batch.user = current_user\n respond_to do |format|\n if @batch.update_attributes(params[:batch])\n flash[:notice] = 'Batch was successfully updated.'\n format.html { redirect_to(@batch) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @batch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def batch_update(batch_data, cellfeed_uri)\n batch_uri = cellfeed_uri + '/batch'\n\n batch_request = <<FEED\n<?xml version=\"1.0\" encoding=\"utf-8\"?> \\\n <feed xmlns=\"http://www.w3.org/2005/Atom\" \\\n xmlns:batch=\"http://schemas.google.com/gdata/batch\" \\\n xmlns:gs=\"http://schemas.google.com/spreadsheets/2006\" \\\n xmlns:gd=\"http://schemas.google.com/g/2005\">\n <id>#{cellfeed_uri}</id>\nFEED\n\n batch_data.each do |batch_request_data|\n version_string = get_version_string(cellfeed_uri + '/' +\n batch_request_data[:cell_id])\n data = batch_request_data[:data]\n batch_id = batch_request_data[:batch_id]\n cell_id = batch_request_data[:cell_id]\n row = batch_request_data[:cell_id][1,1]\n column = batch_request_data[:cell_id][3,1]\n edit_link = cellfeed_uri + '/' + cell_id + '/' + version_string\n \n batch_request<< <<ENTRY\n <entry>\n <gs:cell col=\"#{column}\" inputValue=\"#{data}\" row=\"#{row}\"/>\n <batch:id>#{batch_id}</batch:id>\n <batch:operation type=\"update\" />\n <id>#{cellfeed_uri}/#{cell_id}</id>\n <link href=\"#{edit_link}\" rel=\"edit\" type=\"application/atom+xml\" />\n </entry>\nENTRY\n end\n \n batch_request << '</feed>'\n return post(batch_uri, batch_request)\n end",
"def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n batch.contracted_time = (Time.now + facility.tat.to_i.hours)\n batch.target_time = (Time.now + facility.tat.to_i.hours)\n batch.date = Date.today if batch.date.blank?\n batch.bank_deposit_date = Date.today if batch.bank_deposit_date.blank?\n batch.correspondence = true if type == 'CORRESP'\n return batch\n end",
"def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n batch.contracted_time = (Time.now + facility.tat.to_i.hours)\n batch.target_time = (Time.now + facility.tat.to_i.hours)\n batch.date = Date.today if batch.date.blank?\n batch.bank_deposit_date = Date.today if batch.bank_deposit_date.blank?\n batch.correspondence = true if type == 'CORRESP'\n return batch\n end",
"def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n batch.contracted_time = (Time.now + facility.tat.to_i.hours)\n batch.target_time = (Time.now + facility.tat.to_i.hours)\n batch.date = Date.today if batch.date.blank?\n batch.bank_deposit_date = Date.today if batch.bank_deposit_date.blank?\n batch.correspondence = true if type == 'CORRESP'\n return batch\n end",
"def batch_update(request = nil, manifest: nil, items: nil, **opt)\n self.request = request ||= pre_flight(manifest, items, **opt)\n self.start_time = request[:start_time] ||= timestamp\n opt[:manifest_id] = request[:manifest_id] ||= manifest\n result_data = submit_batch(**opt)\n self.end_time = timestamp\n self.result = post_flight(result_data, **opt)\n end",
"def update\r\n @batch = Batch.find(params[:batch_id])\r\n respond_to do |format|\r\n if @batch_set.update(batch_set_params)\r\n if current_user.try(:is_admin?)\r\n format.html { redirect_to batch_batch_set_path(@batch, @batch_set), notice: 'Batch set was successfully updated.' }\r\n else\r\n format.html { redirect_to batch_batch_set_path(@batch, @batch_set), notice: 'Answers have been submitted.' } \r\n end\r\n format.json { render :show, status: :ok, location: @batch_set }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @batch_set.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @mc_batch.update(mc_batch_params)\n format.html { redirect_to @mc_batch, notice: 'MC batch was successfully updated.' }\n format.json { render :show, status: :ok, location: @mc_batch }\n else\n format.html { render :edit }\n format.json { render json: @mc_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def process_batch_with_http_info(batch_id, process_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.process_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.process_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.process_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.process_batch, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'process_batch_request_body' is set\n if @api_client.config.client_side_validation && process_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'process_batch_request_body' when calling BatchesApi.process_batch\"\n end\n # resource path\n local_var_path = '/v1/batches/{batch_id}/process/labels'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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(process_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'String' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#process_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_batch(batch_input_json_node, opts = {})\n data, _status_code, _headers = update_batch_with_http_info(batch_input_json_node, opts)\n data\n end",
"def update_batch(batch_input_json_node, opts = {})\n data, _status_code, _headers = update_batch_with_http_info(batch_input_json_node, opts)\n data\n end",
"def set_batch\n begin\n @batch = Batch.find(params[:id])\n rescue Exception => e\n return return_error_response(e.exception.to_s,404)\n end\n\n end",
"def batch_update\n @records = record_class.update(record_batch_params.keys, record_batch_params.values)\n\n respond_to do |format|\n if @records.all?(&:valid?)\n format.html { redirect_to url_for(action: 'index'), notice: \"#{record_class.model_name.plural.humanize} were successfully updated.\" }\n format.json { render :index, status: :ok }\n else\n format.html { render :batch_edit }\n format.json { render json: @records.map(&:errors), status: :unprocessable_entity }\n end\n end\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def update!(**args)\n @batch_size = args[:batch_size] if args.key?(:batch_size)\n end",
"def update_batch_statuses\n current_batches = decode(batch_statuses)\n \n if current_batches.keys.count > 20\n current_batches.keys[0..15].each do |batch_id|\n current_batches.delete(batch_id)\n end\n end\n\n current_batches.each do |id, status|\n case batch_status(id)\n when \"finished\"\n current_batches.delete(id)\n else\n current_batches[id] = batch_status(id)\n end\n end\n update_attribute(:batch_statuses, encode(current_batches))\n end",
"def update!(**args)\n @batch_id = args[:batch_id] if args.key?(:batch_id)\n @errors = args[:errors] if args.key?(:errors)\n @execution_status = args[:execution_status] if args.key?(:execution_status)\n @kind = args[:kind] if args.key?(:kind)\n @order = args[:order] if args.key?(:order)\n end",
"def set_batch\n @batch = Batch.find_by_batch_id(params[:id])\n end",
"def batch_update(batch_client, attributes)\n perform_update(batch_client, attributes)\n end",
"def set_batch\n # Находим данные объекта Batch по id\n @batch = Batch.find(params[:id])\n end",
"def delete_batch_with_http_info(batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.delete_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.delete_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.delete_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.delete_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.delete_batch, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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] || 'String' \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#delete_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @batch_sampling = BatchSampling.find(params[:id])\n\n respond_to do |format|\n if @batch_sampling.update_attributes(params[:batch_sampling])\n format.html { redirect_to(@batch_sampling, :notice => 'BatchSampling was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @batch_sampling.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @product_batch.update_attributes(params[:product_batch])\n flash[:notice] = 'ProductBatch was successfully updated.'\n format.html { redirect_to(@product_batch) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_batch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @batch = Batch.find(params[:id])\n\n @batch.phing = true\n if @batch.update(batch_params)\n flash[:notice] = 'Batch was successfully updated.'\n redirect_to(no_experiment_batches_phs_path)\n else\n render :action => \"edit\"\n end\n\n end",
"def set_batch\n @batch = Batch.find(params[:id])\n end",
"def update_batch_with_http_info(batch_input_json_node, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.update_batch ...'\n end\n # verify the required parameter 'batch_input_json_node' is set\n if @api_client.config.client_side_validation && batch_input_json_node.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_input_json_node' when calling BlogAuthorsApi.update_batch\"\n end\n # resource path\n local_var_path = '/cms/v3/blogs/authors/batch/update'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?\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 content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_json_node)\n\n # return_type\n return_type = opts[:debug_return_type] || 'BatchResponseBlogAuthor'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"BlogAuthorsApi.update_batch\",\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: BlogAuthorsApi#update_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update_batch_with_http_info(batch_input_json_node, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlogPostsApi.update_batch ...'\n end\n # verify the required parameter 'batch_input_json_node' is set\n if @api_client.config.client_side_validation && batch_input_json_node.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_input_json_node' when calling BlogPostsApi.update_batch\"\n end\n # resource path\n local_var_path = '/cms/v3/blogs/posts/batch/update'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?\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 content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_json_node)\n\n # return_type\n return_type = opts[:debug_return_type] || 'BatchResponseBlogPost'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2']\n\n new_options = opts.merge(\n :operation => :\"BlogPostsApi.update_batch\",\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: BlogPostsApi#update_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_batches_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.list_batches ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling BatchesApi.list_batches, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/batches'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\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] || 'ListBatchesResponseBody' \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: BatchesApi#list_batches\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def batch options = {}\n Diffbot::APIClient::Batch.new self, options\n end",
"def test_update_users_batch()\n # Parameters for the API call\n\n metadata = JSON.parse('{'\\\n '\"email\": \"testrubyapi@user.com\",'\\\n '\"name\": \"ruby api user\",'\\\n '\"custom\": \"testdata\"'\\\n '}')\n\n user_model_A = UserModel.new()\n user_model_A.modified_time = Time.now.utc.iso8601\n user_model_A.user_id = \"12345\"\n user_model_A.company_id = \"67890\"\n user_model_A.metadata = metadata\n\n user_model_B = UserModel.new()\n user_model_B.modified_time = Time.now.utc.iso8601\n user_model_B.user_id = \"1234\"\n user_model_B.company_id = \"6789\"\n user_model_B.metadata = metadata\n\n users = [user_model_A, user_model_B]\n\n # Perform the API call through the SDK function\n self.class.controller.update_users_batch(users)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end",
"def set_batch_file\n @batch_file = BatchFile.find(params[:id])\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update_check\r\n job = Job.find(params[:id])\r\n check = job.check_information\r\n batch = job.batch\r\n respond_to do |format|\r\n if check.update_attributes(params[:check_information])\r\n Batch.where(:id => batch.id).update_all(:associated_entity_updated_at => Time.now)\r\n format.json { render json: :back }\r\n else\r\n format.json { render :json => check.errors.full_messages, :status => :unprocessable_entity}\r\n end\r\n end\r\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def batch_params\n params.require(:batch).permit(:name,\n :beer_style_id,\n :description,\n :projected_volume_in_gallons,\n :projected_alcohol_by_volume,\n :projected_original_gravity,\n :projected_final_gravity,\n :projected_secondary_transition_date,\n :projected_bottle_date,\n :projected_condition_date,\n :actual_original_gravity,\n :actual_final_gravity,\n :actual_alcohol_by_volume,\n :actual_brew_date,\n :actual_secondary_transition_date,\n :actual_bottle_date,\n :actual_condition_date,\n :color,\n :difficulty,\n :recipe_id)\n end",
"def update\n @batch.price = params[:price].to_i\n @batch.supplier_price = params[:supplier_price].to_i\n @batch.count = params[:amount].to_i\n @batch.count *= 1000 if @batch.item.have_weight\n if @batch.save\n render json: nil, status: :ok\n else\n render json: @batch.errors, status: :unprocessable_entity\n end\n end",
"def update\n @product_batch = ProductBatch.find(params[:id])\n if @product_batch.state == 'reject'\n @product_batch.state = 'initial'\n end\n\n respond_to do |format|\n if @product_batch.update_attributes(params[:product_batch])\n format.html { redirect_to @product_batch, notice: 'Product batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_companies_batch()\n # Parameters for the API call\n\n company_model_A = CompanyModel.new()\n company_model_A.modified_time = Time.now.utc.iso8601\n company_model_A.company_id = \"12345\"\n\n company_model_B = CompanyModel.new()\n company_model_B.modified_time = Time.now.utc.iso8601\n company_model_B.company_id = \"67890\"\n company_model_B.metadata = JSON.parse('{'\\\n '\"string_field\": \"value_1\",'\\\n '\"name\": \"ruby api user\",'\\\n '\"custom\": \"testdata\"'\\\n '}')\n\n companies = [company_model_A, company_model_B]\n\n # Perform the API call through the SDK function\n self.class.controller.update_companies_batch(companies)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end",
"def batch_params\n # Инициализация параметров объекта Batch\n params.require(:batch).permit(:batch_id, :creation_date, :guid, :batch_file)\n end",
"def batch_update\n authorize BonusElementMonthAmount\n if BonusElementMonthAmount.batch_update(bonus_element_month_amount_batch_update_params[:updates])\n render json: { success: true }, status: :ok\n else\n render json: { error: 'update failed' }, status: :unprocessable_entity\n end\n end",
"def create\n \n \n @batch = Batch.new(params[:batch])\n \n if not params[:batch].has_key? :title\n @batch.title = Time.now.getutc\n end\n \n cards = params[:card]\n\n respond_to do |format|\n if @batch.save\n \n for c in cards\n Card.update c[:id], :status_id=>2, :batch_id => @batch.id\n end\n \n \n format.html { redirect_to @batch, notice: 'Batch was successfully created.' }\n format.json { render json: @batch, status: :created, location: @batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_batch bat\r\n bat.file_name = @zip_file_name\r\n bat.arrival_time = Time.now\r\n bat.facility_id = facility.id\r\n bat.client_id = facility.client_id\r\n bat.contracted_time = (Time.now + facility.tat.to_i.hours)\r\n bat.target_time = (Time.now + facility.tat.to_i.hours)\r\n bat.date = Date.today if bat.date.blank?\r\n bat.bank_deposit_date = Date.today if bat.bank_deposit_date.blank?\r\n bat.correspondence = true if type == 'CORRESP'\r\n return bat\r\n end",
"def batch_params\n params.require(:batch).permit(:description, :committed_at, :total_cents, :total_currency, :status)\n end",
"def batch_update\n @success = true\n ActiveRecord::Base.transaction do\n @selected.each do |selected|\n unless selected.update(batch_update_params)\n @success = false\n raise ActiveRecord::Rollback\n end\n end\n end\n render template: \"/dash/base/batch_update\"\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def get_batch_by_id_with_http_info(batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.get_batch_by_id ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.get_batch_by_id\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.get_batch_by_id, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.get_batch_by_id, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.get_batch_by_id, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'GetBatchByIdResponseBody' \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: BatchesApi#get_batch_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def add_to_batch_with_http_info(batch_id, add_to_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.add_to_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.add_to_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.add_to_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.add_to_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.add_to_batch, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'add_to_batch_request_body' is set\n if @api_client.config.client_side_validation && add_to_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'add_to_batch_request_body' when calling BatchesApi.add_to_batch\"\n end\n # resource path\n local_var_path = '/v1/batches/{batch_id}/add'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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(add_to_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'String' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#add_to_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def send_batch(batch)\n return if batch.empty?\n json_package = JSON.generate(batch.map { |c| c.output_hash })\n begin\n resp = @http_client.post @solr_update_url, json_package, \"Content-type\" => \"application/json\"\n rescue StandardError => exception\n end\n\n if exception || resp.status != 200\n error_message = exception ? \n Traject::Util.exception_to_log_message(exception) : \n \"Solr response: #{resp.status}: #{resp.body}\"\n\n logger.error \"Error in Solr batch add. Will retry documents individually at performance penalty: #{error_message}\"\n \n batch.each do |c|\n send_single(c)\n end\n end\n end",
"def update\n respond_to do |format|\n if @batch_day.update(batch_day_params)\n format.html { redirect_to @batch_day, notice: 'Batch day was successfully updated.' }\n format.json { render :show, status: :ok, location: @batch_day }\n else\n format.html { render :edit }\n format.json { render json: @batch_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def batch_params\n params.require(:batch).permit(:name,:background_type,:job_type,:job_count,:worker_count,:thread_count,:modified_run)\n end",
"def index\n @batches = Batch.all\n respond_to do |format|\n format.html {}\n format.json {\n\n data = Hash.new\n data[\"batches\"] = @batches\n return_success_response(data, \"Request Successful\", 200)\n }\n end\n end",
"def update\n @transport_batch = TransportBatch.find(params[:id])\n\n respond_to do |format|\n # if @transport_batch.update_attributes(params[:transport_batch])\n if @transport_batch.update_attributes :state => \"delist\"\n Feed.create owner_type: \"transport_batch\", owner_id: @transport_batch.id, user_id: current_user.id, operation: \"update\", \n desc: \"生成兑奖文件\"\n format.html { redirect_to @transport_batch.product_batch, notice: '成功生成兑奖文件.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transport_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def set_batch_set\r\n @batch_set = BatchSet.find(params[:id])\r\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def create_batch_with_http_info(create_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.create_batch ...'\n end\n # verify the required parameter 'create_batch_request_body' is set\n if @api_client.config.client_side_validation && create_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'create_batch_request_body' when calling BatchesApi.create_batch\"\n end\n # resource path\n local_var_path = '/v1/batches'\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(create_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'CreateBatchResponseBody' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#create_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def batch_params\n p = params.require(:batch).permit(:recipe,\n rhizome_roles_attributes: [:rhizome_id, :role_id, :_destroy])\n if p[:recipe].to_i.zero?\n p.delete(:recipe)\n else\n p[:recipe] = Recipe.find(p[:recipe].to_i)\n end\n p\n end",
"def update(data, &block)\n request :patch, @data[:id], data, &block\n end",
"def set_batch\n begin\n @batch = Batch.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to batches_url, :flash => { :error => \"Record not found.\" }\n end\n end",
"def update\n @bill = Bill.find_by(uid:params[:id]).extend(Billit::BillRepresenter)\n @bill.from_json(request.body.read)\n @bill.save\n begin\n Sunspot.index!(@bill)\n rescue\n puts \"#{$!}\"\n puts \"unindexed bill: \" + @bill.uid\n end\n respond_with @bill, :represent_with => Billit::BillRepresenter\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update\n begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\n respond_to do |format|\n if @job_request && @job_request.update_attributes( params[ :job_request ] )\n format.html { redirect_to root_path, notice: \"Job Requests Updated Successfully\"}\n format.json { head :no_content }\n else\n format.html { redirect_to root_path, notice: \"Update Failed\" }\n format.json { render json: @job_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n req = ActiveSupport::JSON.decode(request.body)\n @bookmark = Bookmark.find(req)\n\n respond_to do |format|\n if @bookmark.update_attributes(params[:id])\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.70306814",
"0.6989383",
"0.6975556",
"0.684838",
"0.68064505",
"0.6696952",
"0.6689448",
"0.6689448",
"0.66380227",
"0.6565038",
"0.65494907",
"0.647014",
"0.6385986",
"0.6318869",
"0.6246466",
"0.6231996",
"0.6219665",
"0.61685556",
"0.6156123",
"0.6033362",
"0.6014959",
"0.6014959",
"0.6014959",
"0.6001321",
"0.59733874",
"0.5956527",
"0.5950784",
"0.5914456",
"0.58777934",
"0.58737034",
"0.5873054",
"0.58730316",
"0.58589447",
"0.5846062",
"0.5846062",
"0.5846062",
"0.5846062",
"0.5846062",
"0.5829941",
"0.5828471",
"0.58161074",
"0.57802916",
"0.576291",
"0.57496387",
"0.573564",
"0.5727956",
"0.5704295",
"0.5687029",
"0.5682513",
"0.56737214",
"0.5672754",
"0.56564176",
"0.5653724",
"0.5650354",
"0.5635675",
"0.5617481",
"0.5610324",
"0.5609527",
"0.56074226",
"0.5592719",
"0.5592719",
"0.5592719",
"0.55901605",
"0.5579687",
"0.557763",
"0.5574211",
"0.5573548",
"0.55734426",
"0.5571528",
"0.5564727",
"0.5533782",
"0.55333585",
"0.5528959",
"0.5526649",
"0.5514136",
"0.54903764",
"0.54858404",
"0.5475676",
"0.5472431",
"0.54685354",
"0.54636407",
"0.5459621",
"0.5454163",
"0.54300535",
"0.5410118",
"0.5408712",
"0.539748",
"0.53902256",
"0.5378687",
"0.53724134",
"0.5367758",
"0.536769",
"0.536769",
"0.536769",
"0.536769",
"0.53506184",
"0.5348603",
"0.53434867"
] |
0.6664314
|
10
|
DELETE /batches/1 DELETE /batches/1.json
|
def destroy
@batch.destroy
respond_to do |format|
format.html { redirect_to batches_url, notice: 'Batch was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tengine_batch = Tengine::Batch.find(params[:id])\n @tengine_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to tengine_batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch.destroy\n render json: @batch, status: :ok\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to(batches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to(batches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n redirect_to batches_path\n end",
"def destroy\n @batch = Batch.find(params[:id])\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_path(@batch.recipe_id)}\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch.destroy\n head :no_content\n end",
"def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url, notice: \"Batch was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n # При удалении объекта Batch из БД, используем уиолчания Rails\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url, notice: 'Batch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @batch = Batch.find(params[:batch_id])\r\n @batch_set.destroy\r\n respond_to do |format|\r\n format.html { redirect_to @batch, notice: 'Batch set was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @batch_file.destroy\n respond_to do |format|\n format.html { redirect_to batch_files_url, notice: \"Batch file was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_batch = ProductBatch.find(params[:id])\n @product_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to product_batches_url }\n format.json { head :no_content }\n end\n end",
"def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end",
"def destroy\n @ready_for_shipment_batch = ReadyForShipmentBatch.find(params[:id])\n @ready_for_shipment_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to ready_for_shipment_batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n flash.now[:notice] = \"Batch was successfully destroyed.\"\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end",
"def destroy\n @mc_batch.destroy\n respond_to do |format|\n format.html { redirect_to mc_batches_url, notice: 'MC batch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transport_batch = TransportBatch.find(params[:id])\n @transport_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to transport_batches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch_sampling = BatchSampling.find(params[:id])\n @batch_sampling.destroy\n\n respond_to do |format|\n format.html { redirect_to(batch_samplings_url) }\n format.xml { head :ok }\n end\n end",
"def delete_batch_with_http_info(batch_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.delete_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.delete_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.delete_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.delete_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.delete_batch, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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] || 'String' \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#delete_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @product_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_batches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy_batches\n @import_job.import_batches.each do |batch|\n batch.destroy\n end\n redirect_to @import_job, notice: \"Batches and related records for this job have been destroyed.\"\n end",
"def batch_delete(uuids)\n body = uuids.to_json\n request_delete(uri: '/files/storage/', content: body)\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def destroy\n @batch_day.destroy\n respond_to do |format|\n format.html { redirect_to batch_days_url, notice: 'Batch day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n result, _ = Sidekiq::Batch.redis(bid) do |conn|\n conn.pipelined do\n conn.hsetnx(\"b-#{bid}\", \"deleted\", \"1\")\n conn.del \"b-#{bid}-failinfo\",\n \"b-#{bid}-notify\",\n \"b-#{bid}-cbsucc\",\n \"b-#{bid}-success\",\n \"b-#{bid}-complete\",\n \"b-#{bid}-jids\"\n conn.zrem('batches'.freeze, bid)\n conn.expire \"b-#{bid}\", Sidekiq::Batch::LINGER\n end\n end\n result ? bid : nil\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def batch_destroy \n if params[:ids]\n if Contrato.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.contrato'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def batch_destroy \n if params[:ids]\n if TipoProcesso.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.tipo_processo'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def batch_destroy \n if params[:ids]\n if Cliente.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.cliente'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def batch_destroy \n if params[:ids]\n if ContratosProcesso.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.contratos_processo'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def remove_from_batch_with_http_info(batch_id, remove_from_batch_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BatchesApi.remove_from_batch ...'\n end\n # verify the required parameter 'batch_id' is set\n if @api_client.config.client_side_validation && batch_id.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_id' when calling BatchesApi.remove_from_batch\"\n end\n if @api_client.config.client_side_validation && batch_id.to_s.length > 25\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.remove_from_batch, the character length must be smaller than or equal to 25.'\n end\n\n if @api_client.config.client_side_validation && batch_id.to_s.length < 1\n fail ArgumentError, 'invalid value for \"batch_id\" when calling BatchesApi.remove_from_batch, the character length must be great than or equal to 1.'\n end\n\n pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)\n if @api_client.config.client_side_validation && batch_id !~ pattern\n fail ArgumentError, \"invalid value for 'batch_id' when calling BatchesApi.remove_from_batch, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'remove_from_batch_request_body' is set\n if @api_client.config.client_side_validation && remove_from_batch_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'remove_from_batch_request_body' when calling BatchesApi.remove_from_batch\"\n end\n # resource path\n local_var_path = '/v1/batches/{batch_id}/remove'.sub('{' + 'batch_id' + '}', CGI.escape(batch_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(['text/plain', '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(remove_from_batch_request_body) \n\n # return_type\n return_type = opts[:return_type] || 'String' \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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BatchesApi#remove_from_batch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def batch_destroy \n if params[:ids]\n if Acompanhamento.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.acompanhamento'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def batch_destroy \n if params[:ids]\n if Fase.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.fase'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def batch_destroy\n Video.destroy(params[:ids])\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blast_request.destroy\n respond_to do |format|\n format.html { redirect_to mc_blast_blast_requests_path, notice: 'Blast request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def batch_destroy\n @success = @selected.destroy_all\n render template: \"/dash/base/batch_destroy\"\n end",
"def batch_destroy \n if params[:ids]\n if CentroCusto.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.centro_custo'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def delete_organization_action_batch(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'organization_id' => options['organization_id'],\r\n 'action_batch_id' => options['action_batch_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/organizations/{organizationId}/actionBatches/{actionBatchId}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'organizationId' => options['organization_id'],\r\n 'actionBatchId' => options['action_batch_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.delete(\r\n _query_url\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n end",
"def remove_jobs(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/erase\"\n\n begin\n response = RestClient::Request.new(\n :method => :post,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job #{id} => success\"\n else\n puts \"delete job #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n\n end\n\nend",
"def destroy\n bin_url = @request.bin.url\n\n @request.destroy\n respond_to do |format|\n format.html do\n redirect_to \"/bins/#{bin_url}\",\n notice: 'Request was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def batch_destroy(batch_client)\n perform_destroy(batch_client)\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_call = RequestCall.find(params[:id])\n @request_call.destroy\n\n respond_to do |format|\n format.html { redirect_to request_calls_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @batch_progress_report.destroy\n respond_to do |format|\n format.html { redirect_to batch_progress_reports_url, notice: 'Batch progress report was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def batch_destroy \n if params[:ids]\n if AssuntoProcessual.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.assunto_processual'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def delete\n count = _redis_lua_run(\n 'batch_delete',\n keys: [_batch_key, _index_key, _batch_ref_key, _batch_gauge_key, _event_gauge_key],\n argv: [@uid, PREFIX_COUNT, subscriber_name])\n _counters.incr('events.removed', queue: subscriber_name, count: count)\n self\n end",
"def batch_destroy \n if params[:ids]\n if AdvogadosEscritorio.destroy_all(id: params[:ids])\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.advogados_escritorio'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb' }\n end\n end",
"def destroy\n @tipo_processo = TipoProcesso.find(params[:id])\n if @tipo_processo.destroy\n flash[:notice] = t('general.messages.delete_success', model_name: t('activerecord.models.tipo_processo'))\n else\n flash[:error] = t('general.messages.delete_error')\n end\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n format.js { render template: 'shared/batch_destroy.js.erb'}\n end\n end",
"def batch_destroy\n params[:device_ids].each do |device_id|\n device = Device.find(device_id)\n device.destroy\n end\n\n respond_with(params[:device_ids], location: devices_path, notice: 'Devices were successfully destroyed.')\n end",
"def delete(*rest) end",
"def delete!\n request! :delete\n end",
"def destroy\n @batting_line = BattingLine.find(params[:id])\n @batting_line.destroy\n\n respond_to do |format|\n format.html { redirect_to batting_lines_url }\n format.json { head :no_content }\n end\n end",
"def deleteRequest\n\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @borrow_request = BorrowRequest.find(params[:id])\n @borrow_request.destroy\n\n respond_to do |format|\n format.html { redirect_to borrow_requests_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def test_count_after_delete\n first_count=Batch.count\n Batch.destroy(1)\n assert_not_equal(first_count,Batch.count)\n end",
"def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @bill_quorum = BillQuorum.find(params[:id])\n @bill_quorum.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_quorums_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blast = Blast.find(params[:id])\n @blast.destroy\n\n respond_to do |format|\n format.html { redirect_to blasts_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end",
"def bulk_delete_comments\n comment_ids_string = params[:ids]\n comment_ids = eval(comment_ids_string)\n\n comment_ids.each do |id|\n comment = Comment.find(id.to_i)\n if !comment.nil?\n comment.destroy\n\n end\n\n end\n\n head :no_content\n\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = LoadBalancerCheck.find(params[:id])\n @load_balancer_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_check_path(operations_check, tab: \"load_balancers\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @http_request.destroy\n respond_to do |format|\n format.html { redirect_to http_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @http_request.destroy\n respond_to do |format|\n format.html { redirect_to http_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @training_queue = Training::Queue.find(params[:id])\n @training_queue.destroy\n\n respond_to do |format|\n format.html { redirect_to training_queues_url }\n format.json { head :ok }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @request_status = RequestStatus.find(params[:id])\n @request_status.destroy\n\n respond_to do |format|\n format.html { redirect_to request_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Clenum.destroy params[:ids].split(',')\n\n respond_to do |format|\n format.html { redirect_to(clenums_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7604413",
"0.7583041",
"0.75795025",
"0.75795025",
"0.7442352",
"0.74171066",
"0.7412871",
"0.7412871",
"0.73102266",
"0.73034376",
"0.7266451",
"0.7244553",
"0.7143779",
"0.7090966",
"0.6951617",
"0.6939564",
"0.6937238",
"0.6875119",
"0.6864587",
"0.67882687",
"0.6785654",
"0.6690034",
"0.6654508",
"0.6609205",
"0.65844977",
"0.62853926",
"0.62639",
"0.6250324",
"0.6236428",
"0.6218325",
"0.62040216",
"0.61951125",
"0.6161378",
"0.6139165",
"0.61175567",
"0.6085296",
"0.60753226",
"0.6073832",
"0.6067785",
"0.60651904",
"0.6061468",
"0.60532504",
"0.60529274",
"0.6035855",
"0.60331225",
"0.6025046",
"0.60187954",
"0.6017015",
"0.6009873",
"0.6002418",
"0.5984475",
"0.597973",
"0.5939434",
"0.5939091",
"0.59349495",
"0.5934674",
"0.59286606",
"0.59223104",
"0.5919559",
"0.59106153",
"0.58984584",
"0.58754313",
"0.58738214",
"0.5867532",
"0.58657396",
"0.58649105",
"0.58641183",
"0.58567315",
"0.58473307",
"0.58442944",
"0.58402723",
"0.5834699",
"0.58331656",
"0.58289737",
"0.5824006",
"0.5824006",
"0.5824006",
"0.5824006",
"0.58226335",
"0.5818714",
"0.581342",
"0.5813224",
"0.58101416",
"0.5807574",
"0.5807574",
"0.5807574",
"0.5807574",
"0.5807574",
"0.5807574",
"0.5806107",
"0.5802487",
"0.5801738",
"0.5801738",
"0.5800836",
"0.5795731",
"0.5792397",
"0.5790655",
"0.5781849"
] |
0.7255194
|
13
|
Use callbacks to share common setup or constraints between actions.
|
def set_batch
begin
@batch = Batch.find(params[:id])
rescue Exception => e
return return_error_response(e.exception.to_s,404)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def batch_params
params.require(:batch).permit(:course_id, :name, :price, :start_date, :schedule, :strength, :status ,:team_member_ids => [])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Create the Note object
|
def initialize
@model = Evertils::Common::Query::Simple.new
@format = Formatting.new
@user = @model.user_info[:user]
@shard = @model.user_info[:shard]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @note = Note.new\n end",
"def create(params = {})\n note = build(params)\n note.save\n note\n end",
"def create_notes\n end",
"def create_note(contents, title = nil, description = nil)\n Dropio::Resource.client.create_note(self, contents, title, description)\n end",
"def new_note(content)\n note = Note.new({:type_id => self.id,\n :owner => 'bill',\n :content => content})\n note.save\n end",
"def create\n @note = Note.new(note_params)\n @note.save\n end",
"def create_note(note, topics, attachments)\n click_create_new_note\n enter_new_note_subject note\n enter_note_body note\n add_attachments_to_new_note(note, attachments)\n add_topics(note, topics)\n click_save_new_note\n set_new_note_id note\n end",
"def create\n @note = build_note\n\n if note.save\n successful_creation\n else\n @errors = note.errors\n render_errors\n end\n end",
"def create_note(issue)\n Note.create_status_change_note(issue, issue.project, current_user, issue.state, current_commit)\n end",
"def create\n @note = current_user.notes.new(params[:note])\n @note.note = view_context.markdown(@note.note).gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n @note.save\n $statsd.increment 'animal.note.created'\n respond_with(@note)\n end",
"def initialize_note(user_id,note)\n \tself.notes.new(user_id: user_id, description: note)\n end",
"def build(params = {})\n note = Ketchup::Note.new @api, @item, params\n push note\n note\n end",
"def make_note(note_store, note_title, note_body, parent_notebook=nil)\n # read the image, to make hash key in MD5\n file_path = save_image(@book.image)\n file_url = @book.image\n mime_type = MIME::Types.type_for(file_path).to_s\n image = File.open(file_path, \"rb\") { |io| io.read }\n hashFunc = Digest::MD5.new\n hashHex = hashFunc.hexdigest(image)\n\n # make mata data type to image\n data = Evernote::EDAM::Type::Data.new()\n data.size = image.size\n data.bodyHash = hashHex\n data.body = image\n\n # dataと併せて添付ファイル形式を作る\n resource = Evernote::EDAM::Type::Resource.new()\n resource.mime = \"image/jpeg\"\n resource.data = data\n resource.attributes = Evernote::EDAM::Type::ResourceAttributes.new()\n resource.attributes.fileName = file_url\n\n n_body = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n n_body += \"<!DOCTYPE en-note SYSTEM \\\"http://xml.evernote.com/pub/enml2.dtd\\\">\"\n n_body += \"<en-note><en-media type=\\\"#{resource.mime}\\\" hash=\\\"#{hashHex}\\\"/>#{note_body}</en-note>\"\n\n ## Create note object\n our_note = Evernote::EDAM::Type::Note.new\n our_note.title = note_title\n our_note.tagNames = [ @book.author.gsub(' ', '') ]\n our_note.content = n_body\n our_note.resources = [ resource ]\n\n ## parent_notebook is optional; if omitted, default notebook is used\n if parent_notebook && parent_notebook.guid\n our_note.notebookGuid = parent_notebook.guid\n end\n\n ## Attempt to create note in Evernote account\n begin\n note = note_store.createNote(our_note)\n rescue Evernote::EDAM::Error::EDAMUserException => edue\n ## Something was wrong with the note data\n ## See EDAMErrorCode enumeration for error code explanation\n ## http://dev.evernote.com/documentation/reference/Errors.html#Enum_EDAMErrorCode\n puts \"EDAMUserException: #{edue}\"\n\n # image file delete\n File.unlink(file_path)\n rescue Evernote::EDAM::Error::EDAMNotFoundException => ednfe\n ## Parent Notebook GUID doesn't correspond to an actual notebook\n puts \"EDAMNotFoundException: Invalid parent notebook GUID\"\n\n # image file delete\n File.unlink(file_path)\n end\n\n # image file delete\n File.unlink(file_path)\n\n # save post datetime\n save_evernote_post_at\n\n ## Return created note object\n return note\n end",
"def createNote(noteText)\n refreshToken\n path = \"/api/note?auth=#{@token}\\&email=#{@email}&modify=#{ERB::Util.url_encode(Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n data = noteText\n payload = Base64.encode64(data)\n response, data = agent.post(path,payload)\n unless response.code.to_i == 200\n raise \"Failed to create new note\"\n end\n response.body\n end",
"def create\n # must be logged in\n if !@user || !@user.id\n flash[:warning] = \"must be logged in\"\n render :action => :error\n return\n end\n # build a temporary new note\n @note = Note.new({:sponsor=>@user.id,:parent=>@note.id})\n # then allow edit to build a display over the subject matter\n edit\n end",
"def create\n @task_note = Note.new(params[:note])\n\n respond_to do |format|\n if @task_note.save\n format.html { redirect_to notes_path, notice: 'Task note was successfully created.' }\n format.json { render json: @task_note, status: :created, location: @task_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_note (notes_hash, framework=self.framework)\n\t\t\tprint_deb \"Attempting to create note with #{notes_hash.inspect}\"\n\t\t\t# check the required hash elements for a good note\n\t\t\t\n\t\t\t# <-- start weird bug work around\n\t\t\trequired_elements = [:data]\n\t\t\t#required_elements = [:data,:type]\n\t\t\tnotes_hash[:type] = \"db_fun\"\n\t\t\t# --> end weird bug work around\n\t\t\t\n\t\t\trequired_elements.each do |elem|\n\t\t\t\traise ArgumentError.new \"Missing required element (#{elem}) \" +\n\t\t\t\t\"for the note\" unless notes_hash[elem]\n\t\t\tend\n\t\t\tprint_deb \"Sending note to db with #{notes_hash.inspect}\"\n\t\t\tframework.db.report_note(notes_hash)\n\t\t\t\t\n\t\t\t#\n\t\t\t# Report a Note to the database. Notes can be tied to a Workspace, Host, or Service.\n\t\t\t#\n\t\t\t# opts MUST contain\n\t\t\t# +:data+:: whatever it is you're making a note of\n\t\t\t# +:type+:: The type of note, e.g. smb_peer_os\n\t\t\t#\n\t\t\t# opts can contain\n\t\t\t# +:workspace+:: the workspace to associate with this Note\n\t\t\t# +:host+:: an IP address or a Host object to associate with this Note\n\t\t\t# +:service+:: a Service object to associate with this Note\n\t\t\t# +:port+:: along with :host and proto, a service to associate with this Note\n\t\t\t# +:proto+:: along with :host and port, a service to associate with this Note\n\t\t\t# +:update+:: what to do in case a similar Note exists, see below\n\t\t\t#\n\t\t\t# The +:update+ option can have the following values:\n\t\t\t# +:unique+:: allow only a single Note per +:host+/+:type+ pair\n\t\t\t# +:unique_data+:: like +:uniqe+, but also compare +:data+\n\t\t\t# +:insert+:: always insert a new Note even if one with identical values exists\n\t\t\t#\n\t\t\t# If the provided +:host+ is an IP address and does not exist in the\n\t\t\t# database, it will be created. If +:workspace+, +:host+ and +:service+\n\t\t\t# are all omitted, the new Note will be associated with the current\n\t\t\t# workspace.\n\t\t\t#\n\t\tend",
"def build_base_note(base_note_options)\n Note.new({\n :text_value => base_note_options[:text_value],\n :octave => base_note_options[:octave] || DEFAULT_OCTAVE,\n :accidental => base_note_options[:accidental],\n :key => base_note_options[:key],\n :pitch => base_note_options[:pitch],\n :attack => base_note_options[:attack],\n :decay => base_note_options[:decay],\n :duration => base_note_options[:duration] },\n @pattern\n )\n end",
"def build_note(note, text)\n\t\tcontent = get_text_from_regexp(text, /-(.*)/)\n\t\t#content = text.match(/-(.*)/).captures.first\n\t\tnote.body = content.rstrip\n\n\t\twhitespace = get_text_from_regexp(text, /(.*)-/)\n\t\t#whitespace = text.match(/(.*)-/).captures.first\n\t\tnote.depth = (whitespace.length)/3 #+2?\n\n\t\treturn note\n\tend",
"def notes\n Notes.new(self)\n end",
"def create_comment(note,comment_text)\n Comment.create(:commentable_type=>note.class.name,:commentable_id=>note.id,:created_by_user_id=>current_user.id,\n :comment=>comment_text,:company_id=>note.company_id,:title=>note.class.name)\n end",
"def n(*args)\n @contents << Note.new(*args)\n end",
"def note(notebook)\n @note = Note.new(notebook, @@auth_store) if @note.nil?\n @note\n end",
"def buildnote\n @buildnote ||= BuildNote.new\n end",
"def create\n\t\t@newEntry = Note.create(title: params[:title], entry: params[:entry], topic: params[:topic])\n\t\t@allNotes = Note.all\n\t\trender json: @allNotes\n\tend",
"def create_deal_note(deal_id, note)\n post(\"deals/#{deal_id}/notes\", note: { note: note })\n end",
"def create_new_note\n note_type = params[:note_type][:note_type_id]\n new_note = keytech_note_handler.create(note_type, params[:element_key])\n new_note.subject = params[:subject]\n new_note.text = params[:body]\n response = keytech_note_handler.save(new_note)\n if response[:success] == true\n flash[:info] = 'Notiz wurde angelegt'\n else\n flash[:error] = \"Notiz konnte nicht angelegt werden: #{response[:error]}\"\n end\n redirect_to \"/element/#{params[:element_key]}/notes\"\n end",
"def create\n @note = Note.new(:content => params[:content], :user => current_user)\n print(\"json note \"+ @note.to_json)\n if @note.save\n render :show, status: :created, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def create\n @note = Note.new(params[:note])\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n importance = 11\n @note = Note.new(body: note_params['body'], last_seen: Date.today, user_id: current_user.id, importance: importance)\n @note.add_tag(note_params['tag'].chomp.downcase, current_user.id)\n @note.add_second(note_params['second'].chomp.downcase, @note.tag.id, current_user.id)\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_path, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { redirect_to notes_path, notice: @note.errors }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: note_url(@note)\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def create \n @note = Note.new(params_as_note_attributes_hash)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to(@note, :notice => 'Note was successfully created.') }\n format.json { render :json => @note, :status => :created, :location => @note }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create!(note)\n self.class.post('/notifications.xml', :body => note.to_xml)\n end",
"def create\n notes_params = params[:note]\n @note = Note.new(notes_params)\n @note.created_by_id = current_user.id\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_log(content)\n @note.title = to_utf8(@name) + \" - \" + Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n @note.tags = @tag.get\n @note.content = to_utf8(content)\n @note.create\n Logger.log_internal { \"Create note: #{@note.guid}\" }\n end",
"def new_notes=(note)\n\t\tif !note.blank? then\n\t\t\ttime = Time.now.strftime(\"%m-%d-%y %I:%M %p\")\n\t\t\tnew_note = \"<p>#{note}<br/>\"\n\t\t\tnew_note << \"<span class=\\\"info\\\">\"\n\t\t\tnew_note << \"[#{time}]\"\n\t\t\tnew_note << \"</span></p>\"\n\t\t\tif self.notes.blank? then\n\t\t\t\tself.notes = new_note\n\t\t\telse\n\t\t\t\tself.notes << new_note\n\t\t\tend\n\t\tend\n\tend",
"def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n\n end",
"def note(note)\n\t\t@note = note\n\tend",
"def create\n respond_with :api, :v1, Note.create(note_params)\n end",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n Rails.logger.info \"CREATING NEW NOTE with params #{params}\"\n receiver = find_by_type_and_id(params[:receiver_type], params[:receiver_id])\n note = Note.new(:message => params[:message], :sender => current_profile, :private => params[:private_note], :receiver => receiver)\n if (reply_to_note_id = params[:reply_to_note_id])\n note.receiver = Note.find(reply_to_note_id).sender\n note.replied_to = reply_to_note_id\n end\n note.save! \n flash[:notice] = \"Your message has ben sent.\" \n render :text => {:message => \"Messsage Sent\" }.to_json\n rescue Exception => e\n flash[:errors] = \"There was an error sending your message, please try again.\"\n render :text => {:message => \"Unable to save message.\", :error => e.message }.to_json\n end",
"def build_note\n @pdf.text_box(\n \"#{@document.note}\",\n size: 10,\n at: [0, note_height],\n width: x(450),\n align: :left\n )\n end",
"def create_note(project_id, story_id, text, options = {})\n options = { :note => options.merge!(:text => text) }\n post(\"projects/#{project_id}/stories\", options).note\n end",
"def create\n @note = Note.new(note_params)\n @note.created_at = DateTime.now\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def note(id, type, options = {})\n # Welguisz: No idea why this is here, but keeping it here because it follows other blocks\n _notes\n # Create a new note and place it in the notes 2-D Hash\n @_notes[id][type] = Note.new(id, type, options)\n end",
"def create\n note_attr = note_params\n tag_names = note_params[:tag].split(\" \")\n note_attr[:tag] = tag_names\n\n ActiveRecord::Base.transaction do\n Tag.add_count(tag_names, [])\n @note = Note.new(note_attr)\n raise \"ノートの作成ができませんでした。\" unless @note.save!\n end\n\n respond_to do |format|\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n end\n rescue => e\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_note = ProjectNote.new(project_note_params(params[:project_note]))\n\n if @project_note.save\n render json: @project_note, status: :created, location: @project_note\n else\n render json: @project_note.errors, status: :unprocessable_entity\n end\n end",
"def initialize(note, duration)\n @note = note\n @duration = duration\n end",
"def note_create_params\n params.require(:note).permit(:project_id, :id, :title, :type, :description, :show)\n end",
"def create\n @playlist = Playlist.find_by(note_params[:spotify_id])\n @note = @playlist.notes.build(user_spotify_id: note_params[:user_spotify_id], content: note_params[:content])\n\n if @note.save\n render json: {\n status: 201,\n store: @note\n }, status: :created, location: api_v1_note_path(@note)\n else\n render json: {\n status: 422,\n errors: @store.errors.full_messages.join(\", \")\n }, status: :unprocessable_entity\n end\n end",
"def create\r\n @note = Note.new(note_params)\r\n if @note.save\r\n redirect_to @note\r\n else\r\n render :new\r\n end\r\n end",
"def initialize(primary_key, uuid, uti, note, alt_text, token_identifier)\n # Set this object's variables\n @primary_key = primary_key\n @uuid = uuid\n @type = uti\n @conforms_to = uti\n @note = note\n @alt_text = alt_text\n @token_identifier = token_identifier\n @backup = @note.backup\n @database = @note.database\n @logger = @backup.logger\n\n @logger.debug(\"Note #{@note.note_id}: Created a new Embedded Inline Attachment of type #{@type}\")\n end",
"def create\n @note = @current_user.notes.create(note_params)\n render json: @note\n end",
"def create\n @note = current_user.notes.build(params[:note])\n if @note.save\n flash[:notice] = 'Note was successfully created.'\n end\n respond_with(@note)\n end",
"def create\n @to_do_note = ToDoNote.new(to_do_note_params)\n\n respond_to do |format|\n if @to_do_note.save\n format.html { redirect_to @to_do_note, notice: 'To do note was successfully created.' }\n format.json { render :show, status: :created, location: @to_do_note }\n else\n format.html { render :new }\n format.json { render json: @to_do_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n @note.user = current_user\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_note # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity\n @bib.biblionote.each do |n|\n case n.type\n when \"annote\" then @item.annote = n.content\n when \"howpublished\" then @item.howpublished = n.content\n when \"comment\" then @item.comment = n.content\n when \"tableOfContents\" then @item.content = n.content\n when nil then @item.note = n.content\n end\n end\n end",
"def create\n @notebook_note = Notebook::Note.new(notebook_note_params)\n\n respond_to do |format|\n if @notebook_note.save\n format.html { redirect_to @notebook_note, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notebook_note }\n else\n format.html { render action: 'new' }\n format.json { render json: @notebook_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = current_user.notes.build(params[:note])\n respond_to do |format|\n if @note.save\n format.html do\n flash[:notice] = 'Note was successfully created.'\n redirect_to(@note)\n end\n format.xml { render :xml => @note.to_xml }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @note.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @note = Note.new\n respond_with(@note)\n end",
"def create\n @sticky_note = StickyNote.new(params[:sticky_note])\n\n respond_to do |format|\n if @sticky_note.save\n format.html { redirect_to @sticky_note, notice: 'Sticky note was successfully created.' }\n format.json { render json: @sticky_note, status: :created, location: @sticky_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sticky_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_note = EventNote.new(event_note_params)\n\n respond_to do |format|\n if @event_note.save\n format.html { redirect_to @event_note, notice: 'Event note was successfully created.' }\n format.json { render :show, status: :created, location: @event_note }\n else\n format.html { render :new }\n format.json { render json: @event_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_note = PostNote.new(params[:post_note])\n\n respond_to do |format|\n if @post_note.save\n format.html { redirect_to(@post_note, :notice => 'Post note was successfully created.') }\n format.xml { render :xml => @post_note, :status => :created, :location => @post_note }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post_note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def make_todo(attributes)\n ToDo.create(attributes)\n end",
"def create\n \n if get_case\n @note = @case.notes.build(note_params)\n path_notes = case_notes_path\n else\n @note = Note.new(note_params)\n path_notes = notes_path\n end\n\n @note.user = @user\n @note.firm = @firm\n \n respond_to do |format|\n if @note.save\n format.html { redirect_to path_notes, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = current_user.notes.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_workflow_note\n @new_workflow_note ||= ChangeSet.for(WorkflowNote.new)\n end",
"def create\n @project_note = ProjectNote.new(project_note_params)\n\n respond_to do |format|\n if @project_note.save\n format.html { redirect_to @project_note, notice: 'Project note was successfully created.' }\n format.json { render :show, status: :created, location: @project_note }\n else\n format.html { render :new }\n format.json { render json: @project_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(note_params)\n @note.user_id = current_user.id\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def maker_note\n @maker_note ||= MakerNote.new(EXIF.exif_data_get_mnote_data(self))\n end",
"def create\n @note = Note.new(note_params.merge(user: current_user))\n\n respond_to do |format|\n if @note.save\n format.html do\n flash[:notice] = t('controllers.notes.create.success')\n redirect_to @note.contact || @note\n end\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_notification\n\t\tNotification.create(title: self.title,\n\t\t\t\t\t\t\t\t\t\t\t\tnotification_type: 0,\n\t\t\t\t\t\t\t\t\t\t\t\tlocation: self.location,\n\t\t\t\t\t\t\t\t\t\t\t\tlatitude: self.latitude,\n\t\t\t\t\t\t\t\t\t\t\t\tlongitude: self.longitude,\n record_id: self.id,\n generated_by: self.created_by)\n\tend",
"def create\n @sticky_note = StickyNote.new(sticky_note_params)\n\n respond_to do |format|\n if @sticky_note.save\n format.html { redirect_to @sticky_note, notice: 'Sticky note was successfully created.' }\n format.json { render :show, status: :created, location: @sticky_note }\n else\n format.html { render :new }\n format.json { render json: @sticky_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(note, voice)\n @obj = note\n @letter, @octave, @accidental = self.parse_name(note['name'])\n @name = @letter + @accidental\n @pitch = self.get_pitch\n @rest = note['rest']\n @beats = @@types[note['type']]\n @voice = voice\n @part = nil\n end",
"def create(name, external_id, note, options = {})\n options[:name] = name\n options[:externalId] = external_id\n options[:note] = note\n post(PATH, options)\n end",
"def new\n @note = Note.new\n\n respond_with(@note)\n end",
"def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n # format.html { redirect_to :back, notice: 'Note was successfully created.' }\n # format.json { render json: @note, status: :created, location: @note }\n # copies from alternate_values:\n format.html { redirect_to @note.note_object.metamorphosize, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { redirect_to :back, notice: 'Note was NOT successfully created.' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n detail = params[:note][:detail_type].constantize.new(params[:note][:detail_attributes])\n params[:note].delete(:detail_attributes)\n @note = Note.new(params[:note])\n @note.detail = detail\n\n respond_to do |format|\n if @note.save\n #format.html { redirect_to(@note, :notice => 'X doc was successfully created.') }\n format.js\n format.xml { render :xml => @note, :status => :created, :location => @note }\n else\n #format.html { render :action => \"new\" }\n format.js\n format.xml { render :xml => @note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def note\n DBC.require( bu?, \"Vin non bu: La note n'est pas definie\" )\n\n @note\n end",
"def create\n if !session[:user]\n redirect_to login_path, :alert => \"You have to log in to create a note \"\n else\n @note = Note.new(note_params)\n if !session[:admin]\n @note.user = User.find_by name: session[:user]\n end\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_url, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @internal_note = InternalNote.new(internal_note_params)\n\n respond_to do |format|\n if @internal_note.save\n format.html { redirect_to @internal_note, notice: 'Internal note was successfully created.' }\n format.json { render :show, status: :created, location: @internal_note }\n else\n format.html { render :new }\n format.json { render json: @internal_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def P(*args)\n SyntaxNotes::P.build(*args)\n end",
"def create\n @notebook = Notebook.find(params[:notebook_id])\n @note = Note.new(note_params)\n @note.notebook_id = @notebook.id\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @notebook, notice: 'Note was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @object = NoteTitle.new(params[:note_title])\n\n respond_to do |format|\n if @object.save\n flash[:notice] = 'Note Title was successfully created.'\n format.html { redirect_to(admin_note_title_url(@object)) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @object.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @note = Note.new(params[:note])\n @note.serial_no = Note.next_serial_no\n @note.year_at = Date.current.year\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Документ успешно создан.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_phase_milestone_note = Project::Phase::Milestone::Note.new(project_phase_milestone_note_params)\n @project_phase_milestone_note.project_phase_milestone = Project::Phase::Milestone.find_by_id(params[:milestone_id])\n @project_phase_milestone_note.user = current_user\n \n respond_to do |format|\n if @project_phase_milestone_note.save\n format.html { redirect_to project_phase_milestone_notes_url, notice: \"Note was successfully created.\" }\n format.json { render :show, status: :created, location: @project_phase_milestone_note }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project_phase_milestone_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def note_contents=(notes)\n notes.each do |note|\n if note != \"\"\n self.notes << Note.find_or_create_by(content: note)\n end\n end\n\n end",
"def create\n @article = Article.create(:content => params[:article_content])\n @graph = Graph.find(params[:graph_id], :select => \"id\", :readonly => true)\n @note = Note.new(params[:note])\n @note.article = @article\n @note.graph = @graph\n\n respond_to do |format|\n if @note.save\n SyncLog.note_create_new(@note.graph.id, @note, params[:clientId])\n format.xml { render :xml => @note.to_xml(:only => [:id]), :status => :created }\n else\n format.xml { render :xml => @note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(authToken, noteStore, note)\n\tcreatedNote = noteStore.createNote(authToken, note)\n\tputs \"Successfully created a new note with GUID: #{createdNote.guid}\"\nend",
"def create\n @textnote = Textnote.new(textnote_params)\n\n respond_to do |format|\n if @textnote.save\n format.html { redirect_to current_user, notice: 'Textnote was successfully created.' }\n format.json { render :show, status: :created, location: @textnote }\n else\n format.html { render :new }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale_note = Sale::Note.new(sale_note_params)\n\n respond_to do |format|\n if @sale_note.save\n format.html { redirect_to @sale_note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @sale_note }\n else\n format.html { render :new }\n format.json { render json: @sale_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @note = Note.new(note_params)\n @note.user_id = current_user.id\n @note.job_id = @job.id\n\n if @note.save\n redirect_to @job\n end\n end",
"def create\n @note = Note.new(note_params)\n @note.created_by = session[:user_id]\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_note\n trap('SIGINT') do\n warn \"\\nCanceled\"\n exit!\n end\n # First make sure there isn't already a buildnotes file\n filename = find_note_file\n if filename\n system 'stty cbreak'\n fname = \"\\e[1;33m#{filename}\\e[1;37m\"\n yn = color_single_options(%w[y N])\n $stdout.syswrite \"#{fname} exists and appears to be a build note, continue anyway #{yn}\\e[1;37m? \\e[0m\"\n res = $stdin.sysread 1\n res.chomp!\n puts\n system 'stty cooked'\n\n unless res =~ /y/i\n puts 'Canceled'\n Process.exit 0\n end\n end\n\n title = File.basename(Dir.pwd)\n printf \"\\e[1;37mProject name \\e[0;32m[#{title}]\\e[1;37m: \\e[0m\"\n input = gets.chomp\n title = input unless input.empty?\n\n summary = ''\n printf \"\\e[1;37mProject summary: \\e[0m\"\n input = gets.chomp\n summary = input unless input.empty?\n\n ext = 'md'\n printf \"\\e[1;37mChoose build notes file extension \\e[0;32m[md]\\e[1;37m: \\e[0m\"\n input = gets.chomp\n ext = input unless input.empty?\n\n note = <<~EOBUILDNOTES\n # #{title}\n\n #{summary}\n\n ## File Structure\n\n Where are the main editable files? Is there a dist/build folder that should be ignored?\n\n ## Build\n\n What build system/parameters does this use?\n\n @run(./build command)\n\n ## Deploy\n\n What are the procedures/commands to deploy this project?\n\n ## Other\n\n Version control notes, additional gulp/rake/make/etc tasks...\n\n EOBUILDNOTES\n\n note_file = \"buildnotes.#{ext}\"\n\n if File.exist?(note_file)\n system 'stty cbreak'\n yn = color_single_options(%w[y N])\n file = \"\\e[1;33m#{filename}\"\n $stdout.syswrite \"\\e[1;37mAre you absolutely sure you want to overwrite #{file} #{yn}\\e[1;37m? \\e[0m\"\n res = $stdin.sysread 1\n res.chomp!\n puts\n system 'stty cooked'\n\n unless res =~ /y/i\n puts 'Canceled'\n Process.exit 0\n end\n end\n\n File.open(note_file, 'w') do |f|\n f.puts note\n puts \"Build notes for #{title} written to #{note_file}\"\n end\n end",
"def create\n @note = Note.new(note_params)\n @note.user_id = current_user.id\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_url, notice: 'Note was successfully created.' }\n format.json { render action: 'index', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_note\n set_cookie_defaults unless cookies[:demo_note].present?\n params[:note] ||= JSON.parse(cookies[:demo_note])\n title = params[:note].try(:[], \"title\") ? html_clean(params[:note][:title]) : t(\"note.sample.title\")\n content = params[:note].try(:[], \"content\") ? html_clean(params[:note][:content]) : t(\"note.sample.content\")\n\n @note = Note.new(title: title, content: content)\n unless @note.has_minimum_number_of_concepts?\n @note.content = t(\"note.sample.content\")\n flash[:not_enough_pairs] = true\n end\n @note.prepare_inputs\n cookies.permanent[:demo_note] = @note.attributes.slice(\"title\", \"content\").to_json\n end",
"def create\n @treatment_note = @treatment.treatment_notes.new(treatment_note_params)\n\n respond_to do |format|\n if @treatment_note.save\n format.html { redirect_to @treatment_note, notice: 'Treatment note was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json { render json: @treatment_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t# Initialize the case note form\n\t\t@case_note = CaseNote.new\n\tend",
"def create\n patient = params[\"patient_note\"].delete(\"patient_id\")\n @patient_note = PatientNote.new(params[:patient_note])\n @patient_note.patient = Patient.find(patient)\n\n respond_to do |format|\n if @patient_note.save\n flash[:notice] = 'PatientNote was successfully created.'\n APP_LOGGER_LOG.info \"NOTE CREATED - for PATIENT ID \" + \n @patient_note.patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\n format.html { redirect_to(@patient_note) }\n format.xml { render :xml => @patient_note, :status => :created, :location => @patient_note }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patient_note.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7684043",
"0.76476824",
"0.7362498",
"0.7289316",
"0.72378147",
"0.719076",
"0.7185615",
"0.7063412",
"0.70445293",
"0.69815344",
"0.6976221",
"0.6890795",
"0.68620527",
"0.6837602",
"0.68306583",
"0.6799151",
"0.6760587",
"0.67371833",
"0.6716095",
"0.6699597",
"0.66839373",
"0.6673238",
"0.6667925",
"0.6644144",
"0.66382945",
"0.6631517",
"0.66311175",
"0.66269964",
"0.6624282",
"0.66151905",
"0.6602609",
"0.6595885",
"0.65776795",
"0.656822",
"0.6561589",
"0.6546251",
"0.654569",
"0.65417725",
"0.6537301",
"0.65331",
"0.65331",
"0.65307003",
"0.6528908",
"0.652681",
"0.65187556",
"0.65133125",
"0.6500011",
"0.6434561",
"0.6421225",
"0.64153737",
"0.64112824",
"0.6410505",
"0.63771594",
"0.6373259",
"0.636926",
"0.63643116",
"0.63634855",
"0.6363427",
"0.6357408",
"0.63464075",
"0.633167",
"0.63275313",
"0.6327499",
"0.631708",
"0.6311808",
"0.630439",
"0.6303177",
"0.6302515",
"0.62975013",
"0.62956405",
"0.62830794",
"0.62726825",
"0.6258592",
"0.6255058",
"0.6242952",
"0.6236896",
"0.62361354",
"0.62290514",
"0.622748",
"0.62200123",
"0.62030774",
"0.61878353",
"0.61837596",
"0.61715573",
"0.6170051",
"0.6167293",
"0.6165705",
"0.6145013",
"0.6142502",
"0.6136449",
"0.6135708",
"0.61295193",
"0.6122634",
"0.61172765",
"0.61140287",
"0.61121905",
"0.61050653",
"0.609773",
"0.6094636",
"0.60915005",
"0.6089481"
] |
0.0
|
-1
|
Wait for a note to exist
|
def wait_for_by_notebook(notebook, iterations = Evertils::Base::MAX_SEARCH_SIZE)
Notify.info("Waiting for #{notebook}...")
note = find_note_by_notebook(notebook)
begin
# didn't find it the first time? wait and try again
if note.entity.nil?
(1..iterations).each do |iter|
Notify.info(" (#{iter}) Looking for #{notebook.downcase}")
note = find_note_by_notebook(notebook, true)
break unless note.entity.nil? || iter == Evertils::Base::MAX_SEARCH_SIZE
end
end
rescue Interrupt
Notify.error('Cancelled wait')
end
note
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_or_create_note(opts)\n\t\treport_note(opts.merge({:wait => true}))\n\tend",
"def enter_note(test_data)\n hide_notifications_bar\n wait_for_element_and_type(note_text_area, test_data[UseOfCollections::NOTE.name])\n end",
"def wait\n\t\t\t\t@notification.wait\n\t\t\tend",
"def wait_for_by_title(title, notebook, iterations = Evertils::Base::MAX_SEARCH_SIZE)\n Notify.info(\"Waiting for #{title}...\")\n note = find_note_by_title(title)\n\n begin\n # didn't find it the first time? wait and try again\n if note.entity.nil?\n (1..iterations).each do |iter|\n Notify.info(\" (#{iter}) Looking for #{notebook.downcase}\")\n note = find_note_by_title(notebook, true)\n break unless note.entity.nil? || iter == Evertils::Base::MAX_SEARCH_SIZE\n end\n end\n rescue Interrupt\n Notify.error('Cancelled wait')\n end\n\n note\n end",
"def test05_post_closed_news_NoNoteRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepost \"\" #No note\n \t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"def click_create_new_note\n logger.debug 'Clicking the New Note button'\n wait_for_update_and_click new_note_button_element\n end",
"def enter_note(test_data)\n hide_notifications_bar\n logger.info \"Entering note '#{test_data[CoreUseOfCollectionsData::NOTE.name]}'\"\n wait_for_element_and_type(note_text_area, test_data[CoreUseOfCollectionsData::NOTE.name])\n end",
"def wait\n @notifier.wait if @notifier\n end",
"def wait\n @notifier.wait if @notifier\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end",
"def enter_new_note_subject(note)\n logger.debug \"Entering new note subject '#{note.subject}'\"\n wait_for_element_and_type(new_note_subject_input_element, note.subject)\n end",
"def set_new_note_id(note)\n new_note_subject_input_element.when_not_visible Utils.short_wait\n id = ''\n start_time = Time.now\n wait_until(10) { (id = BOACUtils.get_note_id_by_subject note) }\n logger.debug \"Note ID is #{id}\"\n logger.warn \"Note was created in #{Time.now - start_time} seconds\"\n note.created_date = note.updated_date = Time.now\n id\n rescue\n logger.debug 'Timed out waiting for note ID'\n fail\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable log\n end",
"def wait\n true\n end",
"def find_note_by_title(title, sleep = false)\n sleep(5) if sleep\n @model.find_note_contents(title)\n end",
"def wait\r\n Ragweed::Wrap32::wait_for_single_object @h\r\n end",
"def click_save_new_note\n logger.debug 'Clicking the new note Save button'\n wait_for_update_and_click new_note_save_button_element\n end",
"def wait_for_message\n message = gets.strip\n publish_message(@current_user, message)\n wait_for_message\n end",
"def test03_post_open_news_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend",
"def enter_acquisition_note(data_set)\n acquis_note = data_set[CoreAcquisitionData::ACQUIS_NOTE.name]\n logger.debug \"Entering acquisition note '#{acquis_note}'\"\n wait_for_element_and_type(acquis_note_input_locator, acquis_note) if acquis_note\n end",
"def wait_until_not_full; end",
"def wait_until_open_confirmed; end",
"def show_notes\n logger.info 'Checking notes tab'\n wait_for_update_and_click notes_button_element\n wait_for_update_and_click show_hide_notes_button_element if show_hide_notes_button? && show_hide_notes_button_element.text.include?('Show')\n end",
"def test04_FlagNoteComment\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS04T04: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def verify_note(note)\n logger.debug \"Verifying visible data for note ID #{note.id}\"\n\n # Verify data visible when note is collapsed\n collapsed_note_el(note).when_present Utils.medium_wait\n collapse_note note\n visible_data = visible_collapsed_note_data note\n expected_short_updated_date = \"Last updated on #{expected_note_short_date_format note.updated_date}\"\n wait_until(1, \"Expected '#{note.subject}', got #{visible_data[:subject]}\") { visible_data[:subject] == note.subject }\n wait_until(1, \"Expected '#{expected_short_updated_date}', got #{visible_data[:date]}\") { visible_data[:date] == expected_short_updated_date }\n\n # Verify data visible when note is expanded\n expand_note note\n visible_data.merge!(visible_expanded_note_data note)\n wait_until(1, \"Expected '#{note.body}', got '#{visible_data[:body]}'\") { visible_data[:body] == \"#{note.body}\" }\n wait_until(1, 'Expected non-blank advisor name') { !visible_data[:advisor].empty? }\n wait_until(1, 'Expected non-blank advisor role') { !visible_data[:advisor_role].empty? }\n wait_until(1, \"Expected '#{note.advisor.depts}', got #{visible_data[:advisor_depts]}\") { visible_data[:advisor_depts] == note.advisor.depts }\n\n # Topics\n note_topics = (note.topics.map { |t| t.name.upcase }).sort\n wait_until(1, \"Expected '#{note_topics}', got #{visible_data[:topics]}\") { visible_data[:topics] == note_topics }\n wait_until(1, \"Expected no remove-topic buttons, got #{visible_data[:remove_topics_btns].length}\") { visible_data[:remove_topics_btns].length.zero? }\n\n # Attachments\n non_deleted_attachments = note.attachments.reject &:deleted_at\n expected_file_names = non_deleted_attachments.map &:file_name\n wait_until(1, \"Expected '#{expected_file_names.sort}', got #{visible_data[:attachments].sort}\") { visible_data[:attachments].sort == expected_file_names.sort }\n\n # Check visible timestamps within 1 minute to avoid failures caused by a 1 second diff\n expected_long_created_date = \"Created on #{expected_note_long_date_format note.created_date}\"\n wait_until(1, \"Expected '#{expected_long_created_date}', got #{visible_data[:created_date]}\") do\n Time.parse(visible_data[:created_date]) <= Time.parse(expected_long_created_date) + 60\n Time.parse(visible_data[:created_date]) >= Time.parse(expected_long_created_date) - 60\n end\n expected_long_updated_date = \"Last updated on #{expected_note_long_date_format note.updated_date}\"\n wait_until(1, \"Expected '#{expected_long_updated_date}', got #{visible_data[:updated_date]}\") do\n Time.parse(visible_data[:updated_date]) <= Time.parse(expected_long_updated_date) + 60\n Time.parse(visible_data[:updated_date]) >= Time.parse(expected_long_updated_date) - 60\n end\n end",
"def click_cancel_new_note\n wait_for_update_and_click new_note_cancel_button_element\n end",
"def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end",
"def enter_note_body(note)\n logger.debug \"Entering note body '#{note.body}'\"\n wait_for_element_and_type(note_body_text_area_elements[0], note.body)\n end",
"def wait; end",
"def wait; end",
"def wait; end",
"def wait_for_message\n listen_for_messages\n loop { publish_message(@current_user, gets.strip) }\n end",
"def wait_for_control(locator)\n control = adapter.control(locator)\n begin\n wait_until { control.exist? }\n rescue\n raise \"A control with #{locator} was not found\"\n end\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def wait_for_message\n loop do\n message = gets.strip\n publish_message(@current_user, message)\n end\n end",
"def wait_for(pattern)\n ProtonBot::EventLock.new(self, pattern)\n self\n end",
"def test01_post_open_news_NoNoteRepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"def wait_label_change (label)\n wait_for_elements_exist([\"view marked:'#{label}'\"])\n sleep 1\n end",
"def note\n DBC.require( bu?, \"Vin non bu: La note n'est pas definie\" )\n\n @note\n end",
"def test05_search_repost_note_TC_28838\n\t\trepostNotePop\n\t\tsleep 2\n\t\trepost\n\t\tsleep 2\n\t\t\n\t\t$search_text_field.when_present.set(\"Repost text\")\n\t\t$search_button.click\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Repost text\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T5: FAILED! User unable to locate repost.\"\n\t\tend\n\tend",
"def wait\n\tend",
"def test02_repostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"def notify_ready\n notify(\"READY=1\")\n end",
"def waiting; end",
"def waiting; end",
"def enter_edit_note_subject(note)\n logger.debug \"Entering edited note subject '#{note.subject}'\"\n wait_for_element_and_type(edit_note_subject_input_element, note.subject)\n end",
"def wait_for_song(song)\n retries = 0\n loop do\n LOGGER.debug \"Waiting for song to be available on server #{@id} (#{song.inspect}) #{\"(#{retries})\" if retries.positive?}\"\n return true if song.ready\n if retries > 3\n LOGGER.debug \"Song was not available after #{retries} retries on server #{@id}. (#{song.inspect})\"\n return false\n end\n respond(\"\\\"#{song.title}\\\" is not ready yet, will start playing once it is.\")\n retries += 1\n sleep(10)\n end\n end",
"def note?\n first_element_child.text =~ /\\A\\s*Note:\\s/\n end",
"def wait_until_running\n until @running\n ControllableThread.sleep POLL_INTERVAL\n check_key\n end\n end",
"def wait_for_cmd_or_ack(cmd_or_ack)\n log \"Waiting for #{cmd_or_ack}\"\n loop do\n last_line = last_chat_line\n return get_info(last_line, cmd_or_ack) if last_line.include?(cmd_or_ack)\n sleep 1\n end\n end",
"def wait_until_element_present(element)\n element.when_present.exists?\n end",
"def wait_while_present\n container.wait_while_present\n end",
"def wait\n\t\t\t\t@available.wait\n\t\t\tend",
"def wait(path, rev=current_revision, timeout=-1)\n invoke(Request.new(:path => path, :rev => rev, :verb => Request::Verb::WAIT), true, timeout)\n end",
"def wait_for_case_to_exist(title_no)\n found_count = 0\n count = 0\n\n while (found_count != 1 && count < 25) do\n puts 'waiting for case to be created'\n sleep(1)\n response = rest_get_call($CASES_URL + '/cases/property/' + title_no)\n if (!response.nil?)\n if (!JSON.parse(response.body)[0]['work_queue'].nil?)\n found_count = 1\n puts 'case assigned to ' + JSON.parse(response.body)[0]['work_queue'] + ' queue'\n end\n end\n count = count + 1\n end\n if (found_count != 1) then\n raise \"No case found for title \" + title_no\n end\n\n return response.body\n\nend",
"def wait(timeout = nil)\n @latch.wait(timeout)\n end",
"def wait_for_ready\n sleep 0.1 until ready?\n end",
"def wait(what = T.unsafe(nil)); end",
"def wait_for_reader\n @reader.wait if @reader\n end",
"def wait(timeout = 0)\n Window.wait(@title, @text, timeout)\n end",
"def test03_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS4T003: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def wait!\n wait\n raise @error if timeout?\n @messages\n end",
"def wait_for_e(xpath)\n $browser.element(:xpath => xpath).wait_until(&:present?)\nend",
"def waiting?\n entered_at.nil?\n end",
"def get_note\n note = queued_email_note\n note ? note.value.to_s : nil\n end",
"def wait_for_progress\n sleep 2\n wait_for(timeout: 60) { element_does_not_exist \"* marked:'#{loading_screen}'\" }\n end",
"def notifier\n @loop_notify.promise\n end",
"def wait_until_available\n return unless locked?\n\n @mutex.synchronize {}\n end",
"def wait_until_present(context=nil)\n adapter.window.wait_until_present context\n end",
"def delete_note(note)\n logger.info \"Deleting note '#{note.id}'\"\n expand_note note\n wait_for_update_and_click delete_note_button(note)\n wait_for_update_and_click confirm_delete_button_element\n note.deleted_date = Time.now\n end",
"def test02_CloseFlagNoteDialog\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCloseFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPST02: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def waiting?\n @status[:description] == :wait\n end",
"def trap\n\t\t\t\ttask = Task.current\n\t\t\t\ttask.annotate(\"waiting for signal #{@name}\")\n\t\t\t\t\n\t\t\t\tnotification = Notification.new\n\t\t\t\t@notifications << notification\n\t\t\t\t\n\t\t\t\twhile true\n\t\t\t\t\tnotification.wait\n\t\t\t\t\tyield\n\t\t\t\tend\n\t\t\tensure\n\t\t\t\tif notification\n\t\t\t\t\tnotification.close\n\t\t\t\t\t@notifications.delete(notification)\n\t\t\t\tend\n\t\t\tend",
"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",
"def wait_for_answer(opts = {})\n receive_trying({optional: true}.merge opts)\n receive_ringing({optional: true}.merge opts)\n receive_progress({optional: true}.merge opts)\n receive_answer opts\n end",
"def wait\n byte = @receiver.read(1)\n raise DeadWakerError, \"can't wait on a dead waker\" unless byte == PAYLOAD\n rescue IOError, RuntimeError\n raise DeadWakerError, \"can't wait on a dead waker\"\n end",
"def wait_for_element(element)\n self.send(element).wait_until_present(@ole.explicit_wait)\n end",
"def exists?\n !!async\n end",
"def wait\n 0\n end",
"def wait(arg0)\n end",
"def wait_for_task(recipe, task, timeout=600, interval=5)\n desired_summary = \"completed: #{recipe}\"\n last_state = nil\n i = 0\n while i <= timeout do\n summary = task.show.summary\n return true if summary == desired_summary\n \n # print in the output if task changed state, and reset timeout\n if summary != last_state\n last_state = summary\n i = 0\n msg = \"Task is now #{summary}, waiting for #{desired_summary}\"\n write_output \"#{msg}\\n\"\n Maestro.log.info msg\n else\n Maestro.log.debug \"Server state is #{summary}, waiting for #{desired_summary} (#{i}/#{timeout})\"\n end\n \n sleep interval\n i += interval\n end\n \n msg = \"Timed out after #{timeout}s waiting for receipe #{recipe} to complete, is currently #{task.show.summary}\"\n Maestro.log.info msg\n set_error msg\n end",
"def wait_readable_or_timeout; end",
"def wait\n loop do sleep 1 end\n end",
"def is_new_and_others_wait? waiter\n waiter.nil? && !@awaiting.empty?\n end",
"def exist?()\n return File.exist?(@r_note_filepath)\n end",
"def test05_post_open_news_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\tassert $comment_flag_success.exists?\n\tend",
"def test_create_issue_bug\n register_user\n create_project\n create_project_version\n issue_type_bug\n create_issue\n\n @wait.until {@driver.find_element(:css => '.subject h3').displayed?}\n expected_issue_subj = @issue_subj\n actual_issue_subj = @driver.find_element(:css => '.subject h3').text\n assert_equal(expected_issue_subj,actual_issue_subj)\n end",
"def wait\n sleep 0.0001\n end",
"def wait_until_available\n return unless @locked\n\n @mutex.lock\n @mutex.unlock\n end",
"def wait_for(pid)\n raise \"Already running #{@pid} (can't wait for #{pid})\" if @pid\n\n @self_started = false\n @pids << pid\n @pid = pid\n end",
"def find_note_by_notebook(notebook, sleep = false)\n sleep(5) if sleep\n title = Formatting.date_templates[notebook]\n\n @model.find_note_contents(title)\n end",
"def test03_CancelFlagNoteComment_TC_24319\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T03: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def notification_confirm\n wait = Selenium::WebDriver::Wait.new(timeout: 5)\n wait.until {\n @driver.find_element(id: 'flash-messages').displayed?\n }\nend",
"def wait_for_element(element, timeout)\n element.when_present timeout\n element.when_visible timeout\n sleep Utils.click_wait\n end",
"def wait_for_runner_to_begin\n assert_file_exists @runner_began_flag\n end",
"def test03_R1_post_note_TC_24423\n\t\t@msg = \"It's nice to see small businesses in #{$local_patch} #{random}\"\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory_listing)\n\t\twait_for_ajax\n\t\tsleep 4\n\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n\t\tsleep 3\n\t\t$business_review_note_button.click\n\t\tsleep 2\n\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t$business_review_text.set(@msg)\n\n\t\tsleep 2\n\t\t$business_review_post.fire_event(\"onclick\")\n\n\t\tsleep 5\n\t\tassert $browser.text.include? \"#{@msg}\"\n\tend",
"def wait(timeout = nil)\n\t\t\tbegin\n\t\t\t\t@queue.wait(timeout)\n\t\t\trescue DRb::DRbConnError\n\t\t\tend\n\t\tend",
"def check_for_new_specification\n\n stored_task = EcoTask.find(self.id) if self.id\n changed = self != stored_task if stored_task\n\n if self.specification_identified?\n \n if self.id\n # Set the creation time if a new document link as provided\n if (!self.document_link.blank? &&\n (self.document_link != stored_task.document_link) ||\n self.started_at == nil )\n self.started_at = Time.now\n end\n else\n self.started_at = Time.now\n end\n end\n\n if stored_task \n if !stored_task.completed? && self.completed?\n self.completed_at = Time.now\n state_change = 'Task Completed'\n elsif !stored_task.closed? && self.closed?\n self.closed_at = Time.now\n state_change = 'Task Closed'\n elsif stored_task.closed? && !self.closed?\n state_change = 'Task Reopened'\n elsif stored_task.completed? && !self.completed?\n state_change = 'Task Incomplete - Needs more work/input'\n end\n if state_change\n self.eco_comments << EcoComment.new( :user_id => self.get_user.id, \n :comment => 'STATUS CHANGE: ' + state_change)\n end\n end\n \n end",
"def find_note\n\t\t@note = Note.find(params[:id])\n\tend",
"def wait\n if args.length != 1\n error \"Kafka name required\"\n end\n name, urls = attachment(args)\n wait_for(urls, name, 3)\n end"
] |
[
"0.6897465",
"0.64621437",
"0.6391215",
"0.62678283",
"0.608166",
"0.6063302",
"0.60514474",
"0.60508984",
"0.60508984",
"0.5917154",
"0.5888937",
"0.58729476",
"0.5825342",
"0.5736597",
"0.5735241",
"0.5720531",
"0.56681895",
"0.56428283",
"0.5633738",
"0.5621295",
"0.56101024",
"0.5588819",
"0.558865",
"0.55802923",
"0.557508",
"0.55625653",
"0.55571604",
"0.55442",
"0.5525917",
"0.5525917",
"0.5525917",
"0.5520798",
"0.5520243",
"0.55141133",
"0.55137587",
"0.5473497",
"0.5470569",
"0.5416489",
"0.54139453",
"0.5381847",
"0.53744936",
"0.5364436",
"0.5356499",
"0.5351701",
"0.5351701",
"0.53360164",
"0.53341454",
"0.53123015",
"0.52978355",
"0.5291621",
"0.52878153",
"0.52839285",
"0.5283635",
"0.5272345",
"0.5271935",
"0.5267507",
"0.5266415",
"0.52653265",
"0.5239831",
"0.5227486",
"0.52106875",
"0.52012885",
"0.51901734",
"0.5188236",
"0.5183686",
"0.51822597",
"0.51821893",
"0.51802564",
"0.517178",
"0.51644266",
"0.5163021",
"0.5162185",
"0.5145762",
"0.5143164",
"0.513242",
"0.5132084",
"0.5127604",
"0.51218545",
"0.51132697",
"0.51062256",
"0.5104105",
"0.51022804",
"0.50961107",
"0.5094408",
"0.5086625",
"0.5082861",
"0.50799453",
"0.50769377",
"0.5069607",
"0.5066005",
"0.5065318",
"0.506137",
"0.505591",
"0.5050794",
"0.5048179",
"0.5047152",
"0.5046495",
"0.50461423",
"0.5045789",
"0.50387245"
] |
0.57018757
|
16
|
Wait for a note to exist
|
def wait_for_by_title(title, notebook, iterations = Evertils::Base::MAX_SEARCH_SIZE)
Notify.info("Waiting for #{title}...")
note = find_note_by_title(title)
begin
# didn't find it the first time? wait and try again
if note.entity.nil?
(1..iterations).each do |iter|
Notify.info(" (#{iter}) Looking for #{notebook.downcase}")
note = find_note_by_title(notebook, true)
break unless note.entity.nil? || iter == Evertils::Base::MAX_SEARCH_SIZE
end
end
rescue Interrupt
Notify.error('Cancelled wait')
end
note
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_or_create_note(opts)\n\t\treport_note(opts.merge({:wait => true}))\n\tend",
"def enter_note(test_data)\n hide_notifications_bar\n wait_for_element_and_type(note_text_area, test_data[UseOfCollections::NOTE.name])\n end",
"def wait\n\t\t\t\t@notification.wait\n\t\t\tend",
"def test05_post_closed_news_NoNoteRepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepost \"\" #No note\n \t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"def click_create_new_note\n logger.debug 'Clicking the New Note button'\n wait_for_update_and_click new_note_button_element\n end",
"def enter_note(test_data)\n hide_notifications_bar\n logger.info \"Entering note '#{test_data[CoreUseOfCollectionsData::NOTE.name]}'\"\n wait_for_element_and_type(note_text_area, test_data[CoreUseOfCollectionsData::NOTE.name])\n end",
"def wait\n @notifier.wait if @notifier\n end",
"def wait\n @notifier.wait if @notifier\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end",
"def enter_new_note_subject(note)\n logger.debug \"Entering new note subject '#{note.subject}'\"\n wait_for_element_and_type(new_note_subject_input_element, note.subject)\n end",
"def set_new_note_id(note)\n new_note_subject_input_element.when_not_visible Utils.short_wait\n id = ''\n start_time = Time.now\n wait_until(10) { (id = BOACUtils.get_note_id_by_subject note) }\n logger.debug \"Note ID is #{id}\"\n logger.warn \"Note was created in #{Time.now - start_time} seconds\"\n note.created_date = note.updated_date = Time.now\n id\n rescue\n logger.debug 'Timed out waiting for note ID'\n fail\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable log\n end",
"def wait\n true\n end",
"def find_note_by_title(title, sleep = false)\n sleep(5) if sleep\n @model.find_note_contents(title)\n end",
"def wait\r\n Ragweed::Wrap32::wait_for_single_object @h\r\n end",
"def wait_for_by_notebook(notebook, iterations = Evertils::Base::MAX_SEARCH_SIZE)\n Notify.info(\"Waiting for #{notebook}...\")\n note = find_note_by_notebook(notebook)\n\n begin\n # didn't find it the first time? wait and try again\n if note.entity.nil?\n (1..iterations).each do |iter|\n Notify.info(\" (#{iter}) Looking for #{notebook.downcase}\")\n note = find_note_by_notebook(notebook, true)\n break unless note.entity.nil? || iter == Evertils::Base::MAX_SEARCH_SIZE\n end\n end\n rescue Interrupt\n Notify.error('Cancelled wait')\n end\n\n note\n end",
"def click_save_new_note\n logger.debug 'Clicking the new note Save button'\n wait_for_update_and_click new_note_save_button_element\n end",
"def wait_for_message\n message = gets.strip\n publish_message(@current_user, message)\n wait_for_message\n end",
"def test03_post_open_news_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\n\t\tassert $repost_confirmation.exists?\n\tend",
"def enter_acquisition_note(data_set)\n acquis_note = data_set[CoreAcquisitionData::ACQUIS_NOTE.name]\n logger.debug \"Entering acquisition note '#{acquis_note}'\"\n wait_for_element_and_type(acquis_note_input_locator, acquis_note) if acquis_note\n end",
"def wait_until_not_full; end",
"def wait_until_open_confirmed; end",
"def show_notes\n logger.info 'Checking notes tab'\n wait_for_update_and_click notes_button_element\n wait_for_update_and_click show_hide_notes_button_element if show_hide_notes_button? && show_hide_notes_button_element.text.include?('Show')\n end",
"def test04_FlagNoteComment\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_success.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS04T04: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def verify_note(note)\n logger.debug \"Verifying visible data for note ID #{note.id}\"\n\n # Verify data visible when note is collapsed\n collapsed_note_el(note).when_present Utils.medium_wait\n collapse_note note\n visible_data = visible_collapsed_note_data note\n expected_short_updated_date = \"Last updated on #{expected_note_short_date_format note.updated_date}\"\n wait_until(1, \"Expected '#{note.subject}', got #{visible_data[:subject]}\") { visible_data[:subject] == note.subject }\n wait_until(1, \"Expected '#{expected_short_updated_date}', got #{visible_data[:date]}\") { visible_data[:date] == expected_short_updated_date }\n\n # Verify data visible when note is expanded\n expand_note note\n visible_data.merge!(visible_expanded_note_data note)\n wait_until(1, \"Expected '#{note.body}', got '#{visible_data[:body]}'\") { visible_data[:body] == \"#{note.body}\" }\n wait_until(1, 'Expected non-blank advisor name') { !visible_data[:advisor].empty? }\n wait_until(1, 'Expected non-blank advisor role') { !visible_data[:advisor_role].empty? }\n wait_until(1, \"Expected '#{note.advisor.depts}', got #{visible_data[:advisor_depts]}\") { visible_data[:advisor_depts] == note.advisor.depts }\n\n # Topics\n note_topics = (note.topics.map { |t| t.name.upcase }).sort\n wait_until(1, \"Expected '#{note_topics}', got #{visible_data[:topics]}\") { visible_data[:topics] == note_topics }\n wait_until(1, \"Expected no remove-topic buttons, got #{visible_data[:remove_topics_btns].length}\") { visible_data[:remove_topics_btns].length.zero? }\n\n # Attachments\n non_deleted_attachments = note.attachments.reject &:deleted_at\n expected_file_names = non_deleted_attachments.map &:file_name\n wait_until(1, \"Expected '#{expected_file_names.sort}', got #{visible_data[:attachments].sort}\") { visible_data[:attachments].sort == expected_file_names.sort }\n\n # Check visible timestamps within 1 minute to avoid failures caused by a 1 second diff\n expected_long_created_date = \"Created on #{expected_note_long_date_format note.created_date}\"\n wait_until(1, \"Expected '#{expected_long_created_date}', got #{visible_data[:created_date]}\") do\n Time.parse(visible_data[:created_date]) <= Time.parse(expected_long_created_date) + 60\n Time.parse(visible_data[:created_date]) >= Time.parse(expected_long_created_date) - 60\n end\n expected_long_updated_date = \"Last updated on #{expected_note_long_date_format note.updated_date}\"\n wait_until(1, \"Expected '#{expected_long_updated_date}', got #{visible_data[:updated_date]}\") do\n Time.parse(visible_data[:updated_date]) <= Time.parse(expected_long_updated_date) + 60\n Time.parse(visible_data[:updated_date]) >= Time.parse(expected_long_updated_date) - 60\n end\n end",
"def click_cancel_new_note\n wait_for_update_and_click new_note_cancel_button_element\n end",
"def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end",
"def enter_note_body(note)\n logger.debug \"Entering note body '#{note.body}'\"\n wait_for_element_and_type(note_body_text_area_elements[0], note.body)\n end",
"def wait; end",
"def wait; end",
"def wait; end",
"def wait_for_message\n listen_for_messages\n loop { publish_message(@current_user, gets.strip) }\n end",
"def wait_for_control(locator)\n control = adapter.control(locator)\n begin\n wait_until { control.exist? }\n rescue\n raise \"A control with #{locator} was not found\"\n end\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def wait_for_message\n loop do\n message = gets.strip\n publish_message(@current_user, message)\n end\n end",
"def wait_for(pattern)\n ProtonBot::EventLock.new(self, pattern)\n self\n end",
"def test01_post_open_news_NoNoteRepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"def wait_label_change (label)\n wait_for_elements_exist([\"view marked:'#{label}'\"])\n sleep 1\n end",
"def note\n DBC.require( bu?, \"Vin non bu: La note n'est pas definie\" )\n\n @note\n end",
"def test05_search_repost_note_TC_28838\n\t\trepostNotePop\n\t\tsleep 2\n\t\trepost\n\t\tsleep 2\n\t\t\n\t\t$search_text_field.when_present.set(\"Repost text\")\n\t\t$search_button.click\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Repost text\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T5: FAILED! User unable to locate repost.\"\n\t\tend\n\tend",
"def wait\n\tend",
"def test02_repostEvent\n\t\trepostEventPop\n\t\tsleep 3\n\t\trepost \"\" #No note\n\t\tsleep 3\n\t\t\n\t\tassert $repost_confirmation.exists?\n\tend",
"def notify_ready\n notify(\"READY=1\")\n end",
"def waiting; end",
"def waiting; end",
"def enter_edit_note_subject(note)\n logger.debug \"Entering edited note subject '#{note.subject}'\"\n wait_for_element_and_type(edit_note_subject_input_element, note.subject)\n end",
"def wait_for_song(song)\n retries = 0\n loop do\n LOGGER.debug \"Waiting for song to be available on server #{@id} (#{song.inspect}) #{\"(#{retries})\" if retries.positive?}\"\n return true if song.ready\n if retries > 3\n LOGGER.debug \"Song was not available after #{retries} retries on server #{@id}. (#{song.inspect})\"\n return false\n end\n respond(\"\\\"#{song.title}\\\" is not ready yet, will start playing once it is.\")\n retries += 1\n sleep(10)\n end\n end",
"def note?\n first_element_child.text =~ /\\A\\s*Note:\\s/\n end",
"def wait_until_running\n until @running\n ControllableThread.sleep POLL_INTERVAL\n check_key\n end\n end",
"def wait_for_cmd_or_ack(cmd_or_ack)\n log \"Waiting for #{cmd_or_ack}\"\n loop do\n last_line = last_chat_line\n return get_info(last_line, cmd_or_ack) if last_line.include?(cmd_or_ack)\n sleep 1\n end\n end",
"def wait_until_element_present(element)\n element.when_present.exists?\n end",
"def wait_while_present\n container.wait_while_present\n end",
"def wait\n\t\t\t\t@available.wait\n\t\t\tend",
"def wait(path, rev=current_revision, timeout=-1)\n invoke(Request.new(:path => path, :rev => rev, :verb => Request::Verb::WAIT), true, timeout)\n end",
"def wait_for_case_to_exist(title_no)\n found_count = 0\n count = 0\n\n while (found_count != 1 && count < 25) do\n puts 'waiting for case to be created'\n sleep(1)\n response = rest_get_call($CASES_URL + '/cases/property/' + title_no)\n if (!response.nil?)\n if (!JSON.parse(response.body)[0]['work_queue'].nil?)\n found_count = 1\n puts 'case assigned to ' + JSON.parse(response.body)[0]['work_queue'] + ' queue'\n end\n end\n count = count + 1\n end\n if (found_count != 1) then\n raise \"No case found for title \" + title_no\n end\n\n return response.body\n\nend",
"def wait(timeout = nil)\n @latch.wait(timeout)\n end",
"def wait_for_ready\n sleep 0.1 until ready?\n end",
"def wait(what = T.unsafe(nil)); end",
"def wait_for_reader\n @reader.wait if @reader\n end",
"def wait(timeout = 0)\n Window.wait(@title, @text, timeout)\n end",
"def test03_250RepostNote\n\t\trepostNotePop\n\t\tsleep 3\n \t\trepostPopulate250\n \t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS4T003: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def wait!\n wait\n raise @error if timeout?\n @messages\n end",
"def wait_for_e(xpath)\n $browser.element(:xpath => xpath).wait_until(&:present?)\nend",
"def waiting?\n entered_at.nil?\n end",
"def get_note\n note = queued_email_note\n note ? note.value.to_s : nil\n end",
"def wait_for_progress\n sleep 2\n wait_for(timeout: 60) { element_does_not_exist \"* marked:'#{loading_screen}'\" }\n end",
"def notifier\n @loop_notify.promise\n end",
"def wait_until_available\n return unless locked?\n\n @mutex.synchronize {}\n end",
"def wait_until_present(context=nil)\n adapter.window.wait_until_present context\n end",
"def delete_note(note)\n logger.info \"Deleting note '#{note.id}'\"\n expand_note note\n wait_for_update_and_click delete_note_button(note)\n wait_for_update_and_click confirm_delete_button_element\n note.deleted_date = Time.now\n end",
"def test02_CloseFlagNoteDialog\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCloseFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPST02: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def waiting?\n @status[:description] == :wait\n end",
"def trap\n\t\t\t\ttask = Task.current\n\t\t\t\ttask.annotate(\"waiting for signal #{@name}\")\n\t\t\t\t\n\t\t\t\tnotification = Notification.new\n\t\t\t\t@notifications << notification\n\t\t\t\t\n\t\t\t\twhile true\n\t\t\t\t\tnotification.wait\n\t\t\t\t\tyield\n\t\t\t\tend\n\t\t\tensure\n\t\t\t\tif notification\n\t\t\t\t\tnotification.close\n\t\t\t\t\t@notifications.delete(notification)\n\t\t\t\tend\n\t\t\tend",
"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",
"def wait_for_answer(opts = {})\n receive_trying({optional: true}.merge opts)\n receive_ringing({optional: true}.merge opts)\n receive_progress({optional: true}.merge opts)\n receive_answer opts\n end",
"def wait\n byte = @receiver.read(1)\n raise DeadWakerError, \"can't wait on a dead waker\" unless byte == PAYLOAD\n rescue IOError, RuntimeError\n raise DeadWakerError, \"can't wait on a dead waker\"\n end",
"def wait_for_element(element)\n self.send(element).wait_until_present(@ole.explicit_wait)\n end",
"def exists?\n !!async\n end",
"def wait\n 0\n end",
"def wait(arg0)\n end",
"def wait_for_task(recipe, task, timeout=600, interval=5)\n desired_summary = \"completed: #{recipe}\"\n last_state = nil\n i = 0\n while i <= timeout do\n summary = task.show.summary\n return true if summary == desired_summary\n \n # print in the output if task changed state, and reset timeout\n if summary != last_state\n last_state = summary\n i = 0\n msg = \"Task is now #{summary}, waiting for #{desired_summary}\"\n write_output \"#{msg}\\n\"\n Maestro.log.info msg\n else\n Maestro.log.debug \"Server state is #{summary}, waiting for #{desired_summary} (#{i}/#{timeout})\"\n end\n \n sleep interval\n i += interval\n end\n \n msg = \"Timed out after #{timeout}s waiting for receipe #{recipe} to complete, is currently #{task.show.summary}\"\n Maestro.log.info msg\n set_error msg\n end",
"def wait_readable_or_timeout; end",
"def wait\n loop do sleep 1 end\n end",
"def is_new_and_others_wait? waiter\n waiter.nil? && !@awaiting.empty?\n end",
"def exist?()\n return File.exist?(@r_note_filepath)\n end",
"def test05_post_open_news_FlagNoteComment\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_note)\n\t\tsleep 2\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\t\tsleep 2\n\t\tcommentFlag\n\t\tsleep 1\n\t\tassert $comment_flag_success.exists?\n\tend",
"def test_create_issue_bug\n register_user\n create_project\n create_project_version\n issue_type_bug\n create_issue\n\n @wait.until {@driver.find_element(:css => '.subject h3').displayed?}\n expected_issue_subj = @issue_subj\n actual_issue_subj = @driver.find_element(:css => '.subject h3').text\n assert_equal(expected_issue_subj,actual_issue_subj)\n end",
"def wait\n sleep 0.0001\n end",
"def wait_until_available\n return unless @locked\n\n @mutex.lock\n @mutex.unlock\n end",
"def wait_for(pid)\n raise \"Already running #{@pid} (can't wait for #{pid})\" if @pid\n\n @self_started = false\n @pids << pid\n @pid = pid\n end",
"def find_note_by_notebook(notebook, sleep = false)\n sleep(5) if sleep\n title = Formatting.date_templates[notebook]\n\n @model.find_note_contents(title)\n end",
"def test03_CancelFlagNoteComment_TC_24319\n\t\tcommentNotePop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T03: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def notification_confirm\n wait = Selenium::WebDriver::Wait.new(timeout: 5)\n wait.until {\n @driver.find_element(id: 'flash-messages').displayed?\n }\nend",
"def wait_for_element(element, timeout)\n element.when_present timeout\n element.when_visible timeout\n sleep Utils.click_wait\n end",
"def wait_for_runner_to_begin\n assert_file_exists @runner_began_flag\n end",
"def test03_R1_post_note_TC_24423\n\t\t@msg = \"It's nice to see small businesses in #{$local_patch} #{random}\"\n\t\t$browser.goto($patch_login)\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_directory_listing)\n\t\twait_for_ajax\n\t\tsleep 4\n\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n\t\tsleep 3\n\t\t$business_review_note_button.click\n\t\tsleep 2\n\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t$business_review_text.set(@msg)\n\n\t\tsleep 2\n\t\t$business_review_post.fire_event(\"onclick\")\n\n\t\tsleep 5\n\t\tassert $browser.text.include? \"#{@msg}\"\n\tend",
"def wait(timeout = nil)\n\t\t\tbegin\n\t\t\t\t@queue.wait(timeout)\n\t\t\trescue DRb::DRbConnError\n\t\t\tend\n\t\tend",
"def check_for_new_specification\n\n stored_task = EcoTask.find(self.id) if self.id\n changed = self != stored_task if stored_task\n\n if self.specification_identified?\n \n if self.id\n # Set the creation time if a new document link as provided\n if (!self.document_link.blank? &&\n (self.document_link != stored_task.document_link) ||\n self.started_at == nil )\n self.started_at = Time.now\n end\n else\n self.started_at = Time.now\n end\n end\n\n if stored_task \n if !stored_task.completed? && self.completed?\n self.completed_at = Time.now\n state_change = 'Task Completed'\n elsif !stored_task.closed? && self.closed?\n self.closed_at = Time.now\n state_change = 'Task Closed'\n elsif stored_task.closed? && !self.closed?\n state_change = 'Task Reopened'\n elsif stored_task.completed? && !self.completed?\n state_change = 'Task Incomplete - Needs more work/input'\n end\n if state_change\n self.eco_comments << EcoComment.new( :user_id => self.get_user.id, \n :comment => 'STATUS CHANGE: ' + state_change)\n end\n end\n \n end",
"def find_note\n\t\t@note = Note.find(params[:id])\n\tend",
"def wait\n if args.length != 1\n error \"Kafka name required\"\n end\n name, urls = attachment(args)\n wait_for(urls, name, 3)\n end"
] |
[
"0.6897465",
"0.64621437",
"0.6391215",
"0.608166",
"0.6063302",
"0.60514474",
"0.60508984",
"0.60508984",
"0.5917154",
"0.5888937",
"0.58729476",
"0.5825342",
"0.5736597",
"0.5735241",
"0.5720531",
"0.57018757",
"0.56681895",
"0.56428283",
"0.5633738",
"0.5621295",
"0.56101024",
"0.5588819",
"0.558865",
"0.55802923",
"0.557508",
"0.55625653",
"0.55571604",
"0.55442",
"0.5525917",
"0.5525917",
"0.5525917",
"0.5520798",
"0.5520243",
"0.55141133",
"0.55137587",
"0.5473497",
"0.5470569",
"0.5416489",
"0.54139453",
"0.5381847",
"0.53744936",
"0.5364436",
"0.5356499",
"0.5351701",
"0.5351701",
"0.53360164",
"0.53341454",
"0.53123015",
"0.52978355",
"0.5291621",
"0.52878153",
"0.52839285",
"0.5283635",
"0.5272345",
"0.5271935",
"0.5267507",
"0.5266415",
"0.52653265",
"0.5239831",
"0.5227486",
"0.52106875",
"0.52012885",
"0.51901734",
"0.5188236",
"0.5183686",
"0.51822597",
"0.51821893",
"0.51802564",
"0.517178",
"0.51644266",
"0.5163021",
"0.5162185",
"0.5145762",
"0.5143164",
"0.513242",
"0.5132084",
"0.5127604",
"0.51218545",
"0.51132697",
"0.51062256",
"0.5104105",
"0.51022804",
"0.50961107",
"0.5094408",
"0.5086625",
"0.5082861",
"0.50799453",
"0.50769377",
"0.5069607",
"0.5066005",
"0.5065318",
"0.506137",
"0.505591",
"0.5050794",
"0.5048179",
"0.5047152",
"0.5046495",
"0.50461423",
"0.5045789",
"0.50387245"
] |
0.62678283
|
3
|
Find a note by note
|
def find_note_by_title(title, sleep = false)
sleep(5) if sleep
@model.find_note_contents(title)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def search_note(string)\n logger.info 'Searching for a string within a note'\n search string\n end",
"def find_note\n\t\t@note = Note.find(params[:id])\n\tend",
"def get_note(obj, id)\n obj['notes'].find {|n| n['persistent_id'] == id}\nend",
"def get_note(note_id)\n @notes[note_id]\n end",
"def get_note(note_id)\n @notes[note_id]\n end",
"def note\n qry = ActiveRDF::Query.new(Note).select(:note).distinct\n qry.where(:note, N::DCT.isPartOf, self)\n qry.execute\n end",
"def find_note_by_notebook(notebook, sleep = false)\n sleep(5) if sleep\n title = Formatting.date_templates[notebook]\n\n @model.find_note_contents(title)\n end",
"def find_case_note\n\t\t# Find the case notes\n\t\t@case_note = CaseNote.find(params[:id])\n\tend",
"def find_notes_for_notable(notable_str, notable_id)\n where(notable_type: notable_str, notable_id: notable_id)\n end",
"def find_by_title(todo_title)\n select { |todo| todo.title == todo_title }.first\n end",
"def note_attachment_el(note, attachment_name)\n note_attachment_els(note).find { |el| el.text.strip == attachment_name }\n end",
"def find_by_title(str)\n self.each do |todo|\n return todo if todo.title == str\n end\n nil\n # select { |todo| todo.title == str }.first # alt from solution\n end",
"def find_notes_by_user(user) \n notable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s\n \n Note.find(:all,\n :conditions => [\"user_id = ? and notable_type = ?\", user.id, notable],\n :order => \"created_at DESC\"\n )\n end",
"def search(query, notes_relation = @notes)\n pattern = \"%#{query}%\"\n notes_relation.where(Note.arel_table[:note].matches(pattern))\n end",
"def search_non_note(string)\n logger.info \"Searching for '#{string}'\"\n search string\n end",
"def set_note\n @note = Note.friendly.find(params[:id])\n\n end",
"def get\n return @note unless @note.nil?\n filter = ::Evernote::EDAM::NoteStore::NoteFilter.new\n filter.order = ::Evernote::EDAM::Type::NoteSortOrder::CREATED\n filter.notebookGuid = @notebook.guid\n filter.timeZone = \"Asia/Tokyo\"\n filter.ascending = false # descending\n note_list = @auth_store.note_store.findNotes(@auth_store.auth_token, filter, 0, 1)\n if note_list.notes.empty?\n Log4r::Logger.log_internal { \"Note not found at #{@notebook.guid}\" }\n @note = ::Evernote::EDAM::Type::Note.new\n else\n @note = note_list.notes[0]\n end\n @note\n end",
"def note note, preview=nil\n preview ||= note[0..64]\n params = {\n contact_ids: [ self.id ],\n note: note,\n note_preview: preview\n }\n @nimble.post \"contacts/notes\", params\n end",
"def note\n return @poco_data[:note] unless @poco_data == nil\n pick_first_node(@poco.xpath('./poco:note'))\n end",
"def find_case_note\n\t\t# Find the case notes\n\t\t@case_note = CaseNote.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Case Note ID !'}, status: 400 if @case_note.nil?\n\tend",
"def extract_references(hackney_note)\n WorkOrderReferenceFinder\n .new(hackney_note.work_order_reference)\n .find(hackney_note.text || \"\")\n end",
"def set_note\n #prevent from searching note from different user\n @note = current_user.notes.find(params[:id])\n end",
"def note\n DBC.require( bu?, \"Vin non bu: La note n'est pas definie\" )\n\n @note\n end",
"def find_noteable_id\n GithubImport::IssuableFinder.new(project, note).database_id\n end",
"def cmd_note(irc, line)\n u = $user.get_nick(irc) or return\n nu = IRC::Address.normalize(u)\n n = @notes[sn = irc.server.name] || (@notes[sn] = {})\n now = Time.now.to_i\n if !line or line.empty?\n if (e = n[nu]) and !e.empty?\n from, date, txt = e.shift\n n.delete(nu) if e.empty?\n irc.reply \"From #{from}, sent #{seconds_to_s(now - date, irc)} ago: #{txt}\"\n else\n irc.reply \"You have no unread notes.\"\n end\n else\n to, txt = line.split(' ', 2)\n if txt\n if (t = $user.get_data(to, sn))\n nto = IRC::Address.normalize(to)\n nl = n[nto] || (n[nto] = [])\n if (announced = $user.get_nick(to, sn))\n as = (nn = irc.from.nick) == u ? '' : \" (as #{nn.capitalize})\"\n irc.server.notice(to, \"#{u.capitalize}#{as} has sent you a note. Use 'notes' to list your unread notes.\")\n end\n nl << [u, now, txt, announced ? true : false]\n irc.reply \"Ok, note to #{to} added.\"\n else\n irc.reply \"No such user, #{to}.\"\n end\n else\n if !(e = n[nu]) or e.empty?\n irc.reply \"You have no unread notes.\"\n else\n begin\n i = Integer(to)\n if i >= 1 and i <= e.length\n from, date, txt = e[i - 1]\n irc.reply \"Note #{i} from #{from}, sent #{seconds_to_s(now - date, irc)} ago: #{txt}\"\n else\n notes = \"note#{'s' if e.length > 1}\"\n irc.reply \"Note number out of range. You have #{e.length} unread #{notes}.\"\n end\n rescue ArgumentError\n irc.reply \"USAGE: note <number>\"\n end\n end\n end\n end\n end",
"def note(note)\n\t\t@note = note\n\tend",
"def find_by_title(string)\n @todos.each do |todo|\n return todo if (todo.title =~ /#{string}/)\n end\n nil\n end",
"def set_note\n @note = Note.where(test_id: params[:test_id], student_id: params[:student_id]).first\n end",
"def resolve_note(note)\n if note.is_a?(Proc)\n note = note.call()\n end\n if note.is_a?(Symbol)\n note = Playables.runtime.note(note)\n end\n if note.nil?\n raise 'Bad Note'\n end\n note\n end",
"def note(name, note=nil)\n if note.nil?\n details(name).rule_notes\n else\n @driver.setRuleNotes([name], [note])\n end\n\n end",
"def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end",
"def find_or_create_note(opts)\n\t\treport_note(opts.merge({:wait => true}))\n\tend",
"def set_note\n @note = Note.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def set_note\n @note = Note.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def play(notes)\n\n md = /(\\w):(.+)/.match(notes)\n \n notetype = @notes[md[1]]\n d = @seq.note_to_delta(notetype)\n\n # n.b channel is inverse of string - chn 0 is str 6 \n md[2].split('|').each_with_index do |fret, channel| \n if fret.to_i.to_s == fret\n fret = fret.to_i\n oldfret = @prev[channel]\n @prev[channel] = fret \n\n if oldfret\n oldnote = @tuning[channel] + oldfret\n @track.events << MIDI::NoteOffEvent.new(channel,oldnote,0,d)\n d = 0\n end\n \n noteval = @tuning[channel] + fret\n @track.events << MIDI::NoteOnEvent.new(channel,noteval,80 + rand(38),d)\n d = 0\n end\n end\n end",
"def notes\n return Note.find(:all, :conditions => [\"type_id = ? AND owner = ?\", self.id, :property ])\n end",
"def show\n @note = Note.find(params[:id])\n end",
"def get_note(context, host, ntype, data)\n\t\trec = Note.find(:first, :conditions => [ \"host_id = ? and ntype = ? and data = ?\", host.id, ntype, data])\n\t\tif (not rec)\n\t\t\trec = Note.create(\n\t\t\t\t:host_id => host.id,\n\t\t\t\t:ntype => ntype,\n\t\t\t\t:data => data,\n\t\t\t\t:created => Time.now\n\t\t\t)\n\t\t\trec.save\n\t\t\tframework.events.on_db_note(context, rec)\n\t\tend\n\t\treturn rec\n\tend",
"def add_note(note)\n response = self.class.put(url(self.id), :query => {:notes => note}, :body => \"\") # nginx reject requests without body\n\n if response.code == 200\n return true\n else\n raise response.response\n end\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def note\n @attributes[:note]\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def notes(options = {})\n # Create a default 2 item hash and update if options is supplied\n options = {\n id: nil,\n type: nil\n }.update(options)\n return nil if @_notes.nil?\n return nil if @_notes.empty?\n\n # Empty 2-D Hash to be used for notes found based on id and type\n notes_found = Hash.new do |h, k|\n # h is the id portion of the hash\n # k is the type portion of the hash\n h[k] = {}\n end\n # Filter @notes based off of the id\n filter_hash(@_notes, options[:id]).each do |id, hash|\n # Filter hash based off of the type\n filter_hash(hash, options[:type]).each do |type, note|\n # Store the note into note_found\n notes_found[id][type] = note\n end\n end\n if notes_found.empty?\n nil\n elsif notes_found.size == 1\n notes_found.values.first.values.first\n else\n notes_found\n end\n end",
"def set_note\r\n @note = Note.find(params[:id])\r\n end",
"def specific_notes(id, accept)\n begin\n \t# Calls a certain note depending on the number \n return RestClient.get 'http://localhost:4567/notes/' + id.to_s, :accept => accept\n rescue => e\n return e.response\n end\n end",
"def topic_xpath_saved_note(note, topic)\n \"//li[contains(@id, \\\"note-#{note.id}-topic\\\")][contains(., \\\"#{topic.name}\\\")]\"\n end",
"def notes(params = {})\n @notes ||= MailchimpAPI::Note.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))\n end",
"def favorite_note?(note_id)\n !favorite_notes.where(note_id: note_id).first.nil?\n end",
"def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end",
"def note(uid, note)\n single(\"INSERT INTO notes (assumption_uid, content) VALUES ($1, $2)\", [uid, note])\nend",
"def set_note\n\t\t@note = Note.find(params[:id])\n\tend",
"def reply\n @bnote = Bnote.find(params[:id])\n end",
"def find_last_note(nb_notes)\n note = self\n (nb_notes.to_i - 1).times do\n note = note.succ\n end\n note\n end",
"def state_note(item)\n s = state_value(item) or return\n state_table.dig(s, :note)\n end",
"def note_params\n params[:note]\n end",
"def match_general(line, lineno, file)\n rec = nil\n if (md = match_general_regex(file).match(line))\n label = md[1]\n text = md[2]\n rec = Note.new(self, file, label, lineno, text, remark(file))\n end\n rec\n end",
"def find(search)\n all_contacts = ContactDatabase.read_from_file\n all_contacts.each do |contacts|\n if contacts[1] =~ /#{search}/i or contacts[2] =~ /#{search}/i\n p \" #{contacts[0]}: #{contacts[1]} (#{contacts[2]})\" \n end \n end\n end",
"def note_params\n params[:note]\n end"
] |
[
"0.7608892",
"0.7047514",
"0.7018209",
"0.6873352",
"0.6873352",
"0.67006177",
"0.6597614",
"0.6212791",
"0.6199753",
"0.6164725",
"0.6124417",
"0.6100361",
"0.6023838",
"0.60042727",
"0.5918086",
"0.59029853",
"0.5881413",
"0.5865618",
"0.5856536",
"0.5852793",
"0.5776528",
"0.5735209",
"0.5733838",
"0.5728271",
"0.57031417",
"0.57002854",
"0.5691081",
"0.5680782",
"0.5679595",
"0.56770974",
"0.5651608",
"0.56397355",
"0.5569183",
"0.5569183",
"0.55587584",
"0.5532665",
"0.55205566",
"0.54969347",
"0.5490197",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5489478",
"0.5488657",
"0.5488657",
"0.5486287",
"0.54861003",
"0.54861003",
"0.54861003",
"0.54861003",
"0.54861003",
"0.54861003",
"0.54861003",
"0.54670423",
"0.5457315",
"0.5438694",
"0.54367536",
"0.5422494",
"0.5409924",
"0.5383563",
"0.53633845",
"0.53546333",
"0.5347012",
"0.53419566",
"0.53342056",
"0.5325713",
"0.5323996",
"0.53190196",
"0.5314558"
] |
0.6114432
|
11
|
Find a note by notebook
|
def find_note_by_notebook(notebook, sleep = false)
sleep(5) if sleep
title = Formatting.date_templates[notebook]
@model.find_note_contents(title)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def notebook\n @notebook ||= note_store.listNotebooks.select{|notebook| notebook.name == notebook_name}.first\n end",
"def notebook\n @note.notebookGuid\n end",
"def search_note(string)\n logger.info 'Searching for a string within a note'\n search string\n end",
"def find_notebook\n if(params[:notebook_id])\n @notebook = current_user.notebooks.find(params[:notebook_id])\n end\n end",
"def set_notebook_note\n @notebook_note = Notebook::Note.find(params[:id])\n end",
"def find_note\n\t\t@note = Note.find(params[:id])\n\tend",
"def get_evernote_notebook_name(note_store, notebook_guid)\n notebook_name = ''\n notebooks = note_store.listNotebooks\n\n notebooks.each do |notebook|\n if notebook.guid == notebook_guid\n notebook_name = notebook.name\n end\n end\n\n return notebook_name\n end",
"def get_note(note_id)\n @notes[note_id]\n end",
"def get_note(note_id)\n @notes[note_id]\n end",
"def fetch_notebook\n evernote = EvernoteUtil.new self.notestore_url, self.token\n evernote.find_or_create_notebook('ClipX').guid\n end",
"def note(notebook)\n @note = Note.new(notebook, @@auth_store) if @note.nil?\n @note\n end",
"def notebook\n return @notebook if @notebook\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_NOTEBOOKS_ENDPOINT, params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:notebook]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @notebook = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @notebook\n end",
"def get\n return @note unless @note.nil?\n filter = ::Evernote::EDAM::NoteStore::NoteFilter.new\n filter.order = ::Evernote::EDAM::Type::NoteSortOrder::CREATED\n filter.notebookGuid = @notebook.guid\n filter.timeZone = \"Asia/Tokyo\"\n filter.ascending = false # descending\n note_list = @auth_store.note_store.findNotes(@auth_store.auth_token, filter, 0, 1)\n if note_list.notes.empty?\n Log4r::Logger.log_internal { \"Note not found at #{@notebook.guid}\" }\n @note = ::Evernote::EDAM::Type::Note.new\n else\n @note = note_list.notes[0]\n end\n @note\n end",
"def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end",
"def get_note(obj, id)\n obj['notes'].find {|n| n['persistent_id'] == id}\nend",
"def show\n if params[:tag]\n @notebook = Notebook.find(params[:notebook_id])\n @notes = @notebook.notes.tagged_with(params[:tag])\n else\n @notebook = Notebook.find(params[:id])\n @notes = @notebook.notes.all\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end",
"def find_note_by_title(title, sleep = false)\n sleep(5) if sleep\n @model.find_note_contents(title)\n end",
"def index\n @notebook_notes = Notebook::Note.all\n end",
"def note\n qry = ActiveRDF::Query.new(Note).select(:note).distinct\n qry.where(:note, N::DCT.isPartOf, self)\n qry.execute\n end",
"def extract_references(hackney_note)\n WorkOrderReferenceFinder\n .new(hackney_note.work_order_reference)\n .find(hackney_note.text || \"\")\n end",
"def note\n return @poco_data[:note] unless @poco_data == nil\n pick_first_node(@poco.xpath('./poco:note'))\n end",
"def find_case_note\n\t\t# Find the case notes\n\t\t@case_note = CaseNote.find(params[:id])\n\tend",
"def notebook\n attributes.fetch(:notebook)\n end",
"def find_noteable_id\n GithubImport::IssuableFinder.new(project, note).database_id\n end",
"def wait_for_by_notebook(notebook, iterations = Evertils::Base::MAX_SEARCH_SIZE)\n Notify.info(\"Waiting for #{notebook}...\")\n note = find_note_by_notebook(notebook)\n\n begin\n # didn't find it the first time? wait and try again\n if note.entity.nil?\n (1..iterations).each do |iter|\n Notify.info(\" (#{iter}) Looking for #{notebook.downcase}\")\n note = find_note_by_notebook(notebook, true)\n break unless note.entity.nil? || iter == Evertils::Base::MAX_SEARCH_SIZE\n end\n end\n rescue Interrupt\n Notify.error('Cancelled wait')\n end\n\n note\n end",
"def show\n # If the current user does not have access to that notebook -> show not found\n if @notebook.user != current_user\n not_found\n end\n end",
"def note\n DBC.require( bu?, \"Vin non bu: La note n'est pas definie\" )\n\n @note\n end",
"def notebook_document\n attributes.fetch(:notebookDocument)\n end",
"def notebook_document\n attributes.fetch(:notebookDocument)\n end",
"def set_notebook\n @notebook = Notebook.find(params[:id])\n end",
"def set_notebook\n @notebook = Notebook.find(params[:id])\n end",
"def set_notebook\n @notebook = Notebook.find(params[:id])\n end",
"def set_notebook\n @notebook = Notebook.find(params[:id])\n end",
"def find_notes_for_notable(notable_str, notable_id)\n where(notable_type: notable_str, notable_id: notable_id)\n end",
"def reply\n @bnote = Bnote.find(params[:id])\n end",
"def set_notebook\n @notebook = Notebook.find(params[:id])\n end",
"def wait_for_by_title(title, notebook, iterations = Evertils::Base::MAX_SEARCH_SIZE)\n Notify.info(\"Waiting for #{title}...\")\n note = find_note_by_title(title)\n\n begin\n # didn't find it the first time? wait and try again\n if note.entity.nil?\n (1..iterations).each do |iter|\n Notify.info(\" (#{iter}) Looking for #{notebook.downcase}\")\n note = find_note_by_title(notebook, true)\n break unless note.entity.nil? || iter == Evertils::Base::MAX_SEARCH_SIZE\n end\n end\n rescue Interrupt\n Notify.error('Cancelled wait')\n end\n\n note\n end",
"def note_attachment_el(note, attachment_name)\n note_attachment_els(note).find { |el| el.text.strip == attachment_name }\n end",
"def set_notebook\n @notebook = Notebook.find(params[:notebook_id])\n end",
"def notebook\n JupyterNotebook.new(content)\n end",
"def find_last_note(nb_notes)\n note = self\n (nb_notes.to_i - 1).times do\n note = note.succ\n end\n note\n end",
"def note_params\n params.require(:note).permit(:title, :content, :notebook_id)\n end",
"def state_note(item)\n s = state_value(item) or return\n state_table.dig(s, :note)\n end",
"def search_non_note(string)\n logger.info \"Searching for '#{string}'\"\n search string\n end",
"def note note, preview=nil\n preview ||= note[0..64]\n params = {\n contact_ids: [ self.id ],\n note: note,\n note_preview: preview\n }\n @nimble.post \"contacts/notes\", params\n end",
"def show\n @note_book = NoteBook.find(params[:id])\n end",
"def assert_note_b_prime(index)\n within(all(\"li.note\")[index]) do\n assert_text \"Note B Prime\"\n assert_text \"1 day ago\"\n assert_link \"Edit\"\n assert_link \"Delete\"\n # TODO: Make a link to user profile show.\n assert_text \"Can Edit CIs/Outages\"\n end\n end",
"def show\n @notebook = Notebook.find(params[:id]) || not_found\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end",
"def note(note)\n\t\t@note = note\n\tend",
"def update\n @notebook = Notebook.find(@note.notebook_id)\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @notebook, notice: 'Note was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def show\n @notes = @bookmark.notes\n end",
"def show\n @note = Note.find_by!(identifier: params[:identifier])\n @like = @note.likes.find_by(ip_hash: helpers.hashed_ip)\n end",
"def show\n @notebook = Notebook.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end",
"def find_case_note\n\t\t# Find the case notes\n\t\t@case_note = CaseNote.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Case Note ID !'}, status: 400 if @case_note.nil?\n\tend",
"def public_api_get_job_note(job_id, note_id, api_key, opts = {})\n data, _status_code, _headers = public_api_get_job_note_with_http_info(job_id, note_id, api_key, opts)\n return data\n end",
"def find_notes_by_user(user) \n notable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s\n \n Note.find(:all,\n :conditions => [\"user_id = ? and notable_type = ?\", user.id, notable],\n :order => \"created_at DESC\"\n )\n end",
"def note\n @attributes[:note]\n end",
"def find(prepostion)\n\t\tpartial_search_kb = string_to_internal(preposition)\n\t\tpartial_search_kb.each do |sentence|\n\t\t\tind = @kb.index(sentence)\n\t\tend\n\t\treturn ind\n\tend",
"def editor_key\n \"notebooks/#{notebook.token}/notes/#{token}\"\n end",
"def set_note\n @note = Note.friendly.find(params[:id])\n\n end",
"def notebook\n @notebook = Notebook.new(@@auth_store) if @notebook.nil?\n @notebook\n end",
"def show\n @note = Note.find(params[:id])\n end",
"def note\n query_root_node(\"lgdp:note/text()\", @@NAMESPACES).to_s\n end",
"def show_all_notes(db)\n notes = server.get_index\n notes.each do |note|\n note = server.get_note(note[\"key\"])\n show_note(note)\n end\nend",
"def notebook_note_params\n params.require(:notebook_note).permit(:user_id, :notebook_id, :name, :token)\n end",
"def favorite_note?(note_id)\n !favorite_notes.where(note_id: note_id).first.nil?\n end",
"def note_for ref\n @note_order << ref\n\n label = @note_order.length\n\n \"{*#{label}}[rdoc-label:foottext-#{label}:footmark-#{label}]\"\n end",
"def resolve_note(note)\n if note.is_a?(Proc)\n note = note.call()\n end\n if note.is_a?(Symbol)\n note = Playables.runtime.note(note)\n end\n if note.nil?\n raise 'Bad Note'\n end\n note\n end",
"def set_note\n #prevent from searching note from different user\n @note = current_user.notes.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def set_note\n @note = Note.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def cmd_note(irc, line)\n u = $user.get_nick(irc) or return\n nu = IRC::Address.normalize(u)\n n = @notes[sn = irc.server.name] || (@notes[sn] = {})\n now = Time.now.to_i\n if !line or line.empty?\n if (e = n[nu]) and !e.empty?\n from, date, txt = e.shift\n n.delete(nu) if e.empty?\n irc.reply \"From #{from}, sent #{seconds_to_s(now - date, irc)} ago: #{txt}\"\n else\n irc.reply \"You have no unread notes.\"\n end\n else\n to, txt = line.split(' ', 2)\n if txt\n if (t = $user.get_data(to, sn))\n nto = IRC::Address.normalize(to)\n nl = n[nto] || (n[nto] = [])\n if (announced = $user.get_nick(to, sn))\n as = (nn = irc.from.nick) == u ? '' : \" (as #{nn.capitalize})\"\n irc.server.notice(to, \"#{u.capitalize}#{as} has sent you a note. Use 'notes' to list your unread notes.\")\n end\n nl << [u, now, txt, announced ? true : false]\n irc.reply \"Ok, note to #{to} added.\"\n else\n irc.reply \"No such user, #{to}.\"\n end\n else\n if !(e = n[nu]) or e.empty?\n irc.reply \"You have no unread notes.\"\n else\n begin\n i = Integer(to)\n if i >= 1 and i <= e.length\n from, date, txt = e[i - 1]\n irc.reply \"Note #{i} from #{from}, sent #{seconds_to_s(now - date, irc)} ago: #{txt}\"\n else\n notes = \"note#{'s' if e.length > 1}\"\n irc.reply \"Note number out of range. You have #{e.length} unread #{notes}.\"\n end\n rescue ArgumentError\n irc.reply \"USAGE: note <number>\"\n end\n end\n end\n end\n end",
"def notes\n run(helm('get', 'notes', name))\n end",
"def search(query, notes_relation = @notes)\n pattern = \"%#{query}%\"\n notes_relation.where(Note.arel_table[:note].matches(pattern))\n end",
"def find_github_issue\n\n issue = github.branch_for_head.match(/(issue\\/\\d+)/)\n if issue\n return issue[1]\n end\n\nend",
"def note(name, note=nil)\n if note.nil?\n details(name).rule_notes\n else\n @driver.setRuleNotes([name], [note])\n end\n\n end",
"def read_notes_without_serializing(obs)\n Observation.connection.exec_query(\"\n SELECT notes FROM observations WHERE id = #{obs.id}\n \").rows.first.first\n end",
"def next_note\r\n end",
"def findIssue(issue) \n\tissueFound = $client.Issue.find(issue)\n\treturn issueFound\nend",
"def create\n @notebook = Notebook.find(params[:notebook_id])\n @note = Note.new(note_params)\n @note.notebook_id = @notebook.id\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @notebook, notice: 'Note was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def notes\n\t\tNote.find(:all)\n\tend",
"def get_issue(num)\n @issues = Octokit.issues \"LingduoKong/final\",:state => \"open\"\n @issues.each do |issue|\n if issue.number == num\n @issue = issue\n return @issue\n end\n end\nend",
"def set_interview_note\n @interview_note = InterviewNote.find(params[:id])\n end",
"def note\n comment_list = []\n return @notes if !@notes.nil?\n for page in @pages\n next if !page || !page.list || page.list.size <= 0\n note_page = page.list.dup\n \n note_page.each do |item|\n next unless item && (item.code == 108 || item.code == 408)\n comment_list.push(item.parameters[0])\n end\n end\n @notes = comment_list.join(\"\\r\\n\")\n return @notes\n end",
"def specific_notes(id, accept)\n begin\n \t# Calls a certain note depending on the number \n return RestClient.get 'http://localhost:4567/notes/' + id.to_s, :accept => accept\n rescue => e\n return e.response\n end\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end",
"def set_note\n @note = Note.find(params[:id])\n end"
] |
[
"0.72482955",
"0.70199686",
"0.68029636",
"0.67772716",
"0.67260605",
"0.6438709",
"0.6371517",
"0.6353533",
"0.6353533",
"0.6298389",
"0.6230734",
"0.6211419",
"0.61774856",
"0.60875726",
"0.6066735",
"0.60615426",
"0.59805685",
"0.59652555",
"0.592485",
"0.59010124",
"0.5872467",
"0.58549625",
"0.5830222",
"0.58212835",
"0.580707",
"0.57887876",
"0.5776762",
"0.57639194",
"0.57639194",
"0.56477636",
"0.56477636",
"0.56477636",
"0.56477636",
"0.5640855",
"0.5609555",
"0.55994684",
"0.55821973",
"0.5574641",
"0.5540223",
"0.55402",
"0.55380005",
"0.5498974",
"0.5496506",
"0.54947966",
"0.54871345",
"0.54820615",
"0.5445797",
"0.54433656",
"0.54177177",
"0.5411624",
"0.53925407",
"0.534391",
"0.5334075",
"0.53121793",
"0.53090656",
"0.52827847",
"0.52804893",
"0.5273717",
"0.52671516",
"0.52548534",
"0.52475536",
"0.523188",
"0.5204719",
"0.5202851",
"0.51822853",
"0.5181919",
"0.51656747",
"0.516342",
"0.51591223",
"0.51474583",
"0.51474583",
"0.51471204",
"0.51238406",
"0.5120884",
"0.5116593",
"0.51153666",
"0.5113564",
"0.5099566",
"0.5099488",
"0.5099392",
"0.5088295",
"0.5080669",
"0.50768197",
"0.5075008",
"0.50733185",
"0.50596774",
"0.50596774",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265",
"0.5057265"
] |
0.8060751
|
0
|
draw a bar at given column with provided value (this command does not overwrite the screen)
|
def bar(column, value)
command "B#{column},#{value}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_values(total, cur)\n @value = (cur * 100 / total).round rescue 0\n width = ((@icon.width - 6) * @value / 100).round rescue 0\n\n # Draw bar\n @icon.clear\n @icon.draw_rect(0, 0, @icon.width - 1, @icon.height - 1, false)\n @icon.draw_rect(3, 3, width, @icon.height - 6, true) if(0 < width)\n end",
"def display_col(col)\r\n\r\n print \"Column #{col}: \"\r\n @bingo_board[@cols.index(col)].each {|num| print \"#{num} \"}\r\n puts\r\n\r\n end",
"def bar\n step = @options[:step].to_f\n height = @options[:height].to_f\n width = ((@norm_data.size - 1) * step).to_f\n background_color = @options[:background_color]\n\n create_canvas(@norm_data.length * step + 2, height, background_color)\n\n upper = @options[:upper].to_f\n below_color = @options[:below_color]\n above_color = @options[:above_color]\n\n target = @options.has_key?(:target) ? @options[:target].to_f : nil\n target_color = @options[:target_color] || 'white'\n\n i = 1\n # raise @norm_data.to_yaml\n max_normalized = normalize(@maximum_value)\n @norm_data.each_with_index do |r, index|\n color = ((@data[index] || @minimum_value) >= upper) ? above_color : below_color\n @draw.stroke('transparent')\n @draw.fill(color)\n bar_height_from_top = @canvas.rows - ( (r.to_f / max_normalized.to_f) * @canvas.rows)\n @draw.rectangle( i, @canvas.rows, i + step - 2, bar_height_from_top )\n i += step\n end\n\n unless target.nil?\n adjusted_target_value = (height - 3 - normalize(target)/(101.0/(height-4))).to_i\n @draw.stroke(target_color)\n open_ended_polyline([[-5, adjusted_target_value], [width + 5, adjusted_target_value]])\n end\n\n @draw.draw(@canvas)\n @canvas\n end",
"def column(position)\n ConsoleGlitter.escape(\"#{position}G\")\n end",
"def to_bar(color = true, bar = '|')\n filling = (bar * @pre_percentage.to_f)\n padding = 0\n if color\n if to_i >= 0 and to_i < 50\n filling = (bar * @pre_percentage.to_i).to_ansi.green.to_s\n end\n if to_i >= 50 and to_i < 80\n filling = (bar * @pre_percentage.to_i).to_ansi.yellow.to_s\n end\n if to_i >= 80\n filling = (bar * @pre_percentage.to_i).to_ansi.red.to_s\n end\n if filling.size > 0\n padding = 13\n end\n end\n bindings = [filling, to_f, '%']\n \"[%-#{@scale + padding}s%5.1f%s]\" % bindings\n end",
"def move_to_column(x); puts \"\\e[#{x}F\" end",
"def do_bar state\n value, y = mega_pop(state), state[:y_position]\n height = state[:height]\n if 0 == value # move down if value = 0\n state[:y_position] = (y+1) % height\n else # up otherwise\n state[:y_position] = y == 0 ? height - 1 : y - 1\n end\n end",
"def gnuplot_row(col, row, value)\n col += 1; row += 1\n \"#{col} #{row - 0.5} #{value}\\n#{col} #{row + 0.5} #{value}\\n\"\n end",
"def draw\n puts \"*\" * (@cells.first.size + 2)\n @cells.each do |row|\n puts \"|\" + row.map { |column_value| column_value == 0 ? \" \" : \"#\" }.join + \"|\"\n end\n puts \"*\" * (@cells.first.size + 2)\n end",
"def bar(depth)\n if @html\n \"<FONT COLOR=\\\"#{@colour_chart[depth % @n_chart_colours]}\\\">#{@spacebar}</FONT>\"\n else\n @spacebar\n end\n end",
"def display_board(board)\n line = ''\n 0.upto(board.length - 1) do |lane|\n 0.upto(5) do |row|\n line += fig('pad')\n 0.upto(board[lane].length - 1) do |col|\n line += board[lane][col][row]\n line += fig('vbar') unless col == 2\n line += \"\\n\" unless col < 2\n end\n line += (fig('pad') + fig('hbar')) if row == 5 && lane < 2\n end\n end\n print line\n end",
"def gen_bar(amount, full, width,\n border_char_l=\"[\", border_char_r=\"]\", border_color=:white,\n bar_on_char=\"|\", bar_off_char=\" \", \n bar_colors=[:green, :yellow, :red],\n cut=-1\n )\n\n bar_l = border_char_l.send(border_color)\n bar_r = border_char_r.send(border_color)\n\n barN_amount = (1.0)*(amount)/(full)*(width)\n barN_empty = width - barN_amount\n\n bar_use = (bar_on_char * barN_amount)\n bar_space = (bar_off_char * barN_empty)\n\n bar_fill = bar_use + bar_space\n bar_colored = \"\"\n bar_colors.each_index do |index|\n start_i = (width / bar_colors.size) * index\n end_i = (width / bar_colors.size) * (index+1)\n filling = bar_fill[ start_i..end_i ].send( bar_colors[index] )\n if cut == index\n return filling.uncolorize\n end\n bar_colored += filling\n end\n \n return \"#{bar_l}#{bar_colored}#{bar_r}\"\nend",
"def setFigureOnBoard(posx, posy, value)\r\n @board[posx][posy] = value\r\n @sumCol[posx] += value\r\n @sumRow[posy] += value\r\n @sumDiag[0] += value if posx == posy\r\n @sumDiag[1] += value if posx + posy == 2\r\n end",
"def moving_bar(type, div='', bookend='')\n case type\n when :bat\n @bat_dir + bar_monitor([@bat_percent])\n end\n end",
"def bar\n return nil if state.total.is_a? Symbol\n skel = render_template(:main, [:bar])\n lwid = state.scope_at[0] == :tty ? terminal_width() : scope.line_width\n barlen = [lwid - skel.gsub(STRIP_ANSI, '').length, 0].max\n fill = [0,[(state.done.to_f/state.total*barlen).to_i,barlen].min].max\n thebar = scope.template.barchar * fill + scope.template.padchar * [barlen - fill,0].max\n thebar.length == 0 ? nil : thebar\n end",
"def display(line, column = T.unsafe(nil)); end",
"def display(line, column = T.unsafe(nil)); end",
"def display(line, column = T.unsafe(nil)); end",
"def column(n = nil)\n CSI + \"#{n || 1}G\"\n end",
"def bar(location)\n\t\t\t@location = location\n\t\t\tputs \"#{@name} is making their way to the brewery in #{@location}.\"\n\n\t\tend",
"def x=(value)\n @background.x = value\n @bar.x = value + @bx\n end",
"def pixel(column, row, action)\n command \"P#{column},#{row},#{action.to_s.upcase}\"\n end",
"def set_disc(row, col, value)\n @board[row * @size + col] = value\n end",
"def []=(column_index, value)\n @row[column_index] = value.part\n $dirty << [column_index, @row_index]\n $blocks_to_redraw << [column_index, @row_index]\n end",
"def render_bar_for_group(group, i)\n score = @assessment_report.gross_score_for(group) || 0\n rectangle_height = 30\n spacing = 30\n fill_color color_for(group)\n stroke_color color_for(group)\n\n multiple = ((bounds.right - ICON_WIDTH) / 100.0)\n\n move_down 15\n\n image graph_icon_for(group), width: 40, position: -15\n\n fill do\n rectangle [bounds.left + ICON_WIDTH, bounds.top - spacing + 8 - i * (rectangle_height + spacing)], score * multiple,\n rectangle_height\n end\n end",
"def column(col, by)\n tmp = @display.map {|row| row[col] }.join\n by.times { tmp[0,0]= tmp[-1]; tmp.chop! }\n tmp.each_char.with_index {|c,i| @display[i][col] = c }\n self\n end",
"def add_bar(bar)\n for i in 0..bar.length - 1\n add_beat(bar[i])\n end\n end",
"def column(c=0)\n percent_width(g_col_width, column_width(c))\n end",
"def set_position(x, y)\n @background.set_position(x, y)\n @bar.set_position(x + @bx, y + @by)\n end",
"def draw_board(b)\n system 'clear'\n puts \" #{b[1]} | #{b[2]} | #{b[3]} \"\n puts \"-----------\"\n puts \" #{b[4]} | #{b[5]} | #{b[6]} \"\n puts \"-----------\"\n puts \" #{b[7]} | #{b[8]} | #{b[9]} \"\nend",
"def draw_board(b)\n system 'clear'\n puts \" | | \"\n puts \" #{b[1]} | #{b[2]} | #{b[3]}\"\n puts \" | | \"\n puts \" ----------------------------\"\n puts \" | | \"\n puts \" #{b[4]} | #{b[5]} | #{b[6]}\"\n puts \" | | \"\n puts \" ----------------------------\"\n puts \" | | \"\n puts \" #{b[7]} | #{b[8]} | #{b[9]}\"\n puts \" | | \"\nend",
"def display(line, column=0)\n result = \"\\e[s\"\n result << \"\\e[#{line.to_i};#{column.to_i}H\"\n result << to_s\n result << \"\\e[u\"\n result\n end",
"def draw_vertical_segment value, column, row_from, row_to\n raise ArgumentError.new(\"There is no image\") if self.data == []\n raise ArgumentError.new(\"column or row out of bound\") if 1 > column || column > self.data.column_count || 1 > row_from || row_from > self.data.row_count || 1 > row_to || row_to > self.data.row_count\n (row_from..row_to).each {|row| self.data.send(:[]=, row-1, column-1, value)}\n end",
"def column=(value)\n @coordinate.x = value\n end",
"def draw_board(b)\n puts \"#{b[1]} | #{b[2]}| #{b[3]}\"\n puts \"---------\"\n puts \"#{b[4]} | #{b[5]}| #{b[6]}\"\n puts \"---------\"\n puts \"#{b[7]} | #{b[8]}| #{b[9]}\"\nend",
"def default_bbar\n [\n :commit_rows.action,\n \"-\", # Adds a separator\n :row_counter.action\n ]\n end",
"def ongoing_bar(event, date)\n if (date).to_datetime.midnight != DateTime.now.midnight\n 1000\n else\n line_control - starting_pos(event, date) -8\n end\n end",
"def draw_line\n print H_SEP * columns\n end",
"def y=(value)\n @background.y = value\n @bar.y = value + @by\n end",
"def draw(text)\n printf \"%s %-#{(columns / 3) - 5}s \" % [V_SEP, text]\n end",
"def endCol; @col + @width - 1; end",
"def display_board\n cell = \" \"\n print cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n\"\n\nend",
"def draw_board\n @squares.each do |square|\n print \" #{square.value ? \" #{square.value} \" : \"[#{square.location}]\"} \"\n if square.location.to_i % 3 == 2 && square.location.to_i != 8\n print \"\\n\"\n puts \"------------------\\n\"\n elsif square.location.to_i == 8\n print \"\\n\"\n else\n print\"|\"\n end\n end\n end",
"def cell(i)\n printf ' %3d ', i\n end",
"def display_board(word, start_position, direction)\n return b1.fill(word, start_position, direction)\n end",
"def bars(bitmap, depth)\n s = bitmap.set?(0) ? \"|\" : \" \" \n\n (1...depth).each do |i|\n if bitmap.set?(i)\n s += bar(depth) \n else\n s += @spacenobar\n end\n end\n return s\n end",
"def draw_segment(character, offset)\n puts \"#{' ' * offset}#{character}\"\nend",
"def bar!(data, bar_color: :default, bar_width: :default,\n bar_gap: :default, bar_edge: :default, bar_edge_color: :default,\n bar_edge_width: :default)\n\n @active_subplot.x_range[0] = 0 if @active_subplot.x_range[0].nil?\n @active_subplot.x_range[1] = data.length if @active_subplot.x_range[0].nil?\n bar_gap = 0 if bar_gap == :default\n bar_width = 1 if bar_width == :default\n bar_edge_width = 0.03 if bar_edge_width == :default\n x_length = data.length * (bar_width + bar_gap) + bar_width + bar_edge_width\n @active_subplot.x_range[1] = x_length if x_length > @active_subplot.x_range[1]\n\n @active_subplot.y_range[0] = data.min if @active_subplot.y_range[0].nil?\n @active_subplot.y_range[1] = data.max if @active_subplot.y_range[1].nil?\n @active_subplot.y_range[0] = data.min if data.min < @active_subplot.y_range[0]\n @active_subplot.y_range[1] = data.max if data.max > @active_subplot.y_range[1]\n @active_subplot.tasks.push(Bar.new(data, bar_color: bar_color, bar_width: bar_width,\n bar_gap: bar_gap, bar_edge: bar_edge,\n bar_edge_color: bar_edge_color,\n bar_edge_width: bar_edge_width))\n end",
"def draw_cell(pdf, x, y, options={})\n index_space = options[:indexes] ? 1 : 0\n graphic_y = dimensions[:vertical]- y - index_space\n graphic_x = x + index_space\n pdf.stroke_rectangle *pdf_cell_box(graphic_x, graphic_y)\n cell_content = char_at(position(x,y))#@panel[:horizontal][y][x]\n if cell_content == self.class::BLACK\n pdf.fill_rectangle *pdf_cell_box(graphic_x, graphic_y)\n elsif options[:solved]\n pdf.text_box cell_content.upcase, :at => [graphic_x*PDF_CELL_SIZE, graphic_y*PDF_CELL_SIZE], \n :height => PDF_CELL_SIZE, \n :width => PDF_CELL_SIZE, \n :align => :center, \n :valign => :center\n end\n end",
"def draw_horizontal_segment value, column_from, column_to, row\n raise ArgumentError.new(\"There is no image\") if self.data == []\n raise ArgumentError.new(\"column or row out of bound\") if 1 > column_from || column_from > self.data.column_count || 1 > column_to || column_to > self.data.column_count || 1 > row || row > self.data.row_count\n (column_from..column_to).each {|column| self.data.send(:[]=, row-1, column-1, value)}\n end",
"def [](idx)\n\t\t@bar[idx]\n\tend",
"def barchart(*args)\n Bar.new(self, *args)\n end",
"def render\r\n # puts \"\\e[H\\e[2J\"\r\n\r\n values = @grid\r\n puts \" 0 1 2 3 4 5 6 7 8\".light_black\r\n puts \" +---+---+---+---+---+---+---+---+---+\".light_black\r\n values.each_with_index do |row, idx|\r\n print \" #{idx} |\".light_black\r\n row.each_with_index do |value, idx|\r\n if idx >= 1\r\n print \"|\".light_black\r\n end\r\n # color coding output to cells\r\n if \" #{value} \".match?(/[0]/) # no values printed for open spaces\r\n print \" \"\r\n elsif value.is_a? String # values changed by player are printed in yellow\r\n print \" #{value} \".yellow\r\n else\r\n print \" #{value} \".light_blue # OG values are printed in blue\r\n end\r\n end\r\n print \"|\\n\".light_black\r\n puts \" +---+---+---+---+---+---+---+---+---+\".light_black\r\n end\r\n puts # adds newline at end of board\r\n end",
"def bar_dir=(v)\n RestrictionValidator.validate \"BarChart.bar_dir\", [:bar, :col], v\n @bar_dir = v\n end",
"def print_board g\n puts \"\n _______________\n | ----------- |\n | | #{g >= 1 ? \"()\".color(:yellow_text) : \" \"}\n | | #{g >= 4 ? \"\\\\\".color(:yellow_text) : \" \"}#{g >= 2 ? \"|\".color(:yellow_text) : \" \"}#{g >= 5 ? \"/\".color(:yellow_text) : \" \"}\n _____________| |______ #{g >= 3 ? \"|\".color(:yellow_text) : \" \"}\n / | | /| #{g >= 6 ? \"/\".color(:yellow_text) : \" \"} #{g >= 7 ? \"\\\\\".color(:yellow_text) : \" \"}\n / | | / |\n /_____________________/ /\n |_____________________|/\n \"\n end",
"def draw_file(col)\n ''\n end",
"def move(line, column=0)\n \"\\e[#{line.to_i};#{column.to_i}H\"\n end",
"def []=(row, col, value)\n set_disc(row, col, value)\n end",
"def draw_board()\n @board\n p \"#{@board[0]} || #{@board[1]} || #{@board[2]}\"\n p \"===========\"\n p \"#{@board[3]} || #{@board[4]} || #{@board[5]}\"\n p \"===========\"\n p \"#{@board[6]} || #{@board[7]} || #{@board[8]}\"\n puts \"\\n\"\n puts \"\\n\"\n end",
"def value=(v)\n @bar.x = (start + course.to_f * v.fbound(0, max_value) / max_value).to_i\n end",
"def display_board(board)\n colors=board\n r=\"-----------\"\n puts \" #{colors[0]} | #{colors[1]} | #{colors[2]} \"\n puts r\n puts \" #{colors[3]} | #{colors[4]} | #{colors[5]} \"\n puts r\n puts \" #{colors[6]} | #{colors[7]} | #{colors[8]} \"\nend",
"def append_width(required_col)\n diff = required_col - @screen_size[1] + 1\n @screen.each.with_index do |row, i|\n @screen[i] = row + Array.new(diff)\n end\n @screen_size[1] += diff\n end",
"def add_piece(column, symbol) #todo: extract position finding ?\n position = grid[column].inject { |memo, space| memo > space.to_i ? memo : space }\n available_index = grid[column].index(position)\n grid[column][available_index] = symbol\n end",
"def output_board(board, x_score, o_score)\r\n clear_screen\r\n header\r\n scorekeeping(x_score, o_score)\r\n spaced = []\r\n board.each { |mark| mark == \"\" ? spaced.push(\" \") : spaced.push(mark) }\r\n rows = spaced.each_slice(3).to_a\r\n rows.each_with_index do |row, index|\r\n index < 2 ? (tab(11, row.join(\" | \")); tab(11, \"-\" * 9)) : tab(11, row.join(\" | \"))\r\n end\r\n puts \"\\n\"\r\n legend\r\n end",
"def draw_board(b)\n system 'clear'\n puts \"Make a selection by entering any number displayed on the board.\"\n puts \" \"+\"#{b[1]} | #{b[2]} | #{b[3]}\"\n puts \" \"+\"----------\"\n puts \" \"+\"#{b[4]} | #{b[5]} | #{b[6]}\"\n puts \" \"+\"----------\"\n puts \" \"+\"#{b[7]} | #{b[8]} | #{b[9]}\"\nend",
"def []=(idx, letter)\n\t\t@bar[idx] = letter\n \tend",
"def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding) + line_height + standard_padding\n rect\n end",
"def draw(box)\n battr = 0\n bchar = 0\n fattr = @filler & Ncurses::A_ATTRIBUTES\n hist_x = @title_lines + 1\n hist_y = @bar_size\n\n @win.werase\n\n # Box the widget if asked.\n if box\n Draw.drawObjBox(@win, self)\n end\n\n # Do we have a shadow to draw?\n if !(@shadow.nil?)\n Draw.drawShadow(@shadow_win)\n end\n\n self.drawTitle(@win)\n\n # If the user asked for labels, draw them in.\n if @view_type != :NONE\n # Draw in the low label.\n if @low_string.size > 0\n Draw.writeCharAttrib(@win, @lowx, @lowy, @low_string,\n @stats_attr, @orient, 0, @low_string.size)\n end\n\n # Draw in the current value label.\n if @cur_string.size > 0\n Draw.writeCharAttrib(@win, @curx, @cury, @cur_string,\n @stats_attr, @orient, 0, @cur_string.size)\n end\n\n # Draw in the high label.\n if @high_string.size > 0\n Draw.writeCharAttrib(@win, @highx, @highy, @high_string,\n @stats_attr, @orient, 0, @high_string.size)\n end\n end\n\n if @orient == CDK::VERTICAL\n hist_x = @box_height - @bar_size - 1\n hist_y = @field_width\n end\n\n # Draw the histogram bar.\n (hist_x...@box_height - 1).to_a.each do |x|\n (1..hist_y).each do |y|\n battr = @win.mvwinch(x, y)\n \n if battr == ' '.ord\n @win.mvwaddch(x, y, @filler)\n else\n @win.mvwaddch(x, y, battr | fattr)\n end\n end\n end\n\n # Refresh the window\n @win.wrefresh\n end",
"def draw_board(board)\n system 'clear'\n puts \" #{board[1]} | #{board[2]} | #{board[3]} \"\n puts \"----+---+----\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]} \"\n puts \"----+---+----\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]} \"\nend",
"def draw\n @grid.each do |row|\n puts row.map{|cell|\n cell.to_s\n }.join(\"\")\n end\n end",
"def draw_board(board)\n system 'clear'\n puts \" #{board[1]} | #{board[2]} | #{board[3]} \"\n puts \" _________\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]} \"\n puts \" _________\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]} \"\nend",
"def draw_actor_hp_hud(actor, x, y, w = 148)\n # calculate fill rate\n rate = (actor.maxhp > 0 ? actor.hp.to_f / actor.maxhp : 0)\n # create color depending on fill rate\n if rate > 0.6\n color1 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192) \n elsif rate > 0.2 && rate <= 0.6\n color1 = Color.new(240, 600 * (rate-0.2), 0, 192) \n elsif rate <= 0.2\n color1 = Color.new(240, 0, 0, 192)\n end\n # background color\n color2 = Color.new(0, 80, 0, 192)\n # draw bar\n self.contents.gradient_bar_simple(x + 32, y, w - 48, color1, color2, rate)\n # fix y coordinate\n y -= 9\n self.contents.font.color = system_color\n # draw HP word\n self.contents.draw_text_full(x, y, 32, 32, $data_system.words.hp)\n # set offset\n hp_x = x + w - 122\n # set colors and draw values\n self.contents.font.color = actor.hp == 0 ? knockout_color :\n actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color\n self.contents.draw_text_full(hp_x, y, 48, 32, actor.hp.to_s, 2)\n self.contents.font.color = normal_color\n self.contents.draw_text_full(hp_x + 48, y, 12, 32, '/', 1)\n self.contents.draw_text_full(hp_x + 60, y, 48, 32, actor.maxhp.to_s)\n self.contents.font.color.alpha = 255\n end",
"def repaint\n r,c = rowcol\n $log.debug(\"widget repaint : r:#{r} c:#{c} col:#{@color_pair}\" )\n value = getvalue_for_paint\n len = self.width || value.length\n acolor = @color_pair \n @graphic.printstring r, c, \"%-*s\" % [len, value], acolor, attr()\n end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def fill_column(x, y1, y2, colour)\n return if invalid?(x,y1) || invalid?(x,y2)\n y1.upto(y2) do |i|\n colour(x,i,colour)\n end\n end",
"def value=(v)\n @bar.y = start + course.to_f * v.fbound(0, max_value) / max_value\n end",
"def setCell(row, col, value)\n # Make sure the row/col combination is within the matrix.\n if row > @rows || cols > @cols || row <= 0 || col <= 0\n return -1\n end\n\n self.cleanCell(row, col)\n @info[row][col] = value[0...[@colwidths[col], value.size].min]\n return 1\n end",
"def draw_board(board)\n system 'clear' #clears board instead of adding to the bottom\n puts \" | | \"\n puts \"#{board[1]} |#{board[2]} |#{board[3]}\"\n puts \"------+-------+-------\"\n puts \" | | \"\n puts \"#{board[4]} |#{board[5]} |#{board[6]}\"\n puts \"------+-------+-------\"\n puts \" | | \"\n puts \"#{board[7]} |#{board[8]} |#{board[9]}\"\nend",
"def draw_board(bf)\n puts \"\"\n puts \"Let's get started!'\"\n puts \"\"\n puts \"Sample board with numbers:\"\n puts \"\"\n puts \" 1 | 2 | 3 \"\n puts \"---+---+---\"\n puts \" 4 | 5 | 6 \"\n puts \"---+---+---\"\n puts \" 7 | 8 | 9 \"\n puts \"\"\n puts \"Game Board:\"\n puts \"\"\n puts \" #{bf[1]} | #{bf[2]} | #{bf[3]} \"\n puts \"---+---+---\"\n puts \" #{bf[4]} | #{bf[5]} | #{bf[6]} \"\n puts \"---+---+---\"\n puts \" #{bf[7]} | #{bf[8]} | #{bf[9]} \"\n puts \"\"\nend",
"def at(row, column)\n # Add logic for this method, Remember to account for inbound & outbound checks.\n\tif (row > @rows-1)\n\t\tputs \"Row #{row} is out of bound\"\n\t\treturn\n\tend\n\tif (column > @columns-1)\n\t\tputs \"Column #{column} is out of bound\"\n\t\treturn\n\tend\n\tif @board[row][column].nil?\n\t\treturn \" \"\n\tend\n\treturn @board[row][column]\t\n end",
"def item_rect(index)\n rect = super\n rect.y = index / col_max * (item_height + standard_padding)\n rect\n end",
"def print_bar(width, title=nil)\n if title\n title += \" (pretend)\" if pretend?\n half_width = (width / 2) - (title.length / 2) - 2\n left_bar = '=' * half_width\n right_bar = '=' * (title.length % 2 == 0 ? half_width : half_width - 1) # TODO: lame.\n puts \"#{left_bar}( #{title} )#{right_bar}\"\n else\n puts \"=\" * width\n end\n end",
"def display\n puts \"#{@cell[0..2].join(\" | \")}\"\n puts \"---------\"\n puts \"#{@cell[3..5].join(\" | \")}\"\n puts \"---------\"\n puts \"#{@cell[6..8].join(\" | \")}\"\n \n end",
"def place_marker(marker, column)\n column -= 1 #index 0\n z = @board.length - 1\n until @board[z][column] == \"_\"\n z -= 1\n end\n @board[x][column] = marker\n end",
"def draw(array=@board_array)\n\t\tputs \" a b c d e f g h \"\n\t\tputs \"___________________________________\"\n\t\tarray.each_with_index do |subarr, i|\n\t\t\tprint \" #{i+1} \"\n\t\t\tsubarr.each_with_index do |item, index|\n\t\t\t\tif index == 7\n\t\t\t\t\tprint item.to_s\n\t\t\t\telse\n\t\t\t\t\tprint item.to_s + \" | \"\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"\\n___________________________________\"\n\t\tend\n\tend",
"def col(num)\n \"#{27.chr}[3#{num.to_s}m\"\nend",
"def enter_value(row,col,value)\n col = @hash[col] if col.is_a? String#interpret 'a' to mean 1\n @board[row][col].chess_piece = value\n end",
"def command_rect(index = 0)\n r_width = contents_width / columns\n r_height = contents_height\n x = r_width * index\n y = 0\n Rect.new(x, y, r_width, r_height)\n end",
"def draw_stat_gauge(x, y, width, stat, value)\n max = max_known_value(stat)\n contents.fill_rect(x, y, width, 3, gauge_back_color)\n gw = (value * width).to_f\n gw /= max\n contents.gradient_fill_rect(x, y, gw.to_i, 3, mp_gauge_color1, mp_gauge_color2)\n end",
"def drop(color, column)\n #append color to column\n @grid[column] << color\n @last_x = column\n @lasy_y = @grid[column].length - 1\n @last_color = color\n end",
"def show_board(spaces)\nputs \"\\n\n\n _______ _______ _______ \n | 1 | 2 | 3 |\n | \" + spaces[0] + \" | \" + spaces[1] + \" | \" + spaces[2] + \" |\n |_______|_______|_______|\n | 4 | 5 | 6 |\n | \" + spaces[3] + \" | \" + spaces[4] + \" | \" + spaces[5] + \" |\n |_______|_______|_______|\n | 7 | 8 | 9 |\n | \" + spaces[6] + \" | \" + spaces[7] + \" | \" + spaces[8] + \" |\n |_______|_______|_______| \\n\\n\\n\"\n\nend",
"def column_print(things, color=:white)\n # return unless things.any?\n # sizes = things.map{|x|x.size}\n # col_width = sizes.max\n # cols = 80 / (col_width+3)\n # cols = 4 if cols > 4\n \n # if things.size % cols != 0\n # things += [''] * (cols - (things.size % cols))\n # end\n \n # things.map!{|thing| thing.ljust(col_width)}\n \n # things.each_slice(cols) do |slice|\n # puts slice.join(' | ').send(color)\n # end\n puts Term::Table.new(things).to_s.send(color)\n end",
"def position_value(pos, value = 42)\n unless value == 42\n @grid[pos[0]][pos[1]] = value\n end\n @grid[pos[0]][pos[1]]\n end",
"def draw\n\t\tputs \"\\n\"\n\t\tmid = (@height/2.0).ceil\n\t\tfor line in 1..@height\n\t\t\tspace0 = (mid - (mid-line).abs).abs\n\t\t\tspace1 = (mid - line).abs * 2 - 1\n\t\t\tputs space1 > 0 ?\n\t\t\t\t \" \" * space0 + \"X \" + \" \" * space1 + \"X\" :\n\t\t\t\t \" \" * space0 + \"X\"\n\t\tend\n\tend",
"def column_space=(val)\n @column_space = val\n update_xy\n end",
"def barcode_box(pdf, value)\n text_height = font_size*1.5\n code_height = pdf.bounds.height - text_height\n code = '%05d' % value\n\n # Barcode above..\n pdf.bounding_box([pdf.bounds.left, pdf.bounds.top - code_height],\n :width => pdf.bounds.width, :height => text_height) do\n pdf.text(code, :align => justification.to_sym)\n end\n\n # Text below\n pdf.bounding_box([pdf.bounds.left, pdf.bounds.top],\n :width => pdf.bounds.width, :height => code_height) do\n barcode = Barby::Code39.new(code)\n barcode.annotate_pdf(pdf, :xdim => 0.75, :height => code_height * 0.8)\n end\n end",
"def display_board(brd)\n puts green(\"You're #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\")\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def show_board(spaces)\n\nputs \"\\n\n\n _______ _______ _______ \n | 1 | 2 | 3 |\n | \" + spaces[0] + \" | \" + spaces[1] + \" | \" + spaces[2] + \" |\n |_______|_______|_______|\n | 4 | 5 | 6 |\n | \" + spaces[3] + \" | \" + spaces[4] + \" | \" + spaces[5] + \" |\n |_______|_______|_______|\n | 7 | 8 | 9 |\n | \" + spaces[6] + \" | \" + spaces[7] + \" | \" + spaces[8] + \" |\n |_______|_______|_______| \\n\\n\\n\"\n\nend"
] |
[
"0.64666945",
"0.6215702",
"0.60802513",
"0.60577494",
"0.5940602",
"0.59248483",
"0.5922719",
"0.589253",
"0.5836636",
"0.58333576",
"0.5799103",
"0.579083",
"0.5780918",
"0.5755637",
"0.5750297",
"0.57136726",
"0.57136726",
"0.57136726",
"0.56806564",
"0.5675468",
"0.5661605",
"0.5660843",
"0.5614283",
"0.5570727",
"0.55017173",
"0.5480678",
"0.5442204",
"0.54284775",
"0.54257935",
"0.54063606",
"0.538775",
"0.5387547",
"0.53864515",
"0.53801084",
"0.53665394",
"0.5361308",
"0.5346318",
"0.53127927",
"0.52971256",
"0.52970636",
"0.5292672",
"0.5285404",
"0.528042",
"0.5274658",
"0.52651227",
"0.5255792",
"0.5252641",
"0.5245304",
"0.5244662",
"0.52375865",
"0.5231899",
"0.52209145",
"0.5209915",
"0.520667",
"0.5181941",
"0.517307",
"0.5170809",
"0.51684755",
"0.5163789",
"0.51623267",
"0.5156098",
"0.5146078",
"0.5143213",
"0.5134417",
"0.5133613",
"0.5128984",
"0.5128909",
"0.511877",
"0.5116033",
"0.5104497",
"0.5100233",
"0.5094466",
"0.5092027",
"0.5092015",
"0.5092015",
"0.5092015",
"0.50836545",
"0.5078284",
"0.5077794",
"0.50718516",
"0.5063582",
"0.5061142",
"0.50606394",
"0.5059573",
"0.50584567",
"0.5054689",
"0.50486016",
"0.504439",
"0.50423586",
"0.50339955",
"0.502984",
"0.5029672",
"0.5023605",
"0.50204086",
"0.50202346",
"0.5018108",
"0.50179",
"0.50168616",
"0.5014346",
"0.50070786"
] |
0.7504416
|
0
|
do an action on a pixel at given column/row
|
def pixel(column, row, action)
command "P#{column},#{row},#{action.to_s.upcase}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_pixel(row: 0, col: 0, color: \"W\")\n raise Useditor::Workspace::PixelLocationError.new(\"Row out of bounds\") if row < 0 || row > (@rows -1)\n raise Useditor::Workspace::PixelLocationError.new(\"Col out of bounds\") if col < 0 || col > (@cols -1)\n @image[row][col]\n end",
"def set_pixel(row: 0, col: 0, color: \"R\")\n draw_horizontal(row: row, start_col: col, end_col: col, color: color)\n save_state\n self\n end",
"def update_cell (row_index, col_index, value)\n return if !within?(@image, row_index) || !within?(@image[row_index], col_index)\n @image[row_index][col_index] = value\n end",
"def color_image_pixel\n @pixel_x = @cmd_options[0]-1\n @pixel_y = @cmd_options[1]-1\n @color = @cmd_options[2]\n @matrix[@pixel_y][@pixel_x] = @color\n end",
"def reveal_clicked(x,y)\n tile = get_tile([(x.fdiv(@rat)).to_i,(y.fdiv(@rat)).to_i])\n value = reveal_tile(tile.pos)\n paint\n return value\n end",
"def color_column(col, row_start, row_end, color)\n (row_start..row_end).each do |y|\n color_pixel(col, y, color)\n end\n end",
"def update_cell(row_index, col_index, value)\n\t\treturn if !within?(@image, row_index) || !within?(@image[row_index],col_index)\n\t\t@image[row_index][col_index] = value\n\tend",
"def insert(pixel, x, y)\n self.matrix[x,y]=pixel\n end",
"def each_pixel\n get_pixels(0, 0, columns, rows).each_with_index do |p, n|\n yield(p, n % columns, n / columns)\n end\n self\n end",
"def at(row, column)\n # We have to do three things:\n #\n # 1. Make sure \"row\" is in bounds\n # 2. Make sure \"column\" is in bounds\n # 3. Return the appropriate value on the board (if present)\n @board[row][column]\n end",
"def color_column(col, row_start, row_end, color)\n (row_start..row_end).each do |y|\n color_pixel(col, y, color)\n end\n end",
"def set_one(row,col)\n\t\tpixels[row][col] = 1\n\tend",
"def color_pixel(x, y, color)\n x_index = x.to_i - 1\n y_index = y.to_i - 1\n bitmap.set_pixel_to({x: x_index, y: y_index}, color)\n end",
"def isClick(x,y)\n @pixel = y * @rowstride + x * @n_channel\n if @tabPixel[@pixel+3] == 255\n @action.call\n end\n return @tabPixel[@pixel+3] == 255\n end",
"def insert(pixel, x, y)\n return \"Enter valid position\" unless inbounds?(x, y)\n matrix[x][y] = pixel\n end",
"def get x, y\n @pixels[pixel(x,y)]\n end",
"def point x, y, c\n screen[x, h-y] = color[c]\n end",
"def change_pixel_color(x, y)\n color = contents.get_pixel(x, y)\n color.red *= 2\n color.blue /= 2\n color.green /= 2\n contents.set_pixel(x, y, color)\n end",
"def turn(row, column)\n place_piece(row, column)\n puts display_board\n check_for_win() \n end",
"def update!(row = @row, col = @col)\n @cells[row][col] = yield at(row, col)\n end",
"def vision(row_offset, column_offset)\n vision_array[row_radius + row_offset][column_radius + column_offset]\n end",
"def insert(pixel, x, y)\n return nil if x > self.width || y > self.height\n @matrix[x][y] = pixel\n end",
"def color_pixel(x, y, color)\n return unless pixel_exists?(x, y)\n bitmap[y.to_i - 1][x.to_i - 1] = color\n end",
"def at(x, y)\n @codeGrid[y][x]\n end",
"def piece_at(position)\n row = position[0]\n col = position[1]\n @grid[row][col]\n end",
"def at_index(x,y)\n @board[x][y]\n end",
"def rect(col, row)\n row.times do |row_index|\n col.times do |col_index|\n @data[row_index][col_index] = true\n end\n end\n end",
"def draw_greyscale_pixel(col,row, teint)\n\t\t@image[ col,row ] = ChunkyPNG::Color.grayscale(teint)\t\t\n\tend",
"def pixel(x, y)\n validate_coordinates!(x, y)\n\n area.pixel(x, y).color\n end",
"def color_pixel(x, y, color)\n raise InvalidColorError.new(color) unless valid_color?(color)\n raise OutOfBoundsError.new(x.to_i, y.to_i, width, height) unless pixel_valid?(x.to_i, y.to_i)\n\n grid[y.to_i - 1][x.to_i - 1] = color\n end",
"def click(field, num_row, num_cols, given_i, given_j)\n queue = []\n \n if field[given_i][given_j] == 0\n field[given_i][given_j] = -2\n queue << [given_i, given_j]\n else\n return field\n end\n\n while !queue.empty?\n current_i, current_j = queue.shift[0], queue.shift[1]\n\n for i in (current_i - 1..current_i + 1)\n for j in (current_j - 1..current_j + 1)\n if (i >= 0 and i < num_rows) and (j >= 0 and j < num_cols) and field[i][j] == 0\n field[i][j] = -2\n queue << [i, j]\n end\n end\n end\n end\n field\nend",
"def map_pixels!(&blk)\n for y in 0...height do\n for x in 0...width do\n set_pixel(x, y, blk.call(get_pixel(x,y)))\n end\n end\n end",
"def color_row(col_start, col_end, row, color)\n (col_start..col_end).each do |x|\n color_pixel(x, row, color)\n end\n end",
"def draw \n\t\t@image.draw(@x, @y, 1)\n\tend",
"def draw\n @image.draw(@x, @y, 1)\n end",
"def execute(image:, x:, y:, colour:)\n unless image\n Log.instance.error 'There is no image present'\n return\n end\n\n image.colour(x, y, colour)\n image\n end",
"def draw_pixel(x, y, color)\n validate_coordinates!(x, y)\n validate_color!(color)\n\n area.draw_pixel(x, y, color)\n end",
"def draw_color_interpolated_pixel(col,row, teint)\n\t\t@image[ col,row ] = ChunkyPNG::Color.interpolate_quick(from_color, to_color, teint)\n\tend",
"def draw\n\t\t@image.draw(@x, @y, 1)\n\tend",
"def block_at(x, y)\n if x >= 0 && y >= 0 && x < @rows.length && y < @rows[x].size\n @rows[x][y]\n else\n nil\n end\n end",
"def blur(row_index,col_index)\n update_cell(row_index+1, col_index,1)\n update_cell(row_index,col_index+1, 1)\n update_cell(row_index,col_index-1, 1)\n update_cell(row_index-1, col_index,1)\n end",
"def color_row(col_start, col_end, row, color)\n (col_start..col_end).each do |x|\n color_pixel(x, row, color)\n end\n end",
"def col(p, r)\n x = p * (p - 1)\n r = p - r - 1 if p.odd?\n cell(x - r)\n end",
"def set x, y, color\n @pixels[pixel(x,y)] = color\n end",
"def at(row, column)\n # Add logic for this method, Remember to account for inbound & outbound checks.\n\tif (row > @rows-1)\n\t\tputs \"Row #{row} is out of bound\"\n\t\treturn\n\tend\n\tif (column > @columns-1)\n\t\tputs \"Column #{column} is out of bound\"\n\t\treturn\n\tend\n\tif @board[row][column].nil?\n\t\treturn \" \"\n\tend\n\treturn @board[row][column]\t\n end",
"def computer_fires(player_board)\n # require \"pry\"; binding.pry\n # player_board.cells.sampe.\n @fired_coord = player_board.cells.keys.sample\n player_board.cells[@fired_coord.to_sym].fire_upon\n @fired_coord\n # player_board.cells[@fired_coord].render\n end",
"def insert(pixel, x, y)\n x = validateX(x)\n y = validateY(y)\n @matrix[\"#{x}, #{y}\"] = pixel\n end",
"def insert(pixel, x, y)\n if @matrix[x] == nil\n @matrix[x] = []\n end\n @matrix[x][y] = pixel\n\n end",
"def change_bitmap_color(rect, x, y)\n xx = x + rect.x\n xy = y + rect.y\n xw = xx + rect.width\n xh = xy + rect.height\n (xx..xw).each { |i|\n (xy..xh).each { |j|\n change_pixel_color(i, j)\n }\n }\n end",
"def draw\n @img.draw(@x, @y, 2, 1.0, 1.0, @color)\n end",
"def rowAt(row)\n self.tiles[row.to_i * N_COLS, N_COLS]\n end",
"def draw\n @image.draw(@x - @width / 2, @y - @height / 2, 1)\n end",
"def drawPoint(pixbuf, x, y, r, g=0, b=0)\n stride = pixbuf.rowstride\n i = x * 3 + y * stride\n str = pixbuf.pixels\n str.setbyte(i+0, r)\n str.setbyte(i+1, g)\n str.setbyte(i+2, b)\n pixbuf.pixels = str\n end",
"def received_shot(row, column)\n\t\traise \"You have already been here.\" if been_here?(row, column)\n\t\treturn miss(row, column) if empty?(row, column) \n\t\thit(row,column) \n\tend",
"def cell(pos_x, pos_y)\n @board[pos_y][pos_x]\n end",
"def board(row:, column:)\n board_state[index_from_row_column(row, column)]\n end",
"def computer_shot(coordinate)\n human_player.board.cells[coordinate].fire_upon\n end",
"def point x, y, c\n screen[x, y] = color[c]\n end",
"def draw_image(image, x1, y1, c)\n end",
"def draw\r\n @image.bmp.draw(@x - @radius, @y- @radius, 1)\r\n end",
"def draw_vertical(col: 0, start_row: 0, end_row: 0, color: \"R\")\n image.map!.with_index do |row, row_num|\n row.map.with_index do |pixel, col_num|\n if (row_num >= start_row && row_num <= end_row) && (col == col_num)\n color\n else\n pixel\n end\n end\n end\n save_state\n self\n end",
"def set_neighbour_colour(col, row)\n xd = rand(2)\n @blocks[row][col] = @blocks[row - (1 - xd)][col - xd]\n end",
"def pieces_at(x, y)\n @board[x][y]\n end",
"def transform \n \n @pixel_location = get_pixel_points \n puts \"px loc : #{@pixel_location}\"\n \n while @pixel_location.size != 0 \n transform_pixel_points(@pixel_location)\n @pixel_location.shift\n @pixel_location.shift\n end\n end",
"def apply(matrix, line, column, value)\n matrix[line, column] = value\n end",
"def update args\n\n\t\t# Normalise the mouse position to the board origin\n\t\tmouse_x = ( ( args.inputs.mouse.x - @board_x ) / @cell_size ).floor\n\t\tmouse_y = ( ( args.inputs.mouse.y - @board_y ) / @cell_size ).floor\n\n\t\t# Handle if there's been a click, if we're still playing\n\t\tif !@victorious && ( @burniation == -1 ) && args.inputs.mouse.click\n\n\t\t\t# Save me some typing later on... ;-)\n\t\t\tcell_idx = (mouse_y*@width) + mouse_x\n\n\t\t\t# The user can do one of three things; click left, click right,\n\t\t\t# or click both. Somwhow we have to handle all of this!\n\t\t\tif mouse_x.between?( 0, @width-1 ) && mouse_y.between?( 0, @height-1 ) && args.inputs.mouse.button_left && args.inputs.mouse.button_right\n\n\t\t\t\t# Clear around an already-cleared cell\n\t\t\t\tif @cell_status[cell_idx] == :status_revealed\n\t\t\t\t\tuncover mouse_y, mouse_x, true\n\t\t\t\tend\n\n\t\t\t# If the user wants to add a gold pile to a covered cell, that's easy\n\t\t\telsif args.inputs.mouse.button_right\n\n\t\t\t\t# Needs to be on the board, and over a covered cell\n\t\t\t\tif mouse_x.between?( 0, @width-1 ) && mouse_y.between?( 0, @height-1 ) && @cell_status[cell_idx] != :status_revealed\n\n\t\t\t\t\t# We maintain a list of gold pile co-ordinates, and just toggle\n\t\t\t\t\t@cell_status[cell_idx] = ( @cell_status[cell_idx] == :status_gold ) ? :status_covered : :status_gold\n\n\t\t\t\tend\n\n\t\t\t# If the user clicks on the board, work out where.\n\t\t\telsif args.inputs.mouse.button_left\n\n\t\t\t\t# Obviously can only act if they're over the board\n\t\t\t\tif mouse_x.between?( 0, @width-1 ) && mouse_y.between?( 0, @height-1 )\n\n\t\t\t\t\t# If this is the first cell, spawn dragons!\n\t\t\t\t\tif !@spawned\n\t\t\t\t\t\tspawn_dragons mouse_y, mouse_x\n\t\t\t\t\tend\n\n\t\t\t\t\t# And then simply uncover the cell here\n\t\t\t\t\tuncover mouse_y, mouse_x\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t# Redraw the board\n\t\t\trender_board\n\n\t\tend\n\n\n\t\t# Check to see if they clicked on the restart button instead\n\t\tif args.inputs.mouse.x.between?( @label_x, @label_x + @label_width ) &&\n\t\t args.inputs.mouse.y.between?( @label_restart_y, @label_restart_y + @size_restart.y )\n\n\t\t\t# If the mouse is clicked down, we've clicked the button\n\t\t \tif args.inputs.mouse.down\n\t\t \t\t@restart_clicked = true\n\t\t \tend\n\n\t\t \tif @restart_clicked && args.inputs.mouse.up\n\t\t \t\t@restart_clicked = false\n\t\t \t\tsize\n\t\t \t\trender_board\n\t\t \tend\n\n\t\tend\n\n\t\t# Now check for end conditions; have we flagged all the dragons we seek?\n\t\tif ( @spawned ) && ( !@victorious) && ( @burniation == -1 ) &&\n\t\t ( @cell_status.count( :status_gold ) == @dragon_count )\n\n\t\t\t# Then automagically reveal all non-flagged cells\n\t\t\t@end_tick = args.tick_count\n\t\t\t@victorious = true\n\t\t\t@cell_status.map! { |cell|\n\t\t\t\tcell == :status_covered ? :status_revealed : cell\n\t\t\t}\n\n\t\t\t# Redraw the board\n\t\t\trender_board\n\n\t\tend\n\n\t\t# Have we revealed a dragon?!\n\t\tif @burniation == -1\n\t\t\t@dragons.each_with_index { |dragon, index|\n\t\t\t\tif ( dragon == DRAGON ) && ( @cell_status[index] == :status_revealed )\n\t\t\t\t\t@burniation = index\n\t\t\t\t\t@victorious = false\n\t\t\t\t\t@end_tick = args.tick_count\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\n\tend",
"def shoot(row,column)\n verify_shoot_location(row,column)\n @coords[row][column].get_shoot\n end",
"def []=(x, y, color)\n validate_x_y_coords(x, y)\n @pixels[y - 1][x - 1] = color\n end",
"def record_move(row, col, value)\n tile = @rows[row-1][col-1]\n tile.value = value\n tile\n end",
"def setFigureOnBoard(posx, posy, value)\r\n @board[posx][posy] = value\r\n @sumCol[posx] += value\r\n @sumRow[posy] += value\r\n @sumDiag[0] += value if posx == posy\r\n @sumDiag[1] += value if posx + posy == 2\r\n end",
"def move_to(row, col)\n @row, @col = wrap(row, col)\n end",
"def click(x, y)\n clicked = @board.click(x, y) == 'bomb'\n game_over if clicked == 'bomb'\n revealed if clicked == 'revealed'\n @board.print_board\n end",
"def at(row = @row, col = @col)\n row, col = wrap(row, col)\n return nil unless in_bounds?(row, col)\n\n @cells[row][col]\n end",
"def pixel_at x, y\n pixel_base = 3 * (@width * y + x)\n (0..2).map {|i| @data[ pixel_base + i] }\n end",
"def [](x, y)\n get_pixel_color(x, y)\n end",
"def toggle_cell(column, row)\n i = (row % ROWS) * ROWS + (column % COLUMNS)\n @cell_state[i] = (@cell_state[i] <= 0) ? 2 : -1\n end",
"def blur_coordinate(row_number, column_number, distance)\n @array.each_with_index do |row, other_row_number|\n row.each_with_index do |cell, other_column_number|\n manhattan_distance = calculate_manhattan_distance(\n row_number,\n column_number,\n other_row_number,\n other_column_number\n )\n\n should_we_blur_it = manhattan_distance <= distance\n\n if should_we_blur_it == true\n @array[other_row_number][other_column_number] = 1\n end\n end\n end\n\n # (1..distance).each do |delta_row|\n # (1..distance).each do |delta_col|\n # #right\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number + delta_row, column_number + delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number + delta_row][column_number + delta_col] = 1\n # end\n #\n # #up\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number - delta_row, column_number + delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number - delta_row][column_number + delta_col] = 1\n # end\n #\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number - delta_row, column_number - delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number - delta_row][column_number - delta_col] = 1\n # end\n #\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number + delta_row, column_number - delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number + delta_row][column_number - delta_col] = 1\n # end\n # end\n # end\n end",
"def get_row(row,board) # row(x,*y)\n\tboard[row]\nend",
"def get_value(row, col)\n @rectangle[row][col]\n end",
"def block(x, y)\n @rows[y][x] unless y >= @y or x >= @x or y < 0 or x < 0\n end",
"def shoot_at (player, x, y)\n\t\tplayer.board.grid[x][y].hit!\n\tend",
"def get_disc(row, col)\n @board[row * @size + col]\n end",
"def click(button, x, y)\n # Left Click: Bring a dead cell to life. \n if button == 1 \n x = x / @cell_width\n y = y / @cell_height\n @life.set_cell_alive! x, y\n self.draw\n # Right Click: Re-seed the grid.\n else\n randomize_cells!\n end\n end",
"def next_tile(col)\n result = nil\n (HEIGHT-1).downto(0) { |i|\n if self.board[i][col] == nil\n result = [i,col]\n break\n end\n }\n if result != nil \n r, c = result\n if not r.between?(0,HEIGHT-1) then raise PostconditionError, \"Row outside of range.\" end\n if not c.between?(0,WIDTH-1) then raise PostconditionError, \"Col outside of range.\" end\n end\n result\n end",
"def pixels; end",
"def blur!(distance = 1) #needs the !, is a bang, syntax is telling that is going to change the state of what we are operating on.\r\n distance.times do #looping for distance\r\n\r\n blur_pixels = coords # accessing array from previous method\r\n @array.each_with_index do |row, row_int|\r\n row.each_with_index do |int, col_index|\r\n blur_pixels.each do |row_int_coord, col_index_coord|\r\n\r\n if row_int == row_int_coord && col_index == col_index_coord\r\n # left of 1\r\n @array[row_int][col_index -1] = 1 unless col_index == 0\r\n # right of 1\r\n @array[row_int][col_index +1] = 1 unless col_index >= @col_length-1\r\n # above 1\r\n @array[row_int -1][col_index] = 1 unless row_int == 0\r\n # below 1\r\n @array[row_int +1][col_index] = 1 unless row_int >= @row_length-1\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end",
"def actuMap()\n 0.upto(@map.rows-1) do |x|\n 0.upto(@map.cols-1) do |y|\n\n if (@map.accessAt(x,y).value == 1)\n\n if @map.accessAt(x,y).color != nil\n if (@map.accessAt(x,y).color == @nbHypo + 1)\n @timePress[x][y] = 1\n @map.accessAt(x,y).color = @nbHypo\n end\n changeImage(@buttonTab[x][y],@tabCase[@map.accessAt(x,y).color])\n else\n changeImage(@buttonTab[x][y],\"../images/cases/blanc.png\" )\n @timePress[x][y] = 0\n end\n elsif @map.accessAt(x,y).value == 2\n changeImage(@buttonTab[x][y],\"../images/cases/croix.png\" )\n @timePress[x][y] = 0\n\n else\n ajoutLimitation(x,y)\n\n end\n\n end\n\n end\n end",
"def setrowcol r, c\n # aha ! here's where i can check whether the cursor is falling off the viewable area\n if c+@cols_panned < @orig_left\n # this essentially means this widget (button) is not in view, its off to the left\n $log.debug \" setrowcol OVERRIDE #{c} #{@cols_panned} < #{@orig_left} \"\n $log.debug \" aborting settrow col for now\"\n return\n end\n if c+@cols_panned > @orig_left + @display_w\n # this essentially means this button is not in view, its off to the right\n $log.debug \" setrowcol OVERRIDE #{c} #{@cols_panned} > #{@orig_left} + #{@display_w} \"\n $log.debug \" aborting settrow col for now\"\n return\n end\n super r+@rows_panned, c+@cols_panned\n end",
"def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end",
"def on_get_item_column_image(i, col)\n -1\n end",
"def transform(row_index,col_index)\n\n if row_index-1 >= 0\n @image[row_index-1][col_index] = 1\n end\n if col_index - 1 >= 0\n @image[row_index][col_index-1] = 1\n end\n if row_index + 1 <= @image.length - 1\n @image[row_index+1][col_index] = 1\n end\n if col_index + 1 <= @image[row_index].length - 1\n @image[row_index][col_index+1] = 1\n end\n\n end",
"def next_tile(col)\n result = nil\n (HEIGHT-1).downto(0) { |i|\n if @board[i][col] == nil\n result = [i,col]\n break\n end\n }\n if result != nil \n r, c = result\n if not r.between?(0,HEIGHT-1) then raise PostconditionError, \"Row outside of range.\" end\n if not c.between?(0,WIDTH-1) then raise PostconditionError, \"Col outside of range.\" end\n end\n result\n end",
"def set_pixel(x, y, value)\n ::GD2::GD2FFI.send(:gdImageSetPixel, @image_ptr, x.to_i, y.to_i, value.to_i)\n nil\n end",
"def tile(y, x, matrix)\n matrix[y - 1 .. y + 1].map {|line| line[x - 1 .. x + 1]}\n end",
"def [](row, col)\n #convert row values by * by 9\n @grid[row * 9 + col]\n end",
"def element_at(row_idx, column_idx)\n target_row = row_at(row_idx)\n target_row[column_idx]\n end",
"def [](row, column)\n\t\treturn nil unless row.between?(0, @rows-1)\n\t\treturn nil unless column.between?(0, @columns-1)\n\t\t@grid[row][column]\n\tend",
"def attack (row, col, grid)\n\t\t$error = 0\n\t\t$hit = 0\n\t\tif grid == 1\n\t\t\tgrid = $comp\n\t\t\tgridshow = $shots\n\t\telse\n\t\t\tgrid = $shot_at\n\t\t\tgridshow = $shot_at\n\n\t\tend\n\n\t\tgridshow\n\n\t\trow -=1\n\t\tcol -=1\n\n\t\tcase grid[row][col]\n\t\twhen 0\n\t\t\tgrid[row][col] = \"X\"\n\t\t\tgridshow[row][col] = \"X\"\n\n\t\t\tif grid == $comp\n\t\t\t\tputs \"You missed.\"\n\t\t\telse\n\t\t\t\tputs \"They missed!\"\n\t\t\tend\n\n\t\twhen 1\n\t\t\tif grid == $comp\n\t\t\t\tputs \"YOU HIT THEIR SHIP!\"\n\t\t\telse\n\t\t\t\tputs \" YOU HAVE BEEN HIT!\"\n\t\t\tend\n\t\t\tgrid[row][col] = \"*\"\n\t\t\tgridshow[row][col] = \"*\"\n\t\t\t$hit = 1\n\t\telse\n\t\t\twrong\n\t\t\t$error = 1\n\t\tend\n\tend",
"def cursor_value(row_idx: c_y, col_idx: c_x)\n map.value(row_idx, col_idx)\n end",
"def move!(row, column, icon)\n @row, @column, @icon = row, column, icon\n\n make_move!\n end"
] |
[
"0.64924747",
"0.6438124",
"0.6388152",
"0.63619256",
"0.6358999",
"0.63124216",
"0.63106084",
"0.62380743",
"0.6237493",
"0.6232126",
"0.6212054",
"0.6182094",
"0.6144389",
"0.61216664",
"0.6005289",
"0.5991073",
"0.59621125",
"0.5919221",
"0.59104174",
"0.5890347",
"0.58750963",
"0.58705944",
"0.5848772",
"0.5848533",
"0.58466643",
"0.58369994",
"0.5835834",
"0.5834695",
"0.5822825",
"0.581744",
"0.58096176",
"0.58080757",
"0.58076376",
"0.5804006",
"0.57869047",
"0.57832533",
"0.57505745",
"0.57448846",
"0.5724922",
"0.5715178",
"0.57149994",
"0.5708786",
"0.570703",
"0.5699908",
"0.56963664",
"0.568697",
"0.5676338",
"0.5665733",
"0.5659728",
"0.56526136",
"0.5641168",
"0.56408703",
"0.5625404",
"0.5623744",
"0.5616907",
"0.5614233",
"0.56133133",
"0.55944985",
"0.5593862",
"0.5586861",
"0.5568515",
"0.55636126",
"0.5560726",
"0.555908",
"0.55566657",
"0.5554691",
"0.55348164",
"0.55320436",
"0.5522592",
"0.5520594",
"0.55088866",
"0.5507404",
"0.5502746",
"0.5497986",
"0.5494271",
"0.54936296",
"0.5489678",
"0.54881895",
"0.54781795",
"0.54718006",
"0.5471702",
"0.546344",
"0.54577893",
"0.5457356",
"0.5453557",
"0.54453236",
"0.54439074",
"0.54432225",
"0.54429543",
"0.5440079",
"0.54333544",
"0.5433028",
"0.5432435",
"0.543242",
"0.5431191",
"0.5429768",
"0.5429038",
"0.54277265",
"0.54226196",
"0.5420486"
] |
0.7726494
|
0
|
turn on/off all LEDs
|
def all(action)
command "ALL,#{action.to_s.upcase}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def turn_on_leds\n @entry_led.on\n @exit_led.on \n end",
"def turnLightsOff\n @lightsOn = false\n end",
"def run\n led.on! # this does what you think it does\n sleep(1) # sleep for 1 second, kind of blunt, since it blocks everthing.\n led.off!\n sleep(1)\n end",
"def turn_on!\n @turned_off = false\n end",
"def led(on_off, duration_s=0)\n set_state(on_off, duration_s, {on: {on: 0}, off: {off: 0}})\n end",
"def toggle_on_or_off(lights)\n 1.upto(lights.size) do |round_number|\n lights.each do |position, value|\n if position % round_number == 0\n value == \"off\" ? lights[position] = \"on\" : lights[position] = \"off\"\n end\n end\n end\nend",
"def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n \n p \"Lights #{joinor(on_lights(lights))} are on\"\n p \"Lights #{joinor(off_lights(lights))} are off\"\nend",
"def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"def toggle(ul,lr)\r\n update_lights(ul,lr) do |i,j|\r\n if @lights[i][j] == 0\r\n \t@lights[i][j] = 1\t\t \r\n\t else\r\n\t @lights[i][j] = 0\r\n\t end\r\n end\r\n end",
"def turn_on!\n set_power!(:on)\n end",
"def turnLightsOn\n @lightsOn = true\n end",
"def lights_on(bool)\n if bool == true\n @lights = true\n end\n if bool == false\n @lights = false\n end\n end",
"def toggle(lights)\n\n # Using the #upto method, we're able to iterate through each round\n 1.upto(lights.size) do |round_number|\n\n # Next we want to toggle each light off and on\n lights.each do |position, value|\n if position % round_number == 0\n\n # We use a ternary operator here\n # If the current light has a value of \"off\", then the value\n # is set to \"on\".\n value == \"off\" ? lights[position] = \"on\" : lights[position] = \"off\"\n end\n end\n end\nend",
"def switch_light_off\n puts \"*** switch_light_off\"\n true\nend",
"def lights\n @lights = !@lights\n end",
"def lights(lights)\n if lights == \"on\"\n @lights = true\n elsif lights == \"off\"\n @lights = false\n end\n end",
"def toggle\n return enabled? ? disable : enable if index.nonzero?\n board.toggle(:all)\n end",
"def loop\n blink_twice if read_input button_one\n blink_three_times if read_input button_two\n button_three.read_and_toggle led # \n blink_three_times_basic if read_input button_four\n blink_with_a_twist if read_input button_five\n end",
"def allOff(sleepy = 0)\n @segments.each do |segment, pin|\n @io.write(pin, HIGH)\n sleep(sleepy)\n end\n end",
"def turn_off!\n set_power!(:off)\n end",
"def status_light_enabled=(enabled)\n send_device_message('SetLEDState', enabled ? 'On' : 'Off')\n end",
"def allOn (sleepy = 0) \n @segments.each do |segment, pin|\n @io.write(pin, LOW);\n sleep(sleepy)\n end\n end",
"def off\n GPIO.write \"gpio#{@number}/value\", \"0\"\n end",
"def toggle_off(outlet = 1)\n toggle(outlet, false)\n end",
"def toggle_on(outlet = 1)\n toggle(outlet, true)\n end",
"def blink(repeat=3, switched_on=0.25, switched_off=0.5)\n repeat.times do |n|\n on\n sleep switched_on\n off\n sleep switched_off\n end\n end",
"def turn_off_lights_for_listing\n http_request(\"#{@listing.smartthings_endpoint}/switches/off\", :put)\n end",
"def toggle_every_nth_light(lights, nth)\n lights.each do |position, state|\n if position % nth == 0\n lights[position] = (state == 'off') ? \"on\" : \"off\"\n end\n end\nend",
"def run\n if ldr.read < 70\n led.on!\n else\n led.off!\n end\n end",
"def set_leds(args)\n @leds[:advance] = args[:advance] unless args[:advance].nil?\n @leds[:play] = args[:play] unless args[:play].nil?\n @leds[:color] = args[:color] unless args[:color].nil?\n @leds[:intensity] = args[:intensity] unless args[:intensity].nil?\n led_bits = 0b00000000\n led_bits |= 0b00001000 if @leds[:advance]\n led_bits |= 0b00000010 if @leds[:play]\n \n write_chars([LEDS, led_bits, @leds[:color], @leds[:intensity]])\n end",
"def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end",
"def toggle_every_nth_light(lights, nth)\n lights.each do |position, state|\n if position % nth == 0\n lights[position] = (state == \"off\") ? \"on\" : \"off\"\n end\n end\nend",
"def toggle_every_nth_light(lights, nth)\n lights.each do |position, state|\n if position % nth == 0\n lights[position] = (state == \"off\") ? \"on\" : \"off\"\n end\n end\nend",
"def milight_on_full_brightness\n\t\t$bridge.all_on\n\t\tsleep(1)\n\t\t$bridge.brightness(25)\t\t\t\n\tend",
"def toggle(switches)\n 1.upto(1000) do |step|\n switches.map do |switch_num, on_or_off|\n if switch_num % step == 0\n switches[switch_num] = !on_or_off\n end\n end\n end\nend",
"def toggle\n if on?\n off\n else\n on\n end\n end",
"def light_switcher(lights)\n 1.upto(lights.size) do |light_num|\n 1.upto(lights.size) do |num|\n if num % light_num == 0\n lights[num] == \"off\" ? lights[num]=\"on\" : lights[num]=\"off\"\n end\n end\n end\n lights\nend",
"def initialize_leds\n @entry_led = PiPiper::Pin.new(:pin => @pins[:entry_error], :direction => :out) \n @exit_led = PiPiper::Pin.new(:pin => @pins[:exit_error], :direction => :out) \n turn_on_leds\n end",
"def off!\n set(:on => false)\n end",
"def manage_buttons\n bootup\n @@pin=PiPiper::Pin.new(:pin => 23, :pull => :up)\n @@led=PiPiper::Pin.new(:pin => 18, :direction => :out)\n @@led.on\n @@t=Time.now\n PiPiper.watch :pin => 23,:trigger => :falling , :pull => :up do\n #puts \"Button pressed changed from #{last_value} to #{value}\"\n #puts \".\"\n @@t=Time.now\n end\n PiPiper.watch :pin => 23,:trigger => :rising , :pull => :up do\n delta = Time.now.to_f - @@t.to_f\n @@t = Time.now\n EstormLottoGem::Button.led_mgr(EstormLottoGem::Button.tap()) if 0.03 <= delta and delta < 0.7\n EstormLottoGem::Button.led_mgr(EstormLottoGem::Button.held()) if 2 < delta and delta < 20\n #puts \"debounce\" if 0.1 > delta\n end\n sleep 5\n \n @@led.off\n @@t=Time.now\n PiPiper.wait\n end",
"def turn_on\n unless on?\n set_attribute('PIO', 1)\n end\n end",
"def on\n pwm(0xff)\n end",
"def locator_led_off(handle:, **kwargs)\n if _is_valid_arg(\"chassis_id\", kwargs)\n _set_chassis_locator_led_state(handle, false, kwargs)\n end\n\n if _is_valid_arg(\"server_id\", kwargs) or \\\n handle.platform == IMC_PLATFORM::TYPE_CLASSIC\n _set_server_locator_led_state(handle, false, kwargs)\n end\nend",
"def stop_all!\n @devices.each(&:stop!)\n end",
"def switch_light_on\n puts \"*** switch_light_on\"\n true\nend",
"def toggle\n set_switch(!self.switch) if @switch\n end",
"def turn_off\n if on?\n set_attribute('PIO', 0)\n end\n end",
"def off\n @level = 0\n puts \"Light is off\"\n end",
"def off\n @level = 0\n puts \"Light is off\"\n end",
"def toggle_state\n puts \"******* toggle_state *******\"\n end",
"def toggle_off\n set_state_to(:off)\n end",
"def blink_on\n unless @_blink\n @_blink = true\n @_blink_count = 0\n end\n end",
"def off_for(seconds=1)\n off\n sleep seconds\n on\n end",
"def lights\n\n @lights = !@lights\n if @lights\n \"The lights are on\"\n else\n \"The lights are off\"\n end\n\n end",
"def off!\n digital_write(:off)\n end",
"def off\n pwm(0x00)\n end",
"def clear\n closed!\n @leds.fill 0\n self\n end",
"def turn_off_all\n return if running?\n @competition.turn_off_all\n end",
"def control_light\n if @is_toggled\n @is_emitting_light = true\n else\n @is_emitting_liht = false\n end\n end",
"def turn_on #turn the power on\n @power = true\n end",
"def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end",
"def powerOn()\n #ns = @topo.nodeSetDecl\n # Check that EC is NOT in 'Slave Mode' - If so call CMC to switch node(s) ON\n #if !NodeHandler.SLAVE_MODE()\n # CMC.nodeSetOn(ns)\n #end\n # Now set the state of each node to ON\n eachNode { |n|\n n.powerOn()\n if NodeHandler.JUST_PRINT\n n.checkIn(n.nodeId, '1.0', 'UNKNOWN')\n n.heartbeat(0, 0, Time.now.to_s)\n end\n }\n end",
"def execute\n light.off\n end",
"def on\n GPIO.write \"gpio#{@number}/value\", \"1\"\n end",
"def control_light\n if @is_toggled\n @is_emitting_light = true\n else\n @is_emitting_light = false\n end\n end",
"def toggle_motor\n joint.enableMotor(!joint.isMotorEnabled)\n end",
"def switch_off(except)\n\t\tunless self.name == except\n\t\t\t#puts \"switching off : #{self.name}\"\n\t\t\tself.state = \"off\"\n\t\tend\n\t\tself.components.each do |c|\n\t\t\tc.switch_off(except)\n\t\tend\n\tend",
"def reset_arduino\n @sp.dtr = 0\n @sp.rts = 0\n sleep(0.2)\n @sp.dtr = 1\n @sp.rts = 1\n sleep(0.3) #give the arduino some startup time\n end",
"def reset\n # Leave the RST pin high for a bit, then pulse the RST pin low for 4ms.\n RPi::GPIO.set_high @rst\n sleep 0.200\n RPi::GPIO.set_low @rst # resets the panel.\n sleep 0.004\n RPi::GPIO.set_high @rst\n end",
"def toggle_up(ul,lr)\r\n update_lights(ul,lr) do |i,j|\r\n\t @lights[i][j] += 2\r\n end\r\n end",
"def turn_on\n connections.each(&:disconnect)\n @connections = []\n end",
"def switch_off port=-1\n run(:func => \"relayWrite\", :port => port, :value => 0)\n end",
"def blink; end",
"def blink; end",
"def toggle_every_nth_light(lights, nth) # works for 1st, 2nd, 3rd, etc for all cases\n lights.each do |position, state| # for each key-value pair\n if position % nth == 0 # if position hits what the nth selection criteria is\n lights[position] = (state == \"off\") ? \"on\" : \"off\" # then switch is flipped\n end\n end\nend",
"def toggle(switch)\n switch == 1 ? 0 : 1\nend",
"def switch_off(multi, pin)\n\t\t\tsuccess, message = $redis.set_actuator_state(multi, pin, 0)\n\t\t\tputs success ? \"OK\" : \"KO : #{message}\"\n\t\tend",
"def toggle_turn\n if @turn == 0\n @turn = 1\n else\n @turn = 0\n end\nend",
"def on\n @is_on = true\n connection.set_pin_mode(pin, Firmata::Board::OUTPUT)\n connection.digital_write(pin, Firmata::Board::HIGH)\n end",
"def enable_all(b = true)\n @enable_all = b\n end",
"def put_all_pin_states\n dut.rtl_pins.each do |name, pin|\n pin.reset_simulator_state\n pin.update_simulation\n end\n end",
"def put_all_pin_states\n dut.rtl_pins.each do |name, pin|\n pin.reset_simulator_state\n pin.update_simulation\n end\n end",
"def white_light\n @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00])\n\n self\n end",
"def blink_off\n if @_blink\n @_blink = false\n self.color.set(0, 0, 0, 0)\n end\n end",
"def initialize_lcd\n\t\tfunction_set(1, 1, 0)\n\t\tsleep 4.1e-3\n\t\tfunction_set(1, 1, 0)\n\t\tsleep 100e-6\n\t\tfunction_set(1, 1, 0)\n\t\tfunction_set(1, 1, 0)\n\t\tdisplay_on_off_control(1, 0, 0)\n\t\tclear\n\tend",
"def lights\n @lights ||= add_all_lights\n end",
"def lights\n @lights ||= add_all_lights\n end",
"def switch_lights(lights_hash)\n 1.upto(lights_hash.length) do |count|\n lights_hash.each do |light_num, position|\n if light_num % count == 0\n lights_hash[light_num] == 'off' ? lights_hash[light_num] = 'on' : lights_hash[light_num] = 'off'\n end \n end\n end\nend",
"def toggle_lights(number_of_lights)\n # initialize the lights hash\n lights = {}\n 1.upto(number_of_lights) do |num|\n lights[num] = false\n end\n # toggle every nth light in the lights hash\n 1.upto(number_of_lights) do |num|\n lights.each do |position, state|\n lights[position] = !state if position % num == 0\n end\n end\n # return list of light numbers that are on\n lights.select { |_position, state| state == true }.keys\nend",
"def turn_on()\n 'Turn on the #{model}<br>' \\\n 'If the thermocycler is off, toggle the power switch in the back of the instrument'\n end",
"def switch_on(multi, pin)\n\t\t\tsuccess, message = $redis.set_actuator_state(multi, pin, 1)\n\t\t\tputs success ? \"OK\" : \"KO : #{message}\"\n\t\tend",
"def on\n set_power(\"on\", \"smooth\",1000)\n end",
"def turned_off(options = {})\n turn_off!(options)\n\n begin\n yield\n ensure\n turn_on!\n end\n end",
"def enable(thing)\n toggle.enable(thing)\n end",
"def off\n @is_on = false\n connection.set_pin_mode(pin, Firmata::Board::OUTPUT)\n connection.digital_write(pin, Firmata::Board::LOW)\n end",
"def change_obstacle_states\n @linked_obstacles.each do |i|\n i.switch_state\n end\n end",
"def switch_lights(n)\n switches = Array.new(n, 'off')\n divisor = 1\n until divisor > switches.size\n switches.each_with_index do |light, indx|\n light_number = indx + 1\n if (light_number % divisor).zero?\n switches[indx] = 'on' if light == 'off'\n switches[indx] = 'off' if light == 'on'\n end\n end\n divisor += 1\n end\n switches\nend",
"def antenna(set)\n if set\n turn_antenna_on\n else\n turn_antenna_off\n end\n end",
"def light(action = :toggle)\n case action\n when :on, :off\n @elements.light.values.each { |element| element.public_send(action) if element.respond_to? action }\n when :toggle\n light_off? ? light(:on) : light(:off)\n end\n end",
"def blink(ton, toff=nil, ion=0xff, ioff=0x00)\n if (@ton && @off)\n toff = ton unless toff\n regdata = @@i2c.read(0x08, 1)\n @@i2c.write([0x08, regdata[0] | (1 << @id)])\n @@i2c.write([@ion, ion])\n @@i2c.write([@ton, ton])\n @@i2c.write([@off, (toff << 3) | (ioff & 0b00000111)])\n @@i2c.write([0x08, regdata[0] & ~(1 << @id)])\n end\n end"
] |
[
"0.8040124",
"0.72063804",
"0.7053904",
"0.69508684",
"0.6896147",
"0.68635553",
"0.6804198",
"0.67947173",
"0.67947173",
"0.6634929",
"0.65866333",
"0.6558669",
"0.6516391",
"0.64706",
"0.6415433",
"0.6318651",
"0.6242476",
"0.62194043",
"0.6210693",
"0.6201556",
"0.6179231",
"0.6164163",
"0.61533266",
"0.6142697",
"0.6134525",
"0.61295176",
"0.6123509",
"0.6108233",
"0.6071569",
"0.6071397",
"0.6064145",
"0.60613716",
"0.60601056",
"0.60601056",
"0.6044256",
"0.6034136",
"0.6025957",
"0.6017157",
"0.5988128",
"0.59449214",
"0.59388435",
"0.5917862",
"0.59071106",
"0.59046245",
"0.5889287",
"0.5870822",
"0.58562034",
"0.5851957",
"0.58507556",
"0.58507556",
"0.583858",
"0.58258826",
"0.5823605",
"0.58210325",
"0.58036405",
"0.57856864",
"0.5783479",
"0.5777019",
"0.57670546",
"0.5763466",
"0.5755619",
"0.57544386",
"0.5742195",
"0.5738454",
"0.57009375",
"0.569245",
"0.5687894",
"0.5672913",
"0.5653936",
"0.56400216",
"0.56207955",
"0.56135875",
"0.5584012",
"0.55838174",
"0.55838174",
"0.5582371",
"0.557147",
"0.55694747",
"0.5554974",
"0.5541568",
"0.55386955",
"0.55340517",
"0.55340517",
"0.55221283",
"0.55020654",
"0.5485056",
"0.5481901",
"0.5481901",
"0.548169",
"0.5470977",
"0.5444597",
"0.5409208",
"0.5396967",
"0.5385633",
"0.5381368",
"0.5375728",
"0.5356712",
"0.53515357",
"0.53465986",
"0.5344797",
"0.53436935"
] |
0.0
|
-1
|
scroll to left or right with given offset
|
def scroll(offset)
command "SCROLL#{offset}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scroll_left (x1,x2,y1,y2)\r\n #driver.swipe(start_x: 1000, end_x: 100, start_y: y, end_y: y, duration: 1000)\r\n #driver.swipe(start_x: x1, end_x: x2, start_y: y1, end_y: y2, duration: 1000)\r\n scroll_in_any_direction(x1,x2,y1,y2)\r\n end",
"def cursor_scroll_dn\n moveto(pos() + MSCROLL)\nend",
"def cursor_scroll_dn\n moveto(pos() + MSCROLL)\nend",
"def scroll_by(delta_x, delta_y, device: T.unsafe(nil)); end",
"def scroll_left\n self.scroll[:x]\n end",
"def scroll_to(top, left)\n tap { @page.execute(\"window.scrollTo(#{top}, #{left})\") }\n end",
"def scroll x, y\n `window.scrollTo(x, y)`\n end",
"def start_scroll_towards(x, y, nb_steps, easing_function)\n initial = Point.new(@display_x, @display_y, scrollable_rect)\n target = Point.new(x, y, scrollable_rect)\n\n return if initial.eql? target\n\n nb_steps += 1\n\n if (initial.x == target.x)\n step_variation = Easing.tween(initial.y, target.y,\n nb_steps, easing_function)\n @scroll_function = build_scroll_function(target, nb_steps) do |i|\n Point.new(initial.x, step_variation.call(i), scrollable_rect)\n end\n else\n linear_interpolant = Point.linear_interpolant(initial, target)\n direction = (target.x < initial.x) ? -1 : 1\n distance = (initial.x - target.x).abs\n x_step = Easing.tween(0, distance, nb_steps, easing_function)\n x_variation = lambda { |i| initial.x + direction * x_step.call(i) }\n\n @scroll_function = build_scroll_function(target, nb_steps) do |i|\n x = x_variation.call(i)\n y = linear_interpolant.call(x)\n Point.new(x, y, scrollable_rect)\n end\n end\n\n @scroll_rest = nb_steps\n end",
"def scroll_right(distance)\n if loop_horizontal?\n @display_x += distance\n @display_x %= @map.width * 256\n @parallax_x += distance\n else\n last_x = @display_x\n @display_x = [@display_x + distance, (width - 17) * 256].min\n @parallax_x += @display_x - last_x\n end\n end",
"def scroll_forward\n #@oldindex = @current_index\n @current_index += @scrollatrows\n @prow = @current_index - @scrollatrows\n end",
"def scroll(x, y)\r\n @scroll_x = x\r\n @scroll_y = y\r\n end",
"def scroll_to text\n args = 'scroll',\n # textContains(text)\n [ [3, text] ],\n # descriptionContains(text)\n [ [7, text] ]\n\n mobile :find, args\n end",
"def scroll_forward\n @oldindex = @current_index\n @current_index += @scrollatrows\n @prow = @current_index - @scrollatrows\n end",
"def cursor_scroll_dn\n @cursor_movement = :down\n @old_cursor = @cursor\n move_to(pos + MSCROLL)\nend",
"def scroll_to element\n element.ancestor(:scroll_area).scroll_to element\n end",
"def scroll_into_view(locator, align_to = true)\n execute_script(\n 'arguments[0].scrollIntoView(arguments[1]);',\n find_element(locator),\n align_to\n )\n end",
"def xview_scroll(number, what)\n execute(:xview, :scroll, number, what)\n end",
"def scrollLeft\n `#{@el}.scrollLeft`\n end",
"def scroll_to_exact text\n args = 'scroll',\n # text(text)\n [ [1, text] ],\n # description(text)\n [ [5, text] ]\n\n mobile :find, args\n end",
"def scroll_left\n s = @scroll_unit + $multiplier\n $log.debug \" scroll_left #{s} m: #{$multiplier} \"\n $multiplier = 0\n #return false if !validate_scroll_col(@pmincol - s)\n if !validate_scroll_col(@pmincol - s)\n @pmincol = 0\n @cols_panned = 0 \n else\n @pmincol -= s # some check is required or we'll crash\n @cols_panned += s\n end\n @window.modified = true\n return 0\n end",
"def scroll_to(element, device: T.unsafe(nil)); end",
"def scroll_to(locator)\n script = 'arguments[0].scrollIntoView(true);'\n\n Capybara.current_session.driver.browser.execute_script(script, locator.native)\n end",
"def scroll_to_index(p_idx)\n\t\t\t@shell_tree_view.selectionModel.select(p_idx, Qt::ItemSelectionModel::ClearAndSelect)\n\t\t\t@shell_tree_view.selectionModel.setCurrentIndex(p_idx, Qt::ItemSelectionModel::ClearAndSelect)\n\t\t\t@shell_tree_view.scrollTo(p_idx, Qt::AbstractItemView::PositionAtCenter)\n\t\t\t@shell_tree_view.setFocus(Qt::TabFocusReason)\t\t\t\t\n\t\tend",
"def scroll_left(distance)\n if loop_horizontal?\n @display_x += @map.width * 256 - distance\n @display_x %= @map.width * 256\n @parallax_x -= distance\n else\n last_x = @display_x\n @display_x = [@display_x - distance, 0].max\n @parallax_x += @display_x - last_x\n end\n end",
"def scroll_to(element, x = 0, y = 0, device: nil)\n scroll(x, y, origin: ScrollOrigin.element(element, 0, 0), device: device)\n end",
"def xview_scroll(number, what)\n execute_only(:xview, :scroll, number, what)\n end",
"def scroll_into_view\n @subject.location_once_scrolled_into_view\n\n element_location = location\n scroll_position = @driver.scroll_position\n\n middle_y_bounds = scroll_position[:y] + @driver.inner_window_height / 2\n\n if middle_y_bounds > element_location.y\n # Add\n y_difference = middle_y_bounds - element_location.y\n scroll_y_position = scroll_position[:y] - y_difference\n else\n # Subtract\n y_difference = element_location.y - middle_y_bounds\n scroll_y_position = scroll_position[:y] + y_difference\n end\n\n # Get the element to halfway\n scroll_x_position = element_location.x.to_f\n\n javascript_string = \"return window.scroll(#{scroll_x_position}, #{scroll_y_position});\"\n @driver.execute_script(javascript_string)\n end",
"def right_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n action.move_to(element, x, y).context_click.perform\n end",
"def scroll_to_element(access_type, access_name)\n ele_scroll = $driver.find_element(:\"#{access_type}\" => \"#{access_name}\")\n ele_scroll.location_once_scrolled_into_view\nend",
"def move_to(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n\n action\n .move_to(element, x, y)\n .perform\n end",
"def scroll\n @scroll\n end",
"def scroll_to(element)\n @driver.execute_script(\"arguments[0].scrollIntoView();\", element)\nend",
"def scroll_menu_to element\n element.ancestor(:menu).scroll_to element\n end",
"def scroll_to(element, device: nil)\n scroll(origin: element, device: device)\n end",
"def scroll_down(amount)\n $driver.execute_script(\"window.scrollBy(0,#{amount});\")\n end",
"def goto_line pos\n pages = ((pos * 1.00) / @pagesize).ceil\n pages -= 1\n @sta = pages * @pagesize + 1\n @cursor = pos\nend",
"def scroll_to_exact(text)\n err = nil\n w_s = window_rect\n\n (1..30).each do |_count|\n action\n .move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number\n .pointer_down(:left)\n .move_to_location(0, w_s.height / 5)\n .release\n .perform\n sleep 1 # we must wait finish scrolling\n\n return text_exact(text)\n rescue StandardError => e\n err = e\n end\n\n raise err\n end",
"def scroll_by(x = 0, y = 0, device: nil)\n scroll(x, y, origin: ScrollOrigin.viewport(0, 0), device: device)\n end",
"def scroll_page(to)\n if to == 'end'\n $driver.execute_script('window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight));')\n elsif to == 'top'\n $driver.execute_script('window.scrollTo(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight),0);')\n else\n raise \"Exception : Invalid Direction (only scroll \\\"top\\\" or \\\"end\\\")\"\n end\nend",
"def right\n `#{clientRect}.right` + Window.scrollX\n end",
"def yview_scroll(number, what)\n execute_only(:yview, :scroll, number, what)\n end",
"def cursor_left(wrap)\n if @index % 10 > 0\n @index -= 1\n elsif wrap\n @index += 9\n end\n end",
"def scroll_by(delta_x, delta_y, device: nil)\n scroll(delta_x: delta_x, delta_y: delta_y, device: device)\n end",
"def cursor_right(wrap)\n if @index % 10 < 9\n @index += 1\n elsif wrap\n @index -= 9\n end\n end",
"def scroll_page(to)\n if to==\"end\"\n $driver.execute_script(\"window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight));\")\n elsif to==\"top\"\n $driver.execute_script(\"window.scrollTo(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight),0);\") \n else\n raise \"Exception : Invalid Direction (only scroll \\\"top\\\" or \\\"end\\\")\"\n end\nend",
"def goto_line pos\n pos = pos.to_i\n pages = ((pos * 1.00)/$pagesize).ceil\n pages -= 1\n $sta = pages * $pagesize + 1\n $cursor = pos\nend",
"def move_to(x, y)\n cur_page.move_to(x, y)\n end",
"def scroll_down(n); puts \"\\e[#{n}T\" end",
"def scroll_to_element(access_type,access_name)\n ele_scroll = WAIT.until {$driver.find_element(:\"#{access_type}\" => \"#{access_name}\")}\n ele_scroll.location_once_scrolled_into_view\nend",
"def next_offset\n next_offset = offset + limit\n return nil if next_offset >= total\n\n next_offset\n end",
"def move_to(point)\n offset(point.x - @left, point.y - @top)\n end",
"def scroll_to(section)\n case section\n when :bottom\n @driver.execute_script('window.scrollBy(0,9999)')\n when :top\n @driver.execute_script('window.scrollBy(0,-9999)')\n else\n nil\n end\n sleep(1)\n end",
"def cursor_down(wrap)\n if @index < 80\n @index += 10\n elsif wrap\n @index -= 80\n end\n end",
"def ListView_Scroll(hwndLV, dx, dy) send_listview_message(hwndLV, :SCROLL, wparam: dx, lparam: dy) end",
"def calculateOffset(index, offset)\n index += offset\n index -= 26 while index >= 26 # keep subtracting until we get to the right range\n index\n end",
"def scroll_step\r\n @options[:scroll_step]\r\n end",
"def scroll_to_elem(by, value)\n elem = get_element(by, value)\n elem.location_once_scrolled_into_view\n sleep 0.3\n end",
"def scroll_action(x, duration)\n width = (x * 2)\n move = SKAction.moveByX(-width, y: 0, duration: duration * width)\n reset = SKAction.moveByX(width, y: 0, duration: 0)\n\n SKAction.repeatActionForever(SKAction.sequence([move, reset]))\n end",
"def scroll_action(x, duration)\n width = (x * 2)\n move = SKAction.moveByX(-width, y: 0, duration: duration * width)\n reset = SKAction.moveByX(width, y: 0, duration: 0)\n\n SKAction.repeatActionForever(SKAction.sequence([move, reset]))\n end",
"def set_right_start_point\n @leading_x = 0\n @leading_y = find_right_entry\n end",
"def move_to_start\n @cursor = 0\n end",
"def move_to_start\n @cursor = 0\n end",
"def move_to_element(element)\n driver.execute_script('arguments[0].scrollIntoView(true)', element)\n end",
"def offset_on_line(offset)\n @locator.offset_on_line + @leading_line_offset\n end",
"def scrollDown\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, h-20, 0, Qt::LEFT_BUTTON)\n end",
"def scroll_fanzons_list_content_300_px\n\n page.execute_script(\"$('ul[data-results]').scrollTop('300')\")\n\n end",
"def set_offset(offset)\n @offset = offset\n self\n end",
"def start_scroll(direction, distance, speed)\n @scroll_direction = direction\n @scroll_rest = distance * 256\n @scroll_speed = speed\n end",
"def scroll_down\r\n $driver.swipe(start_y: 0.9, end_y: 0.5, start_x: 0.9, end_x: 0.9, duration: 800)\r\n end",
"def handle_scroll(opt)\n\n end",
"def scroll(delta)\n @scroll_position += delta\n if @scroll_position < 0\n @scroll_position = 0\n elsif @scroll_position >= @messages.size\n @scroll_position = @messages.size - 1\n end\n\n render\n end",
"def offset(offset)\n self.query.offset = offset\n self\n end",
"def scroll(widget, scroll_buffer)\n if widget[0].size > widget[3] and widget[1] != scroll_buffer\n str, scroll_pos, start_pos, length = *widget\n write_lcd (str[scroll_pos-1, str.size]), start_pos, (length + start_pos - 1)\n scroll_buffer = widget[1]\n end\n return widget[1]\nend",
"def go_left(length)\r\n go_to(@location.x - length, @location.y)\r\n end",
"def scroll_window_down num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n @prow += num\n if @prow > @current_index\n @current_index += 1\n end\n #check_prow\n $multiplier = 0\n end",
"def scroll_window_down num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n @prow += num\n if @prow > @current_index\n @current_index += 1\n end\n #check_prow\n $multiplier = 0\n end",
"def scroll_down(*args, &block)\n max_oy = contents_height - maqj_visible_height\n dest = ((@dest_scroll_oy / line_height) + 1)*line_height\n @dest_scroll_oy = [dest, max_oy].min\n end",
"def goto_line pos\n pages = ((pos * 1.00)/$pagesize).ceil\n pages -= 1\n #$sta = pages * $pagesize + 1\n $sta = pages * $pagesize + 0\n $cursor = pos\n #$log.debug \"XXX: GOTO_LINE #{$sta} :: #{$cursor}\"\nend",
"def next_slide\n switch_to_current_frame\n body = $driver.find_element(:tag_name => \"body\")\n $driver.mouse.move_to(body, 3*body.size.width/4, body.size.height/4)\n $driver.mouse.down\n $driver.mouse.move_by(-body.size.width/2, 0)\n $driver.mouse.up\n sleep(1)\n switch_to_current_frame\n end",
"def pos_on_line(offset)\n end",
"def move_by(dx, dy)\n cur_page.move_by(dx, dy)\n end",
"def scroll_down(distance = 1)\n ConsoleGlitter.escape(\"#{distance}T\")\n end",
"def scroll_and_touch(element, options = {})\n scroll_until_i_see(element, options)\n touch(element)\n end",
"def cursor_move_right\n @cursor_position += 1 if self.cursor_can_move_right?\n self.reset_cursor_blinking\n end",
"def search_goto_pos line, leftcol, rightcol\n search_goto_line line\n\n if rightcol > self.rightcol # if it's occluded...\n jump_to_col [rightcol - buffer.content_width + 1, 0].max # move right\n end\n end",
"def scroll(id); det.image(:index, \"#{id}\"); end",
"def scroll_down(lines = 1)\n @lines.each { |spr| spr.move_down(lines) }\n end",
"def right_offset(right_offset)\n if(right_offset.nil? || !right_offset.is_a?(Integer) || right_offset < 0)\n raise ArgumentError.new 'Right offset only accepts positive integers.'\n end\n\n @right_offset = right_offset\n return self\n end",
"def change_offset(working_offset, state)\n if state.offset > working_offset\n working_offset\n else\n state.offset = state.next_offset\n end\n end",
"def scroll_into_view(element)\n script = <<-JS\n arguments[0].scrollIntoView(true);\n JS\n\n page.execute_script(script, element.native)\nend",
"def scroll_element(element)\n execute_script('arguments[0].scrollIntoView(true);', element)\n highlight_element(element)\n end",
"def ctrlAutoScrollRewind _args\n \"ctrlAutoScrollRewind _args;\" \n end",
"def seek_forward(amount = opts[:seek_size])\n seek_by(amount)\n end",
"def scrollTop\n `#{@el}.scrollTop`\n end",
"def scroll_down_one_page\n @automation_element.get_current_pattern(System::Windows::Automation::ScrollPattern.pattern).scroll_vertical(System::Windows::Automation::ScrollAmount.LargeIncrement)\n end",
"def begin; pager.offset page; end",
"def cursor_up(wrap)\n if @index >= 10\n @index -= 10\n elsif wrap\n @index += 80\n end\n end",
"def scroll_backward\n #@oldindex = @current_index\n @current_index -= @scrollatrows\n @prow = @current_index - @scrollatrows\n end",
"def left\n `#{clientRect}.left` + Window.scrollX\n end",
"def offset_on_line(offset)\n end"
] |
[
"0.7063579",
"0.644053",
"0.644053",
"0.63071156",
"0.63048923",
"0.6162941",
"0.6085208",
"0.6039461",
"0.6001291",
"0.5989853",
"0.59657437",
"0.59635425",
"0.5923462",
"0.5914706",
"0.5900576",
"0.5881104",
"0.5848924",
"0.58294195",
"0.58241266",
"0.5806432",
"0.5788537",
"0.5783654",
"0.57794684",
"0.57717973",
"0.57619154",
"0.57609326",
"0.5719065",
"0.56773543",
"0.5671596",
"0.5669642",
"0.56573033",
"0.5653263",
"0.5645852",
"0.5616339",
"0.56127065",
"0.56118286",
"0.56082344",
"0.55960095",
"0.55678636",
"0.55672914",
"0.55651706",
"0.5564388",
"0.55563533",
"0.55381536",
"0.5532005",
"0.5530681",
"0.5517493",
"0.547525",
"0.5472193",
"0.5471336",
"0.54703903",
"0.54371744",
"0.54296446",
"0.54024833",
"0.54008305",
"0.53826183",
"0.53749335",
"0.53571486",
"0.53571486",
"0.5350063",
"0.5346414",
"0.5346414",
"0.53353363",
"0.53336227",
"0.53303885",
"0.532908",
"0.532741",
"0.53267545",
"0.5312552",
"0.5283772",
"0.52654094",
"0.5251553",
"0.5251309",
"0.52501833",
"0.5248729",
"0.5248729",
"0.5247514",
"0.5236158",
"0.5233076",
"0.5232432",
"0.5229311",
"0.5226267",
"0.5221544",
"0.5220597",
"0.5209121",
"0.5192399",
"0.519228",
"0.51916254",
"0.51798713",
"0.51785976",
"0.5171142",
"0.51683265",
"0.5165864",
"0.5160609",
"0.5160224",
"0.5151514",
"0.51449823",
"0.5144308",
"0.5129815",
"0.5124371"
] |
0.7441704
|
0
|
print a character at given column/row
|
def char(column, row, char)
command "T#{column},#{row},#{char}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def char_at(column)\n line[column, 1]\n end",
"def print_char (i, j, s)\n if maze_mat[i][j] == 1\n print s\n else\n print \" \"\n end\n end",
"def move_to_column(x); puts \"\\e[#{x}F\" end",
"def display(line, column=0)\n result = \"\\e[s\"\n result << \"\\e[#{line.to_i};#{column.to_i}H\"\n result << to_s\n result << \"\\e[u\"\n result\n end",
"def cursor_at(row, col)\n \"\\e[#{row};#{col}H\"\nend",
"def print_cell(x,y)\n puts @maze[x][y]\n end",
"def at(row, column)\n # Add logic for this method, Remember to account for inbound & outbound checks.\n\tif (row > @rows-1)\n\t\tputs \"Row #{row} is out of bound\"\n\t\treturn\n\tend\n\tif (column > @columns-1)\n\t\tputs \"Column #{column} is out of bound\"\n\t\treturn\n\tend\n\tif @board[row][column].nil?\n\t\treturn \" \"\n\tend\n\treturn @board[row][column]\t\n end",
"def display_col(col)\r\n\r\n print \"Column #{col}: \"\r\n @bingo_board[@cols.index(col)].each {|num| print \"#{num} \"}\r\n puts\r\n\r\n end",
"def column(position)\n ConsoleGlitter.escape(\"#{position}G\")\n end",
"def display(line, column=0) #:yield:\n result = \"\\e[s\"\n result << \"\\e[#{line.to_i};#{column.to_i}H\"\n if block_given?\n result << yield\n result << \"\\e[u\"\n #elsif string\n # result << string\n # result << \"\\e[u\"\n end\n result\n end",
"def get_print_char x,y, leer = nil, one = 'X', two = 'O'\n\n #return \"@\" if @field[x][y].winner\n\n case @field[x][y].player\n when 1 then one\n when 2 then two\n else\n if leer.nil? then\n $keymap.invert[[x,y]].to_s\n else\n leer\n end\n end\n end",
"def display(line, column = T.unsafe(nil)); end",
"def display(line, column = T.unsafe(nil)); end",
"def display(line, column = T.unsafe(nil)); end",
"def charPrint (line)\n if line\n if line.chomp.to_f > 0.0\n sleep(line.chomp.to_f)\n else\n line.each_char {|char| \n print char \n sleep(SLEEP_TIME)}\n end\n end\n end",
"def display_row(n, c, p)\n puts \"#{pad(n, 10)} #{pad(c, 10)} #{pad(p, 10)}\"\nend",
"def display_row(n, c, p)\n puts \"#{pad(n, 10)} #{pad(c, 10)} #{pad(p, 10)}\"\nend",
"def printstring(row,col,value,color,attrib=Ncurses::A_NORMAL)\n #$log.debug \" pad printstring #{row} - #{@top} , #{col} - #{@left} \"\n raise \"printstring row < top, pls correct code #{row} #{@top}, #{col} #{@left} \" if row < @top or col < @left\n #$log.warn \"printstring row < top, pls correct code #{row} #{@top} \" if row < @top\n super(row - @top, col - @left, value, color, attrib)\n end",
"def column(col, by)\n tmp = @display.map {|row| row[col] }.join\n by.times { tmp[0,0]= tmp[-1]; tmp.chop! }\n tmp.each_char.with_index {|c,i| @display[i][col] = c }\n self\n end",
"def print_row(row)\r\n column = 1\r\n\t\ti= 0\r\n\r\n while i< 8 do \r\n # Printing each field from the row \r\n\t \tprint @nha[i][row] \r\n\t \tcolumn+=1\r\n\t \tprint \" | \" unless row == 8\r\n\t \ti+=1\r\n\t\tend\r\n end",
"def print\n @cell_board.each do |row|\n string_row_separator = '-'\n string_row = '|'\n row.each do |element|\n string_row += \" #{element.to_s} |\"\n string_row_separator += '----'\n end\n puts string_row\n puts string_row_separator\n end\n end",
"def show_character( row, col )\n old_top_line = @top_line\n old_left_column = @left_column\n\n while row < @top_line + @settings[ \"view.margin.y\" ]\n amount = (-1) * @settings[ \"view.jump.y\" ]\n break if( pitch_view( amount, DONT_PITCH_CURSOR, DONT_DISPLAY ) != amount )\n end\n while row > @top_line + @diakonos.main_window_height - 1 - @settings[ \"view.margin.y\" ]\n amount = @settings[ \"view.jump.y\" ]\n break if( pitch_view( amount, DONT_PITCH_CURSOR, DONT_DISPLAY ) != amount )\n end\n\n while col < @left_column + @settings[ \"view.margin.x\" ]\n amount = (-1) * @settings[ \"view.jump.x\" ]\n break if( pan_view( amount, DONT_DISPLAY ) != amount )\n end\n while col > @left_column + @diakonos.main_window_width - @settings[ \"view.margin.x\" ] - 2\n amount = @settings[ \"view.jump.x\" ]\n break if( pan_view( amount, DONT_DISPLAY ) != amount )\n end\n\n @top_line != old_top_line or @left_column != old_left_column\n end",
"def display_character(column, new_display_character)\n\t\t if (Common.device_id(@handle).to_s == \"textlcd_adapter\")\n\t\t\tKlass.setScreen(@handle, @screen_index)\n\t\t end\n\t\t Klass.setDisplayCharacter(@handle, @row, column, new_display_character)\n\t\t new_display_character\n\t\tend",
"def display_board\n cell = \" \"\n print cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n\"\n\nend",
"def display\n puts\n puts \" 1 2 3 4 5 6 7 8\"\n puts\n $board.each_with_index do |line, index|\n unless line == []\n print index + 1\n print \" \"\n line.each do |cell|\n if cell == -1\n print \"- \"\n elsif cell == 0\n print \"X \"\n else\n print \"O \"\n end\n end\n print \" \"\n print index + 1\n puts\n end\n end\n puts\n puts \" 1 2 3 4 5 6 7 8\"\n puts\nend",
"def render\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |tile, j|\n if i == 0 || i == 7\n if j == 0 || j == 7\n print \" R \"\n elsif j == 1 || j == 6\n print \" Kn\"\n elsif j == 2 || j == 5\n print \" B \"\n else\n print \" T \"\n end\n elsif i == 1 || i == 6\n print \" p \"\n else\n print \" X \".colorize(:blue)\n end\n end\n puts\n end\n return nil\n end",
"def display_board(board)\n row = '-----------'\n puts \" #{board[0]} | #{board[1]} | #{board[2]} \"\n puts row\n puts \" #{board[3]} | #{board[4]} | #{board[5]} \"\n puts row\n puts \" #{board[6]} | #{board[7]} | #{board[8]} \"\nend",
"def printBoard\n for i in 0..(row.to_i - 1)\n for j in 0..(column.to_i - 1)\n print board[i][j]\n end\n puts \"\"\n end \n \n column.times do\n print \"=\"\n end\n puts \"\"\n end",
"def char_at(index)\n self.to_array[index.to_i]\n #@word = TILE_VALUES[index]\n end",
"def print_board(board)\n # See http://cl.ly/image/3t450Y271d25 for expected output\n\n\tfor i in 0..board.rows-1\n\t\tprint '|'\n\t\tfor j in 0..board.columns-1\n\t\t\tprint board.at(i,j)\n\t\t\tprint '|'\n\t\tend\n\t\tputs \"\\n\"\n\tend \nend",
"def print_piece(piece, row_i, col_i, p_color, bg_color)\n if cursor?(row_i, col_i) # fuck yes let's refactor this even better, this changes the print color if the current position is the cursor position and two more choices on whether or not the cursor is selected which is exactly as the code should be fucking love it such good refactoring lol\n p_color = prnt_cursor\n if piece.is_a?(NullPiece) # if the cursor is currently over a NullPiece, if the cursor is selected, display the piece currently selected, otherwise display just a really fucking cool Khmer Unicode circle lol https://en.wikipedia.org/wiki/Khmer_(Unicode_block)\n @cursor.selected ? (piece = @board.grid[@cursor.start_pos[0]][@cursor.start_pos[1]]) : (piece = :៙)\n end\n end\n print Paint[\"#{piece.to_s} \", p_color, bg_color] # boom a single print line this is correctly factored code fucking amazing\n end",
"def display\n puts \"#{@cell[0..2].join(\" | \")}\"\n puts \"---------\"\n puts \"#{@cell[3..5].join(\" | \")}\"\n puts \"---------\"\n puts \"#{@cell[6..8].join(\" | \")}\"\n \n end",
"def show_char(c)\n chars = %w( nul sch stx etx eot enq ack bel bs tab nl vtab\n ff cr so si dle dcl dc2 dc3 dc4 nak syn etb\n can em sub esc fs gs rs us sp\n )\n return(chars[c.ord])\nend",
"def display_board (s)\n puts \" #{s[0]} | #{s[1]} | #{s[2]} \"\n puts \"-----------\"\n puts \" #{s[3]} | #{s[4]} | #{s[5]} \"\n puts \"-----------\"\n puts \" #{s[6]} | #{s[7]} | #{s[8]} \"\nend",
"def putc c\n if c >= 0 and c <= 127\n ret = putch c.chr\n if ret == 0\n if addcol(1) == -1 # if can't go forward, try scrolling\n # scroll if exceeding display len but less than max len\n if @curpos > @width && @curpos <= @maxlen\n @pcol += 1 if @pcol < @width \n end\n end\n set_modified \n return 0 # 2010-09-11 12:59 else would always return -1\n end\n end\n return -1\n end",
"def cell(i)\n printf ' %3d ', i\n end",
"def table_entry_for_cell(row, column)\n if row == 0 && column == 0\n # Special handling for the top-left character, replacing a '1' entry.\n '-'\n else\n list_to_print[row] * list_to_print[column]\n end\n end",
"def print_board\r\n\t\t@board_array.each do |char|\r\n\t\t\tprint \"#{char} \"\r\n\t\tend\r\n\t\tputs \"\"\r\n\t\t@board_array\r\n\tend",
"def print_string(x,y, str)\n return if x < 0 or y < 0\n return if y >= @y_chars\n \n if x >= @x_chars\n # NO-OP\n else\n # puts str\n # clip some of the output string, s.t. everything fits\n # (if necessary)\n if x+str.length-1 >= @x_chars \n # new_stop_x = @x_chars-1\n # new_stop_y = stop_y\n # new_stop_i = start_i + new_stop_x - start_x\n \n # range = start_i..new_stop_i\n \n # puts str\n \n # overhang = (x+str.length - @x_chars)\n # if overhang > 0\n # end\n # temp = str.each_character.to_a\n # str = temp.first(n).join('')\n \n \n str = str[(0)..(@x_chars-1 - x)]\n # ^ without this, text with wrap (because grid is row-major)\n \n # TODO: test string clipping\n # (tested old code, but not the new cpp grid)\n end\n \n cpp_print(x, y, str)\n end\n \n \n \n # # pts = \n # # range\n # # .map{|i| [i % (@x_chars+1), i / (@x_chars+1)]}\n # # .map{|x,y| @char_grid_pts[x+y*@x_chars] }\n \n # # pts = range.map{|i| @char_grid_pts[i] }\n \n # # convert i [index in character grid] to (x,y) coordinate pair\n # return Enumerator.new do |yielder|\n # range.each do |i|\n # yielder << @char_grid_pts[i]\n # end\n # end\n \n end",
"def putc(char)\n each_ios_and_stdout(char, &:putc)\n char\n end",
"def draw_segment(character, offset)\n puts \"#{' ' * offset}#{character}\"\nend",
"def col(num)\n \"#{27.chr}[3#{num.to_s}m\"\nend",
"def next_char(options = {})\n ix = column\n ix = skip_space(ix, :right) if options[:skip_space]\n char_at(ix) || ''\n end",
"def rc_to_alphanum(row:, column:)\n index_to_letter(row) + (column + 1).to_s\n end",
"def render\n (\"A\"..\"H\").each { |col| print \" #{col}\"}\n print \"\\n\\n\"\n\n (0...8).each do |row|\n # Start counting downwards - rows are upside down in ChessBoard\n row_idx = (7 - row) % @board.rows.count + 1\n print \"#{row_idx} \"\n\n (0...8).each do |col|\n pos = [row, col]\n render_piece(pos)\n end\n\n print \"\\n\\n\"\n end\n\n debug_info if @debug\n print_controls\n end",
"def display_print\n @grid.each_with_index do |row, row_idx|\n row.each_with_index do |element, column_idx|\n separator = (column_idx % 3 == 2) ? \" \" : \" \"\n print element.to_s + separator\n end\n puts\n puts if (row_idx % 3 == 2)\n end\n nil\n end",
"def print_board\n puts\n @board.each_with_index do |row, index|\n print \" \"\n row.each_with_index do |element, index|\n print \" \" + element.to_s.center(3, \" \") + \" \"\n if(index < row.length - 1)\n print \"|\"\n else\n print \"\\n\"\n end\n end\n\n if(index < @board.length - 1)\n print \" \"\n row.each_with_index do |element, index|\n print \"-----\"\n if(index < row.length - 1)\n print \"+\"\n else\n print \"\\n\"\n end\n end\n end\n end\n puts\n end",
"def print_row(row)\n puts \" #{row[0]} | #{row[1]} | #{row[2]} \"\nend",
"def putc(char)\n ostream.putc char\n end",
"def putc c\n if c >= 0 and c <= 127\n ret = putch c.chr\n if ret == 0\n # character is valid\n if addcol(1) == -1 # if can't go forward, try scrolling\n # scroll if exceeding display len but less than max len\n if @curpos > @width && @curpos <= @maxlen\n @pcol += 1 if @pcol < @width \n end\n end\n @modified = true\n return 0 \n end\n end\n return -1\n end",
"def print_letters(screen)\n (0..9).each do |multiplier|\n screen.each do |row|\n beg = 5*multiplier\n ending = 5*(multiplier+1)\n puts row[beg...ending].join\n end\n\n puts \"**************************************\"\n end\nend",
"def printchar(str)\n count=0\n while count <= str.length\n puts str[count]\n \n count +=1\n \n end\n\n end",
"def column(n = nil)\n CSI + \"#{n || 1}G\"\n end",
"def liner box_char=@box_char, box_size=@box_size\n self.puts( box_char * box_size ) if self.debug?\n end",
"def addchar(c)\n\t\tif @marked == false\n\t\t\tinsertchar(@row,@col,c.chr)\n\t\telse\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tfor r in mark_row..row\n\t\t\t\tif (@text[r].length==0)&&((c==?\\s)||(c==?\\t)||(c==$ctrl_i)||(c==$space))\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif @colmode\n\t\t\t\t\tsc = bc2sc(@row,@col)\n\t\t\t\t\tcc = sc2bc(r,sc)\n\t\t\t\t\tif(cc>@text[r].length) then next end\n\t\t\t\t\tinsertchar(r,cc,c.chr)\n\t\t\t\telse\n\t\t\t\t\tinsertchar(r,0,c.chr)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tcursor_right\n\t\tif @linewrap\n\t\t\tjustify(true)\n\t\tend\n\tend",
"def alphanumeric(row, column)\n alpha_r = ('A'..'H').to_a\n \"#{alpha_r[row]}#{column + 1}\"\n end",
"def display_board(board_string)\n puts \" #{board_string[0]} | #{board_string[1]} | #{board_string[2]} \"\n print_line_row\n puts \" #{board_string[3]} | #{board_string[4]} | #{board_string[5]} \"\n print_line_row\n puts \" #{board_string[6]} | #{board_string[7]} | #{board_string[8]} \"\nend",
"def display\n i=0\n print \" \"\n 0.upto(9) do |x|\n print\" #{x} \"\n end\n 10.upto(@cols-1) do |x|\n print\" #{x}\"\n end\n print \"\\n\"\n print \" \"\n 0.upto(@cols-1) do\n print\"---\"\n end\n print \"\\n\"\n 0.upto(9) do |x|\n\t\t\tprint\" #{x}\"\n\t\t\t0.upto(@rows-1) do |y|\n \t\t \tprint @map[x][y].value\n\t\t\tend\n\t\t\t\tprint \"\\n\"\n \t\tend\n 10.upto(@rows-1) do |x|\n\t\t\tprint\"#{x}\"\n\t\t\t0.upto(@rows-1) do |y|\n \t\t \tprint @map[x][y].value\n\t\t\tend\n\t\t\t\tprint \"\\n\"\n end\n return nil\n\tend",
"def putc(char)\n $stdout.putc(char);\n $stdout.flush();\n end",
"def view\n pos = [\"A\", \"8\"]\n while pos[1] != \"0\" do\n while pos[0] != \"I\" do\n # handle board column legend\n if pos[0] == \"A\"\n print pos[1]\n print \" \"\n end\n print \" \"\n piece = @board.nodes[pos.join].piece\n if piece != nil\n print piece.icon\n else \n # print @board.nodes[pos.join].position\n print \"\\u25A2\".encode\n end\n # print @board.nodes[pos.join].position\n print \" \"\n letter = pos[0].ord + 1\n pos[0] = letter.chr\n end\n print \"\\n\"\n num = pos[1].ord - 1\n pos[1] = num.chr\n pos[0] = \"A\"\n end\n # handle board row legend\n letters = (\"a\"..\"h\")\n print \" \"\n letters.each do |let|\n print \" \"\n print let\n print \" \"\n end\n print \"\\n\"\n end",
"def displayBoard(characters = true)\n # output = \" \" + (0...(@grid[0].length)).to_a.join('') + \"\\n\"\n output = \"\\n\"\n @grid.each_with_index do |val, idx|\n # line = idx.to_s + \" \" + val.join('')\n line = val.join('')\n if characters\n carr_toprint = Game.sortCharactersbyPos(@characters)\n carr_toprint.each do |c| \n if c.pos[0] == idx\n line[c.pos[1]] = c.type \n line += \" (#{c.type}:#{c.hp})\"\n end\n end\n end\n output << line + \"\\n\"\n end\n puts output\n end",
"def print_board(board)\n board.rows.times do |row|\n print \"|\"\n\n board.columns.times do |column|\n piece = board.at(row, column)\n\n if piece == nil\n piece = \" \" # Display empty cells as spaces\n end\n\n print \"#{piece}|\"\n end\n\n print \"\\n\"\n end\n\nend",
"def display_board\n\t\tsystem \"clear\" or system \"cls\"\n\t\tprint \" 1 2 3 4 5 6 7 8 \\n\\n\"\n\t\t(0..7).each do |row|\n\t\t\tprint \"#{(row+97).chr} \"\n\t\t\t(0..7).each do |collumn|\n\t\t\t\tprint \"#{@board[row][collumn]} \" if @board[row][collumn] == \"X\"\n\t\t\t\tprint @board[row][collumn].to_s + \" \" if @board[row][collumn].is_a?(Piece)\n\t\t\tend\n\t\t\tprint \" #{(row+97).chr} \"\n\t\t\tputs\n\n\t\tend\n\t\tprint \"\\n 1 2 3 4 5 6 7 8 \\n\"\n\tend",
"def print_map\n map.each_with_index do |row, i|\n row.each_with_index do |col , j|\n #puts col\n if col == 'R'\n print 'R'\n elsif col == 'S'\n print 'S'\n elsif col == 'B'\n print 'B'\n elsif col == 'W'\n print 'W'\n else\n print '#'\n end\n end\n puts ''\n end\n end",
"def move_to(x, y); puts \"\\e[#{y};#{x}G\" end",
"def char\n\t\t\t\t@char\n\t\t\tend",
"def highlight(row,scol,ecol)\n\t\t# only do rows that are on the screen\n\t\tif row < @linefeed then return end\n\t\tif row > (@linefeed + $screen.rows - 2) then return end\n\n\t\tif @text[row].length < 1 then return end\n\n\t\t# convert pos in text to pos on screen\n\t\tsc = bc2sc(row,scol)\n\t\tec = bc2sc(row,ecol)\n\n\t\t# replace tabs with spaces\n\t\tsline = tabs2spaces(@text[row])\n\t\t# get just string of interest\n\t\tif sc < @colfeed then sc = @colfeed end\n\t\tif ec < @colfeed then return end\n\t\tstr = sline[sc..ec]\n\t\tif ec == sline.length then str += \" \" end\n\t\tssc = sc - @colfeed\n\t\tsec = ec - @colfeed\n\n\t\tif (str.length+ssc) >= $screen.cols\n\t\t\tstr = str[0,($screen.cols-ssc)]\n\t\tend\n\n\t\t$screen.text_reverse(true)\n\t\t$screen.write_str((row-@linefeed+1),ssc,str)\n\t\t$screen.text_reverse(false)\n\tend",
"def display_board(x)\n puts line_one = \" #{x[0]} | #{x[1]} | #{x[2]} \"\n puts line_two = \"-----------\"\n puts line_three = \" #{x[3]} | #{x[4]} | #{x[5]} \"\n puts line_four = \"-----------\"\n puts line_five = \" #{x[6]} | #{x[7]} | #{x[8]} \"\nend",
"def rb_mvaddch row, col, char\n super(row-@top, col-@left, char)\n end",
"def print_to_terminal\n grid.each do |row|\n row.each do |element|\n print \"O \" if(element==1)\n print \"X \" if(element==-1)\n print \"- \" if(element==0)\n end\n print \"\\n\"\n end\n end",
"def print\n displayBoard = []\n @board.each_with_index { |elem, index|\n if index % @columns == 0\n displayBoard.push(\"\\n\")\n end\n displayBoard.push(elem)\n }\n puts displayBoard.join\n end",
"def print_row(num)\n puts \" \" # Gives row margin\n\n @position_of_pieces.each do |piece|\n current_piece = piece[num]\n print make_piece(current_piece)\n end\n end",
"def display_board(xox)\n line = \"-----------\"\n puts \" #{xox[0]} | #{xox[1]} | #{xox[2]} \"\n puts line\n puts \" #{xox[3]} | #{xox[4]} | #{xox[5]} \"\n puts line\n puts \" #{xox[6]} | #{xox[7]} | #{xox[8]} \"\nend",
"def delchar(row,col)\n\t\tif col == @text[row].length\n\t\t\tmergerows(row,row+1)\n\t\telse\n\t\t\t@text[row] = @text[row].dup\n\t\t\t@text[row][col] = \"\"\n\t\tend\n\tend",
"def render\n print \"\\n\"\n @board.each do |row|\n row.each do |col|\n print \"#{col.nil? ? '.' : col} \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def render\n puts \" #{(0..7).to_a.join(' ')}\"\n (0..7).each do |row|\n puts \"#{row} #{print_row(@board.grid[row] , row).join('|')}\"\n puts\n end\n end",
"def print_cell(c)\n result = \"-------|\\n\"\n if c.solved?\n rows = <<EOT\n ` ` ` |\n ` #{c.val} ` |\n ` ` ` |\nEOT\n result += rows # don't += on the same line as above, it screws up my syntax highlighting\n return result\n else\n result += print_unsolved_cell(c)\n end\n return result\n end",
"def to_s\n \"#{@row_idx+1}&#{('A'.ord+@col_idx).chr}\"\n end",
"def get_char at\n index = range_correct_index(at)\n return internal_object_get(index + 1)\n end",
"def display_board(board)\n cell_separator = \"|\"\n row_separator = \"-\" * 11\n\n board.each.with_index {\n |cell, index| print \" #{cell} \", ((index + 1) % 3) == 0 &&\n index < board.length - 1 ? \"\\n#{row_separator}\\n\" :\n index < board.length - 1 ? \"#{cell_separator}\" : \"\\n\"\n }\nend",
"def display_board(board)\n cell_separator = \"|\"\n row_separator = \"-\" * 11\n\n board.each.with_index {\n |cell, index| print \" #{cell} \", ((index + 1) % 3) == 0 &&\n index < board.length - 1 ? \"\\n#{row_separator}\\n\" :\n index < board.length - 1 ? \"#{cell_separator}\" : \"\\n\"\n }\nend",
"def output_word\n puts @displayed_character.join('')\n end",
"def print_board\n\n\t\t@board.each_with_index do |row, i|\n\n\t\t\trow.each do |space|\n\n\t\t\t\tprint \"|#{space}|\"\n\n\t\t\tend\n\n\t\t\tif i == 2\n\t\t\t\tputs \"\"\n\t\t\telse\n\t\t\t\tputs \"\"\n\t\t\t\tputs \"---------\"\n\t\t\tend\n\n\t\tend\n\n\tend",
"def render\n @board.each.with_index do |row, y|\n row.each.with_index do |item, x|\n chr = item.nil? ? \" \" : item\n print \" #{chr} \"\n print \"|\" unless x == row.size - 1\n end\n print \"\\n-----------\\n\" unless y == @board.size - 1\n end\n print \"\\n\"\n end",
"def print_board\n\t\tcell_index=1\n\t\tputs \"\\n\\n\\t[A]\\t[B]\\t[C]\"\n\t\t@cell_status.each_key do |cell|\n\t\t\tcase cell\n\t\t\twhen \"A1\" \n\t\t\t\tprint \" [1]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B1\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C1\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\t\tputs \"\\t--------------------\"\n\t\t\twhen \"A2\" \n\t\t\t\tprint \" [2]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B2\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C2\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\t\tputs \"\\t--------------------\"\n\t\t\twhen \"A3\" \n\t\t\t\tprint \" [3]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B3\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C3\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\tend\t\n\t\tend\n\tend",
"def position_for(char)\n return ''.freeze if char.position.y == @y\n\n @y = char.position.y\n char.position.to_s\n end",
"def display_piece_by_location(piece, location)\nif location == 2 || location == 5\nprint_piece(piece, \"\\n\\t\")\nprint_separator_line\nelsif location == 8\nprint_piece(piece, \"\\n\")\nelse\nprint_piece(piece, SEPARATOR[:vertical])\nend\nend",
"def render()\n print \" \"\n (0...@size).each do |col|\n print (col).to_s + \" \"\n end\n puts\n\n (0...@size).each do |row|\n (-1...@size).each do |col|\n print col == -1 ? row : card([row, col]).display\n print \" \"\n end\n puts\n end\n end",
"def line_char_to_offset(text, line, character); end",
"def display_board(board)\n row1 = \" #{board[0]} | #{board[1]} | #{board[2]} \"\n row2 = \" #{board[3]} | #{board[4]} | #{board[5]} \"\n row3 = \" #{board[6]} | #{board[7]} | #{board[8]} \"\n interRow = \"-----------\"\n print row1 + \"\\n\"\n print interRow + \"\\n\"\n print row2 + \"\\n\"\n print interRow + \"\\n\"\n print row3 + \"\\n\"\nend",
"def display_board(board)\n cell1 = \" #{board[0]} \"\n cell2 = \" #{board[1]} \"\n cell3 = \" #{board[2]} \"\n cell4 = \" #{board[3]} \"\n cell5 = \" #{board[4]} \"\n cell6 = \" #{board[5]} \"\n cell7 = \" #{board[6]} \"\n cell8 = \" #{board[7]} \"\n cell9 = \" #{board[8]} \"\n box = \"|\"\n line = \"-----------\"\n print cell1, box, cell2, box, cell3\n print \"\\n\",line\n print \"\\n\",cell4, box, cell5, box, cell6\n print \"\\n\",line\n print \"\\n\",cell7, box, cell8, box, cell9, \"\\n\"\nend",
"def set_char at , char\n raise \"char not fixnum #{char}\" unless char.kind_of? Fixnum\n index = range_correct_index(at)\n internal_object_set( index + 1 , char )\n end",
"def print_board(board)\n puts\n for y in (0...9)\n for x in (0...9) \n print board[y][x][0]\n end\n puts\n end\n puts\n return\n end",
"def printLetterGrid(grid, width, height)\n\n # Iterate through each grid entry\n for y in 0..height-1 do\n\n for x in 0..width-1 do\n\n # Print the entry\n print \"|#{grid[[x, y]]}\"\n\n end \n\n print \"|\\n\"\n\n end \n\nend",
"def NextChar\r\n\t\t@Line.slice!(0, 1)\r\n\tend",
"def move(board,cell,char=\"X\")\n board[cell.to_i-1] = char\n puts board\nend",
"def print_row(grid_size, distance_from_center)\n\tstars = grid_size - 2 * distance_from_center\n\tnum = '*' * stars\n\tputs num.center(grid_size)\nend",
"def draw(text)\n printf \"%s %-#{(columns / 3) - 5}s \" % [V_SEP, text]\n end",
"def col\r\n @lines[@line_num].cursor\r\n end",
"def character_location\n ((@cr[5] ^ 0x08) & 0x08) << 12 | (@cr[5] & 0x07) << 10\n end"
] |
[
"0.7378273",
"0.7140198",
"0.70540226",
"0.6794265",
"0.67835265",
"0.6746956",
"0.6741829",
"0.6590594",
"0.65766704",
"0.657374",
"0.6566235",
"0.6552443",
"0.6552443",
"0.6552443",
"0.65387094",
"0.64899075",
"0.64899075",
"0.6478533",
"0.6432986",
"0.6426349",
"0.6421638",
"0.6405529",
"0.63861865",
"0.63844943",
"0.63645834",
"0.635322",
"0.634338",
"0.63304853",
"0.6322279",
"0.63095796",
"0.63071394",
"0.6279261",
"0.6267747",
"0.6265519",
"0.625996",
"0.62470984",
"0.6245085",
"0.62324923",
"0.6225492",
"0.6224754",
"0.6212224",
"0.620952",
"0.62090784",
"0.6181957",
"0.617782",
"0.6176167",
"0.61755526",
"0.61523175",
"0.6149289",
"0.6148341",
"0.6137852",
"0.6128842",
"0.61233777",
"0.6118719",
"0.61158574",
"0.6114164",
"0.6088666",
"0.60826254",
"0.60766643",
"0.6074223",
"0.60737747",
"0.60712963",
"0.606882",
"0.6065585",
"0.6054369",
"0.6052979",
"0.60445887",
"0.604318",
"0.6038907",
"0.60361123",
"0.60316795",
"0.6031576",
"0.6016575",
"0.60105586",
"0.60103405",
"0.6006456",
"0.60062647",
"0.60054123",
"0.59960335",
"0.5989755",
"0.5989755",
"0.59860754",
"0.59860027",
"0.5984421",
"0.598332",
"0.5980429",
"0.5977388",
"0.597566",
"0.59729207",
"0.5968498",
"0.5961882",
"0.59607816",
"0.5945349",
"0.59447044",
"0.5942586",
"0.5941942",
"0.5932227",
"0.5932056",
"0.5919173",
"0.59165126"
] |
0.7382112
|
0
|
print text (will be scrolled automatically)
|
def text(str)
@serial.write("#{str}\r")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def page_print(text)\n return text unless highline.page_at\n\n lines = text.lines.to_a\n while lines.size > highline.page_at\n highline.puts lines.slice!(0...highline.page_at).join\n highline.puts\n # Return last line if user wants to abort paging\n return \"...\\n#{lines.last}\" unless continue_paging?\n end\n lines.join\n end",
"def print\n puts @text\n end",
"def print(text,align=0,raw=false)\n @session.window.print(text,align,raw)\n end",
"def display_text(text)\n print(text)\n end",
"def print(text,align=0,raw=false)\n @window.print(text,align,raw)\n end",
"def print(text, options={}, &block)\n cur_page.print(text, options, &block)\n end",
"def print_raw(text,align=0)\n @session.window.print(text,align,true)\n end",
"def print(text)\n Platform.runLater(-> { @output.append_text(text.to_s) })\n end",
"def print\n puts \"Mencetak : #{@text}\" \n end",
"def print(text)\n @sp.print(text)\n @sp.flush\n sleep (0.01)\n end",
"def print(text)\n @output += %(#{text}\\n)\n puts text\n end",
"def print(text,align=0,raw=false)\n draw_internal(text,align,false,raw)\n reposition_lines\n end",
"def print *textarray\n create_window unless @win\n show unless @visible\n c = 1\n textarray.each_with_index { |s, i| \n @win.printstring i+@row_offset, c+@col_offset, \"%-*s\" % [@w-(@col_offset*2)-c, s], @color_pair\n }\n @win.wrefresh\n end",
"def println(text,align=0,raw=false)\n @session.window.print(text+'\\n',align,raw)\n end",
"def print(text)\n Kernel.print(text)\n $stdout.flush\n end",
"def print_this(win, text, color, x, y)\n raise \"win nil in print_this\" unless win\n color=Ncurses.COLOR_PAIR(color);\n win.attron(color);\n #win.mvprintw(x, y, \"%-40s\" % text);\n win.mvprintw(x, y, \"%s\" % text);\n win.attroff(color);\n win.refresh\n end",
"def scroll_down(n); puts \"\\e[#{n}T\" end",
"def println(text,align=0,raw=false)\n @window.print(text+'\\n',align,raw)\n end",
"def scroll_up(n); puts \"\\e[#{n}S\" end",
"def print(string, _width = @content_cols)\n #return unless visible?\n w = _width == 0? Ncurses.COLS : _width\n FFI::NCurses.waddnstr(@pad,string.to_s, w) # changed 2011 dts \n end",
"def slow_scroll()\r\n 10.times do\r\n sleep 0.05\r\n puts \"\"\r\n end\r\nend",
"def print_xy(x, y, text, options={}, &block)\n cur_page.print_xy(x, y, text, options, &block)\n end",
"def println(text)\n Platform.runLater(-> { @output.append_text(\"#{text.to_s}\\n\") })\n end",
"def print_on_right text\n sz = text.size\n col = @gcols - sz - 1\n col = 2 if col < 2\n text = text[0..@gcols - 3] if sz > @gcols - 2\n # 2019-04-22 - earlier direct system call to tput, now trying print\n # system \"tput cup #{@glines} #{col}\"\n tput_cup @glines, @gcols - sz - 1\n # print text\n print \"\\e[33;4#{@status_color_right}m#{text}\\e[m\"\nend",
"def print_in_box(text)\n\n text_length = text.size + 2\n\n line_one_five = puts '+' + '-'* text_length + '+'\n line_two_four = puts '|' + ' '* text_length + '|'\n line_three = puts '| ' + text + ' |'\n line_two_four = puts '|' + ' '* text_length + '|'\n line_one_five = puts '+' + '-'* text_length + '+'\n\n\nend",
"def print\n puts @subject\n puts @text\n end",
"def puts(text)\n @pager_io ||= spawn_pager\n @pager_io.puts(text)\n self\n end",
"def print_in_box(text)\n banner_size = text.size\n puts \"+-\" + (\"-\" * banner_size) + \"-+\"\n puts \"| \" + (\" \" * banner_size) + \" |\"\n puts \"| #{text} |\"\n puts \"| \" + (\" \" * banner_size) + \" |\"\n puts \"+-\" + (\"-\" * banner_size) + \"-+\"\nend",
"def puts(text='', options={}, &block)\n cur_page.puts(text, options, &block)\n end",
"def print_in_box(text)\n width = text.size\n result = <<EOS\n+-#{'-' * width}-+\n| #{' ' * width} |\n| #{text} |\n| #{' ' * width} |\n+-#{'-' * width}-+\nEOS\n result\nend",
"def curses_print_and_refresh(x, y, string) # rubocop:disable Naming/MethodParameterName\n Curses.setpos(x, y)\n Curses.addstr(string)\n Curses.refresh\nend",
"def get_single text, config={}\n w = one_line_window\n x = y = 0\n color = config[:color_pair] || $datacolor\n color=Ncurses.COLOR_PAIR(color);\n w.attron(color);\n w.mvprintw(x, y, \"%s\" % text);\n w.attroff(color);\n w.wrefresh\n Ncurses::Panel.update_panels\n chr = get_char\n w.destroy\n w = nil \n return chr\nend",
"def print_in_box(text)\n text = text[0, MAX_SIZE]\n pad1 = ''.center(text.size, '-')\n pad2 = ''.center(text.size, ' ')\n\n puts(\"+-#{pad1}-+\n| #{pad2} |\n| #{text} |\n| #{pad2} |\n+-#{pad1}-+\")\nend",
"def print(string, width = self.width)\n w = width == 0? Ncurses.COLS : width\n waddnstr(string.to_s, w) # changed 2011 dts \n end",
"def output text\n puts text\n end",
"def print_out(style, input)\n move_down style[:upper_space]\n font style[:font_variable], :style => $headline_chapter_font_style\n font_size style[:font_size_variable]\n text input\nend",
"def say text\n @output.say text\n end",
"def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"def verbose_print(text)\n @output += %(#{text}\\n)\n puts text if @verbose\n end",
"def scroll_to_exact(text)\n err = nil\n w_s = window_rect\n\n (1..30).each do |_count|\n action\n .move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number\n .pointer_down(:left)\n .move_to_location(0, w_s.height / 5)\n .release\n .perform\n sleep 1 # we must wait finish scrolling\n\n return text_exact(text)\n rescue StandardError => e\n err = e\n end\n\n raise err\n end",
"def print_text\n\t\tputs self # First object\n\t\tputs \"this is instance method to print some text\"\n\tend",
"def tprint(string)\n @window.addstr(string)\n end",
"def say text\n @output.say text\n end",
"def show_text(string) # Tj\n raise PDF::Reader::MalformedPDFError, \"current font is invalid\" if current_font.nil?\n at = transform(Point.new(0,0))\n @content[at.y] ||= \"\"\n @content[at.y] << current_font.to_utf8(string)\n end",
"def printstring r, c, text, color_pair=@color_pair\n create_window unless @win\n show unless @visible\n r = @h-1 if r > @h-1\n #@win.printstring r, c, ' '*@w, @color_pair\n # FIXME this padding overwrites the border and the offset means next line wiped\n # However, now it may now totally clear a long line.\n @win.printstring r+@row_offset, c+@col_offset, \"%-*s\" % [@w-(@col_offset*2)-c, text], color_pair\n @win.wrefresh\n end",
"def show_text_with_positioning(*params)\n params = params.first\n params.each { |str|\n if str.kind_of?(String)\n show_text(str)\n else\n# if str < -100\n# puts str.inspect\n# show_text(\" \")\n# end\n end\n }\n end",
"def print_logo()\n sleep(0.2)\n line = \"===================================================\\n\"\n text = [\" _____ _ _ _ ____ _ _ \", \"| __ \\\\ | | (_)| || _ \\\\ (_)| |\", \"| |__) || |__ _ | || |_) | _ __ __ _ ___ _ | |\", \"| ___/ | '_ \\\\ | || || _ < | '__|/ _` |/ __|| || |\", \"| | | | | || || || |_) || | | (_| |\\\\__ \\\\| || |\", \"|_| |_| |_||_||_||____/ |_| \\\\__,_||___/|_||_|\"]\n print line\n text.each do |t|\n sleep(0.2)\n puts t\n end\n sleep(0.2)\n print \"\\n\"\n sleep(0.2)\n print line\n sleep(0.2)\nend",
"def print\n text = File.expand_path(File.dirname(__FILE__) + '/text/cv.txt')\n File.readlines(text).each do |line|\n puts line\n end\n end",
"def print_header # print intial text\n puts \"The students of Villians Academy\"\n puts \"-------------\"\nend",
"def write_to_screen!\n puts report_title\n puts report_body.lines.take(show_count)\n end",
"def printi(text, n = 1)\n print idt(n) + text\n end",
"def page(text)\n open do |pager|\n pager << text\n end\n end",
"def output(text)\n puts text\n end",
"def print(s = nil)\n if s == nil\n TermGui.open_style(self)\n else\n TermGui.print(s, self)\n end\n end",
"def print\n end",
"def page(text)\n open do |pager|\n pager << text\n end\n end",
"def printing\n \n # \"print\" print data in console without linebrean by default\n print \"HELLO WORLD! \"\n # \"puts\" print data in console with linebreak\n puts \"Hello World!\"\n puts 2+2\n\n#\"end\" finalize the function \nend",
"def println(str)\n unless @lines_used > 0\n feed(@options[:lines_stamp])\n println(@options[:header])\n end\n\n str.split(\"\\n\").each do |line|\n print(\"#{line}\\n\")\n\n @lines_used += 1\n cut if (@lines_used == @options[:lines_available] + @options[:lines_stamp])\n end\n end",
"def print\n puts string\n end",
"def print_message_text()\n @renderer.puts(\"Msg: #{@message_to_post.text_for_display}\")\n end",
"def text page\n @client.text page\n end",
"def print_in_box(text)\n horizontal = \"+\" + \"-\" * (text.length + 2) + \"+\"\n text_line = \"| \" + text + \" |\"\n vertical = \"|\" + \" \" * (text.length + 2) + \"|\"\n\n puts horizontal\n puts vertical\n puts text_line\n puts vertical\n puts horizontal\nend",
"def gprint (text)\n\tprint colorize(colorize(text, \"black\"), \"white_bg\")\nend",
"def process\n @viewport.visible = true\n while Core::LOCK.locked?\n Graphics.update\n @text.text = @texts[Graphics.frame_count % 60 / 20] if Graphics.frame_count % 20 == 0\n end\n @viewport.visible = false\n end",
"def echo(text)\n\ttext \nend",
"def write(x,y,text)\n Curses.setpos(x,y)\n text.each_line do |line|\n break if x == Curses.lines-1\n Curses.addstr(line) \n x += 1\n end\n for x in 1..Curses.lines\n Curses.deleteln\n end\n Curses.setpos(text.lines.count-1,0)\n Curses.addstr(text.lines.take(3)[2]) unless text.lines.take(3)[2].nil?\n Curses.setpos(text.lines.count-1,0)\n end",
"def printCode(txt, file)\n code = txt.get('1.0', 'end - 1c')\n dir = '.'\n dir = ENV['HOME'] if ENV['HOME']\n dir = ENV['TMP'] if ENV['TMP']\n dir = ENV['TEMP'] if ENV['TEMP']\n\n fname = [dir, 'tkdemo-' + file].join(File::Separator)\n open(fname, 'w'){|fid| fid.print(code)}\n begin\n case Tk::TCL_PLATFORM('platform')\n when 'unix'\n msg = `lp -c #{fname}`\n unless $?.exitstatus == 0\n Tk.messageBox(:title=>'Print spooling failure',\n :message=>'エラーが発生しました.' +\n '印刷に失敗したものと思われます : ' + msg)\n end\n when 'windows'\n begin\n printTextWin32(fname)\n rescue => e\n Tk.messageBox(:title=>'Print spooling failure',\n :message=>'エラーが発生しました.' +\n '印刷に失敗したものと思われます : ' +\n e.message)\n end\n when 'macintosh'\n Tk.messageBox(:title=>'Operation not Implemented',\n :message=>'印刷機能はまだ実装されていません')\n else\n Tk.messageBox(:title=>'Operation not Implemented',\n :message=>'検出された環境 ' +\n Tk::TCL_PLATFORM('platform') +\n ' は未知の環境であるため,' +\n '印刷機能は実装されていません: ')\n end\n ensure\n File.delete(fname)\n end\nend",
"def print\n\n end",
"def printstr(str, x=0,y=0)\n win = @pointer\n FFI::NCurses.wmove(win, x, y)\n FFI::NCurses.waddstr win, str\n end",
"def displayInfo(text)\n puts \"( - ) #{text}\"\n end",
"def output()\n add_newline if @linebreak\n @text\n end",
"def w texte\n STDOUT.write \"<p>#{texte}</p>\"\nend",
"def display\r\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\r\n puts \"-----------\"\r\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\r\n end",
"def print(string)\n self.buffer += string\n Kernel.print string\n end",
"def print_in_box(string)\n lines = string.scan(/.{1,76}/)\n width = lines.first.to_s.size + 2\n top_bot = \"+#{'-' * width}+\"\n padding = \"|#{' ' * width}|\"\n text = lines.map { |line| \"| #{line.ljust(width - 2)} |\" }\n puts [top_bot, padding, text, padding, top_bot]\nend",
"def show_document\n\tprint_header\n\tprint_document\n\tprint_footer\nend",
"def print\n end",
"def print\n end",
"def print\n end",
"def print(*args)\n @interface.print(*args)\n end",
"def print(*args)\n @interface.print(*args)\n end",
"def display \n system(\"clear\") || system(\"cls\")\n\n grid = content.split(\"\\n\")\n print \" \" # make grid line up\n grid.length.times{|num| print \" #{num + 1}\"}\n grid.length.times{|row|\n puts \"\"\n print (65+row).chr + \" \"\n grid[row].length.times{|col|\n print grid[row][col] \n }\n }\n puts \"\"\n end",
"def print(*args, backtrace: nil)\n return unless @dialog && @dialog.visible?\n args.each { |arg|\n @dialog.call('Console.print', arg.to_s, {:language => :ruby, :time => Time.now.to_f, :id => @message_id.next!, :backtrace => backtrace})\n }\n nil\n end",
"def printer\n puts \" \" + @bio\n end",
"def print_in_box(text)\n top_bottom_border = \"+\" + (\"-\" * (text.size + 2)) + \"+\"\n spacer_line = \"|\" + (\" \" * (text.size + 2)) + \"|\"\n message_line = \"| \" + text + \" |\"\n\n puts top_bottom_border\n puts spacer_line\n puts message_line\n puts spacer_line\n puts top_bottom_border\nend",
"def prv_printstring(r,c,string, color, att = Ncurses::A_NORMAL)\n\n #$log.debug \" #{@name} inside window printstring r #{r} c #{c} #{string} \"\n att = Ncurses::A_NORMAL if att.nil? \n case att.to_s.downcase\n when 'normal'\n att = Ncurses::A_NORMAL\n when 'underline'\n att = Ncurses::A_UNDERLINE\n when 'bold'\n att = Ncurses::A_BOLD\n when 'blink'\n att = Ncurses::A_BLINK # unlikely to work\n when 'reverse'\n att = Ncurses::A_REVERSE \n end\n\n attron(Ncurses.COLOR_PAIR(color) | att)\n # we should not print beyond window coordinates\n # trying out on 2009-01-03 19:29 \n width = Ncurses.COLS\n # the next line won't ensure we don't write outside some bounds like table\n #string = string[0..(width-c)] if c + string.length > width\n #$log.debug \"PRINT len:#{string.length}, #{Ncurses.COLS}, #{r}, #{c} w: #{@window} \"\n mvprintw(r, c, \"%s\", string);\n attroff(Ncurses.COLOR_PAIR(color) | att)\n end",
"def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end",
"def display\n puts \" #{@cells[0]} | #{@cells[1]} | #{@cells[2]} \"\n puts \"-----------\"\n puts \" #{@cells[3]} | #{@cells[4]} | #{@cells[5]} \"\n puts \"-----------\"\n puts \" #{@cells[6]} | #{@cells[7]} | #{@cells[8]} \"\n end",
"def print_in_box(text)\n length = text.size\n horizontal_border = \"+-\" + (\"-\" * length) + \"-+\"\n empty_border = \"| \" + (\" \" * length) + \" |\"\n content = \"| #{text} |\"\n \n puts horizontal_border\n puts empty_border\n puts content\n puts empty_border\n puts horizontal_border\nend",
"def print_board\n @board.each_slice(1) { |a| p a }\n puts\"\\n\"\n end",
"def print\n (1..5).each do |l|\n out = printByLine(l) + \"\\n\"\n STDOUT << (VROW.include?(l) ? out*@size : out )\n end\n end",
"def print(msg = '')\n clear_line\n print_no_newline(msg)\n end",
"def c_bottomrighttext(str)\n print cursor.row(height)\n print cursor.column(width - str.length)\n print str\n end",
"def print_raw(no_page = 0)\n @pages[no_page].print_raw\n end",
"def display_text word\n raise \"word should be string\" unless word.is_a? String\n w = @form.by_name[\"tv\"]; \n lines = get_data word\n #file = `ri -f bs #{word}`\n #lines = convert_man_to_ansi file\n return if lines.nil? || lines.size == 0\n # ansi can have overflow\n w.add_content(lines, :content_type => :ansi, :title => word)\n\n # Since i am trying without border, so need to put class on top right\n header = @form.by_name[\"header\"]; \n header.text_right(word)\n\n $visited << word unless $visited.index(word)\n #w.add_content(lines, :title => word)\n w.buffer_last\nend",
"def draw\n return if @destoryed\n return unless @verbose\n unless DEBUG_PRINT_WAIT.nil?\n @string = get_debug_string\n end\n @hud_font.draw_text(@string, $program.width - 200, $program.height - 300, 100, 1, 1, 0xff_000000, :default)\n end",
"def titleSlide()\n=begin \n print \"\\n-------------------------------------------------------------------------\\n\"\n print $titleSlideFont.write(\"Console Light Show\")\n print \"\\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n\"\n print \"---------------------------------------------------------------------------\\n\"\n=end\n titleSlideFont = TTY::Font.new(:standard)\n titleBox = TTY::Box.frame(\n width: TTY::Screen.width-1,\n height: 15,\n border: :thick,\n align: :center,\n padding: 1\n )do\n \"#{titleSlideFont.write(\"Console Light Show\")}\n \\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n2019\"\n end\n print titleBox\n menu()\nend",
"def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end",
"def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end",
"def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end",
"def display\n puts \" #{cells[0]} | #{cells[1]} | #{cells[2]} \"\n puts \"-----------\"\n puts \" #{cells[3]} | #{cells[4]} | #{cells[5]} \"\n puts \"-----------\"\n puts \" #{cells[6]} | #{cells[7]} | #{cells[8]} \"\n end"
] |
[
"0.7307597",
"0.7247627",
"0.7181006",
"0.7138893",
"0.7073905",
"0.7011917",
"0.6984974",
"0.6972929",
"0.6921799",
"0.68991756",
"0.6870235",
"0.68508875",
"0.6838785",
"0.6807696",
"0.67343247",
"0.66999865",
"0.6693575",
"0.66796833",
"0.64863235",
"0.6458198",
"0.6434319",
"0.6287227",
"0.6243142",
"0.6211114",
"0.61970735",
"0.61690253",
"0.6163379",
"0.6151963",
"0.6073926",
"0.600631",
"0.59921086",
"0.5986178",
"0.5957131",
"0.59402114",
"0.59264874",
"0.5907555",
"0.5896206",
"0.5894634",
"0.58732",
"0.5863201",
"0.58615637",
"0.58463526",
"0.5841318",
"0.58314955",
"0.5818213",
"0.5796068",
"0.57944334",
"0.57876605",
"0.57626903",
"0.5759666",
"0.575244",
"0.574462",
"0.57429993",
"0.57425344",
"0.5722855",
"0.57225066",
"0.571832",
"0.5717321",
"0.57160616",
"0.5710273",
"0.570413",
"0.56909406",
"0.5686821",
"0.5676297",
"0.5673046",
"0.5661079",
"0.56581724",
"0.565743",
"0.5656982",
"0.5656962",
"0.5648795",
"0.5646014",
"0.5637522",
"0.5636568",
"0.56301427",
"0.5614516",
"0.5607752",
"0.5607752",
"0.5607752",
"0.560499",
"0.560499",
"0.5595024",
"0.55878484",
"0.5587651",
"0.5570926",
"0.55700177",
"0.5552639",
"0.5552639",
"0.5545699",
"0.5541964",
"0.5541219",
"0.55342865",
"0.55167234",
"0.55135894",
"0.5505589",
"0.55049425",
"0.5500564",
"0.54978055",
"0.54978055",
"0.54978055",
"0.54978055"
] |
0.0
|
-1
|
controller route actions GET /auth/assemblies
|
def index
@models = @model.get_many
respond_to do |format|
format.json do
render json: @models.to_json
end
format.html do
render :index
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @assemblies = Assembly.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assemblies }\n end\n end",
"def authorised_assets asset_class,projects=nil, action=\"view\"\n asset_class.all_authorized_for action, User.current_user, projects\n end",
"def index\n @albums = Album.all\n authorize @albums\n end",
"def index\n @access_controls = AccessControl.all\n end",
"def index\n @claimauthorizations = Claimauthorization.all\n end",
"def index\n # CanCan doesn't load @apks here for some reason (it's got something to do with\n # the block in ability.rb, but I don't know what)\n @apks = Apk.find(:all, :conditions => {:base_rom_id => nil})\n \n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @authentics = Authentic.all\n end",
"def index\n @authorizations = Authorization.all\n end",
"def index\n @authorizations = Authorization.all\n end",
"def index\n @assets = @org.assets\n end",
"def index\n @assets = current_user.assets.all\n end",
"def show\n @assembly = Assembly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assembly }\n end\n end",
"def index\n @authorities = Authority.all\n end",
"def index\n @authorities = Authority.all\n end",
"def index\n @authorize_codes = AuthorizeCode.all\n end",
"def dig_assembly(tmp_assemblies_collection, api_params)\n # First step iterate over the [Aid1, Aid2] and make @baked => A[ASM1, ASM2..ASMn]\n @baked = tmp_assemblies_collection.map do |one_assemblies|\n a1 = one_assemblies.assemblies.map do |one_assembly|\n unless one_assembly.empty?\n Api::Assembly.new.show(api_params.merge(id: one_assembly, asms_id: one_assemblies.id)).baked\n end\n end\n\n a1\n end\n filter(api_params[:filter]) unless api_params[:filter] == ALL\n Rails.logger.debug \"\\033[36m>-- ASB'S: #{@baked.class} START\\33[0m\"\n Rails.logger.debug \"\\033[1m#{@baked.to_yaml}\\33[22m\"\n Rails.logger.debug \"\\033[36m> ASB'S: END\\033[0m\"\n end",
"def index\n authorize Authentication, :index?\n @authentications = policy_scope(Authentication)\n end",
"def authorized_assets\n assets.select{|a| a.can_view?}\n end",
"def index\n authorize! :view_pharmacy, @pharmacys\n @pharmacys = Pharmacy.all\n end",
"def index\n @activites = Activite.all\n authorize @activites\n end",
"def index\n @project=Project.find(params[:project_id])\n @scripts = @project.scripts\n self.crumb\n authorize! :show, @project\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scripts }\n end\n end",
"def index\n @claimppriorauthorizations = Claimppriorauthorization.all\n end",
"def index\n\t\t@authentications = Authentication.all\n\tend",
"def index\n @assemblers = Assembler.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assemblers }\n end\n end",
"def index\n @assets = Asset.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n format.xml { render xml: @assets }\n end\n end",
"def getcontrollers\n @controllers = Eb::Permission.getcontrollers\n end",
"def index\n @avators = Avator.all\n end",
"def index\n render json: @authority.all\n end",
"def index\n @assets = Asset.all\n end",
"def index\n @assets = Asset.all\n end",
"def index\n @asset_disposals = AssetDisposal.with_permissions_to(:edit).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asset_disposals }\n end\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def index\n @adecuacionactividads = Adecuacionactividad.all\n end",
"def index\n @autentics = Autentic.all\n end",
"def index\n @contracts = Contract.all\n authorize @contracts\n end",
"def index_approvable\n @asset_categorizations = AssetCategorization.accessible_by(current_ability, :approve).search(params[:search]).order(\"approved, confirmed, number_arranged, submitted, id desc\").page(params[:page])\n\n respond_to do |format|\n format.html \n format.json { render json: @asset_categorizations }\n format.xml { render xml: @asset_categorizations }\n end\n end",
"def index\n @authorized_clients = AuthorizedClient.all\n end",
"def index\n @mx_assessments = MxAssessment.all\n authorize MxAssessment \n end",
"def index\n @dj_applications = DjApplication.all\n authorize! :index, DjApplication\n end",
"def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end",
"def index\n @authentications = Authentication.all\n end",
"def create\n @assembly = @plan.assemblies.build(params[:assembly])\n\n respond_to do |format|\n if @assembly.save\n format.html { redirect_to [@plan, @assembly], notice: 'Assembly was successfully created.' }\n format.json { render json: @assembly, status: :created, location: @assembly }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assembly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @available_assemblies = @plan.assemblies.available\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relationship }\n end\n end",
"def index \n @sims_biga_licenses = SimsBigaLicense.order(cnh_pes_id: :asc).page(params[:page]).per(20) \n authorize @sims_biga_licenses \n end",
"def index\n @broker_acls = BrokerAcl.all\n end",
"def index\n @access_codes = AccessCode.all\n end",
"def index\n\t\trespond_to do |format|\n\t\t\tformat.html {\n\t\t\t\tfacets()\n\t\t\t}\n\t\t\tformat.xml {\n\t\t\t\t@archives = Archive.all\n\t\t\t}\n\t\tend\n\tend",
"def index\n authorize @organization\n render :json => @organization.tags\n end",
"def index\n @financing = Financing.find(params['financing_id'])\n @apr_stages = @financing.apr_stages\n end",
"def index\n @vaccinators = Vaccinator.all\n end",
"def index\n if params[:active_ambassadors]\n @ambassadors = Ambassador.approved\n elsif current_user\n @ambassadors = Ambassador.all\n else\n redirect_to 'http://globalmathproject.com'\n end\n end",
"def index\n @client_assets = ClientAsset.all\n end",
"def index\n authorize Role\n @roles = Role.all\n end",
"def index\n @bundles = current_user.bundle\n end",
"def index\n @authers = Auther.all\n end",
"def index\n @authers = Auther.all\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def index\n @activist_fronts = ActivistFront.all\n authorize ActivistFront\n end",
"def index\n @asslibs = current_user.asslibs\n end",
"def index\n authorize! :read, Guara::Ability\n @modules = SystemModule.all\n @abilities = SystemAbility.all\n end",
"def index\n @security_agents = SecurityAgent.all\n end",
"def index \n @assets = current_user.assets \n end",
"def index\n @collection = AssetCollection.find(params[:asset_collection_id])\n\t\tannotations = @collection.annotations\n\n\t\trespond_to do |format|\n\t\t\tformat.json { \t\n\t\t\t\trender :json => annotations.to_json\n\t\t\t}\n\t\tend \n\tend",
"def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end",
"def index\n @azuls = Azul.all\n end",
"def index\n @libraries = Library.all\n end",
"def index\n @libraries = Library.all\n end",
"def index\n #currenbt user all libearies\n @libraries = current_user.libraries.all\n end",
"def index\n @cas = Ca.all\n end",
"def index\n @becarios = Becario.all\n # authorize @becarios\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def index\n @shebao_bases = ShebaoBase.all\n end",
"def index\n @accesses = Access.all\n respond_with(@accesses)\n end",
"def index\n authorize!(:view_configuration_management)\n end",
"def authentications\r\n AuthenticationsController.instance\r\n end",
"def index\n @visa_applications = VisaApplication.all\n end",
"def index\n @diriving_licenses = DirivingLicense.all\n end",
"def show\n #@assets = @project.assets.all\n\n end",
"def index\n @pages = apply_scopes(Page.includes(:versions)).by_title.page params[:page]\n authorize @pages\n end",
"def index\n @slider_principals = SliderPrincipal.all\n end",
"def index\n if( admin_authorized? )\n @bundles = Bundle.paginate(:all, :order => \"Title\", :page=>params[:page], :per_page=>3 )\n else\n @bundles = Bundle.paginate(:all, \n :conditions => [ 'level <= ? and public > ? or created_by_user_id = ?', user_level, 0, ( @user ? @user.id : -1 )],\n :order => \"Title\",\n :page=>params[:page], \n :per_page=>3 \n )\n end\n \n\t\tlogger.info(\"------> Authorized?: #{@admin_authorized}\" )\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bundles }\n end\n end",
"def index\n\t\tauthorize! :index, AsignacionRol\n @proyecto = Proyecto.find(params[:proyecto_id])\n @asignacion_roles = AsignacionRol.where(\"active = ? AND proyecto_id = ?\", true, params[:proyecto_id])\n #@proyecto = AsignacionRol.where(\"active = ? AND proyecto_id = ?\", true, params[:proyecto_id])\n end",
"def index\n @autors = Autor.all\n end",
"def index\n @loanables = current_user.loanables.includes(:loan_contracts).all\n end",
"def index\n #@centers = Center.page(params[:page]).per(Settings.pagination.per_page)\n # https://github.com/ryanb/cancan/wiki/authorizing-controller-actions#load_resource\n @centers = @centers.page(params[:page]).per(Settings.pagination.per_page)\n end",
"def index\n @assessors = Assessor.all\n end",
"def index\n\t\t@assets = Asset.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @assets }\n\t\tend\n\tend",
"def index\n authorize AdocName\n @adoc_names = AdocName.all\n end",
"def index\n @apis = Api.all\n end",
"def index\n do_authorize_class\n get_project_if_exists\n do_authorize_instance(:show, @project) unless @project.nil?\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n @sites, opts = Settings.api_response.response_advanced(\n api_filter_params,\n list_permissions,\n Site,\n Site.filter_settings\n )\n respond_index(opts)\n end\n end\n end",
"def index\n @authos = Autho.all\n end",
"def index\n @certificate_authorities = CertificateAuthority.all\n @certificate_authorities.each { |ca| ca.collect_certificates }\n end",
"def authorised_assets(asset_class, projects = nil, action = 'view')\n assets = asset_class\n assets = assets.filter_by_projects(projects) if projects\n assets = assets.authorized_for(action, User.current_user).to_a\n assets = assets.sort_by(&:title) if !assets.blank? && !%w[Project].include?(assets.first.class.name)\n assets\n end",
"def index\n @cargo_manifests = CargoManifest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cargo_manifests }\n end\n end",
"def index\n authorize! :create_account, Account\n @accounts = Account.all.decorate\n\n end",
"def show\n @user = User.find(@organization.owner_id)\n @resources = @organization.managed_classes\n end",
"def index\n @application_forms = ApplicationForm.where(organization_id: params['organization_id'])\n authorize @application_forms\n\n render json: @application_forms\n end",
"def index\n @artifacts = Artifact.all\n end",
"def index\n @architectures = Architecture.all\n end",
"def index\n @metadata_schemas = MetadataSchema.arrange(:order => :created_at)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @metadata_schemas }\n end\n authorize! :metadata_schemas, MetadataSchema\n end",
"def index\n @accolaids = Accolaid.all\n end"
] |
[
"0.7329718",
"0.58147573",
"0.58066475",
"0.578521",
"0.57756835",
"0.5773556",
"0.5713083",
"0.57055205",
"0.57055205",
"0.5669257",
"0.56617886",
"0.5636892",
"0.5632952",
"0.5632952",
"0.56128055",
"0.5609874",
"0.5591478",
"0.55783176",
"0.5575782",
"0.55486387",
"0.55463153",
"0.55448395",
"0.55304605",
"0.55300575",
"0.55245847",
"0.55178493",
"0.5503567",
"0.5500534",
"0.55001813",
"0.55001813",
"0.5496891",
"0.54947895",
"0.5486781",
"0.5479067",
"0.54654264",
"0.54596496",
"0.54548633",
"0.54503995",
"0.5441482",
"0.54389125",
"0.54301405",
"0.54237837",
"0.5405245",
"0.54040676",
"0.54004145",
"0.53955114",
"0.53940785",
"0.53907424",
"0.53853315",
"0.5374311",
"0.5364482",
"0.5362904",
"0.5357016",
"0.5353011",
"0.5350554",
"0.5350554",
"0.5345392",
"0.5344054",
"0.5341848",
"0.5335296",
"0.5331772",
"0.5331196",
"0.53299725",
"0.53227365",
"0.5322388",
"0.5320709",
"0.5320709",
"0.53204256",
"0.531894",
"0.53140074",
"0.53067905",
"0.530611",
"0.5305227",
"0.53045315",
"0.53017855",
"0.53016484",
"0.5300514",
"0.5297788",
"0.5289658",
"0.5288613",
"0.52857924",
"0.52826685",
"0.52778834",
"0.5272176",
"0.5270237",
"0.52691674",
"0.5263684",
"0.52617246",
"0.52595705",
"0.5258687",
"0.52556676",
"0.5255361",
"0.52519524",
"0.52491295",
"0.52465504",
"0.5245995",
"0.5244093",
"0.52430886",
"0.5236061",
"0.52356195",
"0.52344984"
] |
0.0
|
-1
|
GET /customers GET /customers.json
|
def index
@customers = Stripe::Customer.all(:limit => 100)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @customers = @user.customers.all\n render json: @customers\n end",
"def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end",
"def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"def customer_list\n perform_get_request('/customer/list')\n end",
"def get_customers\n return ShopifyAPI::Customer.all\n end",
"def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend",
"def customers\n ShopifyAPI::Customer.all\n end",
"def get_customer(id)\n get(\"customers/#{id}\")\n end",
"def get_customer(id)\n get(\"customers/#{id}\")\n end",
"def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\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[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end",
"def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"def list\n @customers = Customer.all\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @customers }\n end\n end",
"def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end",
"def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end",
"def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end",
"def index\n @customers = Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end",
"def customers\n @customers ||= new_resource(self, :customer, :customers)\n end",
"def index\n if params[:search_term]\n customers = Customer.search_customer(params[:search_term])\n else\n if read_from_cache(\"customers\")\n customers = read_from_cache(\"customers\")\n else\n customers = apply_scopes(Customer).all\n write_to_cache(\"customers\", customers)\n end\n end\n\n if params[:page_no]\n result = pagy(customers)\n else\n result = customers\n end\n render :json => result\n end",
"def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end",
"def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end",
"def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end",
"def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n return data\n end",
"def show\r\n @customer = Customer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render :json => @customer }\r\n end\r\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: CustomersDatatable.new(view_context) }\n end\n @customers = Customer.all\n end",
"def customers\n Easybill::Api::Customers\n end",
"def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end",
"def index\n respond_to do |format|\n format.html { @customers = Customer.all }\n format.json { @customers = Customer.order(:name) }\n end\n end",
"def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end",
"def show\n @customers = Customer.all\n end",
"def show\n @customers = Customer.all\n end",
"def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end",
"def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.get_customers ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/customer\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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 => 'CustomerSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def index\n @customers = Customer.all\n end",
"def show\n customer = Customer.find(params[:id])\n authorize! :read, customer\n render json: customer\n end",
"def list_customers(opts = {})\n operation('ListCustomers')\n .add(opts)\n\n run\n end",
"def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end",
"def index\n\t@customers = Customer.all()\n end",
"def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end",
"def all(options = { page: 1, page_size: 10 })\n response = JSON.parse(@client.get('Customers', options).body)\n customers = response.key?('Items') ? response['Items'] : []\n customers.map { |attributes| Unleashed::Customer.new(@client, attributes) }\n end",
"def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?\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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\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] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end",
"def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end",
"def get_customer(opts = {})\n data, _status_code, _headers = get_customer_with_http_info(opts)\n data\n end",
"def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end",
"def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end",
"def show\n @customer = customers.find(params[:id])\n end",
"def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end",
"def index\n @my_customers = MyCustomer.all\n end",
"def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end",
"def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end",
"def index\n @customers = Customer.where(user_id: current_user.id)\n end",
"def get_customer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer'\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 => 'PageCustomer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end",
"def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def all_customers\n if @customer_records_file.nil? || !File.exist?(@customer_records_file)\n raise ArgumentError, 'Customer records file must be provided'\n end\n\n File.open(@customer_records_file, 'r') do |f|\n f.each_line.map do |line|\n JSON.parse(line)\n end\n end\n end",
"def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n \n render json: {farmers: Farmer.all, customers: CustomerUser.all} #User.all #CustomerUser.all #{users: User.all, customers: Customer_User.all}\n end",
"def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end",
"def index\n @users = User.fetch_all_customers\n end",
"def index\n @customer_infos = CustomerInfo.all\n end",
"def show\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potential_customer }\n end\n end",
"def list_customers_with_http_info(authorization, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.list_customers ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.list_customers\" if authorization.nil?\n # resource path\n local_var_path = \"/v2/customers\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\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 => 'ListCustomersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#list_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @customers = get_customers(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @customers }\n end\n end",
"def find(id)\n response = JSON.parse(@client.get(\"Customers/#{id}\").body)\n Unleashed::Customer.new(@client, response)\n end",
"def index\n @customers = current_user.customers.paginate(:per_page => 20, :page => params[:page], :order => 'name', :include => :transactions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @customers }\n end\n end",
"def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end",
"def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end",
"def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end",
"def customers\r\n @customers ||= CustomersController.new(configuration: @configuration)\r\n end",
"def list\n display_customers\n end",
"def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end\n end",
"def show\n @user = User.find(params[:user_id])\n @customer = @user.customers.find(params[:id])\n @album = Album.new\n @albums = @customer.albums\n @notes = @customer.notes.order(\"created_at DESC\")\n @note = Note.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end",
"def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_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] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end",
"def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end",
"def show\n @customer = current_user.customers.find(params[:id], :include => :orders)\n @orders = @customer.orders.paginate(:per_page => current_user.profile.orders_per_page, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"def customerGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end"
] |
[
"0.8047603",
"0.7958144",
"0.7873304",
"0.7785816",
"0.7759628",
"0.7743392",
"0.773739",
"0.7649949",
"0.7649949",
"0.76442534",
"0.76389146",
"0.75627637",
"0.74394524",
"0.74304146",
"0.74222744",
"0.7394979",
"0.72827095",
"0.7276728",
"0.7260948",
"0.7250168",
"0.7250168",
"0.7250168",
"0.7250168",
"0.7250168",
"0.7250168",
"0.72462",
"0.7163521",
"0.7154197",
"0.7125226",
"0.7099512",
"0.70645434",
"0.7044982",
"0.70435",
"0.70316666",
"0.70228696",
"0.70116216",
"0.70116216",
"0.7004819",
"0.7002401",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.6972793",
"0.69627",
"0.6938483",
"0.6920675",
"0.6888581",
"0.6884735",
"0.68840814",
"0.68791765",
"0.68702394",
"0.6868448",
"0.68514013",
"0.6848052",
"0.68401223",
"0.68097484",
"0.68097484",
"0.68058634",
"0.6768543",
"0.6764273",
"0.67610204",
"0.6708986",
"0.6703695",
"0.66999173",
"0.66968775",
"0.667451",
"0.6642976",
"0.66197973",
"0.66063404",
"0.66050726",
"0.66016906",
"0.65902996",
"0.6587931",
"0.65875447",
"0.658343",
"0.6561056",
"0.6543455",
"0.6523269",
"0.6518642",
"0.6507034",
"0.65047795",
"0.650015",
"0.6484135",
"0.64835244",
"0.648316",
"0.64812934",
"0.64714205",
"0.64582753",
"0.64582753",
"0.64582753",
"0.6435244",
"0.6433993",
"0.64323884"
] |
0.0
|
-1
|
before_action :student_validate, except: [:enter_exam, :check_status_exam, :question_student]
|
def layout_by_resource
if devise_controller?
"new_login"
else
"application"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def before_action \n end",
"def beforeValidation\n\n puts \"-----------beforeValidation------------\"\n\n #selfTest(self)\n\n puts \"-----------beforeValidation------------\"\n\n\n \n end",
"def pre_validation\n\n\n end",
"def determine_valid_action\n\n end",
"def require_student\n redirect_to root_path unless @auth_user && @auth_user.type == 'Student'\n end",
"def required_student\n require_user_type(:student)\n end",
"def before(controller)\n @old_proc = ActionView::Base.field_error_proc\n ActionView::Base.field_error_proc = @new_proc\n true\n end",
"def validate_question params\n\n end",
"def rollcall_student_required\n if current_user.is_rollcall_epi? || current_user.is_rollcall_health_officer? || current_user.is_rollcall_nurse? ||\n current_user.is_rollcall_admin?\n return true\n else\n redirect_to :action => \"unauthorized\", :controller => 'rollcall/rollcall_app'\n return false\n end\n end",
"def pre_validation\n\n end",
"def check_student\n if !current_student\n redirect_to :root, notice: \"You are not logged in as student\"\n end \n end",
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def correct_student\n @student = Student.find(params[:id])\n redirect_to(root_url) unless current_student?(@student)\n end",
"def exam_student_params\n params.require(:exam_student).permit(:exam_id, :user_id, :status)\n end",
"def verify_not_before; end",
"def verify_not_before; end",
"def valid_before; end",
"def check_must_be_student_restriction\n if @offering.allow_students_only?\n @restriction = MustBeStudentRestriction.new(:offering_id => @offering.id)\n render :action => \"restricted\" and return unless @restriction.allows?(@user_application)\n end\n if !@user_application.person.is_a?(Student) && @offering.require_invitation_codes_from_non_students?\n redirect_to :action => \"enter_code\" and return if @user_application.offering_invitation_code.nil?\n end\n end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def validate_step\n case action_name\n when 'protocol'\n validate_catalog\n when -> (n) { ['service_details', 'save_and_exit'].include?(n) }\n validate_catalog && validate_protocol\n when 'service_calendar'\n validate_catalog && validate_protocol && validate_service_details\n else\n validate_catalog && validate_protocol && validate_service_details && validate_service_calendar\n end\n end",
"def must_be_student\n unless current_user.role.name.eql?('Student')\n flash[:error] = \"Access denied.\"\n redirect_to root_url\n end\n end",
"def validation; end",
"def validation; end",
"def disallow_teaching_staff_force_submit_assessment_submissions\n cannot :force_submit_assessment_submission, Course::Assessment\n end",
"def check_instructor_or_student\n if !current_instructor && !current_student\n redirect_to :root, notice: \"You are not logged in as instructor or student\"\n end \n end",
"def unsubmit_students\n # self.lesson.students - self.students\n self.grades_course.students - self.students\n end",
"def validate_student(student_params)\n mobile_number_regex = /^[1-9]\\d{9}$/\n email_regex = /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z\\d\\-]+)*\\.[a-z]+\\z/i\n\n render json: {error: \"Please enter name\"}, status: :bad_request if params[:name].blank?\n render json: {error: \"Please enter email in right format\"}, status: :bad_request if params[:name].blank? || !params[:email].match(email_regex)\n puts params[:password].size()\n render json: {error: \"Please enter a valid password\"}, status: :bad_request if params[:password].blank? || !(params[:password].size() > 7)\n render json: {error: \"Please enter valid mobile_number\"}, status: :bad_request if params[:mobile].blank? || !params[:mobile].match(mobile_number_regex)\n render json: {error: \"Please enter school_name\"}, status: :bad_request if params[:school_name].blank?\n render json: {error: \"Please enter class\"}, status: :bad_request if params[:standard].blank?\n render json: {error: \"Please enter address\"}, status: :bad_request if params[:address].blank?\n render json: {error: \"Please enter roll_no\"}, status: :bad_request if params[:roll_no].blank?\n end",
"def disallow_teaching_staff_delete_assessment_submissions\n cannot :delete_all_submissions, Course::Assessment\n end",
"def validate_review_sort()\n \nend",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def skip_actions; end",
"def validate!\n # pass\n end",
"def before_pass \n @test = @subject.tests.find_by_id(params[:id]) \n if request.post?\n @student_name = params[:test][:student_name]\n @student_class = params[:test][:student_class] \n if @test.authenticate(params[:test][:test_password]) && !@student_name.blank? && !@student_class.blank?\n student = User.find_or_create @student_name \n self.current_user = student \n create_test_session @test, student, @student_class \n redirect_to :action => 'pass'\n else\n flash[:notice] = \"Please enter your name, class and test access password\"\n end \n end\n end",
"def extra_validations\n success\n end",
"def validate\r\n\r\n end",
"def _before_validation\n end",
"def require_student_or_instructor\n redirect_to root_path unless @auth_user && ['Student', 'Instructor'].include?(@auth_user.type)\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n\n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def check_student\n @@name_path = request.env['PATH_INFO']\n if current_user&.student? and (@@name_path != \"/my_projects\" and @@name_path != \"/\")\n begin\n redirect_to :back, alert: \"You do not have access to that page.\"\n rescue Exception\n redirect_to \"/\", alert: \"You do not have access to that page.\"\n end\n end\n end",
"def create\n @exam_student = ExamStudent.new\n if params[:user_id]\n @exam_student.user_id = params[:user_id]\n end\n if params[:exam_id]\n @exam_student.exam_id = params[:exam_id]\n end\n if params[:status]\n @exam_student.status = params[:status]\n end\n\n respond_to do |format|\n if @exam_student.save\n format.html { redirect_to exams_url, notice: 'Prijavili ste ispit.' }\n format.json { render :show, status: :created, location: @exam_student }\n else\n format.html { render :new }\n format.json { render json: @exam_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def controller_actions_should_fail(cont, opts={})\n except= opts[:except] || []\n actions_to_test= get_all_actions(cont).reject { |a| except.include?(a) } #controller_class.action_methods\n actions_to_test += opts[:include] if opts[:include]\n actions_to_test.each do |a|\n get a\n response.should_not be_success\n #response.should redirect_to('http://test.host/login')\n #flash[:warning].should == @login_warning\n end\n end",
"def validate_field_without_promotion\n return unless @designation_history.prev_designation_id.nil?\n begin\n if (@designation_history.new_designation_id != params[:designation_id].to_i) and (@designation_history.applicable_from == params[:designation_history][:applicable_from].to_date)\n flash.now[:error]= l(:designation_not_update_error)\n elsif (@designation_history.applicable_from != params[:designation_history][:applicable_from].to_date) and (@designation_history.new_designation_id == params[:designation_id].to_i)\n flash.now[:error] = l(:desgination_applicable_from_error)\n end\n rescue\n flash.now[:error] = l(:proper_date_error_message)\n end \n render 'systango_hrm_employees/edit' unless flash.now[:error].blank?\n end",
"def after_validate\n end",
"def actions_status\n flash[:error] = \"This method is absent\"\n redirect_to action: 'index'\n end",
"def student_user\n unless this_is_studente?(current_user)\n flash[:danger] = \"You don't have the rights for this page.\"\n redirect_to(root_url)\n end\n end",
"def must_be_current_student\n # Need to match current user to current student id\n unless current_user.id == params[:id]\n redirect_to root_path, notice: \"This is not you!\"\n end\n end",
"def student_actions\n case params[:thing_to_do]\n when 'Advance year'\n advance_students\n when 'Revert year'\n revert_students\n when 'Deactivate'\n mass_deactivate\n when 'Activate'\n mass_reactivate\n when 'Edit teacher'\n editing_teacher\n when 'Assign tutor'\n assigning_tutor\n when 'Add notes'\n adding_notes\n else\n message = { message: 'That action is not defined.' }\n render json: message, status: :unprocessable_entity\n end\n end",
"def student?\n false\n end",
"def validation_of_user_input(name, cohort, city, hobby)\n\n if !name.empty? && ( !cohort.empty? && @months.include?(\"#{cohort}\")) && !city.empty? && !hobby.empty?\n single_student = {month: \"#{cohort}\", name: name, city: city, hobby: hobby}\n @students << single_student\n list_or_continue_prompt\n elsif !@months.include?(\"#{cohort}\") && !name.empty? && !cohort.empty? && !city.empty? && !hobby.empty?\n puts \"You did´t enter a valid month, please try again!\\n\\n\"\n put_in_user\n#prompt when u haven´t entered all information, calls put_in_user\n else name.empty? && cohort.empty? && city.empty? && hobby.empty?\n puts \"Please fill in all fields\\n!\"\n list_or_continue_prompt\n end\nend",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def validate\n \n \n end",
"def skip_validation?\n devise_controller? || welcome_controller? || appointment_path?\n end",
"def before\n\t\t\ttrue\n\t\tend",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n \n if @student.marks1 < 40 || @student.marks2 < 40 || @student.marks3 < 40\n NotifyFailMailer.alert_admin(@student).deliver\n end\n\n format.html { redirect_to @student, notice: \"Student was successfully created.\" }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def before_step(step)\n # Do nothing\n end",
"def before_assert\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def former_student\n @batch = Batch.shod(params[:graduate][:batch_id])\n @batch.graduate(params[:students], params[:graduate][:status_description])\n former_student2\n authorize! :create, @batch\n end",
"def validate\n @invalid=false\n end",
"def validate\r\n @invalid=false\r\n end",
"def index\n authorize Student\n if User.find_by_email(current_user.email).provider == 'facebook' and Student.find_by_email(current_user.email).education == 'DUMMY'\n redirect_to edit_student_path(Student.find_by_email(current_user.email)), notice: 'Please fill out details first !'\n end\n\n @students = Student.all\n # authorize Student\n end",
"def validate\n super \n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def before\n end",
"def validate\n super\n end",
"def require_student_or_admin\n redirect_to root_path unless @auth_user && ['Student', 'Admin'].include?(@auth_user.type)\n end",
"def create\n @title = t(:message_0, :scope => [:controller, :exams])\n unless @user.has_role? 'faculty_secretary'\n by_subject\n render :action => :by_subject\n else\n session[:exam] = nil\n end\n end",
"def disallow_teaching_staff_publish_assessment_submission_grades\n cannot :publish_grades, Course::Assessment\n end",
"def validated; end",
"def verify_not_before=(_arg0); end",
"def verify_not_before=(_arg0); end",
"def valid?\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 \n \n \n \n \n \n \n end",
"def valid?\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 end",
"def student_params\n params.require(:student).permit!\n end",
"def validate_if_enabled\n unless FeeAccount.is_deletion_enabled\n flash[:notice] = t('not_permitted')\n if request.get?\n redirect_to :controller => \"user\", :action => \"dashboard\"\n else\n render :update do |page|\n page.redirect_to({:controller => \"user\", :action => \"dashboard\"})\n end\n end\n end\n end",
"def first_exam_params\n params.require(:first_exam).permit(:first_exam_id, :grade, :course_id, :student_id)\n end",
"def rand_exam_params\n params.require(:xmt_test_rand_exam).permit!\n end",
"def valid?\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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\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 end",
"def set_scenario\n if @scenario = Scenario.find_by_id(params.require(:scenario_id))\n if not @scenario.has_student? current_user\n redirect_to '/student'\n end\n else\n redirect_to '/student'\n end\n end",
"def valid?\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 \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 end",
"def action_enable\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def not_present\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.add_to_set(:absences, today_absence)\n format.html { redirect_to students_url, notice: 'Student absences were successfully updated.' }\n format.json { render :json => { value: bullets(@student.absences) }.to_json }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_patient\n if current_user.role!=\"Patient\"\n flash[:info]=\"Sorry You are not allowed to book appointment.\"\n redirect_to user_path(current_user)\n end\nend",
"def validate_resource\n begin \n # Below line will skip extra processing of fiter \n # in subsequent action execution in request chain.\n @resource ||= params[:resource_type].constantize.find(params[:resource_id]) \n rescue\n flash[ :notice ] => \"Invalid #{params[:resource_type] }\"\n end\n end",
"def cannot_edit_All\n if @page.name == Rails.application.config.ALL_PAGE\n redirect_to show_all_path\n end\n end",
"def studente_user\n unless this_is_studente?(current_user)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end"
] |
[
"0.65966564",
"0.6199678",
"0.61837775",
"0.60897243",
"0.6086637",
"0.6003888",
"0.5980892",
"0.5968659",
"0.59161556",
"0.5897849",
"0.58839566",
"0.58488584",
"0.5848739",
"0.5838328",
"0.5820042",
"0.5820042",
"0.5799771",
"0.5796754",
"0.57797843",
"0.5775775",
"0.5769544",
"0.5745223",
"0.5745223",
"0.5707096",
"0.56973577",
"0.5685841",
"0.5685247",
"0.5674111",
"0.56654316",
"0.5646707",
"0.5646707",
"0.5646707",
"0.5643532",
"0.5635049",
"0.5611445",
"0.5607803",
"0.56012833",
"0.5590258",
"0.5569431",
"0.55685246",
"0.55685246",
"0.55685246",
"0.5567362",
"0.5565691",
"0.5558112",
"0.5558112",
"0.5558112",
"0.5555228",
"0.55507386",
"0.5521138",
"0.55207765",
"0.551214",
"0.5510542",
"0.55071235",
"0.55042005",
"0.5500372",
"0.54987496",
"0.5497664",
"0.5492849",
"0.548875",
"0.54715776",
"0.5458733",
"0.54522073",
"0.54477555",
"0.5434145",
"0.5420022",
"0.5420022",
"0.5420022",
"0.5420022",
"0.5415555",
"0.5413511",
"0.5411651",
"0.5403018",
"0.5393115",
"0.5391225",
"0.53815293",
"0.5379034",
"0.5377959",
"0.5354166",
"0.53532535",
"0.5351743",
"0.53502035",
"0.53502035",
"0.53429496",
"0.5341666",
"0.53358364",
"0.5335309",
"0.53327024",
"0.5331232",
"0.5329946",
"0.5329946",
"0.5328724",
"0.53222597",
"0.5315463",
"0.5310305",
"0.5307494",
"0.5304589",
"0.5302171",
"0.52963513",
"0.52934843",
"0.52815807"
] |
0.0
|
-1
|
very bad idea to go so deep
|
def index_joins
@rails.choice[:joins]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recursive => nil",
"def nesting() end",
"def depth; end",
"def traverse; end",
"def deep_each\n \n end",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def depth=(_arg0); end",
"def child_keys() []; end",
"def parents; end",
"def parsed_tree; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def build_tree(arr)\n\tend",
"def my_depth\n 1\n end",
"def too_nested\n \"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{nil}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"\nend",
"def children() []; end",
"def private; end",
"def get_kids(obj)\n # if it's a hash, then there are more layers\n if(obj.class.to_s == \"Hash\")\n # drill down and keep getting kids\n obj.keys.map{|name| {:name=>name, :children=> get_kids(obj[name])}}\n else\n # Otherwise, we're at the edge. Just build an array of \"name\" hashes.\n obj.map{|name| {:name=>name}}\n end\nend",
"def deep_cur\n self.cur.deep_cur\n end",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findOrCreateRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end",
"def deep_clone; end",
"def deepest_cause; end",
"def one_singleton_ancestors_cache; end",
"def recursive\n attributes.fetch(:recursive)\n end",
"def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend",
"def depth_first(value)\n\tend",
"def recursive_solution\n\n end",
"def children; []; end",
"def deepest(cause); end",
"def one_instance_ancestors_cache; end",
"def walk; end",
"def recursiveTreeTraversal(element)\n begin\n requirementsTree = findRequirementsTree(element)\n unless requirementsTree == nil\n checkForDuplicateRoots(requirementsTree)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\n rescue SystemStackError\n $logger.log(\"Recursive Issue1: \" + element.getName())\n end\nend",
"def produce_tree(ary); end",
"def build_parents(data)\n data.inject({}) do |h, d|\n (1...d.length).each { |i| h[d[i]] = d[0] }; h\n end\nend",
"def test_children\n #puts \"---------------test_children-----------------\"\n t= {}\n\n batch11 = MyResource.new :batch11\n batch12 = MyResource.new :batch12\n batch21 = MyResource.new :batch21\n batch22 = MyResource.new :batch22\n pos1 = MyResource.new :pos1, [ batch11, batch12 ]\n pos2 = MyResource.new :pos2, [ batch21, batch22 ]\n order = MyResource.new :order, [pos1, pos2]\n\n GraphBuilder::Builder.build do |b|\n t[:order] = [ b.add(Thing0.new(order)) ]\n \n b.children do |pos|\n t[pos.name] = b.add Thing1.new(pos)\n b.children do |batch|\n b1 = b.add Thing11.new(batch)\n b2 = b.add Thing12.new(batch)\n t[batch.name] = [b1, b2]\n end\n end\n t[:order] << b.add( Thing2.new(order))\n end\n\n r = Thing.links(t.values.flatten)\n assert_instance_of Thing0, t[:order].first\n assert_instance_of Thing2, t[:order].last\n assert_instance_of Thing1, t[:pos1]\n assert_instance_of Thing1, t[:pos2]\n assert_instance_of Thing11, t[:batch11].first\n assert_instance_of Thing12, t[:batch12].last\n assert_instance_of Thing11, t[:batch21].first\n assert_instance_of Thing12, t[:batch22].last\n\n assert r.include? [t[:order].first,t[:pos1]]\n assert r.include? [t[:order].first,t[:pos2]]\n assert r.include? [t[:pos1],t[:batch11].first]\n assert r.include? [t[:pos1],t[:batch12].first]\n assert r.include? [t[:pos2],t[:batch21].first]\n assert r.include? [t[:pos2],t[:batch22].first]\n assert r.include? [t[:batch11].first,t[:batch11].last]\n assert r.include? [t[:batch12].first,t[:batch12].last]\n assert r.include? [t[:batch21].first,t[:batch21].last]\n assert r.include? [t[:batch22].first,t[:batch22].last]\n assert r.include? [t[:batch11].last,t[:order].last]\n assert r.include? [t[:batch12].last,t[:order].last]\n assert r.include? [t[:batch21].last,t[:order].last]\n assert r.include? [t[:batch22].last,t[:order].last]\n\n assert_equal 14, r.size\n end",
"def each_child\n \n end",
"def weaker\n descendants\n end",
"def too_deep?( depth )\n depth.to_i > 0 && (depth + 1) <= path.to_s.count( '/' )\n end",
"def children=(_arg0); end",
"def children=(_arg0); end",
"def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end",
"def deep_thaw!\n replace deep_thaw\n end",
"def recurse_nodes(parent_names, source_tmp_geo_area)\n if parent_names.count > 1\n parents = parent_names.dup # Tricky! \n name = parents.shift\n puts \"building internal node: #{name} : #{parents} \"\n add_item(\n name: name,\n parent_names: parents,\n source_table: source_tmp_geo_area.source_table,\n source_table_gid: source_tmp_geo_area.source_table_gid,\n is_internal_node: true\n )\n recurse_nodes(parents, source_tmp_geo_area)\n end\n end",
"def ancestors; end",
"def ancestors; end",
"def ancestors; end",
"def ancestors; end",
"def object_tree\n head, *rest = array_tree\n object_subtree(head,rest)\n end",
"def tes_gettree\n tree = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree { |b| tree.push b.rev_index }\n }\n tree_d = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree_debug { |b| tree_d.push b.rev_index }\n }\n\n assert_equal 389, tree.count\n assert_equal 389, tree_d.count\n end",
"def _parent; end",
"def structure_dump() end",
"def probers; end",
"def _parent(a)\n u = @store\n col = \"\"\n arr = a.split(\".\") \n arr[0..-2].each{|x|\n col << \".\" << x \n if u[x] == nil\n u[x] = {}\n elsif !u[x].respond_to?(:[])\n raise \"#{col} is not valid\"\n end\n u = u[x] \n }\n [u, arr[-1]]\n end",
"def depth()\n #This is a stub, used for indexing\n end",
"def all_children_deep(flag=nil)\n\t\tarr = []\n\t\tall_children(flag).each do |c|\n\t\t\tarr << c\n\t\t\tc.all_children_deep(flag).each do |cc|\n\t\t\t\tarr << cc\n\t\t\tend\n\t\tend\t\t\t\n\t\tarr\n\tend",
"def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend",
"def each_ancestor # :nodoc:\n end",
"def my_controlled_flatten(n=1)\n #here\n return self if n < 1\n\n results = []\n self.each do |el|\n if el.class == Array\n #here\n results += el.my_controlled_flatten(n-1)\n else\n results << el\n end\n end\n\n results\n\n end",
"def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend",
"def find_all_parents\n end",
"def nodes; end",
"def nodes; end",
"def nodes; end",
"def no_circular_reference\n\n end",
"def get_children()\n {}\n end",
"def traversal_6\n\n all_people = Perpetuity[Person].select {|person| person.profile_type == \"TeamMember\" }.to_a\n docs = 0\n all_people.each do |person|\n projects = []\n team_member = Perpetuity[TeamMember].find(person.profile.id)\n projects_team_members = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.team_member.id == team_member.id}.to_a\n Perpetuity[ProjectsTeamMember].load_association! projects_team_members, :projects\n\n projects_team_members.each do |projtm|\n projects << projtm.project unless projects.include?(projtm.project)\n end\n projects.each do |project|\n documents = Perpetuity[Document].select {|document| document.project.id == project.id }.to_a\n documents.each do |doc|\n #visiting instead of returning the size\n docs += 1\n end\n end\n end\n return docs\nend",
"def leaf?; false end",
"def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end",
"def traverse_folders(nav_level, parent, parent_link, parent_full_link, node_folder_path) \n\n\t\tnode_list = []\n\t\n\t\t#puts \"traverse_folders(#{nav_level.to_s}, #{parent}, #{node_folder_path})\"\n\t\n\t\tsubfolders = nil\n\t\tbegin\n\t\t\tsubfolders = Dir.entries(node_folder_path).select {|entry| File.directory? File.join(node_folder_path, entry) and !(entry == '.' || entry == '..' || entry == 'assets' || entry == 'images') }\n\t\trescue Errno::ENOENT\n\t\t\tputs \"ERROR: No File or Directory [#{node_folder}]\"\n\t\t\tputs puts\n\t\t\texit\n\t\tend\t \n\t\t\n\t\tsubfolders.each do |folder|\n\t\t\tnode = Map.new\n\n\t\t\tsub_path = node_folder_path + \"/\" + folder\n\t\t\n\t\t\tlink = (parent_link.length == 0 ? \"\" : parent_link + \"/\" ) + folder\n\t\t\tfull_link =\t (parent_full_link.length == 0 ? \"/\" : parent_full_link + \"/\" ) + folder\n\t\t\t\t\n\t\t\tnode = Map.new({\n\t\t\t\tdoctype: \"nav\",\n\t\t\t\tsubtype: \"nav_\" + nav_level.to_s,\n\t\t\t\tnav_type: (File.exist?(\"#{sub_path}/../#{folder}.markdown\") ? \"folder+markdown\" : \"folder\"),\n\t\t\t\tnav_level: nav_level,\n\t\t\t\tnav_order: 9000,\n\t\t\t\tnav_title: process_navigation_name(folder),\t\t\t \n\t\t\t\tsource: folder,\n\t\t\t\tlink: link,\n\t\t\t\tfull_link: full_link,\n\t\t\t\tparent: parent,\n\t\t\t\tparent_nav_title: process_navigation_name(parent_link),\n\t\t\t\tparent_link: parent_link,\n\t\t\t\tparent_full_link: parent_full_link,\n\t\t\t\tparent_path: node_folder_path,\n\t\t\t\tsource_path: sub_path,\n\t\t\t\tancestors: [],\n\t\t\t\tancestors_links: [],\n\t\t\t\tsiblings: [],\n\t\t\t\tsiblings_links: [],\n\t\t\t\tdescendants: [],\n\t\t\t\tdescendants_links: [],\n\t\t\t\tnavigation_yml: (File.exists? (sub_path + \"/aaaa-navigation.yml\")),\n\t\t\t\tindex_erb: (File.exists? (sub_path + \"/index.erb\"))\n\t\t\t})\n\t\t\t\t\n\t\t\titems = traverse_folders(nav_level + 1, folder, link, full_link, sub_path)\n\t\t\n\t\t\tif items.size > 0\n\t\t\t\t node.children = {}\n\t\t\t\t node.children.count = items.size\n\t\t\t\t node.children.items = items\n\t\t\tend\n\t\t\n\t\t\tnode_list << node\n\t\tend\n\t\n\t\tnode_list\n\t \n\tend",
"def children_table; end",
"def ancestors() end",
"def depthfirst?\n false\n end",
"def flatten() end",
"def test_base_method_every_sub_structure\n assert structure = Structure.get(:super)\n sub_structures = %w(ManySub1 ManySub1Sub1 ManySub1Sub1Sub1 ManySub1Sub2 ManySub2 OneSub1 OneSub1Sub1 OneSub1Sub1Sub1 OneSub1Sub2 OneSub2)\n structure.every_sub_structure do |struct|\n assert sub_structures.delete(struct)\n end\n assert_equal sub_structures, []\n end",
"def get_root()\n \n end",
"def one_interface_ancestors_cache; end",
"def grab_children(father)\n local_list = []\n father.each_pair do |key, value| \n local_list.push(key)\n local_list.push(grab_children(value))\n end\n return local_list\nend",
"def recursive\n @attributes[:recursive]\n end",
"def recursive\n @attributes[:recursive]\n end",
"def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def subgenres; end",
"def max_nesting()\n #This is a stub, used for indexing\n end",
"def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend"
] |
[
"0.6873934",
"0.6543271",
"0.64127475",
"0.6229251",
"0.6223764",
"0.5947107",
"0.59296095",
"0.59018165",
"0.579625",
"0.57234025",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.56508756",
"0.5648057",
"0.5633905",
"0.5629168",
"0.55675644",
"0.5549157",
"0.5545776",
"0.55414426",
"0.553657",
"0.5509162",
"0.5494332",
"0.548642",
"0.5437629",
"0.54288",
"0.5425546",
"0.5423166",
"0.54195845",
"0.5411739",
"0.54060364",
"0.53987914",
"0.5380841",
"0.5367444",
"0.5343963",
"0.53428894",
"0.5336844",
"0.5323956",
"0.5316387",
"0.5310764",
"0.5310683",
"0.52984256",
"0.52945256",
"0.52945256",
"0.529175",
"0.5279088",
"0.52689886",
"0.5266891",
"0.5266891",
"0.5266891",
"0.5266891",
"0.52614576",
"0.52607083",
"0.52554953",
"0.5254917",
"0.5252998",
"0.52443224",
"0.521463",
"0.5210755",
"0.52098864",
"0.52059644",
"0.52027464",
"0.5198965",
"0.5193449",
"0.51838994",
"0.51838994",
"0.51838994",
"0.5181787",
"0.5179685",
"0.51606196",
"0.51569414",
"0.514558",
"0.51370263",
"0.5128056",
"0.51274765",
"0.51217705",
"0.51047045",
"0.510187",
"0.5096358",
"0.50933236",
"0.50923234",
"0.5089053",
"0.5089053",
"0.5088066",
"0.508131",
"0.508131",
"0.508131",
"0.508131",
"0.508131",
"0.50726837",
"0.5063929",
"0.5058924"
] |
0.0
|
-1
|
which fields will be visible on the index page
|
def index_fields
if @rails.choice[:index_fields].blank?
@rails.resource.fields.keys
else
@rails.choice[:index_fields].collect{|field| field.split(':').first}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @fields = all_fields\n end",
"def index\n @fields = Field.all\n end",
"def document_show_fields\n Blacklight.config[:show_fields][:field_names]\n end",
"def index_fields\n self.class.fields.values.select { |field| field.index }\n end",
"def index_fields\n fields - %i[nonop_source justification review_comment created_at updated_at]\n end",
"def index_fields\n fields - %i[nonop_source justification review_comment created_at updated_at]\n end",
"def index_fields\n fields - %i[nonop_source justification review_comment created_at updated_at]\n end",
"def show_fields\n self.class.fields.values.select { |field| field.show }\n end",
"def fields\n FIELDS\n end",
"def fields\n search_params.return_fields +\n %w[document_type\n title\n description\n organisation_content_ids\n topic_content_ids\n mainstream_browse_page_content_ids\n popularity\n format\n link\n public_timestamp\n updated_at\n indexable_content]\n end",
"def index\n @form_fields = FormField.all\n end",
"def fields\n FIELDS\n end",
"def fields; end",
"def fields; end",
"def fields; end",
"def fields\n FIELDS\n end",
"def index\n @extra_fields = ExtraField.all\n end",
"def display_all_fields\n @@all_fields\n end",
"def index\n @user_fields = UserField.all\n end",
"def index\n @user_fields = UserField.all\n end",
"def index_field_names\n Blacklight.config[:index_fields][:field_names]\n end",
"def index\n @company_dei_fields = CompanyDeiField.all\n end",
"def display_fields\n @form.fields.each {|f| puts f.name}\n end",
"def index\n @fields = @group.fields\n end",
"def index\n @tbl_form_fields = TblFormField.all\n end",
"def index_fields\n\t\t\tif defined? @_index_fields\n\t\t\t\t@_index_fields\n\t\t\telse\n\t\t\t\t#column_names = self.column_names.map do |m|\n\t\t\t\t\t#m.to_sym\n\t\t\t\t#end\n\t\t\t\tsorted_attributes\n\t\t\t# \tsorted_attrs + (column_names - sorted_attrs - [\"created_at\", \"updated_at\", \"id\"])\n\t\t\tend\n\t\tend",
"def show\n set_index_options\n end",
"def index\n @company_fields = CompanyField.all\n end",
"def display_fields\n database_field_names\n end",
"def index\n @fields = Field.all\n respond_with :admin, @fields\n end",
"def show_fields(**params)\n get('fields', params)\n end",
"def fields\n @fields\n end",
"def fields\n @fields\n end",
"def visible_fields\n fields.select {|f| f.visible? }\n end",
"def admin_display_fields\n admin.class.terminology.terms.keys - [:admin, :published_at, :edited_at, :template_name, :batch_id]\n end",
"def releaf_fields_to_display action\n column_names - %w[id created_at updated_at]\n end",
"def manifestation_index_field_names\n Blacklight.config[:manifestation_index_fields][:field_names]\n end",
"def fields\n @fields\n end",
"def search_form_columns\n columns\n end",
"def fields\n all_fields\n end",
"def index\n @dynabute_fields = Dynabute::Field.where(target_model: target_model)\n end",
"def indexable_fields\n self.class.props.map { |key| key.to_s }\n end",
"def index_headers\n index_fields.map { |field| field.label }\n end",
"def index\n @template_form_fields = TemplateFormField.all\n end",
"def get_fields\n FIELD_DESCS\n end",
"def index\n @custom_fields = CustomField.all\n end",
"def index\n @custom_fields = CustomField.all\n end",
"def index_field_labels\n Blacklight.config[:index_fields][:labels]\n end",
"def fields\n search.class.fields\n end",
"def search_fields\n Blacklight.config[:search_fields]\n end",
"def index\n @farm_fields = FarmField.all\n end",
"def index\n @dynamic_fields = DynamicField.where({:dynamic_model_id=>@model.id}).order(\"position\").paginate(:page=>params[:page])\n end",
"def show\n @fields = FormularioField.where \"formulario_id =?\", @formulario.id\n end",
"def fields\n self.class.fields(true)\n end",
"def fields\n @fields.keys\n end",
"def fields\n @fields.keys\n end",
"def field_indexes\r\n return @field_indexes\r\n end",
"def all_list_view_fields\n return @all_list_view_fields if defined? @all_list_view_fields\n\n @all_list_view_fields ||= all_fields.select(&:display_in_list)\n end",
"def index\n @form.index\n end",
"def print_searchable_fields\n puts\n puts 'Searchable fields'\n puts '-----------------'\n @searchable_fields[@object].each { |field| puts field }\n puts '-----------------'\n end",
"def index\n @fields = @kind.fields\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fields }\n end\n end",
"def visible_fields\n CategoriesMovie::VisibleFields\n end",
"def title_fields\n []\n end",
"def index\n @classifields = Classifield.all\n end",
"def fields\n displayed_fields = @display_fields.select { |display_field| @document.key?(display_field) }\n pairs = displayed_fields.map do |display_field|\n [display_field, Array.wrap(@document.fetch(display_field))]\n end\n Hash[pairs]\n end",
"def index\n @equipment_fields = EquipmentField.all\n end",
"def search_fields\n [ 'name', 'email', 'description' ]\n end",
"def fields\n field_map_class.new do |field_map|\n index_config.each { |name, index_field_config| field_map.insert(name, index_field_config, object) }\n end\n end",
"def available_views\n %w(index new edit show _list _form)\n end",
"def current_list_page_as_fields *skip_keys\n link_hash_to_hidden_fields current_list_page, skip_keys + [:controller, :action, :model, :id]\n end",
"def display_fields\n [\"user_name\", \"assignment_name\"]\n end",
"def visible_fields\n Episode::VisibleFields\n end",
"def index\n @field_rents = FieldRent.all\n end",
"def index\n @field_offices = FieldOffice.all\n end",
"def index_fields=(fields)\n @index_fields = ::ActiveSupport::HashWithIndifferentAccess.new fields\n end",
"def index_fields_for(display_types)\n Array(display_types).inject(index_fields) do |fields, display_type|\n fields.merge(for_display_type(display_type).index_fields)\n end\n end",
"def index\n projects = Project.where(company_id:current_user.company_id)\n @field_data = FieldDatum.where(project: projects)\n end",
"def index_information\n collection.index_information\n end",
"def index_information\n collection.index_information\n end",
"def index_information\n collection.index_information\n end",
"def index\n @tbl_form_field_helpers = TblFormFieldHelper.all\n end",
"def index_filters\n {}\n end",
"def fields; h.fields; end",
"def index\n @career_fields = CareerField.paginate(:page => params[:page])\n end",
"def all_public_list_view_fields\n return @all_public_list_view_fields if defined? @all_public_list_view_fields\n\n @all_public_list_view_fields ||= all_fields.select(&:display_in_public_list)\n end",
"def describe_index_fields(index_name, type)\n response = send_request(:get, path: \"#{index_name}/_mapping/#{type}\")\n if response.success?\n body = ActiveSupport::JSON.decode(response.body) if response.body.present?\n return if body.blank?\n fields = body[index_name.to_s][\"mappings\"][type.to_s][\"properties\"]\n\n fields.map do |field_name, properties|\n properties = Hash[ properties.map{|k,v| [k.to_sym, v]} ]\n type = properties.delete(:type)\n AgnosticBackend::Elasticsearch::RemoteIndexField.new field_name, type, **properties\n end\n end\n end",
"def index\n @list_field_values = ListFieldValue.find(:all, :order => \"realty_field_id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_field_values }\n end\n end",
"def show_fields=(fields)\n @show_fields = ::ActiveSupport::HashWithIndifferentAccess.new fields\n end",
"def show_field?(name)\n show_fields.key?(name)\n end",
"def fields(klass, show_all = false)\n fields = send(:\"#{klass.to_s.underscore}_fields\") unless show_all\n fields = send(:\"#{klass.to_s.underscore}_all_fields\") if show_all\n fields\n end",
"def index\n @applicant_field_of_studies = current_applicant.applicant_field_of_studies.all\n end",
"def form_columns\n columns\n end",
"def index\n @forms = Form.where(hidden: false).page params[:page]\n end",
"def fetch_fields\n @fields\n end",
"def ft_field_display\n blacklight_config.search_fields[blacklight_config.full_text_index].include_in_simple_select = true\n blacklight_config.search_fields[blacklight_config.full_text_index].if = true\n end",
"def index\n @screen_self = session.active_screen\n screen_id = params[:id].to_i\n @screens = Screen.find(:all).select{|s| !s.system? }\n\n @screen = (screen_id > 0) ? Screen.find(screen_id) : @screens.first\n @screen = @screens.first if @screen && @screen.name == 'fields'\n\n @fields = @screen.fields if @screen\n @fields ||= []\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fields }\n end\n end",
"def field_names\n fields.keys\n end",
"def index\n @fields = Field.where(:status => 'Y').where(:magazine_id => params[:magazine_id]).order(:height, :width).paginate(:page => params[:page], :per_page => 10)\n @order = Order.new\n if session[:user_id]\n @user = User.find(session[:user_id])\n if is_power\n render :index\n else\n render :index_other\n end\n else\n render :index_other\n end\n end",
"def fields\n @fields ||= []\n end",
"def fields\n []\n end"
] |
[
"0.7662567",
"0.74445957",
"0.7378373",
"0.71553946",
"0.7101874",
"0.7101874",
"0.7100855",
"0.70655817",
"0.70632076",
"0.70022136",
"0.69699955",
"0.6936733",
"0.6891161",
"0.6891161",
"0.6891161",
"0.6887004",
"0.6841685",
"0.6835867",
"0.68349355",
"0.68349355",
"0.6827325",
"0.6772938",
"0.6747236",
"0.6737124",
"0.67311275",
"0.67308044",
"0.6730315",
"0.6729477",
"0.668934",
"0.66753787",
"0.6651692",
"0.6648353",
"0.6648353",
"0.6643057",
"0.6634352",
"0.6608667",
"0.66033584",
"0.6595909",
"0.6594715",
"0.6529548",
"0.65185106",
"0.6483512",
"0.64796066",
"0.64630896",
"0.6455914",
"0.6436854",
"0.6436854",
"0.64284605",
"0.6417984",
"0.63863647",
"0.63843244",
"0.63656086",
"0.63387465",
"0.6336217",
"0.63317883",
"0.63317883",
"0.6323389",
"0.6322923",
"0.6314268",
"0.6314089",
"0.63095117",
"0.63035583",
"0.62899786",
"0.62818545",
"0.6255091",
"0.62526715",
"0.62477493",
"0.62473464",
"0.62349176",
"0.6197682",
"0.61966664",
"0.6186808",
"0.61807764",
"0.61696917",
"0.61611784",
"0.61420345",
"0.614167",
"0.6140792",
"0.6140792",
"0.6140792",
"0.6137293",
"0.61227155",
"0.6095139",
"0.60886663",
"0.6072134",
"0.60594577",
"0.6047488",
"0.6046583",
"0.6033043",
"0.6020753",
"0.6018978",
"0.6017348",
"0.6015248",
"0.6013383",
"0.60109556",
"0.59865564",
"0.5984733",
"0.59837216",
"0.59817266",
"0.59624445"
] |
0.75662607
|
1
|
convert company => company_id Used in the index action
|
def permitted_search_fields
fields = @rails.resource.fields
to_ids = []
expanded_fields = expand_association_to_ids fields
search_fields.each do |key|
next unless expanded_fields.keys.include?(key)
type = expanded_fields[key]
to_ids << (['references', 'belongs_to'].include?(type.downcase) ? "#{key}_id" : key)
end
to_ids
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def company_id\n if @company.respond_to?(:to_hash)\n @company.fetch(:company_id) { @company }\n elsif @company.respond_to?(:company_id)\n @company.company_id\n else\n @company\n end\n end",
"def find_company\n Company.find(params[:company_id].to_i)\n end",
"def set_company\n @company = Company.friendly.find(params[:id])\n end",
"def company_id\n self.dig_for_string(\"agentSummary\", \"office\", \"companyId\")\n end",
"def add_company_id\n\t\tcompany = self.employee.company\n\t\tself.company_id = company[:id]\n\tend",
"def company_id\n e = Employee.find_by(user_id: id)\n e.company_id\n end",
"def company(id)\n record \"/contacts/company/#{id}\"\n end",
"def set_company\n @company = @community.companies.friendly.find(params[:id])\n end",
"def company\n @company ||= Company.find(params[:id])\n end",
"def to_param\n \"#{id} #{company.name}\".parameterize\n end",
"def get_company\n @company = Company.find(params[:company_id])\n end",
"def company_ids\n @cached_company_ids ||= @object.companies.legit.pluck(:id)\n end",
"def index\n @company = current_company\n end",
"def index\n set_company\n end",
"def set_company\n Company.find(params[:id])\n end",
"def index\n @company_clients = CompanyClient.where(company: params[:company]).first\n end",
"def identificacion_company\n \"#{type_identification}-#{rif}\"\n end",
"def set_company\n if /^0*[1-9]\\d*$/.match(params[:id])\n find_company\n else\n render json: { description: \"Invalid ID supplied\", code: 400 }\n end\n end",
"def set_company\n @company = Company.find(params[:id]);\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def show\n @company = @job_offer.company_id\n end",
"def set_company\n @company = Company.find(params[:company])\n end",
"def set_company\n id = params[:company_id] ? params[:company_id] : params[:id]\n @company = Company.find(id)\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:company_id])\n end",
"def set_company \n #params[id]に/users/数でとってきた値を入れている\n @company = Company.find(params[:id])\n end",
"def set_company_name\n @company_name = CompanyName.find(params[:id])\n end",
"def name\n \"#{id}-#{company_name}\"\n end",
"def alias_id(d)\n alias_ids.select{|e_id| e_id.entity.company_id == d}.first\n end",
"def set_company\n @company = Company.find_by(code: params[:company_id])\n end",
"def set_company\n @company = Company.find_by(code: params[:company_id])\n end",
"def current_company\n @current_company = current_user.companies.find(params[:company_id])\n end",
"def tl_update_company_textfield_from_office\n office = params[:id]\n @company = 0\n if office != '0'\n @office = Office.find(office)\n @company = @office.blank? ? 0 : @office.company\n end\n render json: @company\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @client_company = ClientCompany.find(params[:id])\n end",
"def show\n @company = Company.find(params[:company_id])\n end",
"def find_company_id(name)\n @company = Company.find_or_create_by(name: name)\n @company.id\n end",
"def index\r\n @company = Company.find_by(params[:id])\r\n @services = Service.where(company_id: params[:id])\r\n end",
"def set_company\n @company ||= Company.find(params[:id])\n end",
"def set_intelcompany\n @intelcompany = IntelCompany.find(params[:id])\n end",
"def company_number\n 1\n end",
"def set_company\n @company = Company.find(params[:id]) rescue nil\n companies_redirection if @company.nil?\n end",
"def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end",
"def inverse_company_id_field\n :subject_company_id\nend",
"def set_company_field\n @company_field = CompanyField.find(params[:id])\n end",
"def company\n @company ||= research_param(:company) || company_list.first\n end",
"def index\n @company_news = CompanyNews.where(company: params[:company]).first\n end",
"def atom_id\n \"tag:netcooler.com,#{created_at.strftime(\"%Y-%m-%d\")}:/companies/#{id}\"\n end",
"def set_company\n @company = Company.friendly.find(params[:id])\n @company_tab = 'active'\n end",
"def set_listed_company\n @listed_company = ListedCompany.find(params[:id])\n end"
] |
[
"0.7395401",
"0.69671273",
"0.69157135",
"0.6841032",
"0.6752074",
"0.67446",
"0.6722519",
"0.66124934",
"0.6605789",
"0.6588391",
"0.65137887",
"0.6483177",
"0.6477066",
"0.6464012",
"0.64526016",
"0.6399463",
"0.6376099",
"0.6356139",
"0.63144034",
"0.6314252",
"0.6314252",
"0.6314252",
"0.6314252",
"0.6314252",
"0.6314252",
"0.6314252",
"0.6314252",
"0.6303",
"0.62657297",
"0.62433726",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218496",
"0.6218078",
"0.62125564",
"0.6191146",
"0.6182653",
"0.61762035",
"0.61706644",
"0.6169663",
"0.6169663",
"0.612278",
"0.61216766",
"0.6118421",
"0.6118421",
"0.6118421",
"0.6117854",
"0.60913366",
"0.6086933",
"0.60655975",
"0.6062269",
"0.6060058",
"0.6053053",
"0.5991022",
"0.59867805",
"0.5975767",
"0.5969957",
"0.59676653",
"0.59536946",
"0.59469515",
"0.5915367",
"0.58732545"
] |
0.0
|
-1
|
if the field is belongs_to make so that fields contains the `field` and field_id
|
def expand_association_to_ids fields
expanded = {}
fields.each_pair do |name, type|
case type
when 'belongs_to'
expanded["#{name}_id"] = 'integer'
end
end
fields.merge(expanded)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_field?(field_name)\n direct_fields = self.fields\n foreigns.each do |f|\n foreign_dataset = self.class.dataset_from f\n if foreign_dataset\n direct_fields.concat foreign_dataset.fields\n end\n end\n direct_fields.include? field_name\n end",
"def related_fields(method)\n \n end",
"def scaffold_fields_replacing_associations(fields = nil)\n if fields.nil?\n @scaffold_fields_replacing_associations ||= scaffold_fields_replacing_associations(scaffold_fields)\n else\n fields.collect do |field|\n reflection = reflect_on_association(field.to_sym)\n reflection ? (reflection.options[:foreign_key] || reflection.klass.table_name.classify.foreign_key) : field\n end\n end\n end",
"def meta_of(field)\n @meta_of ||= {}\n return @meta_of[field] if @meta_of.key?(field)\n @meta_of[field] = reflect_on_association(relation_alias(field))\n end",
"def belongs_to(*params)\n config = params.extract_options!\n name = \"#{params.join}_id\"\n schemaless_fields <<\n ::Schemaless::Field.new(name, :integer, config)\n super(*params)\n end",
"def belongs_to_custom_fields\n group_custom_fields 'belongs_to'\n end",
"def get_fields_or_build(field)\n unless field.is_a? DelegationField\n field_slug = field.to_s\n field = DelegationField.where(slug: field_slug).first\n return nil if field.nil?\n end\n field_values = get_fields(field)\n if field_values.empty?\n field_values = [self.fields.build(delegation_field_id: field.id)]\n end\n field_values\n end",
"def merged_fields(new_field)\n field_ids = []\n merged_fields = fields.each_with_object([]) do |field, fields|\n field.deep_merge!(new_field) if field.id == new_field.id\n fields << field\n field_ids << field.id\n end\n merged_fields << new_field unless field_ids.include?(new_field.id)\n merged_fields\n end",
"def association_fields\n fields.select{|f| f.is_a?(AssociationField)}\n end",
"def object_id_field?\n @object_id_field ||=\n association.polymorphic? ? true : association.klass.using_object_ids?\n end",
"def field_with_unique_id( form, field_type, object, field_name )\n field_id = \"#{object.class.name.downcase}_#{object.id.to_s}_#{field_name.to_s}\"\n form.send( field_type, field_name, :id => field_id )\n end",
"def for_field(field)\n @all.select { |f| f.field == field.to_sym }\n end",
"def process_field(field_name)\n if ['id', 'name', 'first_name', 'node_id'].include?(field_name)\n \"#{table}.#{field_name}\"\n else\n super # raises\n end\n end",
"def has_field(field_name)\n\t\tend",
"def field_ids\n @conditions['field_ids'] || cbobject.basis_fields\n end",
"def related_id_field\n @related_id_field ||= association.klass.fields[\"_id\"]\n end",
"def check_foreign_key(field)\n val = self.send(field)\n if val.is_a? ForeignKey\n add_foreign_key_message_to_errors(val)\n end\n end",
"def scaffold_field_id(field)\n if reflection = scaffold_association(field)\n scaffold_foreign_key(reflection)\n else\n field.to_s\n end\n end",
"def fields\n [:id]\n end",
"def permitted_search_fields\n fields = @rails.resource.fields\n\n to_ids = []\n\n expanded_fields = expand_association_to_ids fields\n\n search_fields.each do |key|\n next unless expanded_fields.keys.include?(key)\n type = expanded_fields[key]\n to_ids << (['references', 'belongs_to'].include?(type.downcase) ? \"#{key}_id\" : key)\n end\n to_ids\n end",
"def define_set_field_method(field)\n define_method \"#{field.name}=\" do |object|\n if object.nil?\n self.send \"#{field.foreign_key}=\", nil\n elsif object.is_a?(Symbol)\n self.send \"#{field.foreign_key}=\", self.class.send(field.name, object).id\n elsif object.kind_of?(ActsAsEnumField::InstanceMethods)\n self.send \"#{field.foreign_key}=\", object.id\n else\n raise \"BUG: invalid argument \" + object.class.name\n end\n end\n end",
"def field_ids\n @fields.keys\n end",
"def belongs_to?\n not property? and not multiple?\n end",
"def generate_fields_for(model, table)\n table.columns.each do |column|\n if column.options['references'] && parent_model = find_model(column.options['references'])\n model.add_relation(Model::Relation::BELONGS_TO, parent_model.name.underscore)\n #TODO: Look into if there is there a way to figure out a has_one relationship?\n parent_model.add_relation(Model::Relation::HAS_MANY, model.table_name)\n else\n model.add_field(column.name, column.type.to_s.classify, column.options)\n end\n end\n end",
"def set_field\n @field = @group.fields.find(params[:id])\n end",
"def check_filter_relation ( relation, field )\n filtered_users = User.joins(relation).where(field => @user.send(relation), \"users.id\" => @users).group(\"users.id\").all\n validate_filter_result filtered_users\n end",
"def non_relationship_fields\n self.fields.select { |field| !field.is_relationship? }\n end",
"def add_field(field)\n\t\tend",
"def inverse_company_id_field\n :subject_company_id\nend",
"def set_field\n @field = Field.find(params[:id])\n end",
"def set_field\n @field = Field.find(params[:id])\n end",
"def set_field\n @field = Field.find(params[:id])\n end",
"def relation_by_sql_form\n # Nothing to do here\n end",
"def set_field\n @field = Field.find(params[:id])\n end",
"def has_field?(field_name); end",
"def ancestor_field(field)\n return self[field] if self[field].present?\n\n return nil unless ancestor_docs.present?\n\n ancestor_ids.each do |ancestor_id|\n ancestor = ancestor_docs[ancestor_id]\n return ancestor[field] if ancestor && ancestor[field].present?\n end\n\n nil\n end",
"def find_field(field_id)\n fields.find_by(field_id.starts_with?('_') ? :uuid : :slug => field_id)\n end",
"def set_field\n @field = @nested_form.fields.find(params[:id])\n end",
"def belongs_to(relation)\n add_field relation, :belongs_to\n add_field generate_belongs_to_id(relation), :belongs_to_id # a relation is singular.\n end",
"def _draw_belongs_to_field(parent_model, col)\n label = Settings.edgarj.belongs_to.popup_on == 'field' ?\n nil :\n @vc.draw_belongs_to_label(@f, @drawer.popup_path(col), col.name)\n _draw_head(col, label){\n @vc.draw_belongs_to_field(@f, @drawer.popup_path(col), col.name)\n }\n end",
"def set_inclusion_field(resource, field, id_field, resource_name: nil,\n resources_url: nil)\n @inclusion_field ||= ActiveSupport::HashWithIndifferentAccess.new\n @inclusion_field[resource] ||= ActiveSupport::HashWithIndifferentAccess.new\n @inclusion_field[resource][field] = {\n field: field,\n id_field: id_field,\n resource_name: resource_name,\n resources_url: resources_url\n }\n end",
"def relation_of(field)\n meta = meta_of(field)\n meta ? meta.relation : nil\n end",
"def stores_foreign_key?; true; end",
"def build_has_many_conditions(key, value)\n [\"#{key}.id = ?\", value]\n end",
"def build_has_many_conditions(key, value)\n [\"#{key}.id = ?\", value]\n end",
"def select(field_or_fields)\n scoped :select => field_or_fields\n end",
"def _ field\n as_name = [name, field].join(\"_\").to_sym\n AS[\"#{relationize}.(#{field})\", as_name, Bag.new([field, field_type(field)]), nil, :skip_type]\n end",
"def push(fieldlet)\n \t\tfield = @fields[fieldlet.class::FIELD_ID].last\n \t\tif field && field.instance_id == fieldlet[:instance_id]\n \t\t\treturn field << fieldlet\n \t\tend \n \n \t\tfield = fieldlet.class::FIELD.new(@entity)\n \t\tfield << fieldlet\n \n \t\t@fields[fieldlet.class::FIELD_ID] << field\n \n return field\n \tend",
"def belongs_to?; false; end",
"def object_id_field?\n @object_id_field ||=\n metadata.polymorphic? ? true : metadata.klass.using_object_ids?\n end",
"def flexi_fields_except_fk\n _field_names = self.associations.values.flatten.map { |_v| :\"#{_v.to_s.singularize}_id\" }\n if none_flexi_fields.present?\n none_flexi_fields.each do |field|\n ['file_name', 'content_type', 'file_size', 'updated_at'].each do |_suffix|\n _field_names << :\"#{field.name.to_s}_#{_suffix}\"\n end\n end\n end\n self.flexi_fields.select { |_f| !_field_names.include?(_f.name.to_sym) }\n end",
"def link!\n base = ::ActiveRecord::Associations::ClassMethods::JoinDependency.new(\n @model, [], nil\n )\n \n @fields.each { |field|\n field.model ||= @model\n field.columns.each { |col|\n field.associations[col] = associations(col.__stack.clone)\n field.associations[col].each { |assoc| assoc.join_to(base) }\n }\n }\n \n @attributes.each { |attribute|\n attribute.model ||= @model\n attribute.columns.each { |col|\n attribute.associations[col] = associations(col.__stack.clone)\n attribute.associations[col].each { |assoc| assoc.join_to(base) }\n }\n }\n end",
"def field?\n true \n end",
"def on(field)\n self[field].to_a.first\n end",
"def on(field)\n self[field].to_a.first\n end",
"def arel_column(field, &block)\n if virtual_attribute?(field) && (arel = table[field])\n arel\n else\n super\n end\n end",
"def collides_with_field?\n end",
"def searchable_by *fields\n self.fields = process_fields(fields)\n end",
"def duplicants_fieldlet_ids\n\t\t\tself.duplicant_field::FIELDLET_IDS\n\t\tend",
"def stores_foreign_key?; false; end",
"def stores_foreign_key?; false; end",
"def group_by_field\n self.find_field(self.group_by_field_name)\n end",
"def get_value_including_foreign_keys(value)\n if value.is_a? ForeignKey\n value.id\n else\n value\n end\n end",
"def foreign_keys_from_associations(fields = association_fields)\n fields.each_with_object([]) do |(_field_name, metadata), keys|\n keys << metadata[:foreign_key] if metadata[:foreign_key]\n keys << metadata[:polymorphic_type] if metadata[:polymorphic_type]\n keys\n end\n end",
"def foreign_keys_from_associations(fields = association_fields)\n fields.each_with_object([]) do |(_field_name, metadata), keys|\n keys << metadata[:foreign_key] if metadata[:foreign_key]\n keys << metadata[:polymorphic_type] if metadata[:polymorphic_type]\n keys\n end\n end",
"def associated_records\n raise NotImplementedError\n end",
"def existing(field)\n Concert.pluck(field).first\nend",
"def non_foreign_key_fields\n self.database_field_names - self.foreign_key_fields\n end",
"def prepare(model, field_name = nil)\n @model = model\n @selection = Babik::Selection::Path::Factory.build(model, @aggregation_path)\n @field_name = field_name || \"#{self.table_alias}__#{SQL_OPERATION.downcase}\"\n self\n end",
"def macro\n :belongs_to_related\n end",
"def relationship_custom_fields\n custom_fields_recipe['rules'].find_all do |rule|\n %w[belongs_to has_many many_to_many].include?(rule['type'])\n end\n end",
"def relationship_relation company_id_field, referer_id\n Relationship.joins(\n \"join card_references cr on cr.referee_id = relationships.#{company_id_field}\"\n ).where(\n \"cr.referer_id = #{referer_id} \" \\\n \"and #{relationship_prefix}metric_id = #{metric_card.id}\"\n )\n end",
"def company_field_params\n params.require(:company_field).permit(:company_id, :field_id)\n end",
"def belongs_to(relation, options = {})\n add_field relation, :belongs_to, options\n end",
"def get_field_object_in language, association, f\n ( f.object.send(association.to_s).find_by_language(language) || f.object.send(association.to_s).build(:language => language) )\n end",
"def field_by_id(id = nil)\n @fields.find { |h| h[:id] == id.to_s }\n end",
"def mongoize(object)\n if type.resizable? || object_id_field?\n type.__mongoize_fk__(association, object)\n else\n related_id_field.mongoize(object)\n end\n end",
"def non_relationship_custom_fields\n custom_fields_recipe['rules'].find_all do |rule|\n !%w[belongs_to has_many many_to_many].include?(rule['type'])\n end\n end",
"def associated_with_supplier\n self.contact_types = [ContactType.supplier.id]\n end",
"def associated\n end",
"def id field, value\n\t\t# can't bind field name, oh well\n\t\t@db.get_first_value \"select id from #{@name} where #{field} = ?\", value\n\tend",
"def reference_custom_field_ids\n self[:value] ||= {}\n self[:value][:custom_field_ids] ||= []\n \n @custom_field_ids ||= self[:value][:custom_field_ids].collect{|cf_id| cf_id.to_i if CustomField.exists?(cf_id) }.compact\n end",
"def dynamic_field?(field)\n dynamic_enabled? &&\n !fields.keys.include?(database_field_name(field)) &&\n !embedded_relations.map { |_, v| v.key }.include?(database_field_name(field))\n end",
"def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end",
"def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end",
"def update_fields(fields)\n\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end",
"def belongs_to\n return self.property.name if self.renter_id == 0\n return self.renter.full_name2 if (self.renter_id != 0) \n end",
"def find_field(name_or_id)\n self.fields.detect { |field| field.matches?(name_or_id) }\n end",
"def update_same_fields? model, method\n intersection = fields_from_model(model).map(&:to_s) & fields_from_model_method(model, method).map(&:to_s)\n intersection.present?\n end",
"def method_missing(meth, *args, &blk)\n super unless Fields.all.include?(meth)\n field meth, *args\n end",
"def check_exclude_fields\n=begin\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n exc= exclude_fields.send(key)\n next if exc # Leave user options if given.\n \n # By default, the foreign key of the parents are assigned on nested resources,\n # so i remove the from the default columns of new\n exclude_fields.send(\"#{key}=\", parent_ids) if key == :for_new && !parent_ids.empty?\n end\n=end\n # Because a single resource can have multiple resource parents,\n # this check is going to be done on \"runtime\" (ie remove the field for the \n # current parent, not all parents' fields)\n end",
"def deep_copy(src)\n field = Field.find(src)\n name = field.name\n if (name !~ /\\(copy\\)\\s*$/)\n name += \" (copy)\"\n end\n self.name = field.parent_id ? field.name : name\n self.group_id = field.group_id\n self.parent_id = field.parent_id\n self.is_required = field.is_required\n self.is_multi = field.is_multi\n self.type = field.type\n self.par_hi_lim = field.par_hi_lim\n self.par_lo_lim = field.par_lo_lim\n self.display_as = field.display_as\n self.save\n field.limits.each do |l|\n newL = l.clone :except => :field_id\n newL.field_id = self.id\n newL.save\n end\n field.children.each do |k|\n newK = Field.new\n newK.deep_copy(k.id)\n newK.parent_id = self.id\n newK.save\n end\n return self.id\n end",
"def get_field(field, collection)\n if field.is_a?(Hash) # rubocop:disable Style/ConditionalAssignment\n field = \"#{field[:table]}.#{field[:field]}\"\n else\n field = \"#{collection.table_name}.#{field}\"\n end\n field_base.gsub(Placeholder::FIELD, field)\n end",
"def field_instance(field)\n raise \"Not implemented\"\n end",
"def transform_id fields,row\n return row unless fields[@id]\n i = fields[@id]\n /(?<id>\\w+)@.*/ =~ row[i]\n row[i] = id if id\n return row\n end",
"def edges_field_ast(field)\n f_ast = field_ast(field)\n return nil if f_ast.nil?\n node_fields = [node_field_ast(field.type.unwrap.get_field('node'))]\n if f_ast.respond_to?(:merge) # GraphQL-Ruby 1.9+\n f_ast.merge(selections: f_ast.selections + node_fields)\n else\n f_ast.selections.concat(node_fields)\n f_ast\n end\n end",
"def user_field_params\n params.require(:user_field).permit(:user_id, :field_id)\n end",
"def relates_to?(obj)\n self.class.reference_columns_for(obj.class).any? {|col|\n self[col] == obj.id\n }\n end",
"def field(*fields)\n options = fields.extract_options!\n\n fields.each do |f|\n _field(f, options)\n end\n end",
"def belongs_to?\n true\n end"
] |
[
"0.6311901",
"0.61518484",
"0.58919483",
"0.58468366",
"0.5833805",
"0.582897",
"0.57941765",
"0.5739344",
"0.57025427",
"0.56565154",
"0.562928",
"0.5626564",
"0.55656946",
"0.55642444",
"0.5564232",
"0.5548896",
"0.5538942",
"0.5531748",
"0.5525122",
"0.5484996",
"0.54476744",
"0.5411556",
"0.5410804",
"0.53990567",
"0.5381487",
"0.53588665",
"0.53400415",
"0.53352505",
"0.5329246",
"0.531046",
"0.531046",
"0.531046",
"0.5308535",
"0.52804047",
"0.5276279",
"0.5243565",
"0.5226692",
"0.522642",
"0.52110225",
"0.5161629",
"0.5149824",
"0.5149239",
"0.5139804",
"0.51395446",
"0.51395446",
"0.51331675",
"0.5125779",
"0.51156145",
"0.51143306",
"0.51102024",
"0.5091257",
"0.50592166",
"0.50541246",
"0.5034038",
"0.5034038",
"0.5029027",
"0.5018749",
"0.5016783",
"0.50164384",
"0.501143",
"0.501143",
"0.5008848",
"0.5008656",
"0.49896565",
"0.49896565",
"0.49763608",
"0.4964425",
"0.49644035",
"0.49642456",
"0.49574172",
"0.4954454",
"0.49530947",
"0.49374077",
"0.4936962",
"0.4935108",
"0.49345696",
"0.4932291",
"0.4917092",
"0.4914265",
"0.49056712",
"0.49006018",
"0.4897195",
"0.48913023",
"0.48843333",
"0.48843333",
"0.48843333",
"0.48843226",
"0.4882249",
"0.48778567",
"0.48724616",
"0.48525676",
"0.484979",
"0.48458755",
"0.48373982",
"0.48291034",
"0.48291",
"0.48285362",
"0.48067927",
"0.48066",
"0.47963655"
] |
0.606811
|
2
|
convert company => company_id
|
def associations_to_ids hash
to_ids = {}
hash.each_pair do |key, type|
key_name = ['references', 'belongs_to'].include?(type.downcase) ? "#{key}_id" : key
to_ids[key_name] = type
end
to_ids
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def company_id\n if @company.respond_to?(:to_hash)\n @company.fetch(:company_id) { @company }\n elsif @company.respond_to?(:company_id)\n @company.company_id\n else\n @company\n end\n end",
"def add_company_id\n\t\tcompany = self.employee.company\n\t\tself.company_id = company[:id]\n\tend",
"def company_id\n e = Employee.find_by(user_id: id)\n e.company_id\n end",
"def company_id\n self.dig_for_string(\"agentSummary\", \"office\", \"companyId\")\n end",
"def identificacion_company\n \"#{type_identification}-#{rif}\"\n end",
"def find_company_id(name)\n @company = Company.find_or_create_by(name: name)\n @company.id\n end",
"def company_ids\n @cached_company_ids ||= @object.companies.legit.pluck(:id)\n end",
"def alias_id(d)\n alias_ids.select{|e_id| e_id.entity.company_id == d}.first\n end",
"def find_company\n Company.find(params[:company_id].to_i)\n end",
"def to_id(obj)\n current_server.to_id(obj)\n end",
"def to_param\n \"#{id} #{company.name}\".parameterize\n end",
"def company_number\n 1\n end",
"def atom_id\n \"tag:netcooler.com,#{created_at.strftime(\"%Y-%m-%d\")}:/companies/#{id}\"\n end",
"def convert_customer_name_to_id\n\t customer = Customer.find_by_name(self.customer_name)\n\t self.customer_id = customer.id unless customer.nil?\n end",
"def name_to_id\n @name_to_id ||= build_hash('name', 'id')\n end",
"def to_id\n\t\treturn self.\n\t\t\tgsub(\"::\", \"\").\n\t\t\tgsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t\t\tgsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t\t\tdowncase.\n\t\t\tgsub(\"_\", \"-\")\n\tend",
"def set_company\n if /^0*[1-9]\\d*$/.match(params[:id])\n find_company\n else\n render json: { description: \"Invalid ID supplied\", code: 400 }\n end\n end",
"def company(id)\n record \"/contacts/company/#{id}\"\n end",
"def set_company\n @company = Company.friendly.find(params[:id])\n end",
"def need_calc_company\n company_ids = []\n company_ids = self[:company].split(\",\") unless self[:company].blank?\n company_ids\n end",
"def to_s\n company\n end",
"def contact_email_to_id(email)\n @contacts ||= {}\n unless @contacts.has_key?(email)\n c = ::Mailjet::Contact.find(email) # email is a valid key for finding contact resources\n c = ::Mailjet::Contact.create(email: email) unless c && c.email == email\n @contacts[email] = c.id\n end\n @contacts[email]\n end",
"def inverse_company_id_field\n :subject_company_id\nend",
"def format_protocol_id_column(protocol)\n protocol.subsidies.any? ? protocol.sparc_id.to_s + 's' : protocol.sparc_id\n end",
"def toid(value)\n merge(toid: value.to_s)\n end",
"def set_company\n @company = @community.companies.friendly.find(params[:id])\n end",
"def make_name_to_id\n build_hash('name', 'id')\n end",
"def current_company=(company_obj)\n self.current_company_id = company_obj.id\n self.save\n end",
"def charset_name2id(charset_name)\n #This is a stub, used for indexing\n end",
"def originating_company_id_trace(*options)\n '1000000009'\n end",
"def make_id\n \"#{self.class.name.downcase}#{id}\"\n end",
"def convert_data_field_codes_to_id_strings(source_data)\n model.convert_data_field_codes_to_id_strings(source_data)\n end",
"def convert_data_field_codes_to_id_strings(source_data)\n model.convert_data_field_codes_to_id_strings(source_data)\n end",
"def name\n \"#{id}-#{company_name}\"\n end",
"def generate_callout_id(list_index, co_index)\n \"CO#{list_index}-#{co_index}\"\n end",
"def to_id(obj)\n return nil if obj.__id__ == front.__id__\n @idconv.to_id(obj)\n end",
"def name_to_id(model_handle, name, context = {})\n if context.empty?\n return name_to_id_default(model_handle, name)\n end\n name_to_object(model_handle, name, context).id\n end",
"def derive_db_id(model_name, obj_id)\n \"#{model_name}_#{obj_id}\"\n end",
"def company\n @company ||= Company.find(params[:id])\n end",
"def set_company \n #params[id]に/users/数でとってきた値を入れている\n @company = Company.find(params[:id])\n end",
"def make_id_to_name\n build_hash('id', 'name')\n end",
"def set_company\n Company.find(params[:id])\n end",
"def normalize_link_id(id); end",
"def set_company\n id = params[:company_id] ? params[:company_id] : params[:id]\n @company = Company.find(id)\n end",
"def user_login_to_id(login)\n user = user_from_login(login)\n return user[\"id\"]\n end",
"def canonical_id\n @canonical_id ||= crate.resolve_id(id)\n end",
"def to_object_id(value)\n Plucky.to_object_id(value)\n end",
"def company_code\n if self.yard.present? && self.yard.facility.present? && self.yard.facility.country.present?\n country = self.yard.facility.country\n \"COPART#{country.code}\".upcase\n else\n \"\"\n end\n end",
"def idABase32\n Comentario.transaction do\n idBase32 = Comentario.where(:id => '', :created_at => self.created_at.to_time, :comentario => self.comentario)[0].idConsecutivo.to_s(32)\n update_column(:id, idBase32)\n ComentarioGeneral.new(comentario_id: idBase32, subject: '', commentArray: [].to_s).save if categorias_contenido_id == CategoriasContenido::COMENTARIO_ENCICLOVIDA\n end\n end",
"def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end",
"def make_company_employees # need your company (example.com) to already exist in Company table\n users = User.all \n companies=Company.all\n users.each do |user|\n domain = user.email.split(\"@\").last\n company_id = companies.find_by(domain: domain).id\n CompanyEmployee.create!(company_id:(companies.find_by(domain: domain).id), user_id: user.id)\n end\nend",
"def convert_data_field_codes_to_id_strings!\n self.data = convert_data_field_codes_to_id_strings(self.data)\n end",
"def convert_data_field_codes_to_id_strings!\n self.data = convert_data_field_codes_to_id_strings(self.data)\n end",
"def to_obj_id\n if instance_variable_defined? :@to_obj_id\n @to_obj_id\n else\n @to_obj_id =\n if @chars =~ /^ruby-(\\d+)/\n $1.to_i\n end\n end\n end",
"def set_company\n @company = Company.find_by(code: params[:company_id])\n end",
"def set_company\n @company = Company.find_by(code: params[:company_id])\n end",
"def flow_object_id\n @flow_object_id ||= params[:flow_object_id]&.to_s || @company.id\n end",
"def tl_update_company_textfield_from_office\n office = params[:id]\n @company = 0\n if office != '0'\n @office = Office.find(office)\n @company = @office.blank? ? 0 : @office.company\n end\n render json: @company\n end",
"def to_s\n iid\n end",
"def generate_id(v)\n @collection_id + '-' + v.downcase.gsub(/\\/+/, '_').gsub(/;+|\\.+/, '').gsub(/ /, '-')\n end",
"def org_id\n query('select id from Organization').first['Id']\n end",
"def company_number=(value)\n @company_number = value&.upcase\n end",
"def name_to_id!\n @name_to_id = make_name_to_id\n self\n end",
"def set_intelcompany\n @intelcompany = IntelCompany.find(params[:id])\n end",
"def set_company_field\n @company_field = CompanyField.find(params[:id])\n end",
"def translate_company_args hash\n handle_company_auto_add hash, :wikirate_company, :auto_add_company\n\n hash[:company] = hash.delete :wikirate_company\n end",
"def set_company\n @client_company = ClientCompany.find(params[:id])\n end",
"def email_as_id\n\t\tself.email.gsub(/[@\\.]/, '-')\n\tend",
"def real_id(model_name, friendly_id)\n if friendly_id.to_s.to_i == 0\n obj = model_name.constantize.find(friendly_id)\n if obj\n return obj.id\n end\n end\n friendly_id\n end",
"def hash\n [company_id, company_type, compnay_name, company_name_en, company_address, company_address_en, company_zip_code, company_tax_id, company_branch, company_branch_en, company_branch_code, company_phone, company_mobile, company_fax, company_website].hash\n end",
"def get_id(obj)\n\t\t@objects.invert[obj]\n\tend",
"def server_to_id(server)\r\n if server.kind_of? String\r\n puts \"forward lookup\"\r\n id = @server_alias_to_id[server]\r\n else\r\n puts \"reverse lookup\"\r\n id = @cinch_bot_to_id[server] #If it's not a string, assume it's a bot object, reverse lookup id\r\n end\r\n id\r\n end",
"def set_company\n @company = Company.find(params[:id]);\n end",
"def to_i\n id\n end",
"def to_i\n id\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def base_id\n \"#{firstname} #{lastname}\"\n end",
"def company\n @attributes[:company]\n end",
"def get_company\n @company = Company.find(params[:company_id])\n end",
"def get_id(entity)\n check_property_value(entity.properties, :type)\n check_property_value(entity.properties, :name)\n\n get_id_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end",
"def south_african_listed_company_registration_number; end",
"def actual_id\n args = params[:id].split('-')\n args[0]\n end",
"def company=(company)\n super(Company.find_or_create_by_name(company))\n end",
"def cobrand_id\n @cobrand_id || YodleeApi.cobrand_id\n end",
"def create\n @company_contact = CompanyContact.new(params[:company_contact]) \n @company = Company.new(session[:company])\n @company.save\n @company_contact.company_id = @company.id\n @company_contact.save\n redirect_to @company\n end",
"def courier_id(transition)\n courier_id = courier_company_id if transition.event == :ship_items\n end",
"def set_company\n @company = Company.find(params[:company])\n end",
"def get_id(id)\n native_id = Integer(id.split(\":\")[-1])\n end",
"def person_code_key(person_id)\n \"offers:person:code:#{person_id}\"\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end",
"def set_company\n @company = Company.find(params[:id])\n end"
] |
[
"0.7612697",
"0.69163626",
"0.6750859",
"0.67062044",
"0.66654855",
"0.6509545",
"0.63406587",
"0.62368554",
"0.6234156",
"0.62096906",
"0.6185554",
"0.6122597",
"0.6049482",
"0.6034934",
"0.60314256",
"0.60082114",
"0.5965468",
"0.59260285",
"0.5925552",
"0.5918353",
"0.58788407",
"0.58696645",
"0.5853024",
"0.5851486",
"0.58283234",
"0.58158976",
"0.58062714",
"0.57978326",
"0.5775247",
"0.56991804",
"0.56957877",
"0.5677855",
"0.5677855",
"0.5672537",
"0.56483686",
"0.56433547",
"0.5640824",
"0.56371516",
"0.5631715",
"0.55784434",
"0.55613744",
"0.5550857",
"0.5543241",
"0.55380887",
"0.5530584",
"0.5527417",
"0.5523749",
"0.5522653",
"0.55198735",
"0.5508454",
"0.5501907",
"0.5499527",
"0.5499527",
"0.5493078",
"0.54892313",
"0.54892313",
"0.54831964",
"0.5448063",
"0.54456496",
"0.5444177",
"0.5441553",
"0.544082",
"0.54307264",
"0.54284257",
"0.5425593",
"0.54225826",
"0.5420795",
"0.5413564",
"0.54096574",
"0.5408146",
"0.540265",
"0.5399674",
"0.5395872",
"0.53907394",
"0.53907394",
"0.5386617",
"0.5386617",
"0.5386617",
"0.5386617",
"0.5386617",
"0.5386617",
"0.5386617",
"0.5386617",
"0.53848284",
"0.5383984",
"0.53773147",
"0.53753126",
"0.5366698",
"0.53652906",
"0.53607446",
"0.53537697",
"0.5351142",
"0.53484225",
"0.533978",
"0.5335485",
"0.5331551",
"0.53287804",
"0.53287804",
"0.53287804",
"0.53287804",
"0.53287804"
] |
0.0
|
-1
|
GET /authors/1 GET /authors/1.xml
|
def show
@author = Author.find(params[:id])
@all_articles = @author.articles.joins(:views, :content_source).where(["article_age = ? AND content_sources.code != ?", 30,"R"])
@non_inews = @all_articles.joins(:content_source).where(["content_sources.code = ? AND site_id != ?","I",1])
@inews = @all_articles.internet_news
@top_articles = @all_articles.joins(:views).where(["article_age = ?",30]).order("pageviews DESC").limit(10)
@bottom_articles = @all_articles.joins(:views).order("pageviews ASC").limit(10)
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @author }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @author = Author.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @author }\n end\n end",
"def show\n @author_repository = AuthorRepository.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @author_repository }\n end\n end",
"def show_authors\n tag = params['query']\n\n @article = Article.where('arxiv_id = ?', tag).first\n @authors = @article.authors\n # puts authors\n\n @found = 1\n if @authors.nil?\n @msg = \"None found, try again...\"\n @found = 0\n @authors = []\n end\n\n render \"authors\"\n end",
"def index\n @authors = Author.all\n respond_with(@authors)\n end",
"def index\n conditions = { :block => false }\n conditions.merge!( :is_opinion => true ) if params[:opinion] == '1'\n conditions.merge!( :is_agency => true ) if params[:agency] == '1'\n unless params[:author_id].blank? && params[:author_ids].blank?\n author_ids = scan_multiple_value_param( :author_id, :first ) || scan_multiple_value_param( :author_ids )\n conditions.merge!( :id => author_ids )\n end\n params[:top] == '1' ? top() : ( !params[:q].blank? ? search( conditions ) : list( conditions ) )\n @authors.delete_if{ |a| a.story_authors.count < 2 } if params[:cf] == '1'\n rxml_data( @authors, :root => 'authors', :with_pagination => true )\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def authors\n nodes = @doc.xpath(\"atom:feed/atom:author\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomPerson.new(node) }\n end",
"def get_related_authors\n tag = params['query']\n\n @articles = get_articles(tag) # gets all articles of this author\n # puts 'ARTICLES'\n # ap @articles\n\n @related_articles = []\n @authors = []\n\n # for each of the author's articles, get 1st degree articles and their respective authors\n @articles.each do |article|\n puts \"ARTIClE ID \"\n puts article.arxiv_id\n getRelatedPapers(article.arxiv_id, -1).each do |related|\n\n authors = related.authors\n authors.each do |author|\n\n if !@authors.include?(author)\n @authors << author\n end\n\n end\n end\n end\n \n\n @found = 1\n if @authors == []\n @msg = \"None found, try again...\"\n @found = 0\n end\n\n render \"authors\"\n end",
"def show\n @publications = @author.publications.paginate(page: params['page'], per_page: 10)\n @crumbs = [['Authors', authors_path], @author.family]\n end",
"def books_author\n \t@books = Book.where(\"author = '#{params[:author]}'\")\n\n \trespond_to do |format|\n format.html # list_authors.html.erb\n format.json { render json: @books }\n end\n end",
"def authors\n nodes = @node.xpath(\"atom:author\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomPerson.new(node) }\n end",
"def crossref_authors\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.contributors {\n authors.each_with_index do |author, index|\n given_name = author.given_name\n surname = author.last_name\n orcid = author.orcid\n if index == 0\n sequence = \"first\"\n else\n sequence = \"additional\"\n end\n xml.person_name(:sequence => sequence, :contributor_role => \"author\") {\n xml.given_name given_name.encode(:xml => :text)\n if surname.nil?\n xml.surname \"No Last Name\".encode(:xml => :text)\n else\n xml.surname surname.encode(:xml => :text)\n end\n xml.ORCID \"http://orcid.org/#{author.orcid}\" if !orcid.nil?\n }\n end\n }\n end\n\n return builder.doc.xpath('//contributors').to_xml\n end",
"def show\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authors_book }\n end\n end",
"def get_all_authors\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits] # Optional - value must be a substring of \"ESACO\". Determines which traits to return.\n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"traits:#{traits}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/all_authors.json?count=#{count}&timeline=#{timeline}&traits=#{traits}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end",
"def authors\n\t#params[:diff] = params[:diff].eql?\"true\"\n \trespond_in_format Marginalia.authors(params[:id],params[:diff])\n end",
"def index\n @authors = Author.all\n end",
"def authors\n author\n end",
"def show\n @author = Author.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author }\n end\n end",
"def index\n @references_authors = References::Author.all\n end",
"def index\n @authorships = Authorship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @authorships }\n end\n end",
"def getAuthors(indexMeta, rawMeta)\n # If not UC-Ingest formatted, fall back on index info\n if !rawMeta.at(\"/record/authors\")\n return indexMeta.multiple(\"creator\").map { |name| {name: name} }\n end\n\n # For UC-Ingest, we can provide more detailed author info\n rawMeta.xpath(\"/record/authors/*\").map { |el|\n if el.name == \"organization\"\n { name: el.text, organization: el.text }\n elsif el.name == \"author\"\n data = { name: formatAuthName(el) }\n el.children.each { |sub|\n if sub.name == \"identifier\"\n data[(sub.attr('type') + \"_id\").to_sym] = sub.text\n else\n data[sub.name.to_sym] = sub.text\n end\n }\n data\n else\n raise(\"Unknown element #{el.name.inspect} within UCIngest authors\")\n end\n }\nend",
"def show\n @map_author = MapAuthor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map_author }\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def show\n # @authorship = Authorship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @authorship }\n end\n end",
"def show\n @author = Author.find(params[:id])\n respond_with(@author)\n end",
"def new\n @author = Author.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author }\n end\n end",
"def show_authors(result)\n author_array = []\n if result['Items'].present?\n flag = 0\n authorString = []\n result['Items'].each do |item|\n if item['Group'].present?\n if item['Group'] == \"Au\"\n # let Don and Michelle know what this cleaner function does\n newAuthor = processAPItags(item['Data'].to_s)\n # i'm duplicating the semicolor - fix\n newAuthor.gsub!(\"<br />\", \"; \")\n authorString.push(newAuthor)\n flag = 1\n end\n end\n end\n if flag == 1\n return truncate_article authorString.join(\"; \").html_safe\n end\n end\n contributors = result.fetch('RecordInfo', {}).fetch('BibRecord', {}).fetch('BibRelationships', {}).fetch('HasContributorRelationships', [])\n if not contributors.empty?\n contributors.each do |contributor|\n namefull = contributor.fetch('PersonEntity', {}).fetch('Name', {}).fetch('NameFull', nil)\n if namefull\n url_vars = {\"q\" => '\"' + namefull.gsub(\",\", \"\").gsub(\"%2C\", \"\").to_s + '\"', \"search_field\" => \"author\"}\n link2 = generate_next_url_newvar_from_hash(url_vars)\n author_link = '<a href=\"' + request.fullpath.split(\"?\")[0] + \"?\" + link2 + '\">' + namefull.to_s + '</a>'\n author_array.push(author_link)\n end\n\n end\n return author_array.join(\"; \").html_safe\n end\n return ''\n end",
"def new\n @author_repository = AuthorRepository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author_repository }\n end\n end",
"def index\n @products = Product.find(:all, :include => [:author])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def author\n @node.at_xpath(\"author\").try(:content)\n end",
"def index1\n @publications = Publication.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end",
"def show\n @author = Author.find(params[:id])\n render :show\n end",
"def authors\n @authors\n end",
"def show\n @authorid = params[:id]\n @author = Author.find( params[:id] )\n @publishedBooks = Book.where( \"author = '#{@author.name}' \" )\n end",
"def authors\n document.search(\"[@id='bookAuthors']/[@itemprop='author']/a/span\").map { |elem| elem.innerHTML.strip } rescue []\n end",
"def author_info(url)\n authorinfo = handle_response(self.class.get(\"/authorinfo.json\", :query => {:url => url}))\n Topsy::Author.new(authorinfo)\n end",
"def index\n if params[:author_id]\n @author = Author.find(params[:author_id])\n @books = @author.books\n else\n @books = Book.all\n end\n end",
"def get_author\n id = params[:ID]\n puts \"ID:#{id}\"\n request = Net::HTTP::Get.new(\"/personality-api/1/author.json?ID=#{id}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end",
"def author\n I18n.locale = params[:lang]\n\n @quotes = Quote.where(:author => CGI::unescape(params[:author]))\n @quote = Quote.new\n\n @quote.author = params[:author] if !(params[:author].nil?)\n\n respond_to do |format|\n format.html # author.html.erb\n format.xml { render :xml => @quotes }\n end\n end",
"def show\n @authorship = Authorship.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @authorship.to_xml }\n end\n end",
"def index\n if @author_id\n @publications = @author.publications\n else\n @publications = Publication.all\n end\n render json: @publications\n end",
"def author\n traverse_element('meta',\n '{http://www.w3.org/1999/xhtml}meta') {|e|\n begin\n next unless e.fetch_attr('name').downcase == 'author'\n author = e.fetch_attribute('content').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n traverse_element('link',\n '{http://www.w3.org/1999/xhtml}link') {|e|\n begin\n next unless e.fetch_attr('rev').downcase == 'made'\n author = e.fetch_attribute('title').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n if channel = find_element('{http://purl.org/rss/1.0/}channel')\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}creator') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}publisher') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n\n ['http://www.w3.org/2005/Atom', 'http://purl.org/atom/ns#'].each {|xmlns|\n each_child {|top|\n next unless top.elem?\n if top.name == \"{#{xmlns}}feed\"\n if feed_author = find_element(\"{#{xmlns}}author\")\n feed_author.traverse_element(\"{#{xmlns}}name\") {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n end\n }\n }\n\n nil\n end",
"def show\n @research = Research.find(params[:id])\n @page_title = \"Hello Congress research request: \" + @research.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def show\n (@response, @document_list) = search_results(set_author_query(params))\n\n # Remove the header search form, to prefer the search within author form\n @no_header_search = true\n end",
"def index\n @authors_books = AuthorsBook.all\n end",
"def index\n @organizations = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organizations }\n end\n end",
"def index\n if params.include?(:name)\n @owner = Owner.find_by_name(params[:name])\n @articles = @owner.articles\n else\n @owner = nil\n @articles = Article.includes(:owner).all\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render_json_responsibly(articles: @articles) }\n end\n end",
"def index\n @person_verses = PersonVerse.all\n\n respond_to do |format|\n format.html { render :layout => \"main\" } # index.html.erb\n format.xml { render :xml => @person_verses }\n end\n end",
"def get_authors(authors, options={})\n Array(authors).map { |author| get_one_author(author, options) }\n end",
"def show\n @copyright_holder = CopyrightHolder.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @copyright_holder.to_xml }\n end\n end",
"def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end",
"def author\n if @author.nil?\n @author = FeedTools::Author.new\n author_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:author\",\n \"atom03:author\",\n \"atom:author\",\n \"author\",\n \"managingEditor\",\n \"dc:author\",\n \"dc:creator\"\n ])\n unless author_node.nil?\n @author.raw = FeedTools::XmlHelper.try_xpaths(\n author_node, [\"text()\"], :select_result_value => true)\n @author.raw = FeedTools::HtmlHelper.unescape_entities(@author.raw)\n unless @author.raw.nil?\n raw_scan = @author.raw.scan(\n /(.*)\\((\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b)\\)/i)\n if raw_scan.nil? || raw_scan.size == 0\n raw_scan = @author.raw.scan(\n /(\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b)\\s*\\((.*)\\)/i)\n unless raw_scan.size == 0\n author_raw_pair = raw_scan.first.reverse\n end\n else\n author_raw_pair = raw_scan.first\n end\n if raw_scan.nil? || raw_scan.size == 0\n email_scan = @author.raw.scan(\n /\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b/i)\n if email_scan != nil && email_scan.size > 0\n @author.email = email_scan.first.strip\n end\n end\n unless author_raw_pair.nil? || author_raw_pair.size == 0\n @author.name = author_raw_pair.first.strip\n @author.email = author_raw_pair.last.strip\n else\n unless @author.raw.include?(\"@\")\n # We can be reasonably sure we are looking at something\n # that the creator didn't intend to contain an email address\n # if it got through the preceeding regexes and it doesn't\n # contain the tell-tale '@' symbol.\n @author.name = @author.raw\n end\n end\n end\n if @author.name.blank?\n @author.name = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:name/text()\",\n \"atom03:name/text()\",\n \"atom:name/text()\",\n \"name/text()\",\n \"@name\"\n ], :select_result_value => true)\n )\n end\n if @author.email.blank?\n @author.email = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:email/text()\",\n \"atom03:email/text()\",\n \"atom:email/text()\",\n \"email/text()\",\n \"@email\"\n ], :select_result_value => true)\n )\n end\n if @author.url.blank?\n @author.url = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:url/text()\",\n \"atom03:url/text()\",\n \"atom:url/text()\",\n \"url/text()\",\n \"atom10:uri/text()\",\n \"atom03:uri/text()\",\n \"atom:uri/text()\",\n \"uri/text()\",\n \"@href\",\n \"@uri\",\n \"@href\"\n ], :select_result_value => true)\n )\n end\n if @author.name.blank? && !@author.raw.blank? &&\n !@author.email.blank?\n name_scan = @author.raw.scan(\n /\"?([^\"]*)\"? ?[\\(<].*#{@author.email}.*[\\)>].*/)\n if name_scan.flatten.size == 1\n @author.name = name_scan.flatten[0].strip\n end\n if @author.name.blank?\n name_scan = @author.raw.scan(\n /.*#{@author.email} ?[\\(<]\"?([^\"]*)\"?[\\)>].*/)\n if name_scan.flatten.size == 1\n @author.name = name_scan.flatten[0].strip\n end\n end\n end\n @author.name = nil if @author.name.blank?\n @author.raw = nil if @author.raw.blank?\n @author.email = nil if @author.email.blank?\n @author.url = nil if @author.url.blank?\n if @author.url != nil\n begin\n if !(@author.url =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(@author.url)\n @author.url = FeedTools::UriHelper.resolve_relative_uri(\n @author.url, [author_node.base_uri, self.base_uri])\n end\n rescue\n end\n end\n if FeedTools::XmlHelper.try_xpaths(author_node,\n [\"@gr:unknown-author\"], :select_result_value => true) == \"true\"\n if @author.name == \"(author unknown)\"\n @author.name = nil\n end\n end\n end\n # Fallback on the itunes module if we didn't find an author name\n begin\n @author.name = self.itunes_author if @author.name.nil?\n rescue\n @author.name = nil\n end\n end\n return @author\n end",
"def index\n @authors = Author.all.includes(:books)\n end",
"def author\n traverse_element('meta',\n '{http://www.w3.org/1999/xhtml}meta') {|e|\n begin\n next unless e.fetch_attr('name').downcase == 'author'\n author = e.fetch_attribute('content').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n traverse_element('link',\n '{http://www.w3.org/1999/xhtml}link') {|e|\n begin\n next unless e.fetch_attr('rev').downcase == 'made'\n author = e.fetch_attribute('title').strip\n return author if !author.empty?\n rescue IndexError\n end\n } \n\n if channel = find_element('{http://purl.org/rss/1.0/}channel')\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}creator') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}publisher') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n\n nil\n end",
"def index\n @books_authors = BooksAuthor.all\n end",
"def\n get_author()\n @author\n end",
"def index\n @chapter_authors = ChapterAuthor.all\n end",
"def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @university }\n end\n end",
"def author\n authors.first\n end",
"def author\n authors.first\n end",
"def get_authors(authors, options = {})\n Array(authors).map { |author| get_one_author(author, options) }\n end",
"def get_authors(authors)\n Array(authors).map { |author| get_one_author(author) }\n end",
"def index\n @book_authors = BookAuthor.all\n end",
"def show\n @publication = Publication.find(params[:id])\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def show\n @researcher = Researcher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @researcher }\n end\n end",
"def index\n @sort = params[:sort]\n @authors =\n case @sort\n when 'date'\n Author.order(created_at: :desc)\n when 'publications'\n Author\n .left_joins(:publications).group(:id)\n .order('COUNT(publications.id) DESC')\n when 'names'\n Author\n .left_joins(:names).group(:id)\n .select('\"authors\".*, COUNT(DISTINCT names.id) AS name_count')\n .order(name_count: :desc)\n else\n @sort = 'alphabetically'\n Author.order(name: :asc)\n end\n @authors = @authors.paginate(page: params[:page], per_page: 100)\n @crumbs = ['Authors']\n end",
"def index\n @users = User.find(:all, :order => 'name ASC')\n respond_to do |format|\n format.html \n format.xml { @users.to_xml }\n end\n end",
"def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end",
"def index\n @publications = Publication.all\n @publications_by_year = @publications.group_by(&:year).sort.reverse\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end",
"def list_books(api_object)\n puts \"Current Books:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('books/book/title').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend",
"def show\n @author_extra = AuthorExtra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author_extra }\n end\n end",
"def get_author()\n @author\n end",
"def index\n @q = Author.search(params[:q])\n @authors = @q.result(distinct: true).paginate(:page => params[:page]).order('last_name ASC')\n end",
"def index\n @paper_authors = PaperAuthor.all\n end",
"def serialize!\n\t\t\t@namespaces=raw_doc.root.namespaces if @namespaces.nil?\n\t\t\t@authors=[]\n\t\t\t@raw_doc=raw_doc.at('./xmlns:entry',@namespaces) if raw_doc.at('./xmlns:entry',@namespaces)\n\t\t\t@title=text(raw_doc.at('./xmlns:title',@namespaces))\n\t\t\t@id=text(raw_doc.at('./xmlns:id',@namespaces))\n\t\t\t@summary=text(raw_doc.at('./xmlns:summary',@namespaces))\n\t\t\td=text(raw_doc.at('./xmlns:updated',@namespaces))\n\t\t\t@updated=DateTime.parse(d) unless d.nil?\n\t\t\td=text(raw_doc.at('./xmlns:published',@namespaces))\n\t\t\t@published=DateTime.parse(d) unless d.nil?\n\n\t\t\t@authors=raw_doc.xpath('./xmlns:author',@namespaces).collect do |author|\n\t\t\t\t{\n\t\t\t\t\t:name => text(author.at('./xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(author.at('./xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(author.at('./xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@links=OPDS::Support::LinkSet.new @browser\n\t\t\traw_doc.xpath('./xmlns:link',@namespaces).each do |n|\n\t\t\t\ttext=nil\n\t\t\t\ttext=n.attributes['title'].value unless n.attributes['title'].nil?\n\t\t\t\tlink=n.attributes['href'].value\n\t\t\t\ttype=n.attributes['type'].value unless n.attributes['type'].nil?\n\t\t\t\tprice=nil\n\t\t\t\tcurrency=nil\n\t\t\t\t@namespaces['opds']||='http://opds-spec.org/2010/catalog'\n\t\t\t\ttypes=n.search('.//opds:indirectAcquisition',@namespaces).map{|b| b['type']}\n\t\t\t\ttype=[type,types].flatten.compact unless types.nil? || types.empty?\n\t\t\t\toprice=n.at('./opds:price',@namespaces)\n\t\t\t\tif oprice\n\t\t\t\t\tprice=text(oprice)\n\t\t\t\t\tcurrency=oprice.attributes['currencycode'].value unless oprice.attributes['currencycode'].nil?\n\t\t\t\tend\n\n\t\t\t\tunless n.attributes['rel'].nil?\n\t\t\t\t\tn.attributes['rel'].value.split.each do |rel|\n\t\t\t\t\t\t@links.push(rel,link,text,type,price,currency)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@links.push(nil,link,text,type,price,currency)\n\t\t\t\tend\n\t\t\tend\n\t\t\t@dcmetas=Hash.new\n\t\t\tprefs=@namespaces.reject{|_,v| !%W[http://purl.org/dc/terms/ http://purl.org/dc/elements/1.1/].include?v}\n\t\t\tprefs.keys.map{|p| p.split(':').last}.each do |pref|\n\t\t\t\traw_doc.xpath('./'+pref+':*',@namespaces).each do |n|\n\t\t\t\t\t@dcmetas[n.name]=[] unless @dcmetas[n.name]\n\t\t\t\t\t@dcmetas[n.name].push [n.text, n]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@categories=raw_doc.xpath('./xmlns:category',@namespaces).collect do |n|\n\t\t\t\t[text(n.attributes['label']),text(n.attributes['term'])]\n\t\t\tend\n\n\t\t\t@content=raw_doc.at('./xmlns:content',@namespaces).to_s\n\t\t\t\n\t\t\t@contributors=raw_doc.xpath('./xmlns:contributor',@namespaces).collect do |auth|\n\t\t\t\t{\n\t\t\t\t\t:name => text(raw_doc.at('./xmlns:contributor/xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(raw_doc.at('./xmlns:contributor/xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(raw_doc.at('./xmlns:contributor/xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@rights=text(raw_doc.at('./xmlns:rights',@namespaces))\n\t\t\t@subtitle=text(raw_doc.at('./xmlns:rights',@namespaces))\n\n\t\tend",
"def show\n @citation = Citation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @citation }\n end\n end",
"def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def show\n @journal = @book.journals.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"def index\n @authors = Author.find_by_sql(\"SELECT * FROM AUTHOR\").paginate(:page => params[:page] || 1,:per_page => 20)\n end",
"def index\n @q = Author.ransack(params[:q])\n \n # The sortable_name field gives the last name downcased with \"ae\" etc substituted for umlauted vowels\n @authors = @q.result.paginate(:page => params[:page], :per_page => 14).order(sortable_name: :asc, firstnames: :asc)\n end",
"def set_authors_publication\n @authors_publication = AuthorsPublication.find(params[:id])\n end",
"def author\n @author ||= Readability::Document.new(@html).author\n end",
"def author\n @author\n end",
"def set_authors_book\n @authors_book = AuthorsBook.find(params[:id])\n end",
"def index\n @by_pageview = Author.with_article.order('pageview desc').limit(10)\n @by_article = Author.with_article.order('articles_count desc').limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @authors }\n end\n end",
"def show_all_article_titles_with_authors\n @all = all_article_titles_with_authors\n @all.each do |title, author|\n puts \"#{author} - #{title}\"\n end\n return @all\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def index\n @people = Person.all\n @title = \"peoples\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def show\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @artist }\n end\n end",
"def authors\n read_property 'Authors'\n end",
"def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reviewer }\n end\n end",
"def index\n @organs = Organ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organs }\n end\n end",
"def index\n @distributions = @foyer.distributions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @distributions }\n end\n end",
"def show\n @author_paper = AuthorPaper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author_paper }\n end\n end",
"def author\n response = read(\"/user/#{@author}/about.json\", :handler => \"User\") if @author\n @author_data ||= response[0] if response\n end",
"def the_author(content=nil)\n if node = content || @content || Content.get(params[:id]) \n author = node.author\n end\n end"
] |
[
"0.70273924",
"0.6813894",
"0.681174",
"0.6693451",
"0.6566892",
"0.6503373",
"0.6503373",
"0.6503373",
"0.6503373",
"0.64935154",
"0.64515775",
"0.63987124",
"0.63975984",
"0.6393685",
"0.6386732",
"0.6383627",
"0.6355221",
"0.63278633",
"0.6312841",
"0.6295561",
"0.6215661",
"0.6191785",
"0.61745405",
"0.6149877",
"0.61322355",
"0.6117685",
"0.609393",
"0.60781467",
"0.6073718",
"0.60639393",
"0.6040353",
"0.60151595",
"0.59953463",
"0.59776515",
"0.59765327",
"0.5973262",
"0.59702235",
"0.5966724",
"0.5942573",
"0.5941457",
"0.59280384",
"0.59164447",
"0.59129244",
"0.5906945",
"0.5894243",
"0.5880685",
"0.5874689",
"0.5873028",
"0.5859983",
"0.5841601",
"0.58265424",
"0.582312",
"0.5821802",
"0.58192164",
"0.580806",
"0.5806856",
"0.5792924",
"0.5788924",
"0.57873595",
"0.5769319",
"0.5768615",
"0.57587767",
"0.57587767",
"0.575241",
"0.5747911",
"0.5739655",
"0.57294005",
"0.5722299",
"0.5708395",
"0.57059175",
"0.5703591",
"0.5700576",
"0.5697981",
"0.5692591",
"0.56898564",
"0.56803197",
"0.5667924",
"0.56669724",
"0.5655858",
"0.56547964",
"0.5651713",
"0.5644222",
"0.564387",
"0.5641595",
"0.5636883",
"0.5625129",
"0.5621538",
"0.5620256",
"0.56191593",
"0.5615718",
"0.5615718",
"0.5615718",
"0.561423",
"0.56097865",
"0.560788",
"0.56052554",
"0.559829",
"0.55973625",
"0.55946183",
"0.55909485",
"0.5579846"
] |
0.0
|
-1
|
GET /authors/new GET /authors/new.xml
|
def new
@author = Author.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @author }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @author_repository = AuthorRepository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author_repository }\n end\n end",
"def new\n @author = Author.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @author }\n end\n end",
"def new\n @authors_book = AuthorsBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @authors_book }\n end\n end",
"def new\n @map_author = MapAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_author }\n end\n end",
"def new\n @author = Author.new\n respond_with(@author)\n end",
"def new\n @person = Person.new\n @person.names.new\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @authorship = Authorship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @authorship }\n end\n end",
"def new\r\n @author = Author.new\r\n render_new\r\n end",
"def new\n @repo = Repo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repo }\n end\n end",
"def create\n @author = Author.new(params[:author])\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to(@author, :notice => 'Author was successfully created.') }\n format.xml { render :xml => @author, :status => :created, :location => @author }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(params[:author])\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to(@author, :notice => 'Author was successfully created.') }\n format.xml { render :xml => @author, :status => :created, :location => @author }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def new\n @person = Person.new\n @title = \"people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @artist }\n end\n end",
"def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noun }\n end\n end",
"def new\n @author_extra = AuthorExtra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @author_extra }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @citation = Citation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @citation }\n end\n end",
"def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"def new\n @researcher = Researcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @researcher }\n end\n end",
"def new\n @author_paper = AuthorPaper.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @author_paper }\n end\n end",
"def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end",
"def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"def new\n @organ = Organ.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organ }\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def new\n @nom = Nom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nom }\n end\n end",
"def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def new\n @publication = Publication.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end",
"def new\n if params[:initial_authorship]\n @authorship = Authorship.find(params[:initial_authorship])\n @author = Author.new(:en_name => @authorship.en_name,\n :jp_name => @authorship.jp_name)\n else\n @author = Author.new\n end\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @author = Author.new\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @creator_type = CreatorType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creator_type }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @blog_author = BlogAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog_author }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end",
"def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"def new\n @norma = Norma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @norma }\n end\n end",
"def new\n @book = Book.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @reviewer = Reviewer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reviewer }\n end\n end",
"def new\n @node = Node.new\n @node.owner = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def new\n @article = current_user.articles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @published_document = PublishedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @published_document }\n end\n end",
"def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @universe = Universe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @universe }\n end\n end",
"def new\n @publication = Publication.new(:kind => \"Full Paper\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def new\n @primary_publication = PrimaryPublication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @primary_publication }\n end\n end",
"def new\n @usr = Usr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usr }\n end\n end",
"def new\n @organiser = Organiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organiser }\n end\n end",
"def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end",
"def new\n @creation = Creation.new\n @topics = Topic.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creation }\n end\n end",
"def new\n @matter = Matter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @matter }\n end\n end",
"def new\n @student_publication = StudentPublication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_publication }\n end\n end",
"def new\n @journalentry = Journalentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journalentry }\n end\n end",
"def new\n @origin = Origin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @origin }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @nickname = Nickname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nickname }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @publication_number = PublicationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication_number }\n end\n end",
"def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @book }\n format.json { render json: @book }\n end\n end",
"def new\n @announcer = Announcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcer }\n end\n end"
] |
[
"0.7443775",
"0.70914954",
"0.68965006",
"0.6862118",
"0.6814787",
"0.6762321",
"0.66597104",
"0.66587365",
"0.66358787",
"0.66285527",
"0.66285527",
"0.66283363",
"0.6617511",
"0.6612877",
"0.6601246",
"0.6554841",
"0.6536575",
"0.65275043",
"0.65275043",
"0.65275043",
"0.65275043",
"0.65275043",
"0.65275043",
"0.65275043",
"0.65275043",
"0.65275043",
"0.65275043",
"0.6515692",
"0.64874893",
"0.6451111",
"0.64495945",
"0.64162296",
"0.6413351",
"0.6407382",
"0.6407382",
"0.6389624",
"0.6384941",
"0.63810796",
"0.6369556",
"0.63680017",
"0.63549346",
"0.6354542",
"0.63368815",
"0.63273597",
"0.63230777",
"0.63230777",
"0.6322656",
"0.632179",
"0.63162136",
"0.63162136",
"0.63162136",
"0.63162136",
"0.63162136",
"0.63162136",
"0.63162136",
"0.63162136",
"0.6313536",
"0.62960476",
"0.62910473",
"0.62878066",
"0.6287677",
"0.62850827",
"0.6281411",
"0.6273999",
"0.627059",
"0.6270417",
"0.62644184",
"0.6262524",
"0.62623304",
"0.6254843",
"0.6253324",
"0.6253324",
"0.6253324",
"0.6253324",
"0.6253324",
"0.6253324",
"0.6253324",
"0.6253324",
"0.6249",
"0.6248686",
"0.6247395",
"0.6239641",
"0.62278277",
"0.62180245",
"0.6216817",
"0.62164164",
"0.6214241",
"0.6214216",
"0.621182",
"0.62113374",
"0.6209535",
"0.6209535",
"0.620799",
"0.6207783",
"0.62047094",
"0.620435",
"0.62026185",
"0.6200873",
"0.61996806",
"0.6195891"
] |
0.7725193
|
0
|
POST /authors POST /authors.xml
|
def create
@author = Author.new(params[:author])
respond_to do |format|
if @author.save
format.html { redirect_to(@author, :notice => 'Author was successfully created.') }
format.xml { render :xml => @author, :status => :created, :location => @author }
else
format.html { render :action => "new" }
format.xml { render :xml => @author.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_authors\n text = params[:text]\n puts \"str:#{text}\"\n request = Net::HTTP::Post.new(\"/personality-api/1/add_authors.json\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n request.set_form_data({ :text => text\n })\n logger.debug(\"request #{request}\");\n response = @http.request(request)\n render :text => response.body\n\n end",
"def create\n @references_author = References::Author.new(references_author_params)\n\n respond_to do |format|\n if @references_author.save\n format.html { redirect_to @references_author, notice: 'Author was successfully created.' }\n format.json { render action: 'show', status: :created, location: @references_author }\n else\n format.html { render action: 'new' }\n format.json { render json: @references_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(params[:author])\n @author.save\n respond_with(@author)\n end",
"def crossref_authors\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.contributors {\n authors.each_with_index do |author, index|\n given_name = author.given_name\n surname = author.last_name\n orcid = author.orcid\n if index == 0\n sequence = \"first\"\n else\n sequence = \"additional\"\n end\n xml.person_name(:sequence => sequence, :contributor_role => \"author\") {\n xml.given_name given_name.encode(:xml => :text)\n if surname.nil?\n xml.surname \"No Last Name\".encode(:xml => :text)\n else\n xml.surname surname.encode(:xml => :text)\n end\n xml.ORCID \"http://orcid.org/#{author.orcid}\" if !orcid.nil?\n }\n end\n }\n end\n\n return builder.doc.xpath('//contributors').to_xml\n end",
"def create\n @book = Book.new(book_params)\n #for author_id in params[:authors_ids]\n # @book.authors << Author.find(author_id)\n #end\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n author = Author.create(params[:author])\n redirect_to(author)\n end",
"def create\n @author = Author.new(author_params)\n author_attributes\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n Author.create(\n name: params[:name],\n dob: params[:dob],\n gender: params[:gender],\n has_pseudonym: params[:has_pseudonym])\n redirect_to '/authors'\n end",
"def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(params[:author])\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render json: @author, status: :created, location: @author }\n else\n format.html { render action: \"new\" }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n authors=params[:book][:author_book_ids]\n @book = Book.new(book_params.except(:author_book_ids))\n respond_to do |format|\n if @book.save\n if authors.present?\n authors.each do |a|\n @book.authors << Author.find(a)\n end\n end\n format.html { redirect_to @book, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def authors\n nodes = @doc.xpath(\"atom:feed/atom:author\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomPerson.new(node) }\n end",
"def create\n @author = Author.new(author_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render action: 'show', status: :created, location: @author }\n else\n format.html { render action: 'new' }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def authors\n nodes = @node.xpath(\"atom:author\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomPerson.new(node) }\n end",
"def new\n @author = Author.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author }\n end\n end",
"def create\n @author = Author.new(author_params)\n\n if @author.save\n render :show, status: :created, location: api_v1_author_url(@author)\n else\n render json: { error: @author.errors }, status: :unprocessable_entity\n end\n end",
"def create\n @author = Author.new(allowed_params)\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to @author, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n else\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def auttor_params\n params.require(:auttor).permit(:authorid, :authorname)\n end",
"def create\n @authors_book = AuthorsBook.new(params[:authors_book])\n\n respond_to do |format|\n if @authors_book.save\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully created.' }\n format.json { render json: @authors_book, status: :created, location: @authors_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @authors_book = AuthorsBook.new(authors_book_params)\n\n respond_to do |format|\n if @authors_book.save\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully created.' }\n format.json { render :show, status: :created, location: @authors_book }\n else\n format.html { render :new }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @author_repository = AuthorRepository.new(params[:author_repository])\n\n respond_to do |format|\n if @author_repository.save\n format.html { redirect_to(@author_repository, :notice => 'Author repository was successfully created.') }\n format.xml { render :xml => @author_repository, :status => :created, :location => @author_repository }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @author_repository.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(author_params)\n respond_to do |format|\n begin\n sql = \"INSERT INTO AUTHOR\n ( Author_name )\n VALUES (\\\"#{params[:author][:Author_name]}\\\")\"\n ActiveRecord::Base.connection.execute(sql)\n @authors = Author.find_by_sql(\"SELECT * FROM AUTHOR\")\n format.html { redirect_to authors_path, notice: 'Author was successfully created.' }\n format.json { render :show, status: :created, location: @author }\n rescue => error\n flash.now[:alert] = error.message\n format.html { render :new }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def author\n url = @json['user']['meta']['author']\n data = client.get url\n client.factory.create(GoodData::Membership, data)\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def create\n @map_author = MapAuthor.new(params[:map_author])\n\n respond_to do |format|\n if @map_author.save\n format.html { redirect_to([:admin, @map_author], :notice => 'Map author was successfully created.') }\n format.xml { render :xml => @map_author, :status => :created, :location => @map_author }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def review_authors # :norobots:\n pass_query_params\n @object = AbstractModel.find_object(params[:type], params[:id].to_s)\n @authors = @object.authors\n parent = @object.parent\n if @authors.member?(@user) || @user.in_group?(\"reviewers\")\n @users = User.all(order: \"login, name\")\n new_author = params[:add] ? User.find(params[:add]) : nil\n if new_author && !@authors.member?(new_author)\n @object.add_author(new_author)\n flash_notice(\"Added #{new_author.legal_name}\")\n # Should send email as well\n end\n old_author = params[:remove] ? User.find(params[:remove]) : nil\n if old_author && @authors.member?(old_author)\n @object.remove_author(old_author)\n flash_notice(\"Removed #{old_author.legal_name}\")\n # Should send email as well\n end\n else\n flash_error(:review_authors_denied.t)\n redirect_with_query(controller: parent.show_controller,\n action: parent.show_action, id: parent.id)\n end\n end",
"def new\n @author_repository = AuthorRepository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author_repository }\n end\n end",
"def author_params\r\n params.require(:author).permit(:name)\r\n end",
"def author_params\n params.require(:author).permit(:name)\n end",
"def author_params\n params.require(:author).permit(:name)\n end",
"def authors\n\t#params[:diff] = params[:diff].eql?\"true\"\n \trespond_in_format Marginalia.authors(params[:id],params[:diff])\n end",
"def author_params\n params.require(:author).permit(:name, :surname, :email, :slug, :notes)\n end",
"def createAuthor(name=nil)\n params = {}\n params[:name] = name unless name.nil?\n call :createAuthor, params\n end",
"def create\n @game = Game.find(params[:game_id])\n @game.authorships.create_from_names(params[:authorship])\n respond_to do |format|\n flash[:notice] = 'Les autheurs sont enregistres'\n format.html { redirect_to game_path(@game) }\n format.xml { head :created, :location => authorship_url(@authorship) }\n end\n end",
"def author_params\n params.require(:author).permit(:given_name, :family_name)\n end",
"def author_params\n params.require(:author).permit(:given_name, :family_name)\n end",
"def getAuthors(indexMeta, rawMeta)\n # If not UC-Ingest formatted, fall back on index info\n if !rawMeta.at(\"/record/authors\")\n return indexMeta.multiple(\"creator\").map { |name| {name: name} }\n end\n\n # For UC-Ingest, we can provide more detailed author info\n rawMeta.xpath(\"/record/authors/*\").map { |el|\n if el.name == \"organization\"\n { name: el.text, organization: el.text }\n elsif el.name == \"author\"\n data = { name: formatAuthName(el) }\n el.children.each { |sub|\n if sub.name == \"identifier\"\n data[(sub.attr('type') + \"_id\").to_sym] = sub.text\n else\n data[sub.name.to_sym] = sub.text\n end\n }\n data\n else\n raise(\"Unknown element #{el.name.inspect} within UCIngest authors\")\n end\n }\nend",
"def create\n @author_paper = AuthorPaper.new(params[:author_paper])\n\n respond_to do |format|\n if @author_paper.save\n format.html { redirect_to @author_paper, :notice => 'Author paper was successfully created.' }\n format.json { render :json => @author_paper, :status => :created, :location => @author_paper }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @author_paper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(author_params)\n\n respond_to_create({thing: @author})\n end",
"def author_params\n params.require(:author).permit(:first_name, :last_name)\n end",
"def add_author( solr_doc, author_number, authors )\n\n role = solr_doc.at_path( \"mods_0_name_#{author_number}_role_0_text_t[0]\" )\n if role && role.include?( 'author' )\n cid = solr_doc.at_path( \"mods_0_name_#{author_number}_computing_id_t[0]\" )\n fn = solr_doc.at_path( \"mods_0_name_#{author_number}_first_name_t[0]\" )\n ln = solr_doc.at_path( \"mods_0_name_#{author_number}_last_name_t[0]\" )\n dept = solr_doc.at_path( \"mods_0_name_#{author_number}_description_t[0]\" )\n ins = solr_doc.at_path( \"mods_0_name_#{author_number}_institution_t[0]\" )\n\n return add_person( authors, author_number, cid, fn, ln, dept, ins )\n end\n\n # could not find the next author, we are done\n return false, authors\n end",
"def author_params\n params.require(:author).permit(:surname, :firstname, :birthdate, :sex, :title)\n end",
"def create\n @author_extra = AuthorExtra.new(params[:author_extra])\n\n respond_to do |format|\n if @author_extra.save\n format.html { redirect_to @author_extra, :notice => 'Author extra was successfully created.' }\n format.json { render :json => @author_extra, :status => :created, :location => @author_extra }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @author_extra.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @books_author = BooksAuthor.new(books_author_params)\n\n respond_to do |format|\n if @books_author.save\n format.html { redirect_to @books_author, notice: 'Books author was successfully created.' }\n format.json { render :show, status: :created, location: @books_author }\n else\n format.html { render :new }\n format.json { render json: @books_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\tcreate_author(params[:q],params[:r])\n\n\tif @author != nil\n respond_to do |format|\n if @book.save\n\t @author.books << @book unless @author.books.include? @book\n\t\t @author = nil\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n\t\t # format.js\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n\t\t # format.js { render :action => 'create_error' }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n\telse\n\t respond_to do |format|\n\t format.html { render :action => \"new\" }\n\t\t# correc the line below\n\t\tformat.xml { render :xml => {@author=>[\"Author name is not valid\"]}, :status => :unprocessable_entity }\n\t end\n\tend\n end",
"def author_params\n params[:author].permit(:name, :bio )\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end",
"def create\n @paper_author = PaperAuthor.new(paper_author_params)\n\n respond_to do |format|\n if @paper_author.save\n format.html { redirect_to @paper_author, notice: 'Paper author was successfully created.' }\n format.json { render :show, status: :created, location: @paper_author }\n else\n format.html { render :new }\n format.json { render json: @paper_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def create\n @author = Author.new(author_params)\n\n if @author.save\n redirect_to admin_author_path @author\n else\n render action: \"new\"\n end\n end",
"def author_params\n params.require(:author).permit(:fq, :internet_id, :first_name, :last_name, :tenure_status, :scopus_author_id, :author_position, :hindex, :dept_id, :dept_name)\n end",
"def serialize!\n\t\t\t@namespaces=raw_doc.root.namespaces if @namespaces.nil?\n\t\t\t@authors=[]\n\t\t\t@raw_doc=raw_doc.at('./xmlns:entry',@namespaces) if raw_doc.at('./xmlns:entry',@namespaces)\n\t\t\t@title=text(raw_doc.at('./xmlns:title',@namespaces))\n\t\t\t@id=text(raw_doc.at('./xmlns:id',@namespaces))\n\t\t\t@summary=text(raw_doc.at('./xmlns:summary',@namespaces))\n\t\t\td=text(raw_doc.at('./xmlns:updated',@namespaces))\n\t\t\t@updated=DateTime.parse(d) unless d.nil?\n\t\t\td=text(raw_doc.at('./xmlns:published',@namespaces))\n\t\t\t@published=DateTime.parse(d) unless d.nil?\n\n\t\t\t@authors=raw_doc.xpath('./xmlns:author',@namespaces).collect do |author|\n\t\t\t\t{\n\t\t\t\t\t:name => text(author.at('./xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(author.at('./xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(author.at('./xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@links=OPDS::Support::LinkSet.new @browser\n\t\t\traw_doc.xpath('./xmlns:link',@namespaces).each do |n|\n\t\t\t\ttext=nil\n\t\t\t\ttext=n.attributes['title'].value unless n.attributes['title'].nil?\n\t\t\t\tlink=n.attributes['href'].value\n\t\t\t\ttype=n.attributes['type'].value unless n.attributes['type'].nil?\n\t\t\t\tprice=nil\n\t\t\t\tcurrency=nil\n\t\t\t\t@namespaces['opds']||='http://opds-spec.org/2010/catalog'\n\t\t\t\ttypes=n.search('.//opds:indirectAcquisition',@namespaces).map{|b| b['type']}\n\t\t\t\ttype=[type,types].flatten.compact unless types.nil? || types.empty?\n\t\t\t\toprice=n.at('./opds:price',@namespaces)\n\t\t\t\tif oprice\n\t\t\t\t\tprice=text(oprice)\n\t\t\t\t\tcurrency=oprice.attributes['currencycode'].value unless oprice.attributes['currencycode'].nil?\n\t\t\t\tend\n\n\t\t\t\tunless n.attributes['rel'].nil?\n\t\t\t\t\tn.attributes['rel'].value.split.each do |rel|\n\t\t\t\t\t\t@links.push(rel,link,text,type,price,currency)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@links.push(nil,link,text,type,price,currency)\n\t\t\t\tend\n\t\t\tend\n\t\t\t@dcmetas=Hash.new\n\t\t\tprefs=@namespaces.reject{|_,v| !%W[http://purl.org/dc/terms/ http://purl.org/dc/elements/1.1/].include?v}\n\t\t\tprefs.keys.map{|p| p.split(':').last}.each do |pref|\n\t\t\t\traw_doc.xpath('./'+pref+':*',@namespaces).each do |n|\n\t\t\t\t\t@dcmetas[n.name]=[] unless @dcmetas[n.name]\n\t\t\t\t\t@dcmetas[n.name].push [n.text, n]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@categories=raw_doc.xpath('./xmlns:category',@namespaces).collect do |n|\n\t\t\t\t[text(n.attributes['label']),text(n.attributes['term'])]\n\t\t\tend\n\n\t\t\t@content=raw_doc.at('./xmlns:content',@namespaces).to_s\n\t\t\t\n\t\t\t@contributors=raw_doc.xpath('./xmlns:contributor',@namespaces).collect do |auth|\n\t\t\t\t{\n\t\t\t\t\t:name => text(raw_doc.at('./xmlns:contributor/xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(raw_doc.at('./xmlns:contributor/xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(raw_doc.at('./xmlns:contributor/xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@rights=text(raw_doc.at('./xmlns:rights',@namespaces))\n\t\t\t@subtitle=text(raw_doc.at('./xmlns:rights',@namespaces))\n\n\t\tend",
"def create\n @author = Author.new(params[:author])\n @author.conference_confirm = current_conference\n\n if @author.save\n flash[:notice] = \"Author was successfully created\"\n else\n authorships_errors = @author.authorships.map{|as| as.errors.full_messages}.join(' ')\n flash[:error] = \"Failed to create Author #{@author.errors.full_messages} #{authorships_errors}\"\n end\n respond_with @author, :success_action => :back\n end",
"def author_params\n params.require(:author).permit(:Author_name)\n end",
"def create\n @blog_author = BlogAuthor.new(params[:blog_author])\n\n respond_to do |format|\n if @blog_author.save\n format.html { redirect_to blog_authors_path, notice: '執筆者登録を完了しました。' }\n format.json { render json: @blog_author, status: :created, location: @blog_author }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blog_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_create\n get :new\n assert_template 'admin/author/new'\n Author.destroy_all\n \n assert_equal 0, Author.find(:all).size\n post :create, :author => {:first_name => \"Dave\", \n :last_name => \"Thomas\"}\n assert_response :redirect\n assert_redirected_to :action => \"list\"\n assert_equal 1, Author.find(:all).size\n assert_equal \"Dave\", Author.find(:first).first_name\n assert_equal 'Author was successfully created.', flash[:notice]\n end",
"def author=(o)\n self.authors = [o]\n end",
"def author_request # :norobots:\n pass_query_params\n @object = AbstractModel.find_object(params[:type], params[:id].to_s)\n return unless request.method == \"POST\"\n subject = param_lookup([:email, :subject], \"\")\n content = param_lookup([:email, :content], \"\")\n (@object.authors + UserGroup.reviewers.users).uniq.each do |receiver|\n AuthorEmail.build(@user, receiver, @object, subject, content).deliver\n end\n flash_notice(:request_success.t)\n redirect_with_query(controller: @object.show_controller,\n action: @object.show_action, id: @object.id)\n end",
"def author_params\n params.require(:author).permit(:name)\n end",
"def author_params\n params.require(:author).permit(:name)\n end",
"def creator_params\n params.require(:author).permit(:first_name, :last_name)\n end",
"def index\n @authors = Author.all\n respond_with(@authors)\n end",
"def author_params\n params.require(:author).permit(:name, :description, :slug)\n end",
"def authors\n author\n end",
"def create\n @author = Author.new(params[:author])\n @author.user = @user\n @country = Country.find(params[:author][:country_id])\n respond_to do |format|\n if @author.save\n format.html { redirect_to country_author_path(@country.name,@author), :notice => 'Author was successfully created.' }\n format.json { render :json => @author, :status => :created, :location => @author }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @author = Author.new\n respond_with(@author)\n end",
"def create\n @book_author = BookAuthor.new(book_author_params)\n\n respond_to do |format|\n if @book_author.save\n format.html { redirect_to root_path, notice: 'Book author was successfully created.' }\n format.json { render :show, status: :created, location: @book_author }\n else\n format.html { render :new }\n format.json { render json: @book_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def author_params\n params.require(:author).permit(:name, :poetry_header, :about_text, :friendly_header, :order_number,\n :author_id, :additional_info, :last_poem_placeholder, :need_placeholder,\n :title, :subtitle)\n end",
"def create # post \"/authors\" route receives data submitted in form to create new author, and it's mapped to this #create action\n @author = Author.new(author_params) # instantiate author instance with attributes mass assigned from strong params\n # validations are run with #save (which interacts with DB). Instance is only successfully saved to DB if all its attributes are valid\n if @author.save # if the instance is valid b/c all of its attributes are valid, it's successfully saved to DB\n redirect_to author_path(@author) # redirect to show page to show author just created (we re-retrieve instance from DB with new instance variable in show action)\n else # otherwise, the instance is INVALID and is therefore populated with errors (ActiveModel::Errors object)\n render :new # render form to create new author, displaying errors from SAME instance and prefilling fields w/ invalid values submitted beforehand\n end\n end",
"def author\n I18n.locale = params[:lang]\n\n @quotes = Quote.where(:author => CGI::unescape(params[:author]))\n @quote = Quote.new\n\n @quote.author = params[:author] if !(params[:author].nil?)\n\n respond_to do |format|\n format.html # author.html.erb\n format.xml { render :xml => @quotes }\n end\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to(authors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to(authors_url) }\n format.xml { head :ok }\n end\n end",
"def new\n @author = Author.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @author }\n end\n end",
"def set_authors_publication\n @authors_publication = AuthorsPublication.find(params[:id])\n end",
"def authors_publication_params\n params.fetch(:authors_publication, {})\n end",
"def index\n conditions = { :block => false }\n conditions.merge!( :is_opinion => true ) if params[:opinion] == '1'\n conditions.merge!( :is_agency => true ) if params[:agency] == '1'\n unless params[:author_id].blank? && params[:author_ids].blank?\n author_ids = scan_multiple_value_param( :author_id, :first ) || scan_multiple_value_param( :author_ids )\n conditions.merge!( :id => author_ids )\n end\n params[:top] == '1' ? top() : ( !params[:q].blank? ? search( conditions ) : list( conditions ) )\n @authors.delete_if{ |a| a.story_authors.count < 2 } if params[:cf] == '1'\n rxml_data( @authors, :root => 'authors', :with_pagination => true )\n end",
"def create # le submit va chercher la methode create\n @authors = Author.new(author_params)\n @authors.username = params[:author][:username] # on reccupere le nom du form\n @authors.email = params[:author][:email] # on reccupere le body du form \n @authors.password = params[:author][:password] # on reccupere le body du form \n @authors.password_confirmation = params[:author][:password_confirmation] # on reccupere le body du form \n \n @authors.save #on sauvegarde\n redirect_to authors_path # redirection vers l'index\n\nend",
"def create\n author = Author.create!(author_params)\n auth_token = AuthenticateAuthor.new(author.email, author.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def authorizations(params = {})\n scope 'default'\n post('authorizations/', params)\n end",
"def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"def references_author_params\n params.require(:references_author).permit(:name, :slug)\n end",
"def author_params\n params.require(:author).permit(:given, :family)\n end",
"def author\n @node.at_xpath(\"author\").try(:content)\n end",
"def new\n @authorship = Authorship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @authorship }\n end\n end",
"def books_author\n \t@books = Book.where(\"author = '#{params[:author]}'\")\n\n \trespond_to do |format|\n format.html # list_authors.html.erb\n format.json { render json: @books }\n end\n end",
"def new\n @map_author = MapAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_author }\n end\n end",
"def add_author(name, email = nil)\n @authors << {:name => name, :email => email}\n end",
"def author_params\n params.require(:author).permit(:name, :biography, :github_issue_id)\n end",
"def set_author\n @creator = Creator.find(params[:id])\n end",
"def create\n @author_book = AuthorBook.new(author_book_params)\n\n respond_to do |format|\n if @author_book.save\n format.html { redirect_to @author_book, notice: 'Author book was successfully created.' }\n format.json { render :show, status: :created, location: @author_book }\n else\n format.html { render :new }\n format.json { render json: @author_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def authors\n redirect_to url_for(:controller => :authors, :action => :index)\n end",
"def update_paper_authors\n author_ids = paper_params[\"author_ids\"]\n if author_ids\n #remove hidden field from array\n author_ids.shift\n authors = Author.find(author_ids)\n @paper.authors = authors\n return @paper.save\n end\n return true\n end"
] |
[
"0.648555",
"0.6042409",
"0.6015231",
"0.5988629",
"0.5929744",
"0.5927576",
"0.5909428",
"0.590168",
"0.58748627",
"0.58748627",
"0.58748627",
"0.58748627",
"0.5873977",
"0.58709115",
"0.58271414",
"0.58011883",
"0.57874465",
"0.5730848",
"0.5710593",
"0.5630088",
"0.5612164",
"0.55924755",
"0.55860555",
"0.5554318",
"0.5523866",
"0.55187017",
"0.5514939",
"0.5504656",
"0.5461019",
"0.54598975",
"0.54580206",
"0.5446",
"0.5446",
"0.54441303",
"0.5438419",
"0.5426475",
"0.54227084",
"0.5410852",
"0.5410852",
"0.54065293",
"0.54027975",
"0.5399293",
"0.53919935",
"0.5383671",
"0.53820735",
"0.53814423",
"0.5381203",
"0.53809273",
"0.5372611",
"0.5370555",
"0.5363735",
"0.536297",
"0.53618467",
"0.5357893",
"0.53572947",
"0.5343606",
"0.53410405",
"0.5335119",
"0.5308196",
"0.5299877",
"0.5297017",
"0.5294412",
"0.5294412",
"0.52846515",
"0.52832216",
"0.52770406",
"0.52737075",
"0.5273318",
"0.526727",
"0.52275515",
"0.5222917",
"0.52226275",
"0.52208716",
"0.52185124",
"0.52185124",
"0.52145773",
"0.52103597",
"0.52058345",
"0.52019197",
"0.51928145",
"0.518601",
"0.5179008",
"0.5179008",
"0.5179008",
"0.5179008",
"0.5177678",
"0.5169752",
"0.5166256",
"0.5159027",
"0.51566064",
"0.5151822",
"0.5150431",
"0.514318",
"0.51365376",
"0.51356584",
"0.5128152",
"0.51275307",
"0.5114861",
"0.5112232"
] |
0.6285127
|
2
|
PUT /authors/1 PUT /authors/1.xml
|
def update
@author = Author.find(params[:id])
respond_to do |format|
if @author.update_attributes(params[:author])
format.html { redirect_to(@author, :notice => 'Author was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @author.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @author = Author.find(params[:id])\n @author.update_attributes(params[:author])\n respond_with(@author)\n end",
"def update\n @book.authors = params[:book][:authors].delete_if { |x| x == '' }.map { |i| Author.find(i) } if params[:book][:authors].present?\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n author = Author.find(params[:id])\n author.update_attributes(params[:author])\n redirect_to(author_path)\n end",
"def update\n @author = Author.find(params[:id])\n\n respond_to do |format|\n if @author.update_attributes(params[:author])\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n if @authors_book.update_attributes(params[:authors_book])\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to_update({thing: @author})\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n author_attributes\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authors=params[:book][:author_book_ids]\n\n respond_to do |format|\n if @book.update(book_params.except(:author_book_ids))\n @book.authors.delete_all\n if authors.present?\n authors.each do |a|\n @book.authors << Author.find(a)\n end\n end\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_authors_book\n @authors_book = AuthorsBook.find(params[:id])\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n if @author.update(author_params)\n render :show, status: :ok, location: api_v1_author_url(@author)\n else\n render json: { error: @author.errors }, status: :unprocessable_entity\n end\n end",
"def set_v1_author\n @v1_author = V1::Author.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n begin\n sql = \"UPDATE AUTHOR SET\n Author_name = (\\\"#{params[:author][:Author_name]}\\\")\"\n ActiveRecord::Base.connection.execute(sql)\n @authors = Author.find_by_sql(\"SELECT * FROM AUTHOR\")\n format.html { redirect_to authors_path, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :created, location: @author }\n rescue => error\n flash.now[:alert] = error.message\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @author_repository = AuthorRepository.find(params[:id])\n\n respond_to do |format|\n if @author_repository.update_attributes(params[:author_repository])\n format.html { redirect_to(@author_repository, :notice => 'Author repository was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @author_repository.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @author.update(author_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_author(author_id, name = nil, age = nil)\n authors = Authors.with_pk(author_id)\n unless authors.nil?\n authors.name = (name) unless name.nil?\n authors.age = (age) unless age.nil?\n authors.save\n end\n end",
"def update\n @author = find_author\n if @author.update_attributes(author_params)\n flash[:notice] = \"Successfully updated author!\"\n redirect_to root_path\n else\n flash[:alert] = \"Error updating author!\"\n render :edit\n end\n end",
"def update\n @book = Book.find(params[:id])\n\tcreate_author(params[:q],params[:r])\n\n if @author != nil\n\t respond_to do |format|\n if @book.update_attributes(params[:book])\n\t @author.books << @book unless @author.books.include? @book\n\t\t if params[:checks] != nil\n\t params[:checks].each do |s|\n\t\t if @book.authors.count > 1\n\t @book.authors.delete(Author.find_by_id(s))\n\t end\n \t end\n\t end\n\t\t @author = nil\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n\t end\n\telse\n\t respond_to do |format|\n\t flash.now[:error] = 'Author name not valid'\n\t respond_to do |format|\n\t format.html { render :action => \"edit\" }\n\t end\n\t end\n\tend\n end",
"def update\n respond_to do |format|\n if @authors_book.update(authors_book_params)\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully updated.' }\n format.json { render :show, status: :ok, location: @authors_book }\n else\n format.html { render :edit }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n respond_to do |format|\n if @references_author.update(references_author_params)\n format.html { redirect_to @references_author, notice: 'Author was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @references_author }\n else\n format.html { render action: 'edit' }\n format.json { render json: @references_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = load_document_from_params\n # generates sanatized params from params hash to update the doc with\n sanitize_update_params\n @response = update_document(@document,@sanitized_params)\n @document.save\n flash[:notice] = \"Your changes have been saved.\"\n if params.has_key? :add_another_author\n redirect_to({:controller => \"catalog\", :action => \"edit\", :id => params[:id], :wf_step => :contributor, :add_contributor => true}) \n else\n redirect_to( {:controller => \"catalog\", :action => \"edit\", :id => params[:id]}.merge(params_for_next_step_in_wokflow) )\n end\n end",
"def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end",
"def put(*args)\n request :put, *args\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to(authors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to(authors_url) }\n format.xml { head :ok }\n end\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def author=(o)\n self.authors = [o]\n end",
"def set_author\r\n @author = Author.find(params[:id])\r\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update\n @author_extra = AuthorExtra.find(params[:id])\n\n respond_to do |format|\n if @author_extra.update_attributes(params[:author_extra])\n format.html { redirect_to @author_extra, :notice => 'Author extra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @author_extra.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def private_article_authors_replace_with_http_info(article_id, authors, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArticlesApi.private_article_authors_replace ...\"\n end\n # verify the required parameter 'article_id' is set\n if @api_client.config.client_side_validation && article_id.nil?\n fail ArgumentError, \"Missing the required parameter 'article_id' when calling ArticlesApi.private_article_authors_replace\"\n end\n if @api_client.config.client_side_validation && article_id < 1\n fail ArgumentError, 'invalid value for \"article_id\" when calling ArticlesApi.private_article_authors_replace, must be greater than or equal to 1.'\n end\n\n # verify the required parameter 'authors' is set\n if @api_client.config.client_side_validation && authors.nil?\n fail ArgumentError, \"Missing the required parameter 'authors' when calling ArticlesApi.private_article_authors_replace\"\n end\n # resource path\n local_var_path = \"/account/articles/{article_id}/authors\".sub('{' + 'article_id' + '}', article_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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(authors)\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArticlesApi#private_article_authors_replace\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_paper_authors\n author_ids = paper_params[\"author_ids\"]\n if author_ids\n #remove hidden field from array\n author_ids.shift\n authors = Author.find(author_ids)\n @paper.authors = authors\n return @paper.save\n end\n return true\n end",
"def set_authors_publication\n @authors_publication = AuthorsPublication.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end",
"def update\n @author = Author.find(params[:id])\n @author.conference_confirm = current_conference\n\n if @author.update_attributes(params[:author])\n flash[:notice] = 'Author was successfully updated.'\n else\n authorships_errors = @author.authorships.map{|as| as.errors.full_messages}.join(' ')\n flash[:error] = \"Failed to update Author #{@author.errors.full_messages} #{authorships_errors}\"\n end\n respond_with @author, :success_action => :back\n end",
"def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n flash[:notice] = 'Artist was successfully updated.'\n format.html { redirect_to(@artist) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n flash[:notice] = 'Artist was successfully updated.'\n format.html { redirect_to(@artist) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n if @artist.update_attributes(params[:artist])\n format.html { redirect_to(@artist, :notice => 'Artist was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @author = Author.friendly.find(params[:id])\n\n if @author.update_attributes(author_params)\n redirect_to admin_author_path(@author)\n else\n render action: \"edit\"\n end\n end",
"def update\n @map_author = MapAuthor.find(params[:id])\n\n respond_to do |format|\n if @map_author.update_attributes(params[:map_author])\n format.html { redirect_to([:admin, @map_author], :notice => 'Map author was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @books_author.update(books_author_params)\n format.html { redirect_to @books_author, notice: 'Books author was successfully updated.' }\n format.json { render :show, status: :ok, location: @books_author }\n else\n format.html { render :edit }\n format.json { render json: @books_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n rewriteParams\n @book = Book.find(params[:id])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @blog_author = BlogAuthor.find(params[:id])\n\n respond_to do |format|\n if @blog_author.update_attributes(params[:blog_author])\n format.html { redirect_to blog_authors_path, notice: '執筆者名を変更しました。' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blog_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @publisher.update_attributes(params[:publisher])\n flash[:notice] = 'Publisher was successfully updated.'\n format.html { redirect_to(@publisher) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publisher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @author = Author.find(params[:id])\n @country = Country.find(params[:author][:country_id])\n respond_to do |format|\n if @author.update_attributes(params[:author])\n format.html { redirect_to country_author_path(@country.name,@author), :notice => 'Author was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_author\n @creator = Creator.find(params[:id])\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def put(*args)\n request(:put, *args)\n end",
"def set_author\n @author = Author.find(params[:internet_id])\n end",
"def update\n @atom = Atom.find(params[:id])\n\n respond_to do |format|\n if @atom.update_attributes(params[:atom])\n flash[:notice] = 'Atom was successfully updated.'\n format.html { redirect_to(@atom) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atom.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_update_name_add_author_nondestructive_merge\n old_name = names(:mergeable_epithet_unauthored)\n new_name = names(:mergeable_epithet_authored)\n new_author = new_name.author\n name_count = Name.count\n params = {\n id: old_name.id,\n name: {\n text_name: old_name.text_name,\n author: new_author,\n rank: old_name.rank,\n deprecated: (old_name.deprecated ? \"true\" : \"false\")\n }\n }\n login(old_name.user.login)\n put(:update, params: params)\n\n assert_redirected_to(name_path(new_name.id))\n assert_flash_success\n assert_equal(new_author, new_name.reload.author)\n assert_no_emails\n assert_equal(name_count - 1, Name.count)\n assert_not(Name.exists?(old_name.id))\n end",
"def update\n respond_to do |format|\n if @author.update(allowed_params)\n format.html { redirect_to @author, notice: 'Author was successfully updated.' }\n format.json { render :show, status: :ok, location: @author }\n else\n format.html { render :edit }\n format.json { render json: @author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_author( solr_doc, author_number, authors )\n\n role = solr_doc.at_path( \"mods_0_name_#{author_number}_role_0_text_t[0]\" )\n if role && role.include?( 'author' )\n cid = solr_doc.at_path( \"mods_0_name_#{author_number}_computing_id_t[0]\" )\n fn = solr_doc.at_path( \"mods_0_name_#{author_number}_first_name_t[0]\" )\n ln = solr_doc.at_path( \"mods_0_name_#{author_number}_last_name_t[0]\" )\n dept = solr_doc.at_path( \"mods_0_name_#{author_number}_description_t[0]\" )\n ins = solr_doc.at_path( \"mods_0_name_#{author_number}_institution_t[0]\" )\n\n return add_person( authors, author_number, cid, fn, ln, dept, ins )\n end\n\n # could not find the next author, we are done\n return false, authors\n end",
"def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end",
"def edit\n @author = Author.find(params[:id])\n end",
"def update!(**args)\n @authors = args[:authors] if args.key?(:authors)\n @bib_key = args[:bib_key] if args.key?(:bib_key)\n @confidence = args[:confidence] if args.key?(:confidence)\n @title = args[:title] if args.key?(:title)\n @year = args[:year] if args.key?(:year)\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update\n respond_to do |format|\n if @book_author.update(book_author_params)\n format.html { redirect_to @book_author, notice: 'Book author was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_author }\n else\n format.html { render :edit }\n format.json { render json: @book_author.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @setor = Setor.find(params[:id])\n\n respond_to do |format|\n if @setor.update_attributes(params[:setor])\n format.html { redirect_to(setors_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @setor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # @authorship = Authorship.find(params[:id])\n\n respond_to do |format|\n if @authorship.update(authorship_params)\n flash[:notice] = 'Authorship was successfully updated.'\n format.html { redirect_to(@authorship.book) }\n format.xml { head :ok }\n else\n format.html { render action: 'edit' }\n format.xml { render xml: @authorship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find_by_name(params[:name])\n \n respond_to do |format|\n @role.authorities = Authority.find_by_name(params[:authority_names])\n format.html { redirect_to(my_gem_role_path(@role.name),\n :notice => 'Role was successfully updated.') }\n format.xml { head :ok }\n end\n end",
"def create\n @author = Author.new(params[:author])\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to(@author, :notice => 'Author was successfully created.') }\n format.xml { render :xml => @author, :status => :created, :location => @author }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @author = Author.new(params[:author])\n\n respond_to do |format|\n if @author.save\n format.html { redirect_to(@author, :notice => 'Author was successfully created.') }\n format.xml { render :xml => @author, :status => :created, :location => @author }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @author.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_author\n @author = Author.find(params[:id])\n end",
"def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_author\n @author = Author.friendly.find(params[:id])\n end",
"def update\n @docent = Docent.find(params[:id])\n\n respond_to do |format|\n if @docent.update_attributes(params[:docent])\n format.html { redirect_to(@docent, :notice => 'Docent was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @docent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def author=(author) #setter\n @author = author\n end",
"def authors\n\t#params[:diff] = params[:diff].eql?\"true\"\n \trespond_in_format Marginalia.authors(params[:id],params[:diff])\n end",
"def show\n @author = Author.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @author }\n end\n end"
] |
[
"0.6331983",
"0.62035245",
"0.6054555",
"0.60039806",
"0.5974912",
"0.5966066",
"0.5953054",
"0.5952967",
"0.59294695",
"0.5922155",
"0.5914838",
"0.5844891",
"0.5838828",
"0.5788342",
"0.5779889",
"0.5770354",
"0.5770354",
"0.5770354",
"0.5770354",
"0.5770354",
"0.57546765",
"0.574136",
"0.5731232",
"0.5731232",
"0.57219964",
"0.56744033",
"0.5671747",
"0.5641714",
"0.5580599",
"0.55781555",
"0.5556978",
"0.5551119",
"0.5543186",
"0.55409926",
"0.55409926",
"0.553439",
"0.553439",
"0.553439",
"0.55152094",
"0.5504091",
"0.54916346",
"0.5489547",
"0.54712147",
"0.54455125",
"0.54431784",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5432131",
"0.5428254",
"0.5411802",
"0.539552",
"0.539552",
"0.53903425",
"0.53900206",
"0.53772753",
"0.5376809",
"0.5350001",
"0.5342909",
"0.5342441",
"0.53102607",
"0.53069544",
"0.53057975",
"0.5296398",
"0.52962846",
"0.52873844",
"0.5287195",
"0.5287087",
"0.52778786",
"0.52702415",
"0.5261872",
"0.52557504",
"0.5254652",
"0.5254272",
"0.5254073",
"0.52436465",
"0.5237682",
"0.52360547",
"0.5230496",
"0.52298075",
"0.5227534",
"0.5225364",
"0.5225364",
"0.52199054",
"0.5219208",
"0.52120316",
"0.5210999",
"0.5203257",
"0.52004194",
"0.5198403"
] |
0.63688856
|
1
|
DELETE /authors/1 DELETE /authors/1.xml
|
def destroy
@author = Author.find(params[:id])
@author.destroy
respond_to do |format|
format.html { redirect_to(authors_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n Author.destroy(params[:id])\n redirect_to '/authors'\n end",
"def destroy\n Author.delete(params[:id])\n redirect_to(authors_path)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to authors_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to authors_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url, notice: 'Author was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @authors_book = AuthorsBook.find(params[:id])\n @authors_book.destroy\n\n respond_to do |format|\n format.html { redirect_to authors_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author_repository = AuthorRepository.find(params[:id])\n @author_repository.destroy\n\n respond_to do |format|\n format.html { redirect_to(author_repositories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @references_author.destroy\n respond_to do |format|\n format.html { redirect_to references_authors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n author = Author.find params[:author_id]\n author_name = AuthorName.find params[:id]\n author_name.delete\n # Remove the author if there are no more author names that reference it\n if AuthorName.find_by_author_id(params[:author_id]).nil?\n author.delete\n end\n render json: nil, content_type: 'text/html'\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url, notice: 'Author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url, notice: 'Author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url, notice: 'Author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url, notice: 'Author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url, notice: 'Author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url, notice: 'Author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author.destroy\n respond_to_destroy({thing: @author, redirect: authors_url})\n end",
"def destroy\n author = Author.find params[:author_id]\n author_name = AuthorName.find params[:id]\n author_name.delete\n # Remove the author if there are no more author names that reference it\n unless AuthorName.find_by_author_id params[:author_id]\n author.delete\n end\n render json: nil\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n respond_with(@author)\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find_by_sysname(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @chapter_author.destroy\n respond_to do |format|\n format.html { redirect_to chapter_authors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #remove all the links for this publication\n links = Link.find(:all, :conditions => { :object_type => \"Publication\", :object_id => @publication.id, :predicate => \"link\" })\n links.each do |link|\n link.destroy\n end\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @revision = Revision.find(params[:id])\n @revision.destroy\n\n respond_to do |format|\n format.html { redirect_to(revisions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @author_extra = AuthorExtra.find(params[:id])\n @author_extra.destroy\n\n respond_to do |format|\n format.html { redirect_to author_extras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @authors_book.destroy\n respond_to do |format|\n format.html { redirect_to authors_books_url, notice: 'Authors book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(*uris); end",
"def destroy\n @journal = @book.journals.find(params[:id])\n @journal.destroy\n\n respond_to do |format|\n format.html { redirect_to( @book ) }\n format.xml { head :ok }\n end\n end",
"def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def destroy\n @blog_author = BlogAuthor.find(params[:id])\n @blog_author.destroy\n\n respond_to do |format|\n format.html { redirect_to blog_authors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_author = MapAuthor.find(params[:id])\n @map_author.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_map_authors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @nom = Nom.find(params[:id])\n @nom.destroy\n\n respond_to do |format|\n format.html { redirect_to(noms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n AuthorsBook.where(:book_id => @book.id).each do |ab| # destroy sharing links of this note\n ab.destroy\n end\n\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref = Ref.find(params[:id])\n @ref.destroy\n\n respond_to do |format|\n format.html { redirect_to(refs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @books_author.destroy\n respond_to do |format|\n format.html { redirect_to books_authors_url, notice: 'Books author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to( :action => 'index' ) }\n format.xml { head :ok }\n end\n end",
"def call\n\n #parse the payload to determine which author by the github issue id\n author_issue_id = @payload['issue']['id']\n\n #delete the author (& associated books based on dependency assigned in model)\n @author = Author.find_by issue_id: author_issue_id\n\n if @author.destroy\n return true\n else \n return false\n end\n end",
"def web_dav_delete(*args, &block)\n args = web_dav_args args\n map_method :delete, args, &block\n end",
"def destroy\n respond_to do |format|\n begin\n sql = \"Delete FROM AUTHOR Where id = #{params[:id].to_i}\"\n ActiveRecord::Base.connection.execute(sql)\n @authors = Author.find_by_sql(\"SELECT * FROM AUTHOR\").paginate(:page => params[:page] || 1,:per_page => 20)\n format.html { redirect_to authors_url, notice: 'Author was successfully destroyed.' }\n format.json { head :no_content }\n rescue\n @authors = Author.find_by_sql(\"SELECT * FROM AUTHOR\").paginate(:page => params[:page] || 1,:per_page => 20)\n format.html { redirect_to authors_url, notice: 'Author wasn\\'t destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @paper_author.destroy\n respond_to do |format|\n format.html { redirect_to paper_authors_url, notice: 'Paper author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to(authorships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @document = Document.find(:first, :conditions => [\"id = ?\", params[:id]])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @norma = Norma.find(params[:id])\n @norma.destroy\n\n respond_to do |format|\n format.html { redirect_to(normas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n \t@doc = Doc.find params[:id]\n @doc.destroy\nend",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_publication = StudentPublication.find(params[:id])\n @student_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @primary_publication = PrimaryPublication.find(params[:id])\n @primary_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_publications_url) }\n format.xml { head :ok }\n end\n end",
"def delete(owner_id, name)\n @user.delete([@base_uri, owner_id, name].join(\"/\"))\n end",
"def destroy\n @journalentry = Journalentry.find(params[:id])\n @journalentry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journalentries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @chore = Chore.find(params[:id])\n @chore.destroy\n\n respond_to do |format|\n format.html { redirect_to(chores_path, :notice => 'Chore deleted.') }\n format.xml { head :ok }\n end\n end",
"def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end",
"def destroy\n @book_author.destroy\n respond_to do |format|\n format.html { redirect_to book_authors_url, notice: 'Book author was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documentation = Documentation.find(params[:id])\n @documentation.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to authorships_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @reviewer = Reviewer.find(params[:id])\n @reviewer.destroy\n\n respond_to do |format|\n format.html { redirect_to(reviewers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @journal = Journal.find(params[:id])\n @journal.destroy\n\n respond_to do |format|\n format.html { redirect_to(journals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end",
"def delete(name)\n\n end",
"def destroy\n @tdoc = Tdoc.find(params[:id])\n @tdoc.destroy\n\n respond_to do |format|\n format.html { redirect_to(tdocs_url) }\n format.xml { head :ok }\n end\n end",
"def delete(name); end",
"def delete(name); end",
"def destroy\n @publication.destroy\n head :no_content\n end",
"def destroy\n @researcher = Researcher.find(params[:id])\n @researcher.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n@article = current_user.articles.find(params[:id])\n@article.destroy\nrespond_to do |format|\nformat.html { redirect_to(articles_url) }\nformat.xml { head :ok }\nend\nend",
"def destroy\n @name = Name.find(params[:id])\n @name.destroy\n\n respond_to do |format|\n format.html { redirect_to(names_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.686459",
"0.68583137",
"0.6798691",
"0.6657785",
"0.6657785",
"0.6614151",
"0.6614151",
"0.65511936",
"0.65001845",
"0.6499806",
"0.6468818",
"0.64463925",
"0.64429945",
"0.64429945",
"0.64429945",
"0.64429945",
"0.64429945",
"0.64429945",
"0.6419601",
"0.6416993",
"0.640376",
"0.6390183",
"0.6358018",
"0.6347181",
"0.6347181",
"0.6343585",
"0.6342705",
"0.63357985",
"0.6328118",
"0.6315181",
"0.63098896",
"0.63056904",
"0.6305592",
"0.62624836",
"0.6260681",
"0.6226047",
"0.62246376",
"0.6222605",
"0.6205751",
"0.61835086",
"0.6179891",
"0.6177532",
"0.61761934",
"0.61754894",
"0.6174509",
"0.6168725",
"0.61417675",
"0.6140207",
"0.61397636",
"0.61361897",
"0.6134625",
"0.6133551",
"0.6133551",
"0.6133551",
"0.6133551",
"0.6133551",
"0.6133551",
"0.6133551",
"0.6133551",
"0.61333674",
"0.6130719",
"0.6130589",
"0.61281115",
"0.6122312",
"0.6120622",
"0.6116817",
"0.6111133",
"0.6108414",
"0.6107431",
"0.61071754",
"0.61055756",
"0.61055756",
"0.61048913",
"0.61044145",
"0.6099394",
"0.6097355",
"0.60941464",
"0.609414",
"0.6093518",
"0.6093518",
"0.60899866",
"0.6089913",
"0.60799277",
"0.6073328",
"0.6073328",
"0.6073328",
"0.607293",
"0.6072033",
"0.6071474",
"0.6071474",
"0.6069784",
"0.6054565",
"0.6051753",
"0.60499173",
"0.604847",
"0.604847",
"0.604847",
"0.604847",
"0.604847"
] |
0.7327123
|
1
|
This method validates all the selected and is responsible for calling invalid/valid events
|
def valid?
result = true
selected.each do |view|
view.rmq_data.validations.each do |validation|
has_events = view.rmq_data.events
if validation.valid?(rmq(view).data)
if has_events && view.rmq_data.events.has_event?(:valid)
view.rmq_data.events[:valid].fire!
end
else
if has_events && view.rmq_data.events.has_event?(:invalid)
view.rmq_data.events[:invalid].fire!
end
result = false
end
end
end
return result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:vessel_code => self.vessel_code}],self)\n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_vessel\n\t end\nend",
"def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end",
"def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end",
"def validate\n # first check whether combo fields have been selected\n is_valid = true\n end",
"def validate!\n # Require that at least one field exist.\n if fields.length == 0\n raise SkyDB::Query::ValidationError.new(\"At least one selection field is required for #{self.inspect}.\")\n end\n\n fields.each do |field|\n field.validate!\n end\n\n groups.each do |group|\n group.validate!\n end\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rule_code => self.rule_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rule\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t \n\t if is_valid\n\t is_valid = set_drench_concentrate_status\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:drench_line_type_code => self.drench_line_type_code}],self) \n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = set_drench_station\n#\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:concentrate_code => self.concentrate_code}],self) \n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = set_concentrate_product\n#\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:port_id => self.port_id}],self,nil,true)\n set_port if is_valid\n end\n\n\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:voyage_port_type_id => self.voyage_port_type_id}],self,nil,true)\n \n\n\t\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t #is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t #is_valid = set_spray_program_result\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:mark_code => self.mark_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_mark\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n #\tfirst check whether combo fields have been selected\n is_valid = true\n if is_valid\n is_valid = ModelHelper::Validations.validate_combos([{:qc_test_id => self.qc_test_id}],self) \n end\n # #now check whether fk combos combine to form valid foreign keys\n # if is_valid\n # is_valid = set_qc_test\n # end\n # if is_valid\n # is_valid = ModelHelper::Validations.validate_combos([{:qc_inspection_type_code => self.qc_inspection_type_code}],self) \n # end\n # #now check whether fk combos combine to form valid foreign keys\n # if is_valid\n # is_valid = set_qc_inspection_type\n # end\n end",
"def validate\n\t#first check whether combo fields have been selected\n\t is_valid = true\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:farm_code => self.farm_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rmt_variety_code => self.rmt_variety_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pack_material_product_code => self.pack_material_product_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code}],self)\n\t end\n\n\t #now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_farm\n\t end\n\n\t if is_valid\n\t\t is_valid = set_rmt_variety\n\t end\n\n\t if is_valid\n\t\t is_valid = set_pack_material_product\n\t end\n\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n\n\t#validates uniqueness for this record\n#\t if self.new_record? && is_valid\n#\t\t validate_uniqueness\n#\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:temperature_device_type_code => self.temperature_device_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_temperature_device_type\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:unit_type_code => self.unit_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_unit_type\n\t end\nend",
"def validate \n # first check whether combo fields have been selected\n#\t is_valid = true\n#\t if is_valid\n#\t is_valid = ModelHelper::Validations.validate_combos([{:stock_type_code => self.stock_type_code}],self)\n#\t end\n#\t if is_valid\n#\t is_valid = set_stock_type\n#\t end\n#\n#\t if is_valid\n#\t is_valid = ModelHelper::Validations.validate_combos([{:location_code => self.location_code}],self)\n#\t end\n#\t if is_valid\n#\t is_valid = set_location\n#\t end\n#\n#\t #if is_valid\n#\t # is_valid = ModelHelper::Validations.validate_combos([{:party_name => self.party_name}],self)\n#\t #end\n#\t #if is_valid\n#\t # is_valid = set_party\n#\t #end\n#\n#\t if is_valid\n#\t is_valid = set_parties_role\n#\t end\n#\n#\t #if is_valid\n#\t # is_valid = set_current_location\n#\t #end\n#\n# if is_valid\n# is_valid = set_status\n# end\n\t \n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:report_type_code => self.report_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_report_type\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rails_error\n\t end\nend",
"def validate_event_selection\n\t\tunless self.event\n\t\t\tself.errors.add(:event, 'must be chosen.')\n\t\tend\n\tend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_group_code => self.commodity_group_code},{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code},{:marketing_variety_code => self.marketing_variety_code}],self)\n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code},{:marketing_variety_code => self.marketing_variety_code}],self)\n#\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_variety\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self)\n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code},{:commodity_code => self.commodity_code}],self)\n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:track_indicator_type_code => self.track_indicator_type_code}],self)\n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_track_indicator_type\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\n\n\t puts \"VALID: \" + is_valid.to_s\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:system_name => self.system_name},{:subsystem_name => self.subsystem_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_subsystem\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:affected_object_type_name => self.affected_object_type_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_affected_object_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pack_material_product_code => self.pack_material_product_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_pack_material_product\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n if(self.rmt_product_type_code.to_s.upcase == \"PRESORT\")\n self.treatment_type_code = \"PRESORT\"\n elsif self.rmt_product_type_code == \"orchard_run\"\n self.product_class_code = \"OR\"\n self.treatment_type_code = \"PRE_HARVEST\"\n else\n self.treatment_type_code = \"PACKHOUSE\"\n end\n\n #self.size_code = \"UNS\" if !self.size_code\n if !self.size_code\n self.size_code = \"UNS\" \n\t self.size_id = Size.find_by_size_code(self.size_code).id\t\t \n end\n \n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:ripe_point_code => self.ripe_point_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_ripe_point\n\t end\n\t \n\t\n\tif is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:size_code => self.size_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = set_size\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:product_class_code => self.product_class_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_product_class\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_group_code => self.commodity_group_code},{:commodity_code => self.commodity_code},{:variety_code => self.variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_code => self.treatment_code}],self) \n\tend\n\t\n\tif is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:bin_type => self.bin_type}],self) \n\tend\n\t\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rmt_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:farm_group_code => self.farm_group_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_farm_group\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name},{:role_name => self.role_name},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_parties_role\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n\t \n\tif is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:equivalent_count_from => self.equivalent_count_from}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_equivalent_count_from\n\t end\n\t \n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:equivalent_count_to => self.equivalent_count_to}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_equivalent_count_to\n\t end\n\t \n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_type_code => self.treatment_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:account_code => self.account_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_account\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name},{:role_name => self.role_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_parties_role\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:postal_address_type_code => self.postal_address_type_code},{:city => self.city},{:address1 => self.address1}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_postal_address\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_party\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \nputs \"in IPC validate\"\n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\n ModelHelper::Validations.validate_combos([{:size_ref => self.size_ref}],self,true)\n self.size_ref = \"NOS\" if !self.size_ref\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:product_class_code => self.product_class_code}],self)\n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_product_class\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:grade_code => self.grade_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_grade\n\t end\n\t \n\tif is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_code => self.treatment_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_group_code => self.commodity_group_code},{:commodity_code => self.commodity_code},{:marketing_variety_code => self.marketing_variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_marketing_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:cosmetic_code => self.cosmetic_code_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_cosmetic_code\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:basic_pack_code => self.basic_pack_code},{:standard_size_count_value => self.standard_size_count_value}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_standard_size_count\n\t end\n\t \n\t if !self.size_ref\n\t self.size_ref = \"NOS\"\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\n\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:puc_type_code => self.puc_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_puc_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:carton_pack_product_code => self.carton_pack_product_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_carton_pack_product\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pallet_format_product_code => self.pallet_format_product_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_pallet_format_product\n\t end\n\t \n\t if is_valid\n\t self.cpp_code = self.pallet_format_product_code + \"_\" + self.carton_pack_product_code + \"_\" + self.cartons_per_pallet.to_s \n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:artist_name => self.artist_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_artist\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate_eligibility_checker\n # there are 4 eligibility checkers which are mandatory to select\n # @eligibility_checkers array contains selected option this arrays 0th element is always nil\n errors.add(:eligibility_checkers, :accepted) unless @eligibility_checkers.length == 5\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:contact_method_type_code => self.contact_method_type_code},{:contact_method_code => self.contact_method_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_contact_method\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_party\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate_all\n validate\n items.each do |item|\n definition.validate_item item\n end\n definition.validate_columns items\n end",
"def validate\n is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:system_name => self.system_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_system\n\t end\n \n end",
"def validate\n errors = {}\n\n @items.each_with_index do |item, idx|\n begin\n item.validate\n rescue => error\n errors[idx+1] = error\n end\n end\n\n if !errors.empty?\n raise ValidationError.new(_(\"Validation failed for '%{name}' settings list\") % {name: @name}, :errors => errors)\n end\n end",
"def validate\r\n\r\n end",
"def validate!\n if identifier.to_s.empty?\n raise ValidationError.new(\"identifier is required\")\n else\n [image_changes.created,\n image_changes.updated,\n unit_changes.created,\n unit_changes.updated].each do |collection|\n collection.each(&:validate!)\n end\n\n true\n end\n end",
"def validations\n options_to_validations(@options)\n end",
"def valid_options\n valid = true\n has_one_checked = false\n #logger.debug \"Q#{self.id} OV: #{self.id}: #{self.options ? self.options.size : nil}, #{self._options ? self._options.size : nil}, #{self.json_options ? self.json_options.size : nil}\"\n \n self.options.each do |option|\n valid = false if option.invalid?\n has_one_checked = true if option.correct?\n end\n \n errors.add(:options, 'Question must have at least 1 option!') if self.options.empty?\n errors.add(:options, 'Question must have at least 1 correct option!') if !self.options.empty? && !has_one_checked\n errors.add(:options, 'All must have text!') if !valid\n \n #logger.debug \" ERROR #{errors.full_messages}\"\n end",
"def selected_options; end",
"def selected_options; end",
"def validate\n # add errors if not validate\n end",
"def validate\n end",
"def store_validations #:nodoc:\n return if @validations.size == 0\n\n @validations.each do |param|\n store_dv(\n param[:cells],\n param[:validate],\n param[:criteria],\n param[:value],\n param[:maximum],\n param[:input_title],\n param[:input_message],\n param[:error_title],\n param[:error_message],\n param[:error_type],\n param[:ignore_blank],\n param[:dropdown],\n param[:show_input],\n param[:show_error]\n )\n end\n end",
"def validate!\n # Set @error_text if the options are not valid\n end",
"def valid!\n super\n valid_entities!\n valid_action_instances!\n entities.each(&:valid!)\n action_instances.each(&:valid!)\n end",
"def validate_event_complete(_options = {})\n # 0: user has never saved this thus when baptized_at_home_parish will not show yes or no as selected\n # 1: user has saved a selection for baptized_at_home_parish\n # if baptized_at_home_parish == true then done\n # if baptized_at_home_parish == false then baptized_catholic will not show yes or no as selected\n # 2: User has chosen baptized_catholic(true or false)\n case show_empty_radio\n when 0\n errors.add(:base, I18n.t('messages.error.baptized_should_be_checked', home_parish: Visitor.home_parish))\n false\n when 1\n basic_valid = validate_basic_info\n church_info = validate_other_church_info\n return basic_valid && church_info if baptized_at_home_parish\n\n errors.add(:base, I18n.t('messages.error.baptized_catholic_should_be_checked'))\n\n false\n when 2\n basic_valid = validate_basic_info\n church_info = validate_other_church_info\n\n if baptized_catholic\n church_info && basic_valid\n else\n validate_profession_of_faith && church_info && basic_valid\n end\n else\n raise(I18n.t('messages.error.unknown_show_empty_radio', show_empty_radio: show_empty_radio))\n end\n end",
"def extra_validations\n success\n end",
"def validate\n\t\tself.options.validate(self.datastore)\n\tend",
"def validate_choice\n return if errors.present?\n\n return if %i[not_required all_day].include? service_choice.to_sym\n\n validate_numbers\n validate_number_ranges\n return if errors.present?\n\n validate_time_sequence\n end",
"def validate\n ModelHelper::Validations.validate_combos([{:grade_code => self.grade_code}],self,true) \n \n end",
"def validate_attributes\n if male_index_changed? && !for_male?\n self.remove_male_icon! if self.male_icon\n self.remove_male_camera_background! if self.male_camera_background\n end\n if female_index_changed? && !for_female?\n self.remove_female_icon! if self.female_icon\n self.remove_female_camera_background! if self.female_camera_background\n end\n self.male_icon_background_color = '#' + male_icon_background_color if male_icon_background_color.present? && !male_icon_background_color.starts_with?('#')\n self.female_icon_background_color = '#' + female_icon_background_color if female_icon_background_color.present? && !female_icon_background_color.starts_with?('#')\n end",
"def verify_selection(user_input)\n VALID_SELECTIONS.include?(user_input)\nend",
"def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end",
"def validate(_options = 0)\n []\n end",
"def valid?\n super\n if attendee.valid?\n validate_mandatory_plan_cats(selected_plans)\n validate_single_plan_categories(selected_plans)\n validate_disabled_plans(persisted_plan_selections, selected_plans)\n validate_models(selected_attendee_plans)\n validate_activities\n else\n merge_errors(attendee.errors)\n end\n @errors.empty?\n end",
"def validate_options; end",
"def validate(options); end",
"def run_validations\n true\n end",
"def validate\n \n \n end",
"def valid; end",
"def validate\n errors.add_to_base \"Enter atleast one product\" if items.empty?\n end",
"def rex_validate(*selected_fields)\n include Rexval::Models::Validatable\n options = selected_fields.extract_options!.dup\n \n selected_fields.map(&:to_sym).uniq.each do |fld|\n validates fld, :regexp => true\n end\n \n selected_modules = [].map(&:to_sym).uniq.sort_by do |s|\n Rexval::ALL.index(s) || -1\n end\n \n rexval_modules_hook! do\n selected_modules.each do |m|\n mod = Rexval::Models.const_get(m.to_s.classify)\n \n if mod.const_defined?(\"ClassMethods\")\n class_mod = mod.const_get(\"ClassMethods\")\n extend class_mod\n \n if class_mod.respond_to?(:available_configs)\n available_configs = class_mod.available_configs\n available_configs.each do |config|\n next unless options.key?(config) \n send(:\"#{config}=\", options.delete(config))\n end\n end\n end\n \n include mod\n end\n \n self.rexval_modules |= selected_modules\n self.rexval_fields |= selected_fields\n \n Rexval::FIELDS[self.model_name.i18n_key] = self.rexval_fields\n \n options.each { |key, value| send(:\"#{key}=\", value) }\n end\n end",
"def validation; end",
"def validation; end",
"def validate_line_items\n \n end",
"def occurrence_select\n if self.category.eql?('appointment')\n unless self.repeat.blank?\n if (self.occurrence_type)\n self.errors.add(' ', 'Select End by date') if (self.occurrence_type.eql?(\"until\") and self.until.blank?)\n self.errors.add(' ', 'Select End after count') if (self.occurrence_type.eql?(\"count\") and self.count.blank?)\n end\n end\n end\n end",
"def selected?; false; end",
"def selected?; false; end",
"def valid_sets; end",
"def valid_options\n selected_options.grep_v(/\\Agroup_/)\n end",
"def selected; end",
"def valid?\n return false if @name.nil?\n return false if @value.nil?\n return false if @timestamp.nil?\n return false if @source_id.nil?\n return false if @source_label.nil?\n return false if @source.nil?\n source_validator = EnumAttributeValidator.new('String', [\"IMPORT\", \"API\", \"FORM\", \"ANALYTICS\", \"MIGRATION\", \"SALESFORCE\", \"INTEGRATION\", \"CONTACTS_WEB\", \"WAL_INCREMENTAL\", \"TASK\", \"EMAIL\", \"WORKFLOWS\", \"CALCULATED\", \"SOCIAL\", \"BATCH_UPDATE\", \"SIGNALS\", \"BIDEN\", \"DEFAULT\", \"COMPANIES\", \"DEALS\", \"ASSISTS\", \"PRESENTATIONS\", \"TALLY\", \"SIDEKICK\", \"CRM_UI\", \"MERGE_CONTACTS\", \"PORTAL_USER_ASSOCIATOR\", \"INTEGRATIONS_PLATFORM\", \"BCC_TO_CRM\", \"FORWARD_TO_CRM\", \"ENGAGEMENTS\", \"SALES\", \"HEISENBERG\", \"LEADIN\", \"GMAIL_INTEGRATION\", \"ACADEMY\", \"SALES_MESSAGES\", \"AVATARS_SERVICE\", \"MERGE_COMPANIES\", \"SEQUENCES\", \"COMPANY_FAMILIES\", \"MOBILE_IOS\", \"MOBILE_ANDROID\", \"CONTACTS\", \"ASSOCIATIONS\", \"EXTENSION\", \"SUCCESS\", \"BOT\", \"INTEGRATIONS_SYNC\", \"AUTOMATION_PLATFORM\", \"CONVERSATIONS\", \"EMAIL_INTEGRATION\", \"CONTENT_MEMBERSHIP\", \"QUOTES\", \"BET_ASSIGNMENT\", \"QUOTAS\", \"BET_CRM_CONNECTOR\", \"MEETINGS\", \"MERGE_OBJECTS\", \"RECYCLING_BIN\", \"ADS\", \"AI_GROUP\", \"COMMUNICATOR\", \"SETTINGS\", \"PROPERTY_SETTINGS\", \"PIPELINE_SETTINGS\", \"COMPANY_INSIGHTS\", \"BEHAVIORAL_EVENTS\", \"PAYMENTS\", \"GOALS\", \"PORTAL_OBJECT_SYNC\", \"APPROVALS\", \"FILE_MANAGER\", \"MARKETPLACE\", \"INTERNAL_PROCESSING\", \"FORECASTING\", \"SLACK_INTEGRATION\", \"CRM_UI_BULK_ACTION\", \"WORKFLOW_CONTACT_DELETE_ACTION\"])\n return false unless source_validator.valid?(@source)\n return false if @selected_by_user.nil?\n return false if @selected_by_user_timestamp.nil?\n return false if @source_vid.nil?\n return false if @source_metadata.nil?\n return false if @request_id.nil?\n true\n end",
"def validate\r\n @invalid=false\r\n end",
"def validate\n super \n end",
"def selected\r\n assert_exists\r\n #@option.selected\r\n option_selected\r\n end",
"def validations\n {}\n end",
"def validate\n return nil unless internal_subset\n\n internal_subset.validate(self)\n end",
"def validate!\n # Expression must be present.\n if expression.to_s.length == 0\n raise SkyDB::Query::ValidationError.new(\"Invalid expression for selection group: '#{expression.to_s}'\")\n end\n end",
"def validations\n []\n end",
"def validated; end",
"def validate\n is_valid = true\n\n if is_valid\n is_valid = ModelHelper::Validations.validate_combos([{:order_type_id => self.order_type_id}], self)\n end\n if is_valid\n is_valid = ModelHelper::Validations.validate_combos([{:trading_partner_party_role_id => self.trading_partner_party_role_id}], self)\n end\n\n if is_valid\n is_valid = ModelHelper::Validations.validate_combos([{:customer_party_role_id => self.customer_party_role_id}], self)\n end\n end",
"def selected?; end",
"def selected?; end",
"def valid_selection?\n @selections.include?(@input)\n end",
"def validate!\n super()\n self\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate_values\n @days_format = OpenOrder.get_select_values\n @search_by_values = OpenOrder.get_search_values\n #checking whether search for(textbox) value is empty string and search by(select box) value is other than \"all\"\n if params[:search_for].blank? && params[:search_by] != \"all\"\n flash.now[:alert] = I18n.translate(\"error\",:scope => \"open_orders.validate_values\")\n render :index\n end\n #End of checking whether search for(textbox) value is empty string and search by(select box) value is other than \"all\"\n end",
"def validate_booking_options!(opts)\n self.class.validate_booking_options!(opts)\n end",
"def check_for_selected\n if changes[:selected] && self.selected == true\n BetaMailer.send_beta_acceptance_email(self).deliver_later\n end\n end",
"def check_invariants\n validEvent = true\n\n # This block checks if the start and end times are empty\n if :start_time_date.empty? or :end_time_date.empty?\n errors.add :start_time, \"should be added.\"\n validEvent = false\n end\n \n # This block checks if the number of categories is > 2\n if !categories.nil? and categories.split(',').size > 2\n errors.add :categories, \"section should only have one or two categories selected.\"\n validEvent = false\n end\n\n # This block checks if the start time is greater than the end time\n# #if (Time.strptime(self.start_time, \"%Y-%d-%m %H:%M\") > Time.strptime(self.end_time, \"%Y-%d-%m %H:%M\")) \n# if (self.start_time > self.end_time)\n# errors.add :start_time, \"should be before the end time.\"\n# validEvent = false\n# end\n\n # This block checks if the name field exists\n if (self.name.nil?)\n errors.add :name, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the description field exists\n if (self.description.nil?)\n errors.add :description, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the location field exists\n if (self.location.nil?)\n errors.add :location, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the approval_rating field exists\n if (self.approval_rating.nil?)\n errors.add :approval_rating, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_start field exists\n if (self.event_start.nil?)\n errors.add :event_start, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_end field exists\n if (self.event_end.nil?)\n errors.add :event_end, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if there are any duplicate events when submitting a new event\n if(self.id == nil) \n if (Event.exists?(:location => self.location, :start_time => self.start_time, :end_time => self.end_time))\n errors.add :location, \"invalid: Cannot be a duplicate event.\"\n validEvent = false\n end\n else\n if (Event.where(\"location = ? AND start_time = ? AND end_time = ? AND NOT id = ?\", self.location, self.start_time, self.end_time, self.id).length >= 1)\n errors.add :location, \"invalid: Created a duplicate event via editing\"\n end\n end\n\n # This block checks to make sure that the organization\n # matches the specified user\n if !can_modify?(self.user)\n errors.add :organization, \"should be one that you are a member of\"\n validEvent = false\n end\n\n return validEvent\n end",
"def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end",
"def valid_options\n @@valid_options\n end"
] |
[
"0.7187285",
"0.715672",
"0.715672",
"0.7142176",
"0.68905145",
"0.684564",
"0.67118716",
"0.6701096",
"0.66997075",
"0.667705",
"0.6636022",
"0.6634045",
"0.6623421",
"0.66059524",
"0.65937626",
"0.65416104",
"0.6540964",
"0.6517969",
"0.65076065",
"0.64507526",
"0.6403189",
"0.6374066",
"0.6370473",
"0.6357198",
"0.63241184",
"0.63178694",
"0.6187613",
"0.6150344",
"0.613058",
"0.61002594",
"0.60998887",
"0.6040059",
"0.60119724",
"0.60098463",
"0.6005975",
"0.59833074",
"0.5956645",
"0.5825873",
"0.57785106",
"0.57734597",
"0.576267",
"0.5730758",
"0.5682302",
"0.5662367",
"0.5662367",
"0.56544745",
"0.56487787",
"0.5646326",
"0.563485",
"0.56280124",
"0.56181264",
"0.5600756",
"0.55961484",
"0.5589259",
"0.55884707",
"0.55557936",
"0.5552089",
"0.554613",
"0.553101",
"0.5522555",
"0.5517877",
"0.5506784",
"0.5505808",
"0.5495211",
"0.5492805",
"0.54839754",
"0.54627675",
"0.54590106",
"0.54590106",
"0.5450076",
"0.543704",
"0.5437",
"0.5437",
"0.5421498",
"0.5417955",
"0.54085195",
"0.53889745",
"0.538255",
"0.53803",
"0.5380047",
"0.53779143",
"0.5371137",
"0.53546315",
"0.5353869",
"0.5340904",
"0.534027",
"0.5314525",
"0.5314525",
"0.5306452",
"0.52942663",
"0.52875704",
"0.52875704",
"0.52875704",
"0.52875704",
"0.52866095",
"0.5282387",
"0.52822226",
"0.5280863",
"0.52712",
"0.52554"
] |
0.55726856
|
55
|
this method shortcuts specific validation rules. As such it should only be added to for universal validation needs. It must be kept as efficient as possible.
|
def universal_validation_checks (data, options={})
# shortcircuit if debugging
return true if RubyMotionQuery::RMQ.debugging?
# allow blank data if specified
return true if (options[:allow_blank] && (data.nil? || data.empty?))
# allow whitelist data if specified
return true if (options[:white_list] && options[:white_list].include?(data))
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def subclass_validations ; true ; end",
"def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end",
"def validation; end",
"def validation; end",
"def validations\n [:line_style_names] + super\n end",
"def validator; end",
"def validate\n validate_required_attributes\n Position.validate_order_type_constraints attributes\n validate_trailing_stop_constraints\n validate_stop_and_limit_constraints\n validate_guaranteed_stop_constraints\n end",
"def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end",
"def validation_rules\n []\n end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def setting_validations\n errors.add(:value, I18n.t(:blank, :scope => 'activerecord.errors.messages')) if validators['presence'] && ['1','true',true].include?(validators['presence']) && self.value.nil?\n errors.add(:value, I18n.t(:inclusion, :scope => 'activerecord.errors.messages')) if valid_values && !valid_values.include?(self.value)\n errors.add(:value, I18n.t(:invalid, :scope => 'activerecord.errors.messages')) if validators['format'] && !(Regexp.new(validators['format']) =~ self.value)\n end",
"def extra_validations\n success\n end",
"def validate\n super \n end",
"def validate\n self.class.validations.each do |(method, args, opts)|\n send(method, *args) if !opts[:if] || instance_exec(&opts[:if])\n end\n end",
"def validate\n begin\n validatable_rules.map{ |k, v| self.send(\"validate_\" + k.to_s) }\n rescue Errors::ValidationError => e\n raise decorate_error e\n end\n end",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def apply_validations!\n if not_nullable? && (! skip_not_nullable_validation_due_to_type?)\n flex_column_class.validates field_name, :presence => true\n end\n\n if options.has_key?(:enum)\n values = options[:enum]\n unless values.kind_of?(Array)\n raise ArgumentError, \"Must specify an Array of possible values, not: #{options[:enum].inspect}\"\n end\n\n flex_column_class.validates field_name, :inclusion => { :in => values }\n end\n\n if options.has_key?(:limit)\n limit = options[:limit]\n raise ArgumentError, \"Limit must be > 0, not: #{limit.inspect}\" unless limit.kind_of?(Integer) && limit > 0\n\n flex_column_class.validates field_name, :length => { :maximum => limit }\n end\n end",
"def setting_validations\n if errors.empty?\n errors.add(:value, :blank) if validators['presence'] && ['1','true',true].include?(validators['presence']) && self.value.nil?\n errors.add(:value, :inclusion) if valid_values && !valid_values.include?(self.value)\n errors.add(:value, :invalid) if validators['format'] && !(Regexp.new(validators['format']) =~ self.value)\n end\n end",
"def validate\n errors.add_to_base(\"Your Volume is to long, can only store 4 characters!\") if self.volume.to_s.length > 4\n errors.add_to_base(\"Your Number is to long, can only store 3 characters!\")if self.number.to_s.length > 3\n errors.add_to_base(\"Your Semester is to long, can only store 6 characters!\")if self.semester.to_s.length > 6\n end",
"def validate\n super\n end",
"def validator=(_); end",
"def validate\n fail 'sub class to implement'\n end",
"def run_validations!\n run_callbacks(:validation) do\n super\n end\n end",
"def validate\n # add errors if not validate\n end",
"def validate(options); end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end",
"def validate()\n\t\trules.values.each do |aRule|\n\t\t\tsubrule_invokations = aRule.all_actions.select { |act| act.kind_of?(ApplySubrule) }\n\t\t\tsubrule_invokations.each do |invokation|\n\t\t\t\traise LexerRuleError, \"Reference to unknown subrule '#{invokation.rulename}' in rule '#{aRule.name}'.\" unless rules.has_key? invokation.rulename\n\t\t\tend\n\t\tend\n\tend",
"def validate\n \n \n end",
"def validate( _x )\n #TODO: cover common type-based validations?\n #TODO: Offer validation objects?\n raise InternalError.new( \"#{self.class}.validate() not implemented!\" )\n end",
"def determine_useful_validations\n useful_checks = [\n useful_validations_for_qrda_type,\n useful_validations_for_measure_type\n # TODO: Add useful_validations_for_performance_rate\n ]\n useful_checks.inject(:&)\n end",
"def apply_validations_for_text\n apply_validations_for_string\n end",
"def add_rule(opts)\n opts = check_params(opts,[:rules])\n super(opts)\n end",
"def rule\n super\n end",
"def rule\n super\n end",
"def validate!\n validate_patches!\n validate_new_branch_name! if new_branch?\n validate_permissions!\n end",
"def validate\n end",
"def validate\n errors.add(:post_office, \"- must be filled for postalcode #{self.postal_code}\") if self.post_office.blank? && !self.postal_code.blank?\n errors.add(:postal_code, \"- must be filled for #{self.post_office}\") if self.postal_code.blank? && !self.post_office.blank? \n errors.add_to_base(\"- Person must have at least one phonenumber\") if (self.phone_home.blank? && self.phone_cell.blank? && self.phone_work.blank?) \n end",
"def validate\n errors.add_to_base('password', 'and confirmation do not match') unless password_confirmation == password\n errors.add_to_base(\"Your User ID is to long, can only store 4 characters!\") if self.userId.to_s.length > 4\n errors.add_to_base(\"Your User Name is to long, can only store 50 characters!\")if self.userName.to_s.length > 50\n errors.add_to_base(\"Your First Name is to long, can only store 50 characters!\")if self.firstName.to_s.length > 50\n errors.add_to_base(\"Your Last Name is to long, can only store 50 characters!\")if self.lastName.to_s.length > 50\n errors.add_to_base(\"Your Title is to long, can only store 50 characters!\") if self.title.to_s.length > 50\n errors.add_to_base(\"Your Photo is to long, can only store 50 characters!\") if self.photo.to_s.length > 50\n errors.add_to_base(\"Your Email is to long, can only store 30 characters!\") if self.email.to_s.length > 30\n errors.add_to_base(\"Your Byline ID is to long, can only store 11 characters!\") if self.bylineID.to_s.length > 11\n end",
"def _before_validation\n end",
"def validate(validator, *args); validation_chain.validate(validator, *args); end",
"def validate\r\n\r\n end",
"def validations\n {}\n end",
"def literal_validation; end",
"def literal_validation; end",
"def validate\n\n end",
"def set_rule(opts)\n opts = check_params(opts,[:rules])\n super(opts)\n end",
"def validations\n options_to_validations(@options)\n end",
"def validate\n validations = self.class.meta_eval { @validations }\n\n validations.each do |v|\n raise \"#{self.class}.#{v[:name]} #{v[:options][:message]}\" unless\n v[:proc].call(send(v[:name]))\n end\n\n self\n end",
"def check_constraints\n case self.recordable\n when ExtractionsExtractionFormsProjectsSectionsQuestionRowColumnField\n case self.recordable.question_row_column_field.question_row_column.question_row_column_type.name\n when 'text'\n min_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_length).to_i\n max_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_length).to_i\n if self.persisted? && self.name.length > 0 && (self.name.length < min_length || self.name.length > max_length)\n errors.add(:length, \"must be between #{ min_length.to_s } and #{ max_length.to_s }\")\n end\n when 'numeric'\n # First check that we aren't trying to validate any of the ~, <, >, ≤, ≥ special characters.\n if self.recordable.question_row_column_field.question_row_column.question_row_column_fields.second == self.recordable.question_row_column_field\n unless (self.name =~ /\\A[-+]?[0-9]*\\.?[0-9]+\\z/) || self.name != ''\n errors.add(:value, 'Must be numeric')\n end\n\n min_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_value).to_i\n max_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_value).to_i\n if self.persisted? && (self.name.to_i < min_value || self.name.to_i > max_value)\n errors.add(:value, \"must be numeric and between #{ min_value.to_s } and #{ max_value.to_s }\")\n end\n end\n end\n end\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n validator_class.new(self).validate\n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def validate!\n super()\n self\n end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def rules; end",
"def validate( _x )\n msg = 'ERROR: Item.validate() not implemented!'\n msg += \"\\nTODO: cover common type-based validations?\"\n msg += \"\\nTODO: Offer validation objects?\"\n fail msg\n end",
"def validate!\n self.class.validators.each do |validator|\n validator.validate!(self)\n end\n nil\n end",
"def pre_validation\n\n end",
"def pre_validation\n\n\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end",
"def validate_shape\n base.validate\n base.errors.collect{|error|\n errors.add_to_base(error.show_message)\n }\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end",
"def set_validations_and_filters\n validates_length_of :numero_publicacion, :in => 6..12, :allow_nil => true, :allow_blank => true\n validates_presence_of :fecha_solicitud, :numero_gaceta\n validates_format_of :numero_solicitud, :with => /^\\d+-\\d{4}/\n validates_uniqueness_of :numero_solicitud#, :scope => :parent_id\n #validates_presence_of :numero_publicacion, :numero_gaceta\n end",
"def saint_saens; end",
"def add_validation_errors(value); end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n if self.start_date.present? && self.due_date.present?\n errors.add_to_base :start_date_cant_be_after_due_date if self.start_date > self.due_date\n # errors.add_to_base :start_date_cant_be_after_due_date if self.start_date > self.due_date\n # errors.add_to_base :end_date_cant_be_after_due_date if self.end_date > self.due_date\n if self.financial_year_id == '0'\n if (FinancialYear.last(:conditions => [\"start_date BETWEEN ? AND ? OR end_date BETWEEN ? AND ?\",\n self.start_date, self.due_date, self.start_date, self.due_date])).present?\n\n end\n self.financial_year_id = nil\n elsif self.financial_year_id.present?\n fy = FinancialYear.find_by_id(self.financial_year_id)\n errors.add_to_base :financial_year_must_be_set unless fy.present?\n errors.add_to_base :date_range_must_be_within_financial_year if fy.present? and\n !(self.start_date >= fy.try(:start_date) && self.due_date <= fy.try(:end_date))\n else\n # errors.add_to_base :financial_year_must_be_set\n end\n else\n\n end\n end",
"def validate!\n # pass\n end",
"def validate\n each_field_with_value do |key, field, value|\n field.validate(value)\n end\n self\n end",
"def apply_validations_for_timestamp\n apply_validations_for_datetime\n end",
"def validation min, max\n\n end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def is_valid; end",
"def validated?; end",
"def validate!\n validate_redis\n validate_workers\n validate_options\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end",
"def apply_validations_for_decimal\n apply_validations_for_float\n end",
"def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rule_code => self.rule_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rule\n\t end\nend",
"def validate\n validate_summary\n validate_duration\n validate_kind\n validate_state\n validate_created_at\n\n super\n end",
"def supports_validate_constraints?\n false\n end",
"def supports_validate_constraints?\n false\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', ['string', 'number', 'boolean', 'date', 'address', 'country', 'email', 'url', 'image', 'signature', 'barcode', 'combined'])\n return false unless type_validator.valid?(@type)\n image_gravity_validator = EnumAttributeValidator.new('String', ['NorthWest', 'North', 'NorthEast', 'West', 'Center', 'East', 'SouthWest', 'South', 'SouthEast'])\n return false unless image_gravity_validator.valid?(@image_gravity)\n overflow_validator = EnumAttributeValidator.new('String', ['shrink_to_fit', 'truncate'])\n return false unless overflow_validator.valid?(@overflow)\n return false if !@id.nil? && @id < 0\n image_scale_type_validator = EnumAttributeValidator.new('String', ['fit', 'fill', 'stretch'])\n return false unless image_scale_type_validator.valid?(@image_scale_type)\n return false if !@height.nil? && @height < 0\n v_alignment_validator = EnumAttributeValidator.new('String', ['bottom', 'center', 'top'])\n return false unless v_alignment_validator.valid?(@v_alignment)\n return false if !@shape_border_width.nil? && @shape_border_width < 0\n return false if !@comb_number_of_cells.nil? && @comb_number_of_cells < 0\n shape_type_validator = EnumAttributeValidator.new('String', ['square', 'rectangle', 'circle', 'ellipse'])\n return false unless shape_type_validator.valid?(@shape_type)\n display_type_validator = EnumAttributeValidator.new('String', ['text', 'check', 'qrcode', 'barcode', 'image', 'shape'])\n return false unless display_type_validator.valid?(@display_type)\n return false if !@multiline_lines.nil? && @multiline_lines < 0\n return false if !@font_size.nil? && @font_size < 0\n return false if !@page.nil? && @page < 1\n alignment_validator = EnumAttributeValidator.new('String', ['left', 'center', 'right'])\n return false unless alignment_validator.valid?(@alignment)\n check_character_validator = EnumAttributeValidator.new('String', ['✓', '✔', '✖', '✗', '✘'])\n return false unless check_character_validator.valid?(@check_character)\n return false if !@rotation.nil? && @rotation > 3.6E+2\n return false if !@rotation.nil? && @rotation < 0\n string_condition_type_validator = EnumAttributeValidator.new('String', ['equals', 'contains', 'starts_with', 'ends_with', 'regex'])\n return false unless string_condition_type_validator.valid?(@string_condition_type)\n return false if !@decimal_places.nil? && @decimal_places < 0\n return false if !@width.nil? && @width < 0\n return false if !@x.nil? && @x < 0\n return false if !@y.nil? && @y < 0\n number_condition_type_validator = EnumAttributeValidator.new('String', ['equals', 'range', 'gte', 'gt', 'lte', 'lt'])\n return false unless number_condition_type_validator.valid?(@number_condition_type)\n return false if !@opacity.nil? && @opacity > 1\n return false if !@opacity.nil? && @opacity < 0\n true\n end",
"def valid?(_) true end",
"def valid?(_) true end",
"def validate(context = Attributor::DEFAULT_ROOT_CONTEXT)\n self.validate_attributes(context) +\n self.validate_requirements(context) +\n self.validate_keys(context)\n end"
] |
[
"0.7086543",
"0.6851903",
"0.6830744",
"0.6830744",
"0.67079294",
"0.6637014",
"0.6568492",
"0.65260607",
"0.6472873",
"0.6460393",
"0.6460393",
"0.6460393",
"0.6450427",
"0.6450427",
"0.6450427",
"0.6450427",
"0.6443667",
"0.6435409",
"0.643194",
"0.64303666",
"0.64222115",
"0.6401568",
"0.63879675",
"0.6377416",
"0.63760626",
"0.63281965",
"0.6275694",
"0.62546456",
"0.62510264",
"0.6247753",
"0.624721",
"0.6240828",
"0.62401193",
"0.6231184",
"0.62274766",
"0.6226069",
"0.62159854",
"0.6200847",
"0.6200167",
"0.6200167",
"0.6199494",
"0.6198826",
"0.61866856",
"0.6176591",
"0.61713946",
"0.61650884",
"0.6152978",
"0.6148775",
"0.6140049",
"0.6140049",
"0.613112",
"0.61285853",
"0.61163527",
"0.6109977",
"0.60975194",
"0.60836065",
"0.60836065",
"0.60836065",
"0.607206",
"0.60639876",
"0.6059566",
"0.6056901",
"0.6056901",
"0.6056901",
"0.6056901",
"0.6056901",
"0.6056901",
"0.6056901",
"0.60490084",
"0.60465103",
"0.6045277",
"0.6024353",
"0.60242695",
"0.6015788",
"0.6015278",
"0.60142946",
"0.6010049",
"0.599787",
"0.59972304",
"0.59972304",
"0.59972304",
"0.5994572",
"0.5991541",
"0.5981474",
"0.5969989",
"0.5958816",
"0.5951947",
"0.5951861",
"0.59469146",
"0.5946373",
"0.5944462",
"0.5940446",
"0.5929832",
"0.59279805",
"0.59251386",
"0.59224784",
"0.59224784",
"0.5921651",
"0.5920143",
"0.5920143",
"0.5916237"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def skeleton_params
params.require(:skeleton).permit(
:name,
:slug,
settings_attributes: [:id, :_destroy, :type, :name, :value, :version_qualifier]
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Get Instance Count Histogram
|
def ri_histogram(az, platform, size, options={})
options[:az] = az
options[:platform] = platform
options[:size] = size
request = get '/1/reporting/histogram', options
Hashie::Mash.new request
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def histo_counts\n @histo_counts ||= calculate_histo_counts\n end",
"def histograms\n metrics(Histogram)\n end",
"def calculate_histo_counts\n counts = []\n xx = x.dup\n histo_ranges.each do |i|\n counts << xx.size - xx.delete_if { |j| j > i[1] }.size\n end\n counts\n end",
"def hist\n return [] unless @histogram_buckets\n max = @histogram_buckets.max.to_f\n @histogram_buckets[0..-2].map { | count | { count: count, score: max > 0 ? count / max : 0 } }\n end",
"def counts\r\n @counts\r\n end",
"def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end",
"def count\n { value: @count, color: \"gray\" }\n end",
"def serializable_hash \n results.each.inject(empty_bins) do |histogram, result|\n histogram[result] = histogram[result] ? histogram[result] + 1 : 1; histogram\n end\n end",
"def instance_count\n @group.instances.length\n end",
"def stats\n\t\t@counts\n\tend",
"def count_used_instances\n count = 0\n return count\n end",
"def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend",
"def histogram\n if @histogram.nil?\n @histogram = Hash[*BINS.map{ |elt| [elt, 0] }.flatten]\n authors.each do |name, num_commits|\n bottom = 0\n BINS.each do |top|\n if num_commits >= bottom and num_commits < top\n @histogram[bottom] += 1\n end\n bottom = top\n end\n end\n end\n @histogram\nend",
"def getCounts\n result = {}\n @classes.each do |c|\n count = 0\n ObjectSpace.each_object(c){ count += 1 }\n result[c] = count\n end\n result\n end",
"def value_counts\n values = @data.each_with_object(Hash.new(0)) do |d, memo|\n memo[d] += 1\n end\n\n Daru::Vector.new(values)\n end",
"def color_counts\n color_counts = Hash.new(0)\n @pegs.each do |color|\n color_counts[color] += 1\n end\n color_counts\n end",
"def histogram(*args, &block)\n reduce(Hash.new(0)) do |hist, h|\n if block_given?\n v = yield(h)\n else\n v = h[args.first]\n end\n hist[v] += 1\n hist\n end\n end",
"def counts\n @counts ||=\n begin\n h = {}\n by_label.each do |label, notes|\n h[label] = notes.size\n end\n h\n end\n end",
"def sentiments_counts\n #This will get the sentiments related to each instance\n x = self.sentiments\n\n #These two lines are instantiated for the while loop below\n y = 0\n sentiments_count = []\n\n #This is a loop taking 'positive', 'negative', or 'neutral' from the instances\n while y < x.count\n sentiments_count << x[y][:sentiment]\n y += 1\n end\n\n #This creates a hash and counts each of the words' occurrences in the array\n #The output will look something like:\n # {\"Positive\" => 2, \"Neutral\" => 1, \"Negative\" => 3}\n hash = sentiments_count.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }\n hash.map {|key, value| puts \"#{key} - #{value}\"}\n end",
"def raw_count(value)\n @bins[value] || 0\n end",
"def histogram grid, n = 50000\n marginal(n).to_h grid\n end",
"def get_histogram(url)\n\t\tbegin \n\t\t\tmax_colors = settings.max_colors\n\t\t\timage = Magick::ImageList.new \n\t\t\th = {}\n\n\t\t\turi = URI.parse(url)\n\n\t\t\turi.open { |f|\n\t\t\t\timage.from_blob(f.read)\n\n\t\t\t\ttotal_pixels = image.columns * image.rows\n\t\t\t\thist = image.quantize(256, Magick::RGBColorspace).color_histogram\n\t\t\t\thist = Hash[hist.sort_by { |k,v| -v }[0..max_colors - 1]]\n\n\t\t\t\tpixels = hist.each {|pixel, value|\n\t\t\t\t\th[pixel.to_color(Magick::AllCompliance, false, 8, true)] = (value/total_pixels.to_f * 100).round(2)\n\t\t\t\t}\n\t\t\t}\t\t\n\t\t\treturn h\n\t\trescue\n\t\t\traise \n\t\tend\n\tend",
"def db_instance_count\n data.db_instance_count\n end",
"def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end",
"def histogram(fg = 'white', bg = 'black')\n red = Array.new(HISTOGRAM_COLS, 0)\n green = Array.new(HISTOGRAM_COLS, 0)\n blue = Array.new(HISTOGRAM_COLS, 0)\n alpha = Array.new(HISTOGRAM_COLS, 0)\n int = Array.new(HISTOGRAM_COLS, 0)\n\n rows.times do |row|\n pixels = get_pixels(0, row, columns, 1)\n pixels.each do |pixel|\n red[pixel.red & MAX_QUANTUM] += 1\n green[pixel.green & MAX_QUANTUM] += 1\n blue[pixel.blue & MAX_QUANTUM] += 1\n\n # Only count opacity channel if some pixels are not opaque.\n alpha[pixel.opacity & MAX_QUANTUM] += 1 unless opaque?\n v = pixel_intensity(pixel)\n int[v] += 1\n end\n end\n\n # Scale to chart size. When computing the scale, add some \"air\" between\n # the max frequency and the top of the histogram. This makes a prettier chart.\n # The RGBA and intensity histograms are all drawn to the same scale.\n\n max = [red.max, green.max, blue.max, alpha.max, int.max].max\n scale = HISTOGRAM_ROWS / (max * AIR_FACTOR)\n\n charts = ImageList.new\n\n # Add the thumbnail.\n thumb = copy\n thumb['Label'] = File.basename(filename)\n charts << thumb\n\n # Compute the channel and intensity histograms.\n channel_hists = channel_histograms(red, green, blue, int, scale, fg, bg)\n\n # Add the red, green, and blue histograms to the list\n charts << channel_hists.shift\n charts << channel_hists.shift\n charts << channel_hists.shift\n\n # Add Alpha channel or image stats\n charts << if !opaque?\n alpha_hist(alpha, scale, fg, bg)\n else\n info_text(fg, bg)\n end\n\n # Add the RGB histogram\n charts << channel_hists.shift\n\n # Add the intensity histogram.\n charts << intensity_hist(channel_hists.shift)\n\n # Add the color frequency histogram.\n charts << color_hist(fg, bg)\n\n # Make a montage.\n histogram = charts.montage do |options|\n options.background_color = bg\n options.stroke = 'transparent'\n options.fill = fg\n options.border_width = 1\n options.tile = '4x2'\n options.geometry = \"#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}+10+10\"\n end\n\n histogram\n end",
"def insight_counts\n return @insight_counts\n end",
"def counters\n metrics(Counter)\n end",
"def class_distribution dataset\n classes = Hash.new {|h,k| h[k] = 0}\n dataset.each do |item|\n classes[item[\"label\"]]=1+classes[item[\"label\"]]\n end\n \n result={}\n classes.each do |key,array|\n result[key]=array.to_f/dataset.size.to_f\n end\n \n return result\nend",
"def bins\n @p.size - 1\n end",
"def histogram(results)\n array = []\n results.each_with_index do |rolls, index|\n if rolls > 0\n array.unshift(\"#{index + 1}|#{\"#\" * rolls} #{rolls}\\n\")\n else\n array.unshift(\"#{index + 1}|#{\"#\" * rolls}\\n\")\n end\n end\n\n array.join\nend",
"def histogram freq_group, title\n upper = freq_group.map(&:first).max\n values = spread(freq_group,(0..upper),0).map(&:second)\n chart [title], values\nend",
"def calcRandHistogram2(rand, lowerBound, upperBound, nSections=100, nRuns=10000)\n bRand = boundedRand(rand, lowerBound, upperBound)\n sectionWidth = (upperBound - lowerBound) / nSections\n\n result = Array.new(nSections) {|i| [lowerBound + i*sectionWidth, 0]}\n\n nRuns.times { |i|\n r = bRand.call\n result[(r-lowerBound)/sectionWidth][1] += 1\n }\n\n result\nend",
"def count\n @bitmap.count\n end",
"def get_counts(args = {})\r\n Net::Flickr.instance().request('flickr.photos.getCounts', args).at('photocounts')\r\n end",
"def histogram(params = {})\n params[:name] ||= File.join(@pictureName.gsub(\".png\", \"Histogram.html\"))\n bins = Hash.new(0)\n \n (0...@picture.height).each do |j|\n (0...@picture.width).each do |i|\n r = ChunkyPNG::Color.r(@picture[i,j])\n g = ChunkyPNG::Color.g(@picture[i,j])\n b = ChunkyPNG::Color.b(@picture[i,j])\n \n op = 0.241 * r**2 + 0.691 * g**2 + 0.68 * b**2\n val = Math.sqrt(op).round\n val /= 13\n \n bins[val] += 1\n end\n end\n \n bins = Hash[ bins.map { |k,v| [k * 13, v] }.sort ]\n graph(bins, params[:name])\n end",
"def total_instances_count\n @os_aws.total_instances_count\n end",
"def get_count\n capture(\"cf curl /v2/apps/#{$app_uuid} | jq .entity.instances\").to_i\nend",
"def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end",
"def count\n @history.objects.find { |o| o.name == \"count\" }.val\n end",
"def size_v(data)\n\t\tcounts = data[:counts].values\n\t\tcounts.map{|i|[(Math.log(i+1) * 15) ** 1.6] * 2}\n\tend",
"def extract_histogram\n Riiif::File.new(\"#{Settings.IMAGE_PATH}/#{file_name}\")\n .extract(\n Riiif::Transformation.new(\n nil, nil, nil, nil,\n # Only provide :format for this Struct\n '-define histogram:unique-colors=true -format %c'\\\n ' histogram:info'\n )\n )\n end",
"def hcount\n @hcount += 1\n end",
"def hcount\n @hcount += 1\n end",
"def calcRandHistogram(rand, lowerBound, upperBound, nSections=100, nRuns=10000)\n bRand = boundedRand(rand, lowerBound, upperBound)\n sectionWidth = (upperBound - lowerBound) / nSections\n\n xs = (0...nSections).collect {|i| lowerBound + i*sectionWidth}\n ys = [0]*nSections\n\n nRuns.times { |i|\n r = bRand.call\n ys[(r-lowerBound)/sectionWidth] += 1\n }\n\n [xs,ys]\nend",
"def counter\n Weed::Stats.by_total({ :bucket_id => id })\n end",
"def initialize\n @domain_counts = Hash.new\n end",
"def counts\n {\n \"A\" => 0,\n \"G\" => 0,\n \"C\" => 0,\n \"T\" => 0\n }\n end",
"def ri_counts(*args)\n resources, opts = ri_opts(args)\n counts = {}\n threads = []\n resources.each do |res|\n next unless res.populated?\n threads << Thread.new do\n counts[res.acronym] = res.concept_count(self.xxhash, opts)\n end\n end\n threads.each(&:join)\n counts\n end",
"def getOccurrences\r\n\t\t\t\t\treturn @occurrences\r\n\t\t\t\tend",
"def num_buckets\n @store.length\n end",
"def frequency\n \n end",
"def count\n self.class.count(self)\n end",
"def show\n overlap1 = []\n overlap2 = []\n interlibrary_loans = []\n circulations = []\n @analysis_group.monograph_holdings.each do |holding|\n overlap1 << holding.overlap_holdings_count(1)\n overlap2 << holding.overlap_holdings_count(2)\n interlibrary_loans << holding.interlibrary_loans_count\n circulations << holding.circulation_count\n end\n\n #This isn't quite right. Need distinct OCLC Numbers because there will be overlap\n #Maybe something like this will work\n #ActiveRecord::Base.connection.execute(\"SELECT SUM(shared_by) FROM (SELECT * FROM overlap_holdings GROUP BY oclc_number)\")\n\n overlap_overall = OverlapHolding.pluck(:shared_by)\n\n interlibrary_loans_overall = InterlibraryLoan.group(:oclc_number).count.values\n interlibrary_loans_overall.concat(Array.new(zero_interlibrary_loans, 0))\n\n circulations_overall = Circulation.group(:oclc_number).count.values\n circulations_overall.concat(Array.new(zero_circulations, 0))\n\n # max = overlap1.max > overlap_overall.max ? overlap1.max : overlap_overall.max\n # max = overlap2.max > max ? overlap2.max : max\n\n # @overlap1_histogram = overlap1.histogram(10, :min => 0, :max => max)\n # @overlap2_histogram = overlap2.histogram(10, :min => 0, :max => max)\n # @overlap_histogram_overall = overlap_overall.histogram(10, :min => 0, :max => max)\n\n # @interlibrary_loans_histogram = interlibrary_loans.histogram(10, :min => 0, :max => 61)\n # @interlibrary_loans_histogram_overall = interlibrary_loans_overall.histogram(10, :min => 0, :max => 61)\n\n # @circulation_histogram = circulations.histogram(10, :min => 0, :max => 40)\n # @circulation_histogram_overall = circulations_overall.histogram(10, :min => 0, :max => 1300)\n\n # @overlap1_histogram = overlap1.histogram()\n # @overlap2_histogram = overlap2.histogram()\n # @overlap_histogram_overall = overlap_overall.histogram()\n\n # @interlibrary_loans_histogram = interlibrary_loans.histogram()\n # @interlibrary_loans_histogram_overall = interlibrary_loans_overall.histogram()\n\n # @circulation_histogram = circulations.histogram()\n # @circulation_histogram_overall = circulations_overall.histogram()\n\n\n @overlap1_desc = DescriptiveStatistics::Stats.new(overlap1)\n @overlap2_desc = DescriptiveStatistics::Stats.new(overlap2)\n @interlibrary_loans_desc = DescriptiveStatistics::Stats.new(interlibrary_loans)\n @circulations_desc = DescriptiveStatistics::Stats.new(circulations)\n\n @overlap_overall_desc = DescriptiveStatistics::Stats.new(overlap_overall)\n @interlibrary_loans_overall_desc = DescriptiveStatistics::Stats.new(interlibrary_loans_overall)\n @circulations_overall_desc = DescriptiveStatistics::Stats.new(circulations_overall)\n\n \n @interlibrary_loan_items_overall_count = InterlibraryLoan.all.distinct.count(:oclc_number) + zero_interlibrary_loans\n @interlibrary_loan_overall_count = InterlibraryLoan.all.count\n\n @interlibrary_loan_items_count = interlibrary_loans.count\n @interlibrary_loan_count = interlibrary_loans.sum\n\n @circulation_items_overall_count = Circulation.all.distinct.count(:oclc_number) + zero_circulations\n @circulation_overall_count = Circulation.all.count\n\n @circulation_items_count = circulations.count\n @circulation_count = circulations.sum\n\n @overlap_items_overall_count = OverlapHolding.all.distinct.count(:oclc_number)\n @overlap_overall_count = ActiveRecord::Base.connection.execute(\"SELECT SUM(shared_by) FROM (SELECT * FROM overlap_holdings GROUP BY oclc_number)\")[0][0]\n\n @overlap1_item_count = overlap1.count\n @overlap1_count = overlap1.sum\n\n @overlap2_item_count = overlap2.count\n @overlap2_count = overlap2.sum\n\n end",
"def histogram(lookback)\n histo = Hash.new\n key = [@@start_token] * lookback\n get_text.each do |char|\n ((histo[key.clone] ||= { })[char] ||= 0)\n histo[key.clone][char] += 1\n key.push(char).shift\n end\n histo\n end",
"def get_counts_for_all_entities\n @tracker.counts\n end",
"def word_instances(text)\n instances = Hash.new(0)\n normalized_words = normalize(text)\n unique(text).each do |word|\n instances[word] = normalized_words.count(word)\n end\n instances\nend",
"def counts(n)\n divisors = Array.new\n (1..n).each do |n|\n single_divisors = count n\n divisors.push(single_divisors)\n end\n divisors\n end",
"def counters\n return @counters if @counters\n return [] unless random?\n\n percounter = template.max / (@max_counters || Noid::MAX_COUNTERS) + 1\n t = 0\n @counters = []\n\n while t < template.max\n counter = {}\n counter[:value] = t\n counter[:max] = [t + percounter, template.max].min\n\n t += percounter\n\n @counters << counter\n end\n\n @counters\n end",
"def count\n range = current_range\n\n sum = 0\n @mutex.synchronize do\n range.each do |key|\n sum += @counts[key]\n end\n end\n sum\n end",
"def calculate(ratings)\n histogram_data = ratings.group(:int_value).count\n 5.times { |i| histogram_data[i+1] = 0 if !histogram_data[i+1] }\n histogram_data.to_a.sort.to_s\n end",
"def histogram(query, field, interval=nil)\n raise \"The class #{self.class.name} must implement the 'histogram' method.\"\n end",
"def get_histogram(features)\n return [] if features.empty?\n results = []\n #lower limit\n left = features.first.start - (features.first.start % 10)\n #upper limit\n right = features.last.end + (features.last.end % 10)\n #number of arrays\n start = left\n while start <= right\n results << [start, 0, 0]\n start += 10\n end\n features.each do |f|\n window = f.start - (f.start % 10)\n start_index = nil\n if window == left\n start_index = 0\n else\n start_index = (window - left) / 10\n end\n end_index = start_index + (((f.end - f.start) - ((f.end - f.start) % 10)) / 10)\n for index in start_index .. end_index\n break if index > results.length\n if f.strand.match(/\\+/)\n results[index][1] += 1\n else\n results[index][2] += 1\n end\n end\n end\n return results\n\n end",
"def Count()\n _getproperty(1, [], [])\n end",
"def repeat_counts\n repeats.values.map &:count\n end",
"def insight_counts=(value)\n @insight_counts = value\n end",
"def instance_count\n repository.files(:pattern => /.rb/).map do |file|\n content = repository.read(file)\n count_calls(:def,content)\n end.sum\n end",
"def count\n # implement in subclasses\n end",
"def count\n @count\n end",
"def ab_counts(_experiment, _alternative)\n raise \"Not implemented\"\n end",
"def count_occurrences(vehicles)\n occurences = {}\n\n vehicles.each do |vehicle|\n occurences[vehicle] = vehicles.count(vehicle)\n end\n\n occurences.each do |vehicle, count|\n puts \"#{vehicle} => #{count}\"\n end\nend",
"def count\n dataset.count\n end",
"def count\n @collector.count\n end",
"def count\n @atlas.count\n end",
"def cluster_annotation_count\n self.cluster_groups.map {|c| c.cell_annotations.size}.reduce(0, :+)\n end",
"def histo_mids\n @histo_mids ||= histo_ranges.map { |x| (x[0] + x[1]) / 2 }\n end",
"def get_ingredient_counts\n otc = 0\n legend = 0\n self.ingredients.each do |ingredient|\n if ingredient.get_base_item.drug_class == 'legend'\n legend += 1\n elsif ingredient.get_base_item.drug_class == 'over_the_counter'\n otc += 1\n end\n end\n self.number_legend_ingredients = legend\n self.number_otc_ingredients = otc\n end",
"def summary\n res = description\n\n {\n in_service: res.instances.all?{ |e| e[:lifecycle_state] == 'InService' },\n healthy: res.instances.all?{ |e| e[:health_status] == 'Healthy' },\n size: res.instances.select { |e| e[:lifecycle_state] == 'InService' }.length\n }\n end",
"def countables\n key :type, Integer\n key :ts, Time\n key :uid, String\n\n key :count, Integer\n\n generate_aggregators { |ts, method|\n totype = method_names_type_counter(method)\n fromtype = get_fromtype_for_totype(totype)\n aggregate_and_create(fromtype, totype, ts)\n }\n end",
"def densities\n\t\t\tmap { |n| count n }\n\t\t end",
"def print_counts(hash)\n hash.each { |key, count| puts \"#{key} -- #{count}\\n---------\\n\" }\nend",
"def type_count\n type_count = {}\n self.each do |go|\n if type_count[go.class].nil?\n type_count[go.class] = 1\n else\n type_count[go.class] += 1\n end\n end\n return type_count\n end",
"def count\n end",
"def count\n end",
"def count\n\t\t\t\t# CPU count can change during the program runtime\n\t\t\t\tcpuinfo.count { |x| x.start_with?('processor') }\n\t\t\tend",
"def time_histogram(time_bin,object_array)\n binned = Hash.new(0)\n p = Proc.new { |date|\n case time_bin\n when :day_of_month then date.strftime(\"%d\")\n when :day_of_week then date.strftime(\"%A\")\n when :time_of_day then date.strftime(\"%H\")\n else \n nil\n end\n }\n \n object_array.each { |v| \n date = yield v\n if date and bin = p.call(date) \n binned[bin] += 1\n end\n } \n binned\n end",
"def Occurrence_count(arr)\n\th1={}\n\tarr.each do |element|\n\t\th1[\"#{element}\"].nil? ? h1[\"#{element}\"]=1 : h1[\"#{element}\"]+=1\n\tend\n\th1.each do |key,value|\n\t\tputs \"\tOccurrence of #{ key } in the array is #{value} times \"\n\tend\t\nend",
"def element_count(arr)\n hash = {} \n\n # debugger \n arr.each {|ele| hash[ele] = arr.count(ele) }\n\n hash \nend",
"def event_counter_statistics(flags=\"\")\n output = `vmstat #{flags}` \n keys = output.split(/\\d/).compact.join.split(\"\\n\").map(&:strip)\n # this looks silly. but I kind'a like it\n keys.map(&:downcase).map {|s| \n s.gsub(\" \", \"_\")}.map {|s| \n s.gsub(\"-\", \"_\")}.map {|s| \n s.gsub(/\\b(\\w){1}_{1}/, \"\") }.map(&:to_sym)\n values = output.split(/[A-z]/).compact.join.split(\"\\n\").map(&:strip)\n data = Hash[keys.zip values]\n Vmstator::DiskSummary.new(data)\n end",
"def stat\n each_with_object(Hash.new(0)) { |c, o| o[c] += 1 }\n end",
"def register_histogram( name )\n @metrics.histogram( name )\n end",
"def chromosome_count(genome_array)\n ccount = Hash.new(0)\n genome_array.each {|entry| ccount[entry[1]] += 1}\n ccount.each {|chromosome, count| puts \"Chromosome \" + chromosome.to_s + \" has \" + count.to_s + \" SNP data points\" }\n total = 0\n ccount.values.each {|count| total+= count }\n puts \"----\"\n puts total.to_s + \" total data points\"\n return ccount\nend",
"def histo_bin_size\n @opts[:histo_bin_size] ||= effective_range_size / 50.0\n end",
"def count; end",
"def count; end",
"def count; end",
"def edges\n i = 0\n @hypernyms.each do |key, values|\n i += values.length\n end\n i\n end",
"def num_gears\n num = 0\n group_instances.each { |g| num += g.gears.count}\n num\n end",
"def element_frequency_count\n collection.each_with_object(Hash.new(0)) {|element, occurrence| occurrence[element] += 1}\n end",
"def define_histogram(name, opts = {}, &block)\n define_metric(:histogram, name, opts, &block)\n end",
"def size\n @buckets.length\n end",
"def num_buckets\n self.store.length\n end"
] |
[
"0.75326955",
"0.685996",
"0.6805563",
"0.66530573",
"0.658357",
"0.65093786",
"0.64420104",
"0.6397016",
"0.6303631",
"0.6256727",
"0.62532616",
"0.6194095",
"0.615203",
"0.6061174",
"0.6059027",
"0.6003143",
"0.5987595",
"0.59839326",
"0.5978755",
"0.5972718",
"0.5971477",
"0.59040797",
"0.5865843",
"0.5843359",
"0.58326894",
"0.583055",
"0.5824059",
"0.5813942",
"0.5789904",
"0.57879233",
"0.5780172",
"0.5772667",
"0.5767807",
"0.57675815",
"0.57623416",
"0.57568485",
"0.5717986",
"0.5714107",
"0.5712758",
"0.57078373",
"0.57070965",
"0.5701584",
"0.5701584",
"0.5685899",
"0.56856495",
"0.5676765",
"0.56443703",
"0.5635804",
"0.5631239",
"0.56248736",
"0.5611839",
"0.5603416",
"0.56028736",
"0.5599088",
"0.55886275",
"0.55831563",
"0.55763304",
"0.5575307",
"0.5571265",
"0.55662894",
"0.5564837",
"0.55640036",
"0.5551674",
"0.554458",
"0.5542586",
"0.5541061",
"0.553745",
"0.5535784",
"0.5534874",
"0.55326796",
"0.5526829",
"0.5525755",
"0.55250585",
"0.55231345",
"0.5522292",
"0.5520551",
"0.55168855",
"0.5514351",
"0.5512895",
"0.5499073",
"0.54901016",
"0.5481412",
"0.5481412",
"0.54683316",
"0.54642946",
"0.54642487",
"0.54595274",
"0.5459154",
"0.54567707",
"0.5453124",
"0.5453049",
"0.54490846",
"0.5444667",
"0.5444667",
"0.5444667",
"0.54377997",
"0.54341024",
"0.54253393",
"0.5418669",
"0.5408491",
"0.54037356"
] |
0.0
|
-1
|
def [](pos) r, c = pos
|
def build_move_tree # Node[0,0]
@root_node = PolyTreeNode.new(@start_pos)
tree = [@root_node] #after first round tree = []
while !tree.empty?
#after line 39 => tree => [N(v(2,1)), N(v(1,2))]
res = tree.shift #tree = [] # res => TreeNode with the value of [2,1]
positions = new_move_positions(res.value) # positions => [[0,2],[1,3], [3,3], [4,2], [5,0]]
#tree => [N(v(1,2))]
positions.each do |n| # n=> [2,1]
nd = PolyTreeNode.new(n) # nd=> Node with with the value of [2,1]
res.add_child(nd)
tree << nd
end # tree => [N(v(1,2)),N [0,2],[1,3], [3,3], [4,2], [5,0]]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def [](pos)\n r, c = pos[0],pos[1]\n grid[r][c]\n end",
"def [](pos)\n row = pos.first\n col = pos.last\n @grid[row][col]\n end",
"def [](pos)\n @grid[pos[0]][pos[1]]\n # row,col = pos\n # @grid[row][col]\n end",
"def [](pos) #pos = [1,2]\n # x, y = pos\n x = pos[0]\n y = pos[1]\n @rows[x][y] \n end",
"def [](pos)\n x, y = pos.first, pos[1]\n @grid[x][y]\n end",
"def [](pos)\n @board[pos[0]][pos[1]]\n end",
"def [](pos)\n self.grid[pos[1]][pos[0]]\n end",
"def [](pos)\n row, col = pos[0], pos[1]\n @rows[row][col]\n end",
"def [](pos)\n @board[pos[0]][pos[1]]\n end",
"def [](pos)\n grid[pos[0]][pos[1]]\n end",
"def [](pos)\n row, col = pos\n grid[row][col]\n end",
"def [](pos)\n row, col = pos\n grid[row][col]\n end",
"def [](pos)\n row, col = pos\n @rows[row][col]\n end",
"def [](pos)\n row, col = pos\n @grid[row][col]\n end",
"def [](pos)\n row, col = pos \n @grid[row][col]\n end",
"def [](pos)\n x, y = pos\n @grid[x][y] \n end",
"def position (r,c)\n if (0...ROWS).member? r\n if (0...COLS).member? c\n {row: r, col: c, pos: COLS*r + c}\n end\n end\nend",
"def [](pos)\n x, y = pos\n grid[x][y]\n end",
"def [](pos)\n row, col = pos\n @grid[row][col]\n end",
"def [](pos)\n x, y = pos\n @grid[x][y]\n end",
"def [](pos)\n x, y = pos\n @rows[x][y]\n end",
"def [](pos)\n x, y = pos\n @board[x][y]\n end",
"def [](pos)\n raise 'invalid pos' if !valid_pos?(pos)\n \n row, col = pos\n @rows[row][col]\n end",
"def [](row, col)\n @move[[row, col]]\n end",
"def [](pos)\n if valid_pos?(pos)\n row, col = pos\n @grid[row][col]\n else\n puts \"Invalid position\"\n end\n end",
"def [](pos)\n row,col = pos\n @board[row][col]\n end",
"def pos=(_arg0); end",
"def line_and_column(pos); end",
"def pos=(pos); end",
"def position=(_arg0); end",
"def [](position)\n row, col = position\n @board[row][col]\n end",
"def position\n V[x, y]\n end",
"def get_coordinates(pos)\n row = (pos / @width) + 1\n col = (pos % @width) + 1\n [row, col]\n end",
"def pos() end",
"def pos() end",
"def pos() end",
"def pos() end",
"def at(position)\n self[position]\n end",
"def at(index); end",
"def [](index); end",
"def position\n [x, y]\n end",
"def get_index(position:)\n row = (position - 1) / 3\n col = (position - 1) % 3\n return row, col\n end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos(a,b)\n\t\t@mat[a][b]\n\tend",
"def [](pos)\n row, col = pos\n raise \"Invalid coordinate\" unless (0..7).include?(row) && (0..7).include?(col)\n @board[row][col]\n end",
"def position\n [ChessBoard.col_index(pos[0]), pos[1].to_i]\n end",
"def []( index )\n case index\n when 0\n @x\n when 1\n @y\n else\n nil\n end\n end",
"def pos\n [posx, posy]\n end",
"def [](i); @x[i]; end",
"def position\n [@x, @y]\n end",
"def get(i, j)\n @pos[i][j]\n end",
"def position(pos)\n @cells[to_index(pos)]\n end",
"def rindex(p0) end",
"def [](position)\n\n pRow, pColumn = position\n @grid[pRow][pColumn]\n\n end",
"def [](loc)\n sequence[loc]\n end",
"def pos1(pos)\n [pos.first + 1, pos.last + 1]\n end",
"def [](p0) end",
"def [](p0) end",
"def pos() @current end",
"def []( index )\r\n @ary.at(index + @offset)\r\n end",
"def [](pos)\n raise \"pos not on board\" unless on_board?(pos)\n i, j = pos\n @rows[i][j]\n end",
"def [](index); @args[index] end",
"def line_and_column(position = T.unsafe(nil)); end",
"def getCoords (index)\n return index%10, index/10\n end",
"def pos()\n #This is a stub, used for indexing\n end",
"def [](loc, idx)\n return loc if immediate?(idx)\n\n sequence[loc]\n end",
"def position\n\t\t[ @x, @y ]\n\tend",
"def []=(pos, p)\n r, c = pos[0],pos[1]\n grid[r][c] = p\n end",
"def row(position)\n position[0]\n end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def [](pos)\n index = pos.to_int\n raise IndexError unless (1..8).cover? index\n \n @bits[8 - index]\n end",
"def index_line_and_col(index) \n\t\ti = 0\n\t\ti += 1 while index_of_position(i) <= index\n\t\ti -= 1\n\t\t[i, index - index_of_position(i)]\n\tend",
"def pos=(p0) end",
"def pos=(p0) end",
"def pos=(p0) end",
"def pos=(p0) end",
"def[]=(pos, value)\n row = pos.first\n col = pos.last\n @grid[row][col] = value\n end",
"def index(p0) end",
"def index(p0) end",
"def at(pos)\n pos = pos.to_int\n\n if 0 <= pos && !has_size?\n return read_access(pos)\n elsif 0 <= pos && pos < size\n return read_access(pos)\n elsif -size <= pos && pos < 0\n return read_access(size + pos)\n else\n return nil\n end\n end",
"def [](idx) \n if idx >= @total\n return nil\n end\n\n @tuple.at(@start + idx)\n end",
"def index(x, y)\n (y - 1) * width + (x - 1)\n end",
"def begin_pos=(_); end",
"def at(pos)\n @map[pos]\n end",
"def pos *indexes\n if indexes.first.is_a? Integer\n return indexes.first if indexes.size == 1\n return indexes\n end\n res = self[indexes]\n return res if res.is_a? Integer\n res.map { |i| self[i] }\n end",
"def pos *indexes\n if indexes.first.is_a? Integer\n return indexes.first if indexes.size == 1\n return indexes\n end\n res = self[indexes]\n return res if res.is_a? Integer\n res.map { |i| self[i] }\n end",
"def [](position)\n raise IndexError, \"Bad position: #{position}\" unless position.between?(1,9)\n @state[position - 1]\n end",
"def to position\n self[0..position]\n end",
"def []=(pos)\n end"
] |
[
"0.75785005",
"0.73188806",
"0.7302657",
"0.729694",
"0.7238931",
"0.72283983",
"0.71659946",
"0.7148236",
"0.71439314",
"0.7132368",
"0.71185046",
"0.71185046",
"0.7088293",
"0.70881635",
"0.7042924",
"0.7040852",
"0.69896233",
"0.69882005",
"0.69846493",
"0.6978763",
"0.6952678",
"0.68107307",
"0.6787842",
"0.67535156",
"0.6729707",
"0.67117727",
"0.66627955",
"0.66627717",
"0.6575019",
"0.655263",
"0.65499526",
"0.6498578",
"0.6489827",
"0.6456715",
"0.6456715",
"0.6456715",
"0.6456715",
"0.64529485",
"0.6448593",
"0.6393128",
"0.6388277",
"0.63830584",
"0.63758767",
"0.63758767",
"0.63758767",
"0.63758767",
"0.63758767",
"0.63758767",
"0.6363732",
"0.6356039",
"0.6346704",
"0.6343523",
"0.63153553",
"0.629528",
"0.62803286",
"0.626255",
"0.62520945",
"0.62468666",
"0.6245991",
"0.6243852",
"0.6241527",
"0.62225586",
"0.62225586",
"0.6221697",
"0.6198529",
"0.6182086",
"0.61679834",
"0.6166715",
"0.6163088",
"0.61612505",
"0.61576575",
"0.61404836",
"0.61333984",
"0.61314785",
"0.61282057",
"0.61282057",
"0.61282057",
"0.61282057",
"0.61282057",
"0.61282057",
"0.61282057",
"0.61282057",
"0.61258966",
"0.61252654",
"0.61199236",
"0.61199236",
"0.61199236",
"0.61199236",
"0.61185175",
"0.6116484",
"0.6116484",
"0.61095506",
"0.6108106",
"0.61065644",
"0.6101755",
"0.60907847",
"0.60795397",
"0.60795397",
"0.6076504",
"0.60582566",
"0.6055907"
] |
0.0
|
-1
|
def build_move_tree p "asdfasdfasdlfj" sleep 1 self.root_node = PolyTreeNode.new(start_pos) build the tree out in breadthfirst fashion nodes = [root_node] until nodes.empty? current_node = nodes.shift current_pos = current_node.value new_move_positions(current_pos).each do |next_pos| next_node = PolyTreeNode.new(next_pos) current_node.add_child(next_node) nodes << next_node end end end
|
def new_move_positions(pos)
candidates = KnightPathFinder.valid_moves(pos)
candidates = candidates.select { |e| !@considered_positions.include?(e) }
@considered_positions.concat(candidates)
return candidates
#@considered_positions = (@considered_positions.concat(candidates)).uniq
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_move_tree #=> build the tree\n self.root_node = PolyTreeNode.new(start_pos) #=> root_node set to the start pos\n\n # build the tree out in breadth-first fashion\n nodes = [root_node]\n until nodes.empty?\n current_node = nodes.shift\n\n current_pos = current_node.value\n new_move_positions(current_pos).each do |next_pos|\n next_node = PolyTreeNode.new(next_pos)\n current_node.add_child(next_node)\n nodes << next_node\n end\n end\n end",
"def build_move_tree\n self.root_node = PolyTreeNode.new(start_pos) #instance variable\n \n queue = [root_node]\n until queue.empty?\n #pop,queue\n cur_node = queue.shift\n move_list = new_move_positions(cur_node.value)\n move_list.each do |pos|\n child_node = PolyTreeNode.new(pos)\n cur_node.add_child(child_node)\n queue << child_node\n end\n end\n end",
"def build_move_tree\n self.root_node = PolyTreeNode.new(@start_pos)\n\n nodes = [root_node]\n until nodes.empty?\n current_node = nodes.shift\n current_pos = current_node.value\n\n new_move_positions(current_pos).each do |pos|\n next_node = PolyTreeNode.new(pos)\n current_node.add_child(next_node)\n nodes << next_node\n end\n end\n end",
"def build_move_tree\n queue = [@root_node]\n until queue.empty?\n current_node = queue.shift\n possible_positions = new_move_positions(current_node.value) #[]\n possible_positions.each do |position| #[1,2]\n child_node = PolyTreeNode.new(position) #node object(value = 1,2)\n child_node.parent = current_node\n current_node.add_child(child_node)\n queue << child_node\n end\n end\n end",
"def build_move_tree(root_node)\n start_pos = root_node.value\n queue = Queue.new \n new_move_positions(start_pos).each do | move |\n move_node = PolyTreeNode.new(move)\n root_node.add_child(move_node)\n end\n end",
"def build_move_tree\n @move_tree = PolyTreeNode.new(@starting_pos)\n\n new_move_positions(@starting_pos).each do |move|\n @move_tree.add_child(PolyTreeNode.new(move))\n end\n\n end",
"def build_move_tree # Node[0,0]\n @root_node = PolyTreeNode.new(@start_pos)\n tree = [@root_node] #after first round tree = []\n while !tree.empty?\n #after line 39 => tree => [N(v(2,1)), N(v(1,2))]\n res = tree.shift #tree = [] # res => TreeNode with the value of [2,1]\n positions = new_move_positions(res.value) # positions => [[0,2],[1,3], [3,3], [4,2], [5,0]]\n #tree => [N(v(1,2))]\n positions.each do |n| # n=> [2,1]\n nd = PolyTreeNode.new(n) # nd=> Node with with the value of [2,1]\n res.add_child(nd)\n tree << nd\n end # tree => [N(v(1,2)),N [0,2],[1,3], [3,3], [4,2], [5,0]]\n end\n end",
"def build_move_tree\n move_q = [@root]\n while move_q.length > 0\n children = new_move_positions(move_q[0].value)\n children.each do |kid|\n move_q[0].add_child(PolyTreeNode.new(kid))\n end\n move_q += move_q[0].children\n move_q.shift\n end\n nil\n end",
"def build_move_tree\n arr = [root_node]\n nodes = []\n\n until arr.empty?\n this_pos = arr.shift\n arr += new_move_positions(this_pos)\n nodes << PolyTreeNode.new(this_pos)\n end\n\n nodes\n end",
"def build_move_tree(end_pos)\n #build entire tree\n tree = [@root_node]\n # until tree.empty?\n curr_pos = @considered_positions\n \n #root_node \n #node(root_node) \n #root_node.children << new_move (root_node) \n #\n end",
"def build_next_moves current_node\n cur_pos = current_node.value \n\n (0...8).each do |col|\n (0...8).each do |row|\n next_pos = [col, row] \n if valid_move?(cur_pos,next_pos)\n current_node.add_child(PolyTreeNode.new(next_pos))\n @all_positions[next_pos] = true \n end\n end\n end\n end",
"def build_tree(start, finish, node = Node.new(start), queue = [node])\n @root = node\n\n until queue.index { |n| n.value == finish }\n node = queue.shift\n node.children = generate_move_nodes(node.value, finish)\n node.children.each { |c| queue << c }\n end\n end",
"def build_move_tree(end_pos)\n queue = [self.root_node]\n until queue.empty?\n curr_node = queue.shift\n if curr_node.value == end_pos\n return curr_node\n end\n end\n end",
"def build_queen_move_tree\n move_tree_template = MoveTree.new([0, 0])\n # Get directions\n directions = [-1, 0, 1].repeated_permutation(2).to_a\n directions.delete([0, 0])\n\n directions.each do |direction|\n move_tree_template.root.add_child(build_directional_tree_nodes(direction))\n end\n\n move_tree_template\n end",
"def build_king_move_tree\n move_tree_template = MoveTree.new([0, 0])\n\n # Get the 8 surrounding spaces\n locations = [-1, 0, 1].repeated_permutation(2).to_a\n locations.delete([0, 0])\n\n locations.each do |loc|\n move_tree_template.root.add_child(loc)\n end\n\n move_tree_template\n end",
"def generate_tree_nodes(ttt)\n while !@avail_moves.empty?\n player_moves = create_new_players_moves_array\n player_makes_move(player_moves)\n create_new_child_node(ttt, player_moves)\n end\n end",
"def build_move_tree(node)\n queue = [node]\n until queue.empty?\n current_node = queue.shift\n return current_node if current_node.value == target_value\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\n end",
"def initialize(root_node=[0,0])\n @root_node = PolyTreeNode.new(root_node)\n @considered_pos = [@root_node.value]\n self.build_move_tree # goes here?\n end",
"def children\n new_board = Array(3) { Array (3) }\n root = PolyTreeNode.new(new_board)\n possible_moves =\n end\nend",
"def build_tree(arr)\n\ntree = []\n\ntree.push(Node.new(arr[0]))\n\n arr[1..-1].each do |i|\n new_node = Node.new(i)\n\n condition = false\n current = tree[0]\n until condition == true\n if i > current.value && current.find_right_child.count == 0\n new_node.create_parent(current)\n current.create_right_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i < current.value && current.find_left_child.count == 0\n new_node.create_parent(current)\n current.create_left_child(new_node)\n tree.push(new_node)\n condition = true\n elsif i > current.value && current.find_right_child.count == 1\n current = current.find_right_child[0]\n elsif i < current.value && current.find_left_child.count == 1\n current = current.find_left_child[0]\n end\n end\n end\n tree\nend",
"def build_tree(unit, node, level = 0)\r\n return nil if level > @max_depth\r\n \t\r\n unit.next_move(node.current_case).each do |next_case|\r\n next if next_case[0] < 0 || next_case[0] > 7 ||\r\n next_case[1] < 0 || next_case[1] > 7 \r\n \r\n next_node = Node.new(next_case, node)\r\n node.children << next_node\r\n\r\n build_tree(unit, next_node, level + 1)\r\n end \r\n end",
"def make_tree_for(position)\n root = TreeNode.new(nil, position)\n\n\nend",
"def move(start, finish)\n unless @board.valid_position?(start) && @board.valid_position?(finish)\n return invalid_inputs\n end\n\n queue = [Node.new(start)]\n node = Node.new\n\n until node.data == finish\n node = queue.shift\n @board.moves_as_children(node)\n node.children.each { |child| queue << child }\n end\n\n print_path(create_path(node))\n end",
"def build_tree(arr)\n #arr.shuffle!\n arr.each do |x|\n if @root == nil\n @root = Node.new(x)\n else\n current_node = @root\n until current_node == nil\n if x < current_node.value\n parent = current_node\n direction = \"left\"\n current_node = current_node.left_child\n elsif x > current_node.value\n parent = current_node\n direction = \"right\"\n current_node = current_node.right_child\n end\n end\n if direction == \"left\"\n parent.left_child = Node.new(x)\n elsif direction == \"right\"\n parent.right_child = Node.new(x)\n end\n end\n end\n end",
"def create_tree(start_tile)\n queue = [start_tile]\n visited.add(start_tile.pos)\n\n while !queue.empty?\n cur_tile = queue.shift\n tiles = adjacent_tiles(cur_tile.pos)\n\n tiles.each do |tile_pos|\n tile = self[tile_pos]\n tile.parent = cur_tile\n queue.push(tile)\n visited.add(tile.pos)\n end\n end\n start_tile\n end",
"def run\n @ply = 0\n @nodes = 0\n @root = nil\n start_time = Time.now\n search(-INF, INF, @height)\n return unless @root\n make_move(@root)\n Result.new(generate_fen, @root, @nodes, Time.now - start_time, board)\n end",
"def build_path(start, end_pos)\n node = Node.new(start[0], start[1])\n target = Node.new(end_pos[0], end_pos[1])\n visited_nodes = []\n next_moves = [node]\n until next_moves.empty? do\n node = next_moves.shift\n puts \"Current node: #{node.x}, #{node.y}\"\n if node.x == target.x && node.y == target.y \n return node\n end\n visited_nodes.push(node)\n node.moves = get_moves(node)\n node.moves.reject do |square|\n visited_nodes.include?(square)\n end\n node.moves.each do |move| \n next_moves.push(move)\n end\n end\n return node\nend",
"def construct_game_tree(node=@root, turn_order)\n\n\t\tif turn_order\n\t\t\tmark = @player.mark\n\t\telse\n\t\t\tmark = @mark\n\t\tend\n\n\t\tboard = node.value\n\n\t\tavailable_moves = board.get_available_positions\n\n\t\tavailable_moves.each do |position|\n\t\t\tcopy = board.clone()\n\t\t\tcopy.place_mark(mark, position)\n\t\t\tnode.add_child(copy)\n\t\tend\n\n\t\tnode.children.each do |child|\n\t\t\tself.construct_game_tree(child, !turn_order)\n\t\tend\n\t\t\n\tend",
"def build_tree(tree_size, input)\n nodes = Array.new(tree_size) { Node.new(nil, nil, nil) }\n\n tree_size.times do |i|\n line = input.next\n val, left, right = line.chomp.split.map(&:to_i)\n nodes[i].val = val\n nodes[i].left = nodes[left] unless left == -1\n nodes[i].right = nodes[right] unless right == -1\n end\n \n nodes.first\nend",
"def create_tree_positions\n # Get the number of qualified participants from the tournament\n if tournament.rankings.empty?\n participants_number = tournament.max_participants\n else\n # Or from the number of qualified from last ranking\n participants_number = tournament.rankings[tournament.rankings.size - 1].qualified\n end\n\n special = false\n next_depth = participants_number\n special_falling = false\n (participants_number * 2 - 1).downto(1) do |pos|\n tree_positions.create(:position => pos, :special => special)\n if tree_type == DOUBLE\n if pos.even?\n tree_positions.create(:position => -pos, :special => false)\n tree_positions.create(:position => -pos, :special => true) if special_falling\n elsif special_falling and pos != 1\n tree_positions.create(:position => -pos, :special => true)\n end\n end\n if pos == next_depth\n special_falling = true\n special = !special\n next_depth /= 2\n end\n end\n end",
"def build_tree(data, par_node)\n return nil if data.empty?\n \n if @node.value <= par_node.value\n if par_node.left == nil\n par_node.left = @node\n else\n build_tree(data, par_node.left)\n end\n else\n if par_node.right == nil\n par_node.right = @node\n else\n build_tree(data, par_node.right)\n end\n end\n\n @node = Node.new(data.shift)\n build_tree(data, @root)\n end",
"def push(source_loc, current_loc, next_loc, dir, goal_loc, depth)\n \n extra_cost = depth\n node_cost = predict_movement_cost(source_loc,current_loc,goal_loc) + extra_cost\n node = Map_Address.new(next_loc.x,next_loc.y,node_cost)\n \n @nodes.push(node)\n @nodes.sort!{ |a,b| a.cost <=> b.cost}\n \n # save source direction\n @move_dir[ hash_address(next_loc.x,next_loc.y) ] = dir\n # save source address\n @nodes_parent_id[ hash_address(next_loc.x, next_loc.y) ] = hash_address(current_loc.x,current_loc.y)\n end",
"def build_tree\n c1 = ComponentNode.new(110)\n c2 = ComponentNode.new(20)\n c3 = ComponentNode.new(20)\n c4 = ComponentNode.new(150)\n c5 = ComponentNode.new(80)\n c6 = ComponentNode.new(120, [c1, c2, c3])\n c7 = ComponentNode.new(180, [c4, c5])\n return(ComponentNode.new(200, [c6, c7]))\n end",
"def children\n # find array of empty positions on board (children candidates)\n\n # create node by duping board and putting next_mover_mark in one of the empty positions\n\n end",
"def build_path(parent_pos, visited)\n possible_moves = []\n # Getting all available moves for knight and applying it to the current position (root)\n @move_rows.each_with_index do |value, index|\n temp_arr = [parent_pos.value[0] + @move_rows[index], parent_pos.value[1] + @move_cols[index]] # Temp variable for repetition\n # Checking for validity of the new moves as well as checking if it hasn't already been visited\n if valid_play(parent_pos.value[0] + @move_rows[index], parent_pos.value[1] + @move_cols[index]) && !visited.include?(temp_arr)\n possible_moves << [parent_pos.value[0] + @move_rows[index], parent_pos.value[1] + @move_cols[index]]\n end\n end\n # Get all possible moves and add it as a child to the parent Node that was passed\n possible_moves.map do |value|\n parent_pos.child = Node.new(value, parent_pos)\n end\n end",
"def knight_moves(start, finish)\n tree = MoveTree.new(start)\n queue = [tree]\n result = nil\n visited_points = Set.new()\n while queue.length > 0\n current_node = queue.shift\n visited_points.add(current_node.point)\n if current_node.point == finish\n result = get_path(current_node)\n break\n else\n propagate_tree(current_node)\n queue += current_node.children.reject { |n| visited_points.include?(n.point) }\n end\n end\n result\nend",
"def build_tree(list)\n root = Node.new(list[0], nil)\n list[1...list.length].each do |item|\n current_node = root\n while !item.nil?\n if item > current_node.value\n if current_node.right_child.nil?\n current_node.right_child = Node.new(item, current_node)\n item = nil\n else\n current_node = current_node.right_child\n end\n elsif item < current_node.value\n if current_node.left_child.nil?\n current_node.left_child = Node.new(item, current_node)\n item = nil\n else\n current_node = current_node.left_child\n end\n else\n item = nil\n end\n end\n end\n root\nend",
"def get_moves(start)\n x = start.x\n y = start.y\n moves = []\n moves << Node.new(x+2, y+1)\n moves << Node.new(x+2, y-1)\n moves << Node.new(x+1, y+2)\n moves << Node.new(x+1, y-2)\n moves << Node.new(x-1, y+2)\n moves << Node.new(x-1, y-2)\n moves << Node.new(x-2, y+1)\n moves << Node.new(x-2, y-1)\n moves = moves.reject do |node|\n node.x < 0 || node.x > 8\n end\n moves = moves.reject do |node|\n node.y < 0 || node.y > 8\n end\n moves.each { |move| move.next_node = start }\nend",
"def children\n # temp_dup[[i, j]] = @next_mover_mark # mark the board\n if @next_mover_mark == :x\n @next_mover_mark = :o\n bob = :x\n else\n @next_mover_mark = :x\n bob = :o\n end\n temp_dup = self.board.dup\n next_moves = []\n temp_dup.rows.each_with_index do |row, i|\n row.each_with_index do |col, j|\n # debugger\n if temp_dup.empty?([i, j])\n # next moes << tttn.new([board with mark placed on i,j], themark, prev_movepos)\n # next_moves << [i, j] \n \n temp_dup[[i, j]] = @next_mover_mark # mark the board\n \n \n next_moves << TicTacToeNode.new(temp_dup, @next_mover_mark, [i,j] )\n \n #temp_dup[[i, j]] = @next_mover_mark # mark the board\n \n end\n nil\n end\n end\n next_moves\n #returns nodes from all game states ???\n end",
"def calculate_left_child\n # Guard condition for movement not possible\n return nil if blank_x + 1 == size\n\n # Make the movement\n new_state = swap_left\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x + 1, blank_y)\n end",
"def build_tree(data, parent = nil)\n return if data.size.zero?\n center = half(data)\n value = data[center]\n @depth_first << value\n\n # Recusion to split halves until zero then execute logic\n build_tree(l_half = data[0...center], value)\n build_tree(r_half = data[center + 1..-1], value)\n\n # Node creation and set node properties\n l_child = l_half[half(l_half)]\n r_child = r_half[half(r_half)]\n Node.new(value, parent, l_child, r_child)\n end",
"def get_next_moves\n children = Array.new()\n new_move = @moves + 1\n @code.length.times do |i|\n move_up = Combination.new(next_code(i, :up), self, new_move)\n move_down = Combination.new(next_code(i, :down), self, new_move)\n children.push(move_down, move_up)\n end\n children\n end",
"def generate_tree\n root =\tTreeNode.new(3)\n root.left =\tTreeNode.new(9)\n right = \t\tTreeNode.new(20)\n right.left = \tTreeNode.new(15)\n right.right = TreeNode.new(7)\n root.right = \tright\n root\nend",
"def children\n moves = []\n (0..2).each do |row|\n (0..2).each do |col|\n if @board[row, col].empty?\n state = TicTacToeNode.new(@board.dup, next_mover_mark, prev_mov_pos = [row, col])\n state.board[row, col] = next_mover_mark\n state.swap_mark\n moves << state\n end\n end\n moves\n end\n\n def save_state\n end\n\n def swap_mark\n @next_mover_mark == :x ? :o : :x\n end\nend",
"def children\n\n # if winning_node(next_mover_mark)\n # end\n possible_moves = [self]\n #queue generation\n until possible_moves.empty?\n node = possible_moves.shift\n children_nodes = []\n self.board.rows.each_with_index do |row, i|\n row.each_with_index do |space, j|\n pos = [i,j]\n if self.board.empty?(pos)\n #self.board[pos] = @next_mover_mark\n children_nodes << TicTacToeNode.new(@board, next_mark, pos)\n end\n end\n end\n @children = children_nodes\n possible_moves += children_nodes\n end\n\n # until possible_moves.empty?\n # possible_moves.shift.children\n # end\n self\n end",
"def knights_moves(start, finish)\n board = create_board\n\n path = []\n queue = []\n\n queue << start\n\n loop do\n \tcurrent_node = board[queue[0][0]][queue[0][1]]\n\n current_node.moves.each do |node|\n unless node == start || board[node[0]][node[1]].parent != nil\n board[node[0]][node[1]].parent = queue[0] \n queue << node\n end\t\n end\n\n if queue.include? finish\n\n parent = board[finish[0]][finish[1]].parent\n path << parent\n\n loop do\n \tparent = board[parent[0]][parent[1]].parent\n \tbreak if parent == nil\n \tpath.unshift(parent)\n end\n\n path << finish\n break\n end\n\n \tqueue.shift\n end\n puts \"You can make it in #{path.length-1} steps!\"\n path\nend",
"def children\n out = [] \n (0..2).each do |row|\n (0..2).each do |col|\n pos = [row, col]\n out << next_move_node(pos) if @board.empty?(pos)\n end\n end\n out\n end",
"def generate_moves\n @delta.each do |step|\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n @move_list << new_pos if valid_coord?(new_pos)\n end\n end",
"def build_tree(data)\n @root = Node.new(data[0])\n data.shift\n data.each { |value| @root.insert(value) }\n end",
"def build\n\t\t\tfifo_q = Array.new\n\t\n\t\t\t# Set the failures for the nodes coming out of the root node.\n\t\t\t@root.get.each_pair do |item, node|\n\t\t\t\tnode.failure = @root\n\t\t\t\tfifo_q.push node\n\t\t\tend\n\n\t\t\t# Set the failures in breadth-first search order\n\t\t\t# using a FIFO queue. A failure identifies the deepest node\n\t\t\t# that is a proper suffix of the current node. \n\t\t\twhile !fifo_q.empty?\n\t\t\t\tp_node = fifo_q.shift\n\t\t\t\tif p_node.get\n\t\t\t\t\tp_node.get.each_pair do |item, node|\n\t\t\t\t\t\t# Push the current node onto the queue, so any child\n\t\t\t\t\t\t# nodes can be processed later.\n\t\t\t\t\t\tfifo_q.push node \n\t\t\t\t\t\n\t\t\t\t\t\tf_node = p_node.failure\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Follow the failures until we find a goto transition\n\t\t\t\t\t\t# or arrive back at the root node\n\t\t\t\t\t\twhile f_node.goto(item) == nil and !f_node.eql? @root\n\t\t\t\t\t\t\tf_node = f_node.failure\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif f_node.eql? @root and f_node.goto(item) == nil\n\t\t\t\t\t\t\tnode.failure = @root\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnode.failure = f_node.goto(item)\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\tnode.output = yield node.output, (node.failure).output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif node.output && (node.failure).output\n\t\t\t\t\t\t\t\t\tnode.output = node.output + (node.failure).output\n\t\t\t\t\t\t\t\telsif (node.failure).output\n\t\t\t\t\t\t\t\t\tnode.output = (node.failure).output\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tbuild_dfa if @type == :DFA\n\n\t\tend",
"def children\n new_next_mark = self.next_mover_mark\n if new_next_mark == :x\n new_next_mark = :o\n else\n new_next_mark = :x\n end\n positions = [ [0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1], [2,2] ]\n \n children = []\n \n positions.each do |pos|\n new_board = board.dup\n next if new_board[pos] != nil\n new_board[pos] = self.next_mover_mark \n children << TicTacToeNode.new(new_board, new_next_mark, pos) \n end\n children\n end",
"def knight_moves start, target\n raise StandardError.new(\"Invalid ending space\") if validate_space(target)\n root = Node.new(start, nil)\n target_acquired = nil\n queue = [root]\n return queue if root.position == target\n \n #build the structure to be searched\n puts \"I am right before the while loop\"\n while(!queue.empty? && !target_acquired)\n current = queue[0]\n potential_moves = get_possible_moves(current.position)\n potential_moves.each do |move|\n new_node = Node.new(move, current)\n current.children.push(new_node)\n queue.push(new_node)\n target_acquired = new_node if new_node.position == target\n puts \"FOUND IT MOFO\" if new_node.position == target\n end\n queue.shift\n end\n\n #search the structure, start with target node and go up parent\n current = target_acquired\n path = [current]\n while current.parent\n path.push(current.parent)\n current = current.parent\n end\n return path.reverse!\n end",
"def build_tree(inorder, postorder)\n return nil if inorder.empty?\n last_node_val = postorder.last\n last_node_index = inorder.index(last_node_val)\n node = TreeNode.new(last_node_val)\n \n if last_node_index > 0\n node.left = build_tree(inorder[0..last_node_index-1], postorder[0..last_node_index-1])\n end\n \n if last_node_index < inorder.length-1\n node.right = build_tree(inorder[last_node_index+1..-1], postorder[last_node_index..-2])\n end\n node\nend",
"def build_tree(array)\n first_node = Node.new(nil, nil, array[0])\n this_node = first_node\n i = 1\n\n finished = false\n while !finished\n if array[i] == nil\n finished = true\n elsif array[i] < this_node.data\n if this_node.left_child == nil\n this_node.left_child = Node.new(nil, nil, array[i])\n this_node = first_node\n i += 1\n else\n this_node = this_node.left_child\n end\n elsif array[i] > this_node.data\n if this_node.right_child == nil\n this_node.right_child = Node.new(nil, nil, array[i])\n this_node = first_node\n i += 1\n else\n this_node = this_node.right_child\n end \n elsif array[i] == this_node.data\n i += 1\n end\n end\n return first_node\nend",
"def draw_route\n # Delete all sprites in drawing of path\n if @arrow_path != nil\n @arrow_path.each{|a|\n a.dispose\n }\n end\n # Initialize variables\n @arrow_path = []\n return if @passed_positions.empty?\n start_pos = [@selected_unit.x, @selected_unit.y]\n new_pos = start_pos\n type = \"\"\n # Get direction from unit to first tile in path\n last_dir = case [@passed_positions[0].x - @selected_unit.x, @passed_positions[0].y - @selected_unit.y]\n when [0, 1] then 2\n when [-1,0] then 4\n when [1, 0] then 6\n when [0,-1] then 8\n end\n # Loop through path positions, evaluating two elements at a time\n for i in 0...@passed_positions.size\n p1 = @passed_positions[i]\n p1 = [p1.x, p1.y]\n p2 = (@passed_positions[i+1] == nil ? 0 : @passed_positions[i+1])\n if p2.is_a?(MoveTile)\n p2 = [p2.x, p2.y] \n # Figure out the direction taken to get from p1 to p2\n dir = [p2[0] - p1[0], p2[1] - p1[1]]\n dir = case dir\n when [0, 1] then 2\n when [-1,0] then 4\n when [1, 0] then 6\n when [0,-1] then 8\n end\n else\n dir = 0\n end\n # Evaluate the last direction taken to get to current spot\n case last_dir\n when 2\n new_pos[1] += 1\n case dir\n when 0 then type = \"d\"\n when 2 then type = \"v\"\n when 4 then type = \"ru\"\n when 6 then type = \"lu\"\n end\n when 4\n new_pos[0] -= 1\n case dir\n when 0 then type = \"l\"\n when 2 then type = \"ld\"\n when 4 then type = \"h\"\n when 8 then type = \"lu\"\n end\n when 6\n new_pos[0] += 1\n case dir\n when 0 then type = \"r\"\n when 2 then type = \"rd\"\n when 6 then type = \"h\"\n when 8 then type = \"ru\"\n end\n when 8\n new_pos[1] -= 1\n case dir\n when 0 then type = \"u\"\n when 4 then type = \"rd\"\n when 6 then type = \"ld\"\n when 8 then type = \"v\"\n end\n end\n last_dir = dir\n @arrow_path.push(Arrow_Sprite.new(@arrows_viewport, type, new_pos))\n end\n end",
"def find_path(end_pos)\n path = [@root_node]\n valid_moves = KnightPathFinder.valid_moves(@root_node)\n valid_moves.each do |move|\n @move_tree.add_child(move)\n end\n \n if @move_tree.bfs(end_pos) == end_pos\n path << end_pos\n else \n end\n\n end",
"def get_move\n #puts \"get_move for #{self}\"\n return [] if goal == nil or goal == []\n while(1)\n rv = []\n g = goal.shift\n return [] if g == nil\n puts g.join('---')\n case g[0]\n when KILL\n e = g[1] # get the ennemy\n if(not $map.exists?(e) or e.life<=0)\n puts 'this ant does not exists anymore or is dead, next goal'\n next \n end\n \n dist = distance(self,e)\n #puts \"I am #{self}\"\n #puts \"goal: kill this enneny: #{e}\"\n i = 0\n if dist > 1 # move\n # by doing this we are finding subgoals\n # TODO: add_sub_goal ?\n\n path = find_best_way(e.x,e.y)# we have to move next to it\n #puts ppath(path)\n if path==nil\n # TODO: no path, find something else to do\n puts 'no path ! , next goal'\n next\n end\n \n # we have a path to it\n # so now we have to move smartly\n # if we are at 3 cases, we can move and attack\n # more than that we have to move at 4 cases and wait the next turn\n # TODO: do not wait at a position where we can be attacked\n if(path.size-2 <= 3) # minus two because the path include our case\n i = path.size-2 # 0 based minus one, so -2 \n #puts 's1'\n elsif(path.size-2 >= 6) # we are far away\n i = 6\n #puts 's2'\n else\n i = (path.size-2)\n #puts 's3'\n end\n #puts i\n #sleep(1)\n if i <= 0\n puts \"i <= 0 (#{i}), #{ppath(path)}\"\n sleep(5)\n else\n a,b = path[i][0]\n #puts \"I am moving to (#{[a,b].join(',')})\"\n self.x,self.y = a,b\n rv << \"Cb#{object_id}~\"+[a,b].pack('cc')\n #puts x\n end\n end\n return rv if i > 3 # return if we can not attack at the same round\n #puts i\n dist = distance(self,e)\n if dist == 1\n puts 'Attack'\n rv << \"Cc#{object_id}~#{e.object_id}\"\n e.life -= 5\n end\n return rv\n else\n puts 'unknown goal, next goal'\n end # case\n end #while\n puts \"no goal ? find something else to do !\"\n rv\n end",
"def build_tree(array)\n\t\t@root = Node.new(array[0])\n\t\ttemp_root = @root\n\n\t\tarray[1..-1].each do |node_value|\n\t\t\tinsert_node(node_value, temp_root)\n\t\tend\n\tend",
"def build_tree(piece, finish, space = piece.space, board = self)\n piece.class == Queen ? space.find_adjacent_queen(board, finish, piece) : space.find_adjacent(board, piece)\n @searched << space\n return space if space == finish\n\n space.adjacent.each { |square| @queue << square }\n build_tree(piece, finish, @queue.shift)\n end",
"def knight_moves(initial, final)\n @board.check_impossible_move(initial, final)\n\n search_queue = [Vertex.new(initial)]\n\n until search_queue.empty?\n test_vertex = search_queue.shift\n\n return show_path(make_path(test_vertex)) if test_vertex.value == final\n \n @board.possible_moves(test_vertex.value).each do |move|\n new_vertex = Vertex.new(move)\n new_vertex.parent = test_vertex\n test_vertex.children << move\n search_queue << new_vertex\n end \n\n end\n \"No path was found :(\"\n end",
"def children\n next_move_arr = []\n\n (0...3).each do |r|\n (0...3).each do |c|\n if board.empty?([r,c])\n new_board = board.dup\n new_board[[r,c]] = next_mover_mark\n next_mover_mark == :o ? next_mark = :x : next_mark = :o\n node = TicTacToeNode.new(new_board, next_mark, [r,c])\n next_move_arr << node\n end\n end\n end\n next_move_arr\n end",
"def build_tree array\n\t\t@root = Node.new array[0]\n\t\t@nodes += 1\n\t\tarray[1..-1].each do |var|\n\t\t\tinsert(@root,var)\n\t\tend\n\tend",
"def initialize(pos)\n @position = pos\n @grid = Array.new(8){Array.new(8)}\n populate_grid\n @visited_positions = [pos]\n @move_tree = build_move_tree\n end",
"def build_tree(arr)\n\tend",
"def make_tree(pre, inord)\n return if pre.size == 0\n root_node = Node.new(pre[0])\n idx = inord.index(pre[0])\n root_node.left = make_tree(pre[1..idx], inord[0...idx])\n root_node.right = make_tree(pre[idx+1...pre.size], inord[idx+1...inord.size])\n return root_node\nend",
"def build_tree(preorder, inorder)\n return nil if preorder.empty? || inorder.empty?\n \n root = TreeNode.new(preorder.first)\n idx = inorder.find_index(preorder.first)\n preorder.shift\n\n root.left = build_tree(preorder, inorder.slice(0..(idx-1))) unless idx==0\n root.right = build_tree(preorder, inorder.slice((idx+1)..-1)) if idx!=inorder.size-1\n \n return root\nend",
"def draw_route\n # Delete all sprites in drawing of path\n @arrow_path.each{|a| a.dispose}\n @arrow_path = []\n \n return if @passed_positions.empty?\n start_pos = [@unit.x, @unit.y]\n new_pos = start_pos\n type = \"\"\n # Get direction from unit to first tile in path\n last_dir = case [@passed_positions[0].x - @unit.x, @passed_positions[0].y - @unit.y]\n when [0, 1] then 2\n when [-1,0] then 4\n when [1, 0] then 6\n when [0,-1] then 8\n end\n # Loop through path positions, evaluating two elements at a time\n for i in 0...@passed_positions.size\n p1 = @passed_positions[i]\n p1 = [p1.x, p1.y]\n p2 = (@passed_positions[i+1] == nil ? 0 : @passed_positions[i+1])\n if p2.is_a?(MoveTile)\n p2 = [p2.x, p2.y] \n # Figure out the direction taken to get from p1 to p2\n dir = [p2[0] - p1[0], p2[1] - p1[1]]\n dir = case dir\n when [0, 1] then 2\n when [-1,0] then 4\n when [1, 0] then 6\n when [0,-1] then 8\n end\n else\n dir = 0\n end\n # Evaluate the last direction taken to get to current spot\n case last_dir\n when 2\n new_pos[1] += 1\n type = case dir\n when 0 then \"d\"\n when 2 then \"v\"\n when 4 then \"ru\"\n when 6 then \"lu\"\n end\n when 4\n new_pos[0] -= 1\n type = case dir\n when 0 then \"l\"\n when 2 then \"ld\"\n when 4 then \"h\"\n when 8 then \"lu\"\n end\n when 6\n new_pos[0] += 1\n type = case dir\n when 0 then \"r\"\n when 2 then \"rd\"\n when 6 then \"h\"\n when 8 then \"ru\"\n end\n when 8\n new_pos[1] -= 1\n type = case dir\n when 0 then \"u\"\n when 4 then \"rd\"\n when 6 then \"ld\"\n when 8 then \"v\"\n end\n end\n last_dir = dir\n @arrow_path.push(Arrow_Sprite.new($spriteset.viewport1, type, new_pos))\n end\n end",
"def build_tree(arr)\n #take array, turn into bt with node objs\n return nil if arr.empty?\n\n mid = (arr.size - 1)/2\n current_node = Node.new(arr[mid])\n\n current_node.left = build_tree(arr[0...mid])\n current_node.right = build_tree(arr[(mid+1)..-1])\n \n current_node\n end",
"def move(all_units)\n all_units.each do |char|\n next unless char.alive\n\n targets = []\n\n queue = []\n queue.push([1, char.pos])\n\n distances = Hash.new\n previous = Hash.new\n\n while queue.length > 0\n curr = queue.shift\n # puts \"Q: #{curr[0]} POS: #{curr[1]}\"\n new_round = curr[0] + 1\n next if targets.length > 0 # Skip branches if we've found targets.\n\n DIRS.each do |dir| # For each potential neighbor...\n f_pos = curr[1] + dir\n # puts \"\\tCHECKING: #{f_pos} LINE: #{LINES[f_pos[0]][f_pos[1]]}\"\n if LINES[f_pos[0]][f_pos[1]] == '.' # Check map for wall\n skip_add = false\n all_units.each do |check|\n next if check == char || !check.alive\n if check.pos == f_pos\n if char.type != check.type # If enemy...\n # targets.push([check, curr[2]]) # Using state path\n targets.push([check, curr[0], curr[1]]) # Using previous hash\n end\n skip_add = true # Can't walk through units.\n end\n end\n # puts \"\\tSKIP CHECK: #{skip_add} PAST: #{curr[2]} EXISTS: #{curr[2].include?(f_pos)}\"\n # if !skip_add && !curr[2].include?(f_pos)\n # # puts \"\\tADDING: #{f_pos}\"\n # new_path = Marshal.load(Marshal.dump(curr[2]))\n # not_queued = queue.index {|q| q[1] == f_pos}.nil?\n # queue.push([new_round, f_pos, new_path.push(f_pos)]) if not_queued\n # end\n if (!skip_add && (distances[f_pos].nil? || new_round < distances[f_pos]))\n distances[f_pos] = new_round\n previous[f_pos] = curr[1]\n queue.push([new_round, f_pos])\n end\n end\n end\n end\n\n targets.each_with_index do |target, i|\n # puts \"#{char} #{i}: #{target[0]} PATH:#{target[1]}\"\n # puts \"#{char} #{i}: #{target[0]} NUM_STEPS:#{target[1]}\"\n end\n if targets.length > 0\n # Move\n nearest_target = targets[0] # Only interested in nearest enemy.\n # if nearest_target[1].length > 1 # More than 1 step away?\n # char.pos = nearest_target[1][1] # Step towards nearest enemy.\n # end\n if nearest_target[1] > 1 # More than 1 step away?\n next_pos = nearest_target[2]\n next_pos = previous[next_pos] while previous[next_pos] != char.pos\n # char.pos = nearest_target[1][1] # Step towards nearest enemy.\n # puts \"#{char} GOES TO #{next_pos}\"\n char.pos = next_pos # Step towards nearest enemy.\n end\n\n d_to_closest = (nearest_target[0].pos - char.pos).to_a.collect!{|v| v.abs}.sum\n # puts \"\\tC:#{char} T:#{nearest_target[0]} D_TO_T: #{d_to_closest}\"\n if d_to_closest == 1 # In melee range!\n targets_by_hp = targets.select {|t| (t[0].pos - char.pos).to_a.collect!{|t| t.abs}.sum == 1}.sort_by {|t| t[0].hp}\n target = targets_by_hp[0] # Lowest hp in melee range.\n target[0].hp -= char.attack\n # puts \"#{char} HITS #{target[0]}\"\n\n if target[0].hp <= 0\n puts \"#{char} KILLS #{target[0]}\"\n target[0].hp = 0\n target[0].alive = false\n end\n end\n else\n all_alive = all_units.select {|unit| unit.alive }\n all_elves = all_alive.select {|unit| unit.type == 'E'}\n return false if all_elves.length == 0 || all_elves.length == all_alive.length\n end\n end\n\n return true\nend",
"def build_tree_rec(preorder, inorder)\n if inorder.length != 0\n original = preorder.shift\n ind = inorder.index(original)\n root = TreeNode.new(inorder[ind])\n root.left = build_tree(preorder, inorder[0...ind])\n root.right = build_tree(preorder, inorder[ind + 1..-1])\n root\n end\nend",
"def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend",
"def build_tree(array)\n tree = TreeNode.new(array[0], 0)\n (1..array.length-1).each {|i|\n insert_into_tree(tree, array[i], i)\n }\n tree\nend",
"def build_tree_unsorted(arr)\n root = nil\n arr.each do |item|\n root = insert_tree(item, root)\n end\n\n root\nend",
"def build_tree array\n\t\t@root = Node.new(array.shift)\n\t\tparent = @root\n\t\tarray.each do |el|\n\t\t\twhile true\n\t\t\t\tif el <= parent.value\n\t\t\t\t\tif parent.left_child.nil?\n\t\t\t\t\t\tparent.left_child = Node.new(el,parent)\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tparent = parent.left_child\n\t\t\t\t\tend\n\t\t\t\telsif el > parent.value\n\t\t\t\t\tif parent.right_child.nil?\n\t\t\t\t\t\tparent.right_child = Node.new(el,parent)\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tparent = parent.right_child\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def build_tree_arbitrary(arr)\n node = Node.new(arr[0])\n queue = [node]\n @root = node\n i = 0\n\n until queue.empty?\n node = queue.shift\n children = node_children(node, i, arr)\n queue.concat(children)\n i += 2\n end\n end",
"def draw_tree(pen, length)\n\tangle = 20\n\tmin_length = 4\n\tshrink_rate = 0.7\n\treturn if length < min_length\n\tpen.move length\n\tpen.turn_left angle\n\tdraw_tree pen, length * shrink_rate\n\tpen.turn_right angle * 2\n\tdraw_tree pen, length * shrink_rate\n\tpen.turn_left angle\n\tpen.move -length\nend",
"def build_graph\n @matrix.each_with_index do |row, x|\n row.each_with_index do |move, y|\n move = Coordinate.new(x,y)\n @matrix[x][y] = possible_moves(move)\n end\n end\n\tend",
"def setup\n size(800, 200)\n new_tree\nend",
"def calculate_up_child\n # Guard condition for movement not possible\n return nil if blank_y + 1 == size\n\n # Make the movement\n new_state = swap_up\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x, blank_y + 1)\n end",
"def initialize (starting_pos)\n # @starting_pos = starting_pos\n @root_node = PolyTreeNode.new(starting_pos)\n # kpf = KnightPathFinder.new([0, 0])\n @used_pos = [starting_pos]\n end",
"def next_game_trees\n return @next_game_trees unless @next_game_trees.nil?\n\n moves = @board.available_moves\n\n @next_game_trees = moves.each_with_object([]) { |move, game_trees| add_game_trees(game_trees, move) }\n\n @next_game_trees\n end",
"def children\n positions = []\n\n (0..2).to_a.each do |row|\n (0..2).to_a.each do |col|\n if @board.empty?([row,col])\n dup_board = @board.dup\n dup_board.[]=([row,col], next_mover_mark)\n\n if @next_mover_mark == :x\n new_next_mover_mark = :o\n else\n new_next_mover_mark = :x\n end\n\n new_prev_move_pos = [row,col]\n positions << TicTacToeNode.new(dup_board, new_next_mover_mark, new_prev_move_pos)\n end\n end\n end\n\n positions\n end",
"def find_all_moves\n stack = []\n stack << @initial_move\n until stack.empty?\n current_node = stack.shift\n calc_move(current_node)\n stack << current_node.children\n stack.flatten!\n end\n end",
"def children\n pos_positions = all_positions.select { |pos| @board[pos].nil? }\n mark = switch_mark\n moves = []\n\n pos_positions.each do |pos|\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n moves << TicTacToeNode.new(new_board, mark, pos)\n end\n\n moves\n end",
"def children\n empty_pos = []\n (0..2).each do |row_i|\n (0..2).each do |col_i|\n pos =[row_i,col_i]\n empty_pos << pos if @board.empty?(pos) \n end\n end\n empty_pos.map do |pos|\n next_mark = (@next_mover_mark == :x ? :o : :x)\n new_node = TicTacToeNode.new(@board.dup,next_mark,pos) \n new_node.board[pos] = @next_mover_mark\n new_node\n end\n end",
"def custom_tree\n\t\t#if they haven't made a shrink range/trunk yet, make one for them\n\t\tif $shrink_range.empty?\n\t\t\t$shrink_Range = (4..6).to_a\n\t\tend\n\t\tif $trunk.empty?\n\t\t\t$trunk = (175..250).to_a\n\t\tend\n\t\t\n\t\t@shrink = \"0.#{$shrink_range[0]}\".to_f\n\t\t#Height is 600, so y is in (0,600)\n\t\t$angle_of_separation = (@window.mouse_y / 10).to_i #this gives max of 60 degree angle, min of 0 (line)\n\t\t\n\t\t@branches = []\n\t\t@branches << [ [[@x, Height - @bot_margin], [@x, Height - $trunk[0]]] ]\n\t\t#Width is 800, so x is in (0,800)\n\t\t$num_splits = (((@window.mouse_x) / 100).to_i)+2 #this gives max of 8+2=10 splits, min of 2\n\t\t\n\t\tputs \"This output is from Custom Tree\"\n\t\tputs \"Number of splits: #{$num_splits}\"\t\n\t\tputs \"Angle of separation: #{$angle_of_separation}\"\n\t\tputs \"Shrink range: #{$shrink_range[0]} to #{$shrink_range[$shrink_range.length-1]}\"\n\t\tputs \"Split range: #{$split_range}\"\t\t\n\t\tputs \"Initial branch length: #{$trunk[0]} to #{$trunk[$trunk.length-1]}\"\n\t end",
"def find_path(start, target)\n node = build_path(start, target)\n path = [node]\n until node.next_node.nil? do\n node = node.next_node\n path.push(node)\n end\n path = path.reverse\n puts \"You made it in #{path.length} moves. Here is your path: \"\n path.each do |node|\n puts \"[#{node.x}], [#{node.y}]\"\n end\nend",
"def build_tree_rec(inorder, postorder)\n if inorder.length != 0\n original = postorder.pop\n ind = inorder.index(original)\n root = TreeNode.new(inorder[ind])\n root.right = build_tree(inorder[ind + 1..-1], postorder)\n root.left = build_tree(inorder[0...ind], postorder)\n root\n end\nend",
"def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end",
"def move\n @position.shift unless @growing\n case @direction\n when 'down'\n @position.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @position.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @position.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @position.push(new_coords(head[0] + 1, head[1]))\n end\n @growing = @turned = false\n end",
"def make_children(depth_layer)\n @childless.each do |node|\n coords = generate_children_coordinates(node.x, node.y)\n coords.each do |x,y|\n child = Move.new(x,y,depth_layer,[],node)\n node.children ||= []\n node.children << child\n @node_count += 1\n end\n end\n #generate coordinates for children\n #creates child nodes with child coordinates, appropriate depth attribute, appropriate parent node attribute)\n end",
"def state_text heap, store\n ret = \"\\\\begin{tikzpicture}\"\n ret += \"[->,>=triangle 45,auto,semithick,node distance=2.0cm]\\n\"\n first_var = nil\n last_var = nil\n # Build store\n store.each do |var, val|\n pos_text = \" \"\n if first_var\n pos_text = \"[right of=#{last_var}]\"\n else\n first_var = var\n end\n last_var = var\n ret += \" \\\\node[var] (#{var}) #{pos_text} \"\n ret += \"{\\\\il{#{var}} \\\\nodepart{lower} #{val}};\\n\"\n end\n first_add = nil\n last_add = nil\n # Build heap\n heap.each do |add, val|\n pos_text = \" \"\n if first_add\n pos_text = \"[right of=#{last_add}]\"\n else\n first_add = add\n if first_var\n pos_text = \"[below of=#{first_var}]\"\n end\n end\n last_add = add\n ret += \" \\\\node[hea] (#{add}) #{pos_text} \"\n ret += \"{\\\\il{#{add}} \\\\nodepart{second} #{val}};\\n\"\n end\n # Draw pointers\n store.each do |s_var, s_val|\n heap.each do |h_add, h_val|\n if s_val == h_add\n ret += \" \\\\path (#{s_var}) edge node {} (#{h_add});\\n\"\n end\n end\n end\n ret += \"\\\\end{tikzpicture}\\n\"\n ret\nend",
"def children\n next_moves = []\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n if self.board[pos].nil?\n new_board = self.board.dup\n new_board[pos] = self.next_mover_mark\n next_mark = ((self.next_mover_mark == :x) ? :o : :x)\n\n next_move = TicTacToeNode.new(new_board, next_mark, pos)\n next_moves << next_move\n end\n end\n end\n next_moves\n\n end",
"def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @board[new_pos]\n else\n break\n end\n end\n end\n end",
"def structure_reform(curNode, addNode)\n # reset branches for reform\n @branches = []\n @branch_count = 0\n # puts 'before cleanup'\n # lNode.print_tree\n # rNode.print_tree\n # rNode.print_tree\n # remove_PH_node(lNode)\n # remove_PH_node(rNode)\n # remove_PH_node(curNode)\n # puts 'after cleanup'\n # curNode.print_tree\n # addNode.print_tree\n # rNode.print_tree\n curChildren = curNode.children.count == 0 ? [curNode] : curNode.children\n addChildren = addNode.children.count == 0 ? [addNode] : addNode.children\n count = 0\n # p 'lnode'\n # pp lChildren\n # p 'rnode'\n curChildren.each do |ln|\n curNode.remove!(ln)\n addChildren.each do |rn|\n # p '--------------'\n # p 'ln'\n # ln.print_tree\n # p 'rn'\n # rn.print_tree\n # binding.pry\n # phName=\"PH#{@branch_count}\"\n # ph =Tree::TreeNode.new(phName, '')\n ln_append = ln.detached_subtree_copy\n # p 'ln_append before'\n # ln_append.print_tree\n append_to_end(ln_append, rn)\n # p 'ln_append'\n # ln_append.print_tree\n # ph<<ln_append #unless curNode==newNode\n ln_append = add_branch(ln_append)\n # p 'ln_append after'\n # ln_append.print_tree\n curNode << ln_append\n # p 'ph'\n # ph.print_tree\n # p 'curNode'\n # curNode.print_tree\n end\n end\n end",
"def reconstruct_bst_from_traversal(pre_order)\n reconstruct_bst_rec(0, pre_order.length - 1, pre_order)\nend",
"def build_tree(array)\n\t\t@root = Node.new(array.shift)\n\t\tarray.each { |value| add_node(value, @root)}\n\tend",
"def construct_solution\n path = [@root]\n tabu_list = [@root]\n until @ends.include?(last = path.last)\n step = next_step last, tabu_list\n path << step\n end\n path\n end",
"def breadthTraversal(path, parent = nil)\n\t@jobs.push Job.new(path, parent)\n\n\twhile not @jobs.empty?\n\t\tbtraverse(@jobs.pop)\n\tend\nend",
"def children\n# debugger\n open_positions = []\n children = []\n @board.rows.each_index do |i|\n (0..2).each do |j|\n open_positions << [i, j] if @board.rows[i][j] == nil\n end\n end\n open_positions.each do |pos|\n new_board = @board.rows.dup\n child_board = Board.new(new_board)\n child_board[pos] = next_mover_mark\n new_mark = next_mover_mark\n new_mark == :x ? new_mark = :o : new_mark = :x\n children << TicTacToeNode.new(new_board, new_mark, prev_move_pos =)\n end\n return children \n end",
"def moves\n pos = self.current_position\n moves = []\n move_dirs.each do |arr|\n @current_position = pos\n loop do\n @current_position = [@current_position[0] + arr[0], @current_position[1] + arr[1]]\n break if [@current_position[0], @current_position[1]].any? { |val| val < 0 || val > 7 }\n if board.pos_occupied?(@current_position)\n if @board[@current_position].color == self.color\n break\n else\n moves << @current_position\n break\n end\n moves << @current_position\n end\n moves << @current_position\n end\n end\n moves\n end"
] |
[
"0.9175775",
"0.9000952",
"0.8862723",
"0.8755282",
"0.8581117",
"0.85265106",
"0.8458384",
"0.84568965",
"0.8361926",
"0.7860596",
"0.7157782",
"0.714767",
"0.7035436",
"0.7018894",
"0.67968047",
"0.6691939",
"0.6674388",
"0.66083485",
"0.643518",
"0.6339106",
"0.6309171",
"0.62325513",
"0.62290615",
"0.61913747",
"0.61854714",
"0.6177236",
"0.61526203",
"0.6138786",
"0.6113876",
"0.6075668",
"0.597244",
"0.5941686",
"0.5911887",
"0.58855516",
"0.58738065",
"0.58709466",
"0.5848942",
"0.58477116",
"0.5839844",
"0.5829949",
"0.5792511",
"0.57901186",
"0.5780872",
"0.5769529",
"0.57615703",
"0.5760596",
"0.575415",
"0.57531255",
"0.57529914",
"0.5742817",
"0.57215554",
"0.5711265",
"0.57111096",
"0.57107455",
"0.5709216",
"0.57071996",
"0.5702393",
"0.56892043",
"0.56819606",
"0.56785274",
"0.5674002",
"0.5664093",
"0.5656321",
"0.5655136",
"0.5648783",
"0.5642938",
"0.5630782",
"0.5622123",
"0.56069344",
"0.5605568",
"0.5603449",
"0.5589395",
"0.5589199",
"0.5586865",
"0.5577478",
"0.55766505",
"0.5576335",
"0.5574327",
"0.5573883",
"0.55666745",
"0.5565033",
"0.5563868",
"0.55487275",
"0.55474263",
"0.5546893",
"0.55410564",
"0.55387056",
"0.55345154",
"0.5533666",
"0.5533665",
"0.5524031",
"0.55227077",
"0.5510145",
"0.5508516",
"0.55079883",
"0.5505378",
"0.5502621",
"0.5501562",
"0.5498456",
"0.5492823",
"0.5486952"
] |
0.0
|
-1
|
Each subarray will have strings which are anagrams of each other Time Complexity: O(w n^2) ? THINKING.... Iterating through the string = O(n), summing each word = O(w); O(n w) checking for the word's sum in the hash and shovel onto array = O(1) returning the hash values = O(n) b/c if no words are anagrams, our hash would be the same size as the original array. Space Complexity: O(n); The hash ends up being the same size as the string/input size.
|
def grouped_anagrams(strings)
return strings if strings.empty?
anagrams = {}
# for each word, if the sum is in the hash
strings.each do |word|
if anagrams[word.sum].nil?
anagrams[word.sum] = [word]
else
anagrams[word.sum] << word
end
end
return anagrams.values
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def combine_anagrams(words)\r\n big_array = Array.new\r\n hash = Hash.new(0)\r\n words.each do |w| \r\n array = Array.new\r\n array = w.downcase.split(//)\r\n if hash.has_key?(array.sort) \r\n hash[array.sort]=hash[array.sort].push(w)\r\n else\r\n hash[array.sort]=Array.[](w)\r\n end\r\n end\r\n hash.each { |key,value| big_array.push(value) }\r\n big_array\r\nend",
"def grouped_anagrams(strings)\n string_hash = {}\n\n strings.each do |string|\n key = string.split(\"\").sort.join # probably an O(n log n) operation, I couldn't find an integer based hashing function i liked\n\n string_hash[key] ||= [] # trying this thing out\n string_hash[key] << string\n end\n \n return string_hash.values # also probably an O(n) operation\nend",
"def anagrams(array_of_words)\n ana_hash = Hash.new { |hash, key| hash[key] = [] }\n array_of_words.each { |word| ana_hash[word.split(\"\").sort.join] << word }\n ana_hash.map { |key, list| list }.select { |list| list.size > 1 }\nend",
"def grouped_anagrams(strings)\n hash = {}\n acc = 0\n return_array = []\n strings.each do |str|\n if !(hash[str.split(//).sort!.join().hash])\n hash[str.split(//).sort!.join().hash] = acc\n return_array[acc] = [str]\n acc += 1\n else\n return_array[hash[str.split(//).sort!.join().hash]] << str\n end\n end\n return return_array\nend",
"def anagram_hash(input)\n list = {} # empty hash\n input.each do |word| # iterates over each word in the array\n add_word = word.chars.sort.join # sorts the anagrams\n list[add_word] ||= []\n list[add_word] << word\n end\n # list of all anagrams and words\n list.values\nend",
"def grouped_anagrams(strings)\n\n new_hash = Hash.new()\n\n strings.each do |word|\n # calculate the hash key\n key_word = word.downcase.chars.sort.join\n\n if new_hash[key_word] == nil\n new_hash[key_word] = []\n end\n array_value = new_hash[key_word]\n\n length = array_value.length\n array_value[length] = word\n end\n\n return new_hash.values\nend",
"def grouped_anagrams(strings)\n hash_ana = {}\n outerArray = []\n\n # The way I identify they are anagrams is using bytes to get the ASCII value of each char sum them,\n # Then we know all the characters have the same letter on it.\n strings.each do |string|\n if hash_ana[string.bytes.sum]\n hash_ana[string.bytes.sum].push(string)\n else\n hash_ana[string.bytes.sum] = [string]\n end\n end\n\n hash_ana.each do |key|\n outerArray << key[1]\n end\n\n return outerArray\nend",
"def combine_anagrams(wordArray)\n \n \n sortedCharsHash = Hash.new\n groupedArray = Array.new\n n = 0\n \n wordArray.each do |word|\n \n #if freq hash not in freq hash array, put in there and add to grouped array\n #if freq hash in freq hash array, iterate through items until match and put in there\n \n sortedChars = word.downcase.split(//).sort.join\n if sortedCharsHash[sortedChars]\n groupedArray[sortedCharsHash[sortedChars].to_i] << word\n else\n sortedCharsHash[sortedChars] = n\n n = n +1\n groupedArray << [word]\n end\n end\n \n return groupedArray\n \n \nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n\n anagram_hash = Hash.new()\n strings.each do |string|\n word_array = string.split(\"\").sort\n if anagram_hash.include?(word_array)\n anagram_hash[word_array] << string\n else\n anagram_hash[word_array] = [string]\n end\n end\n\n result = []\n anagram_hash.each do |key, value|\n result << value\n end\n return result\n\nend",
"def my_anagram(type_array) \n #Create Hash container\n storage_hash = {} \n #Take given array argument and opperate on each element.\n #Anagrams are words that can be spelled using the same letters. Order inmaterial. \n\n #Split text into Array / Sort String.split(\"\") Array using Array.sort. / String.join \n #Iterate over array input\n\n type_array.each do |word|\n word_sorted = word.split(\"\").sort.join\n #Check to see if word sorted is already in container (storage_array)\n if storage_hash.has_key?(word_sorted)\n storage_hash[word_sorted].push(word)\n else\n #add the new unique storage key\n storage_hash[word_sorted] = [word]\n end\n end\n #Iterate threw your storage and print results\n storage_hash.each do |key, value|\n puts \"---#{key}----\"\n p value\n end\nend",
"def combine_anagrams(words)\n hash = {}\n words.each do |str|\n sorted = str.chars.sort { |a, b| a.casecmp(b) } .join\n down = sorted.downcase\n if (hash[down]== nil)\n hash[down] = Array.new\n end\n arr = hash[down]\n arr[arr.length] = str\n hash[down] = arr\n# puts \"[sorted] is \\\"\" + sorted + \",\\\" and hash[sorted] is \" + hash[sorted].inspect\n arr = nil\n end\n hash.values\nend",
"def grouped_anagrams(strings)\n\n hash = {}\n\n # take each word in 'strings' array ...\n strings.each do |word|\n # ... and split it into letters, alphabetize those letters, and join them back together: this produces a standardized string for words that are anagrams of each other ('ate', 'eat' => 'aet')\n letters = word.split(//).sort().join()\n \n # if the standardized string isn't already in the hash, add it as the key and an empty array as the value\n if hash[letters].nil?\n hash[letters] = []\n end\n\n # push the word to the array for the associated standardized string\n hash[letters] << word\n\n end\n\n # return the values (array of words that are anagrams) for each standardized string\n return hash.values\n\nend",
"def anagrams(string, array)\nend",
"def anagram(words)\n words_hash = {}\n\n words_hash = words.each_with_object(Hash.new []) do |word, hash|\n hash[word.chars.sort] += [word]\n end\n\n words_array = words_hash.flatten\n final_hash = []\n\n words_array.each_index do |index|\n final_hash << words_array[index] if index.odd?\n end\n\n return final_hash\nend",
"def grouped_anagrams(strings)\n # create an anagrams hash of arrays\n anagrams = {}\n # for each string, split the characters and sort them\n # join the characers, and test the hash keys\n # if the key already exists add it to the array of that key\n # if not create one\n strings.each do |word| \n sorted_word = word.split(//).sort.join\n if anagrams[sorted_word]\n anagrams[sorted_word] << word\n else\n anagrams[sorted_word] = [word]\n end\n end\n \n # return the arrays\n anagrams.values\nend",
"def group_anagrams(arr)\n hash = Hash.new { |h, k| h[k] = [] }\n arr.each do |str|\n hash[str.chars.sort] << str\n end\n\n hash.values.map(&:sort)\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n\n #create empty hash\n hash = {}\n strings.each do |word|\n alphabet = word.chars.sort.join\n if !hash[alphabet]\n hash[alphabet]\n else\n hash[alphabet] = [word]\n end\n end\nend",
"def grouped_anagrams(strings)\n # edge cases\n return [] if strings.empty?\n return [[strings[0]]] if strings.size == 1\n # a hash is going to have hashes with letters as a key, and array of words\n # containing those letters as values\n anagrams_storage = {}\n strings.each do |word|\n # create a hash with letters as keys and a number of times it appears in that word as values\n letters = {}\n word.chars.each do |char|\n if letters[char]\n letters[char] += 1\n else\n letters[char] = 1\n end\n end\n # we freeze the hash as a key because it's recommended not to have mutable data structures as keys\n letters = letters.freeze\n # check if there is a hash equal to this newly created one.\n # checks key-value pairs, not their order\n if !anagrams_storage[letters]\n anagrams_storage[letters] = Array.new\n anagrams_storage[letters] << word\n else\n anagrams_storage[letters] << word\n end\n end\n # as a result we have \n # { {\"t\"=>1,\"a\"=>1,\"n\"=>1} => [\"tan\", \"nat\", \"ant\"], \"b\"=>1,\"a\"=>1,\"t\"=>1} => [\"bat\"] }\n return anagrams_storage.values\nend",
"def grouped_anagrams(strings)\n hash_map = {}\n \n strings.each do |str| #n\n chars = str.chars #k length of string\n sorted = chars.sort # k log(k)\n hash_map[sorted] ? hash_map[sorted].push(str) : hash_map[sorted] = [].push(str)\n end\n \n return hash_map.values\nend",
"def grouped_anagrams(strings)\n return [] if strings.length == 0\n\n result = []\n hash = {}\n count = 0\n\n strings.each do |string|\n sorted_string = string.chars.sort.join\n\n if hash[sorted_string] \n result[hash[sorted_string]].push(string)\n else\n hash[sorted_string] = count\n result.push([string])\n count += 1\n end\n end\n\n return result\nend",
"def grouped_anagrams(strings)\n return [] if strings.length == 0\n \n hash = {}\n strings.each do |word|\n sorted_word = word.split(\"\").sort\n if hash[sorted_word]\n hash[sorted_word] << word\n end\n end\n final_anagrams = []\n hash.each do |k, v|\n anagrams << v\n end\n return final_anagrams\nend",
"def combine_anagrams(words)\n #h=Hash.new(0)\n output = Array.new\n words.map{|word| word.chars.sort.join }.uniq.each {|anagram|\n w = words.partition { |word| word.chars.sort.join==anagram}\n# puts \"w : \" + w.to_s\n output += [w[0]]\n# puts \"output : \" + output.to_s\n }\n return output\nend",
"def combine_anagrams(words)\n\thashes = Hash.new(0)\n\twords.each do |x|\n\t\talpha_word = x.downcase.chars.sort.join\n\n\t\tif hashes[alpha_word] == 0\n\t\t\thashes[alpha_word] = [x]\n\t\telse\n\t\t\thashes[alpha_word] = hashes[alpha_word] << x\n\t\tend\n\tend\n\toutArray = Array.new\n\thashes.each do |key, value|\n\t\toutArray << value\n\tend\n\t\n\treturn outArray\nend",
"def grouped_anagrams(strings)\n\n string_hash = {}\n\n strings.each do |string|\n \n temp = string.chars.sort.join\n if string_hash.has_key?(temp)\n string_hash[temp] << string\n else\n string_hash[temp] = Array.new()\n string_hash[temp] << string\n end\n \n end\n return string_hash.values\n\nend",
"def grouped_anagrams(strings)\n hash = {}\n\n strings.each do |string|\n sorted_string_array = string.split(\"\").sort\n\n if hash[sorted_string_array]\n hash[sorted_string_array] << string\n else\n hash[sorted_string_array] = [string]\n end\n end\n\n answer = []\n\n hash.each do |key, value|\n answer.push(value)\n end\n\n return answer\nend",
"def combine_anagrams(words)\n anagrams = Hash.new()\n words.each do |word|\n letters = word.downcase.gsub(/[^a-z]/, \"\").split(\"\").sort.join\n anagrams[letters] = Array.new unless anagrams.include?(letters)\n anagrams[letters] << word\n end\n anagrams.values\nend",
"def grouped_anagrams(strings)\n res = []\n return res if strings.empty?\n hash = {}\n strings.each do |word|\n key = word.split(\"\").sort.join\n if hash[key]\n hash[key] << word\n else\n hash[key] == [word]\n end\n end\n hash.each do |k, v|\n res << v \n end\n return res\nend",
"def combine_anagrams(words)\n#\n\n hash = {}\n words.each{ |word| \n key = word.downcase.split(//).sort\n hash[key] = (hash[key] || []) + [word]\n }\n ans = []\n hash.map{ |k, v|\n ans += v\n }\n ans\nend",
"def combine_anagrams(words)\n result = Hash.new\n words.each do |word|\n sw = word.downcase.split(//).sort\n if !result.has_key?(sw)\n result[sw] = Array.new\n end\n result[sw] << word\n end\n result.values\nend",
"def grouped_anagrams(strings)\n results = []\n return results if strings.empty?\n\n hash_map = {}\n set_no = 1 \n\n strings.each do |word|\n letters = word.split('').sort!\n\n if hash_map.empty?\n hash_map[set_no] = letters\n set_no += 1\n elsif !hash_map.has_value?(letters)\n hash_map[set_no] = letters\n set_no += 1\n end \n end \n\n results = []\n\n hash_map.keys.each do |sub_arr|\n sub_arr = []\n results << sub_arr\n end \n\n strings.each do |word|\n letters = word.split('').sort!\n\n if hash_map.has_value?(letters)\n sub_group = hash_map.key(letters)\n results[sub_group-1] << word\n end \n end \n\n results.each do |list|\n list.sort!\n end \nend",
"def anagrams(string, array)\n string_anagram = string.chars\n \n array.select! do |word|\n word.chars.all? do |letter|\n word.chars.count(letter) == string_anagram.count(letter)\n end\n end\n array\nend",
"def grouped_anagrams(strings)\n word_hash = {}\n\n strings.each do |word|\n char_hash = {}\n\n word.each_char do |char|\n if char_hash[char] \n char_hash[char] += 1\n else\n char_hash[char] = 1\n end\n end\n\n if word_hash[char_hash]\n word_hash[char_hash] << word\n else\n word_hash[char_hash] = [word]\n end\n end\n\n return word_hash.values\nend",
"def anagrams(array)\n copy_array = array.dup\n result_array = []\n iteration_idx = 0\n until copy_array.empty?\n \n word = copy_array.pop\n next if word.nil?\n \n result_array << []\n result_array[iteration_idx] << word\n copy_array.each do |sub_word|\n next if sub_word.nil?\n if are_anagrams?(sub_word, word)\n result_array[iteration_idx] << sub_word\n idx = copy_array.index(sub_word)\n copy_array[idx] = nil\n end\n end\n \n iteration_idx += 1\n end\n \n result_array\nend",
"def grouped_anagrams_version2(strings)\n # edge cases\n return [] if strings.empty?\n return [[strings[0]]] if strings.size == 1\n # new array has the same number of elements as the input array\n # each inner array has 25 elements, by the number of letter in the English alphabet\n anagrams_storage = {}\n strings.each do |word|\n letters = Array.new(26, 0)\n word.chars.each do |char|\n # get an Integer ordinal of a letter\n letters[char.ord - 97] += 1\n end\n\n # we freeze the array as a key because it's recommended not to have mutable data structures as keys\n letters = letters.freeze\n # check if there is a hash equal to this newly created one.\n # checks key-value pairs, not their order\n if !anagrams_storage[letters]\n anagrams_storage[letters] = Array.new\n anagrams_storage[letters] << word\n else\n anagrams_storage[letters] << word\n end\n end\n # as a result we have \n # { [1,0,0,0...all 26 elements] => [\"tan\", \"nat\", \"ant\"] }\n return anagrams_storage.values\nend",
"def combine_anagrams(words)\r\n buckets = Hash.new([])\r\n words.each do | item |\r\n key = item.downcase.chars.sort.join\r\n\r\n if buckets.has_key?(key)\r\n buckets[key] << item\r\n else\r\n buckets[key] = [item]\r\n end\r\n end\r\n\r\n output = Array.new;\r\n buckets.each do | key, value |\r\n output << value\r\n end\r\n return output\r\nend",
"def combine_anagrams(words)\n\th = Hash.new{|hash, key| hash[key] = Array.new;}\n\twords.each do |word| h[word.downcase.split(//).sort.join] << word end\n\th.values \nend",
"def combine_anagrams(words)\r\n hash = Hash.new([])\r\n anagrams = []\r\n words.each do |word|\r\n keyword = word.downcase.chars.sort.join\r\n hash[keyword] += [word]\r\n end\r\n hash.each_value do |words|\r\n anagrams += [words]\r\n end\r\n return anagrams\r\nend",
"def anagrams(array, string)\n dictionary = dictionary_hash(array)\n anagrams = []\n letters = string.chars.sort.join\n if dictionary.has_key?(letters)\n anagrams = dictionary[letters]\n end\n if anagrams.empty?\n \"No anagrams were found for #{string}\"\n else\n anagrams.each do |word|\n puts word\n end\n end\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n anagram_hash = {}\n \n strings.each do |word|\n letters = word.split(\"\").sort.join(\"\")\n if anagram_hash[letters].nil?\n anagram_hash[letters] = [word]\n else\n anagram_hash[letters] << word\n end\n end\n return anagram_hash.values\nend",
"def grouped_anagrams(strings) \n h = {}\n return [] if strings.nil? || strings.empty? || !strings.is_a?(Array)\n strings.each do |str| \n key = str.chars.sort.join\n if h.include?(key)\n h[key] << str\n else\n h[key] = [str]\n end \n end\n return h.values\nend",
"def combine_anagrams(words)\r\n\th = Hash.new\r\n\twords.each do |a_word|\r\n\t\tkey = a_word.downcase.chars.sort.join\r\n\t\tputs key\r\n\t\tputs \"-------\"\r\n\t\tif h[key] == nil\r\n\t\t\th[key] = Array.new\r\n\t\tend\r\n\t\th[key].push(a_word)\r\n\tend\r\n\t\r\n\tr_a=Array.new\r\n\t\r\n\th.each do |key, list|\r\n\tr_a.push(list)\r\n\tend\r\n\treturn r_a\r\nend",
"def combine_anagrams(words)\r\n hash = Hash.new\r\n words.each{|w|\r\n key = w.downcase.chars.sort * \"\"\r\n if hash.has_key?(key)\n hash[key] += [w]\n else\n hash[key] = [w]\n end}\r\n return hash.values\r\nend",
"def grouped_anagrams(strings)\n hash = {}\n strings.each do | i |\n key = i.chars.sort.join\n if hash[key] != nil \n hash[key] << i\n else \n hash[key] = [i]\n end\n end\n return hash.values\n\nend",
"def grouped_anagrams(strings)\n if strings.length == 0\n return []\n end\n\n anagram_hash = {}\n\n strings.each do |string|\n sorted_letters = string.split(\"\").sort.join\n if anagram_hash[sorted_letters]\n anagram_hash[sorted_letters] << string\n else\n anagram_hash[sorted_letters] = [string]\n end\n end\n return anagram_hash.values\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n\n hash_groups = []\n anagrams_grouped = []\n\n strings.each do |string|\n string_hash = {}\n\n # count freq of characters in string through hash\n string.each_char do |char|\n if string_hash[char]\n string_hash[char] += 1\n else\n string_hash[char] = 1\n end\n end\n\n # if no hash_groups exist, add new string hash to hash group and add string to anagrams list\n if hash_groups.empty?\n hash_groups << string_hash\n anagrams_grouped << [string]\n \n # otherwise, test string hash against all previous hashes, if match, add to existing anagram group, if unique, add hash group, create new anagram group\n else\n unique = true\n hash_groups.each_with_index do |hash, index|\n if hash == string_hash\n unique = false\n anagrams_grouped[index] << string\n end\n end\n\n if unique\n hash_groups << string_hash\n anagrams_grouped << [string]\n end\n end\n end\n\n return anagrams_grouped\nend",
"def grouped_anagrams(strings)\n sorted_words = {}\n anagrams = []\n\n strings.each do |word|\n word_sorted = word.chars.sort.join\n if !sorted_words.keys.include?(word_sorted)\n # In the hashmap, the sorted word will point to the index in the outer array that the anagram should be placed.\n index = sorted_words.length\n sorted_words[word_sorted] = index\n anagrams[index] = [word]\n else\n # Add anagram to correct group.\n anagrams[sorted_words[word_sorted]].push(word)\n end\n end\n\n return anagrams\nend",
"def combine_anagrams(words)\n anagram_group = Hash.new([])\n words.each {|word| anagram_group[word.downcase.split(//).sort.join] += [word]}\n return anagram_group.values\nend",
"def combine_anagrams(words)\r\n cage = Hash.new()\r\n words.each do |word|\r\n sorted_word = word.split('').sort.join\r\n if cage.has_key?(sorted_word)\r\n cage.store(sorted_word, cage.fetch(sorted_word).push(word))\r\n else\r\n cage.store(sorted_word, Array.new(1,word))\r\n end\r\n end\r\n return cage.values\r\nend",
"def combine_anagrams(words)\r\n # <YOUR CODE HERE>\r\n # create a hash to store the anagrams and return arrays of the hash\r\n h = Hash.new \r\n words.each {|x|\r\n key = x.downcase.split(//).sort.join\r\n if h.has_key? key then\r\n a = h[key]\r\n h[key] = a.push(x)\r\n else\r\n h[key]= [x]\r\n end\r\n }\r\n return_array = Array.new\r\n # TODO Figure out how to build an array of arrays\r\n h.each_key {|x| return_array.push (h[x])}\r\n return return_array\r\nend",
"def group_anagrams(strs)\n result = Hash.new{|h,k| h[k] = []}\n strs.each do |str|\n hash = Hash.new(0)\n str.each_char do |char|\n hash[char] +=1\n end\n result[hash] << str\n end\n return result.values\nend",
"def combine_anagrams(words)\r\n\r\n h=Hash.new([])\r\n words.map {|w| key=w.downcase.split('').sort.join; h[key]+=[w]}\r\n h.values\r\n \r\nend",
"def funWithAnagrams(word_arr)\n # Write your code here\n visited = {}\n\n word_arr.each_with_index do |word,idx|\n if visited[word.split(\"\").sort.join(\"\")]\n word_arr[idx] = \"\"\n else\n visited[word.split(\"\").sort.join(\"\")] = 1\n end\n end\n\n word_arr.delete(\"\")\n word_arr.sort\nend",
"def grouped_anagrams(strings)\n return [] if strings.empty?\n hash = {}\n\n strings.each do |string|\n alphabetized = string.chars.sort.join\n\n if hash[alphabetized]\n hash[alphabetized] << string\n else\n hash[alphabetized] = [string]\n end\n end\n return hash.values\nend",
"def combine_anagrams(words)\n h = Hash.new()\n\n words.each do |word|\n lowercase_word = word.downcase\n sorted_lowercase_word = lowercase_word.chars.sort.join\n\n similar_words = h[sorted_lowercase_word]\n if not similar_words\n similar_words = []\n end\n similar_words << word\n h[sorted_lowercase_word] = similar_words\n\n end\n\n output = []\n h.each_value { |value| output << value }\n return output\nend",
"def combine_anagrams(words)\n outp = Hash.new;\n words.each{|w| idx = w.downcase.chars.to_a.sort.join; if outp[idx] == nil then outp[idx] = Array.new; end; outp[idx].push(w); };\n return outp.values ;\nend",
"def combine_anagrams(words)\n return [] if words.nil?\n return [] if words.length == 0\n\n h = Hash[]\n words.each {|x|\n s = x.strip.downcase.chars.sort.join\n if !h.has_key?(s)\n h[s] = [x]\n else\n h[s].push(x)\n end\n }\n h.values\nend",
"def grouped_anagrams(strings)\n hash = Hash.new\n strings.each do |element|\n key = element.chars.sort.join()\n groupedAnagrams = hash[key]\n if groupedAnagrams == nil\n hash[key] = []\n groupedAnagrams = hash[key]\n end\n groupedAnagrams << element\n end\n return hash.values\nend",
"def anagrams_for(word, array)\n #Pasar la palabra a minuscula para que sea igual\n word.downcase!\n #Arreglo vacio para meter los que sean anagramas\n arr = []\n #Separar la palabra en su forma canonica\n cano = word.chars.sort\n #iterar dentro de cada palabra del array\n array.each do |dicc|\n #crear una variable donde pase la palabra del array a su forma canonica\n word_cano = dicc.chars.sort\n #si la palabra es igual a la palabra del array\n #Ya las 2 en su forma canonica\n if cano == word_cano\n #mete la palabra a el array\n arr << dicc\n #De lo contrario deja el array igual\n else\n arr\n end\n end\n #Regresar el array lleno si habia palabras\n #o vacio si no las encontro\n arr\nend",
"def anagrams_for(word, array)\n array.find_all {|element| are_anagrams?(word, element)}\nend",
"def combine_anagrams_method2(words)\n\ttemp1 = Array.new\n\ttemp1 = words.clone\t# making a deep copy of the input \n\tanagram = Array.new\t\n\ti = 0\n\twhile i < temp1.length\t\t\t\n\t\tcount = 0 # count the number of anagrams of a particular string say \"cars\"\n\t\tfor j in i+1..(temp1.length - 1)\n\t\t\tif temp1[i].downcase.chars.sort.join == temp1[j].downcase.chars.sort.join \n\t\t\t\tcount = count + 1\n\t\t\t\ttemp1[j],temp1[i+count] = temp1[i+count],temp1[j] # get all the anagrams to one place by swapping\n\t\t\tend\n\t\tend\n\t\tanagram.push([temp1[i..i+count]]) # pushing the array of anagrams into anagram array say [\"cars\", \"racs\", \"scar\"]\n\t\ti = i + count + 1\n\tend\n\t# printing each group\n\tfor i in 0..anagram.length-1\n\t\tprint \"anagram[\" + i.to_s + \"]: \" \n\t\tputs anagram[i]\n\tend\t\nend",
"def anagrams_of(string)\n return [string[0]] if string.length == 1\n\n collection = []\n\n substring_anagrams = anagrams_of(string[1, string.length - 1])\n\n substring_anagrams.each do |substring_anagram|\n (0..substring_anagram.length).each do |index|\n copy = String.new(substring_anagram)\n collection << copy.insert(index, string[0])\n end\n end\n collection\nend",
"def combine_anagrams(strings)\n lettercombinations = strings.map{|string| string.downcase.count_regex(/\\w/)}\n lettercombinationsunique = lettercombinations.uniq\n lettercombinationsindex = lettercombinations.map{|lettercombination| lettercombinationsunique.index(lettercombination)}\n newarray = lettercombinationsunique.map{[]}#pitfall, new will make the same copy of the array throughout\n strings.each_index{|i| newarray[lettercombinationsindex[i]].push(strings[i])}\n newarray\nend",
"def anagrams_for(word, array)\n p array.select {|w| canonical(word) == canonical(w)}\nend",
"def find_anagrams(target_word, array_of_words)\n array_of_anagrams = []\n\n array_of_words.each do |member|\n if member.split(//).sort == target_word.split(//).sort\n array_of_anagrams.push(member)\n else\n next\n end\n end\n array_of_anagrams\nend",
"def combine_anagrams(words)\n output_array = Array.new(0) #create a new output array\n words.each do |firstword| \n\ttemp_array = [] #create a temp array \n words.each do |nextword|\n\t\tif (nextword.downcase.split(//).sort == firstword.downcase.split(//).sort) #compare if two words are anagrams\n\t\t\ttemp_array.push(nextword) #if so, push nextword to array\n\t\tend\n end\n output_array.push(temp_array) #push word to output array, then move up\n end\n \n return output_array.uniq #output array\nend",
"def combine_anagrams(words)\n anagrams = Hash.new([])\n for i in 0..(words.length - 1)\n anagram_found = false\n if (i == 0)\n anagrams[words[i]] = []\n end\n for j in 0..(i-1)\n# puts \"Comparing #{words[i]} and #{words[j]}\"\n anagram1 = merge_sort(words[i].downcase)\n anagram2 = merge_sort(words[j].downcase)\n# puts \"#{anagram1} #{anagram2}\"\n if (merge_sort(words[i].downcase) == merge_sort(words[j].downcase))\n# puts \"#{words[i]} and #{words[j]} are the same anagram.\"\n anagrams[words[j]] << words[i]\n anagram_found = true\n #puts \"anagrams: #{anagrams.to_s}\"\n break\n end\n end\n anagrams[words[i]] = [] unless (anagram_found)\n end\n\n # Convert hash to an array.\n anagrams_arr = hash_to_array(anagrams)\n return anagrams_arr\n #return anagrams\nend",
"def combine_anagrams(words)\n @results = []\n word_bins = words.group_by { |word| word.length }\n word_bins.values.map { |sublist| \n sublist = sublist.zip(sublist)\n sublist.map { |wordpairs| wordpairs[0] = wordpairs[0].downcase.chars.sort.join }\n # collect unique keys for this sublist:\n keys = sublist.collect { |list| list[0] }.uniq\n # print \"keys: \", keys, \"\\n\"\n keys.each do |key| \n anagrams = sublist.collect { |list| list[0] == key ? list[1] : nil }\n anagrams.compact!\n @results << anagrams\n # print \"anagrams= \", anagrams, \"\\n\"\n end\n # print sublist.length, \": \", sublist, \"\\n\\n\" \n }\n # print \"final results: \", @results, \"\\n\"\n @results\nend",
"def combine_anagrams(words)\r\n words.sort!{|a, b| a.length <=> b.length}\r\n letters = words.map{|w| w.downcase.split(//).sort}\r\n outp = Array.new \r\n prev_a = []\r\n for w in words\r\n if letters[words.index(w)] == prev_a\r\n outp[outp.length - 1].push(w)\r\n else\r\n outp.push([w])\r\n prev_a = letters[words.index(w)]\r\n end\r\n end\r\n return outp\r\nend",
"def combine_anagrams(words)\n\tsorted = Hash.new\n\tk=0\n\twords.each { |c| sorted[k]=c.downcase.chars.sort.join; k=k+1 }\n\tanagram = Array.new\n\ta = Array.new\n\tb = Array.new\n\ti=0\n\tsorted.invert.each { |w,y| a[i] = sorted.select { |k,v| v == w }.keys; a[i].each { |x| b << words[x] }; anagram << anagram[i].to_a + b.to_a ; b.clear; i=i+1 }\n\treturn anagram\nend",
"def combine_anagrams(words)\n hash = {}\n anagrams = []\n\n words.each { |w| \n sorted = w.downcase.each_char.sort.join \n\n if (hash.has_key?(sorted))\n hash[sorted].push w\n else\n hash[sorted] = Array.new.push(w)\n end\n }\n\n hash.each_value { |v|\n anagrams.push v\n }\n\n return anagrams\nend",
"def grouped_anagrams(strings)\n words = {} \n \n until strings.empty? \n i = 0 \n word_to_compare = strings[0] # \"eat\" => \"tan\" => \"bat\"\n words[word_to_compare] = []\n # [\"eat\", \"tea\", \"ate\"]\n # [\"tan\", \"nat\"]\n # [\"bat\"]\n\n while i < strings.length \n if permutation(word_to_compare, strings[i])\n words[word_to_compare].push(strings[i])\n strings.delete_at(i) \n i -= 1\n end\n i += 1 # 0 => 0\n end\n end\n\n return words.values\nend",
"def combine_anagrams(words)\n words_hash = Hash.new{ |hash, key| hash[key] = [] }\n words.each { |word| word_key = word.downcase.chars.sort.join; words_hash[word_key] = words_hash[word_key] << word; }\n words_list = Array.new()\n words_hash.keys.each { |key| words_list << words_hash[key] }\n return words_list\nend",
"def combine_anagrams(words)\n output = []\n if words.length == 0\n return output\n end\n words.each do |item|\n s_string = item.downcase.chars.sort.join.to_s\n temp_arry = []\n words.each do |scan|\n if s_string == scan.downcase.chars.sort.join.to_s\n temp_arry << scan\n end\n end\n if output.include?(temp_arry)\n #do nothing\n else\n output << temp_arry\n end\n end\n return output\nend",
"def combine_anagrams(words=[])\n return [] if words.empty?\n hash = {}\n words.each do |word|\n anagram = word.downcase.split(\"\").sort.join(\"\")\n if hash[anagram].nil? then\n hash[anagram]=[word]\n else\n hash[anagram].push(word)\n end\n end\n return hash.values\nend",
"def group_anagrams(strs)\n hash = {}\n \n strs.each do |s|\n sorted = s.split('').sort().join()\n if !hash[sorted]\n hash[sorted] = [s]\n else\n hash[sorted].push(s)\n end\n end\n\n hash.values\nend",
"def combine_anagrams(words)\n hash = Hash.new\n words.each {|w|\n if(hash[w.downcase.split(\"\").sort().join] == nil)\n hash[w.downcase.split(\"\").sort().join] = [] \n end\n hash[w.downcase.split(\"\").sort().join] << w\n }\n rList = []\n hash.each_value{|v|\n rList << v\n }\n return rList\n\nend",
"def combine_anagrams(words)\n\n ouArr = Array.new\n\n words.each do |w|\n\n ouIt = Array.new [w]\n\n words.each do |w2|\n if w.downcase.chars.sort == w2.downcase.chars.sort && !ouIt.include?(w2)\n ouIt.push(w2)\n end\n end\n ouIt.sort!\n\n if !ouArr.include?(ouIt)\n ouArr.push(ouIt)\n end\n end\n ouArr\nend",
"def anagram(words)\n words_hash = {}\n\n words.each do |w1|\n sorted_word = w1.chars.sort\n\n if words_hash.has_key?(sorted_word)\n words_hash[sorted_word] << w1\n else\n words_hash[sorted_word] = [w1]\n end\n end\n\n words_hash.values\nend",
"def combine_anagrams(words) \r\n anagrams = words.inject(Hash.new()) do |r, word|\r\n key = word.downcase.chars.sort.join\r\n r[key] ||=[]\r\n r[key] << word\r\n r\r\n end\r\n anagrams.values\r\nend",
"def match(array) #takes in an array of possible anagrams\n anagrams = []\n \n # iterate over array of words\n array.each do |word|\n # compare each word of array to OG word \n # determine if word is anagram\n if word.chars.sort == @word.chars.sort\n anagrams << word\n end\n end\n anagrams #return all matches/ empty array if no matches exist\n end",
"def combine_anagrams(words)\n result = Array.new\n words.each do |i|\n anagrams = Array.new\n sorted = i.downcase.chars.sort.join\n words.each do |j|\n if j.downcase.chars.sort.join == sorted\n anagrams << j\n end\n end\n result << anagrams\n end\n return result.uniq\nend",
"def combine_anagrams(words)\n\twords.collect do |w|\n\t\twords.find_all { |w2| w.split(//).sort.eql? w2.split(//).sort }.sort.uniq\n\tend.uniq\nend",
"def grouped_anagrams(strings)\n hash = {}\n\n strings.each do |word|\n letter_grouping = word.split('').sort().join()\n\n if !hash[letter_grouping]\n hash[letter_grouping] = []\n end \n \n hash[letter_grouping] << word\n end \n\n return hash.values\nend",
"def combine_anagrams(words)\r\n\tswords = Array.new\r\n\tnoDups = Array.new\r\n\tgroupWords = Array.new\r\n\tanagrams = Array.new\r\n\twords.each {|word| swords << word.downcase.chars.sort.join}\r\n\tswords.each{|word| noDups << word unless !noDups.index(word).nil? }\r\n\tnoDups.each do|tword|\r\n\t\t\t\t\t\r\n\t\t\t\t\tgroupWords = Array.new\r\n\t\t\t\t\twords.each {|word| groupWords << word unless word.downcase.chars.sort.join != tword}\r\n\t\t\t\t\tanagrams << groupWords\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\treturn anagrams\r\nend",
"def anagram(words)\r\n result = words.group_by { |word| word.chars.sort.join }\r\n result.each {|k, v| p v unless v.size == 1}\r\nend",
"def fifth_anagram?(word1, word2) # O(n)\n \n p \"Running fifth_anagram...\" \n\n start = Time.now\n \n hash1 = Hash.new(0)\n # hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash1[char] += 1}\n\n hash1.values.all? {|v| v.even?}\n\n\n # puts \"Took #{Time.now - start} seconds\"\n\n \nend",
"def combine_anagrams(words)\r\n\tanagrams = words.group_by { |word| word.chars.sort }.values\t\r\nend",
"def combine_anagrams(words)\n Array anagrams = []\n words.each {|x|\n flag = false\n anagrams.collect {|y|\n if x.downcase.chars.to_a.sort == y[0].downcase.chars.to_a.sort then\n y << x\n flag = true\n break\n end\n }\n unless flag; anagrams << [x] end \n }\n anagrams\nend",
"def combine_anagrams(words)\n result = []\n words.each do |word|\n anagrams = words.find_all{|item| item.downcase.chars.sort.join == word.downcase.chars.sort.join }\n result.push(anagrams)\n end\n result.uniq\nend",
"def combine_anagrams(words)\n\tresult = []\n\twords.each do |word|\n\t\ttemp_word = sort_letters(word)\n\t\tis_found = false\n\t\tresult.each do |grouped_array|\n\t\t\tif !false and sort_letters(grouped_array.last) == temp_word\n\t\t\t\tgrouped_array << word\n\t\t\t\tis_found = true\n\t\t\tend\n\t\tend\n\t\tresult << [word] if !is_found\n\tend\n\tresult\nend",
"def grouped_anagrams(strings)\n return [] if strings == []\n anagrams = {}\n\n strings.each_with_index do |string, i|\n sorted_string = string.split(\"\").sort.join(\"\").downcase\n if anagrams[sorted_string]\n anagrams[sorted_string] << string\n else\n anagrams[sorted_string] = [string]\n end\n end\n\n return anagrams.values\nend",
"def combine_anagrams(words)\r\n words.group_by{|w| w.downcase.chars.sort.to_s}.values\r\nend",
"def anagrams(word, words)\n # TODO: check if \"words\" has anagrams of \"word\" and return them in an array\nend",
"def match(anagrams)\n anagrams.each do |array_word|\n if @word.split(\"\").sort == array_word.split(\"\").sort\n @final_array << array_word\n end\n end\n @final_array\n end",
"def combine_anagrams(words)\n word_list = Hash.new{|h, k| h[k] = []}\n \n words.each do |word|\n sorted = word.downcase.chars.sort.join\n # if not (word_list.include? sorted and word_list[sorted].include?(word))\n word_list[sorted] << word\n # end\n end\n \n word_list.map { |key,value| value }\nend",
"def grouped_anagrams(strings)\n result = []\n return result if strings.empty?\n\n anagrams = {}\n strings.each do |string|\n sorted_string = string.split(\"\").sort.join(\"\")\n anagrams[sorted_string] ? anagrams[sorted_string] << string : anagrams[sorted_string] = [string]\n end\n\n return anagrams.values\nend",
"def grouped_anagrams(strings)\n \n inventory = {}\n # key = alphabetically sorted word\n # value = array of original word(s), where each can be sorted into the key.\n # example: \"bat\" from strings[] would show up in inventory as \"abt\" => [\"bat\"]\n # and later if \"tab\" is found in strings[], inventory would now include \"abt\" => [\"bat\", \"tab\"]\n \n strings.each do |word|\n # source for line below: https://solidfoundationwebdev.com/blog/posts/how-to-sort-a-string-alphabetically-in-ruby\n sortedWord = word.chars.sort_by(&:downcase).join\n \n if inventory[sortedWord]\n inventory[sortedWord] << word \n else\n inventory[sortedWord] = [word]\n end\n end\n \n output = []\n inventory.each do |key, value|\n output << value\n end\n \n return output\nend",
"def all_anagrams(string)\n return [string] if string.length <= 1\n\n options = all_anagrams(string[1..-1])\n\n result = []\n\n options.each do |sub|\n string.length.times do |i|\n result << sub[0...i] + string[0] + sub[i..-1]\n end\n end\n\n result\nend",
"def combine_anagrams(words)\n hash = {}\n hash.default=[]\n words.each{|word|\n down_cased = word.downcase\n anagram = down_cased.chars.sort.join\n hash[anagram]= hash[anagram] + [word]\n }\n hash.values\nend",
"def grouped_anagrams(strings)\n string_hashmap = {}\n strings.each do |string|\n if string_hashmap[grouped_anagrams_helper(string)]\n string_hashmap[grouped_anagrams_helper(string)] << string\n else\n string_hashmap[grouped_anagrams_helper(string)] = []\n string_hashmap[grouped_anagrams_helper(string)] << string\n end\n end\n return string_hashmap.values\nend"
] |
[
"0.77875847",
"0.7774702",
"0.7766619",
"0.77547306",
"0.77300113",
"0.76665324",
"0.76329285",
"0.7569145",
"0.75421345",
"0.7539979",
"0.75197387",
"0.7513685",
"0.749747",
"0.748366",
"0.74831265",
"0.7472842",
"0.7444642",
"0.74369186",
"0.7414231",
"0.7414188",
"0.7412299",
"0.7408568",
"0.74009514",
"0.73991406",
"0.7384966",
"0.7384833",
"0.7380796",
"0.7378192",
"0.7371122",
"0.73551506",
"0.735076",
"0.7345254",
"0.7330684",
"0.72951525",
"0.7287234",
"0.72837234",
"0.72678685",
"0.7252407",
"0.7252093",
"0.7231161",
"0.7226336",
"0.7207587",
"0.72027016",
"0.7186743",
"0.7185178",
"0.7185145",
"0.7182106",
"0.7181162",
"0.71700853",
"0.7167472",
"0.7162732",
"0.7159559",
"0.7156451",
"0.7154505",
"0.7151979",
"0.7151146",
"0.7142537",
"0.71420425",
"0.7137291",
"0.71344936",
"0.71307045",
"0.71305895",
"0.71190244",
"0.71140367",
"0.7110521",
"0.71050316",
"0.71045303",
"0.71006304",
"0.70908153",
"0.70902264",
"0.7086296",
"0.7086288",
"0.7082868",
"0.7077117",
"0.70743114",
"0.70672095",
"0.70584834",
"0.70561403",
"0.70519394",
"0.70465165",
"0.7043751",
"0.7018811",
"0.7014479",
"0.70076424",
"0.7001412",
"0.69870645",
"0.69855213",
"0.6967291",
"0.6954882",
"0.69509757",
"0.69503105",
"0.69473404",
"0.6937395",
"0.69303215",
"0.692568",
"0.69251156",
"0.6923354",
"0.6920116",
"0.69108707",
"0.6905905"
] |
0.74237925
|
18
|
This method will return the k most common elements in the case of a tie it will select the first occuring element. Time Complexity: O(n + k) Iterate through each element in order to count and add to hash O(n) Sort the hash: maybe O(log n) Put return first k elements = O(k) Space Complexity: O(n); worst case, hash is same size as array. Other variables are O(1).
|
def top_k_frequent_elements(list, k)
return [] if list.empty?
element_count = {}
list.each do |element|
if element_count[element].nil?
element_count[element] = 1
else
element_count[element] += 1
end
end
sorted_elements = element_count.sort_by(&:first)
i = 0
max_nums = []
k.times do
max_nums << sorted_elements[i][0]
i += 1
end
return max_nums
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def top_k_frequent_elements(list, k)\n\n return [] if list.empty?\n \n # create a hash that has each element as key and number of occurrences as value: [1, 1, 1, 2, 2, 3] => {1=>3, 2=>2, 3=>1}\n hash = {}\n list.each do |element|\n if hash[element].nil?\n hash[element] = 1\n else \n hash[element] += 1\n end\n end\n \n # get the keys associated with k max values. There is almost certainly a better way to do this \n max_arrays = hash.max_by(k) {|key, value| value} # this returns k hash pairs as arrays: {1=>3, 2=>2, 3=>1}, k = 2 => [[1, 3], [2, 2]]\n\n # return the first element from each array\n max_keys = []\n max_arrays.each do |array|\n if k == 1\n # \"will work for an array when k is 1 and several elements appear 1 time\" situation: return the first key with value of 1 in the element counts hash\n max_keys << hash.min[0]\n else\n max_keys << array[0]\n end\n end\n\n return max_keys\n\nend",
"def top_k_frequent_elements(list, k)\n result = []\n\n hash = Hash.new\n \n list.each do |letter|\n if hash[letter]\n hash[letter] += 1\n else \n hash[letter] = 1\n end \n end \n\n k.times do \n max = nil\n hash.each do |num, value|\n\n if value && (max.nil? || value > max)\n max = num \n end \n end \n\n if max \n hash[max] = nil \n result << max \n end \n end \n return result end",
"def top_k_frequent_elements(list, k)\n result_arr = []\n return result_arr if list.length == 0\n\n frequency_hash = {}\n\n list.each do |element|\n if frequency_hash[element]\n frequency_hash[element] += 1\n else\n frequency_hash[element] = 1\n end\n end\n\n k.times do\n top_element = nil\n top_frequency = 0 \n\n frequency_hash.each do |element, frequency|\n top_frequency = frequency && top_element = element if frequency > top_frequency\n end\n\n result_arr << top_element\n frequency_hash[top_element] = 0\n end\n\n return result_arr\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n hash = {}\n\n list.each do |element|\n if hash[element]\n hash[element] += 1\n else\n hash[element] = 1\n end\n end\n\n answer = []\n answer_length = 0\n\n highest_freq = hash.values.max\n\n while answer_length < k\n hash.each do |element, count|\n if count == highest_freq\n answer << element\n answer_length += 1\n end\n\n break if answer_length == k\n end\n\n highest_freq -= 1\n end\n\n return answer\nend",
"def top_k_frequent_elements(list, k)\n return nil if !list\n # intialze an empty hash\n ## iterate throught the list\n #chechk if the key is in the hash,\n # if key is in the hash ++ value\n # otherwise add key and value as 1 since it's first occurance\n # now the key(uniqe) and value(how many time the int_value) happend is in the hash,\n # my_hash.sort_by { |_, value| value }.each { |key, value| puts key } (iterate throught the hash, (hash.each {|key, value|}) )\n # before pushing the key into the initalized array, check to see if the length is less than k\n # if\n hash = Hash.new\n list.each do |int_value|\n if hash.key?(int_value)\n hash[key] = +1\n else\n hash[key] = 1\n end\n end\n kth_frequent_elements = []\n counter = 0 \n pervisou_value = 0\n hash.sort_by { |k, v| -v }.each do |key, value|\n if counter < k\n kth_frequent_elements << key\n if pervisou_value != value\n pervisou_value = value\n counter += 1\n end\n # end\n # if kth_frequent_elements.length < k\n # kth_frequent_elements << key\n else\n break\n end\n end\n return kth_frequent_elements\nend",
"def top_k_frequent_elements(list, k)\n return list if list.empty? || list.size == 2\n\n elements = []\n hash = {}\n\n list.each do |elem|\n if hash[elem]\n hash[elem] += 1\n else\n hash[elem] = 1\n end\n end\n\n k.times do\n max_key = hash.key(hash.values.max)\n elements << max_key\n hash.delete(max_key)\n end\n return elements\nend",
"def top_k_frequent_elements(list, k)\n h = {}\n solution = []\n return solution if list.nil? || list.empty? || !list.is_a?(Array)\n list.each do |element|\n if h.include?(element)\n h[element] += 1\n else\n h[element] = 1\n end\n end\n k.times do\n top = nil\n h.each do |element,value| \n if value && (top.nil? || value > top)\n top = element\n end\n end \n if top \n h[top] = nil\n solution << top\n end\n end \n return solution\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n count_hash = Hash.new(0)\n result = []\n\n list.each do |element|\n count_hash[element] += 1\n end\n\n max_array = count_hash.sort_by { |k, v| -v }\n\n (0...k).each do |i|\n result << max_array[i][0]\n end\n\n return result\nend",
"def top_k_frequent_elements(list, k)\n return list if list.empty? || list.length == k\n count = {}\n \n list.each do |num|\n count[num] ? count[num] += 1 : count[num] = 1\n end\n \n sorted = count.sort_by { |k, v| -v }\n \n most_frequent = Array.new(k)\n k.times { |i| most_frequent[i] = sorted[i][0] } \n \n return most_frequent\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n return list if list.length == 1\n\n element_count = Hash.new()\n\n list.each do |element|\n if element_count[element]\n element_count[element] += 1\n else\n element_count[element] = 1\n end\n end\n\n result = []\n\n k.times do |i|\n count = 0\n frequent_element = nil\n element_count.each do |element, frequency|\n if frequency > count\n count = frequency\n frequent_element = element\n end\n end\n result << frequent_element\n element_count[frequent_element] = 0 if frequent_element\n end\n\n return result\n\nend",
"def top_k_frequent_elements(list, k)\n # load a hash table which has elements & their frequency \n element_frequency = {}\n array = []\n return array if list.length == 0\n\n list.each do |val|\n if !(element_frequency[val])\n element_frequency[val] = 1\n else\n element_frequency[val] += 1\n end\n end\n\n values = element_frequency.values.sort!\n inverted_hash = element_frequency.invert\n \n k.times do |i|\n array << inverted_hash[values[i]]\n end\n\n return array \nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n frequency = {}\n list.each do |i|\n frequency[i] ? (frequency[i] += 1) : (frequency[i] = 1)\n end\n\n nums = []\n unique = list.uniq\n max = frequency.values.max\n\n until max == 0 || nums.length == k\n unique.each do |i|\n break if nums.length == k\n if frequency[i] == max\n nums << i\n end\n end\n max -= 1\n end\n\n return nums\nend",
"def top_k_frequent_elements(list, k)\n hash = {}\n \n list.each do |value|\n if hash[value]\n hash[value] += 1\n else\n hash[value] = 1\n end\n end\n \n top_elements = Array.new(k)\n return top_elements = hash.sort_by{ |key, value| value } \nend",
"def top_k_frequent_elements(list, k)\n res = []\n return res if list.empty?\n hash = {}\n list.each do |num|\n if hash[num]\n hash[num] += 1\n else\n hash[num] = 1\n end\n end\n \n k.times do \n max = nil\n hash.each do |num, v|\n if v && (max.nil? || v > max)\n max = num \n end\n end\n if max\n hash[max] = nil\n res << max\n end\n end\n \n return res\nend",
"def top_k_frequent_elements(list, k)\n return [] if k == 0\n\n frequency = {}\n list.each do |element|\n frequency[element] ? frequency[element] += 1 : frequency[element] = 1\n end\n\n return frequency.keys[0...k]\nend",
"def top_k_frequent_elements(list, k)\n # list = [1,1,1,2,2,3]\n # k = 2\n return [] if list == []\n\n counter = {}\n\n list.each do |value|\n if counter[value]\n counter[value] += 1\n else\n counter[value] = 1\n end\n end\n\n puts counter\n\n ordered = counter.sort_by{ |key, value| value } \n\n k_most = []\n\n k.times do |i|\n k_most << ordered[-i]\n end\n\n return k_most\nend",
"def top_k_frequent_elements(list, k)\n k_freq = []\n return k_freq if list.empty?\n \n hash_map = Hash.new\n\n list.each do |element| \n hash_map[element] ? hash_map[element] += 1 : hash_map[element] = 1\n end\n \n vals = hash_map.values \n max_vals = vals.max(k) \n \n max_vals.each do |val| \n key = hash_map.key(val)\n k_freq << key\n hash_map.delete(key)\n end\n return k_freq\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty? \n # list tracking quantities\n total_ele = list.length # O(n) operation\n return list if total_ele == 1\n top_k = Array.new(total_ele + 1){[]} # plus one for better tracking\n count_hash = {}\n\n # get frequencies of each element, O(n)\n list.each do |e|\n count_hash[e] ||= 1\n count_hash[e] += 1\n end\n\n # use a non-nested O(n) operation to sort\n # frequencies in top_k\n count_hash.each do |k,v|\n top_k[v] << k\n end\n\n return_arr = []\n \n # sort array in order now\n until total_ele == 0\n if(!top_k[total_ele].empty?)\n return_arr += top_k[total_ele]\n end\n\n total_ele -= 1\n end\n\n return return_arr[0...k]\nend",
"def top_k_frequent_elements(list, k)\n # build hashmap\n num_hash = {}\n list.each do |num|\n if num_hash[num]\n num_hash[num] += 1\n else\n num_hash[num] = 1\n end\n end\n\n # convert hashmap to array\n array_num_hash = num_hash.to_a\n\n # sort by occurences\n sorted_array_num_hash = array_num_hash.sort_by {|num| -num[1]}\n\n # sorted elements only\n sorted_numbers = sorted_array_num_hash.map{|num| num[0]}\n\n # slice sorted array by k elements\n return sorted_numbers.slice(0, k)\nend",
"def top_k_frequent_elements(list, k)\n results = []\n\n return list if list.length == k\n return results if list.length == 0 \n\n list = list.sort.uniq\n\n i = 0\n k.times do \n results << list[i]\n i += 1\n end \n return results\nend",
"def top_k_frequent_elements(list, k)\n element_occurrence = {}\n list.each do |element|\n if element_occurrence[element]\n element_occurrence[element] += 1\n else\n element_occurrence[element] = 1\n end\n end\n \n sorted_pairs = element_occurrence.sort_by {|key, value| -value }\n output = []\n k.times do |index|\n return output if sorted_pairs[index].nil?\n output << sorted_pairs[index].first\n end\n return output\nend",
"def top_k_frequent_elements(list, k)\n # edge cases\n return list if list.empty? || list.size == 1\n\n occurances_counter = {}\n list.each do |digit|\n if occurances_counter[digit]\n occurances_counter[digit] += 1\n else\n occurances_counter[digit] = 1\n end\n end\n # occurances_counter looks like this for input [1,1,2,2,2]: {1=>2, 2=>3}\n\n # create an array with the input number of elements + 1\n # at indexes equal to occurance number I will store an array of occured digits\n # +1 to have the last index available, e.g. [1,1,1] => [nil, nil, nil, (here at index 3 will be digit 1)]\n sorted_occurances = Array.new(list.size + 1)\n occurances_counter.each do |digit, counter|\n if !sorted_occurances[counter]\n sorted_occurances[counter] = Array.new\n sorted_occurances[counter] << digit\n else\n sorted_occurances[counter] << digit\n end\n end\n # sorted_occurances array for input c will be like: [nil, nil, [1,3], [2], nil, nil]\n # reverse to keep the needed order of inner arrays elements, then flatten and get rid of nil elements\n sorted_occurances = sorted_occurances.reverse.flatten.select { |element| !element.nil? }\n # the result is: [2,3,1] where 1 is least frequent, 2 is most frequent in the input array\n # the last step is to slice the k number of elements\n result = sorted_occurances.slice(0, k)\n return result\nend",
"def top_k_frequent_elements_version2(list, k)\n # edge cases\n return list if list.empty? || list.size == 1\n\n occurances_counter = {}\n list.each do |digit|\n if occurances_counter[digit]\n occurances_counter[digit] += 1\n else\n occurances_counter[digit] = 1\n end\n end\n # occurances_counter looks like this for input [1,1,2,2,2]: {1=>2, 2=>3}\n # create an array out of this hash, sort it by values and return keys of k elements\n sorted_occurances = occurances_counter.to_a.sort_by{ |pair| pair[1]}\n number_pairs = sorted_occurances.slice(sorted_occurances.length - k, k)\n result = number_pairs.map do |pair|\n pair[0]\n end\n return result\nend",
"def top_k_frequent_elements(list, k)\n return [] if list == []\n\n frequency = {}\n list.each do |element|\n if frequency[element]\n frequency[element] += 1\n else\n frequency[element] = 1\n end\n end\n\n k_frequent_elements = []\n\n k.times do |i|\n max_freq = 0\n max_freq_element = nil\n frequency.each do |element, freq|\n if freq > max_freq\n max_freq = freq\n max_freq_element = element\n end\n end\n k_frequent_elements << max_freq_element\n frequency[max_freq_element] = 0 if max_freq_element\n end\n\n return k_frequent_elements\nend",
"def top_k_frequent_elements(list, k)\n return [] if list == []\n hash = Hash.new(0)\n counter = 0;\n list.each do |value|\n hash[value] = [] if hash[value].nil?\n hash[value]+=1\n end\n \n if k > hash.size()\n raise ArgumentError, \"Not Enough Values to Display\"\n end\n \n solution = hash.max(k){ |a, b| b<=>a} \n p solution\n numbers = []\n solution.each do |array|\n numbers << array[0]\n end\n return numbers\nend",
"def top_k_frequent_elements(list, k)\n if list.length == 0 \n return []\n end \n nums = {}\n list.each do |num|\n if !nums[num]\n nums[num] = 1\n else\n nums[num] += 1\n end\n end \n\n sorted = nums.sort_by {|k, v| -v}\n top_k = []\n k.times do |k|\n top_k << sorted[k][0]\n end \n return top_k\nend",
"def top_k_frequent_elements(list, k)\n \n return [] if list.empty?\n ranked_hash = {}\n ranked = []\n\n list.each do |element|\n if ranked_hash.has_key?(element)\n ranked_hash[element] += 1\n else\n ranked_hash[element] = 1\n end\n end\n\n sorted = ranked_hash.sort_by { | k, v | -v }\n\n k.times do \n max = sorted.shift\n ranked << max[0]\n k -= 1\n end\n\n return ranked \n\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n counts_hash = {}\n\n list.each do |number|\n if !counts_hash[number]\n counts_hash[number] = 1 \n else\n counts_hash[number] = counts_hash[number] + 1\n end\n end\n\n length_to_num_hash = {}\n\n counts_hash.keys.each do |number|\n if !length_to_num_hash[counts_hash[number]]\n length_to_num_hash[counts_hash[number]] = []\n end\n length_to_num_hash[counts_hash[number]] << number\n end\n\n result_length = k\n result = []\n most_freq_num = length_to_num_hash.keys.max\n\n while result_length > 0 && most_freq_num != nil && most_freq_num >= 0\n if length_to_num_hash[most_freq_num]\n length_to_num_hash[most_freq_num].each do |num|\n result << num\n result_length -= 1\n break if result_length <= 0\n end\n end\n most_freq_num -= 1\n end\n\n return result\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty?\n\n frequency_count = Hash.new(0)\n list.each do |num|\n frequency_count[num] += 1\n end\n\n top_k = frequency_count.to_a.sort_by { |e| e[1] }\n\n if k == 1\n top_k.first(k).map { |e| e[0] }\n else\n top_k.last(k).map { |e| e[0] }\n end\nend",
"def top_k_frequent_elements(list, k)\n return [] if list.empty? || k == 0\n\n item_with_freq = []\n item_freq = {}\n\n # make hash with freq of each element\n list.each do |item|\n if item_freq[item]\n item_freq[item] += 1\n else\n item_freq[item] = 1\n end\n end\n\n # turn hash into array and sort by freq\n item_with_freq = item_freq.to_a\n item_with_freq.sort_by { |item| item[1] }\n\n # iterate through sorted array k times and pull out top items\n top_items = []\n k.times do |i|\n top_items << item_with_freq[i][0]\n end\n\n return top_items\nend",
"def top_k_frequent_elements(list, k)\n counter_hash = {}\n list.each do |value|\n if counter_hash[value].nil?\n counter_hash[value] = 1\n else\n counter_hash[value] += 1\n end\n end \n \n values_sort = counter_hash.sort_by {|key, value| -value}\n k_values = values_sort.slice(0..(k-1))\n final_values = []\n k_values.each do |value|\n final_values << value[0]\n end\n \n return final_values\nend",
"def top_k_frequent_elements(list, k)\n return list if list.empty?\n\n num_frequency = {}\n\n list.each do |num|\n num_frequency[num] ? num_frequency[num] += 1 : num_frequency[num] = 1\n end\n\n top_frequent_nums = []\n\n k.times do\n max_frequency = 0\n max_frequent_num = nil\n\n num_frequency.each do |key, value|\n if value > max_frequency\n max_frequency = value\n max_frequent_num = key\n end\n end\n\n top_frequent_nums << max_frequent_num\n num_frequency[max_frequent_num] = 0\n end\n\n return top_frequent_nums\nend",
"def top_k_frequent_elements(list, k)\n # create a counter hash for the numbers\n counter = {}\n # go through the list of numbers\n # test the hash keys, if it is not there, add it with a number 1 value\n # otherwise increment the value by 1\n list.each do |num|\n if !counter[num]\n counter[num] = 1\n else\n counter[num] += 1\n end\n end\n\n # list.each do |element|\n # counts[element] ||= 0\n # counts[element] += 1\n # end\n\n # find the K max counts\n highest_counts = counter.values.max(k)\n # return the values of those keys\n most_frequent = []\n highest_counts.each do |n|\n most_frequent << counter.key(n)\n counter.delete(counter.key(n))\n end\n return most_frequent\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def top_k_frequent_elements(list, k)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def find_most_frequent_integer(arr)\n #1. Create hash variable with default 0 value.\n hashld = Hash.new 0\n \n #2. Loop through each array element, count them, and insert the final key/value combo into the hashld hash.\n arr.each do |ele|\n \t hashld[ele] += 1\n end\n \n #3. Hold max count in variable.\n maxd = hashld.values.max\n \n #4. Create new hash containing keys with more than 1 count.\n fnlhsh = (hashld.select {|key,value| value == maxd})\n \n #5. Return array if size == 1, else return nil. \n if fnlhsh.size == 1\n final_val = fnlhsh.keys.join.to_i\n else \n final_val = nil\n end\n \n return final_val\nend",
"def top_k_frequent_b(nums, k)\n nums\n .inject(Hash.new(0)) { |h, n| h[n] += 1; h }\n .sort_by { |_, v| -v }\n .first(k)\n .map(&:first)\nend",
"def most_common_number(array)\n #var\n numbers_and_count = Hash.new 0\n \n array.each do |num|\n \tnumbers_and_count[num] += 1\n end\n #var\n most = numbers_and_count.sort_by { |key, value| value }.reverse\n \n top = Hash[*most.first]\n top.select { |k,v| p k }\n\nend",
"def duplicates(array)\n frequency = Hash.new(0)\n array.each do |element|\n frequency[element] += 1\n end\n frequency.each do |k, v|\n return k if v > 1\n end\nend",
"def find_most_frequent_integer(arr)\n collect = Hash.new 0\n \n arr.each do |int|\n collect[int] += 1\n end\n \n if collect.select {|k,v| v == collect.values.max}.count > 1\n nil\n else\n collect.key(collect.values.max)\n end\nend",
"def find_unique_elements(arr)\n freq = Hash.new #hash to count integers in using key as integer and value as count\n answer = Array.new #array to store the answer to be returned in\n\n \n arr.each {|a| #loop through every element in array \n if freq[a] != nil #check to see if hash value exists\n freq[a] = freq[a] + 1 #add 1 to the hash value\n else \n freq[a] = 1 #create the hash value\n end\n }\n\n\n freq.each {|key, value| #loop through all key and value combinations in hash\n if value == 1 #If the value is 1 it is unique so add it to the answer array to be returned\n answer << key\n end\n } \n return answer\n\nend",
"def numberOfPairs(a,k)\n count = 0\n find_arr(a,k).each do |pair|\n if uniq(pair,k)\n count += 1\n end\n end\n return count\nend",
"def find_most_frequent_integer(arr)\n count_hash = arr.each_with_object (Hash.new(0)) { |element, counts| counts[element] += 1 }\n count_hash.each { |key, value| return key if value == count_hash.values.max }\nend",
"def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend",
"def find_most_frequent_integer(arr)\n new_array=[]\n final_array=[]\n if arr.uniq.length==0\n return nil\n else\n array_to_use=arr.uniq\n array_to_use.each do |x| \n new_array << [arr.count(x), x]\n final_array=new_array.sort\n end\n end\n count_array=[]\n final_array.each do |x|\n count_array << x.reverse\n end\n just_count_array=[]\n count_array.each do |x|\n just_count_array << x.pop\n end\n z=just_count_array[-1]\n res=just_count_array[0..-2].include?(z)\n if res==false\n return final_array[-1][1]\n end\nend",
"def pairs(k, arr)\n ha = {}\n pairs = Set.new\n count = 0\n arr.to_set.each do |element|\n ha[element] = 1\n end\n arr.to_set.each do |element|\n sum = (k + element)\n if ha.key? sum\n count += 1\n end\n end\n count\nend",
"def find_most_frequent_integer(arr)\n #use a Hash to keep track of the number of duplicates\n new_hash = Hash.new(0)\n #iterate through each element in the array\n arr.each do |element|\n #add all elements to the new_hash and add one to the key's value if there's a duplicate\n new_hash[element] += 1\n end\n #make sure that the Array passed in contained something\n if new_hash.empty?\n return nil\n end\n #create empty array to add the key(s) with the \"highest value\" value(s)\n comparison_array = []\n #iterate through each key and value in new_hash\n new_hash.each do |x, y|\n #compare each value to the \"max\" value of the hash\n if y == new_hash.values.max\n #add any keys that match the \"highest value\" value in the \n #hash to the new array\n comparison_array.push(x)\n end\n end\n #check if more than one key was added to the new array\n if comparison_array.count > 1\n #if the array contains more than one element then there was more than one\n #repeated integer\n return nil\n else\n #if the array contains only one element then that element is the most\n #frequent integer\n return comparison_array[0]\n end\nend",
"def find_most_frequent_integer(arr)\n empty = {}\n max = {}\n num = nil\n \n i = 0 \n while i < arr.length\n if empty.has_key?(arr[i]) == true\n empty[arr[i]] += 1\n else\n empty[arr[i]] = 1\n end\n i+=1\n end\n \n empty.each do |key,value|\n if value == empty.values.max\n max[key] = value\n num = key\n end\n end\n \n max.length > 1 ? nil : num\n \nend",
"def find_most_frequent_integer(arr)\n most = []\n freq = Hash.new(0)\n arr.each do |i|\n freq[i] += 1\n end\n freq.each do |k,v|\n if v == freq.values.max\n most.push(k)\n end\n end\n if most.count > 1\n nil\n else return most[0]\n end\nend",
"def find_unique_elements(arr)\n\tcounts = Hash.new 0\n\tarr.each do |ele|\n\t\tcounts[ele] += 1\n\tend\n\t\n\tcounts.delete_if {|key, value| value > 1 }\n\tresult = counts.keys #Array returned with keys for non-dupe values\n\treturn result\nend",
"def unique_items(arr) #O(n)\n hash = Hash.new(0)\n results = []\n arr.each do |el|\n hash[el] += 1\n end\n hash.select { |k, v| k if v == 1 }.keys\nend",
"def grouped_anagrams(strings)\n anagram_hash = Hash.new\n\n strings.each do |word|\n sorted_string = word.chars.sort.join\n\n #Check if key exists with the sorted string already\n #In case of yes, add the word to the array value of the key \n if anagram_hash[sorted_string]\n anagram_hash[sorted_string] += [word] \n\n #If not, set it as a new key/value pair in the hash\n else \n anagram_hash[sorted_string] = [word]\n end \n end \n return anagram_hash.valuesend\n\n# This method will return the k most common elements\n# in the case of a tie it will select the first occuring element.\n# Time Complexity: O(n)\n# Space Complexity: O(n)\ndef top_k_frequent_elements(list, k)\n result = []\n\n hash = Hash.new\n \n list.each do |letter|\n if hash[letter]\n hash[letter] += 1\n else \n hash[letter] = 1\n end \n end \n\n k.times do \n max = nil\n hash.each do |num, value|\n\n if value && (max.nil? || value > max)\n max = num \n end \n end \n\n if max \n hash[max] = nil \n result << max \n end \n end \n return result end\n\n\n# This method will return the true if the table is still\n# a valid sudoku table.\n# Each element can either be a \".\", or a digit 1-9\n# The same digit cannot appear twice or more in the same \n# row, column or 3x3 subgrid\n# Time Complexity: ?\n# Space Complexity: ?\ndef valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def find_unique_elements(arr)\n collect = Hash.new 0\n \n arr.each do |elt|\n collect[elt] += 1\n end\n\n unique_hash = Hash(collect.select {|k,v| v == 1})\n \n unique_hash.keys\nend",
"def appears_most_times(array)\n hash = {}\n max = 0\n key_max = array[0]\n array.each do |num|\n if hash[num].nil?\n hash[num] = 1\n else\n hash[num] += 1\n end\n if hash[num] > max\n max = hash[num]\n key_max = num\n end\n end\n key_max\nend",
"def mode(array)\n count = Hash.new 0\n array.each do |n|\n count[n] += 1\n end\n\n frequency = count.values.max\n \n x = []\n count.each do |k, v|\n if frequency == v \n x.push k\n end\n end\n x\nend",
"def find_most_frequent_integer(arr)\n highest_value = Hash.new(0)\n store_integer = Array.new\n arr.each do |x|\n highest_value[x] += 1\n end\n highest_value.each do |key,value|\n if value == highest_value.values.max \n store_integer.push(key) #need to put the highest value somewhere, so an array it will have to be! This was the hardest step for me. I could figure out how to return the key from the above step, but that wasn't helpful since one couldn't directly compare the keys (but putting them in an array worked.)\n end\n end \n if store_integer.length == 0 or store_integer.length >= 2 #This will return nil if there is no most frequent integer (like in the case of an empty hash), or if there are several of the most frequent integer amount\n return nil\n else\n return store_integer[0] \n end \n \nend",
"def k_largest_elements(array, k)\n heap = BinaryMinHeap.new { |a,b| b <=> a }\n result = []\n array.each do |el|\n heap.push(el)\n if heap.count > array.length - k\n result << heap.extract\n end\n end\n\n result\nend",
"def mode(array)\n freq = Hash.new(0)\n\n array.each do |i|\n freq[i] += 1\n end\n\n temp = Array.new\n largest = 0\n\n freq.each do |k, v|\n if(v > largest)\n temp.clear\n temp.push(k)\n largest = v\n elsif(v == largest)\n temp.push(k)\n end\n end\n\n return temp\nend",
"def k_largest_elements(array, k)\nend",
"def find_most_frequent_integer(arr)\n counts = Hash.new(0)\n\n arr.each do |int|\n counts[int] += 1\n end\n\n freq = counts.values\n # returns array of frequencies [2,1]\n\n if freq.uniq! == false && freq.uniq.length > 1\n freq.max\n counts.key(freq.max)\n else\n nil\n end\n\n \nend",
"def key_indexed_counting(arr, max)\n count = Array.new(max + 1, 0)\n\n arr.each { |num| count[num + 1] += 1 }\n idx = 0\n while idx < max\n count[idx + 1] += count[idx]\n idx += 1\n end\n\n aux = []\n arr.each do |num|\n aux[count[num]] = num\n count[num] += 1\n end\n\n arr.each_index do |idx|\n arr[idx] = aux[idx]\n end\n\n arr\nend",
"def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\nend",
"def mode(array)\n instance = Hash.new(0)\n array.each do |item|\n instance[item] += 1\n end\n most_frequent = instance.values.max\n p instance.collect { |k, v| k if v == most_frequent }.compact\nend",
"def compute_element_occurrence(values)\n uniq_elements = Hash.new(0)\n values.map { |x| uniq_elements[x] += 1 }\n uniq_elements\nend",
"def my_uniq(arr)\n #make hash with each item in teh array as a key, and the value will be its frequency\n new_arr = []\n freqhash = Hash.new(0)\n arr.each do |ele| \n freqhash[ele] += 1\n end\n \n freqhash.each do |k, v| \n new_arr << k\n end\n \n new_arr\nend",
"def counting_sort(input, k)\n counts = Array.new(k+1)\n sorted = Array.new(input.size)\n (0..k).each { |i| counts[i] = 0 }\n # set counts [i] to the number of elements equal to i\n input.each { |element| counts[element] += 1 }\n # to preserve STABILITY we actually have to\n # track the less than or equal counts and\n # use the input array, however if we were just sorting\n # integers, (or things we don't care about for stability)\n # we could just iterate the counts from large to small\n # and output that many elements of i to the end of the output array\n\n # set counts[i] to the number of elements in input <= i\n (1..k).each { |i| counts[i] += counts[i-1] }\n # now lay everything into the output\n (input.size-1).downto(0).each do |index|\n input_elem = input[index]\n counts_elem = counts[input_elem] # ow many elements are less than this?\n # our arrays are zero indexed\n output_index = counts_elem - 1\n sorted[output_index] = input_elem\n counts[input_elem] -= 1\n end\n sorted\nend",
"def mode(array)\n\thash = Hash.new(0)\n \t\tarray.each do |i|\n \t\thash[i] += 1\n \tend\n\tfinal_array = []\n \tn = 0\n \tfrequent_value = hash.values[0]\n \twhile n < hash.length\n\t\tif frequent_value < hash.values[n]\n \t\tfrequent_value = hash.values[n]\n \tend\n \tn += 1\n \tend\n \thash.each do |key, val|\n \tif val == frequent_value\n \t\tfinal_array.push(key)\n \tend\n \tend\n \tp final_array\nend",
"def hash_letter_freq( array )\n\n i = 0 # keeps track of outter loop\n hash = Hash.new()\n\n while( array.length > i )\n\n count = 1\n\n i2 = 1 + i # keeps track of inner while loop\n\n while( array.length > i2 ) # this will never check the last element of the array - otherwise have i2 check itself by doing i2 = i\n\n # puts(\"i #{i} | i2 #{i2}\") -- check if iteration is made right\n\n if( array[i] == array[i2] )\n count += 1\n end\n\n i2 += 1\n end # inner - while\n\n # alternative cond: hash.has_key?(\"#{array[i]}\") http://ruby-doc.org/core-1.9.3/Hash.html#method-i-has_key-3F\n if( hash[\"#{array[i]}\"] == nil ) # checks if key exists\n hash[\"#{array[i]}\"] = count\n end\n\n # for the last element in the array -- skipped by i2\n if( i2 == array.length )\n if( hash[\"#{array[i]}\"] == nil )\n hash[\"#{array[i]}\"] = 1\n end\n end\n\n\n i += 1\n end # while -outter\n\n # puts( hash )\n return hash\n\nend",
"def element_count(arr)\n # Write your code here\n array = arr.uniq\n result = {}\n i = 0\n x = array.length\n loop do\n result.store(array[i],arr.count(array[i]))\n i += 1\n break if i == x\n end \nreturn result\nend",
"def unique_elements(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] += 1}\n return hash.keys\n\nend",
"def counting_sort(arr, k)\n\t# auxiliary array\n\tc = []\n\t# resulting array\n\tb = []\n\t# set all in aux to 0\n\tfor i in 0..k\n\t\tc[i] = 0\n\tend\n\t# get count of each number\n\tarr.each do |i|\n\t\tc[i] += 1\n\tend\n\t# get number of smaller or equal to number at i index\n\t# by keeping a sum\n\tfor i in 1..k\n\t\tc[i] = c[i] + c[i-1]\n\tend\n\t# sort\n\tj = arr.length-1\n\twhile j >= 0\n\t\tb[c[arr[j]]-1] = arr[j]\n\t\tc[arr[j]] -= 1\n\t\tj -= 1\n\tend\n\tb\nend",
"def mode(arr)\n\th = {}\n\tarr.each do |x| \n\t\th [x] = arr.count(x)\n\tend\n\tarr = h.values.sort\n highest_count = arr.last\n h.select {|k,v| v == highest_count}.keys\nend",
"def count_elements(array)\n counts = Hash.new 0\n unique_elements = array.uniq\n\n unique_elements.each do |item|\n item[:count] = array.count(item)\n end\n\n unique_elements\nend",
"def most_common_value(a)\n a.group_by do |e|\n e\n end.values.max_by(&:size).first\nend",
"def unique_elements(arr)\n my_hash = Hash.new(0)\n arr.each do |element|\n my_hash[element] += 1\n end\n return my_hash.keys\nend",
"def mode (array)\n hash = Hash.new (0)\n array.each { |item|\n hash[item] += 1}\n hash\n\n frequency = hash.values.max\n new_array = []\n\n hash.each { |key, value|\n if frequency == value\n new_array.push(key)\n end}\n new_array\nend",
"def most_common(arr) #sort array first\n arr.sort!\n most_common = 0\n most_common_count = 0\n type_count = 0\n prev = 0\n\n arr.each do |type|\n if prev == type\n type_count += 1\n else\n prev = type\n type_count = 1\n end\n\n if type_count > most_common_count\n most_common = type\n most_common_count = type_count\n end\n end\n\n most_common\nend",
"def k_most_visited input, k\n \n hotels_to_visits = Hash.new\n \n input.each do |user|\n user.each do |hotel_id|\n hotels_to_visits[hotel_id] = (hotels_to_visits[hotel_id] || 0) + 1\n end\n end\n \n sorted_hotels_and_visits = hotels_to_visits.to_a.sort { |a,b| a[1] < b[1] }\n \n return sorted_hotels_and_visits[0..k]\n \nend",
"def unique_elements(arr)\n hash = Hash.new(0)\n arr.each { |ele| hash[ele] += 1}\n hash.keys\nend",
"def find_unique_elements(arr)\n \n#Algorithmic Process\n#Create an array that includes elements without the repeats\n#Create a hash that pairs each element of the new array with how many times it appears in the original array\n#Any key-value pair that has 1 for a value is unique and gets placed in the desired array\n \nnew_hash = {}\narr.each do |x|\n new_hash[x] = 0 if new_hash[x].nil?\n new_hash[x] = new_hash[x] + 1\nend\n\nnew_hash.delete_if {|key, value| value != 1}\nnew_hash.each_key {|key| puts key}\n\nend",
"def pairs(k, arr)\n # set = Set.new(arr)\n set = arr.to_h { |num| [num, true] }\n\n result = 0\n arr.each do |num|\n target = num + k\n if set.include?(target)\n result += 1\n end\n end\n\n result\nend",
"def pair_sum(array, k)\n result = Set.new\n hash_num = Hash.new\n\n array.each{|n| hash_num[n] = k - n}\n\n array.each do |n|\n unless hash_num[hash_num[n]].nil?\n result.add([hash_num[n], n].sort)\n end\n end\n\n result\nend",
"def majority_element_3(nums)\n majority = nums.size / 3\n result = []\n counts = nums.inject({}) { |acc, n| \n acc[n] ||= 0\n acc[n] += 1\n if acc[n] > majority && !result.include?(n)\n result << n\n end\n \n acc\n }\n \n return result\nend",
"def unique_elements(arr)\n\n # hash count -> duplicate removed -> return a new array\n new = []\n\n # count = Hash.new(0) # create {} with default value 0\n arr.each do |ele|\n if !new.include?(ele)\n new << ele\n end\n end\n # print count # {\"a\"=>3, \"b\"=>2, \"c\"=>1}\n\n return new \nend",
"def count_elements(arr)\n hash = {}\n count = 0\n\n arr.each do |x|\n if !hash.key?(x)\n hash[x] = true\n end\n end\n\n arr.each do |x|\n if hash.key?(x+1)\n count += 1\n end\n end\n\n count\nend",
"def mode(arr)\n count = Hash.new(0)\n arr.each { |value| count[value] += 1 }\n count = count.sort_by { |key, value| value }\n count.reverse!\n high = count[0][1]\n count.select! { |key, value| value == high } \n result = count.collect(&:first)\n result.sort!\nend",
"def count_occurrences(arr)\n keys = arr.uniq\n keys.map do|key| \n [key, arr.count {|v| v == key }]\n end\nend",
"def duplicates_subarray3(arr)\n arr.uniq.map { |elm| [elm] * arr.count(elm)}.sort_by {|subarr| subarr[0].ord }\nend",
"def mode(array)\n hash = Hash.new(0)\n num_a = []\n final_a = Array.new\n\n array.each do |value|\n hash[value] += 1\n end\n\n num_a = hash.values.sort\n\n hash.each do |k,v|\n if v == num_a[-1]\n final_a << k\n end\n end\n\n return final_a\nend",
"def count_occurences(array)\n\n # interate over array and add unique values as keys to a new hash\n unique_values = {}\n\n array.each do |item|\n if unique_values.keys.include?(item) == false\n unique_values[item] = 0\n end\n end\n # ------------\n\n\n # interate over hash and array, +1 the value of key for every match in array\n unique_values.each_key do |key|\n array.each do |item|\n if key == item\n unique_values[key] += 1\n end\n end\n end\n\n unique_values\nend",
"def mode(array)\n freq_hash = Hash.new(0)\n #hash_array = Hash[array.map{|x| [x,0]}]\n array.each do |arg|\n freq_hash[arg] += 1\n end\n freq_hash\n new_array = Array.new\n\n freq_hash.each do |key,value|\n if value == freq_hash.values.max\n new_array.push(key)\n end\n end\n new_array\nend",
"def unique_elements(array)\n hash = Hash.new(0)\n array.each { |ele| hash[ele] += 1 }\n\n hash.keys\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def mode(array)\n new_hash = Hash.new\n array.uniq.each {|x| new_hash[x] = 1}\n new_hash.each {|element, value| new_hash[element] = array.count(element)}\n max = 0\n new_hash.each {|key, value| max = value if value > max}\n new_hash.select! {|key, value| value == max}\n return new_hash.keys\nend",
"def find_duplicates(array)\n result_hash = {}\n result_array = []\n\n array.each do |num|\n if result_hash[num].nil?\n result_hash[num] = 1\n else\n result_hash[num] += 1\n end\n end\n\n result_hash.each do |k, v|\n result_array.push(k) if v > 1\n end\n\n result_array\nend",
"def mode(array)\n count = Hash.new(0)\n array.each {|element| count[element] += 1}\n max = count.values.max\n count.keep_if {|key,value| value == max}\n count.keys\nend",
"def count_elements(array)\n array.group_by(&:itself).map { |key, value| key.merge(count: value.length)} # counts number of times occur\nend"
] |
[
"0.7957266",
"0.7929317",
"0.78502864",
"0.7811906",
"0.7798034",
"0.77936715",
"0.7775621",
"0.77672654",
"0.77605575",
"0.7752809",
"0.77316654",
"0.77315664",
"0.7683785",
"0.76756597",
"0.7651884",
"0.7635849",
"0.76263773",
"0.7612502",
"0.76046515",
"0.75953776",
"0.7580258",
"0.7571457",
"0.75696725",
"0.75597167",
"0.75585115",
"0.75363016",
"0.7483539",
"0.7470034",
"0.745849",
"0.7433237",
"0.7429568",
"0.7407048",
"0.73733425",
"0.6823394",
"0.6823394",
"0.6823394",
"0.6823394",
"0.68222797",
"0.6808219",
"0.6801535",
"0.6636317",
"0.65470815",
"0.65384483",
"0.65003437",
"0.64499944",
"0.6371427",
"0.6369078",
"0.6356541",
"0.63336426",
"0.6331411",
"0.63279533",
"0.63167834",
"0.63022023",
"0.6294315",
"0.6267123",
"0.62626475",
"0.62478507",
"0.62288696",
"0.62182146",
"0.6214826",
"0.6203439",
"0.6195467",
"0.6188389",
"0.6187183",
"0.6178767",
"0.6150375",
"0.6143226",
"0.61284614",
"0.61277956",
"0.6116823",
"0.6103157",
"0.6096326",
"0.6089459",
"0.60691494",
"0.6068613",
"0.6063319",
"0.60632217",
"0.6055314",
"0.6048545",
"0.60440296",
"0.60421604",
"0.6037415",
"0.6033427",
"0.6031785",
"0.60231924",
"0.6011946",
"0.60006833",
"0.5993315",
"0.59792536",
"0.5973646",
"0.59661406",
"0.59652734",
"0.5946803",
"0.5942993",
"0.5940629",
"0.59395033",
"0.5937971",
"0.5936855",
"0.59227145",
"0.59218615"
] |
0.75547165
|
25
|
This method will return the true if the table is still a valid sudoku table. Each element can either be a ".", or a digit 19 The same digit cannot appear twice or more in the same row, column or 3x3 subgrid Time Complexity: ? Space Complexity: ?
|
def valid_sudoku(table)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def valid_sudoku(table)\n table.each do |row|\n row_map = {}\n row.each do |elem|\n if elem != '.'\n if row_map[elem] \n return false\n else\n row_map[elem] = 1\n end\n end\n end\n end\n \n i = 0\n 9.times do\n column_map = {}\n table.each do |row|\n col = row[i]\n if col != '.'\n if column_map[col] \n return false\n else\n column_map[col] = 1\n end\n end\n\n end\n k += 1\n end\n \n i = 0\n k = 0\n 9.times do\n box_map = {}\n while i < i + 3\n while k < k + 3\n \n end\n end \n end\n \n return true\nend",
"def valid_sudoku(table)\n subgrids = {}\n\n # return false if any element is repeated in a row\n table.each do |row|\n row_count = {}\n row.each do |element|\n if row_count[element]\n return false unless element == \".\"\n else\n row_count[element] = 1\n end\n end\n end\n\n # return false if any element is repeated in a column\n columns = {\n 0 => {},\n 1 => {},\n 2 => {},\n 3 => {},\n 4 => {},\n 5 => {},\n 6 => {},\n 7 => {},\n 8 => {},\n }\n table.each do |row|\n row.each_with_index do |element, index|\n if columns[index][element]\n return false unless element == \".\"\n else\n columns[index][element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[0..2].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[3..5].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[6..8].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n return true\nend",
"def valid_sudoku(table)\n # edge cases\n return false if table.nil? || table.size != 9 || table[0].size != 9\n # 3 new storages will count number of occurances of each element for columns, rows and sub-boxes\n rows = Array.new(9)\n i = 0\n while i < rows.size\n rows[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n columns = Array.new(9)\n i = 0\n while i < columns.size\n columns[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n sub_boxes = Array.new(9)\n i = 0\n while i < sub_boxes.size\n sub_boxes[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n # loop through the input table to populate the above created storages with occurance numbers\n i = 0 # i is a row counter\n while i < table.size\n j = 0 # j is a column counter\n while j < table.size\n if table[i][j] != \".\"\n rows[i][table[i][j]] += 1\n columns[j][table[i][j]] += 1\n # find a number of a box/hash by calculating (i/3)*3 + (j/3)\n # e.g. for the element at indexes 1,2 the box will be: (1/3)*3 + (2/3) = 0, first box\n sub_boxes[(i/3)*3 + (j/3)][table[i][j]] += 1\n end\n j += 1\n end\n i += 1\n end\n # check if any of table elements occured more than 1 time within a row, a column or a sub-box\n rows.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n columns.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n sub_boxes.each_with_index do |hash, i|\n return false if hash.any? { |key, value| value > 1}\n end\n\n return true\nend",
"def valid_sudoku(table)\n store = {\n rows: {},\n cols: {},\n square: {},\n }\n # First loop it represents the first row we are checking\n # Second loop it represents the column.\n\n (0...9).each do |i|\n (0...9).each do |j|\n box = table[i][j]\n if !store[:rows][i] && box != \".\"\n store[:rows][i] = []\n store[:rows][i].push(box)\n elsif box != \".\" && !store[:rows][i].include?(box)\n store[:rows][i].push(box)\n elsif store[:rows][i] && store[:rows][i].include?(box)\n return false\n end\n\n if !store[:cols][j] && box != \".\"\n store[:cols][j] = []\n store[:cols][j].push(box)\n elsif box != \".\" && !store[:cols][j].include?(box)\n store[:cols][j].push(box)\n elsif store[:cols][j] && store[:cols][j].include?(box)\n return false\n end\n\n # Converting to float and the ceil to round up always.\n squareRowId = ((i + 1).to_f / 3).ceil\n squareColId = ((j + 1).to_f / 3).ceil\n # The squeare id is gonna be like\n # 1-1 , 1-2, 1-3\n # 2-1 , 2-2, 2-3\n # 3-1 , 3-2, 3-3\n\n squareId = \"#{squareRowId}-#{squareColId}\"\n\n # Here insted of checking rows and colums I will be checking the numbers inside of this\n # Squeare ids.\n if !store[:square][squareId] && box != \".\"\n store[:square][squareId] = []\n store[:square][squareId].push(box)\n elsif box != \".\" && !store[:square][squareId].include?(box)\n store[:square][squareId].push(box)\n elsif store[:square][squareId] && store[:square][squareId].include?(box)\n return false\n end\n end\n end\n return true\nend",
"def valid_sudoku(table)\n sudoku_box_hash = { [0, 0] => {}, [0, 1] => {}, [0, 2] => {},\n [1, 0] => {}, [1, 1] => {}, [1, 2] => {},\n [2, 0] => {}, [2, 1] => {}, [2, 2] => {}}\n\n sudoku_row_hash = { 1 => {}, 2 => {}, 3 => {},\n 4 => {}, 5 => {}, 6 => {},\n 7 => {}, 8 => {}, 9 => {}}\n \n sudoku_col_hash = { 1 => {}, 2 => {}, 3 => {},\n 4 => {}, 5 => {}, 6 => {},\n 7 => {}, 8 => {}, 9 => {}}\n\n sudoku_diagonal_hash = {1 => {}, 9 => {}}\n\n table.each_with_index do |arr, i|\n arr.each_with_index do |ele, j|\n next if ele == \".\"\n # check and add diagonals\n if i == j \n return false if sudoku_diagonal_hash[1].include?(ele)\n sudoku_diagonal_hash[1][ele] = 1\n elsif i + j + 1 == 9 || i == 4 && j == 4\n return false if sudoku_diagonal_hash[9].include?(ele)\n sudoku_diagonal_hash[9][ele] = 1\n end\n\n # check these hashes for all elements\n return false if sudoku_row_hash[i + 1].include?(ele)\n return false if sudoku_col_hash[j + 1].include?(ele)\n return false if sudoku_box_hash[[i / 3, j / 3]].include?(ele)\n\n # can add if no return \n sudoku_row_hash[i + 1][ele] = 1\n sudoku_col_hash[j + 1][ele] = 1\n sudoku_box_hash[[i / 3, j / 3]][ele] = 1 # based off calculating indices of ecah sudoku box\n end\n end\n\n return true\nend",
"def valid_sudoku(table)\n row_list = {}\n col_list = {}\n\n i = 0\n while i < table.length \n j = 0\n\n while j < table[i].length\n \n row_num = table[i][j]\n col_num = table[j][i]\n\n row_list = update_sub_grid(row_list, row_num)\n return false if !row_list\n\n col_list = update_sub_grid(col_list, col_num)\n return false if !col_list\n\n j += 1\n end\n\n\n row_list = {}\n col_list = {}\n \n i += 1\n end\n\n\n starting_points = [\n [0, 0],\n [0, 3],\n [0, 6],\n [3, 0],\n [3, 3],\n [3, 6],\n [6, 0],\n [6, 3],\n [6, 6]\n ]\n\n starting_points.each do |row_start, col_start|\n return false if !valid_sub_grid(table, row_start, col_start)\n end \n\n return true\nend",
"def valid_sudoku(table)\n numbers = {}\n\n # iterate through each row and confirm valid\n row = 0\n while row < table.length\n table[row].each do |value|\n return false if !check_value(numbers, value)\n end\n\n numbers = {}\n row += 1\n end\n\n # iterate through each column and confirm valid\n numbers = {}\n col = 0\n while col < table[0].length\n (0..8).each do |x|\n value = table[x][col]\n\n return false if !check_value(numbers, value)\n end\n\n numbers = {}\n col += 1\n end\n\n # create list of each sub-box's upper left corner\n corners = []\n (0..2).each do |row|\n (0..2).each do |col|\n corners << [row * 3, col * 3]\n end\n end\n\n # iterate through the list of corners to see if each value is unique within the sub-box\n numbers = {}\n index = 0\n while index < corners.length\n (0..2).each do |x|\n (0..2).each do |y|\n x_point = corners[index][0] + x\n y_point = corners[index][1] + y\n value = table[x_point][y_point]\n\n return false if !check_value(numbers, value)\n end\n end\n\n numbers = {}\n index += 1\n end\n\n return true\nend",
"def sudoku_valid? grid\n \n # grid has first index for row, 2nd index for column\n \n # Check every row\n grid.each do |row|\n seen = Set.new\n (0..9).each do |row_value|\n if !seen.add?(row_value)\n return false\n end\n end\n end\n \n # Check every column\n grid.each do |row|\n seen = Set.new\n row.each do |col_value|\n if !seen.add?(col_value)\n return false\n end\n end\n end\n \n # Check every 3x3\n [0,3,6].each do |offset|\n [0,3,6].each do |offset2|\n to_check = get3by3 grid, offset, offset2\n seen = Set.new\n to_check.each do |value|\n if !seen.add?(value)\n return false\n end\n end\n end\n end\n \n \n return true\nend",
"def valid_sudoku(table)\n l = table.length\n # row, time l * l\n table.each do |row|\n return false if !sudoku_helper(row)\n end\n \n # column, time l * 2l\n l.times do |i|\n column = []\n l.times do |j|\n column << table[j][i]\n end\n return false if !sudoku_helper(column)\n end\n \n # area, time l * 2l\n x = Integer.sqrt(l)\n m = n = 0\n x.times do\n x.times do \n area = []\n x.times do |i|\n area += table[n + i][m...(m+x)]\n end\n return false if !sudoku_helper(area)\n m += x\n end\n n += x\n m = 0\n end\n return true\nend",
"def sudoku2(grid)\n \n i = 0\n \n while i < grid.length\n hash = Hash.new(0)\n j = 0\n\n while j < grid[0].length\n hash[grid[i][j]] += 1\n return false if hash[grid[i][j]] > 1 && grid[i][j] != '.'\n j += 1\n end\n i += 1\n end\n\n i = 0\n\n while i < grid[0].length\n hash = Hash.new(0)\n j = 0\n\n while j < grid.length\n hash[grid[j][i]] += 1\n return false if hash[grid[j][i]] > 1 && grid[j][i] != '.'\n j += 1\n end\n i += 1\n end\n\n true && grid_builder(grid)\nend",
"def valid?\n 0.upto(8) { |row| return false if @rows[row].uniq! }\n 0.upto(8) { |column| return false if @columns[column].uniq! } \n 0.upto(8) { |box| return false if @boxes[box].uniq! }\n\n return true\n end",
"def valid_sudoku(table)\n\n return true if in_row?(table) && in_column?(table) && in_box?(table)\n\n return false\n\nend",
"def valid\n for i in 0..(@n-1)\n for j in 0..(@m-1)\n return false if @maze_table[2*j+1][2*i+1] == \"1\"\n walls = 0\n walls += 1 if @maze_table[2*j][2*i+1] == \"1\"\n walls += 1 if @maze_table[2*j+2][2*i+1] == \"1\"\n walls += 1 if @maze_table[2*j+1][2*i+2] == \"1\"\n walls += 1 if @maze_table[2*j+1][2*i] == \"1\"\n return false if walls < 1 || walls > 3\n end\n end\n for i in 0..(@maze_table.size-1)\n return false if @maze_table[i][0] == \"0\" || @maze_table[i][2*@n] == \"0\"\n end\n for i in 0..(@maze_table[0].size-1)\n return false if @maze_table[0][i] == \"0\" || @maze_table[2*@m][i] == \"0\"\n end\n return true\n end",
"def is_valid_sudoku(board)\n transposed_board = board.transpose\n board.each_with_index do |row, r_index|\n row.each_with_index do |cell, c_index|\n # check row\n # check column\n if !check_row(row, cell, c_index) || !check_row(transposed_board[c_index], cell, r_index)\n p \"False at: #{cell}, #{r_index}, #{c_index}\"\n return false\n end\n end\n end\n return true\nend",
"def validate(section)\n \n #Rows, Columns or Blocks\n #--------------------------------------------------\n section.each do |i|\n check = i.sort.join.squeeze(\"0\")\n if check.length > check.split(\"\").uniq.length\n\tputs \"***************************************************\"\n\tputs \"Failed Validation, Values did not meet sudoku rules\"\n\tputs \"***************************************************\"\n\treturn false\n end\n end \n \n #Return true if all validations passed\n #--------------------------------------------------\n return true\n end",
"def consistent?\n ret = true\n # Check every row first\n @board.each_row do |row|\n row_numbers = Set.new\n row.each do |cell|\n n = cell.number\n if n and row_numbers.include? n\n ret = false\n end\n row_numbers << n\n end\n end\n # Check every column\n @board.each_column do |col|\n col_numbers = Set.new\n col.each do |cell|\n n = cell.number\n if n and col_numbers.include? n\n ret = false\n end\n col_numbers << n\n end\n end\n # Check every region\n @board.each_region do |reg|\n reg_numbers = Set.new\n reg.each do |cell|\n n = cell.number\n if n and reg_numbers.include? n\n ret = false\n end\n reg_numbers << n\n end\n end\n return ret\n end",
"def valid?\n # Valid puzzle has 9 rows.\n unless @puzzle.size == 9\n raise RuntimeError, \"Sudoku puzzle must have 9 rows.\"\n end\n\n # Valid puzzle has 9 columns of 9 cells.\n each_row do |row|\n unless row.size == 9\n raise RuntimeError, \"Each row in the Sudoku puzzle must have 9 cells.\"\n end\n end\n\n # Valid puzzle has valid cells.\n each do |cell|\n cell.valid?\n end\n\n #TODO: Find out if there are conflicts in row, column or nonet.\n\n # If we get this far without error, the puzzle is valid.\n return true\n end",
"def validSolution(board)\n return false if board.flatten.size != 81\n return false if board.flatten.any? { |el| el.class != Fixnum }\n return false if board.size != 9\n board.each do |row|\n return false if row.any? { |el| el < 1 || el > 9 }\n return false if row.uniq.size != 9\n end\n (0..8).each do |col|\n this_col = []\n (0..8).each do |el|\n this_col << board[el][col]\n end\n return false if this_col.uniq.size != 9\n end\n [-1, 2, 5].each do |xoffset|\n [-1, 2, 5].each do |yoffset|\n this_square = []\n (1..3).each do |x|\n (1..3).each do |y|\n this_square << board[x + xoffset][y + yoffset]\n end\n end\n return false if this_square.uniq.size != 9\n end\n end\n true\nend",
"def valid?\n 1.upto(puzzle.size) { |index| return false unless valid_row?(index - 1) && valid_column?(index - 1) }\n sections.all? { |section| valid_section?(section) }\n end",
"def solved?\n cols = @grid.transpose\n return false unless (0..8).all? {|i| check_cols(i) && check_row(i)}\n (0..2).each do |horiz| \n (0..2).each {|vert| return false unless check_square(horiz,vert)}\n end\n true\n end",
"def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end",
"def checkSubgrid(row, col, num)\n\t\tx = (row / 3) * 3\n\t\ty = (col / 3) * 3\n\n\t\tbox = @sudokuBoard[x][y..(y+2)] + @sudokuBoard[x+1][y..(y+2)] + @sudokuBoard[x+2][y..(y+2)]\n\t\tdisjointSet = box - [num]\n\t\tif disjointSet.length == 9 then\n\t\t\t# Safe to add num to the row.\n\t\t\treturn true\n\t\telse\n\t\t\t# Unsafe to add num to the row, since it already existed there.\n\t\t\treturn false\n\t\tend\n\t\t\n\t\n\t\n\t\n\tend",
"def valid?\n cells.find_all(&:filled?).compact.length == 1\n end",
"def validateBoard()\n #cycle through all lines in the file\n row = 0\n for row in 0..8\n # @gameboard index\n index = 0\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n while index<@DIMENSION\n if (1..9).member? @gameboard[row * @DIMENSION + index]\n if temp.include? @gameboard[row * @DIMENSION + index]\n return false\n else\n temp[i] = @gameboard[row * @DIMENSION + index]\n i += 1\n end\n end\n index += 1\n end\n end\n #cycle through all columns in the file\n column = 0\n for column in 0..8\n # @gameboard index\n index = 0\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n while index<@DIMENSION\n if (1..9).member? @gameboard[column + index * @DIMENSION]\n if temp.include? @gameboard[column+ index * @DIMENSION]\n return false\n else\n temp[i] = @gameboard[column+ index * @DIMENSION]\n i += 1\n end\n end\n index += 1\n end\n end\n #cycle through all @DEIMENSION squares in the file\n startIndex = 0\n rowBase = 0\n columnBase = 0\n for rowBase in 0..2\n startIndex = rowBase * 3 * @DIMENSION\n for columnBase in 0..2\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n #find the real index in @gameboard\n l = 0\n for l in 0..2\n m = 0\n for m in 0..2\n index = startIndex + m * @DIMENSION + l\n if (1..9).member? @gameboard[index]\n if temp.include? @gameboard[index]\n return false\n else\n temp[i] = @gameboard[index]\n i += 1\n end\n end\n end\n end\n startIndex += 3\n end\n end\n return true\nend",
"def valid_rows?\n valid = true\n row = 0\n while (row < @board.length && valid)\n valid = false if !unique_arr?(@board[row])\n row += 1\n end\n valid\n end",
"def check_sudoku(grid)\n return (check_rows(grid) and check_cols(grid) and check_squares(grid))\nend",
"def legal?\n [rows, columns, boxes].all? do |group|\n group.all? { |_, n| n.uniq == n }\n end\n end",
"def all_valid\n # Check the vertical\n @size.times { |i|\n if !valid_column(i)\n return false\n end\n }\n\n # Check the diagonal\n @size.times { |i|\n if !valid_diagonal(true, true, i)\n return false\n end\n if !valid_diagonal(true, false, i)\n return false\n end\n if !valid_diagonal(false, true, i)\n return false\n end\n if !valid_diagonal(false, false, i)\n return false\n end\n }\n\n # Check the horizontal\n @size.times { |i|\n if !valid_row(i)\n return false\n end\n }\n\n return true\n end",
"def b_check sym \n\t\t#check rows\n\t\ti=0\n\t\twhile i<@arr.length\n\t\t\tgame_finished=true\n\t\t\tj=0\n\t\t\twhile j<@arr.length\n\t\t\t\tif @arr[i][j]!=sym\n\t\t\t\t\tgame_finished=false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tj=j+1\n\t\t\tend\n\t\t\tif game_finished\n\t\t\t\treturn game_finished\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\t# check colmns\n\t\ti=0\n\t\twhile i<@arr.length\n\t\t\tgame_finished=true\n\t\t\tj=0\n\t\t\twhile j<@arr.length\n\t\t\t\tif @arr[j][i]!=sym\n\t\t\t\t\tgame_finished=false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tj=j+1\n\t\t\tend\n\t\t\tif game_finished\n\t\t\t\treturn game_finished\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\t#check diagonals\n\t\ti=0\n\t\tgame_finished=true\n\t\tj=@arr.length-1\n\t\twhile i<@arr.length\n\t\t\tif @arr[i][j]!=sym\n\t\t\t\tgame_finished=false\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti=i+1\n\t\t\tj=j-1\n\t\tend\n\t\tif game_finished\n\t\t\treturn game_finished\n\t\tend\n\n\t\ti=0\n\t\tgame_finished=true\n\t\tj=0\n\t\twhile i<@arr.length\n\t\t\tif @arr[i][j]!=sym\n\t\t\t\tgame_finished=false\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti=i+1\n\t\t\tj=j+1\n\t\tend\n\t\tif game_finished\n\t\t\treturn game_finished\n\t\tend\n\t\treturn false\n\tend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def sudoku_clauses\n res = []\n\n #ensure each cell contains a digit\n (1..9).each do |i|\n (1..9).each do |j|\n #must contains at least one of 9 digits\n res << (1..9).map {|d| variable(i, j, d) }\n\n (1..9).each do |d|\n ((d+1)..9).each do |dp|\n #can not contain two digits at once\n res << [-variable(i, j, d), -variable(i, j, dp)]\n end\n end\n end\n end\n\n #ensure each rows and columns contain distinct values\n (1..9).each do |i|\n res += valid( (1..9).map{|j| [i, j]} )\n res += valid( (1..9).map{|j| [j, i]} )\n end\n\n #ensure 3x3 sub-grids regions have distinct values\n [1, 4, 7].each do |i|\n [1, 4, 7].each do |j|\n res += valid((0..8).map{|k| [i + k%3, j+k / 3]})\n end\n end\n\n res\n end",
"def sudoku_not_filled?\n flg = false\n @sudoku.each do |row|\n flg = true if row.include? \" \"\n end\n flg\n end",
"def validate\n\n entireSet = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9])\n\n @rows = []\n 9.times { @rows.push(entireSet.dup) }\n\n @cols = []\n 9.times { @cols.push(entireSet.dup) }\n\n @box = []\n 3.times do\n subrow = []\n 3.times { subrow.push(entireSet.dup) }\n @box.push(subrow)\n end\n\n (0..8).each do |i|\n (0..8).each do |j|\n v = @grid[i,j]\n if v > 0\n raise \"dup number in row #{i} : #{v}\" unless @rows[i].delete?(v)\n raise \"dup number in column #{j} : #{v}\" unless @cols[j].delete?(v)\n raise \"dup number in box #{i/3}-#{j/3} : #{v}\" unless @box[i/3][j/3].delete?(v)\n end\n end\n end\n\n @poss = []\n @poss_grid = []\n (0..8).each do |i|\n poss_row = []\n (0..8).each do |j|\n if @grid[i,j] == 0 then\n p = Poss.new(i, j, @rows[i], @cols[j], @box[i/3][j/3])\n @poss.push(p)\n poss_row.push(p.to_a)\n else\n poss_row.push([])\n end\n end\n @poss_grid.push(poss_row)\n end\n @poss.sort! { |x, y| x.length <=> y.length }\n\n end",
"def board_solved?\r\n # Check that all the cells are filled with values\r\n #\r\n (0 .. 8).each do |row|\r\n (0 .. 8).each do |col|\r\n return false unless board[row][col] > 0\r\n end\r\n end\r\n \r\n # Check column constraints\r\n #\r\n @board.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check row constraints\r\n #\r\n @board.transpose.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check box constraints\r\n #\r\n (0 .. 2).each do |box_x|\r\n (0 .. 2).each do |box_y|\r\n box_vals = []\r\n \r\n (0 .. 2).each do |i|\r\n (0 .. 2).each do |j|\r\n box_vals << @board[3 * box_x + i][3 * box_y + j]\r\n end\r\n end\r\n \r\n return false unless box_vals.uniq.size == 9\r\n end\r\n end\r\n \r\n true\r\n end",
"def solved?(board)\n board.all? { |row| row.flatten.length == 9 && row.sort == [1,2,3,4,5,6,7,8,9] }\nend",
"def valid?(board_array)\n board_array.each { |row| return false if row.length != row.uniq.length }\n return true\nend",
"def cell_validate\n height = 2 * self.down - 1\n width = 2 * self.across - 1\n for i in (1..height).step(2) do\n for j in (1..width).step(2) do\n wall_num = calculate_boundary_sum(i,j)\n if(wall_num == 4 || wall_num == 0)\n puts \"[#{j/2},#{i/2}] is an invalid cell. Please enter another valid string\"\n self.valid = false\n end\n end\n end\n end",
"def valid?\n 81.times do |i|\n return false if @board[i] == 0\n return false unless check?(i)\n end\n\n true\n end",
"def row_checker(puzzle_digit_location_hash)\n for i in 0...ROW_LENGTH\n current_row = row_selector(i, puzzle_digit_location_hash)\n current_row_digits = digit_selector(current_row)\n current_row_digits.size == current_row_digits.uniq.size ? solution_okay = true : solution_okay = false\n break if solution_okay == false\n end\n solution_okay\n end",
"def valid_sudoku(table)\n # seen_set = Set.new()\n # for i in \nend",
"def valid?\n !!free_cell_index\n end",
"def is_safe(grid, row, column, number)\n $count += 1\n return !exist_in_row(grid, row, number) && !exist_in_column(grid, column, number) && !exists_in_box(grid, row - (row % 3), column - (column % 3), number)\nend",
"def valid?\n return false if @first_row_index.nil?\n return false if @first_cell_index.nil?\n return false if @last_row_index.nil?\n return false if @last_cell_index.nil?\n return false if @allow_splitting.nil?\n true\n end",
"def all_cells_cleared?\n count_num_of_cells_cleared = @cleared_field.select{|key, value| value == true}.size\n total_cell_count = @column_count * @row_count\n cell_clear_check = total_cell_count - @mine_count == count_num_of_cells_cleared\n return true if !any_mines_detonated? && cell_clear_check\n false\n\n end",
"def check_row\n @num_row.times do |row|\n consecutive = 0\n curr_tile = @board[row][0]\n @num_col.times do |col|\n if curr_tile == @board[row][col]\n next unless @board[row][col] #skip over empty tiles before the first non-empty\n consecutive += 1\n return true if consecutive == 4\n else\n curr_tile = @board[row][col]\n consecutive = 1\n end\n end\n end\n false\n end",
"def valid?\n tally = Hash.new(0)\n tally[:xxx] = 1\n \n 5.times do |u|\n 5.times do |h|\n if !@solution[h][u].nil?\n tally[@solution[h][u]] += 1\n end\n end\n return true if tally.values.max < 2\n end\n puts \"invalid: #{tally.inspect}\"\n puts self.to_s\n return false\n end",
"def in_column?(table)\n\n table.length.times do |col|\n column_hash = Hash.new()\n\n table.length.times do |i|\n\n if column_hash[table[i][col]]\n return false\n end\n if table[i][col] != '.'\n column_hash[table[i][col]] = 1\n end\n end\n end\n end",
"def all_cells_cleared?\n count = 0\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) || contains_mine?(row, column)\n count += 1\n end\n end\n end\n if count == row_count*column_count\n true\n else\n false\n end\n end",
"def all_cells_cleared?\n cell_count = 0\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) || contains_mine?(row, column)\n cell_count += 1\n end\n end\n end\n\n (row_count * column_count) == cell_count\n end",
"def all_cells_cleared?\n x = 0\n @field.each do |row|\n y = 0\n row.each do |col|\n if !contains_mine?(x, y)\n if @field[x][y].cleared == false\n return false\n end\n end\n y += 1\n end\n x += 1\n end\n true\n end",
"def valid_column(column)\n bits = 0\n\n @size.times { |i|\n if @state[(@size *i) + column]\n bits += 1\n if bits > 1\n return false\n end\n end\n }\n\n return true\n end",
"def check_if_all_combos_tried(row, col, forward)\n \n if @board_indicator[row][col] == 0 && @board[row][col] == 9 && row == @row_of_first_empty_square && col == @col_of_first_empty_square\n return true\n else\n return false\n end\n # if all initial holes are filled with'9', all combos were tried\n # all_combos_tried = true\n # (0..8).each do |k|\n # (0..8).each do |j|\n # if @board_indicator[k][j] == 0 && @board[k][j] < 9\n # all_combos_tried = false\n # #break\n # end\n # end\n # end\n # puts all_combos_tried\n # all_combos_tried\n end",
"def external_check?(row,col)\n \n #Get values available in this block\n #------------------------------------------------------------------\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n \n section = []\n \n #Check row\n #Get values available in the other blocks in the current row\n #---------------------------------------------------------------------------------------------------\n 9.times do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(row,i) unless col==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n values_row = values.tr(section,\"\")\n \n if values_row.length == 1\n @rows[row][col] = values_row.to_s\n adjust_values\n return true\n else\n return false\n end \n #Check column\n #Get values available in the other blocks in the current column\n #---------------------------------------------------------------------------------------------------\n 9.times do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(i,col) unless row==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n \n values_col = values.tr(section,\"\")\n if values_col.length == 1\n @rows[row][col] = values_col.to_s\n adjust_values\n return true\n else\n return false\n end \n \n #Check block\n #Get values available in the other blocks in the current block\n #---------------------------------------------------------------------------------------------------\n blk = find_block(row,col)\n case blk\n when 0\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c-1) unless r=row and c=col\n\tend\n end\n when 1\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c+2) unless r=row and c=col\n\tend\n end\n when 2\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c+5) unless r=row and c=col\n\tend\n end\n when 3\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c-1) unless r=row and c=col\n\tend\n end\n when 4\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c+2) unless r=row and c=col\n\tend\n end\n when 5\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c+5) unless r=row and c=col\n\tend\n end\n when 6\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c-1) unless r=row and c=col\n\tend\n end\n when 7\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c+2) unless r=row and c=col\n\tend\n end\n else \n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c+5) unless r=row and c=col\n\tend\n end\n end \n \n @blks[blk].each do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(row,i) unless col==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n \n values_block = values.tr(section,\"\") \n if values_block.length == 1\n @rows[row][col] = values_block.to_s\n adjust_values\n return true\n else\n return false\n end \n end",
"def valid?\n (0..@dimension - 1).each do |i|\n return false unless valid_enum(row_elems(i))\n return false unless valid_enum(col_elems(i))\n return false unless valid_enum(block(i))\n end\n true\n end",
"def board_values_valid\n\t\treturn false if !@arr_of_arrs\n\n\t\t@arr_of_arrs.each do |sub|\n\t\t\tsub.each do |val|\n\t\t\t\t# puts \"val: \",val,\", length = \",val.length\n\t\t\t\tif val.length != 1 || !\"-123456789\".include?(val)\n\t\t\t\t\treturn false \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn true\n\tend",
"def full?\n @cells.all?{|element| element != \" \"}\n end",
"def all_cells_cleared?\n row_count.times do |row|\n column_count.times do |col|\n if !contains_mine?(row, col)\n return false unless cell_cleared?(row, col)\n end\n end\n end\n true\n end",
"def is_valid_cell?(cell)\n if cell.nil?\n return false\n end\n\n if cell.col < 0 || cell.row < 0\n return false\n end\n\n if cell.row < @maze.size && cell.col < @maze[0].size\n return true\n end\n\n false\n end",
"def valid_collection?(row)\n # union of array of chars with range of number chars 1.. 9 ruby preserves order\n return row.split(//) | ('1'..'9').to_a == row.split(//)\nend",
"def is_solved?\n return false unless is_rows_valid?\n return false unless is_columns_valid?\n return false unless is_subgrids_valid?\n true\n end",
"def check_rows\n 0.upto(5) do |i|\n str = \"\"\n 0.upto(6) do |j|\n str += @board[j][i].to_s\n end\n if str.match(/RRRR|BBBB/) != nil\n return true\n end\n end\n return false\n end",
"def validation(board, xblks, yblks)\n # row in valid\n\n \tfor x in 0..board.length-1\n \t\tcol = Array.new\n \t\trow = Array.new(board[x]) #need new array not modify board via reference\n\t\tblock = Array.new(board.length) {Array.new}\n \t\tfor y in 0..board.length-1\n if (board[y][x] != 0)\n\n \t\t\t\tcol.concat([board[y][x]])\n\t\t\tend\n\n\t\t\tputs [y, x]\n \t\t\tputs \"\"\n\t\t\tif (board[x][y] != 0)\n \t\t\t\tblk = (x/xblks).floor + yblks * (y/yblks).floor\n\t\t\t\tblock[blk-1].concat([board[x][y]])\n\t\t\tend\n \t \tend\n\t\trow.delete(0)\n\n \t\tif (col.uniq! != nil or row.uniq! != nil)\n\n\n\t\t\treturn false\n\t\tend\n\n\n \tend\n\n for each in block\n\t\tif each.uniq! != nil\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\n end",
"def valid?(length, row, column, direction)\n begin\n for i in 1..length\n if @board[row][column] != \".\"\n return false\n else\n direction == \"Horizontal\" ? column += 1 : row += 1\n end\n end\n rescue\n return false\n end\n return true\n end",
"def check_full? \n \t\treturn true if @size==16 #size increase by 1 with every turn so when it reaches 16 we know that all cells are full\n\tend",
"def loadFromFile(fileName)\n inFile = File.new(fileName, \"r\")\n index = 0\n\n # Iterate over the lines from the file.\n inFile.each_line do |line|\n # line is a string containing one line from the file.\n\n ### The code to process the line goes here. ###\n\t\tvals = line.split\n\t\t# The collect block will iterate over each item in vals (strings)\n\t\t# and perform the function (convert to int) returning the set as a new array.\n\t\t@sudokuBoard[index] = vals.collect { |x| x.to_i }\n index = index + 1\n end\n\t\n\t\n\t# Returns whether a number can be placed in this column\n\t#\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the column, false otherwise\n\tdef checkCol(col, num)\n\t\t0.upto(BOARD_SIZE-1){\n\t\t|row| \n\t\tif num == @sudokuBoard[row][col] then\n\t\t\treturn false\n\t\tend\n\t\t}\n\t\treturn true\n\n\tend\n\t# Returns whether a number can be placed in this row\n\t#\n\t# @param row A number representing the board row\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the row, false otherwise\n\tdef checkRow(row, num)\n\t\tdisjointSet = @sudokuBoard[row] - [num]\n\t\tif disjointSet.length == 9 then\n\t\t\t# Safe to add sum to the row.\n\t\t\treturn true\n\t\telse\n\t\t\t# Unsafe to add sum to the row, since it already existed there.\n\t\t\treturn false\n\t\tend\n\t\t\n\tend\n\t\n\t# Returns whether a number can be placed in this subgrid\n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the subgrid, false otherwise\n\tdef checkSubgrid(row, col, num)\n\t\tx = (row / 3) * 3\n\t\ty = (col / 3) * 3\n\n\t\tbox = @sudokuBoard[x][y..(y+2)] + @sudokuBoard[x+1][y..(y+2)] + @sudokuBoard[x+2][y..(y+2)]\n\t\tdisjointSet = box - [num]\n\t\tif disjointSet.length == 9 then\n\t\t\t# Safe to add num to the row.\n\t\t\treturn true\n\t\telse\n\t\t\t# Unsafe to add num to the row, since it already existed there.\n\t\t\treturn false\n\t\tend\n\t\t\n\t\n\t\n\t\n\tend\n\t\n\t# Returns whether a number can be placed per sudoku rules\n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in this postion, false otherwise\n\tdef check(row, col, num)\n\t\treturn checkCol(col,num) && checkRow(row,num) && checkSubgrid(row,col,num)\n\t\n\tend\n\t\n\t# A recursive backtracking function to solve sudoku boards \n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @return Returns true if the board is solved, false otherwise\n\tdef solve(row, col)\n\tif row == 9 then\n\t\treturn true\n\tend\n\t\n\tif col == 9 then\n\t\treturn solve(row +1, 0)\n\tend\n\t\n\tif @sudokuBoard[row][col] != 0 then\n\t\treturn solve(row, col +1)\n\tend\n\t\n\t1.upto(9) {\n\t|num|\n\t\n\tif check(row,col,num) then\n\t\t@sudokuBoard[row][col] = num\n\t\tif solve(row, col+1) then\n\t\t\treturn true\n\t\tend\n\tend\n\t}\n\t\n\t@sudokuBoard[row][col] = 0\n\treturn false\n\t\n\t\n\tend\n\t\t\n\n inFile.close\nend",
"def full?\n cells.each do | position |\n if position == \" \"\n return false\n end\n end\n end",
"def solved?\n # Return whether the total passed in is equal to the total for a valid house.\n def is_valid_house_total?(total)\n return total == 45\n end\n\n # Return the total of adding up all the cells in this house.\n def house_total(house)\n return house.inject(0) {|sum, cell| sum + cell.to_i }\n end\n\n ## Check whether all the houses in the puzzle have valid totals.\n ##\n\n each_row do |row|\n return false unless is_valid_house_total?(house_total(row))\n end\n\n each_column do |column|\n return false unless is_valid_house_total?(house_total(column))\n end\n\n each_nonet do |nonet|\n return false unless is_valid_house_total?(house_total(nonet))\n end\n end",
"def all_cells_cleared?\n @board.each do |row|\n row.each do |cell|\n if !cell.has_bomb && !cell.is_open\n return false\n end\n end\n end\n true\n end",
"def spans_all_rows?(cells_list)\n cells_list.inject([]) {|rows, (_, r)| rows << r }.uniq.size == @board.size\n end",
"def spaces?\n @cells.map{|cell| cell[4] }.include?(0)\n end",
"def full?(cells = @cells)\n cells.all?{|taken| taken == \"X\" || taken == \"O\"}\n end",
"def full?\n !@cells.include? \" \"\n end",
"def solved?(board_array)\n return valid?(board_array) && valid?(transpose_arrays(board_array)) && valid?(create_grid(board_array))\nend",
"def check_valid (size)\n #checks length of string correct according to n x m\n if @arg.length != size\n puts \"String length incorrect\"\n end\n #checks if outer wall is all 1's\n string=''\n @col_nums.times do\n string+='1'\n end\n if !@arg[0..@col_nums-1].eql? string\n puts \"Invalid maze (outer wall)\"\n end\n (0..@row_nums*@col_nums-1).step(@col_nums) do |i|\n if @arg[i] != \"1\" || @arg[i-1] != \"1\"\n puts \"Invalid maze (outer wall)\"\n break\n end\n end\n #cell centers should be 0's\n #takes values of cell centers and uses coordinates for make_cell method\n (@col_nums..@row_nums*@col_nums-1).step(@col_nums*2) do |i|\n (1..@col_nums-2).step(2) do |j|\n if @arg[i+j]!=\"0\"\n puts \"Invalid maze (cell center)\"\n break\n else\n make_cell(i+j)\n end\n end\n end\n #cell corners should be 1's\n (0..@row_nums*@col_nums-1).step(@col_nums*2) do |i|\n (0..@col_nums-2).step(2) do |j|\n if @arg[i+j]!=\"1\"\n puts \"Invalid maze (cell corner)\"\n break\n end\n end\n end\n end",
"def check?(ptr)\n ptr_x, ptr_y = x_y(ptr)\n\n # Keep track of what we've seen\n row = {}\n col = {}\n sec = {}\n\n @board.each_with_index do |value, i|\n next if value == 0\n\n x, y = x_y(i)\n\n if y == ptr_y\n return false if row[value]\n\n row[value] = true\n end\n\n if x == ptr_x\n return false if col[value]\n\n col[value] = true\n end\n\n # Check the cells in the sector\n if x / 3 == ptr_x / 3 && y / 3 == ptr_y / 3\n return false if sec[value]\n\n sec[value] = true\n end\n end\n\n # These checks aren't *theoretically* necessary, given the algorithm,\n # but nice to have as a sanity check.\n if row.length == 9\n return false unless row.keys.inject(:+) == 45\n end\n\n if col.length == 9\n return false unless col.keys.inject(:+) == 45\n end\n\n true\n end",
"def full?\n cells.all? {|cell| cell != \" \"}\n end",
"def validate_position(board, row, col, number)\n position_row = row\n position_col = col\n # Checks the row to ensure there's no duplicate while also checking the column to ensure there's no duplicate.\n for val in 0...9 do\n if board[val][position_col] == number || board[position_row][val] == number\n return false\n end\n end\n\n # Defining the boundaries of the block that the given position falls into...\n block_row_min = position_row / 3 * 3 # Abusing integer division to get the lower bound for the rows.\n block_row_max = block_row_min + 3 # Max is just 3 higher than that.\n block_col_min = position_col / 3 * 3 # Abusing integer division to get the lower bound for the columns.\n block_col_max = block_col_min + 3 # Max is just 3 higher than that.\n\n # Checks that the given position is valid, given the dimensions calculated above...\n for row in block_row_min...block_row_max do\n for col in block_col_min...block_col_max do # Simple double for-loop with an if statement.\n if board[row][col] == number\n return false\n end\n end\n end\n return true\n end",
"def check_rows(piece, arr)\n arr.each do |row|\n row.each_cons(4).each do |combination|\n return true if combination.all? { |a| a == piece }\n end\n end\n false\n end"
] |
[
"0.8211502",
"0.81889945",
"0.8146699",
"0.8069601",
"0.80009776",
"0.79232717",
"0.7897237",
"0.76094997",
"0.75945985",
"0.73538876",
"0.734205",
"0.7302121",
"0.7013267",
"0.69960505",
"0.69183975",
"0.6854969",
"0.68095815",
"0.6777305",
"0.67575437",
"0.67113936",
"0.6703372",
"0.6695579",
"0.6675492",
"0.66723746",
"0.6662532",
"0.6602315",
"0.6534395",
"0.65188366",
"0.6491991",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6490447",
"0.6460732",
"0.64282626",
"0.64198905",
"0.6411125",
"0.6406737",
"0.63878065",
"0.63865024",
"0.6386392",
"0.63579273",
"0.63364285",
"0.6327434",
"0.6312362",
"0.6303727",
"0.6303103",
"0.6297146",
"0.6280715",
"0.62784845",
"0.62763",
"0.6272148",
"0.62676054",
"0.6266129",
"0.6239424",
"0.6220932",
"0.6216794",
"0.62050056",
"0.6195558",
"0.61839503",
"0.61807823",
"0.61753744",
"0.6158296",
"0.61555374",
"0.6155366",
"0.6152481",
"0.6148439",
"0.6144065",
"0.61361223",
"0.60993916",
"0.6087242",
"0.6084274",
"0.6077984",
"0.6048267",
"0.6042802",
"0.6038866",
"0.60171026",
"0.6005739",
"0.6004976",
"0.5995987",
"0.59943205"
] |
0.6978259
|
14
|
Book => xml: => :skip_instruct => true Category => :json => :dasherize => false Author => :all => :dasherize => false
|
def first_book
Book.find(:first)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @book = Book.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book.to_xml(:include => { :keywords => {}, :sb_keywords => {}, :targetgroup => {}, :agegroup => {}, :signum => {}, :editions => { :include => { :descriptions => { :include => { :user => { :except => [:email, :password_hash]}}}}}, :assessments => {}, :taggings => { :include => :tag } }) } \n end\n end",
"def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end",
"def parse_book!\n # if not book\n unless @page.search(\"a[@class='eBreadCrumbs_link']/@href\").to_a[0].to_s.include?('div_book')\n @to_skip = true\n return false\n end\n\n @genre = get_genre(\n @page.search(\"a[@class='eBreadCrumbs_link']/@href\").to_a[1].to_s,\n @page.search(\"a[@class='eBreadCrumbs_link']/@href\").to_a[2].to_s\n # @page.search(\"ul.navLine/li:nth-of-type(2)\").search(\"*/a/@href\").text, # li with 1-st level category\n # @page.search(\"ul.navLine/li:nth-of-type(3)\").search(\"*/a/@href\").text # li with 2-nd level category\n )\n @title = @page.search(\"div.details-main//h1\").text.sub(/\\(+[^\\(\\)]*\\)+\\s*$/, '').squish\n @author_last, @authors_all = get_authors\n # @coverid = /\\/(\\w+)\\.jpg/.match(@page.search(\"div#detailGalleryMini//div.img/img/@src\").text)\n @coverid = /\\/(\\w+)\\.jpg/.match(@page.search(\"//img[contains(@class, 'eMicroGallery_fullImage')]/@src\").text)\n @coverid = @coverid[1] if @coverid.present?\n # cover can be 'noimg_200x200'\n\n # skip not russian & not english books\n # languages = @page.search(\"//div[contains(@class,'product-detail')]/p[contains(text(), 'Языки')]\").text.squish\n languages = @page.search(\"//p[@itemprop='inLanguage']\").text.squish\n\n if (languages.present? && languages !~ /(Английский|Русский)/ui) || @coverid =~ /noimg/ ||\n @coverid.blank? || !OzonBookParser.cover_exist(@agent, @coverid)\n @to_skip = true\n return false\n end\n\n state_valid?\n end",
"def index\n case\n when params[:tag]\n @books = Book.tagged_with(params[:tag], :on => :tags, :any => true)\n when params[:author]\n @books = Book.tagged_with(params[:author], :on => :authors, :any => true)\n when params[:translator]\n @books = Book.tagged_with(params[:translator], :on => :translators, :any => true)\n else\n @books = Book.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def parse_item(item) \n @book = JSON(item.body)[\"data\"].first \t\n \n # @book = Hashie::Mash.new book_data\n @book_id = @book['book_id']\n @title = @book['title']\n @authors = @book['author_data'] || []\n @publisher = @book['publisher_name']\n @published_date = extract_date @book['edition_info'] if @book['edition_info'].present?\n @description = @book['summary']\n @isbn = @book['isbn13']\n @isbn10 = @book['isbn10']\n @dewey = @book['dewey_decimal']\n @page_count = extract_page_count @book['physical_description_text'] if @book['physical_description_text'].present?\n @notes = @book['notes']\n @edition_info = @book['edition_info']\n @physical_description = @book['physical_description_text']\n @subject_ids = @book['subject_ids'] || []\n @language = @book['language']\n end",
"def display_book_attributes\n [@title, @type, @author, @price]\n end",
"def book_params\n #params.fetch(:book, {:name, :categories })\n params.require(:book).permit(:name, :description, :author_name, :price, :edition, :published_date, category_ids: [])\n end",
"def book_params\n\n params.require(:book).permit(:category_id, :ISBN, :publication_year, :name, :author)\n end",
"def book_by_author(author)\n\t\t\tresponse = request('/book/author', :author => author)\n\t\t\tHashie::Mash.new(response['book'])\n\t\tend",
"def new\n @book = Book.new\n @categories = Category.order(:names_depth_cache).map { |c| [\"-\" * c.depth + c.name,c.id] }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def book_params\n # params.fetch(:book, {})\n params.require(:book).permit(:isbn, :title, :author, :language, :published, :edition, :image, :subject, :summary, :is_special_collection_item, :search)\n end",
"def serialize!\n\t\t\t@namespaces=raw_doc.root.namespaces if @namespaces.nil?\n\t\t\t@authors=[]\n\t\t\t@raw_doc=raw_doc.at('./xmlns:entry',@namespaces) if raw_doc.at('./xmlns:entry',@namespaces)\n\t\t\t@title=text(raw_doc.at('./xmlns:title',@namespaces))\n\t\t\t@id=text(raw_doc.at('./xmlns:id',@namespaces))\n\t\t\t@summary=text(raw_doc.at('./xmlns:summary',@namespaces))\n\t\t\td=text(raw_doc.at('./xmlns:updated',@namespaces))\n\t\t\t@updated=DateTime.parse(d) unless d.nil?\n\t\t\td=text(raw_doc.at('./xmlns:published',@namespaces))\n\t\t\t@published=DateTime.parse(d) unless d.nil?\n\n\t\t\t@authors=raw_doc.xpath('./xmlns:author',@namespaces).collect do |author|\n\t\t\t\t{\n\t\t\t\t\t:name => text(author.at('./xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(author.at('./xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(author.at('./xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@links=OPDS::Support::LinkSet.new @browser\n\t\t\traw_doc.xpath('./xmlns:link',@namespaces).each do |n|\n\t\t\t\ttext=nil\n\t\t\t\ttext=n.attributes['title'].value unless n.attributes['title'].nil?\n\t\t\t\tlink=n.attributes['href'].value\n\t\t\t\ttype=n.attributes['type'].value unless n.attributes['type'].nil?\n\t\t\t\tprice=nil\n\t\t\t\tcurrency=nil\n\t\t\t\t@namespaces['opds']||='http://opds-spec.org/2010/catalog'\n\t\t\t\ttypes=n.search('.//opds:indirectAcquisition',@namespaces).map{|b| b['type']}\n\t\t\t\ttype=[type,types].flatten.compact unless types.nil? || types.empty?\n\t\t\t\toprice=n.at('./opds:price',@namespaces)\n\t\t\t\tif oprice\n\t\t\t\t\tprice=text(oprice)\n\t\t\t\t\tcurrency=oprice.attributes['currencycode'].value unless oprice.attributes['currencycode'].nil?\n\t\t\t\tend\n\n\t\t\t\tunless n.attributes['rel'].nil?\n\t\t\t\t\tn.attributes['rel'].value.split.each do |rel|\n\t\t\t\t\t\t@links.push(rel,link,text,type,price,currency)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t@links.push(nil,link,text,type,price,currency)\n\t\t\t\tend\n\t\t\tend\n\t\t\t@dcmetas=Hash.new\n\t\t\tprefs=@namespaces.reject{|_,v| !%W[http://purl.org/dc/terms/ http://purl.org/dc/elements/1.1/].include?v}\n\t\t\tprefs.keys.map{|p| p.split(':').last}.each do |pref|\n\t\t\t\traw_doc.xpath('./'+pref+':*',@namespaces).each do |n|\n\t\t\t\t\t@dcmetas[n.name]=[] unless @dcmetas[n.name]\n\t\t\t\t\t@dcmetas[n.name].push [n.text, n]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@categories=raw_doc.xpath('./xmlns:category',@namespaces).collect do |n|\n\t\t\t\t[text(n.attributes['label']),text(n.attributes['term'])]\n\t\t\tend\n\n\t\t\t@content=raw_doc.at('./xmlns:content',@namespaces).to_s\n\t\t\t\n\t\t\t@contributors=raw_doc.xpath('./xmlns:contributor',@namespaces).collect do |auth|\n\t\t\t\t{\n\t\t\t\t\t:name => text(raw_doc.at('./xmlns:contributor/xmlns:name',@namespaces)),\n\t\t\t\t\t:uri => text(raw_doc.at('./xmlns:contributor/xmlns:uri',@namespaces)),\n\t\t\t\t\t:email => text(raw_doc.at('./xmlns:contributor/xmlns:email',@namespaces))\n\t\t\t\t}\n\t\t\tend\n\n\t\t\t@rights=text(raw_doc.at('./xmlns:rights',@namespaces))\n\t\t\t@subtitle=text(raw_doc.at('./xmlns:rights',@namespaces))\n\n\t\tend",
"def index\n @books_categories = BooksCategory.all(:order => \"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books_categories }\n end\n end",
"def book_params\n params.require(:book).permit(:title, {:author_ids => []}, :publisher_id, :published_at, :category_id, :isbn, :blurb, :page_count, :price)\n end",
"def book_params\n params.require(:book).permit(:title, :published_at, :isbn, :publisher_id, :blurb, :avatar,:page_count, :price,:author_ids=>[])\n end",
"def book_params\n params.permit(:authors, :categories, :description, :google_id, :image_url, :language, :page_count, :subtitle, :title)\n end",
"def book_params\n params.require(:book).permit(:title, :description, :publication_year,\n :price, :height, :weight, :depth, :sort,\n :direction, author_ids: [])\n end",
"def render_book(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n if p.editors.size > 0 then\n r += p.editors.map {|e| e.abbreviated_name}.joined_by_comma_and_and + \", editors, \"\n end\n end\n\n r += p.title.detex.titlecase\n\n if field(p,\"Volume\") then\n r += text_for_field(\"Volume\", p, :prefix => \", volume \")\n r += text_for_field(\"Series\", p, :prefix => \" of \")\n elsif field(p,\"Number\") then\n r += text_for_field(\"Number\", p, :prefix => \". Number \")\n r += text_for_field(\"Series\", p, :prefix => \" in \")\n elsif field(p,\"Series\") then\n r += text_for_field(\"Series\", p, :prefix => \". \")\n end\n r += \". \"\n\n r += text_for_field(\"Publisher\", p, :postfix => \", \").detex\n r += text_for_field(\"Address\", p, :postfix => \", \").detex\n r += text_for_field(\"Edition\", p, :postfix => \" edition, \").titlecase.detex\n\n r += month_for_field(\"Month\", p, :postfix => \" \").detex\n r += text_for_field(\"Year\", p, :postfix => \". \").detex\n r += text_for_field(\"Note\", p, :postfix => \". \")\n return r\n\nend",
"def book_params\n params.fetch(:book, {}).permit(:author, :title, :publisher, :collection, :release_year, :nr_of_pages, :format, :cover, :language, :condition, :isbn, :book_category_id, :price)\n end",
"def book_params\n params.require(:book).permit(:title, :author, :isbn_10, :isbn_13, :edition, :print, :publication_year, :publication_month, :condition, :value, :status, :stage, :description, :visits, \n :user_id, :prefered_place, {:tag_ids => []}, :prefered_time, :image, :image_cache, :goodreads_id, :publisher, :language_code, :pages, :image_url)\n end",
"def book_params\n params.require(:book).permit(:title, :author, :isbn_10, :isbn_13, :edition, :print, :publication_year, :publication_month, :condition, :value, :status, :stage, :description, :visits, \n :user_id, :location_id, :prefered_place, {:tag_ids => []}, :prefered_time, :image, :image_cache, :goodreads_id, :publisher, :language_code, :pages, :image_url, :ext_image_url)\n end",
"def book_params\n params.require(:book).permit(:title, :author, :isbn_10, :isbn_13, :edition, :print, :publication_year, :publication_month, :condition, :value, :status, :stage, :description, :visits, \n :user_id, :location_id, :prefered_place, {:tag_ids => []}, :prefered_time, :image, :image_cache, :goodreads_id, :publisher, :language_code, :pages, :image_url)\n end",
"def api_search_by_author(input)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{input}+inauthor&key=#{API_KEY}\"\n response = RestClient.get(url)\n parsed_response = JSON.parse(response)\n parsed_response\n end",
"def booksmark_params\n params.require(:booksmark).permit(:name, :url,{categories_attributes: [:name, :visibility]},{assemblies_attributes:[:id, :category_id, :_destroy]},{types_attributes: [:name]}, {relations_attributes:[:id, :type_id, :_destroy]}, {type_ids: []})\n end",
"def book_params\n params.require(:book).permit(:name, :name_prefix, :tree_prefix, :name_comment, :order_number, :cover_picture_id,\n :synopsis, :year, :author, :page_count, :can_buy, :book_category_id, :page_format,\n :taggable_name, :book_file_id, :tree_prefix_tooltip, :name_tooltip)\n end",
"def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end",
"def book_params\n params.require(:book).permit(:name, :description, :picture, :user_id, :ispublic,:category,:coauthors,:avg_rating, :all_tags)\n end",
"def book_params\n params.require(:book).permit(:title,\n :isbn10,\n :isbn13,\n :is_active,\n :tag_list,\n :cover,\n :cover_cache,\n :remote_cover_url,\n :owner_id,\n :author_id,\n author_attributes: [:given_name, :family_name])\n end",
"def test_return_all_book_information\n data = post_book('id' => 1)\n keys = %w(id isbn edition_group_id author edition publisher cover image\n title course_code for_sale).sort\n returned_keys = data[0]['data'].keys.sort\n assert(returned_keys.size == keys.size && returned_keys & keys == keys,\n 'Missing Keys: ' + (keys - returned_keys).to_s)\n end",
"def show\n @book = Book.find(params[:id], :include => [{:comments => :user}, :authors])\n @comments = @book.comments\n @authors = @book.authors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def list_books(api_object)\n puts \"Current Books:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('books/book/title').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend",
"def book\n fetch('harry_potter.books')\n end",
"def title\n\t\t@book\n\tend",
"def render_inbook(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and\n else\n r += p.editors.map {|e| e.abbreviated_name}.joined_by_comma_and_and + \", editor\"\n end\n r += \". \"\n\n r += p.title.detex.titlecase\n\n if field(p,\"Volume\") then # <$fields.Volume?>\n r += text_for_field(\"Volume\", p, :prefix => \", volume \") #, volume <$fields.Volume/>\n if field(p,\"Series\") then # <$fields.Series?>\n r += text_for_field(\"Series\", p, :prefix => \" of \", :postfix => \"\") # <$fields.Series/>\n end # </$fields.Series?>\n end # </$fields.Volume?>\n\n if field(p,\"Chapter\") then # <$fields.Chapter?>, \n r += \", \"\n if field(p,\"Type\") then # <$fields.Type?>\n r += text_for_field(\"Type\", p, :postfix => \" \") # <$fields.Type/>\n else\n r += \"chapter\" # <?$fields.Type?>chapter\n end # </$fields.Type?>\n r += text_for_field(\"Chapter\", p) # <$fields.Chapter/>\n # <$fields.Pages.stringByPrependingCommaAndSpaceIfNotEmpty/>\n if field(p,\"Pages\") then\n r += text_for_field(\"Pages\", p, :prefix => \", pages \", :postfix => \". \").detex\n end\n else # <?$fields.Chapter?>\n # <$fields.Pages?>, page <$fields.Pages/>\n if field(p,\"Pages\") then\n r += text_for_field(\"Pages\", p, :prefix => \", pages \", :postfix => \". \").detex\n end # </$fields.Pages?>\n end # </$fields.Chapter?>\n\n if field(p,\"Volume\") then #<$fields.Volume?>\n # empty\n else # <?$fields.Volume?>\n if field(p,\"Number\") then # <$fields.Number?>. Number\n r += text_for_field(\"Number\", p, :prefix => \". Number \", :postfix => \"\") #<$fields.Number/>\n if field(p,\"Series\") then # <$fields.Series?>\n r += text_for_field(\"Series\", p, :prefix => \" in \", :postfix => \"\") # <$fields.Series/>\n end #</$fields.Series?>\n else # <?$fields.Number?>\n # <$fields.Series.stringByPrependingCommaAndSpaceIfNotEmpty/>\n r += text_for_field(\"Series\", p, :prefix => \", \")\n end # </$fields.Number?>\n r += \". \"\n end # </$fields.Volume?>.\n\n r += text_for_field(\"Publisher\", p) # <$fields.Publisher/>\n r += text_for_field(\"Address\", p, :prefix => \", \") # <$fields.Address.stringByPrependingCommaAndSpaceIfNotEmpty/>,\n r += text_for_field(\"Edition\", p, :prefix => \", \", :postfix => \" edition\")\n r += month_for_field(\"Month\", p, :prefix => \", \") # <$fields.Month.stringByAppendingSpaceIfNotEmpty/>\n r += text_for_field(\"Year\", p, :prefix => \" \", :postfix => \".\") # <$fields.Year/>. \n r += text_for_field(\"Note\", p, :prefix => \" \", :postfix => \". \").detex # <$fields.Note.stringByPrependingFullStopAndSpace/>.\n return r\nend",
"def book_params\n\t\tparams.require(:book).permit(:book_image, :title, :description, :category, :author)\n\tend",
"def book_params\n params.require(:book).permit(:Title, :Summary, :Rating, :Author, :Ranking, :Awards, :Recommended_by, :Amazon, :Audiobook, :Animated_Review,:image,:category_id)\n end",
"def book_params\n # params is a hashtable. It should have in it a key of :book.\n # The value for the :book key is another hash.\n # If params does not contain the key :book, an exception is raised. \n # Only the \"book\" hash is returned and only with the permitted key(s).\n # So returns a hash with only having at most keys of :title, :year, :author_id\n params.require(:book).permit(:name)\n end",
"def book_params\n # params is a hashtable. It should have in it a key of :book.\n # The value for the :book key is another hash.\n # If params does not contain the key :book, an exception is raised. \n # Only the \"book\" hash is returned and only with the permitted key(s).\n # So returns a hash with only having at most keys of :title, :year, :author_id\n params.require(:book).permit(:name)\n end",
"def odsa_books\n inst_books\n end",
"def index\n default_q = {\n name_not_cont_all: (1..9).to_a.map { |i| [\"(#{i})\", \"(#{i})\", \"(0#{i})\", \"(0#{i})\"] }.flatten,\n press_not_cont_all: %w(東立 九星文化出版社 台灣角川股份有限公司 旺福圖書 N/A 銘顯文化事業有限公司 上海譯文出版社 明日工作室股份有限公司 橘子 十田十 青文出版社股份有限公司 尖端出版 龍吟ROSE 台灣東販股份有限公司 桔子),\n rate_gt: 4.5\n }\n @q = Book.enabled.ransack(params[:q])\n @books = params[:q] ? @q.result(distinct: true).page(params[:page]) :\n Book.enabled.ransack(default_q).result.page(params[:page]).order(publish_at: :desc)\n end",
"def scrape_book_info(html)\n retval = {}\n html = restrict(html,\n /<div.+class\\s*=\\s*\"buying\".*?>\\s*<b/,\n %r{</div\\s*>})\n retval[:title] = scrape_title(html)\n retval[:authors] = scrape_authors(html)\n retval\nend",
"def author; end",
"def index\n @books = Book.all\n @categories = Category.joins(:books).group(\"category_id\")\n @themes = Theme.joins(:books).group(\"theme_id\")\n @book_types = BookType.all\n @tags = Book.tag_counts_on(:tags)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def orderbook\n Fyb.public.orderbook.perform.parse\n end",
"def getTitle(book)\n book['volumeInfo']['title']\nend",
"def create\n @book = Book.new(params[:book])\n\tcreate_author(params[:q],params[:r])\n\n\tif @author != nil\n respond_to do |format|\n if @book.save\n\t @author.books << @book unless @author.books.include? @book\n\t\t @author = nil\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n\t\t # format.js\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n\t\t # format.js { render :action => 'create_error' }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n\telse\n\t respond_to do |format|\n\t format.html { render :action => \"new\" }\n\t\t# correc the line below\n\t\tformat.xml { render :xml => {@author=>[\"Author name is not valid\"]}, :status => :unprocessable_entity }\n\t end\n\tend\n end",
"def book_params\n params.require(:book).permit(:name, :isbn, :barcode, :series, :volume, :publisher, :price, :author_1, :author_2, :author_3, :image_url, :illustrator, :translator )\n end",
"def create\n rewriteParams\n @book = Book.new(params[:book])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n render jsonapi: Book.search(params), include: [:genre, :author, :libraries]\n end",
"def book_params\n params.require(:book).permit(:title, :published_date, :author, :category, :description, :price)\n end",
"def book_params\n params.require(:book).permit(:image, :name, :description, :price, :isbn, :status,author_book_ids:[])\n\n end",
"def render_booklet(p)\n r = \"\"\n if p.authors.size > 0 then\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n end\n r += p.title.detex.titlecase + \". \"\n r += text_for_field(\"Howpublished\", p, :postfix => \", \")\n r += text_for_field(\"Address\", p, :postfix => \", \")\n r += month_for_field(\"Month\", p, :postfix => \" \")\n r += text_for_field(\"Year\", p, :prefix => \" \", :postfix => \". \")\n r += text_for_field(\"Note\", p, :prefix => \" \", :postfix => \". \").detex\n return r\nend",
"def parse_years_books year_books, year\n\t\t@doc.css('div.short-opis').each do |link|\n\t\t\tauthor = link.css('strong')[0].text.strip\n\t\t\ttitle = link.css('strong')[1].text.strip\n\t\t\tdescription = link.css('p').text.strip\n\t\t\t\n\t\t\tbook = Book.new(author, title, description, year)\n\t\t\tyear_books.push(book)\n\t\tend\n\tend",
"def book_params\n params.require(:book).permit(:title, :description, :published_date, :cover_url, :book_category_id)\n end",
"def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end",
"def initialize(uri = nil, factory = nil, json: nil, ld: nil)\n uri = json ? json['uri'] : nil if uri.nil?\n super(uri, factory)\n if json\n has_part = json['hasPart']\n is_part_of = json['isPartOf']\n self.authors = get_property('authors', json, single: false)\n self.book_jacket_url = get_property('bookjacketURL', json)\n self.date = get_property('date', json)\n self.doi = get_property('doi', json)\n self.edition = get_property('edition', json)\n self.edition_data = get_property('editionData', json)\n self.eissn = get_property('eissn', json)\n self.has_part = has_part ? factory.get(uri, json: has_part) : nil\n self.is_part_of = is_part_of ? factory.get(uri, json: is_part_of) : nil\n self.isbn10 = get_property('isbn10', json)\n self.isbn13 = get_property('isbn13', json)\n self.isbns = get_property('isbns', json, single: false)\n self.issn = get_property('issn', json)\n self.issue = get_property('issue', json)\n self.issued = json ? json['issued'] : nil # TODO\n self.latest_edition = get_property('latestEdition', json)\n self.local_control_number = get_property('lcn', json)\n self.online_resource = get_property('onlineResource', json) ? true : false\n self.page = get_property('page', json)\n self.page_end = get_property('pageEnd', json)\n self.page_start = get_property('pageStart', json)\n self.place_of_publication = get_property('placeOfPublication', json)\n self.publisher = get_property('publisher', json)\n self.title = get_property('title', json)\n self.type = get_property('type', json)\n self.url = get_property('url', json, is_url: true)\n self.volume = get_property('volume', json)\n end\n end",
"def book_params\n params.require(:book).permit(:title, :authors, :description, :publisher)\n end",
"def index\n @books = @collection.books\n #original: @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def book_params\n params.require(:book).permit(:name, :author_id, :category_id, :year, :star_rating, :download, :description, :image, :pages, :language, :file_size, :file_format)\n end",
"def book_params\n params.require(:book).permit(:isbn, :title, :author, :subject, :is_special, :summary, :image_front_cover, :edition, :published, :language)\n end",
"def author_hash; end",
"def book_params\n\t\t\tparams.require(:book).permit(:title, :description, :author, :category_id, :book_img)\n\t\tend",
"def book_params\n params.require(:book).permit(:title, :active, :author, :isbn, :tag_list, :cover, :rating, :user_id, :followings)\n end",
"def book_params\n params.permit(:title, :author, :description)\n end",
"def book_params\n params.require(:book).permit(:title, :author, :description, :url)\n end",
"def book_params\n params.require(:book).permit(:title, :description, :author_id, :category_id, :price)\n end",
"def authors(library)\nend",
"def get_books\n unless self.scraped\n page = Nokogiri::HTML(open(self.url), nil, \"iso-8859-1\")\n item_elements = page.css(\".g-span7when-wide\")\n item_elements.each do |item|\n book_data = {}\n book_data[:title] = item.at_css(\".a-link-normal\").text.strip\n book_data[:author] = item.at_css(\".a-size-small\").text.split(\"by\")[-1].strip\n book_data[:price] = item.at_css(\".a-color-price\").text.strip\n book_data[:price] = \"N/A\" unless book_data[:price].include?(\"$\")\n book_data[:asin] = item.at_css(\".a-link-normal\")[\"href\"].split(\"/\")[2].strip.split(\"?\")[0]\n self.books << Book.new(book_data)\n end\n self.last_scraped = Time.now\n self.scraped = true\n end\n end",
"def book_params\n params.require(:book).permit(:isbn, :title, :author, :language,\n :published, :edition, :image, :subject, :summary, :is_special)\n end",
"def books_author\n \t@books = Book.where(\"author = '#{params[:author]}'\")\n\n \trespond_to do |format|\n format.html # list_authors.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n @books = current_user.books.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books.map { |e| e.chapters }.flatten }\n end\n end",
"def book_params\n\tparams.require(:book).permit(:title, :description, :author)\nend",
"def book_params\n params.require(:book).permit(:isbn, :title, :authors, :language, :published, :edition, :associated_library, :subject, :summary, :special_collection, :library_id, :is_borrowed, :is_deleted)\n end",
"def index\n conditions = { :block => false }\n conditions.merge!( :is_opinion => true ) if params[:opinion] == '1'\n conditions.merge!( :is_agency => true ) if params[:agency] == '1'\n unless params[:author_id].blank? && params[:author_ids].blank?\n author_ids = scan_multiple_value_param( :author_id, :first ) || scan_multiple_value_param( :author_ids )\n conditions.merge!( :id => author_ids )\n end\n params[:top] == '1' ? top() : ( !params[:q].blank? ? search( conditions ) : list( conditions ) )\n @authors.delete_if{ |a| a.story_authors.count < 2 } if params[:cf] == '1'\n rxml_data( @authors, :root => 'authors', :with_pagination => true )\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @books.to_xml }\n end\n end",
"def book_params\n #params.fetch(:page, {name})\n params[:book].permit(:name, :cipher,:author, :publishing_house, :publishing_date, :price, :library_id)\n end",
"def show\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shelf.to_xml(:include => :books) }\n end\n end",
"def book_params\n params.require(:book).permit(:ISBN, :title, :description, :author, :status)\n end",
"def book_params\n params.require(:book).permit(:author, :name, :category, :description, :owner_id, :rent_by_id, :give)\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def book_params\n params.require(:book).permit(:isbn, :title, :subtitle, :image, :author, :translator, :pages, :douban_url, :jd_url, :publisher, :author_intro, :summary, :price, :stocks)\n end",
"def index\n if params.has_key?(:search) && params[:search].strip != \"\" #for rental search across site\n @books = Book.search(params[:search], :match_mode => :any, :star => true, :page => params[:page], :per_page => 10)\n if (@books.count == 0)\n @books = nil\n end\n\n elsif params[:category] #for category search\n @book_ids = BookCategory.where('category_id = ?', params[:category]).pluck(:book_id)\n if (@book_ids)\n @books = Book.where(:id => @book_ids).paginate(:page => params[:page], :per_page => 10)\n if (UserBook.find_by_book_id(@book_ids) == nil)\n @books = nil\n end\n else\n @books = nil\n #flash[:alert] = \"We didn't find any book in this category :(\" #not showing up\n end\n \n #elsif params[:value] #for autosuggest on search bar\n # @books = Book.search(params[:value], :match_mode => :any, :star => true)\n \n else \n @books = Book.where(:id => [1..191]).paginate(:page => params[:page], :per_page => 10) #paginate(:page => params[:page], :per_page => 1) #(limit: 10)\n flash.now[:alert] = \"Please type in something to search. Some recent listings have been shown. Also, we just opened up the listing feature :)\"\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n\n end",
"def index\n @books = Book.order(\"year DESC\").paginate(page: params[:page], per_page: params[:per_page] ? params[:per_page] : 10)\n @books_all = @books\n\n if params[:type]\n if params[:type] == 'collections'\n @books = @books.where('book_type NOT IN (?)', ['Monograph', 'Monograph in a serial'])\n elsif params[:type] == 'monographs'\n @books = @books.where('book_type IN (?)', ['Monograph', 'Monograph in a serial'])\n end\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @books }\n end\n end",
"def book_params\n params.require(:book).permit(:title, :author, :isbn, :image, :is_active, :is_approved, tag_ids: [])\n end",
"def book_params\n params.require(:book).permit(:author, :title, :publisher)\n end",
"def book_params\n params.require(:book).permit(:isbn, :title, :author, :price, :category_id, :icon_path, :picture_path, :description, :display_order)\n end",
"def book_params\n params.require(:book).permit(:isbn, :title, :author, :price, :category_id, :icon_path, :picture_path, :description, :display_order)\n end",
"def search\n books, editionparams, descriptionparams = searchbooks(params)\n @hitcount = books.size\n filterbooks(books, editionparams, descriptionparams)\n @books = books\n respond_to do |format|\n format.html # search.html.erb\n format.xml\n format.atom\n #format.xml { render :xml => @books }\n end\n end",
"def index\n @books = Book.all\n\t# @book = Book.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def getAuthors(indexMeta, rawMeta)\n # If not UC-Ingest formatted, fall back on index info\n if !rawMeta.at(\"/record/authors\")\n return indexMeta.multiple(\"creator\").map { |name| {name: name} }\n end\n\n # For UC-Ingest, we can provide more detailed author info\n rawMeta.xpath(\"/record/authors/*\").map { |el|\n if el.name == \"organization\"\n { name: el.text, organization: el.text }\n elsif el.name == \"author\"\n data = { name: formatAuthName(el) }\n el.children.each { |sub|\n if sub.name == \"identifier\"\n data[(sub.attr('type') + \"_id\").to_sym] = sub.text\n else\n data[sub.name.to_sym] = sub.text\n end\n }\n data\n else\n raise(\"Unknown element #{el.name.inspect} within UCIngest authors\")\n end\n }\nend",
"def display_resource(book)\n book.title\n end",
"def create\n \n \n @booktitle = Book.find_by_title(book_params[:title])\n if Book.where(:title => book_params[:title]).present?\n @book = Book.find(@booktitle.id)\n @book.count = @book.count + book_params[:count].to_i\n else\n if !(Author.where(:name => book_params[:author_name]).present?)\n @author = Author.create(:name => book_params[:author_name],\n :category => book_params[:category])\n end\n @book = Book.new(book_params)\n @book.author_id = Author.find_by_name(book_params[:author_name]).id\n end\n\n \n respond_to do |format|\n if @book.save\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def book_params\n params.require(:book).permit(:title, :isbn, :stock, :edition_number, :genre, :language, :pages, :publisher_id, author_ids: [])\n end",
"def index\n if params[:author_id]\n @author = Author.find(params[:author_id])\n @books = @author.books\n else\n @books = Book.all\n end\n end",
"def book_params\n params.require(:book).permit(:title, :description, :author, :category_id, :book_img)\n end",
"def book\n return direct_book if item_type == 'book' || item_type == 'package'\n group && group.book\n end",
"def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end",
"def book_params\n params.require(:book).permit(:title, :price, :language, :publishedyear, :ISBN, :author_id, :name, :user_id)\n end",
"def book_params\n params.require(:book).permit(:name, :book_category_id)\n end",
"def book_params\n params.require(:book).permit(:title, :author, :pages, :public, :user_id, :trade_able)\n end"
] |
[
"0.65045077",
"0.59051555",
"0.58521795",
"0.5815419",
"0.5782682",
"0.572954",
"0.57255226",
"0.5692258",
"0.56849456",
"0.5672873",
"0.56698275",
"0.5667937",
"0.56581014",
"0.56352717",
"0.559848",
"0.55929154",
"0.5581945",
"0.5569365",
"0.55536705",
"0.55375427",
"0.55331224",
"0.55269754",
"0.5513769",
"0.5511671",
"0.5503518",
"0.5498435",
"0.54939455",
"0.5491984",
"0.5490886",
"0.5487818",
"0.5486774",
"0.54806256",
"0.54720366",
"0.546358",
"0.54561996",
"0.5454765",
"0.5446615",
"0.5446615",
"0.5434892",
"0.5434637",
"0.5433896",
"0.5424145",
"0.5423649",
"0.5423555",
"0.5421609",
"0.5421445",
"0.54148716",
"0.54144824",
"0.5408473",
"0.53963727",
"0.5394166",
"0.5392665",
"0.5389682",
"0.53860563",
"0.5384716",
"0.5382911",
"0.538139",
"0.5373553",
"0.5371213",
"0.53650796",
"0.53642297",
"0.53623843",
"0.5361931",
"0.5356777",
"0.53518164",
"0.5349622",
"0.5332272",
"0.5331492",
"0.53311527",
"0.53249925",
"0.53224885",
"0.53201467",
"0.5318873",
"0.53176796",
"0.5315304",
"0.5315147",
"0.53099257",
"0.5309166",
"0.5307311",
"0.53058356",
"0.53058356",
"0.5302003",
"0.53015673",
"0.5298275",
"0.52881944",
"0.5287124",
"0.5285457",
"0.5285457",
"0.52829206",
"0.5280664",
"0.5279788",
"0.52679396",
"0.52679384",
"0.52650326",
"0.5261652",
"0.526081",
"0.5250385",
"0.5249911",
"0.5246796",
"0.5241786",
"0.52378494"
] |
0.0
|
-1
|
Enumerate the PPP active connections.
|
def list
Enumerator.new do |y|
@cache.each_value do |re|
y << [re['address'], re['name']]
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def connections\n @mutex.synchronize do\n @connections.values.inject(0, &:+)\n end\n end",
"def get_connections\n @connected_to.keys\n end",
"def connections\n @connections.size\n end",
"def connections\n @connections.size\n end",
"def connections\n @connections ||= []\n end",
"def numConnections\n if activeConnections? then do\n n = 0\n @connectedClients.each {|client| n += 1 }\n return n\n else\n return 0\n end\n end",
"def available_connections(server=:default)\n @available_connections[server]\n end",
"def all_active_connections\n super\n end",
"def connections\n return @connectors.keys\n end",
"def connections\n @connection_pool\n end",
"def nicks_connected_with\n @connection_cache.keys\n end",
"def getconnectioncount\n coind.getconnectioncount\n end",
"def status\n @connections.status\n end",
"def connections\n @connections ||= {}\n end",
"def index\n @ps_connection_informations = PsConnectionInformation.all\n end",
"def connections\n @connections ||= {}\n end",
"def connections\n attributes[:connections]\n end",
"def connected_ports; end",
"def peers\n if sessions.count > 0\n puts\n puts \"Currently Managing\"\n puts \"------------------\"\n puts\n sessions.each_with_index do |session, i|\n puts \"[#{i}] #{session.peername}\"\n end\n puts\n else\n puts \"No active sessions\"\n end\n nil\n end",
"def grab_connections\n connections = []\n connections << @host\n end",
"def active_connections?\n self.ensure_ready\n self.connection_pool_list.any?(&:active_connection?)\n end",
"def active_remotes\n @remote_forwarded_ports.keys\n end",
"def connections\n @_connections ||= {}\n end",
"def remote_connections; end",
"def connection_count\n request('getconnectioncount')\n end",
"def connections\n targets = []\n enter_at_mode\n at('atnd')\n while true\n a = wait_cr # XXXX\n break if a == ''\n adrh = wait_cr # Address (H)\n adrl = wait_cr # Address (L)\n targets << [adrh, adrl]\n 6.times {wait_cr} # ' ', XXXX, XX, XX, XX, XXXX, XXXX\n end\n leave_at_mode\n targets\n end",
"def active_local_sockets\n @local_forwarded_sockets.keys\n end",
"def all_connections\n hold do |c|\n sync do\n yield c\n @available_connections.each{|conn| yield conn}\n end\n end\n end",
"def all_connections\n hold do |c|\n sync do\n yield c\n @available_connections.each{|conn| yield conn}\n end\n end\n end",
"def activeConnections?\n if @connectedClients then do return true else return false end\n end",
"def managed_connections\n @@managed_connections\n end",
"def connections\n connections = @mutex.synchronize { connections = @connections.dup }\n connections.delete_if { |c| c.kind_of?(Thread) }\n connections.freeze\n connections\n end",
"def index\n @connections = Connection.all\n end",
"def index\n @connections = Connection.all\n end",
"def connections_for(socket)\n @mutex.synchronize do\n ip = peer_ip(socket)\n @connections[ip] || 0\n end\n end",
"def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end",
"def connecting_i_p\n return @connecting_i_p\n end",
"def get_connections(queue)\n @connections.select { |con| con.src.label == queue.label }\n end",
"def connection_stats\n @lock.lock\n @connections.map(&:stats)\n ensure\n @lock.unlock\n end",
"def connections(token)\n request(\n __method__,\n :get,\n \"#{api_base}/users/@me/connections\",\n Authorization: token\n )\n end",
"def connection_count\n @@_telnet_connection_count\n end",
"def state\n Cproton.pn_connection_state(@impl)\n end",
"def index\n @http_connections = HttpConnection.all\n end",
"def active_local_sockets; end",
"def profile_connections\n\t\tfindby = params[:slug] || params[:id]\n\t\t@user = User.find_by_slug(findby) if findby.is_a?(String)\n\t\t@user = User.find(findby) if findby.is_a?(Fixnum)\n\n\t\t@connections = @user.connections.\n\t\t not_pending.\n\t\t collect{|connection| connection.not_me(@user.id)}.\n\t\t paginate(:per_page => 20, :page => params[:page])\n\n\t\t@my_connections = self.current_user.\n\t\t connections.\n\t\t not_pending.\n\t\t collect{|connection| connection.not_me_id(self.current_user.id)}\n\tend",
"def connections(id={}, options={})\n options = parse_id(id, options)\n path = \"#{profile_path(options, false)}/connections\"\n get(path, options)\n end",
"def getconnectioncount\n @api.request 'getconnectioncount'\n end",
"def get_connection_info\n info = []\n @connections.each do |connection|\n info.push([connection.id, connection.target_uri, 'i', connection.protocol, @topic_name])\n end\n info\n end",
"def all_connections_parser(reply_from_all_connections, flag=/^CONNECTION: /)\n pairs = reply_from_all_connections.split(\"\\n\").select {|v| v =~ flag }.map do |line|\n line.split(':').last.split(' - ').map {|v| v.to_i }.sort\n end\n pairs.uniq\n end",
"def get_conns_current(snmp = nil)\n snmp = @snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Virtual Servers/Current Connections\", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_CUR_CONNS, snmp)\n NewRelic::PlatformLogger.debug(\"Virtual Servers: Got #{res.size}/#{@names.size} Current Connection metrics\")\n\n unless res.nil?\n sorted_report = res.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"conns\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end",
"def get_num_connections(params)\n # TODO: deal with node not existing (nil coming back from get_stats)\n get_stats(params)['STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS']\n end",
"def current_open_ports\n tcp_ports = []\n udp_ports = []\n security_group.ip_permissions.each do |hsh|\n proto, from, to = hsh['ipProtocol'], hsh['fromPort'], hsh['toPort']\n case proto\n when 'tcp'\n tcp_ports.push Range.new(from, to).to_a\n when 'udp'\n udp_ports.push Range.new(from, to).to_a\n end\n end\n {tcp: tcp_ports.flatten, udp: udp_ports.flatten}\n end",
"def all_connections\n hold do |conn|\n yield conn\n\n # Use a hash to record all connections already seen. As soon as we\n # come across a connection we've already seen, we stop the loop.\n conns = {}\n conns.compare_by_identity\n while true\n conn = nil\n begin\n break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]\n conns[conn] = true\n yield conn\n ensure\n @queue.push(conn) if conn\n end\n end\n end\n end",
"def extract_connections!\n # Get the connections.\n cnxs = self.each_connection.to_a\n # Remove them from the scope.\n # cnxs.each { |cnx| self.delete_connection!(cnx) }\n # cnxs.delete_all_connections!\n self.delete_all_connections!\n # Return the connections.\n return cnxs\n end",
"def all_connections\n yield @conn.first if @conn\n end",
"def known_ip_count\n @mutex.synchronize do\n @connections.size\n end\n end",
"def close_connections\n @connections.values.each(&:close)\n end",
"def verify_active_connections! #:nodoc:\n clear_stale_cached_connections!\n @connections.each do |connection|\n connection.verify!\n end\n end",
"def ports\n enum_for(:each_port).to_a\n end",
"def realize_pending_connections! #:nodoc:\n return unless concurrent_connections\n\n server_list.each do |server|\n server.close if !server.busy?(true)\n server.update_session!\n end\n\n @connect_threads.delete_if { |t| !t.alive? }\n\n count = concurrent_connections ? (concurrent_connections - open_connections) : @pending_sessions.length\n count.times do\n session = @pending_sessions.pop or break\n # Increment the open_connections count here to prevent\n # creation of connection thread again before that is\n # incremented by the thread.\n @session_mutex.synchronize { @open_connections += 1 }\n @connect_threads << Thread.new do\n session.replace_with(next_session(session.server, true))\n end\n end\n end",
"def netstat_tcp\n\t\ttcp=[]\n\t\tprint_status('Enumerating Open TCP Ports.....')\n\t\t@manager.walk('tcpConnState') {|x| tcp << x.to_s.split(\", \")[0].sub('[name=TCP-MIB::tcpConnState.', '') }\n\t\tif not tcp.empty?\n\t\t\tputs \"[*] \".light_green + \"OPEN TCP PORTS\".light_yellow + \": \".white\n\t\t\ttcp.each do |entry|\n\t\t\t\tif entry =~ /(\\d+.\\d+.\\d+.\\d+).(\\d+).(\\d+.\\d+.\\d+.\\d+).(\\d+)/ or entry =~ /(\\d+.\\d+.\\d+.\\d+).(\\d+)/\n\t\t\t\t\tip=$1\n\t\t\t\t\tport=$2\n\t\t\t\t\tip2=$3\n\t\t\t\t\tport2=$4\n\t\t\t\t\tprint_good(\"#{ip}:#{port}\")\n\t\t\t\t\tif ip2 and port2\n\t\t\t\t\t\tprint_good(\"#{ip2}:#{port2}\")\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprint_good(\"#{entry}\")\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tprint_error(\"No Values Found!\")\n\t\tend\n\tend",
"def get_connected_uri\n @connections.map {|x| x.target_uri}\n end",
"def available_count\n raise_if_closed!\n\n @lock.synchronize do\n @available_connections.length\n end\n end",
"def channels\r\n return @chanlist\r\n end",
"def all\n repo.connections.each do |name, connection|\n write \"#{name} : #{connection}\"\n end\n end",
"def supported_connections\n ConnectionProvider.providers.select { |connection| connection.supported_by?(@handle) }\n end",
"def manageConnections(classifiedPeers)\n\n n = classifiedPeers.handshakingPeers.size + classifiedPeers.establishedPeers.size\n if n < @targetActivePeerCount\n result = classifiedPeers.disconnectedPeers.shuffle.first(@targetActivePeerCount - n)\n @logger.debug \"There are #{n} peers connected or in handshaking. Will establish #{result.size} more connections to peers.\"\n result\n else\n []\n end\n end",
"def count_unique_connections\n connected_users = []\n ActionCable.server.connections.each do |connection|\n connected_users.push(1)\n end\n return connected_users.uniq.length\n end",
"def index\n @t_qconnections = TQconnection.all\n end",
"def open_ports\n @scanned_ports ||= host_stats[:open_ports].to_i\n end",
"def clear_active_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:release_connection)\n end",
"def connections_here(whom = nil)\n list = []\n if whom\n whom = whom.map(&:downcase)\n end\n @connection.server.connections.each { |key, connection|\n if whom\n if whom.include?(connection.agent.name.downcase) and connection.agent.item == item\n list.push(connection)\n end\n else\n if connection.agent.item == item\n list.push(connection)\n end\n end\n }\n return list\n end",
"def connections?\n @connections.any?\n end",
"def next_available\n case @connection_handling\n when :stack\n @available_connections.pop\n else\n @available_connections.shift\n end\n end",
"def next_available\n case @connection_handling\n when :stack\n @available_connections.pop\n else\n @available_connections.shift\n end\n end",
"def ping_all_sockets\n\t\treturn if self.connections.empty?\n\n\t\tself.log.debug \"Pinging %d connected sockets.\" % [ self.connections.length ]\n\t\tself.connections.each do |sender_id, conn_ids|\n\t\t\tframe = Mongrel2::WebSocket::Frame.new( sender_id, conn_id, '', {}, 'heartbeat' )\n\t\t\tframe.opcode = :ping\n\t\t\tframe.fin = true\n\n\t\t\tself.log.debug \" %s/%d: PING\" % [ sender_id, conn_id ]\n\t\t\tself.conn.reply( frame )\n\t\tend\n\n\t\tself.log.debug \" done with pings.\"\n\tend",
"def active_handles\n uvloop = Ext::UvLoop.new @pointer\n uvloop[:active_handles]\n end",
"def clear_active_connections!\n clear_cache!(@@active_connections) do |name, conn|\n conn.disconnect!\n end\n end",
"def connectionStart(conn)\n\n port, host = conn.peeraddr[1,2]\n client = \"#{host}:#{port}\"\n #puts \"#{client} is connected\"\n $counter=$counter + 1\n $maxConnections = $maxConnections + 1\n puts $counter.to_s+\" clients connected\"\n $logger.info \"#{client} has connected\"\n $logger.info $counter.to_s+\" clients connected\"\nend",
"def each_with_inactive\n @uuids.each do |uuid|\n yield @connections[uuid]\n end\n end",
"def connection_status\n @connection_status ||= @node['connectionStatus']\n end",
"def pending_connections\n\t\tredirect_to '/my_connections'\n\tend",
"def connection_status\n @connection_status ||= @node['connectionStatus']\n end",
"def connected\n\t\treturn @connected\n\tend",
"def pool \n @pool.select(&:alive?).size\n end",
"def getConnections\n\t\tr = []\n\t\teditor.getModelCanvas.getItems(UONConnection).each do |c|\n\t\t\tif (c.srcItem == self) || (c.destItem == self) then r.push c end\n\t\tend\n\t\tr\n\tend",
"def connection_status\n \t@current_connection = ConnectionInfo.where(\"disconnected_at is null\").first\n end",
"def discover_server_periodically\n @disconnected_connections.each do |key,connection|\n connection.establish_connection\n if connection.connection_status\n @backend_connections << connection\n connection.close_connection\n @disconnected_connections[key] = nil\n end\n end\n @disconnected_connections.delete_if { |key,value| value.nil? }\n @round_robin = (0...@backend_connections.length).to_a\n end",
"def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end",
"def active_macs\n db_cached_connect\n\n retvalue = []\n\n sql = \"SELECT M.mac\n FROM mac M,\n mac_history MH\n WHERE M.mac_id = MH.mac_id\n AND NOW() BETWEEN MH.start_dt AND MH.end_dt\"\n\n @dbh.prepare(sql) do |sth|\n sth.execute(switch_id, name, descr, portindex, bridgeport, uplink, active)\n sth.fetch_hash do |hash|\n retvalue.push(hash['mac'])\n end\n end\n\n return retvalue\n end",
"def index\n @scan_protocols = current_account.scan_protocols.all\n end",
"def getconnectioncount\n request :getconnectioncount\n end",
"def handle_connections\n @node.connections.sort{|x,y| y.uptime <=> x.uptime}.map{|c|\n \"#{c.host.rjust(15)}:#{c.port} [#{c.direction}, state: #{c.state}, \" +\n \"version: #{c.version.version rescue '?'}, \" +\n \"block: #{c.version.block rescue '?'}, \" +\n \"uptime: #{format_uptime(c.uptime) rescue 0}, \" +\n \"client: #{c.version.user_agent rescue '?'}]\" }\n end",
"def connections_get(opts = {})\n data, _status_code, _headers = connections_get_with_http_info(opts)\n data\n end",
"def connected_resources(jid)\n jid = Jabber::JID.new(jid) unless jid.kind_of?(Jabber::JID)\n (clients | bosh_clients).select do |stream|\n stream.connected? && jid == (jid.bared? ? stream.user.jid.bare : stream.user.jid)\n end\n end",
"def connections\n super.includes(:partners)\n .where(partners: { status: :approved })\n .where.not(partners: { id: id })\n .group(\"connections.id, partners.id\")\n end",
"def index\n @dbconnections = Dbconnection.all\n end",
"def all_cops\n @all_cops ||= `#{options[:cmd]} --show-cops --force-default-config`.lines.select { |l| l.match(/^\\w/) }\n end",
"def active_connection?\n connection_id = current_connection_id\n if conn = @reserved_connections.fetch(connection_id, nil)\n !! conn.in_use? # synchronize { conn.in_use? }\n else\n false\n end\n end",
"def read_used_ports\n end",
"def index\n @project_connections = ProjectConnection.all\n end"
] |
[
"0.6588165",
"0.6537788",
"0.628825",
"0.628825",
"0.62706524",
"0.6180209",
"0.61736506",
"0.6163956",
"0.6145144",
"0.6120536",
"0.60523576",
"0.60159576",
"0.5992606",
"0.5988143",
"0.5985991",
"0.5972942",
"0.5968366",
"0.59525335",
"0.5898508",
"0.5885188",
"0.5857816",
"0.5797302",
"0.5793983",
"0.5778103",
"0.57715064",
"0.57667875",
"0.57470137",
"0.57254475",
"0.57254475",
"0.5722131",
"0.5709475",
"0.5706016",
"0.56992316",
"0.56992316",
"0.5684337",
"0.56806844",
"0.5671882",
"0.56612873",
"0.56487536",
"0.56381863",
"0.56304705",
"0.5628388",
"0.55496377",
"0.5532937",
"0.5532402",
"0.5530964",
"0.55103236",
"0.5482625",
"0.54669815",
"0.5464153",
"0.5425253",
"0.5417732",
"0.5410917",
"0.5370487",
"0.5350231",
"0.53427064",
"0.5336721",
"0.53338873",
"0.5316822",
"0.5312687",
"0.5294347",
"0.5269644",
"0.52605003",
"0.5255022",
"0.52509904",
"0.5245289",
"0.5241338",
"0.52355564",
"0.5234663",
"0.52206254",
"0.5216578",
"0.5213762",
"0.52019227",
"0.51999587",
"0.51999587",
"0.518315",
"0.5182936",
"0.517542",
"0.5174199",
"0.516538",
"0.5162816",
"0.515261",
"0.514921",
"0.5124546",
"0.5120477",
"0.51171434",
"0.5115487",
"0.5104016",
"0.5103844",
"0.51008403",
"0.50957",
"0.50890034",
"0.50872403",
"0.50870323",
"0.5086033",
"0.5084982",
"0.50700694",
"0.50659925",
"0.50551945",
"0.50524783",
"0.5041741"
] |
0.0
|
-1
|
=index value of 15 i case insensitive
|
def come
p 'Welcome Home'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def az_index c\n c.upcase.ord - 'A'.ord\nend",
"def create_index2(word)\n word.each_char.map {|c| CHAR_MAP[c.downcase]}.reduce(:*)\n end",
"def char_at(index)\n self.to_array[index.to_i]\n #@word = TILE_VALUES[index]\n end",
"def index_of_small_letter(word)\n #word.gsub(/[[:lower:]]/)\nend",
"def get_index(i)\n case i\n when 0...10\n index = \"00#{i}\"\n when 10...100\n index = \"0#{i}\"\n else\n index = i\n end\n index\n end",
"def index_to_letter(index)\n ALPHA26[index]\n end",
"def value_index\n return nil unless self.value\n VALUES.index(self.value.downcase)\n end",
"def upcase\n $capitals.values[6].upcase\nend",
"def print_index\n\t\t#zet de index nr in text_index\n\t\ttext_index = \"Hello, Ruby.\".index /Ruby/\n\t\t#print text_index\n\t\tputs text_index\n\tend",
"def get_index key, vsz=999\n i = $IDX.index(key)\n return i+$stact if i\n #sz = $IDX.size\n zch = nil\n if vsz > 25\n if key == \"z\" || key == \"Z\"\n #print key\n zch = get_char\n #print zch\n i = $IDX.index(\"#{key}#{zch}\")\n return i+$stact if i\n end\n end\n return nil\nend",
"def get_index key, vsz=999\n i = $IDX.index(key)\n return i+$stact if i\n #sz = $IDX.size\n zch = nil\n if vsz > 25\n if key == \"z\" || key == \"Z\"\n print key\n zch = get_char\n print zch\n i = $IDX.index(\"#{key}#{zch}\")\n return i+$stact if i\n end\n end\n return nil\nend",
"def get_view_by_index(idx)\n value = idx / 4 + (idx % 4 == 0 ? 1 : 2)\n case\n when value <= 10\n return value.to_s\n when value == 11\n return 'J'\n when value == 12\n return 'Q'\n when value == 13\n return 'K'\n when value == 14\n return 'A'\n end\n end",
"def vowel(vowel_letter)\r\n vowel = \"aeiou\"\r\n current_location = vowel.index(vowel_letter)\r\n new_vowel = current_location + 1\r\n if vowel.index(vowel_letter) == 4\r\n results = vowel[0]\r\n else\r\n results = vowel[new_vowel]\r\n end\r\n results\r\nend",
"def create_index1(word)\n word.chars.sort!.join\n end",
"def extract_word_index\n self.word_index = self.title[0].upcase\n end",
"def index(substr)\n `var res = self.indexOf(substr);\n\n return res == -1 ? nil : res;`\n end",
"def index(substr)\n `var res = self.indexOf(substr);\n\n return res == -1 ? nil : res;`\n end",
"def [](word1)\n @index[word1]\n end",
"def dash_to_letter() \n $match_index_arr.map {|n| $hidden_word_arr[n] = \"#{$input}\"}\n end",
"def word\n i = rand(78)\n if i <= 2\n \"ie\"\n elsif i <= 3\n \"au\"\n elsif i < 10\n v + c\n elsif i < 17\n c + v\n elsif i < 25\n v + c + v\n elsif i < 33\n c + v + c\n elsif i < 43\n v + c + v + c\n elsif i < 53\n c + v + c + v\n elsif i < 68\n v + c + v + c + v\n elsif i < 71\n c + v + c + v + c\n elsif i < 74\n v + c + v + c + v + c\n elsif i < 76\n c + v + c + v + c + v\n elsif i < 77\n v + c + v + c + v + c + v\n elsif i <= 78\n c + v + c + v + c + v + c\n end\nend",
"def char_at(index)\n\tself.to_array[index.to_i]\n end",
"def test_index_one_repeated_word\n #assert false # bogus assert -- remove or comment out\n @concordance.index!(['zero','zero','zero'])\n assert_equal({'zero'=>[1]},@concordance.hash)\n end",
"def find_value(val)\r\n\t\ttemp = nil\r\n\t\t@actual_parameters.each_with_index do |row,index|\r\n\t\t\trow.each_with_index do |element, index1|\r\n\t\t\t\tif (element.downcase.delete(' ') == val.downcase.delete(' ') && index1 != 0)\r\n\t\t\t\t\treturn (index + 97).chr + index1.to_s\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\treturn nil\r\n\tend",
"def letter_to_index(letter)\n ALPHA26.index(letter.upcase)\n end",
"def char_at(index)\n\tself.to_array[index.to_i]\nend",
"def get_map_letter_index(x_value)\n\tif x_value >= 0 && x_value <= 50\n\t\treturn 'A'\n\telsif x_value >= 50 && x_value <= 100\n\t\treturn 'B'\n\telsif x_value >= 100 && x_value <= 150\n\t\treturn 'C'\n\telsif x_value >= 150 && x_value <= 200\n\t\treturn 'D'\n\telsif x_value >= 200 && x_value <= 250\n\t\treturn 'E'\n\telsif x_value >= 250 && x_value <= 300\n\t\treturn 'F'\n\telsif x_value >= 300 && x_value <= 350\n\t\treturn 'G'\n\telsif x_value >= 350 && x_value <= 400\n\t\treturn 'H'\n\telsif x_value >= 400 && x_value <= 450\n\t\treturn 'I'\n\telsif x_value >= 450 && x_value <= 500\n\t\treturn 'J'\t\t\n\telse\n\t\treturn '?'\n\tend\nend",
"def capital_index\n\n user_input = gets.chomp.to_s\n\n input_array = []\n input_array << user_input.split(//) \n\n input_array.each_with_index do |input, index|\n if input.upcase\n puts index\n else\n puts input\n end\n end\n\nend",
"def [](index)\r\n words[index]\r\n end",
"def [](word)\n @index[word]\n end",
"def char_at(index)\n self.to_array[index.to_i]\n end",
"def subject_string_by_index(index)\n\t\tcase index\n\t\t\twhen 0\n\t\t\t\treturn \"ma\"\n\t\t\twhen 1\n\t\t\t\treturn \"sc\"\n\t\t\twhen 2\n\t\t\t\treturn \"ss\"\n\t\t\twhen 3\n\t\t\t\treturn \"la\"\n\t\t\twhen 4\n\t\t\t\treturn \"fl\"\n\t\t\twhen 5\n\t\t\t\treturn \"mu\"\n\t\t\twhen 6\n\t\t\t\treturn \"pe\"\n\t\t\twhen 7\n\t\t\t\treturn \"he\"\n\t\t\twhen 8\n\t\t\t\treturn \"da\"\n\t\t\twhen 9\n\t\t\t\treturn \"va\"\n\t\t\twhen 10\n\t\t\t\treturn \"se\"\n\t\t\twhen 11\n\t\t\t\treturn \"te\"\n\t\tend\n\t\t#otherwise\n\t\treturn \"Invalid subject index!\"\n\tend",
"def pirates_say_arrrrrrrrr(string)\n\n string_array = string.chars\n indexes = string_array.each_with_index.map {|char, index| char.downcase == 'r' ? index : nil}.compact # gives an array of the indexes we want\n indexes.map {|x| string_array[x+1]}.join # iterates through each index for string_array \n\nend",
"def get index\n @letters[index]\n end",
"def robot_translator(phrase)\n counter = 0\n i = 0\n first_alpha = \"abcdefghijklm\"\n while counter < phrase.length\n word_index = phrase[i]\n if word_index.upcase && word_index[first_alpha]\n puts \"bloop\"\n elsif\n word_index.upcase || word_index == \"e\"\n puts \"buzz\"\n elsif word_index.to_i\n puts \"boing\"\n else\n puts \"beep\"\n end\n counter += 1\n end\nend",
"def nieuwe_letter(i, nummer)\n alfabet = ('a'..'z').to_a\n alfabet_hoog = ('A'..'Z').to_a\n\n# index van letter krijgen\nif alfabet.index i\n huidig_nummer = alfabet.index i\nelse\n huidig_nummer = alfabet_hoog.index i\nend\n\n# Index van vertaalde letter krijgen\nif nummer > 0\n nieuw_nummer = huidig_nummer + nummer\nif nieuw_nummer > 26\n nieuw_nummer = nieuw_nummer - 26\nend\nend\n\n# Gebruik index voor letters (vertaald)\nif alfabet.index\n new_let = alfabet[nieuw_nummer]\nelse\n new_let = alfabet_hoog[nieuw_nummer]\nend\n\nend",
"def [](index)\n to_s[index]\n end",
"def to_searchable index\n _getarray[index].to_s\n end",
"def formatted_index(index=nil)\n index = \"^#{index.nil? ? @index : index}\"\n Unit.use_superscript_characters? ? index.with_superscript_characters : index\n end",
"def change a\n ans = []\n (\"a\"..\"z\").each do |i|\n if a.downcase.include?(i)\n ans << 1\n else\n ans << 0\n end\n end\n return ans.join\nend",
"def partial(i)\n return false if i > 8\n return @pan.to_s.split('')[(i-1)..(i+1)].join().to_i\n end",
"def fill_up_case(pion)\n\tself.position = pion\n end",
"def pirates_say_arrrrrrrrr(string)\n \n arr = string.downcase.split('') # turning into an array and making lowercase\n \n index_no = arr.each_index.select { |r| arr[r] == 'r' } # finding the index no of each r\n \n new_index_no = index_no.map {|n| n + 1} # adding 1 to each index no\n \n p new_index_no.map {|i| arr[i] }.join # mapping the index no to the original arr and chaning to a str\n \nend",
"def column_index i\n if case_sensitive\n position = indices.find_index {|column| column == i || (@aliases.has_key?(column) && @aliases[column].member?(i))}\n else\n position = indices.find_index {|column| column.downcase == i.to_s.downcase || (aliases.has_key?(column.downcase) && aliases[column.downcase].any? {|the_alias| the_alias.downcase == i.to_s.downcase})}\n end\n\n position ||= (i.kind_of?(Fixnum) ? i : nil)\n end",
"def [](key)\n @itinerary[key.to_s.camelcase(:lower)]\n end",
"def consonants(consonants_letter)\r\n consonants = \"bcdefghjklmnpqrstvwxyz\"\r\n current_location = consonants.index(consonants_letter)\r\n new_consonants = current_location + 1\r\n if consonants.index(consonants_letter) == 21\r\n results = \"b\"\r\n else\r\n results = consonants[new_consonants]\r\n end\r\n results\r\nend",
"def index(key, size)\n char_value = 0\n # Adds together all of the ASCII values for each character into char_value.\n for letter in key.chars do\n char_value += letter.ord\n end\n # Increments char_value until its length equals desired size.\n until char_value.to_s.length == 7\n char_value*=11\n end\n\n return char_value%size\n end",
"def arrayplace (letter)\n array= \"abcĉdefgĝhĥijĵklmnoprsŝtuŭvz \".chars\n array.find_index(letter)\nend",
"def index(key, size)\n #sums up the ascii values of each char in a string\n code = key.sum\n return code % size\n end",
"def vowels_7(words)\n offset = nil\n index = 0\n words.each_char do |char|\n if char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\"\n offset ||= index\n end \n index +=1\n end\n offset\nend",
"def translateFromAmbigValue( value, index )\n ambiguous?(value) ? (('a'..'z').to_a[index]) : (\"\")\n end",
"def toggle_case(text, count = text.prefix_count)\n from = 'insert'\n to = \"insert + #{count} chars\"\n chunk = text.get(from, to)\n chunk.tr!('a-zA-Z', 'A-Za-z')\n text.replace(from, to, chunk)\n end",
"def temporal_index_name(index_name)\n\t\t\tindex_name.to_s.sub(/^index/, \"ind_h\").sub(/_ix(\\d+)$/, '_hi\\1')\n\t\tend",
"def get_code_for(i)\n if i.is_a?(String)\n c = i[0]\n else\n c = i\n end\n\n return @remap_chars[c.chr] || c.chr\n end",
"def at(index); end",
"def substitution_value(index)\n Base64.urlsafe_encode64(Digest::SHA1.digest(index.to_s)).gsub(/[^A-Za-z]/, '')[0..5]\n end",
"def index_for(word)\n words = %w{There was a farmer had a dog and Bingo was his name}\n\n words.find_index {|this_word| word == this_word}\nend",
"def [](index)\n lookup(index.to_sym)\n end",
"def test_index word, guess, index\r\n (word[index] == guess)? \"!\" : \"?\" #if the indexes match it means outputs a \"!\", else it means the letter exists in the word but not in that exact index and outputs a \"?\" \r\nend",
"def index_letter\n last_name[0..0]\n end",
"def translateFromFillValue( value, index )\n filled?(value) ? (('a'..'z').to_a[index]) : (\" \")\n end",
"def index\n @case_insensitives = CaseInsensitive.all\n end",
"def vowel_change(current_v)\n if current_v == \"u\"\n current_v = \"a\"\n elsif current_v == \"U\"\n current_v = \"A\" \n else \n v_location = $vowels.index(current_v)\n current_v = $vowels[v_location+2]\n end\n current_v\nend",
"def question5(str) # Modify str, returning a lowercased version\n\n end",
"def top_char_downcase(field)\n check_str = field.split(\"_\").map {|word| word.capitalize }.join(\"\")\n head_str = check_str[0].downcase \n check_str.slice!(0)\n result = head_str + check_str\n end",
"def top_char_downcase(field)\n check_str = field.split(\"_\").map {|word| word.capitalize }.join(\"\")\n head_str = check_str[0].downcase \n check_str.slice!(0)\n result = head_str + check_str\n end",
"def create_index3(word)\n word.split('').sort!.join\n end",
"def case_insensitive_match=(_arg0); end",
"def change_vowels(vowel)\n vowels = 'aeioua'\n new_vowel = vowels.index(vowel)\n next_vowel = new_vowel + 1\n swapped_vowel = vowels[next_vowel]\nend",
"def cofactor_indexed(cover,var,val)\n # if val != \"0\" and val != \"1\" then\n if val != 48 and val != 49 then\n raise \"Invalid value for generating a cofactor: #{val}\"\n end\n # Get the index of the variable.\n i = cover.variable_index(var)\n # Create the new cover.\n ncover = Cover.new(*@variables)\n # Set its cubes.\n cover.each_cube do |cube| \n cube = cube.to_s\n # cube[i] = \"-\" if cube[i] == val\n cube.setbyte(i,45) if cube.getbyte(i) == val\n # if cube[i] == \"-\" then\n if cube.getbyte(i) == 45 then\n ncover << Cube.new(cube,false) # No need to clone cube.\n else\n # Add an empty cube for keeping the index.\n ncover << VoidCube.new(ncover.width)\n end\n end\n return ncover\n end",
"def [](index)\n case index\n when Integer\n values[index]\n when self\n values[index.index]\n else\n name = index.to_s\n case name\n when /\\A(\\d+)\\Z/\n return values[$1.to_i]\n when /\\A[a-z]/\n name = name.to_str.gsub(/(?:\\A|_)(.)/) { $1.upcase }\n end\n with_name(name)\n end\n end",
"def index(key, size)\n ascii_sum = 0\n key.split(\"\").each do |word|\n ascii_sum += word.ord\n end\n ascii_sum % size\n end",
"def translate(text)\n mapping = [\"abc\", \"def\", \"ghi\", \"jkl\", \"mno\", \"pqrs\", \"tuv\", \"wxyz\"]\n text.chars.map do |c|\n match = mapping.find_index { |s| s.include?(c.downcase) }\n match ? (match + 2) : c\n end.join\nend",
"def swapcase() end",
"def index(element); end",
"def test_match_case_sensitive_offset\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.offset = 3\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with offset.\")\r\n\tend",
"def expression_index_name(name)\n column_name, operator_name = split_column_name(name)\n\n result_name = if column_name =~ FUNCTIONAL_INDEX_REGEXP\n \"#{$1.downcase}_#{$3}\"\n else\n column_name\n end\n\n result_name += \"_\" + operator_name.parameterize.underscore if operator_name\n\n result_name\n end",
"def index(key, size)\n # Takes the string 'key', creates an array of individual characters (split), maps to an array of ascii values (map), and then sums them (reduce)\n # Reaminder from dividing above amount by array size produces the array index\n (key.split(//).map { |char| char.ord }.reduce(:+)) % size\n end",
"def string_index\n @string_index ||= query.index(reference)\n end",
"def index(p0) end",
"def index(p0) end",
"def locale_idx; end",
"def vowel_2_index(string)\n arr = []\n string.split('').each_with_index { |j, n| arr << j.gsub(/[aeiou]/i, (n + 1).to_s) }\n arr.join('')\nend",
"def find_vowel_index(word, char_idx, count_direction)\n vowel_index = char_idx\n word.length.times do\n if is_vowel?(word[char_idx])\n vowel_index = char_idx\n break\n end\n char_idx += count_direction\n end\n return vowel_index\nend",
"def index(key, size)\n #true_index = hash(key) % k\n code = 0\n key.split(%r{\\s*}).each do |letter|\n code += letter.ord \n end\n puts code\n return code % size\n\n end",
"def alphacheck(value, ary)\n tmp = value.downcase\n \n # If they specified a shortened version of the name, then see\n # if we can lengthen it (e.g., mon => monday).\n if tmp.length == 3\n ary.each_with_index { |name, index|\n if tmp.upcase == name[0..2].upcase\n return index\n end\n }\n else\n return ary.index(tmp) if ary.include?(tmp)\n end\n \n false\n end",
"def caesar_cipher(str, num)\n\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n alphabet.each_char.with_index do |char, idx|\n puts char\n puts idx\n puts \"---\"\n end \n\nend",
"def rl_upcase_word(count, key)\r\n rl_change_case(count, UpCase)\r\n end",
"def indexOfVowel(letter,vowels)\n vowels.index(letter)\nend",
"def get_shortcut ix\n return \"<\" if ix < $stact\n ix -= $stact\n i = $IDX[ix]\n return i if i\n return \"->\"\nend",
"def get_shortcut ix\n return \"<\" if ix < $stact\n ix -= $stact\n i = $IDX[ix]\n return i if i\n return \"->\"\nend",
"def eval_ele(word)\n\n formWord = []\n word.each_char.with_index do |let, idx|\n if idx == 0\n formWord << word[idx].upcase\n else\n formWord << word[idx].downcase\n end\n end\n\n return formWord.join(\"\")\n\nend",
"def index_to_letter(idx)\n letter = \"\"\n while true\n idx -= 1\n r = idx % 26\n idx /= 26\n letter = (r + 97).chr + letter\n break if idx <= 0\n end\n letter\n end",
"def index_for(type, value)\n order = Kubes.config.kubectl.order.send(type) # kinds or roles\n index = order.index(value.to_s) || 999\n i = index.to_s.rjust(3, \"0\") # pad with 0\n \"#{i}-#{value}\" # append name so that terms with same index get order alphabetically\n end",
"def index_to_letter(index)\n alphabet_array[index]\n end",
"def lttfindex\n end",
"def pirates_say_arrrrrrrrr(string)\n r_indexes = []\n string.split(\"\").each_with_index{|letter, index| r_indexes << index if letter.downcase == \"r\"}\n plusoneindex = r_indexes.map{|index| index + 1}\n answer = \"\"\n plusoneindex.map{|index| string.split(\"\")[index]}.join\n\nend",
"def rot13(secret_messages)\n secret_messages = secret_messages.chars\n new_string = \"\" \n letters = ('a'..'z').to_a\n secret_messages.length.times do |letter|\n letter_location = letters.each_index.detect{|i| secret_messages[letter] == letters[i]}\n puts letter_location\n # puts \"index\"\n # puts letter_location += 13\n # new_string += letters[index]\n # puts new_string\n end \n new_string\nend",
"def swapcase!() end",
"def xyzzy(a_value)\n a_value.upcase\nend",
"def alphacheck(value, ary)\n tmp = value.downcase\n\n # If they specified a shortened version of the name, then see\n # if we can lengthen it (e.g., mon => monday).\n if tmp.length == 3\n ary.each_with_index { |name, index|\n if tmp.upcase == name[0..2].upcase\n return index\n end\n }\n else\n return ary.index(tmp) if ary.include?(tmp)\n end\n\n false\n end",
"def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend"
] |
[
"0.6508305",
"0.649827",
"0.6012254",
"0.59458476",
"0.5933818",
"0.58764404",
"0.5873269",
"0.5845312",
"0.57892764",
"0.5770418",
"0.5696458",
"0.5655363",
"0.56407475",
"0.56131804",
"0.5594958",
"0.5591342",
"0.5591342",
"0.5574778",
"0.5557818",
"0.5547689",
"0.55422676",
"0.55306023",
"0.55224913",
"0.5515753",
"0.54933465",
"0.547981",
"0.5468421",
"0.54573643",
"0.54518384",
"0.544899",
"0.5439199",
"0.54214543",
"0.5408498",
"0.5407934",
"0.5403744",
"0.5403034",
"0.5402794",
"0.54019475",
"0.53940904",
"0.5387675",
"0.5387632",
"0.5384454",
"0.53680676",
"0.53678226",
"0.53660613",
"0.5349035",
"0.5347414",
"0.5340778",
"0.5328968",
"0.5328519",
"0.5314839",
"0.53079367",
"0.5299785",
"0.5293346",
"0.52872527",
"0.5276995",
"0.52753544",
"0.52718216",
"0.5266269",
"0.5263924",
"0.5257682",
"0.52566427",
"0.5252938",
"0.525064",
"0.525064",
"0.52481663",
"0.5248058",
"0.5239244",
"0.5233221",
"0.52266455",
"0.5220869",
"0.5216891",
"0.5213653",
"0.52084386",
"0.52040374",
"0.5201541",
"0.52005714",
"0.51952934",
"0.5191675",
"0.5191675",
"0.5185028",
"0.51846844",
"0.5183735",
"0.51813275",
"0.5179925",
"0.5178052",
"0.51739645",
"0.51585275",
"0.5158135",
"0.5158135",
"0.51524794",
"0.51513696",
"0.5146553",
"0.51456547",
"0.5136338",
"0.51333493",
"0.51326525",
"0.5130065",
"0.5128384",
"0.51251304",
"0.512283"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_donation_detail(id)
@donation_detail = DonationDetail.find(id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] |
[
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] |
0.0
|
-1
|
Before filters Confirms a loggedin user.
|
def logged_in_user
unless logged_in?
flash[:danger] = "Please log in."
redirect_to login_url
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end",
"def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end",
"def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n redirect_to root_path\n return false # halts the before_action\n else\n return true\n end\n end",
"def before_filter\n if current_user\n true\n end\n end",
"def cleared_required\n if current_user\n if current_user.cleared\n return\n end\n raise 'Du är ännu inte godkänd för att tippa.'\n end\n redirect_to \"/login\", notice: 'Logga in för att tippa.'\n end",
"def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n render('show')\n #redirect_to(:action => 'login')\n \n #redirect_to(:action => 'login')\n #redirect_to(:controller => 'contacts', :action => 'list')\n \n \n return false # halts the before_filter\n else\n redirect_to(:controller => 'admin_users')\n return true\n end\n end",
"def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end",
"def check_user_before_membership\n if current_user\n ncm_membership = current_user.get_membership(@mother)\n epicenter = Epicenter.find_by_slug(params['epicenter_id'])\n\n if epicenter != @mother and not ncm_membership\n session[:new_ncm_membership] = { \n :epicenter_id => params['epicenter_id'], \n :membership_id => params['membership_id'],\n :t => Time.now\n }\n #\n redirect_to new_epicenter_subscription_path(@mother)\n end\n else\n # it's possible that we can put the logic from \"authenticate\" method below here\n redirect_to epicenters_path\n end\n end",
"def authorized\n redirect_to new_user_session_path unless logged_in?\n end",
"def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend",
"def confirm_logged_in\n \tunless session[:user_id]\n \t\tflash[:notice] = \"Please Log in.\"\n \t\tredirect_to(login_path)\n \tend\n end",
"def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end",
"def enforce_logged_in\n bounce unless current_user\n end",
"def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end",
"def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end",
"def require_no_authentication\n super\n return unless flash[:alert].present?\n\n flash[:alert] = nil\n flash[:notice] = _('You are already signed in as another user. Please log out to activate your invitation.')\n end",
"def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end",
"def filter_user_is_registered\n unless( user_is_registered)\n redirect_to_login\n end\n end",
"def confirm_user_logged_in\n unless logged_in?\n store_url # So that user is sent to the same URL after they log in\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end",
"def login_filter\n\t\tif not protect?( action_name )\n\t\t\treturn true \n\t\tend\n\n\t\tif not session[:user_id]\n\t\t\t# user isn't logged in\n\t\t\tstore_location\n\t\t\tredirect_to :controller=>\"account\", :action=>\"login\"\n\t\t\treturn false\n\t\tend\n\n\t\t# initialize the @user variable\n\t\t@user = User.find( session[:user_id] )\n\t\t\n\t\tif not @user.validated?\n\t\t\t# user is logged in, but they haven't been validated\n\t\t\tredirect_to :controller=>\"account\", :action=>\"not_activated\"\n\t\t\treturn false\n\t\telsif not authorized?( @user, action_name )\n\t\t\t# user is logged in and validated, but not authorized\n\t\t\tredirect_to :controller=>\"account\", :action =>\"denied\"\n\t\t\treturn false\n\t\telse\n\t\t\t# user is logged in AND validated AND authorized! let 'em in!\n\t\t\treturn true\t\n\t\tend\n\n\t\t# we shouldn't get here\n\t\traise \"Serious malfunction in 'login_filter' -- please contact manufacturer (cgahan@ideeinc.com)...\"\n\tend",
"def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end",
"def prevent_other_user_edits\n @user = User.find(params[:id])\n\n if !(logged_in?)\n redirect_to login_path\n flash[:danger] = \"You must be logged in to visit this page\"\n\n else\n if (current_user.id != @user.id)\n redirect_to home_path\n flash[:danger] = \"You must be logged in as the correct user to visit this page\"\n end\n end\n end",
"def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend",
"def authorize_user\n unless current_user\n flash[:notice] = \"Sorry, you need to be logged in to access that feature\"\n redirect_to new_session_path\n end\n end",
"def unconfirmed_user_only!\n unless current_user.email_confirmed?\n redirect_to root_path, alert: t('application.unconfirmed_user_only')\n end\n end",
"def valid_user\n unless ( @user && @user.activated? &&\n @user.authenticated?( :reset, params[ :id]))\n redirect_to root_url\n end\n end",
"def restrict_users\n \t\tif user_signed_in?\n \t\t\tif current_user.has_role? :client\n \t\t\t\tif current_user.profile.agreed == nil\n \t\t\t\t\tredirect_to edit_profile_path(current_user.profile)\n \t\t\t\tend\n \t\t\tend\n\n \t\tend\n\n \tend",
"def valid_user\n # unless (@user && @user.activated? && @user.authenticated?(:reset, params[:id])) \n unless(@user && @user.activated?)\n redirect_to root_url\n end\n end",
"def authorize_user\r\n unless session[:user_id]\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"user_not_authorized_wo_login\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end",
"def confirm_logged_in\n unless session[:user_id]\n redirect_to login_path, alert: \"Please log in\"\n end\n end",
"def valid_user\n unless (@user && @user.approved? &&\n @user.authenticated?(:reset, params[:id]))\n redirect_to root_url\n end\n end",
"def valid_user\n return if @user && @user.activated? && @user.authenticated?('reset', params[:id])\n redirect_to root_url\n end",
"def unauthorized_user!\n if @user != current_user\n redirect_to root_path, status: :unauthorized, alert: 'You can only perform this action on your own user!'\n end\n end",
"def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end",
"def authorize\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n end",
"def valid_user\n unless (@user && @user.activated? &&\n @user.authenticated?(:reset, params[:id]))\n redirect_to root_url\n end\n end",
"def configure_sign_in_params\n if !!current_end_user && current_end_user&.is_withdrawal != true #ユーザーが存在する場合(true)かつユーザーの退会フラグがfalseの時\n reset_session\n flash[:alert] = \"このアカウントは退会済みです。\"\n redirect_to request.referer\n end\n end",
"def handle_unverified_request\n sorcery_config.before_unverified_request.each do |callback|\n send(callback)\n end\n @current_user = nil\n super # call the default behaviour which resets the session\n end",
"def login_required\n not_authorized unless current_user\n end",
"def authorize_user\n @user = User.find(params[:id])\n\n #User.find_by(id: (session[:update_email]/50000)) works with the code on line 50 of the sessions controller\n #this is done to allow the user to update the email in the case that they do not receive a confirmation email\n unless @user == User.find_by(id: session[:user_id]) || User.find_by(role_id: session[:user_role_id]) || User.find_by(id: (session[:update_email]/50000))\n redirect_to login_url, notice: \"Permission Denied.\\nA different user login is required to access this page.\"\n end\n end",
"def require_user\n current_user\n if @current_user\n if @current_user.token_expired?\n #binding.pry\n @current_user = nil\n session.delete(:id)\n set_notification_messages(\"authentication.session_expired\", :error)\n redirect_or_popup_to_default_sign_in_page\n return\n end\n else\n set_notification_messages(\"authentication.permission_denied\", :error)\n redirect_or_popup_to_default_sign_in_page\n return\n end\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def authorize\n redirect_to \"/log_in\", :alert => t('.need_to_be_logged_in') unless signed_in?\n end",
"def verify_user\n redirect_to forbidden_path unless user_signed_in? && @review.user_id == current_user.id\n end",
"def run_filters\n set_user\n authorize\n end",
"def valid_user\n redirect_to root_url unless @user && @user.activated? && @user.authenticated?(:reset, params[:id])\n end",
"def user_logout_required\n if logged_in?\n flash[:notice] = 'Please log out of your user account first!'\n redirect_to current_user\n end\n end",
"def authorize_user!\n user = Circle.find(params[:id]).user\n if current_user != user\n flash[:notices] = \"Unathorized action\"\n redirect_to user_url(user.id)\n end\n end",
"def valid_user\n \tunless(@user && @user.activated? && @user.authenticated?(:reset, params[:id]))\n \t\tredirect_to root_url\n \tend\n end",
"def require_user\n #if not logged in \n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n #then redirect them away\n redirect_to login_path\n end\n end",
"def valid_user\n\t\t\tunless (@user && @user.activated? && \n\t\t\t\t\t\t\t@user.authenticated?(:reset, params[:id]))\n\t\t\t\tredirect_to root_url\n\t\t\tend\t\n\t\tend",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end",
"def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end",
"def authorize\n redirect_to('/login') unless @current_user\n end",
"def authorized\n redirect_to '/signin' unless current_driver\n end",
"def require_user\n current_user\n if @current_user\n if @current_user.token_expired?\n @current_user = nil\n session.delete(:id)\n set_notification_messages(I18n.t(\"authentication.session_expired_heading\"), I18n.t(\"authentication.session_expired_message\"), :error)\n redirect_to_sign_in_page\n return\n end\n else\n set_notification_messages(I18n.t(\"authentication.permission_denied_heading\"), I18n.t(\"authentication.permission_denied_message\"), :error)\n redirect_to_sign_in_page\n return\n end\n end",
"def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end",
"def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end",
"def authorize\n redirect_to login_path and return unless current_user\n @current_user.touch(:seen_at)\n end",
"def authorize\n if current_user.nil?\n redirect_to login_url, alert: \"Please Log in or Sign Up to comment!\"\n \tend\n end",
"def ensure_user_logged_in\n bounce_user unless current_user\n end",
"def authorize\n \t\t\tunless User.find_by(id: session[:user_id])\n \t\t\t\tredirect_to login_url, notice: \"Please Log-in\"\n \t\t\tend\n \t\tend",
"def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end",
"def before_request\n self.login if require_login? && !@authenticating\n end",
"def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end",
"def logged_in_user\n unless current_user\n flash[:danger] = \"Please log in.\"\n redirect_to log_in_path\n end\n end",
"def authorize_signed_in!\n redirect_to user_session_path, alert: \"You have to be signed in to do that!\" unless current_user\n end",
"def confirm_logged_in\r\n unless session[:username]\r\n redirect_to authenticate_index_path\r\n else\r\n true\r\n end\r\n end",
"def authorize\n if current_user.nil?\n redirect_to events_manager_index_path, :notice => \"Login to continue!\"\n return false\n else\n end \n end",
"def authorize \n unless logged_in?\n flash[:danger] = \"You must be logged in to view that... Please log in.\"\n redirect_to new_session_path unless logged_in?\n end\n end",
"def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform this action\"\n redirect_to :back\n end\n end",
"def authenticate_current_user_as_invited_user\n\t unless current_user == @invitation.invited_user\n\t redirect_to :back, alert: 'This invitation is not for you!'\n\t end\n\t end",
"def authorized\n redirect_to \"/login\" unless logged_in? \n end",
"def require_user\n if !is_logged_in\n flash[:danger] = 'You must be logged in to perform this action'\n redirect_to root_path\n end\n end",
"def authenticate_current_user\n unless current_user.admin == true\n unless current_user == User.find(params[:id]) \n flash[:danger] = \"Impossible d'aller sur cette page.\"\n redirect_to root_path\n end\n end\n end",
"def pre_authorize_cb; end",
"def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => :login and return false\n else\n redirect_to :controller => 'authentication', :action => :setup and return false\n end\n end",
"def pre_resend\n \t@user = User.find(params[:id])\n \tif @user.user_state == \"confirmed\"\n flash[:notice] = \"\" + @user.first_name + \", your account is already confirmed.\"\n redirect_to(:action => 'already_confirmed', :id => params[:id])\n else\n render :layout => 'clean'\n end\n end",
"def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"def authorize\n unless User.find_by_id(session[:user_id])\n redirect_to :log_in, :notice => \"Please log in\"\n end\n end",
"def correct_user\n return if current_user_is_admin? || current_user.id == @comment.user_id\n flash[:danger] = 'Not authorized.'\n redirect_to users_path\n end",
"def user_authenticated\n redirect_to root_url, alert: 'You must be logged in to go here' unless current_user\n end",
"def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end",
"def require_equal_user\n if @user.id != current_user.id\n render :file => \"#{Rails.public_path}/401.html\", :layout => true, :status => :unauthorized\n end\n end",
"def verify_user\n return if (@user = current_user)\n flash[:notice] = I18n.t('blacklight.saved_searches.need_login')\n raise Blacklight::Exceptions::AccessDenied\n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end",
"def authorize\n redirect_to new_session_path unless logged_in?\n end",
"def authorize_user\n unless current_user.id == @profile.user_id\n flash[:unauthorized] = \"Not authorized\"\n redirect_to listings_path\n end \n end",
"def prevent_user\n if session[:is_admin] != true and params[:user_id].to_i != @current_user.id\n redirect_to products_path\n end\n end",
"def authorize\n unless User.find_by_id( session[ :user_id ] )\n session[ :original_uri ] = request.request_uri\n flash[ :notice ] = \"Please log in\"\n redirect_to :controller => :login, :action => :login\n end\n end",
"def authenticate_correct_user\n redirect_unauthorized unless current_user? @run.user_id\n end",
"def correct_user\n if request.subdomain.present? && request.subdomain != \"www\"\n if user_signed_in?\n if params[:controller] == 'static_pages' && params[:action] == 'home'\n elsif params[:controller] == 'pages' && params[:action] == 'show'\n elsif params[:controller] == 'static_pages' && params[:action] == 'leasing'\n elsif params[:controller] == 'availabilities' && params[:action] == 'show'\n else\n @subdomain = request.subdomain\n @site = Site.where(subdomain: request.subdomain).first\n @user = User.where(id: @site.user_id).first\n if @user.id != current_user.id\n redirect_to (root_url(:subdomain => false) + \"dashboard\")\n # sign_out(@user)\n end\n end\n end\n end\n end",
"def authorize \n redirect_to login_url, notice: \"Please log in\" if session[:user_id].nil?\n end",
"def correct_user\n redirect_to(root_url) unless @user == current_user\n end",
"def require_login\n redirect_to login_path, notice: 'The requested action requires you to log in' unless session[:user_id]\n end",
"def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end",
"def authorize\n if current_user != @profile.username\n flash[:alert] = \"Cannot access this profile\"\n redirect_to root_path\n end\n end"
] |
[
"0.6569166",
"0.6430658",
"0.6423167",
"0.64137745",
"0.63995165",
"0.62902534",
"0.6249426",
"0.6248803",
"0.6218758",
"0.6173909",
"0.612472",
"0.61157626",
"0.60806084",
"0.6062998",
"0.6040006",
"0.60308075",
"0.6022445",
"0.60193825",
"0.6015744",
"0.6000973",
"0.5993021",
"0.5991861",
"0.5990247",
"0.59732157",
"0.59731853",
"0.5957767",
"0.5956104",
"0.5951737",
"0.5947172",
"0.592623",
"0.5921581",
"0.59179676",
"0.59034806",
"0.5887522",
"0.5884948",
"0.58768743",
"0.58765846",
"0.58758426",
"0.58735776",
"0.587279",
"0.58721757",
"0.5871094",
"0.58678186",
"0.58597577",
"0.585962",
"0.5846623",
"0.58431613",
"0.583902",
"0.58359814",
"0.5830664",
"0.58259964",
"0.58206636",
"0.5820238",
"0.58191544",
"0.5812869",
"0.58108264",
"0.58006203",
"0.57966095",
"0.5791977",
"0.5786464",
"0.57773817",
"0.57712746",
"0.5759577",
"0.5757955",
"0.5757765",
"0.5755161",
"0.5748342",
"0.5743378",
"0.57423174",
"0.57420623",
"0.57306045",
"0.5729118",
"0.57244396",
"0.57210755",
"0.57175434",
"0.5717196",
"0.57168984",
"0.5715941",
"0.57074636",
"0.5706773",
"0.57067716",
"0.57058156",
"0.5702965",
"0.5699887",
"0.56984425",
"0.5697734",
"0.5697734",
"0.5697636",
"0.56975067",
"0.56961983",
"0.5695846",
"0.5695014",
"0.56949896",
"0.56883526",
"0.5687561",
"0.56852823",
"0.56833124",
"0.5683292",
"0.56819636",
"0.56762284",
"0.56755614"
] |
0.0
|
-1
|
Confirms the correct user.
|
def correct_user
@user = User.find(params[:id])
redirect_to current_user unless current_user?(@user)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end",
"def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end",
"def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end",
"def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end",
"def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end",
"def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end",
"def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user_help?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end",
"def correct_user\n if !is_correct_user\n redirect_to incorrect_user_path_for\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Please don't mess with others' profiles!\"\n # redirect_to root_url\n redirect_to @user\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end",
"def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend",
"def correct_user\n unless @user == current_user\n redirect_to user_notes_path(current_user)\n end\n end",
"def correct_user\n redirect_to(root_url) unless @user == current_user\n end",
"def confirm_with_user\n confirmed = Helper::Util.confirm \"Is this OK? \", true\n return if confirmed\n\n loop do\n Helper::Util.clear\n\n print_identification\n\n say \"<%= color('The following options may be adjusted before continuing.', BOLD) %>\"\n choice = choose do |menu|\n self.class.available_options.reject(&:skip_confirmation).each do |option|\n value = send option.confirm_symbol\n menu.choice \"#{option.label}: #{option.display_value(value)}\"\n end\n\n menu.choice \"Accept and continue\"\n menu.choice \"Quit\"\n menu.readline = true\n menu.prompt = \"What would you like to do?\"\n end\n\n Helper::Util.clear\n\n print_identification\n\n if (option = self.class.available_options.find { |o| choice =~ /^#{Regexp.quote(o.label)}/ })\n loop do\n break if prompt_for_option(option)\n say \"Invalid value for option.\\n\\n\"\n end\n elsif choice =~ /^Accept/\n log\n return\n else\n exit(0)\n end\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end",
"def correct_user(user)\n user == current_user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend",
"def correct_user\n @user = HoacUser.find(params[:id])\n redirect_to(edit_hoac_user_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end",
"def correct_user\n user_id = params[:user_id] || params[:id] || session[:user_id]\n @user = User.find_by(id: user_id)\n unless @user.nil?\n unless current_user?(@user) || current_user.administrator?\n flash[:danger] = \"Only the account owner or an adminstrator to do that.\"\n redirect_to(root_path)\n end\n else\n nonexistent_user_error\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user)\n flash[:danger] = \"You don't have permission for that action.\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n logger.debug \"***correct_user - Detected User - #{@user.name}\"\n redirect_to(root_url) unless current_user?(@user) || admin_user\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end",
"def correct_user\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_url, notice: \"You do not have permission to view or edit this information because it isn't yours.\" unless current_user?(@user)\n end",
"def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end"
] |
[
"0.7474259",
"0.73411936",
"0.7317917",
"0.7183303",
"0.7174887",
"0.7049758",
"0.70130193",
"0.7012358",
"0.7006517",
"0.7006201",
"0.7003461",
"0.69663024",
"0.69136065",
"0.6911695",
"0.690295",
"0.6892608",
"0.68439376",
"0.6842948",
"0.68397075",
"0.683463",
"0.6826711",
"0.6825813",
"0.6811448",
"0.680094",
"0.67988366",
"0.6793706",
"0.67789406",
"0.67666626",
"0.67421",
"0.6740984",
"0.6740906",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6732851",
"0.67279315",
"0.6725006",
"0.6723821",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.6720861",
"0.6715527",
"0.6711952",
"0.6684064",
"0.66769403",
"0.66658443",
"0.6663128",
"0.6663128",
"0.6663128",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.6658565",
"0.66540176",
"0.6653203",
"0.66520107",
"0.664873",
"0.66435707"
] |
0.0
|
-1
|
Allert for non authorized action
|
def user_not_authorized
flash[:alert] = "You are not authorized to perform this action."
redirect_to(request.referrer || root_path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unauthorized\n end",
"def skip_authorization; end",
"def authorization; end",
"def user_action_on_resource_authorized\n end",
"def skip_authorization\n @_authorization_performed = true\n end",
"def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end",
"def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end",
"def authorize\n end",
"def authorize\n end",
"def authorize_unauthenticated_user\n target_action = params[:controller] + '#' + params[:action]\n unless User::DEFAULT_PERMISSIONS.include?(target_action)\n head :unauthorized and return\n end\n end",
"def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end",
"def authorize_for_none\n # Clear all authorizations and create an allow-all entry\n ContentAuthorization.transaction do\n update_privacy_level(ContentAuthorization::AuthInvisible)\n clear_accessors\n end\n end",
"def show\n skip_authorization\n end",
"def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end",
"def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end",
"def unauthorized\n head :unauthorized\n end",
"def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end",
"def not_authorized\n redirect_to volunteer_positions_url, alert: \"You are not authorized to perform the requested action!\"\n end",
"def unauthorized\n\n render_error( :unauthorized )\n\n end",
"def access_denied\n\n end",
"def denied\n end",
"def access_denied\n end",
"def unauthenticated\n end",
"def unauthorized_request user:current_user,filter:nil\n\t\t\tputs \"\\n\\nNo filter matches the given http method, controller, or controller method, rerouting...\" if filter.blank?\n\t\t\tputs \"\\n\\nUser #{user.email} is not authorized to #{filter.http_method.upcase}::>#{filter.controller || 'all'}.#{filter.action_name || 'all'}, rerouting...\\n\\n\" unless filter.blank?\n\t\t\trender json: \"Unauthorized Request\"\n\t\tend",
"def unauthorized\n render :text => \"You are not authorized to perform this action\", :status => 401\n end",
"def restrict_access\n head :unauthorized and return false unless current_user\n end",
"def unauthorised\n flash[:notice] = 'Unauthorised operation. Please try another option '\n redirect_to robots_path\n end",
"def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end",
"def not_authorised\n flash[:notice] = 'You are not authorized to perform this action!'\n redirect_back(fallback_location: root_path)\n end",
"def user_not_authorized\n flash[:alert] = \"Vous n'êtes pas autorisé à exécuter cette action.\"\n redirect_to(root_path)\n end",
"def index\n head :unauthorized\n end",
"def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end",
"def authorize_for_all_guests\n # Clear all authorizations and create an allow-all entry\n #ContentAuthorization.transaction do\n update_privacy_level(ContentAuthorization::AuthPrivate)\n clear_accessors\n #end\n end",
"def filter_object\n # redirect_to(root_url, :notice => \"Do not have permission\") and return\n end",
"def access_control\n \n end",
"def rescue_unauthorized\n render nothing: true, status: 403\n end",
"def rescue_unauthorized\n render nothing: true, status: 403\n end",
"def authorized?(user, action)\n\t\ttrue\n\tend",
"def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def require_authorization!\n unless current_user == @event.user\n render json: {}, status: :forbidden\n end\n end",
"def needs_authenticate_user?\n except_actions = %w[index show print]\n !except_actions.include?(action_name)\n end",
"def user_not_authorized\n redirect_to((request.referrer || root_path) ,notice: \"Authorization error.\")\n end",
"def authorizations\n @@authorized_actions ||= {}\n @@authorized_actions\n end",
"def controller_actions_should_fail_if_not_logged_in(cont, opts={})\n except= opts[:except] || []\n actions_to_test= get_all_actions(cont).reject{ |a| except.include?(a) }\n actions_to_test += opts[:include] if opts[:include]\n actions_to_test.each do |a|\n get a\n response.should_not be_success\n response.should redirect_to('http://test.host/')\n end\n end",
"def authorized?\n true\n end",
"def authorize!(user)\n redirect '/not_authorized' unless authorized?(user)\nend",
"def authorize_user\n unless @api_user.permit? params[:controller], params[:action]\n head :unauthorized and return\n end\n end",
"def authorize(verb); send_or_default(\"authorize_#{verb}\",true) ; end",
"def unauthorized\n render :json => \"You are not authorized for access.\", :status => :unauthorized\n end",
"def run_filters\n set_user\n authorize\n end",
"def skip_actions; end",
"def implicit_authorization_target\n # no-op\n end",
"def unauthorized_request(e)\n render json: jsonData(e), status: :unauthorized\n end",
"def unauthorized?(action, subject)\n !authorized? action, subject\n end",
"def unauthorized_request(e)\n render json: { message: e.message }, status: :unauthorized\n end",
"def unauthorized_request(e)\n render json: { message: e.message }, status: :unauthorized\n end",
"def authorization(*args, &block); end",
"def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def call &block\n return true if before(@action)\n return true if send(@action)\n raise Lux::Error.unauthorized('Access disabled in policy')\n rescue Lux::Error\n error = $!.message\n error += \" - #{self.class}.#{@action}\" if Lux.config(:dump_errors)\n raise Lux::Error.unauthorized(error) unless block\n block.call(error)\n false\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end",
"def needs_authenticate_user?\n except_actions = %w[index show]\n !except_actions.include?(action_name)\n end",
"def authorized?\n render nothing: true, status: :forbidden if !current_account\n end",
"def require_authorization( message=\"You are not authorized to access this resource.\" )\n\t\tfinish_with( HTTP::FORBIDDEN, message )\n\tend",
"def unauthorized_request(e)\n\t\tjson_response({ message: e.message }, :unauthorized)\n\tend",
"def show\n authorize @account\n # if authorize @account != true\n\n # end\n end",
"def user_not_authorized\n flash[:warning] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end",
"def authorized?(action, subject = nil)\n false\n end",
"def unauthorized_user!\n if @user != current_user\n redirect_to root_path, status: :unauthorized, alert: 'You can only perform this action on your own user!'\n end\n end",
"def authenticate_request\n render :json => { :error => :unauthorized }, :status => :unauthorized unless current_user\n end",
"def deny_access_action( txn, *args )\n\t\t\tself.log.error \"Unauthorized request for %s\" % [ txn.uri ]\n\t\t\ttxn.status = Apache::FORBIDDEN\n\t\t\treturn \"access denied\"\n\t\tend",
"def unauthenticated\n render_json status: :unauthorized\n end",
"def authorize\n \t\t#teste http://localhost:3000/products/2/who_bought.atom\n \t\t#ou curl --silent --user dave:secret http://localhost:3000/products/2/who_bought.atom \n \t\treturn if User.count.zero?\n\n \t\tif request.format == Mime[:html]\n \t\t\tuser = User.find_by(id: session[:user_id])\n \t\telse\n \t\t\tuser = authenticate_or_request_with_http_basic do |u,p|\n \t\t\t\tUser.find_by_name(u).try(:authenticate, p)\n \t\t\tend\n \t\tend\n\n \t\tredirect_to login_url, notice: \"Please log in\" unless user\n \t\t\n \tend",
"def failsafe_action\n super\n end",
"def authorize\n @job = Job.find(params[:id])\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && @job.user_id == current_user.id || (current_user && current_user.role == 'admin')\n end",
"def user_not_authorized\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to root_path\n end",
"def authorization_mode; end",
"def not_authorized\n redirect_to home_path\n flash[:error] = \"You are not authorized to do that.\"\n end",
"def user_not_authorized\n flash[:alert] = t('messages.non_authorized_action')\n redirect_to(request.referrer || root_path)\n end",
"def user_not_authorized\n respond_to do |format|\n format.json do\n render json: ErrorReport.generate( { id: [t(\"errors.messages.not_authorized\")] }, 403 ), status: :forbidden\n end\n end\n end",
"def unauthorized_entity(entity_name)\r\n render json: [\"You are unauthorized to access this.\"], status: :unauthorized\r\n end",
"def user_not_authorized\n flash[:alert] = \"You are not authorized to perform that action.\"\n redirect_to(request.referrer || root_path)\n end",
"def authorize!\n if current_user && current_user.clearance_level > 1\n return true\n else\n respond_to do |format|\n format.html do\n redirect_to main_app.new_session_path\n end\n format.json do\n render status: 403, nothing: true\n end\n end\n end\n end",
"def authorized\n render json: { message: 'Você não está logado, pfv logar' }, status: :unauthorized unless logged_in?\n end",
"def render_unauthorized(obj)\n render json: nil_protection(obj), status: :unauthorized\n end",
"def user_not_authorized\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to(root_path)\n end",
"def authorize_for_all\n # Clear all authorizations and create an allow-all entry\n ContentAuthorization.transaction do\n update_privacy_level(ContentAuthorization::AuthPublic)\n clear_accessors\n end\n end",
"def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end",
"def index\n prevent_non_admin\n end",
"def unauthorized_entity(entity_name)\n render json: {error: 'Unauthorized request'}, status:\n :unauthorized\n end",
"def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def user_not_authorized(exception)\n case exception.query\n when 'approve?',\n 'can_add_attachment?',\n /^add_response_to_flagged_case/,\n 'upload_responses?',\n 'update_closure?'\n super(exception, case_path(@case))\n else\n super\n end\n end",
"def authorized?(action, subject = nil)\n true\n end",
"def authorization_denied\n head :unauthorized\n end",
"def authorize_user!\n # binding.pry\n unless can?(:crud, @question)\n flash[:alert] = \"Access Denied!\"\n redirect_to root_path\n\n # `head` is a method similar to `render` or `redirect_to`. It finalizes\n # the response. However, it will add content to the response. It will simply\n # set the HTTP status of the response. (e.g. head :unauthorized sets the\n # the status code to 401)\n # For a list of available status code symbols to use with `head` go to:\n # http://billpatrianakos.me/blog/2013/10/13/list-of-rails-status-code-symbols/\n # head :unauthorized\n end\n end",
"def unauthorized_request(e)\n json_response({ message: e.message }, :unauthorized)\n end",
"def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n redirect_to(action: \"index_article\") and return\n end",
"def authorized\n render json: {message: 'Please log in'}, status: :unauthorized unless logged_in?\n end"
] |
[
"0.73594624",
"0.7103822",
"0.6858122",
"0.6769781",
"0.67648417",
"0.6720445",
"0.6720445",
"0.6697826",
"0.6697826",
"0.6694636",
"0.66926926",
"0.6598255",
"0.6543917",
"0.6531534",
"0.6529454",
"0.65237707",
"0.65109235",
"0.6500639",
"0.6494309",
"0.6482946",
"0.6455142",
"0.645481",
"0.64379287",
"0.6424573",
"0.64161164",
"0.64124805",
"0.64004254",
"0.63743645",
"0.6340578",
"0.63311344",
"0.6323101",
"0.63170695",
"0.631428",
"0.62908113",
"0.62892944",
"0.6284203",
"0.6284203",
"0.6275594",
"0.6262535",
"0.6261591",
"0.6258797",
"0.62571657",
"0.6251679",
"0.6236985",
"0.6229648",
"0.6222683",
"0.6216944",
"0.6215524",
"0.62062323",
"0.6205792",
"0.6190313",
"0.61679816",
"0.6157157",
"0.6149089",
"0.61480343",
"0.61480343",
"0.6145543",
"0.61362845",
"0.61306745",
"0.61165553",
"0.6116217",
"0.6115244",
"0.6105464",
"0.61048794",
"0.6102498",
"0.610181",
"0.60994023",
"0.60994023",
"0.60994023",
"0.60990614",
"0.6097175",
"0.6096187",
"0.60948044",
"0.6094357",
"0.6087159",
"0.6084561",
"0.6083204",
"0.60802066",
"0.6079879",
"0.6077359",
"0.6070061",
"0.6068132",
"0.6060454",
"0.60602313",
"0.60586715",
"0.60459584",
"0.6042175",
"0.6041765",
"0.6040858",
"0.60401464",
"0.6039994",
"0.6035899",
"0.60328275",
"0.60260403",
"0.60219043",
"0.60077935",
"0.6007612",
"0.6004749",
"0.6002202",
"0.5997011"
] |
0.6265342
|
38
|
Method moves a card from game cards to specified hand
|
def deal_card(hand)
#hand is a string whose valid values are 'player_cards' and 'dealer_cards'
if !['player_cards','dealer_cards'].include?(hand)
raise "Unknown hand #{hand}"
end
#Check for an empty deck and reshuffle if necessary
if (session['game_cards'].length == 0)
session['game_cards'] = session['discard']
session['game_cards'].shuffle!
session['discard'] = []
append_message("Dealer shuffled the cards.")
end
#Move the card
session[hand] << session['game_cards'].pop
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def turn_card(guess)\n @board[guess].reveal\n @player.store_cards(guess, @board[guess].value)\n p @player.store\n end",
"def deal(card)\n\t\t@hand.push(card)\n\tend",
"def take_turn( player, hand )\n turn = nil\n case turn = player.take_turn(hand, @dealer.up_card)\n when :hit:\n hand.hit(@deck.take_card)\n\n when :double_down:\n if hand.double_down_allowed?\n hand.double_down(@deck.take_card)\n else\n raise 'Cannot double down!'\n end\n\n when :split:\n if hand.split_allowed?\n hands = hand.split\n\n 2.times do |i|\n hands[i] << @deck.take_card\n player.hands << hands[i]\n end\n else\n raise 'Cannot split!'\n end\n\n when :stand:\n hand.stand # Ha... Kinda funny how that worked out.\n end\n\n turn\n end",
"def move_card(card, destination)\n card.location = destination\n card.save\n end",
"def add_to_hand(card)\n # add the new card to each \"hand\"\n @values = @values.map { |val| val + card.rank }\n\n # change accordngly if there is an ace\n update_for_ace if card.rank.eql?(1)\n\n @cards.push(card)\n end",
"def addCardToHand(card)\n @hand << card\n end",
"def hit_hand(player, hand)\n card = nil\n if @play_god\n card = @io.set_card(@shoe, player, nil)\n else\n card = @shoe.deal_card\n end\n hand.hit(card)\n end",
"def deal\n\t\tcase @phase\n\t\t\twhen 0 then new_hand\n\t\t\twhen 1 then flop\n\t\t\twhen 2 then turn_or_river\n\t\t\twhen 3 then turn_or_river\n\t\tend\n\t\t@current_position = @button\n\t\t@round_history = []\n\t\t@players_at_start_of_hand = @hands.size - @max_can_win.size\n\t\t@minimum_bet = big_blind\n\t\tif @phase == 0\n\t\t\tmove_position(3, true)\n\t\telse\n\t\t\tmove_position(1)\n\t\tend\n\t\t@phase += 1\n\t\t@moves_taken = 0\n\tend",
"def hit(hand)\n hand.push(random_card)\n end",
"def give_card_to_player(card,player)\n\t\t#player is another player object\n\t\t@cards[card].times do\n\t\t\tplayer.add_card(card)\n\t\tend\n\n\n\t\t#remove cards from hand if selected by another player\n\t\tself.remove_set_from_hand(card)\n\tend",
"def move(from, card, to)\n from_pile = parse_pile(from)\n to_pile = parse_pile(to)\n result = from_pile.move(card, to_pile)\n puts ascii\n result\n end",
"def deal_card(game_deck,player)\n card = game_deck.deck.pop\n ace_checker(card,player)\n player.hand.push(card)\n puts\"#{player.player_name} received #{card.identify}\"\n puts \"Current hand: #{player.display_hand}\"\n win_or_bust(player)\n hit_or_stay(player)\nend",
"def lay_card\n @hand.shift\n end",
"def add_card_to_hand(curr_hand)\n curr_hand.push(get_rand_card)\n end",
"def move_card( card, places )\n \n n = places\n card_locus = @deck.index( card )\n while (n != 0) do\n \n if (card_locus + 1 < @deck.length )\n @deck[card_locus], @deck[card_locus +1] = @deck[card_locus+1], @deck[card_locus]\n card_locus = card_locus+1\n else\n card = @deck.slice!(card_locus)\n @deck.insert(1, card)\n card_locus = 1\n \n end\n # subtract 1 from n\n n -= 1\n \n end\n \n end",
"def deal_card(hand)\n\t# pick a random card and add to the hand\n\tindex = rand($card_deck.length)\n\thand << $card_deck[index]\n\n\t# remove the card from the deck\n\t$card_deck.delete_at(index)\nend",
"def set_hand(hand)\n\t\t\t@hand = hand\n\t\tend",
"def set_hand(hand)\n\t\t\t@hand = hand\n\t\tend",
"def turnPlayerHand(hand)\r\n\t\tputs \"Player's hand: \"\r\n\t\t\r\n\t\thand.each do |x|\r\n\t\t\tx.to_s\r\n\t\tend\r\n\t\t\r\n\t\tputs \"\\n\"\r\n\tend",
"def turnPlayerHand(hand)\n\t\tputs \"Player's hand: \"\n\n\t\thand.each do |x|\n\t\t\tx.to_s\n\t\tend\n\n\t\tputs \"\\n\"\n\tend",
"def hit(hand, deck)\n hand.push(deck.pop)\nend",
"def move(area)\n options = []\n area.each { |f| options.push(f) }\n puts \"Which card? [1,2,3,4,5]\"\n options.each { |o| puts o[:name]}\n response = gets.to_i\n response -= 1\n $hand.push(area[response])\n area.delete[response]\nend",
"def play_hand( player, hand )\n @events.handle(:player_play_hand, player, hand) do\n\n while hand.active?\n @events.handle(:player_play_hand_turn, player, hand) do\n if :split == take_turn(player, hand)\n # Automatically return if Player decided to split their hand\n return\n end\n end\n end\n\n end\n end",
"def drawCard\n\t\t@hand = @hand.push(@deck.pop)\n\tend",
"def deal_cards(cards)\n @players.each do |player|\n player.hand += @deck.cards.pop(cards)\n end\n end",
"def deal\n hit = bjdeck.draw\n self.player_hand << hit\n hit = bjdeck.draw\n self.computer_hand << hit\n end",
"def addCardsToHand(cards)\n @hand.concat(cards)\n end",
"def set_hand hand\n @my_hand = hand\n end",
"def dealSelf(deck)\n \t@hands[0].addCard(deck.removeCard)\n end",
"def play(deck)\r\n\t\taction = get_user_action if hand.hand_value < 21\r\n\t\twhile (hand.hand_value) < 21 && (action == \"H\") do\r\n\t\t\tdraw_card(deck.deal_card)\r\n\t\t\tshow_hand\r\n\t\t\taction = get_user_action if hand.hand_value < 21\r\n\t\tend\r\n\tend",
"def card_from_user(hand, cards_played)\n next_card_prompt(hand)\n\n puts \"What card would you like to play?\"\n card = get_card_following_suit(hand, cards_played)\n\n puts \"You picked #{card}\"\n hand.delete(card)\n\n card\n end",
"def deal\r\n @cards.shift\r\n end",
"def process_hand(hand, direction)\n id = hand.id\n unless @hand_list[id]\n hand_obj = Hand.new(hand, direction)\n @hand_list[id] = hand_obj\n else\n @hand_list[id].process_hand(hand)\n end\n end",
"def play_dealer(hand, shoe, odds, upcard_result)\n case decide(hand)\n when :stand\n upcard_result[result(hand)] += odds\n when :hit\n CARDS.each do |card|\n next unless shoe.any?(card)\n card_odds = shoe.odds_of(card)\n\n hand.push(card)\n shoe.consume(card)\n\n play_dealer(hand, shoe, odds * card_odds , upcard_result)\n\n shoe.replace(card)\n hand.pop\n end\n else\n raise \"error, illegal hand action\"\n end\nend",
"def show_hand\n if @hand.point == \"Blackjack\" # the dealer should reveal both cards when it has blackjack\n @hand.turn_all_cards_up\n puts \" #{@hand.to_s} Blackjack\\n\" \n else\n puts \" #{@hand.to_s}\\n\"\n end\n end",
"def setCard( newCard )\n @cardsInHand.push(newCard)\n \n # since the computer player doesn't make bad guess, \n # we delete the card just received from the lists of potential right cards.\n i = 0\n while( i < @listOfAllSuspects.length )\n if( @listOfAllSuspects[i].value == newCard.value && @listOfAllSuspects[i].type == newCard.type )\n @listOfAllSuspects.delete_at(i)\n else\n i = i + 1\n end\n end\n \n i = 0\n while( i < @listOfAllLocations.length )\n if( @listOfAllLocations[i].type == newCard.type && @listOfAllLocations[i].value == newCard.value )\n @listOfAllLocations.delete_at(i)\n else\n i = i + 1\n end\n end\n \n i = 0\n while( i < @listOfAllWeapons.length )\n if( @listOfAllWeapons[i].type == newCard.type && @listOfAllWeapons[i].value == newCard.value )\n @listOfAllWeapons.delete_at(i)\n else\n i = i + 1\n end\n end\n end",
"def get_card_and_put_in_hand(which_hand)\n the_card = @deck_current.delete_at(rand(@deck_current.length))\n\n if which_hand === \"dealer\"\n @hand_dealer.push(the_card)\n\n elsif which_hand === \"player\"\n @hand_player.push(the_card)\n\n end\n \nend",
"def play(hand,playTo)\n\t\n\tplayedCards = Array.new\n\t\n\t#push the correct number of cards to the cards played\n\tfor i in 0...playTo\n\t\tplayedCards.push(hand[i])\n\tend\n\n\t#remove played cards from hand\n\thand.shift(playTo)\n\n\t#returns hand for player and played cards for the game\n\treturn {\"handBack\" => hand, \"playedCards\" => playedCards}\n\nend",
"def get_card(card)\n @hand.append(card)\n end",
"def expected_hand(player, turn)\n my_player = @playerstates.detect{|playerstate| playerstate.name == player.player_name}\n expected_hand = my_player.hand.hand_to_list\n cardsfrom = turn.turn_end\n if cardsfrom.from_deck?\n new_cards = [turn.deck.take]\n elsif cardsfrom.from_stack?\n new_cards = turn.stack.take(cardsfrom.how_many_cards?)\n end\n expected_hand = expected_hand + new_cards\n end",
"def take_card\n @deck.shift\n end",
"def deal_hand\n 3.times do \n @players.each do |player|\n player.hand.draw_card\n end\n end\n end",
"def card(index)\n \tif index < 0 || index >= @cards.size\n \t raise Exception \"Position does not exist in hand: #{index}\"\n \tend\n \t@cards[index]\n end",
"def deal\r\n @deck_of_cards.shift\r\n end",
"def setCard(newCard)\n\t\t#add the card to this players hand\n\t\t@hand[newCard.value] = newCard\n\n\t\t#delete the card from the not seen list\n\t\tif newCard.type == :person\n\t\t\t@suspectsNotSeen.delete(newCard)\n\t\telsif newCard.type == :place\n\t\t\t@locationsNotSeen.delete(newCard)\n\t\telse \n\t\t\t@weaponsNotSeen.delete(newCard)\n\t\tend\n\tend",
"def movedeck_to(direction)\r\n @log.debug \"gfx: Move deck to #{direction}\"\r\n model_canvas_gfx = @gfx_res.model_canvas_gfx\r\n \r\n img_coperto = @gfx_res.get_cardsymbolimage_of(:coperto)\r\n #img_opponent_deck = @image_gfx_resource[:card_opp_img]\r\n \r\n x_deck_start = model_canvas_gfx.info[:canvas][:width] - (img_coperto.width + 30)\r\n y_deck_start = 10\r\n if direction == :sud\r\n y_deck_start = (model_canvas_gfx.info[:canvas][:height] - (img_coperto.height)) \r\n end\r\n \r\n model_canvas_gfx.info[:deck_info][:position] = {:x_deck_start => x_deck_start, :y_deck_start => y_deck_start }\r\n \r\n \r\n end",
"def stand()\n @current_hand += 1\n end",
"def starting_hands\n @dealer_hand.push(random_card)\n @player_hand.push(random_card, random_card)\n end",
"def action_useCard(pockerCard_id)\n\n if check_cardOwn(pockerCard_id) and check_currentTurn()#only owner can play card and current turn on\n if check_usableNumShape(pockerCard_id) #check bottom number and shape\n\n sourcePlayer_id = Game.last.players.by_user(current_user).id\n destPlayer_id = Game.last.players.dummy.id # destPlayer_id = 2 (dummy) \n\n action_moveCard(dest_id: destPlayer_id, source_id: sourcePlayer_id, card_id: pockerCard_id)\n\n #check effect of cards\n card_effect = Pockercard.find(pockerCard_id).effect\n action_addDummyList(pockerCard_id)\n action_putBottomCard(pockerCard_id)\n if card_effect == \"none\"\n action_endTurn(1) #move to next player=[\n elsif card_effect == \"back\" \n Game.last.toggle_order!\n action_endTurn(1) #skip next player\n elsif card_effect == \"jump\" \n action_endTurn(2) #move to next next player\n elsif card_effect == \"attack\"\n action_attackCard(pockerCard_id)\n action_endTurn(1) #move to next next player\n elsif card_effect == \"change\"\n action_setBottomCardStep()\n elsif card_effect == \"onemore\" \n else\n action_endTurn(1) #skip next player\n end\n check_winOrLose() \n end\n end\n\n\n\n end",
"def set_hand\n @hand = Hand.find(params[:id])\n end",
"def play(deck)\r\n\t\twhile hand.hand_value < 17 do\r\n\t\t\tdraw_card(deck.deal_card)\r\n\t\tend\r\n\tend",
"def dealHand \n h = Hand.new\n 5.times do \n h.addCard(self.draw)\n end\n return h\n end",
"def set_hand\r\n @hand = Hand.find(params[:id])\r\n end",
"def opening_hand(players_cards, computers_cards, deck)\n players_cards.push (the_draw(deck))\n computers_cards.push (the_draw(deck))\n players_cards.push (the_draw(deck))\n computers_cards.push (the_draw(deck))\n end",
"def hit(deck)\n @hand << deck.draw!\n end",
"def set_hands(hand_size = 2)\n puts \"Dealing cards\"\n @player.new_hand\n @dealer.new_hand\n\n @dealer.update_deck if @deck.cards_left < ((hand_size * 2) + 1) # Rebuilds deck if empty\n hand_size.times do\n @player.hand.hit\n @dealer.hand.hit\n end\n end",
"def deal_card(player)\n if !self.is_empty?\n player.hand << cards.pop\n else\n self.initialize(1)\n end\n end",
"def choose_card \n\n @cards.shift\n end",
"def player_deal_card\n player.add_card(deck.deal_card)\n player.add_card(deck.deal_card)\n player.show_hand\n end",
"def update_hands\n\t\tplayers.each do |player|\n\t\t\tnext if player.folded?\n\t\t\tdiscard_idx = player.get_discard\n\t\t\tplayer.update_hand(discard_idx, @deck)\n\t\tend\n\tend",
"def deal\n @deckOfCards.shift\n end",
"def move_card(draw, play)\n if play.empty? && draw.any?\n play << draw.shift\n elsif draw.any? && (within_one?(draw[0].rank.to_i, play[-1].rank.to_i))\n play << draw.shift\n else\n end\nend",
"def play_card(pile, card)\n fail 'cannot play card outside your hand' unless cards.include?(card)\n\n if card.value == :eight\n pile.play_eight(card, favorite_suit)\n else\n pile.play(card)\n end\n\n cards.delete(card)\n end",
"def auto_turn\n #TODO:\n #returns card, true or false for play or discard\n #choose a random card\n #discard a random card if no cards can be played\n #come up with a prioritized hand based on winning potential (play the best, discard the worst)\n end",
"def opponent_turn\n #set variables\n game = Game.find(self.game_id)\n player = Player.find(game.players.last)\n draw_card = Card.where(player_id: -2).first\n opponent_cards = Card.where(player_id: self.id)\n possible_plays = []\n colors = [\"blue\", \"green\", \"red\", \"yellow\"]\n\n #determine eligible cards in hand.\n opponent_cards.each do |card|\n if card.color == draw_card.color || card.number == draw_card.number || (card.card_action != nil && card.card_action == draw_card.card_action)\n possible_plays.push(card)\n end\n end\n #starts decision logic for card to play, otherwise draws a card and looks for possible plays\n if possible_plays.any?\n #discard current draw pile card\n draw_card.player_id = -1\n draw_card.save\n\n #determines card to be played, sets card to be the new draw pile card\n selected_card = possible_plays.sample\n selected_card.player_id = -2\n selected_card.save\n\n #determines if card has special action, and executes action if it does.\n if selected_card.card_action != nil\n\n if selected_card.card_action === \"skip\" || selected_card.card_action === \"reverse\"\n self.opponent_turn\n elsif selected_card.card_action === \"draw\"\n draw_two = Card.where(player_id: 0).sample(2)\n draw_two.each do |card|\n card.player_id = game.players.first.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"draw_four\"\n draw_four = Card.where(player_id: 0).sample(4)\n draw_four.each do |card|\n card.player_id = player.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"wild_color\"\n selected_card.color = colors.sample\n selected_card.save\n end\n\n else\n #switches current turn once card has been selected and played\n if game.current_turn = self.id\n game.current_turn = player.id\n game.save\n else\n game.current_turn = self.id\n game.save\n end\n\n end\n\n else\n #draws a card from the draw pile and repeats opponent_turn process.\n drawn_card = Card.where(player_id: 0).sample\n drawn_card.player_id = self.id\n drawn_card.save\n self.opponent_turn\n end\n end",
"def hit(card)\n hand = @hands[@current_hand]\n hand.cards.push(card)\n puts \"New card received - #{card}\"\n if hand.is_bust()\n print_player_hands()\n puts \"Player #{@position} busts!\"\n @current_hand += 1\n end\n end",
"def discard\n\n # organize hand into sorted array of cards\n #### METHOD\n\n puts \"here is your hand #{hand}\"\n\n puts 'what cards? you can only discard 3.'\n\n #the player returns [2,3]\n ##### METHOD\n\n # find hand[2], hand[3] and remove from hand\n ##### METHOD\n\n # hand currently has 3 cards\n\n # hand << deck.deal(2)\n\n #RETURNS new hand\n\n\n #....player1.hand = the new hand\n end",
"def place(card)\n end",
"def play_game\n\n Console_Screen.cls #Clear the display area\n \n #Assist the player and dealer an initial starting card\n playerHand = get_new_card\n dealerHand = get_new_card\n \n #Call the method responsible for dealing new cards to the player\n playerHand = complete_player_hand(playerHand, dealerHand)\n \n #If the player has not gone bust, call the method responsible for managing\n #dealer's hand\n if playerHand <= 21 then\n dealerHand = play_dealer_hand(dealerHand)\n end\n\n #call the method responsible for determining the results of the game\n determine_winner(playerHand, dealerHand)\n\n end",
"def dealer_play_hand\n while @dealer.hand.active?\n take_turn(@dealer, @dealer.hand)\n end\n end",
"def push(card)\n @pile.push(card)\n card.arm!\n end",
"def deal\n @hand << @dealingmachine.deal_one_card << @dealingmachine.deal_one_card\n end",
"def draw_card(card)\r\n\t\thand.add_card(card)\r\n\tend",
"def move_card(card_id, options)\n unless options.is_a?(Hash) && ([:board_id, :list_id, :pos].any? { |key| options.key? key })\n raise ArgumentError, \"Required option: :pos, :board_id and/or :list_id\"\n end\n update_card(card_id, options)\n end",
"def play(card)\n fail 'invalid play' if !valid_play?(card)\n fail 'must declare suit when playing eight' if card.value == :eight\n\n @top_card = card\n @current_suit = card.suit\n end",
"def take_turn(player)\n p player.render_hand\n #render their hand\n p \"Which cards do you want to discard? (first, second..etc) i.e. '1,2' If none, reply 'none'\"\n discarded_cards = gets.chomp\n indices = parse(discarded_cards)\n discard(indices, player)\n #promt for how many new cards? => quantity\n #rerender the hand\n #promt for fold?\n #prompt them for a bet.. show their current bet\n end",
"def hand_of_poker\n players_in_hand = @players.dup\n @players.each {|player| deal(player, 5)}\n remaining_players = betting_round(players_in_hand)\n unless remaining_players.count == 1\n exchange_cards\n remaining_players = betting_round(remaining_players)\n unless remaining_players.count == 1\n remaining_players = compare_hands(remaining_players)\n end\n end\n winner = remaining_players.first\n puts \"#{winner.name} wins!\"\n print \"\\n\\n\\n\"\n pay_out(winner)\n reset_deck\n end",
"def deal_hand(players)\n players.each do |player|\n player.clear_hand\n end\n\n 2.times do \n players.each do |player|\n deal_card(player)\n end\n end\n end",
"def give_cards_to_winner(winner, loser)\n lost_cards = loser.give_hand\n winner.receive_cards(lost_cards)\n end",
"def add_card(card)\n @addhand = @addhand + card\n end",
"def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Assign the player and dealer an initial starting card\r\n playerHand = get_new_card\r\n dealerHand = get_new_card\r\n\r\n #Call the method responsible for dealing new cards to the player\r\n playerHand = complete_player_hand(playerHand, dealerHand)\r\n\r\n #If the player has not gone bust, call the method responsible for managing\r\n #dealer's hand\r\n if playerHand <= 21 then\r\n dealerHand = play_dealer_hand(dealerHand)\r\n end\r\n\r\n #call the method responsible for determining the results of the game\r\n determine_winner(playerHand, dealerHand)\r\n\r\n end",
"def receive_card(a_card)\n @cards_in_hand << a_card\n end",
"def move_joker_a\n\t\t# find the index of the 'a' joker\n\t\tindex_a = @deck_of_cards.index(Card.new(:joker, 1))\n\t\t# if the 'a' joker is the last card in the deck, move it below the first card\n\t\tif index_a == 53\n\t\t\tjoker_a = @deck_of_cards.delete_at(index_a)\n\t\t\t@deck_of_cards.insert(1, joker_a)\n\n\t\t\t# new position of the 'a' joker\n\t\t\tnew_a = 1\n\t\telse # swap the 'a' joker with the card right below it\n\t\t\t@deck_of_cards[index_a], @deck_of_cards[index_a + 1] = @deck_of_cards[index_a + 1], @deck_of_cards[index_a] \n\t\t\t\n\t\t\t# new position of the 'a' joker\n\t\t\tnew_a = index_a + 1\n\t\tend\n\tend",
"def move_joker_a\n a_pos = $deck.find_index('A')\n if a_pos == 53\n $deck.delete 'A'\n $deck.insert 1, 'A'\n else\n temp = $deck[a_pos + 1]\n $deck[a_pos + 1] = $deck[a_pos]\n $deck[a_pos] = temp\n end\nend",
"def play_card(card)\n puts 'begin playcard id :' + card.id.to_s\n if self.respond_to?(card.name.gsub(' ','_'), true)\n update_attributes(played_card_id: card.id)\n self.send(card.name.gsub(' ','_'), nil)\n else\n puts 'No card played! gamemanager couldnt find details for ' + card.cardmapping.name\n end\n end",
"def start_round(cards, bet)\n new_hand = Hand.new(cards, bet)\n place_bet(bet)\n @hands.push(new_hand)\n @current_hand = 0\n check_blackjack()\n end",
"def deal\n end_round()\n shuffle()\n rounds_dealt = 0\n while rounds_dealt < @hand_size\n @players.each do | player |\n if card = @deck.draw()\n player.hand << card\n else\n return\n end\n end\n rounds_dealt += 1\n end\n end",
"def deal_turn\n @pokerdeck.pop\n turn = @pokerdeck.pop\n @communal_cards << turn\n return turn\n end",
"def play_internally(player,hand_index)\n p = player\n i = hand_index\n\n while p.is_playing(i)\n p.print_hand(i) # print the current hand\n\n #if blackjack, no need to play further, only a moron would hit more, they'd obviously stand.\n if p.blackjack(i)\n p.disable_playing(i)\n puts \"***Blackjack!!! No need to play further!\" # TODO maybe play for a hard blackjack, in which case just comment out this BLOCK! code will be shorter\n break\n end # end blackjack if\n\n print \"Please choose from the following {hit, stand, split, double, surrender}: \"\n decision = gets.chomp\n\n if decision == \"hit\"\n p.push_card(i,get_card)\n elsif decision == \"stand\"\n p.disable_playing(i) # just finish this hand\n elsif decision == \"split\" and p.player_number >=0 # dealer cant split\n if i == 0 and p.can_split() # i==0 is redundant actually. p.can_split() just checks\n p.create_new_hand_for_split() # create new hands\n p.push_card(0,get_card) # offer one more card for Hand 0\n p.push_card(1,get_card) # offer one more card for Hand 1\n puts \"Player #{p.player_number} Split call was done on hand #{i}\"\n p.print_Player # print the players new set of Hands\n else\n puts \"Player #{p.player_number} Split call was denied on hand #{i}\"\n end\n elsif decision == \"double\" and p.player_number >=0 #dealer cant double\n ## Player can double his hand after splitting so not putting that condition\n if p.can_double(i) # check if its ok to double, note that a split hand can indeed be doubled\n p.modify_for_double(i) # modify bet for doubling\n p.push_card(i,get_card) # take one more card & stand down\n puts \"Player #{p.player_number} has called Double on his hand #{i}\"\n p.print_Player\n else\n puts \"Player #{p.player_number} Double call was denied on hand #{i}\"\n end\n elsif decision == \"surrender\" and p.player_number >=0 #dealer cant surrnder\n if p.can_surrender()\n p.surrender()\n puts \"Player #{p.player_number} Surrender on hand #{i}\"\n else\n puts \"Player #{p.player_number} Surrender call was denied on hand #{i}\"\n end\n end# end hit, stand, split, double if\n\n # If busted, can't play further\n if p.get_value(i) > 21\n p.print_hand(i)\n puts \"***BUST!!! Can't Play Further!\"\n p.disable_playing(i)\n end\n\n end # end while hand is being played out\n\n end",
"def deal_hand\n\t\thand = Array.new\n\t\t@num_cards.times do\n\t\t\tcard = get_card(get_random_number)\n\t\t\thand << card\n\t\t\tremove_card_from_deck(card)\n\t\tend\n\t\thand\n\tend",
"def deal_one_card\n player.hands.each do |hand|\n # return nil if hand.bust?\n deck.deal(hand.cards)\n puts \"#{player.name} got #{hand.cards[-1].output_card}\"\n end\n deck.deal(house.hand.cards)\n puts \"#{house.name} got #{house.hand.cards[-1].output_card}\"\n end",
"def deal_player_card(current_player)\n\n card = @deck.delete_at(0)\n if current_player == 1 then\n @player1_hand << card\n end\n if current_player == 2 then\n @player2_hand << card\n end\n if current_player == 3 then\n @player3_hand << card\n end\n if current_player == 4 then\n @player4_hand << card\n end\n\n end",
"def play_hand (deck)\n puts \"\\nI have: \"\n display_hand\n puts \"\\nMy score is: #{score}\\n\"\n if score < 17 \n puts \"I think I'll hit.\"\n hit deck\n play_hand deck\n else\n score\n end\n end",
"def play\n @last_card_played = @my_hand.pick_random\n set_last_card_played @last_card_played\n end",
"def hit (deck)\n @hand << deck.deal_card\n calc_score\n true\n end",
"def draw_first_hand(hand, cards)\n hand = []\n hand << draw_card(cards)\n hand << draw_card(cards)\nend",
"def clear_hand\n @hand_cards.clear\n @points = 0\n end",
"def discard(card)\n hand.transfer!(card: card, to: discard_pile)\n end",
"def deal_card\r\n\t\tcards.pop\r\n\tend",
"def deal_cards(deck)\n hands []\n players.each do |player|\n hand = {\n player: = player\n card: = deck.shift\n }\n hands << hand\n end\n hands\n end"
] |
[
"0.72171724",
"0.7138571",
"0.7109097",
"0.7089356",
"0.706713",
"0.70414263",
"0.6991335",
"0.696174",
"0.6937465",
"0.69079477",
"0.6865887",
"0.68263716",
"0.6822201",
"0.68142325",
"0.67830056",
"0.6734797",
"0.6711113",
"0.6711113",
"0.6691604",
"0.6683179",
"0.66782117",
"0.6664284",
"0.66475964",
"0.66411424",
"0.66262907",
"0.66097254",
"0.65996885",
"0.6553425",
"0.65472364",
"0.6546262",
"0.6519286",
"0.6507883",
"0.6500786",
"0.6498234",
"0.6494756",
"0.6494623",
"0.6493525",
"0.6486424",
"0.6484722",
"0.64812154",
"0.6479594",
"0.6479567",
"0.6456771",
"0.6454291",
"0.64427423",
"0.644206",
"0.6440718",
"0.6438194",
"0.6438168",
"0.6414424",
"0.6413683",
"0.640272",
"0.64016396",
"0.6384385",
"0.63809645",
"0.6379812",
"0.6378759",
"0.6354999",
"0.6354232",
"0.63537574",
"0.6334044",
"0.63299984",
"0.632333",
"0.63193995",
"0.6312393",
"0.63104296",
"0.62967575",
"0.6285993",
"0.6283543",
"0.6282093",
"0.62750554",
"0.62572074",
"0.62512434",
"0.62491286",
"0.6234059",
"0.6232005",
"0.6230896",
"0.6228441",
"0.62258995",
"0.6225442",
"0.6224941",
"0.6224585",
"0.62224025",
"0.6211365",
"0.6205055",
"0.6204296",
"0.61954075",
"0.6182501",
"0.61783296",
"0.6176298",
"0.6164772",
"0.61500293",
"0.61454946",
"0.6139472",
"0.61348075",
"0.61332023",
"0.61203253",
"0.61190635",
"0.6113423",
"0.61102337"
] |
0.7269293
|
0
|
a method that checks if the specify hand busted
|
def bust?(hand)
return hand_total( hand ) > WIN_VALUE
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def busted?(hand)\n if hand.busted?\n puts \"Busted!\"\n true\n else\n false\n end\n end",
"def busted?\n\t\treturn hand_busted?(@hand)\n\tend",
"def can_split_hand(hand)\n return nil\n end",
"def shouldHit\n # If 17 or above, lock the hand so it cannot receive any more cards\n \tif @hands[0].checkHand > 16 or @hands[0].checkHand < 0\n \t @hands[0].lock\n \tend\n \t@hands[0].canGetCards\n end",
"def can_double()\n hand = @hands[@current_hand]\n @total_money > 0\n end",
"def hit?(hand, dealer_hand = nil)\n\t\t\t\tif hand.blackjack?\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\t\task_user\n\t\t\tend",
"def player_bust?(player)\n hand_value(player.hand) > BUST\n end",
"def blackjack(hand)\n value(hand) == 21 && hand.length == 2\n end",
"def analyze_hand\n pairs = 0\n straight = 0\n flush = 0\n\n # for now be conservative\n @play = 3\n\n # check for pairs\n\n\n # check for flush\n\n # check for straight\n\n\n\n # check for special hands\n #full house\n #royal flush\n #straight flush\n \n end",
"def blackjack?\n\t\treturn (hand.length == 2 and hand_value == BustLimit)\n\tend",
"def check_hand(hand)\n\t\t\tmin_value = hand.min_value\n\t\t\tclamped = hand.clamp_value(21, 21)\n\t\t\tif min_value > 21\n\t\t\t\tupdated = self.bust(hand)\n\t\t\telsif clamped > 0 # Value of hand is 21\n\t\t\t\tupdated = self.stand(hand, true, hand.is_blackjack)\n\t\t\telse\n\t\t\t\tupdated = [hand]\n\t\t\tend\n\t\t\treturn updated\n\t\tend",
"def has_a_hand\n return 1 if @hands.length > 0\n return nil\n end",
"def can_double?\n\t\treturn (@hand.length == 2 and @balance.balance >= @bet)\n\tend",
"def check_busted\n\t\tif @player.player_busted?\n\t\t\tputs \"You busted.\"\n\t\t\treturn\n\t\telsif @dealer.player_busted?\n\t\t\tputs \"The dealer busted.\"\n\t\t\treturn\n\t\tend\n\tend",
"def checkHand\n possible_hands = possibleHandValues\n if possible_hands.include?(21)\n return BLACKJACK\n elsif possible_hands.empty?\n return LOST\n else\n return possible_hands.max\n end\n end",
"def busted?(cards)\n\nend",
"def must_hit\n return true if @hand.point != \"Blackjack\" && @hand.point <= 16\n return false\n end",
"def hand_check(player_check)\n if player_check.hand_total > 21\n player_check.bust = true\n puts \"#{player_check.name} busted with #{player_check.hand_total}\"\n winner\n elsif player_check.hand_total == 21\n winner\n elsif six_cards?(player_check) == true\n puts \"~~~Six cards! #{player_check.name} wins!~~~\" ; player_check.score += 1\n show_hands_final\n again?\n end\n end",
"def stop_hit(hand)\r\n return true if hand.is_bust\r\n return true if hand.hand_score == [17]\r\n return true if hand.hand_score.max > 17\r\n return false\r\n end",
"def winning_hand\n if !(@player.hand.bust)\n if @player.hand.value > @dealer.hand.value\n player_win\n elsif @player.hand.value == @dealer.hand.value\n if @player.hand.blackjack? && !@dealer.hand.blackjack?\n player_win\n else\n puts \"The hand pushed\"\n @player.push_bet\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n else\n puts \"You lost the hand\"\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n else\n puts \"You busted\"\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n end",
"def decide(hand)\n value(hand) >= 17 && :stand || :hit\nend",
"def check_break?(hand_value)\n hand_value > 21 ? true : false\nend",
"def royal_flush?\n straight_flush? && @hand.include?('A')\n end",
"def double_bet?(hand)\n return @hands.include?(hand) && hand.double? && @cash - hand.bet >= 0\n end",
"def has_unplayed_hands()\n @current_hand < @hands.length\n end",
"def is_full_house( hand )\n\treturn ( is_three_of_a_kind( hand ) && is_one_pair( hand ) ) ? 1 : 0\nend",
"def first_hand?\n\t\treturn @first_hand\n\tend",
"def getResult\n \t@hands[0].checkHand\n end",
"def hungry?\n\n\t\t @stuff_in_belly <= 2\n\t\tend",
"def flush?\n @hand =~ /((S.*){5}|(H.*){5}|(D.*){5}|(C.*){5})/ ? true : false\n end",
"def check_borc_in_hand?(player, turn, done)\n expected_hand = expected_hand(player, turn)\n \n if !done.card.nil? && !expected_hand.include?(done.card)\n raise Cheating, \"Player is discarding card not in his/her hand!\"\n else\n true\n end\n end",
"def check_bingo\n\t\t\n\tend",
"def keepable_hand\n keepable = false\n if @hand.count('land') >= 3 && @hand.count('land') <= 4 && @hand.size > 5\n keepable = true\n elsif\n @hand.count('land') >= 3 && @hand.count('low_curve') >= 1 && @hand.size >= 5\n keepable = true\n elsif\n @hand.count('land') >= 2 && @hand.count('ramp') >= 1 && @hand.size >= 5\n end\n keepable\n end",
"def is_straight_flush( hand )\n\treturn ( is_straight( hand ) && is_flush( hand ) ) ? 1 : 0\nend",
"def best_hand\n raise\n end",
"def is_bust_or_blackjack?(player_or_dealer)\n # check for blackjack\n if player_or_dealer.get_hand_score == 21\n puts \"Blackjack! #{player_or_dealer.name} wins!\"\n player_or_dealer.display_hand\n player_or_dealer.class == Dealer ? @win_state = LOSS : @win_state = WIN\n return true\n # check for bust\n elsif player_or_dealer.get_hand_score > 21\n puts \"Bust! #{player_or_dealer.name} loses!\"\n player_or_dealer.display_hand\n player_or_dealer.class == Dealer ? @win_state = WIN : @win_state = LOSS\n return true\n # no blackjack or bust\n else\n return false\n end\n end",
"def blackjack_check\r\n\t\tif @player.hand.hand_value == 21 && @dealer.hand.hand_value == 21\r\n\t\t \t@dealer.show_hand\r\n\t\t \tputs \"Both #{@player.name} and #{@dealer.name} have Blackjack. It's a push\"\r\n\t\t \treturn true\r\n\t\t elsif @player.hand.hand_value == 21 && @dealer.hand.hand_value < 21\r\n\t\t \t@dealer.show_hand\r\n\t\t \tputs \"#{@player.name} has a Blackjack. #{@player.name} wins!\" \r\n\t\t \treturn true\r\n\t\t elsif @player.hand.hand_value < 21 && @dealer.hand.hand_value == 21\r\n\t\t \t@dealer.show_hand\r\n\t\t \tputs \"#{@dealer.name} has a Blackjack. #{@dealer.name} wins.\"\r\n\t\t \treturn true\r\n\t\t else\r\n\t\t \treturn false\r\n\t\t end\r\n\tend",
"def check_winner(d_hand,p_hand)\n if blackjack?(d_hand) && blackjack?(p_hand)\n tie\n elsif blackjack?(d_hand) && !blackjack?(p_hand)\n game_over\n elsif blackjack?(p_hand)\n blackjack\n end\n\n end",
"def hungry?\r\n # methods that return true or false\r\n @stuff_in_belly <= 2\r\n end",
"def has_hands\n return @hands.select{|hands| hands.status == HandStatus::PLAY} != []\n end",
"def bastard?\n end",
"def hungry?\n\t\t@stuff_in_belly <= 2\n\tend",
"def hungry?\n\t\t@stuff_in_belly <= 2\n\tend",
"def is_flush( hand )\n\treturn 1 == hand.map { | e | card_suit( e ) }.uniq.length ? 1 : 0\nend",
"def main_hand\n if has_hands\n return @hands[0]\n else\n return false\n end\n end",
"def hungry?\n # end a method with ? if it returnes true or false\n @stuff_in_belly <= 2\n end",
"def hungry? # method names can end in ? (usually used if returns true or false)\n\t\t@stuff_in_belly <= 2\n\tend",
"def browsed?() origin_code == \"browsed\" end",
"def is_handset? type\n Handset.is_handset? request.user_agent, type\n end",
"def dealer_decision\n while hand_value(@dealer_hand) < 17 \n puts \"\\nDealer hits!\"\n hit(@dealer_hand)\n show_hands()\n end\n end",
"def hungry?\n # method naam kan eindigen met \"?\"\n # dit is gebruikelijk om te doen als de methode\n # true of false terug geeft\n @stuff_in_belly <= 2\n end",
"def is_flush?\n @hand.all? {|card| card.suit == @hand[0].suit}\n end",
"def is_royal_flush( hand )\n\treturn ( is_flush( hand ) && is_flush( hand ) ) ? 1 : 0\nend",
"def split_hand?(hand)\n return @hands.include?(hand) && hand.split? && @hands.length <= MAX_SPLITS && @cash - hand.bet >= 0\n end",
"def hungry? # method returns true/false so we can use \"?\" as part of the name\n @stuff_belly <= 2\n end",
"def hungry? # method returns true/false so we can use \"?\" as part of the name\n @stuff_belly <= 2\n end",
"def hungry?\n\t @stuff_in_belly <= 2\n\tend",
"def unstable?\n harm > 3\n end",
"def check_blackjack()\n hand = @hands[0]\n if hand.is_blackjack()\n print_player_hands()\n puts \"Player #{@position} has a blackjack. You win 3:2!\"\n add_winnings(hand, blackjack=true) # Add the winnings of the bet to the player\n @current_hand += 1\n end\n end",
"def hand?\n @cards_by_score.length == 5\n end",
"def fair?\n !crooked?\n end",
"def won?\n won_checker\n end",
"def check_for_a_bomb\n warrior.listen.each do |unit|\n if Captives.include? unit.to_s.to_sym and unit.ticking?\n return true\n end\n end\n return false\n end",
"def win?(player_check)\n other = \"\"\n player_check == player ? other = dealer : other = player\n if (player_check == player)&&(player_check.hand_total == other.hand_total)\n return \"Tie\"\n elsif (player_check.bust == false) && (other.bust == false) && (player_check.hand_total > other.hand_total)\n return true\n elsif (player_check.hand_total == 21)\n return true\n elsif (player_check.bust == false) && (other.bust == false)&&(player_check.hand_total < other.hand_total)\n return false\n elsif (player_check.bust == false) && (other.bust == true)\n return true\n elsif (player_check.bust == true) && (other.bust == false)\n return false\n elsif (player_check.bust = true) && (other.bust == true)\n return \"Bust\"\n end\n end",
"def has_multiple_hands\n return 1 if @hands.length > 1\n return nil\n end",
"def busy?\n BusyPhases.any? {|phase| battle_phase == phase }\n end",
"def hungry? ## a ? means answer is true or false\n @stuff_in_belly <= 2\n end",
"def can_split_hand(hand)\n if hand.can_split and not self.has_max_hands\n return 1\n end\n return nil\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def hungry?\n @stuff_in_belly <= 2\n end",
"def is_hardwire?(); @type == GRT_HARDWIRE; end",
"def pl_high?\n session[:player].hand_total > session[:dealer].hand_total\n end",
"def test_complete?\n assert(@LiarHand.complete? == true, 'Hand for <LiarHand> expected to be full but wasnt.')\n assert(@IdiotHand.complete? == true, 'Hand for <IdiotHand> expected to be full but wasnt.')\n\n assert(@LightHand.complete? == true, 'Hand for <LightHand> expected to be full but wasnt')\n assert(@SpiderHand.complete? == true, 'Hand for <SpiderHand> expected to be full but wasnt')\n end",
"def hungry?\n\t@stuff_in_belly <= 2\nend",
"def pbBikeCheck\n if $PokemonGlobal.surfing ||\n (!$PokemonGlobal.bicycle && pbGetTerrainTag==PBTerrain::TallGrass)\n Kernel.pbMessage(_INTL(\"Can't use that here.\"))\n return false\n end\n# if $game_player.pbHasDependentEvents?\n# Kernel.pbMessage(_INTL(\"It can't be used when you have someone with you.\"))\n# return false\n# end\n if $PokemonGlobal.bicycle\n if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)\n Kernel.pbMessage(_INTL(\"You can't dismount your Bike here.\"))\n return false\n end\n return true\n else\n val=pbGetMetadata($game_map.map_id,MetadataBicycle)\n val=pbGetMetadata($game_map.map_id,MetadataOutdoor) if val==nil\n if !val\n Kernel.pbMessage(_INTL(\"Can't use that here.\"))\n return false\n end\n return true\n end\nend",
"def check?\n king_attacked?\n end",
"def check_blackjack\n\t\tif @player.blackjack?\n\t\t\tputs \"Blackjack!\"\n\t\t\treturn\n\t\telsif @dealer.blackjack?\n\t\t\tputs \"Dealer blackjack!\"\n\t\t\treturn\n\t\tend\n\tend",
"def test_for_straight_flush\n p = Hand.new(SF)\n assert p.send(:straight) == true\n assert p.send(:flush) == true\n assert p.send(:two_pair) == false\n end",
"def printAskUserInstr(player,dealer,hand)\n puts dealer.printHands(true)\n puts player.printHands\n puts \"Player \" + player.getName + \", what would you like to do on Hand \" + hand.getName + \"?\"\n if hand.isFirstTurn and (player.getHands.length == 1)\n puts \"'dd'=doubledown 'split'=split 'surr'=surrender 'hit'=hit 'stay'=stay\"\n elsif hand.isFirstTurn and player.canSplit\n \tputs \"dd'=doubledown 'split'=split 'hit'=hit 'stay'=stay\"\n elsif hand.isFirstTurn\n puts \"dd'=doubledown 'hit'=hit 'stay'=stay\"\n else\n puts \"'hit'=hit 'stay'=stay\"\n end\nend",
"def check_hard_soft_hand(a, b)\n if a == \"A\" && b == \"A\"\n \"Pair\"\n elsif a == \"A\" || b == \"A\"\n \"Soft\"\n elsif a == b\n \"Pair\"\n else\n \"Hard\"\n end\nend",
"def can_put_in_tableau?\n (@pile_beneath.empty? && @card_to_drop.rank.king?) ||\n (@card_beneath && @card_to_drop.rank.not.ace? &&\n @pile_beneath.last_card?(@card_beneath) &&\n tableau_conditions?(@card_beneath))\n end",
"def check ; true ; end",
"def hungry?\n @stuffInBelly <= 2\n end",
"def who_wins\n\n bj = false\n bust = false\n #//Check for dealer status after the showing hands\n if @dealer.busted?\n @ui.message(\"dealer loses\")\n bust=true\n else\n if @dealer.get_value == 21 && @dealer.num_cards == 2\n bj=true\n end\n end\n\n #//Check for player status after showing hands\n\n for player in @players\n hand_index = 0\n while hand_index < player.num_hands\n if player.busted?(hand_index)\n ui.message(player.name+\"loses on hand\"+ (hand_index+1).to_s)\n else\n if player.get_value(hand_index) == 21 && player.num_cards(hand_index) == 2 && !player.split?\n if BJ == true\n @ui.message(player.name+\" and dealer has a black jack!!! its a push on hand\"+ (hand_index+1).to_s)\n @ui.message(player.name+\"gets back \"+ player.push(hand_index).to_s)\n else\n @ui.message(\" its a black jack!!!\"+player.name+\" wins on hand\"+ (hand_index+1).to_s)\n @ui.message(player.name+\"gets \"+player.win(hand_index,true).to_s)\n end\n else\n if !bust\n if player.get_value(hand_index) > @dealer.get_value\n @ui.message(player.name+\" wins on hand\"+ (hand_index+1).to_s+\"!!!\")\n @ui.message(player.name+\"gets \"+player.win(hand_index,false).to_s)\n elsif player.get_value(hand_index) == dealer.get_value\n @ui.message(\"Its a push on hand\"+ (hand_index+1).to_s+\"!!!\"+player.name+\" and dealer has same value.\")\n @ui.message(player.name+\"gets back \"+ player.push(hand_index).to_s)\n else\n @ui.message(player.name+\" loses on hand\"+ (hand_index+1).to_s)\n end\n else\n @ui.message(player.name+\" wins on hand\"+ (hand_index+1).to_s+\"!!!\")\n @ui.message(player.name+\"gets \"+player.win(hand_index,false).to_s)\n end\n end\n end\n hand_index+=1\n end\n end\n end",
"def bust_or_win?\n if player.total == BLACKJACK\n puts \"#{player.name} hit backjack!! #{player.name} lost, dealer lost.\"\n play_again?\n elsif player.total > BLACKJACK\n puts \"#{player.name} busted! #{player.name} lost, dealer won.\"\n play_again?\n elsif dealer.total == BLACKJACK\n puts \"Dealer hit blackjack!! #{player.name} lost.\" \n play_again?\n elsif dealer.total > BLACKJACK\n puts \"Dealer busted! #{player.name} won.\"\n play_again?\n else\n \"continue\"\n end\n end",
"def have_suit?(player,suit)\n h = hand(player)\n h.each do |c|\n if c.suit == suit \n return true\n end\n end\n false\n end",
"def faab?\n free_agent? && !waiver_bid.nil?\n end",
"def playable\r\n\t\t@phand.each do |x| #go through player hand\r\n\t\t\tif @attack[-1].suit == @trump.suit && x.suit == @trump.suit && x.value > @attack[-1].value\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.suit == @trump.suit && @attack[-1].suit != @trump.suit #player can always trump any non trump\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.suit == @attack[-1].suit && x.value > @attack[-1].value #player can play a higher card of the same suit\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.value == @attack[-1].value && @defend.count == 0\r\n\t\t\t\tx.canplay = true\r\n\t\t\telse\r\n\t\t\t\tx.canplay = false\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def special_weapon_slot?(slot)\n ['Main Hand', 'Held In Off-hand', 'One-Hand', 'Off Hand', 'Shield'].include? slot\n end",
"def waiver?\n free_agent? && !waiver_bid\n end",
"def target_of_bang(card, targetter, missed_needed)\n if player.hand.count{ |x| x.type == Card.missed_card } >= missed_needed\n player.hand.select{|x| x.type == Card.missed_card}.first(missed_needed)\n else\n []\n end\n end",
"def negotiate_best_deal?\n nil\n end",
"def check_if_over_21(hand_total)\n if hand_total[0] > 21 && hand_total[1] > 21\n return true\n\n else\n return false\n\n end\nend",
"def in_this_hand?\n\t\t\t@state_hash['state']['players'].any? {|p| p['id'] == @player_id}\n\t\tend",
"def in_this_hand?\n\t\t\t@state_hash['state']['players'].any? {|p| p['id'] == @player_id}\n\t\tend",
"def is_one_pair( hand )\n\tpair = check_pair( 2, hand )\n\treturn 1 == pair.length ? card_value( pair[ 0 ] ) : 0\nend",
"def full_house(hand)\n\t\tif (pair(hand) > 0 and three_of_a_kind(hand) > 0)\n\t\t\treturn 6\n\t\tend\n\t\treturn 0\n\tend",
"def acro_passable_check(d, result)\n on_bike = (@on_acro_bike or $game_switches[::Yuki::Sw::EV_Bicycle])\n if @z > 1 and on_bike\n sys_tag = front_system_tag\n case d\n when 4, 6\n return true if sys_tag == AcroBikeRL\n when 8, 2\n return true if sys_tag == AcroBikeUD\n else\n return true if AccroTag.include?(sys_tag)\n end\n return false if @__bridge and AccroTag.include?(@__bridge.first) and !ZTag.include?(sys_tag)\n @__bridge = nil if result and ZTag.include?(sys_tag)\n elsif on_bike\n return false if NO_BIKE_TILE.include?(front_system_tag)\n end\n return result\n end",
"def check_game_over (guess, code)\n red_orb = give_hint(guess,code)[0]\n white_orb = give_hint(guess,code)[1]\n puts \"Red Orb: #{red_orb}, White Orb: #{white_orb}\"\n (give_hint(guess, code)[0] == 4) ? true : false\n end"
] |
[
"0.82900345",
"0.81556726",
"0.7051722",
"0.7028727",
"0.69882107",
"0.69708616",
"0.6958255",
"0.69564843",
"0.6950832",
"0.6922749",
"0.68880975",
"0.6885143",
"0.68551177",
"0.6830759",
"0.68238235",
"0.6813831",
"0.6812661",
"0.6769677",
"0.6758388",
"0.6757798",
"0.67131686",
"0.66392285",
"0.6604944",
"0.66003203",
"0.6593868",
"0.65798783",
"0.65685076",
"0.65624565",
"0.6554494",
"0.6539579",
"0.65012836",
"0.64971536",
"0.64802945",
"0.64607376",
"0.64313656",
"0.64143324",
"0.64082843",
"0.64005214",
"0.6377683",
"0.636166",
"0.6351829",
"0.6321391",
"0.6321391",
"0.6318414",
"0.6317576",
"0.6314446",
"0.6311412",
"0.6308295",
"0.6292338",
"0.62810904",
"0.62757164",
"0.6272934",
"0.62585783",
"0.62565845",
"0.6255224",
"0.6255224",
"0.6249237",
"0.62141985",
"0.62003136",
"0.61983275",
"0.6180745",
"0.61688215",
"0.616624",
"0.61566186",
"0.61565655",
"0.61421305",
"0.61404365",
"0.6127894",
"0.61277336",
"0.61277336",
"0.61277336",
"0.61254823",
"0.6124905",
"0.6109126",
"0.610905",
"0.60983026",
"0.60951865",
"0.6092636",
"0.6092413",
"0.60827696",
"0.60782903",
"0.60746473",
"0.6069176",
"0.60628366",
"0.6056144",
"0.60538894",
"0.6050744",
"0.60457164",
"0.604269",
"0.6030145",
"0.60219336",
"0.6020246",
"0.60176665",
"0.6017306",
"0.6017055",
"0.6017055",
"0.6014892",
"0.6005587",
"0.60055643",
"0.59999704"
] |
0.780418
|
2
|
Totals the points for a hand
|
def hand_total(hand)
#A flag to see if the hand contains an ace
have_ace = ! ( session[hand].select{|card| card['rank'] == "ace"}.empty? )
total = 0
#Look up the point value of each card in the hand
session[hand].each do |card|
total += RANK_TO_POINTS[ card['rank']]
end
#Convert from hard (ace=1) to a soft (ace=11)
#score if hand contains an ace
#and it won't cause the hand to bust
if (total <= 11 && have_ace) then total += 10 end
return total
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def calcScore(hand)\n return hand.inject(0) { |sum, n| sum + n.points }\nend",
"def points\n @puntos = 0\n students.each do |s| \n @puntos += s.points\n end\n @puntos += house_points\n end",
"def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def points\n\t\tpoints = 0\n\t\tassignments.each do |assignment|\n\t\t\tpoints += assignment.worth\n\t\tend\n\t\treturn points\n\tend",
"def total_points\n if self.has_paid?\n sum = 0\n self.bets.each { |b| sum+=b.points }\n self.answers.each { |a| sum+=a.points }\n sum\n else\n -1\n end\n end",
"def total_hands\n return @@total_hands\n end",
"def points() \n\t\t(self.wins()*3+self.draws()) \n\tend",
"def score\n # make a local array that will disappear when not in this method\n tally = []\n # for each of the cards in the hand, add their score to the tally from points\n @hand.each do |card|\n tally.push(@points[card])\n end\n # return the tally of the scores\n return tally.sum\nend",
"def total\n sum = 0\n hand.each do |card|\n sum += card.find_face_value\n end\n sum = correct_for_aces(sum)\n end",
"def total_points\n stories.inject(0) do |accumulator, story|\n accumulator += story.points\n end\n end",
"def sum_of_point\n # Calculating point of each block\n calculate_points\n # Sum\n rubbish_count + not_clear_count + somewhat_count + understand_count\n end",
"def total\n calculate_hand_totals\n if @hand.empty?\n puts \"Your hand is empty.\"\n return\n end\n\n puts \"Your hand is #{@hand.to_s}\" \n\n if !in_good_standing?\n puts \"*** YOU LOSE! ***\"\n end\n\n puts \"You have #{@hand_totals.count} possible total(s) with #{@hand_totals.count - 1} Aces:\"\n @hand_totals.each do | total, ace_distrobution |\n if total > 21\n puts \"BUSTED!- #{total} - [A: #{ace_distrobution[:hi]} hi, #{ace_distrobution[:lo]} lo]\"\n elsif total == 21 && @hand.count == 2\n puts \"BLACKJACK - #{total} - [A: #{ace_distrobution[:hi]} hi, #{ace_distrobution[:lo]} lo]\"\n elsif total == 21\n puts \"WINNING HAND - #{total} - [A: #{ace_distrobution[:hi]} hi, #{ace_distrobution[:lo]} lo]\"\n else\n puts \"#{total} - [A: #{ace_distrobution[:hi]} hi, #{ace_distrobution[:lo]} lo]\"\n end\n end\n end",
"def hand_score\n score = self.tricks\n if !self.got_set\n score += 10\n end\n return score\n end",
"def points\n made? ? (made_contract_points + overtrick_points + bonus) : undertrick_points\n end",
"def hand_score(hand)\n points = {\n \"A\"=>4,\n \"K\"=>3,\n \"Q\"=>2,\n \"J\"=>1\n }\n\n score = 0\n hand.each_char { |char| score += points[char.upcase] }\n return score\nend",
"def get_player_total(player_hand)\n\tplayer_total = 0 \t\t# Total value of player's hand\n\n\tfor i in 0..player_hand.length - 1\n\t\tplayer_total += $cards[player_hand[i]]\n\tend\n\treturn player_total\nend",
"def hand_value(hand)\n sum = 0\n hand.each do |card|\n sum += card\n end\n sum\n end",
"def calculate\n player.combine_cards\n player.deck.each do |card|\n if card.is_a? Victory\n @points += card.points player\n end\n end\n self\n end",
"def total\n @frame.inject(0){|rez, item| item ? rez + item[:score] : rez }\n end",
"def points\n @results.inject(0.0) { |t, r| t += r.points }\n end",
"def sum_player_hand(player_hand)\n player_hand.reduce(:+)\n end",
"def get_total_points\n @event_points + @performance_points + @enhance_points\n end",
"def dealer_hand_total\n dealers_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def total_points\n\n points = 0\n wattball_matches_as_team1.each do |match|\n points += match.points(1) || 0\n end\n\n wattball_matches_as_team2.each do |match|\n points += match.points(2) || 0\n end\n\n points\n end",
"def total_points\n self.user_points.reduce(0) { |sum, points| sum + points.point_category.number_of_points}\n end",
"def calculate_total hand\n\ttotal=0\n\tarray = hand.map {|e| e[1]}\n\tarray.each do |card|\n\t\t## face card \n\t\tif card == \"10\" || card ==\"J\" || card ==\"K\" || card ==\"Q\"\n\t\t\ttotal +=10\n\t\t## Ace card\t\n\t\telsif card ==\"A\"\n\t\t\ttotal += 11\n\t\telse \n\t\t\ttotal += card.to_i\n\t\tend\n\tend\n\thand.collect {|e| e[1]}.each do |card|\n\t\tif total >21 && card == \"A\"\n\t\t\ttotal -= 10\n\t\tend\n\tend\n\n\treturn total \nend",
"def score\r\n @health + points\r\n end",
"def calculate_total(cards_of_player, cards_of_dealer)\n total_points=[]\n total_points[0] = calculate_points(cards_of_player)\n total_points[1] = calculate_points(cards_of_dealer)\n total_points\nend",
"def points\n return 0 if event.trial? || event.trialed?\n\n points_if_not_trial\n end",
"def add_points(points)\n @correct_answers += 1\n @points += points\n end",
"def display_total\n puts \"Your points: #{self.points}\"\n end",
"def simple_points(frames)\n all_rolls(frames).sum\n end",
"def points\n self.answer_votes.sum(:value).to_i\n end",
"def points; end",
"def total\n total = 0\n aces = 0\n @hand.each do |card|\n case card[0]\n when 2..10 then total += card[0]\n when 'A' then aces += 1\n else total += 10\n end\n end\n total += add_aces(total, aces)\n total\n end",
"def display_total (person)\n puts \"#{person.name}'s total is #{person.hand_value(person.hand)}.\" \n end",
"def calculate_points(cards_in_hands)\n points = 0\n cards_without_ace = cards_in_hands.select {|card| card[1] != 'A'}\n cards_with_ace = cards_in_hands.select {|card| card[1] == 'A'}\n cards_without_ace.each do |card|\n if card[0].to_i !=0\n points += card[0].to_i\n else\n points += 10\n end\n end\n if cards_with_ace.empty?\n return points\n else\n ace_sets = [11, 1].repeated_permutation(cards_with_ace.length).to_a\n ace_sets_sum_arr = []\n ace_sets.each do |arr|\n arr_sum = 0\n arr.each {|v| arr_sum = arr_sum + v}\n ace_sets_sum_arr.push(arr_sum)\n end\n ace_sets_sum_arr.sort!.uniq!\n ace_sets_sum_arr.map! {|num| num + points}\n if ace_sets_sum_arr.include?(21)\n points = 21\n return points\n else\n lt_21_arr = ace_sets_sum_arr.select {|v| v < 21}\n gt_21_arr= ace_sets_sum_arr.select {|v| v > 21}\n if lt_21_arr.empty?\n points = gt_21_arr.first\n return points\n else\n points = lt_21_arr.last\n return points\n end\n end\n end\nend",
"def reduce_HP\n @points -= 10\n end",
"def total_points(competitor)\n scores = competitor.scores.map(&:total).compact\n\n scores.reduce(:+) # sum the values\n end",
"def player1_score\n player_hand.inject(0){|sum,n| sum + n.value }\n end",
"def points\n self.votes.inject(0) { |points, vote| points + vote.value }\n end",
"def points\n self.votes.inject(0) { |points, vote| points + vote.value }\n end",
"def total_point(team)\n team[:players].collect { |player| player[:points] }.sum\nend",
"def step_one_points\n\t\tpoints = 0\n\t\tpoints+=50 if !link.blank?\n\t\tpoints+=25 if !title.blank?\n\t\tpoints+=25 if !company.blank?\n\t\tpoints\n\tend",
"def get_hand_sum(curr_hand) \n curr_hand.inject(0) { |sum, card| sum + card }\n end",
"def points\n votes.sum(:value)\n end",
"def points\n votes.sum(:value)\n end",
"def sum_values\n points.sum\n end",
"def tally\n update_column :points, entries.sum(:points)\n end",
"def karma_sum\n karma_points.inject(0) {|sum, k| sum + k.karma }\n end",
"def calculate_points(master_pics, scoring_system = ScoringSystems.default)\n @points = 0\n pics.correct(master_pics).each do |pic|\n @points += pic.point_worth(scoring_system)\n end\n @points\n end",
"def total_query\n\t\t@total = 0\n\t\t@cards_held.times do |x|\n\t\t\t@total += hand_query(x,1,0)\n\t\tend\n\t\treturn @total\n\tend",
"def game_score\n previous_hands = self.game_player.hand_players.joins(:hand).where(\n \"hands.position <= ?\", self.hand.position\n )\n gs = 0\n for h in previous_hands\n gs += h.hand_score\n end\n return gs\n end",
"def calculate_player_points\n # Sort the teams by points in descending order. This way, the output will\n # follow the teams' finishing order, which will be easier to read.\n @teams.sort_by(&:points).reverse_each do |team|\n puts \"Awarding #{team.points} points to #{team.name}: \" +\n @players[team.id].map(&:to_s).join(\", \")\n\n @players[team.id].each do |player|\n player.points = team.points\n end\n end\n end",
"def total_points(competitor)\n if @unicon_scoring\n total = 0\n competitor.competition.judge_types.uniq.each do |jt|\n total += total_points_for_judge_type(competitor, jt)\n end\n else\n total = total_points_for_judge_type(competitor, nil)\n end\n\n total\n end",
"def num_points win_condition\n points = 0\n @game_objects.each do |game|\n points += game.score_osu game_meets_win_cond win_condition, game\n end\n points\n end",
"def dealer_score\n dealer_hand.inject(0){|sum,n| sum + n.value }\n end",
"def gain_points\n @score += 1\n end",
"def hand_score(hand)\n\nend",
"def score_hand\n\n end",
"def score\n\t\tpontos = 0\n\t\tindex = 0\n\t\twhile (index < 20 && @rolls[index]) do\n\t\t\tif strike? index\n\t\t\t\tpontos += pontosStrike (index)\n\t\t\telsif spare? index\n\t\t\t\tpontos += pontosSpare (index)\n\t\t\telsif @rolls[index + 1]\n\t\t\t\tpontos += @rolls[index] + @rolls[index + 1]\n\t\t\telse\n\t\t\t\tpontos += @rolls[index]\n\t\t\tend\n\t\t\tindex += 2\n\t\tend\n\t\tpontos\n\tend",
"def total_score\n total = 0\n @cards.each do |card|\n total += card.value\n end\n\n sorted_cards = @cards.sort\n\n straights = get_straight(sorted_cards).reverse\n straights.each do |straight|\n total += 40\n sorted_cards.slice!(straight[0]..straight[1])\n end\n\n three_cards = get_number_of_a_kind(sorted_cards, 3)\n three_cards.each do |three|\n total += 20\n sorted_cards.slice!(three[0]..three[1])\n end\n\n pairs = get_number_of_a_kind(sorted_cards, 2)\n pairs.each do |pair|\n total += 10\n sorted_cards.slice!(pair[0]..pair[1])\n end\n\n total\n end",
"def deal_and_total(name, hand_array, deck_hash)\n read_hand(name, hand_array, deck_hash)\n new_hand_value = sum_cards(hand_array, deck_hash)\nend",
"def point_count\n puts \"#{@player1.name}'s points: #{@player1.point}\\n#{@player2.name}'s points: #{@player2.point}\"\n end",
"def value(hand)\n # Sorting hack to get aces at the very end so we count them last\n hand.sort_by { |c| c.to_i != 0 ? c : c[0] - 81 }.reverse().inject(0) do |total,cur|\n if cur.to_i != 0\n total + cur # 2-10 case\n elsif [\"J\",\"Q\",\"K\"].include? cur\n total + 10 # J,Q, or K\n elsif cur == \"A\"\n if (total+11) > 21\n total + 1 # Count ace as 1\n else\n total+11 # Count ace as 11\n end\n end\n end\n end",
"def hand_score(hand)\n\tcards= {\"A\"=>4, \"K\"=>3, \"Q\"=>2, \"J\"=>1}\n \tscore = 0\n \thand.each_char { |char| score += cards[char.upcase] }\n \treturn score\nend",
"def display_points(some_points)\n puts (\"Total Points: #{@player_points}\")\n end",
"def hitting_total\n self.rating_19 +\n self.rating_20 +\n self.rating_21 +\n self.rating_22 +\n self.rating_23 +\n self.rating_24 +\n self.rating_25 +\n self.rating_26 +\n self.rating_27\n end",
"def findPoints\n #test royal flush\n if (self.isFlush && self.isStraight && self.getDigits[-1,1] == \"A\")\n return 10\n #straight flush\n elsif(self.isFlush && self.isStraight)\n return 9\n # four of a kind\n elsif (self.hasRecurringDigit(@hand, 4))\n return 8\n else\n #test for full house\n @hand.sort\n firstThree = @hand[0,3]\n firstTwo = @hand[0,2]\n secondThree = @hand[-3,3]\n secondTwo = @hand[-2,2]\n if ( (self.hasRecurringDigit(firstTwo, 2) && self.hasRecurringDigit(secondThree, 3)) ||\n (self.hasRecurringDigit(firstThree, 2) && self.hasRecurringDigit(secondTwo, 3)) )\n return 7\n end\n end\n\n # flush\n if (self.isFlush)\n return 6\n #straight\n elsif (self.isStraight)\n return 5\n # three of a kind\n elsif (self.hasRecurringDigit(@hand,3))\n return 5\n end\n return 0\n end",
"def calculate_ropes_points_total(wrestler)\n\n\t\tropes_specialty_points = \n\t\t\tcalculate_ropes_specialty_points(wrestler)\n\t\tropes_points_per_roll_subtotal = \n\t\t\tcalculate_ropes_points_per_roll_total(wrestler)\n\n\t\tropes_total = ropes_points_per_roll_subtotal + \n\t\t\t\tropes_specialty_points\n\n\t\treturn ropes_total\n\tend",
"def score\n @scoreTotal = @jogadas[0].down_pin + @jogadas[1].down_pin\n end",
"def num_points\n @size * @size\n end",
"def total_points\n Activity.points_for_person(id)\n end",
"def total_point\n lecture.etcs_point\n end",
"def compute_sum_for player\r\n if player == nil || player[:cards] == nil || player[:cards].length == 0\r\n return 0\r\n end\r\n \r\n #Compute initial points\r\n sum = 0\r\n i = 0\r\n \r\n while i < player[:cards].length\r\n card = player[:cards][i]\r\n sum = sum + (card[:face] > 10 ? 10 : ((card[:face] == 1)? 11 : card[:face]))\r\n\ti = i + 1\r\n end\r\n \r\n #Fix the sum if possible, when the points is larger than 21\r\n j = player[:cards].length - 1\r\n while sum > 21 && j >= 0\r\n\tcard = player[:cards][j]\r\n\tif card[:face] == 1 #There is an Ace\r\n\t sum = sum - 11 + 1\r\n\tend\r\n\tj = j - 1\r\n end\r\n\t\r\n sum\r\nend",
"def pl_total\n @printer << \"You have #{session[:player].hand_total}\" if !session[:player].blackjack?\n @printer << \"You bust.\" if session[:player].bust?\n if session[:player].blackjack?\n @printer << \"BlackJack!\" \n session[:player].make_lucky\n end\n nil\n end",
"def calculate_points\n if team.exhibition?\n event.standings_including(team).find_index(self) + 1\n else\n event.standings.find_index(self) + 1\n end\n end",
"def score\n p_score = player_hand.collect{|x| x.value}.inject(:+)\n c_score = computer_hand.collect{|x| x.value}.inject(:+)\n puts \"You have #{player_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{p_score}\"\n puts \"The computer has #{computer_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{c_score}\"\n puts \" \"\n end",
"def points\n points_by_round = [nil, 3, 5, 8, 13, 21, 34]\n points_by_round[@game.round] + @winner.seed\n end",
"def card_total(hand)\n total = 0\n ace = hand.select {|x| x[0] == 'A'}\n # Calculation of hand without aces.\n if ace == []\n hand.each do |x|\n x = x[0..-2].to_i\n x == 0? total += 10 : total += x\n end\n total\n else\n # Calculation of hand with ace(s)\n # Delete aces from hand array\n ace.each do |a|\n hand.each {|x| hand.delete(a) if x == a}\n end\n # Calculate hand without aces\n hand.each do |x|\n x = x[0..-2].to_i\n x == 0? total += 10 : total += x\n end\n ace.each {|a| hand << a}\n # Add the value of ace(s) to the current total\n nr_ace = ace.length\n case nr_ace\n when 1\n total <= 10? total += 11 : total += 1\n when 2\n total <= 9? total += 12 : total += 2\n when 3\n total <= 8? total += 13 : total += 3\n else\n total <= 7? total += 14 : total += 4\n end\n total \n end\nend",
"def calculate_oc_points_subtotal(wrestler)\n\t\toc_prob = wrestler[:oc_probability]\n\n\t\toc_hash = get_oc_hash(wrestler)\n\t\toc_points_hash = oc_hash.select { |k,v| k.to_s.include?(\"points\") }\n\t\t\n\n\t\treturn calculate_oc_subtotal(oc_points_hash)\n\tend",
"def points\n 1\n end",
"def hand_value\n @hand_value = @player_hand.hand.flatten.map { |x| Integer(x) rescue nil}.compact.inject(:+)\n end",
"def point_wh_count point\n point.layers.inject(0){|sum, lay| sum + lay.whs.size }\n end",
"def score\n self.tiles.inject(0){|sum,num| sum+=TileBag.points_for(num)}\n end",
"def result(outcome)\n @points += 3 if outcome == \"W\"\n @points += 0 if outcome == \"L\" # not really necessary...\n end",
"def total\n tot = 0\n for card in @cards\n tot += card.value\n end\n if has_ace and tot < 12\n tot2 = tot + 10\n if @stand\n return tot2\n else\n return [ tot, tot2 ]\n end\n else\n return tot\n end\n end",
"def add_points(result)\n if result == \"win\"\n @points += 1\n end\n end",
"def current_points(game)\n game_cards ? game_cards.where(game: game).map(&:card).map(&:value).sum : 0\n end",
"def score\n @rolls.reduce(:+)\n end",
"def hand_value\n @hand_value = []\n if straight_flush?\n @hand_value << 9 << straight_flush?\n elsif four_of_a_kind?\n @hand_value << 8 << four_of_a_kind?\n elsif full_house?\n @hand_value << 7 << full_house?\n elsif flush?\n @hand_value << 6 << flush?\n elsif straight?\n @hand_value << 5 << straight?\n elsif three_of_a_kind?\n @hand_value << 4 << three_of_a_kind?\n elsif two_pair?\n @hand_value << 3 << two_pair?\n elsif pair?\n @hand_value << 2 << pair?\n else\n @hand_value << 1 << points[0]\n end\n\n end",
"def total; end",
"def accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\n end",
"def true_point_value\n\t\ttotal = 0\n\t\ttotal += points_scored\n\t\ttotal += field_goals_made * season.field_goals_made_point_value\n\t\ttotal -= field_goals_attempted * season.field_goals_attempted_point_value\n\t\ttotal += free_throws_made * season.free_throws_made_point_value\n\t\ttotal -= free_throws_attempted * season.free_throws_attempted_point_value\n\t\ttotal += three_pointers_made * season.three_pointers_made_point_value\n\t\ttotal += assists * season.assists_point_value\n\t\ttotal += total_rebounds * season.total_rebounds_point_value\n\t\ttotal += steals * season.steals_point_value\n\t\ttotal += blocks * season.blocks_point_value\n\t\ttotal -= turnovers * season.turnovers_point_value\n\t\ttotal\n\tend",
"def points(place, ties)\n total_points = 0\n current_place = place\n (ties + 1).times do\n total_points += points_for(current_place)\n current_place += 1\n end\n total_points.to_f / (ties + 1)\n end",
"def hash\n @points.inject(0) { |sum, point| sum += point.x + point.y }\n end",
"def sum_of_cards(hand)\n card_values = hand.map do |card|\n if card[0] == 1\n card[0] = 11\n elsif card[0] >= 11\n card[0] = 10\n else\n card[0]\n end\n end\n sum = 0\n card_values.each do |card|\n sum += card[0]\n end\n sum\n end",
"def total_points(semester = Semester.current_semester)\n sum = 0\n\n event_mems = Array.new\n self.event_members.each do |em|\n if em.semester == semester\n event_mems << em\n end\n end\n\n if semester == \"all\"\n event_mems = self.event_members\n end\n # Calculate points from events\n event_mems.each do |event_member|\n sum += event_member.event_points.value if event_member.event_points\n end\n\n # Calculate points from tabling\n # TODO only for this semester tabling slots\n self.tabling_slot_members.where(\n status_id: Status.where(name: :attended).first\n ).each do |tsm|\n # only add points if it was from this semester\n if TablingSlot.find(tsm.tabling_slot_id).start_time >= Semester.current_semester.start_date\n sum += TablingSlot::POINTS\n end\n\n # TODO: points for other statuses\n end\n\n return sum\n end",
"def total_rounds\n self.count_wins + self.count_losses\n end",
"def calculate_oc_points_per_round_total(wrestler)\n\n\t\toc_points_subtotal = \n\t\t\tcalculate_oc_points_subtotal(wrestler)\n\n\t\toc_specialty_points_per_round = \n\t\t\tcalculate_oc_specialty_points_per_round(wrestler)\n\n\t\tropes_points_total = \n\t\t\tcalculate_ropes_points_total(wrestler)\n\n\t\toc_points_per_round_total = oc_points_subtotal +\n\t\t\toc_specialty_points_per_round + ropes_points_total\n\n\t\treturn oc_points_per_round_total\n\tend"
] |
[
"0.73431003",
"0.6987293",
"0.6947591",
"0.69389284",
"0.69366807",
"0.6907244",
"0.6902562",
"0.68712276",
"0.68426865",
"0.68361413",
"0.6812822",
"0.6750951",
"0.6711056",
"0.66690224",
"0.6664042",
"0.6629807",
"0.6557108",
"0.6540432",
"0.6540071",
"0.6514982",
"0.64994174",
"0.64715326",
"0.6457252",
"0.6437032",
"0.643204",
"0.63848406",
"0.637452",
"0.6363969",
"0.6359794",
"0.63440865",
"0.6342219",
"0.6340021",
"0.6339065",
"0.6334947",
"0.63318914",
"0.63285494",
"0.63135",
"0.6281161",
"0.62779844",
"0.6259079",
"0.6244488",
"0.6244488",
"0.624364",
"0.6227646",
"0.62269884",
"0.6226698",
"0.6226698",
"0.6225011",
"0.6207254",
"0.62072366",
"0.6191501",
"0.6184495",
"0.6168731",
"0.6154686",
"0.6115217",
"0.6114622",
"0.6110923",
"0.6110178",
"0.61064374",
"0.61055356",
"0.6101153",
"0.60820556",
"0.6076849",
"0.60743284",
"0.60717964",
"0.6055666",
"0.6050568",
"0.6041063",
"0.6032771",
"0.6030663",
"0.6026697",
"0.6017434",
"0.6014398",
"0.60141855",
"0.6008944",
"0.6004979",
"0.59821314",
"0.59695905",
"0.59672344",
"0.5967221",
"0.595911",
"0.59556735",
"0.59548575",
"0.5952486",
"0.59486115",
"0.5948423",
"0.59443146",
"0.59415483",
"0.5935851",
"0.59320027",
"0.5912312",
"0.5910064",
"0.59088004",
"0.59072125",
"0.59064394",
"0.5903688",
"0.58983415",
"0.5896691",
"0.5895717",
"0.5885304"
] |
0.75406694
|
0
|
Never trust parameters from the scary internet, only allow the white list through.
|
def validation_params
# params.require(:validation).permit(:id, :phone_num, :code)
params.permit(:id, :phone_num, :code)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
def before_create self.on_base ||= "" self.outfielders ||= "" end
|
def redis_on_base
on_base
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def before_create()\n end",
"def before_create_save(record); end",
"def before_build\n\nend",
"def before_write\n end",
"def before_create_defaulter\n\t\tif self.order == nil\n\t\t\tself.order = \"\"\n\t\tend\n\n\t\tif self.show_others == nil\n\t\t\tself.show_others = false\n\t\tend\n\tend",
"def before_save(sender); end",
"def validate_on_create; end",
"def pre_initialize_fields\n end",
"def before_create\n self[:TableID] = 1\n self[:Type] = 0 # FIXME: guess\n super\n end",
"def _before_validation\n end",
"def before_create\n @added = true\n super\n end",
"def before_validation_on_update\n before_validation_on_create\n end",
"def before_save(*); end",
"def after_create; end",
"def before_create(_params)\n nil\n end",
"def post_initialize_fields\n end",
"def before_create\n self.created_at ||= Time.now\n super # ($)\n end",
"def after_create_save(record); end",
"def before_create; self.created_on = Time.now.utc; end",
"def on_field_change\n super\n end",
"def validate_on_create=(_arg0); end",
"def pre_validation\n\n end",
"def before_create_hook\n execute_hooks_for(:before, :create)\n end",
"def before_save #def self.before_save()\n @my_log.info(\"Creating user with name #{self.name}\")\n end",
"def validate_on_create #:doc:\n end",
"def before_validation_callback\n end",
"def before_validation_on_create\n self.OTNum ||= self.class.next_OTNum\n self.ticket_no ||= self.class.next_ticket_no\n end",
"def before_create\n super\n self.check_unique_code\n end",
"def before_validation() \n #logger.info \"Tend: #{tend} // class: #{tend.class}\"\n self.published = true unless attribute_present?(\"published\") # pubblicato: yes\n self.starred = false unless attribute_present?(\"starred\") # starred: no\n #ric_change_parameter('starred',false)\n #self.birthday = Date.civil(1901,1,1) unless attribute_present?(\"birthday\") # compleanno 1gen1901\n self.nickname = _fake_nickname unless attribute_present?(\"nickname\") # i.e. 'rcarlesso'\n self.created_by ||= current_user.name rescue \"ModelCreatedBy: #{$!}\"\n self.updated_by = current_user.name rescue \"Probably Updated from shell and not from web: ''#{$!}''\"\n if (attribute_present?(\"organisation\") && ! attribute_present?(\"work_venue_id\") ) # --> autocreate workplace obj from string! Cool!\n self.work_venue = Venue.find_or_create_by_name(organisation.strip) rescue nil\n end\n if (attribute_present?(\"location\") && ! attribute_present?(\"venue_id\") ) # --> autocreate workplace obj from string! Cool!\n self.venue = Venue.find_or_create_by_name(location.strip) rescue nil\n end\n self.relevance = 42 unless attribute_present?(\"relevance\") # rilevanza 42\n # NON HO ACCESSO AL CURRENTUSER DA QUI! SOLO VIEW E CONTROLLER!!!\n #self.feed = \"Person:_:BeforeValidation(): person changed by ''#{@current_user rescue 'BOH'}'' on #{Time.now}\" unless attribute_present?(\"feed\") \n #self.nickname = self.nickname.nicknamize rescue nil # minuscolizza e toglie spazi\n self.email = self.email.strip if attribute_present?(\"email\")\n end",
"def before_create \n self.name = name.downcase.strip.squeeze(\" \")\n end",
"def before_update; end",
"def pre_validation\n\n\n end",
"def before_save(request=nil)\n \n self[:collection] = \"tracking\"\n # @todo self schema ==> current schema\n \n if not warn?\n self[:warn] = []\n end\n\n # Base URI, used to set source and deployment URIs\n if not base?\n self[:base] = base_uri\n end\n \n # Set source to URI if it's a SHA1 hash\n if source? and source !~ URI::REGEXP and source =~ /\\w{40}/\n source_uri = base_uri\n source_uri.path = \"/source/#{source}\"\n self[:source] = source_uri.to_s\n end\n\n # Merge in object, species, platform_model, platform_type\n inject_platform_deployment_metadata\n \n # Merge in individual if the platform is known to be attached to one, \n # ie. only if measured >= deployed (and if terminated is set: measured <= terminated)\n inject_indvidual\n \n # Merge in sensor data\n decode_sensor_data\n \n if self[:warn].none?\n self.delete :warn\n end\n \n self\n end",
"def _before_validation\n set_uuid if new?\n super\n end",
"def after_create\n true\n end",
"def init_on_create(*)\n self._classname = self.class.to_s\n write_default_attributes\n write_changed_attributes\n clear_changes\n end",
"def on_before_save\n\t\ts = \"#{self.make} #{self.model} #{self.year} #{self.trim} #{self.body} #{self.drive} #{self.transmission}\"\n\t\tputs s\n\t\tself.searchable = s\n\tend",
"def before_create_save(record)\n record.user = current_user\n record.categories = CategoryNews.find(params[:record][:news_categories_override]) unless params[:record][:news_categories_override].blank?\n end",
"def before_write_processors\n @before_write_processors ||= []\n end",
"def after_build\n end",
"def before_create_save(record)\n record.usr_id = session[:usr_id]\n # I derive the name of the object to prevent user from naming it stupidly\n record.name = \"#{record.symbl.name}-#{record.rpttype.name}-#{record.enddate.to_s}\"\n end",
"def before_save\n\n touch\n end",
"def before_save\n\n touch\n end",
"def fields_not_to_clean\n ['deleted_record','record_before','record_after']\n end",
"def create\n\t\tsuper\n\tend",
"def before_save\n # boolean fields cannot be NULL at database level\n self.is_active = 0 if self.is_active.nil?\n end",
"def before_create\n self.name = name.downcase.strip.squeeze(\" \")\n end",
"def _process_on_create(entity)\n end",
"def before_save\n self.resource_type ||= self.class.to_s.split('::')[-1].downcase\n self.uuid ||= UUIDTools::UUID.random_create\n self.name ||= self.uuid\n self.urn ||= GURN.create(self.name, :type => self.class.to_s.split('::')[-1].downcase).to_s\n super\n end",
"def post_is_create?\n\t\ttrue\n\tend",
"def pre_initialize\n end",
"def before_create \n self.ver = 0\n end",
"def generated_on\n\t\t\n\tend",
"def before_create\n self.scraped_at ||= DateTime.now\n super\n end",
"def after_initialize\n self.lazy_action = '' # keep it text. we need it for Approve, Bill actions\n self.need_validation = true # assume, the user will not hit \"save\"\n # \n # Tue May 24 00:31:48 IST 2011, ramonrails\n # * date should not be 7 days ahead, as discussed with Chirag on chat\n # self.installation_datetime ||= (order.created_at + 7.days) if ordered_direct_to_consumer?\n decide_card_or_bill\n # \n # * we begin from this state\n if self.new_record?\n self.no_caregiver_1 = true if no_caregiver_1.nil?\n self.no_caregiver_2 = true if no_caregiver_2.nil?\n self.no_caregiver_3 = true if no_caregiver_3.nil?\n end\n #\n # build before fetching caregiver options. also establishes\n # * same as user\n # * add as caregiver #1\n build_associations\n #\n self.subscriber_is_caregiver ||= subscriber_and_caregiver1_match?\n end",
"def form_setup\n\tend",
"def before_save\n \n self.proyecto=self.proyecto.upcase\n \n if self.accion_especifica.to_i < 10 \n if self.accion_especifica.to_s.length!=2\n self.accion_especifica=\"0\"+self.accion_especifica.to_s \n end\n end \n \n if self.partida.to_i < 10 \n if self.partida.to_s.length!=3\n self.partida=\"00\"+self.partida.to_s \n end\n elsif self.partida.to_i < 100\n if self.partida.to_s.length!=3\n self.partida=\"0\"+self.partida.to_s \n end\n end\n \n if self.generica.to_i < 10 \n if self.generica.to_s.length!=2\n self.generica=\"0\"+self.generica.to_s \n end\n end\n \n if self.especifica.to_i < 10 \n if self.especifica.to_s.length!=2\n self.especifica=\"0\"+self.especifica.to_s\n end \n end\n \n if self.sub_especifica.to_i < 10 \n if self.sub_especifica.to_s.length!=2\n self.sub_especifica=\"0\"+self.sub_especifica.to_s\n end\n end\n end",
"def required_on\n if null\n nil\n elsif default.nil?\n :save\n else\n :update\n end\n end",
"def before_validation()\n logger.debug \"Vediamo di mettere mittente a riclife se non c'e'..\"\n self.from = User.default_system_user unless attribute_present?(\"from_id\") # unless User.find_by_login('riclife') unless \n end",
"def before_update_save(record); end",
"def configure_field\n end",
"def after_initialize\n if new_record?\n self.email ||= \"jakub.hozak@gmail.com\"\n end\n end",
"def before_create\n self.created_at = Time.now\n self.updated_at = Time.now\n end",
"def before_save_hook\n execute_hooks_for(:before, :save)\n end",
"def _before_validation\n if new? && (set = self[model.sti_key])\n exp = model.sti_key_chooser.call(self)\n if set != exp\n set_table = model.sti_class_from_key(set).table_name\n exp_table = model.sti_class_from_key(exp).table_name\n set_column_value(\"#{model.sti_key}=\", exp) if set_table != exp_table\n end\n end\n super\n end",
"def after_created; end",
"def before_create\n \tself.day_made ||= Date.current if new_record?\n \tself.got_bonus = false\n \tend",
"def create\n super\n end",
"def before_import_save(record)\n self.allow_blank_password = true\n self.allow_blank_email = true\n end",
"def before_processing\n end",
"def after_save(record)\n \n end",
"def set_default_values\n # set_new_record_default_values\n set_attr_accessor_default_values\n end",
"def before_create\n keywords = []\n subkeywords = []\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def create\n super\n end",
"def new_model_defaults\n end",
"def before_save\n # boolean fields cannot be NULL at database level\n self.is_active = 0 if self.is_active.nil?\n end",
"def before_validation\n self.name=first_upper(self.name)\n end",
"def before_validation\n self.name=first_upper(self.name)\n end",
"def set_defaults\n self.created_at ||= DateTime.now.utc\n self.keyword ||= nil\n self.extra ||= nil\n end",
"def before\n\t\t\ttrue\n\t\tend",
"def pre_initialize; end",
"def before_create\n select = \"#{Company.table_name}.id\"\n \n # serialized adjustments. initialize the array.\n self.adjustments = []\n \n case payable_type\n when \"OrderEntityCost\" \n j = \"LEFT OUTER JOIN #{OrderEntity.table_name} AS oe ON oe.company_id = #{Company.table_name}.id\"\n j += \" LEFT OUTER JOIN #{OrderEntityCost.table_name} AS oec ON oec.order_entity_id = oe.id\"\n c = \"oec.id = #{payable_id}\" \n self.company_id = Company.find(:first, :select => select, :conditions => c, :joins => j).id\n self.name = payable.type.name\n when \"OrderEntity\"\n j = \"LEFT OUTER JOIN #{OrderEntity.table_name} AS oe ON oe.company_id = #{Company.table_name}.id\"\n c = \"oe.id = #{payable_id}\"\n self.company_id = Company.find(:first, :select => select, :conditions => c, :joins => j).id\n self.name = payable.type.label + ' charge' #<-- OrderTypeEntity.label [Pickup Agent, Carrier, Delivery-agent, etc]\n when \"CompanySalesAccount\"\n j = \"LEFT OUTER JOIN #{Account.table_name} AS a ON a.company_id = #{Company.table_name}.id\"\n j += \" LEFT OUTER JOIN #{CompanySalesAccount.table_name} AS csa ON csa.account_id = a.id\"\n c = \"csa.id = #{payable_id}\"\n self.name = \"Commission\"\n self.company_id = Company.find(:first, :select => select, :conditions => c, :joins => j).id \n end\n end",
"def prep\n\tend",
"def do_before_save\n self.dc_user_id = nil if self.public\nend",
"def after_create(obj); end",
"def after_create\n self.update_attribute(:updated_on,self.created_on)\n end",
"def before_validation()\n self.attribute_names.each do |n|\n self[n] = self[n].strip if self[n].kind_of?(String)\n end\n end",
"def before_create(model)\n model.created_by = @@current_user if model.respond_to?(\"created_by\")\n end",
"def configure_field\n end",
"def validate_on_save(fields)\n end",
"def before_setup; end"
] |
[
"0.7185991",
"0.6746148",
"0.66413254",
"0.6637903",
"0.6601145",
"0.6597145",
"0.64315075",
"0.637407",
"0.63470066",
"0.6310391",
"0.6273825",
"0.6266105",
"0.6258427",
"0.62444776",
"0.6213979",
"0.6174674",
"0.6160833",
"0.6131725",
"0.61163664",
"0.6060748",
"0.6051994",
"0.60376704",
"0.60352117",
"0.60152715",
"0.60010743",
"0.5992819",
"0.5983923",
"0.59519213",
"0.59281945",
"0.59093565",
"0.58806825",
"0.5870045",
"0.58618045",
"0.58211416",
"0.5814594",
"0.5800794",
"0.5795512",
"0.5780648",
"0.57614857",
"0.575523",
"0.575243",
"0.574905",
"0.574905",
"0.57482135",
"0.5745862",
"0.57341826",
"0.57182074",
"0.5714877",
"0.5712565",
"0.570148",
"0.5700722",
"0.5692649",
"0.5687602",
"0.56699526",
"0.56631666",
"0.56611407",
"0.56596917",
"0.5650082",
"0.5644222",
"0.56415147",
"0.5637638",
"0.56335837",
"0.56264263",
"0.5614071",
"0.56125396",
"0.5602419",
"0.5597427",
"0.5581013",
"0.5580906",
"0.5540425",
"0.5539985",
"0.553948",
"0.55379784",
"0.55204916",
"0.55204916",
"0.55204916",
"0.55204916",
"0.55204916",
"0.55204916",
"0.55204916",
"0.55204916",
"0.55204916",
"0.55204916",
"0.55204916",
"0.5517112",
"0.5513515",
"0.5507218",
"0.5507218",
"0.5506537",
"0.5499466",
"0.5496568",
"0.548982",
"0.5487374",
"0.54824394",
"0.5476477",
"0.5475082",
"0.54735565",
"0.54630923",
"0.54590887",
"0.54524887",
"0.54504496"
] |
0.0
|
-1
|
Checks that arguments are rejected if they're wrong
|
def test_password
p1 = "mypassword123"
p2 = "mypassword1234"
s1 = Password.update(p1)
assert_equal(true, Password.check(p1,s1), "Password was not stored correctly")
assert_equal(false, Password.check(p2,s1), "Password check is broken")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def test_check_args_false\n c = Checker.new\n assert_equal false, c.check_args([1, 1, 1, 1])\n assert_equal false, c.check_args([1,1])\n assert_equal false, c.check_args(['something', 111])\n assert_equal false, c.check_args([1, -1, 1])\n assert_equal false, c.check_args([1, 1, -1])\n end",
"def validate_args (args)\n\t# todo\nend",
"def test_check_args_invalid_negative\n args = CheckArgs.new\n assert_equal false, args.check_args([6, -2, -3])\n end",
"def validate_arguments(args={})\n return if args.count == 1 && args.key?(:all)\n\n only_options = args[:only] || Set.new\n except_options = args[:except] || Set.new\n skip_options = args[:skip] || Set.new\n\n unless (only_options & except_options).empty? &&\n (only_options & skip_options).empty?\n\n raise IncorrectArgumentException.new(\n nil,\n <<-TXT\n The same arguments shouldn't be used\n with different keys excluding except and skip\n TXT\n )\n end\n\n if args[:skip] == 'all' && args.count > 1\n raise IncorrectArgumentException.new(\n nil,\n <<-TXT\n Option 'skip' with argument 'all' shouldn't be used\n with another options\n TXT\n )\n end\n end",
"def test_check_args_invalid2\n args = CheckArgs.new\n assert_equal false, args.check_args([1, 2])\n end",
"def validate_arguments(args={})\n return if args.count == 1 && args.keys.include?(:all)\n only_options = args[:only] || Set.new\n except_options = args[:except] || Set.new\n skip_options = args[:skip] || Set.new\n unless (only_options & except_options).empty? &&\n (only_options & skip_options).empty?\n raise IncorrectArgumentException.new(nil, 'The same arguments shouldn\\'t be used with different keys excluding except and skip')\n end\n if args[:skip] == 'all' && args.count > 1\n raise IncorrectArgumentException.new(nil, 'Option \\'skip\\' with argument \\'all\\' shouldn\\'t be used with another options')\n end\n end",
"def test_negative_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,-2])\n\tend",
"def test_args_check_less\n\t\targs_checker = ArgsChecker::new\n\t\tarr = []\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def validate_arguments()\n usage unless ARGV.count > 0\nend",
"def arguments_valid?\n true \n # to do\n end",
"def check_arg()\n if ARGV.length > 1\n print \"ERROR: Too many command line args.\\n\"\n print \"USAGE: #{$PROGRAM_NAME} [--FixThemAll]\\n\"\n exit ERR_EXIT_ARGS2MANY\n end\n if ARGV.length == 1 && ARGV[0] != '--FixThemAll'\n print \"ERROR: Invalid argument on command line: '#{ARGV[0]}'\\n\"\n print \"USAGE: #{$PROGRAM_NAME} [--FixThemAll]\\n\"\n exit ERR_EXIT_ARGINVALID\n end\nend",
"def arguments_valid?\n true \n end",
"def check_args(args)\n args.count == 2 && args[0].to_i > 0 && args[1].to_i > 0\n rescue StandardError\n false\n end",
"def check_args(hash)\n if !hash.include? :hostname\n raise ArgumentError, \"You must provide a hostname\"\n elsif !hash.include? :service_name\n raise ArgumentError, \"You must provide a service name\"\n elsif !hash.include? :return_code\n raise ArgumentError, \"You must provide a return code\"\n elsif !hash.include? :status\n raise ArgumentError, \"You must provide a status\"\n end\n end",
"def test_check_args_invalid_string2\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI', 4, 'There'])\n end",
"def test_two_valid_arguments\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1])\n\tend",
"def arguments_valid?\n true\n end",
"def test_bad_argument\n assert_equal 1, go_with_args(%w(--this_is_really_redonculouslywrong))\n assert_match(/Error: bad arguments/, @stderr_io.string )\n end",
"def test_negative\r\n args = Args.new\r\n assert_equal false, args.check_args(\"hello\")\r\n end",
"def arguments_valid?\n true\n end",
"def validate_arguments\n if(!@options.parse || !@@sections.include?(@options.parse))\n @log.error \"select one of the following to parse: #{@@sections.join(\"|\")}\"\n exit!\n end\n \n if(!@options.download && !@options.file)\n @log.error \"Select either to download the file remotely or supply the given file\"\n exit!\n end\n \n if(!@options.output)\n @log.error \"supply an output directory with -o\"\n exit!\n end\n \n return true\n end",
"def invalid_arguments?(arguments, count)\n\t\targuments.length != count\n\tend",
"def test_check_num_args_invalid_negative\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,-1,-1])\n end",
"def test_check_num_args_invalid2\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1])\n end",
"def invalid_args!(message)\n raise InvalidCommandLine, message\n end",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def test_check_args_valid\n args = CheckArgs.new\n assert_equal true, args.check_args([-5, 2, 3])\n end",
"def test_neg_prospectors\n\t\trefute check_args([1, -1])\n\tend",
"def validate_args\n if name_args.size < 1\n ui.error('No cookbook has been specified')\n show_usage\n exit 1\n end\n if name_args.size > 2\n ui.error('Too many arguments are being passed. Please verify.')\n show_usage\n exit 1\n end\n end",
"def check_args(args)\n begin\n results = [Integer(args[0]), Integer(args[1])] \n rescue ArgumentError, TypeError\n puts 'Invalid input.' \n end\n args.count == 2 && results[1] >= 1\nrescue StandardError\n false\nend",
"def check_no_extra_args!\n if @argv.length > 0\n Braid::Command.handle_error(\n Braid::BraidError.new('Extra argument(s) passed to command.'))\n end\n end",
"def arguments_valid?\n true # no required arguments\n end",
"def test_check_args_invalid_zero\n args = CheckArgs.new\n assert_equal false, args.check_args([2, 0, 0])\n end",
"def test_check_args_invalid_string\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI'])\n end",
"def wrong_num_parameters?\n (ARGV.size != 1)\n end",
"def validate_arguments!(list)\n chk_idx = list.find_index do |item|\n item.start_with?(\"-\")\n end\n if chk_idx\n marker = list.find_index do |item|\n item == \"--\"\n end\n if marker.nil? || chk_idx.to_i < marker\n raise ArgumentError.new \"Unknown CLI option provided `#{list[chk_idx]}`\"\n end\n end\n list\n end",
"def test_positive\n args = Arguments.new\n assert_equal false, args.check_args(5)\n end",
"def errorCheck()\n\t# Debug output\n\tif $DEBUG then STDERR.puts \"in errorCheck()\" end\n\n\t# no args -> quit\n\tif ARGV.length == 0\n\t\tputs \"incorrect argument(s). usage: 'ruby name2number.rb <name1> <name2> <name3>..\"\n\t\texit\n\tend\n\n\t# special characters / numbers -> quit\n\tARGV.each do |arg|\n\t\tif arg !~ /^[a-zA-Z]+$/ then\n\t\t\tputs \"non-alphabetical character(s) detected. usage: 'ruby name2number.rb <name1> <name2> <name3>..\"\n\t\t\texit\n\t\tend \n\tend\nend",
"def invalid(*arguments)\n raise Invalid\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if (1..2).include? @arguments.length \n end",
"def validate(args = {})\n end",
"def check_arguments\n if (@ec2_user_id.nil? || @aws_access_key_id.nil? || @aws_secret_access_key.nil? || @host_role.nil? || ! ( @do_snapshot || @do_restore )) then\n raise ArgumentError, \"Missing command line parameter\"\n end\n end",
"def check_args(arguments)\r\n if arguments.length != 3\r\n puts 'There must be exactly three arguments: *seed*, *num_prospectors*, *num_turns*'\r\n return false\r\n elsif arguments[1].to_i.negative? || arguments[2].to_i.negative?\r\n puts 'Usage:'\r\n puts 'ruby ruby_rush.rb *seed* *num_prospectors* *num_turns*'\r\n puts '*seed* should be an integer'\r\n puts '*num_prospectors* should be a non-negative integer'\r\n puts '*num_turns* should be a non-negative integer'\r\n return false\r\n end\r\n true\r\nend",
"def foo(bar)\n unless allowed?(bar)\n raise \"bad bar: #{bar.inspect}\"\n end\nend",
"def check_requirement!(*args)\n args_length = args.length\n required_length = @required.length\n\n if args_length < required_length\n raise ArgumentError, \"Wrong number of arguments \" \\\n \"(#{args_length} for #{required_length}). \" \\\n \"Expected `#{@required.join(', ')}` as required arguments, \" \\\n \"but got `#{args.join(\", \")}`.\"\n end\n end",
"def normalize_pending_arguments(arguments)\n bad_argument_list!(arguments) unless arguments.empty?\n end",
"def validate(args, config)\n errors = ValidationErrors.new\n config.options.each do |(name, option)|\n validate_argument(args.option(name), option, errors) \\\n if args.options.key?(name.to_s)\n end\n raise(Cliqr::Error::IllegalArgumentError, \"illegal argument error - #{errors}\") \\\n unless errors.empty?\n args\n end",
"def test_check_num_args_invalid3\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1, 2])\n end",
"def test_one_ints\n args = Arguments.new\n assert_equal false, args.check_args([1])\n end",
"def test_positive\r\n args = Args.new\r\n assert_equal false, args.check_args(6)\r\n end",
"def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && !@options.password\n valid_args = false if @options.password && !@options.user\n valid_args\n end",
"def invalid_args(msg)\n puts \"#{msg}\\n\\n\"\n puts $opts\n exit\nend",
"def check_arguments arguments\n arguments.each_with_index do |argument, index|\n next if argument.is_a? Numeric\n next if argument.is_a? String\n next if argument.is_a? Symbol\n next if argument.is_a? Hash\n next if argument.is_a? NilClass\n next if argument.is_a? TrueClass\n next if argument.is_a? FalseClass\n\n raise ArgumentError, \"Cannot send complex data for block argument #{index + 1}: #{argument.class.name}\"\n end\n\n arguments\n end",
"def valid_arguments?\n arguments_passed? && right_type?\n end",
"def validate_args_count(expected, got)\n if (expected.is_a?(Numeric) and expected != got) or\n (expected.is_a?(Range) and !(expected === got))\n raise ArgumentError, \"wrong number of arguments for '#{name}' (#{got} for #{expected})\"\n end\n end",
"def test_arg_check_prospectors_negative\n def exit(x); 1; end\n ret = arg_check_prospectors '-1'\n assert_equal ret, -3\n end",
"def test_two_ints\n args = Arguments.new\n assert_equal false, args.check_args([1, 2])\n end",
"def arguments_valid?\n # TO DO - implement some real logic here\n true if @arguments.length == 1 \n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end",
"def checkValidOperation(array)\n if array.length < 2\n abort('Not enough arguments to perform an operation. Input string is invalid. Aborting')\n end\nend",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 2\n end",
"def verify_args(method, args)\n matches = Chassis.signatures[method].select do |key|\n args[key]\n end\n \n misses = Chassis.signatures[method] - matches\n \n unless misses.empty?\n raise \"Required arguments missing for '#{method}': #{misses.join(\", \")}\"\n end\n end",
"def arguments_valid?\n # Should be no remaining arguments\n true if @arguments.length == 0\n end",
"def valid_args?(args={})\n valid = false\n arguments.each do |name, argument|\n if argument[:required]\n return false if args[name] == nil\n end\n valid = argument.valid_input?(args[name])\n end\n return valid\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def incorrect_arg_size?(args)\n return false if has_splat_args?\n required_arg_size = @args.take_while {|e| e[1].nil? }.size\n args.size < required_arg_size || args.size > required_arg_size\n end",
"def test_arg_check_prospectors_valid\n ret = arg_check_prospectors '1'\n assert_equal ret, 0\n end",
"def arguments_valid?\n begin\n @validoptions = BoilermakerOptions.new(options)\n @validoptions.validate\n # pp @validoptions.args\n return @validoptions.args\n rescue => error\n # pp x.args\n puts error.message + \"\\n\"\n exit\n end\n end",
"def validate_argument(arg)\n raise ArgumentError, \"Argument #{arg} is not Fixnum\" unless arg.is_a? Fixnum\n raise ArgumentError, \"Argument #{arg} is negative\" if arg < 0\n end",
"def fail(*rest) end",
"def test_args_check_nil\n\t\targs_checker = ArgsChecker::new\n\t\tarr = nil\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def test_args_check_greater\n\t\targs_checker = ArgsChecker::new\n\t\tarr = [2, 4]\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def arguments_valid?\n true if @arguments.size >= 1 \n end",
"def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end",
"def test_check_num_args_invalid_zero\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,0,0])\n end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def acceptable? *args\n true\n end",
"def arguments_valid?\n # TODO - implement your real logic here\n true # if @arguments.length == 1\n end",
"def _argument_error(exp, rec, msg)\n exp = exp.join(\" or \") if exp.is_a?(Array)\n raise ArgumentError, sprintf(msg, exp, rec)\n end",
"def arguments_valid?\n true if @arguments.size > 1\n end",
"def validateArgs\n if ( ! ARGV[0] || ! ARGV[1])\n abort \"must provide two version numbers. try: tagdeleter.rb --help\"\n end\n end",
"def setup_args_valid?(argsArr)\r\n if nil==argsArr[0] or argsArr[0]==\"\"\r\n return \"Bot token cannot be empty or nil.\"\r\n elsif nil==argsArr[1] or argsArr[1]==\"\"\r\n return \"Bot clientId cannot be empty or nil.\"\r\n elsif nil==argsArr[2]\r\n return \"Bot command prefix cannot be nil.\"\r\n end\r\n\r\n return nil\r\n end",
"def check_if_user_gave_input\n abort(\"mkdiruby: missing input\") if ARGV.empty?\n abort(\"mkdiruby: input contains more than one argument\") if ARGV.count > 1\nend",
"def process_arguments\n if arguments_valid? \n process_command\n else\n raise ArgumentError\n end\n end",
"def validate(arg)\n arg.each do |arg|\n if arg[0].to_f > 90 || arg[0].to_f < -90\n msg = \"Latitude '#{arg[0]}' is invalid - must be between -90 and 90\"\n raise Error, msg\n end\n if arg[1].to_f > 180 || arg[1].to_f < -180\n msg = \"Longitude '#{arg[1]}' is invalid - must be between -180 and 180\"\n raise Error, msg\n end\n end\n end",
"def bail_args(arg_err)\n bail \"Error: bad arguments - #{arg_err}\\n Hint: Use -h or --help\"\n end",
"def arguments_valid?\n true if @arguments.length == argv_length \n end",
"def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The file you specified doesn't exist: #{@options.file}\" if File.exist?(@options.file) == false\n else\n @log.error \"Select a file using -f or --file FILE\"\n end\n \n if(@options.output)\n # not going to worry about this one.\n else\n @log.error \"No output was specified select using -o or --output\"\n end\n rescue LoadError => bam\n @log.error bam\n exit\n end\n \n return true\n end",
"def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The file you specified doesn't exist: #{@options.file}\" if File.exist?(@options.file) == false\n else\n @log.error \"Select a file using -f or --file FILE\"\n end\n \n if(@options.output)\n # not going to worry about this one.\n else\n @log.error \"No output was specified select using -o or --output\"\n end\n rescue LoadError => bam\n @log.error bam\n exit\n end\n \n return true\n end",
"def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The file you specified doesn't exist: #{@options.file}\" if File.exist?(@options.file) == false\n else\n @log.error \"Select a file using -f or --file FILE\"\n end\n \n if(@options.output)\n # not going to worry about this one.\n else\n @log.error \"No output was specified select using -o or --output\"\n end\n rescue LoadError => bam\n @log.error bam\n exit\n end\n \n return true\n end",
"def validate(*args, **kargs)\n end",
"def arguement_check(options)\n args = [\"access_key_id\", \"secret_access_key\", \"bucket_name\"] \n args.each do |arg|\n begin\n options.fetch(arg)\n rescue KeyError\n raise ArgumentError, \"Argument #{arg} is required.\"\n end\n end\n end",
"def valid_argument? name, type\n if name.nil? || name.empty? || name == type\n shell.say(\"ERROR: Invalid/missing argument.\") and false\n else\n true\n end\n end",
"def test_string\n args = Arguments.new\n assert_equal false, args.check_args(\"puppy\")\n end",
"def arguments_passed?\n !!(ARGV[0] && ARGV[1] && ARGV[2])\n end",
"def arguments_valid?\n\t\t # TO DO - implement your real logic here\n\t\t true if @arguments.length == 1\n\t\tend",
"def test_arg_check_turns_negative\n def exit(x); 1; end\n ret = arg_check_turns '-1'\n assert_equal ret, -4\n end",
"def validate_options!(options)\n return if options[:help] || options[:version]\n validate_date(options)\n raise MissingArgument, \"--repository or --config\" unless\n options[:repository] || options[:config]\n end",
"def validate_args(course, yoe_text)\n unless Config.read(\"courses\").has_key?(course)\n raise ArgumentError, %Q{Invalid course name \"#{course}\"}\n end\n\n yoe = yoe_text.to_i\n unless valid_years.include?(yoe)\n raise ArgumentError, %Q{Invalid year of entry \"#{yoe_text}\"}\n end\n end"
] |
[
"0.7541694",
"0.7461994",
"0.74147946",
"0.73032457",
"0.7283505",
"0.72121847",
"0.71826154",
"0.71557444",
"0.71118116",
"0.7058357",
"0.70359516",
"0.70178556",
"0.69858646",
"0.6973148",
"0.6946238",
"0.6929936",
"0.6918174",
"0.68965983",
"0.6891664",
"0.6891247",
"0.68804723",
"0.6869656",
"0.68559754",
"0.68514",
"0.6846492",
"0.6835884",
"0.6819227",
"0.6816743",
"0.6773298",
"0.67704576",
"0.67587423",
"0.67440736",
"0.67335683",
"0.67319363",
"0.67318785",
"0.6730266",
"0.67297745",
"0.6704883",
"0.67046815",
"0.6703345",
"0.67012256",
"0.66952044",
"0.66934407",
"0.6683985",
"0.66645545",
"0.66611475",
"0.6660836",
"0.66415644",
"0.66412264",
"0.6628965",
"0.6626967",
"0.66177607",
"0.65955037",
"0.65761316",
"0.65559775",
"0.65446985",
"0.6524611",
"0.6523682",
"0.65209806",
"0.6514144",
"0.6513818",
"0.6508443",
"0.65084255",
"0.65016085",
"0.6489649",
"0.647795",
"0.6475537",
"0.64614576",
"0.6460523",
"0.6449061",
"0.6440562",
"0.6437382",
"0.6429846",
"0.64107573",
"0.6397184",
"0.6396737",
"0.6389517",
"0.6389517",
"0.63840026",
"0.63831466",
"0.63696843",
"0.6356075",
"0.6354434",
"0.63449293",
"0.6339534",
"0.6306171",
"0.6304518",
"0.6297845",
"0.6296832",
"0.6274506",
"0.6274506",
"0.6274506",
"0.6272647",
"0.6261859",
"0.62554973",
"0.62547123",
"0.62542933",
"0.6245189",
"0.62421036",
"0.6230585",
"0.62202036"
] |
0.0
|
-1
|
we only support roundrobin placement for now
|
def monitor
loop do
sleep opts[:period]
group.engine.logger.info "#{group.banner}Monitoring group elasticity rule..."
# this is blocking because we don't want the rule to be triggered
# too many times.
if scale_up?
group.engine.logger.info "#{group.banner}Scaling up!"
manage(scale(:up))
elsif scale_down?
group.engine.logger.info "#{group.banner}Scaling down!"
manage(scale(:down))
else
group.engine.logger.info "#{group.banner}..."
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def robin; end",
"def distributePrimaryRegions(priRegions)\n c = HBaseConfiguration.new()\n admin = HBaseAdmin.new(c)\n servers = Array.new()\n dServers = Array.new()\n dServers = admin.getClusterStatus.getDeadServerNames()\n serv = admin.getClusterStatus.getServers()\n serv.each do |s|\n if (!dServers.include?(s))\n servers << s.getServerName()\n end\n end\n count=0\n totRS = servers.size()\n priRegions.each do |r|\n puts r+\" will move to \"+servers[count%totRS]\n move r,servers[count%totRS]\n count+=1\n end\n puts priRegions.size().to_s() + \"primary regions moved\"\nend",
"def initial_placement\n rover_bay.each do |r|\n if pass_initial_placement_check?(r)\n place_rover(r)\n else\n raise \"There is a collision\\nin placement #{r.coordinate.inspect}\"\n end\n end\n end",
"def crossover\n p1 = rand(@elements)\n p2 = rand(@elements)\n # to modify to p1 must be smaller than p2\n p1, p2 = p2, p1 if p2 < p1\n (p1..p2).each do |index|\n @tg[@s1][index], @tg[@s2][index] = @tg[@s2][index], @tg[@s1][index]\n end\n end",
"def crossover s1, s2\n b1, b2 = s1.map{|i| i.clone}, s2.map{|i| i.clone}\n if rand <= @crossover_rate\n point = rand_int(1, s1.length - 1)\n 0.upto(s1.length - 1) do |i|\n if i < point\n b2[i].path = s1[i].path\n else\n b1[i].path = s2[i].path\n end\n end\n end\n [b1, b2]\n end",
"def schedule_process_connections\n ProcessQueue.create(:type => \"apply_primary_tags\",\n :priority => 1,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_inner_connections\",\n :priority => 2,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_outer_connections\",\n :priority => 5,\n :params => [self.id])\n end",
"def round_robin(list, pairs = [])\n \n length = list.length\n halfway = (length / 2.0).ceil\n first_half = list[0..halfway - 1]\n second_half = list[halfway..]\n\n\n if length <= 2\n\n first = first_half[0]\n second = second_half[0] || ''\n pairs << [first, second] unless first == second\n\n return pairs\n else\n halfway.times do\n second_halves_used = []\n first_half.each do |first|\n found_second = false\n second_half.each do |second|\n next if second_halves_used.include?(second)\n next if pairs.any? { |pair| (pair[0] == first && pair[1] == second) || (pair[1] == first && pair[0] == second) }\n\n # second_half.delete(second)\n found_second = true\n pairs << [first, second]\n second_halves_used << second\n break\n end\n unless found_second\n pairs << [first, '']\n end\n end\n end\n pairs = round_robin(first_half, pairs)\n pairs = round_robin(second_half, pairs)\n return pairs\n end\nend",
"def reverse_overlap\n self.overlap.reverse\n end",
"def test_alignment_works_in_single_thread\n assert_nothing_raised(\"Can't handle single threaded scenario\") do\n SEQUENCE_GROUPS[0..10].each do |sequence_group|\n align_group(sequence_group)\n end\n end\n end",
"def snat_pool\n super\n end",
"def part2(grid)\n grid.non_overlapping.id\nend",
"def last_hop_pool\n super\n end",
"def cheap_broadcast; end",
"def generate_placement(ship)\n loop do\n coordinates = @board.cells.keys.each_cons(ship.length).to_a.sample\n if @board.valid_placement?(ship, coordinates)\n @board.place(ship, coordinates)\n break\n end\n end\n end",
"def in_parallel?; end",
"def test_parallel_segment?\n # 平行\n pos0 = Mageo::Vector3D[0.0, 0.0, 2.0]\n pos1 = Mageo::Vector3D[2.0, 0.0, 2.0]\n seg01 = Mageo::Segment.new(pos0, pos1)\n assert_equal(true , @t00.parallel_segment?(seg01))\n\n # 面に含まれる\n pos0 = Mageo::Vector3D[0.0, 0.0, 0.0]\n pos1 = Mageo::Vector3D[2.0, 0.0, 0.0]\n seg01 = Mageo::Segment.new(pos0, pos1)\n assert_equal(false, @t00.parallel_segment?(seg01))\n\n # 平行ではない。\n pos0 = Mageo::Vector3D[0.0,10.0, 0.0]\n pos1 = Mageo::Vector3D[0.0,10.0, 2.0]\n seg01 = Mageo::Segment.new(pos0, pos1)\n assert_equal(false, @t00.parallel_segment?(seg01))\n end",
"def move_regions(server)\n if server.class == String\n server = region_servers.find { |a| a.get_server_name.include? server }\n end\n #puts \"moving regions on RS:#{server.to_s}\"\n max_try = 10\n\n r_count = region_count(server)\n while (r_count !=0 && max_try > 0) do\n\n get_regions(server).each { |region|\n move_region(region, @previous_region_server)\n }\n\n sleep 1\n current_count = region_count server\n\n while (r_count > current_count)\n r_count= current_count\n sleep(3)\n end\n end\n @previous_region_server = Bytes.toBytes(server.getServerName())\n\n return max_try > 0\n end",
"def merge_ranges(schedule)\n merged_schedule = []\n\n schedule.each do |meeting|\n overlapping_time_slots = check_times(meeting, merged_schedule)\n merged_schedule -= overlapping_time_slots if merged_schedule.include?(overlapping_time_slots)\n merged_schedule << slot_merger(overlapping_time_slots)\n end\n\n merged_schedule\nend",
"def to_route_requests\n rr_arr = []\n hosts_1 = brand.hosts_for(sched1_cxr).uniq\n hosts_2 = brand.hosts_for(sched2_cxr).uniq\n\n hosts_1.each do |host1|\n hosts_2.each do |host2|\n rr1 = BrandedRouteRequest.where(brand: brand, origin: origin, dest: via,\n cxrs: [sched1_cxr], host: host1.code).first_or_create!\n rr2 = BrandedRouteRequest.where(brand: brand, origin: via, dest: dest,\n cxrs: [sched2_cxr], host: host2.code).first_or_create!\n\n rr_arr << [rr1,rr2]\n end\n end\n rr_arr\n end",
"def shard; end",
"def across_pool_state\n super\n end",
"def try_to_join_leading_ranges\n if @allocated_ranges[1] && @allocated_ranges[0].last.succ == @allocated_ranges[1].first\n @allocated_ranges[0] = (@allocated_ranges[0].first..@allocated_ranges[1].last)\n @allocated_ranges.delete_at(1)\n end\n end",
"def create_pairs(teams)\n return RoundRobinTournament.schedule(teams.shuffle)\nend",
"def test_ships_overlap?\n board = Board.new\n cruiser = Ship.new('Cruiser', 3)\n board.place(cruiser, [\"A1\", \"A2\", \"A3\"])\n submarine = Ship.new(\"Submarine\", 2)\n assert_equal true, board.ship_overlap?(submarine, [\"A1\", \"B1\"])\n\n assert_equal false, board.valid_placement?(submarine, [\"A1\", \"B1\"])\n assert_equal true, board.valid_placement?(submarine, [\"C1\", \"C2\"])\n end",
"def computer_place\n # Place each ship using random coordinates.\n count = 1\n ships.each do |ship|\n # Set the initial random coordinate into the ship_array.\n ship_array = [random_cell(empty_board_cells)]\n \n # Until the coordinates are valid, keep finding new coordinates.\n until board.valid_placement?(ship, ship_array) do\n # Find the adjecent cells, then select one to add to ship array.\n ship_array = adj_cell(ship_array)\n\n # Check if the array has valid coordinates.\n ship_array = valid_cells(ship_array)\n\n # If the array has no valid coordinates after culling re-choose intial coordinate. If the initial selection is bad, after four iterations reselect seed.\n if ship_array.length == 1 || count == 4\n ship_array = [random_cell(empty_board_cells)]\n count = 0\n end\n count += 1\n end\n board.place(ship, ship_array)\n end\n end",
"def conflict_position # conflict always happen at sc2\n @left_to_right ? @sc2.position : (@sc2.position + @sc1.internal_distance)\n end",
"def star_cluster; end",
"def pool; end",
"def pool; end",
"def ordered_topologically\n @ordered_topologically ||= super\n end",
"def active_remote_destinations; end",
"def schedule(start = 0, stop = 100)\n\n # Sort intervals by end point asc\n # iterate from left to right\n # at each endpoint find the max weight from the start to that endpoint\n # Make a comparison if the start of the interval is after the end of the previous \"checkpoint\"\n # add the weight adn that is the new checkpoint\n # if it overlaps then select the larger of the two endpoints\n # This is almost right but not quite\n # we want to break up at previously weighed sectionif we need to\n # we shodul get keep the list of all endpoints weights\n\n # x---x\n # x----x\n # x-------x\n\n # 1,4,3\n # 5,9,4\n # 7,12,5\n\n # Keep the checkpoints here\n # [4:3, 9:7]\n # then see 7,12,5\n # choose 5 or 7 we'd say 7 and may want to do say 7 is max from 0<=>12\n # but if we split it up\n # [4:3, 9:7, 12:8]\n # we could get max 8 if we exclude the middle one\n\n endpoints = []\n interval_list = sort(@interval_list)\n\n interval_list.each do |interval|\n max_weight = interval.weight\n steps = []\n\n # endpoint list is sorted so ya konw we could just do binary search here\n # woudl bring the whoel thing down to nlgn\n endpoints.reverse.each do |endpoint|\n if interval.start > endpoint.stop\n max_weight += endpoint.best_weight\n steps = endpoint.steps.clone\n break\n end\n end\n\n # If we do better by ignoring this interval than record that\n if endpoints.last && endpoints.last.best_weight > max_weight\n max_weight = endpoints.last.best_weight\n steps = endpoints.last.steps\n else\n steps << interval\n end\n\n endpoints << EndpointWeight.new(interval.stop, max_weight, steps)\n end\n\n # endpoints is non-decrasing with each entry. Last must be max\n puts endpoints.last\n endpoints.last.best_weight\n end",
"def place_random_ship\n unless full?\n placement = []\n placement << (0...@grid.length).to_a.shuffle.first\n placement << (0...@grid[0].length).to_a.shuffle.first\n @grid[placement[0]][placement[1]] = :s\n else\n raise 'Board is full'\n end\n\n end",
"def parallelize_me!; end",
"def replicas; end",
"def shift_down_next_tasks\n return if next_associated_tasks.empty?\n\n # Shift down next task order_index starting\n # from the current index if the current object is deleted\n # from the next index if the current object exists\n new_order = destroyed? ? order_index : order_index + 1\n\n next_associated_tasks.each do |task|\n task.update_columns(order_index: new_order)\n new_order += 1\n end\n end",
"def reserve_and_run_one_job; end",
"def twopoint_crossover(parent1, parent2, percent1, percent2)\n point1 = parent1.size * percent1/100.0\n point2 = parent1.size - parent1.size * percent2/100.0\n parent1[point1..point2] = parent2[point1..point2]\n parent1\n end",
"def point_crossover(other, n)\n indexes = (0...self.size).to_a # Insieme degli indici possibili\n points = [] # Insieme di punti di taglio del crossover\n n.times { points.push(indexes.delete_at(rand(indexes.size))) } # Prende casualmente n indici (diversi) possibili e li include in points\n a, b = self, other \n son_str = (0...self.size).map do |i|\n a, b = b, a if points.include?(i) # Se incontra un punto di crossover effettua uno swap\n a[i] # Elemento da includere in son\n end\n son_str\n end",
"def next_rid; end",
"def crossover(parent1, parent2, rate)\n # print \".\" # added by YKY\n return \"\"+parent1 if rand() >= rate\n point = 1 + rand(parent1.size - 2)\n return parent1[0...point] + parent2[point...(parent1.size)]\nend",
"def generate_occupied_points(a_size, a_origin, a_direction)\n\toccupied = [a_origin]\t\n\tneighbor = a_origin\n\t(a_size - 1).times do \n\t\tneighbor = neighbor.next_at(a_direction)\n \t\toccupied = occupied + [neighbor]\n\tend\t\n\tset_occupied_points(occupied) \n end",
"def mergeGbkSeq\n \nend",
"def child_overlap_enlargement (child,data)\n # DEBUG \"child_overlap_enlargement called on #{child},#{data}\" # DEBUG\n # DEBUG \"child_overlap(#{child},\\n #{child.clone.insert_data(data)}) = \" +\n # \"#{child_overlap(child,child.clone.insert_data(data))}\"\n # DEBUG \"child_overlap(#{child} = #{child_overlap(child)}\"\n # remove second parameter from insert_data after proper debug\n # DEBUG_OFF()\n overlap = child_overlap(child,child.clone.just_insert_data(data)) - child_overlap(child)\n # DEBUG_ON()\n overlap\n end",
"def taskswap priority\n @cur_proc_id = @queue[priority].shift||@cur_proc_id\n (@queue[priority] << @cur_proc_id) if priority == 0\n @timeslice = 0\n end",
"def workers(count); end",
"def primary()\n while true\n moves = []\n map = $network.frame\n\n (0...map.height).each do |y|\n (0...map.width).each do |x|\n loc = Location.new(x, y)\n site = map.site(loc)\n\n next if site.owner != $tag\n\n next if should_wait(map, site)\n\n valid = valid_moves(map, loc)\n if valid.empty?\n opts = $directions\n #opts = site.strength == 255 ? directions : ([GameMap::DIRECTIONS[0] ] + directions\n moves << Move.new(loc, opts.shuffle.first)\n else\n moves << Move.new(loc, valid.shuffle.first)\n end\n\n end\n end\n\n $network.send_moves(moves)\n end\nend",
"def pre_sync\n #move\n end",
"def reposition_queue\n task_queue = TaskQueue.where(user_id: user_id, task_type_id: task_type_id)\n if task_queue.pluck(:position).any? {|pos| pos > position}\n task_queue.where(\"position > ?\", position).each do |queue_item|\n queue_item.update(:position => (queue_item.position - 1))\n end\n end\n end",
"def canonocalize_hops!()\n # Sort\n @hops = @hops.sort_by { |hop| hop.ttl }\n\n # Fill in gaps\n return if @hops.empty?\n return if @hops[-1].ttl > 45 # packet corruption perhaps...\n @hops.each_with_index do |hop, i|\n return if i+1 == @hops.size\n # look ahead to the next hop\n next_hop = @hops[i+1]\n if next_hop.ttl != hop.ttl + 1\n filler_hop = Hop.new\n filler_hop.ip = \"0.0.0.0\"\n filler_hop.ttl = hop.ttl + 1\n # on next iteration, this will be the current hop\n @hops.insert(i+1, filler_hop)\n end\n end\n end",
"def populate\n self.start_coordinate_x = rand(11)\n self.start_coordinate_y = rand(11)\n if ship_position == 'vertical'\n self.end_coordinate_x = self.start_coordinate_x\n self.end_coordinate_y = (self.start_coordinate_y + SHIP_SIZE) > MAX_SIZE_BOARD ? (self.start_coordinate_y - SHIP_SIZE) : (self.start_coordinate_y + SHIP_SIZE)\n else\n self.end_coordinate_y = self.start_coordinate_y\n self.end_coordinate_x = (self.start_coordinate_x + SHIP_SIZE) > MAX_SIZE_BOARD ? (self.start_coordinate_x - SHIP_SIZE) : (self.start_coordinate_x + SHIP_SIZE)\n end\n end",
"def compute(name, ref, span, snps)\n return if span.length < 1\n\n span.sort! {|a,b| a[0] <=> b[0]}\n head = span.shift\n ss,ee = head[0],head[1]\n array = []\n \n array << ss \n span.each do |breaks|\n array << breaks[0]\n array << breaks[1]\n end\n array << ee \n\n while array.size > 0\n s = array.shift\n e = array.shift\n# $stderr.puts \"#{ref}\\t#{s}\\t#{e}\"\n (s..e).each do |i|\n @coverage[ref][i] += 1 #Compute coverage on base i\n end\n end\n\n snps.each_key do |pos|\n refbase = @seq[ref][pos-1,1].upcase\n curbase = snps[pos][:snpbase]\n if snps.key?(pos + 1) or snps.key?(pos + 2) or snps.key?(pos - 1) or snps.key?(pos - 2)\n if snps.key?(pos + 1) and refbase == snps[pos+1][:snpbase] and curbase == @seq[ref][pos,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos - 1) and refbase == snps[pos-1][:snpbase] and curbase == @seq[ref][pos-2,1].upcase \n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos + 2) and refbase == snps[pos+2][:snpbase] and curbase == @seq[ref][pos+1,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos - 2) and refbase == snps[pos-2][:snpbase] and curbase == @seq[ref][pos-3,1].upcase\n snps[pos][:info] << \"swap;\"\n elsif snps.key?(pos + 1) or snps.key?(pos - 1) \n snps[pos][:info] << \"mnp;\"\n else\n snps[pos][:info] << \"snp;\" \n end\n else\n snps[pos][:info] << \"snp;\" \n end\n @snp[ref][pos] = '' unless @snp[ref].key?(pos)\n @snp[ref][pos] << snps[pos][:info]\n end\nend",
"def edgeb_network(cmd)\n node = $node_info.new \n $lock.synchronize{\n \n node.src = $hostname\n node.dst = cmd[1]\n node.cost = 1\n node.nexthop = cmd[1]\n $rt[cmd[1]] = node\n if $local_ip == nil then $local_ip = cmd[2] end\n\n $network.undir_connection($hostname, cmd[1], cmd[3].to_i, 1) \n }\n #puts \"THIS IS THE ROUTING TABLE: #{$rt}\"\nend",
"def explore\n rover_bay.each do |r|\n if pass_path_check?(r)\n move(r)\n else\n raise \"There is a collision\\nin placement #{r.coordinate.inspect}, please revise instruction set #{r.command.inspect}\"\n end\n end\n end",
"def run( current, positions, iterations, num_values )\n iterations.times do \n slice_start = current.next\n current.next = current.next.next.next.next\n destination = nil\n backoff = 1\n \n while ! destination \n search_for_label = current.value - backoff\n if search_for_label < 1\n search_for_label += num_values\n end \n destination = positions[search_for_label]\n if destination.value == slice_start.value ||\n destination.value == slice_start.next.value ||\n destination.value == slice_start.next.next.value \n destination = nil\n backoff += 1\n end\n end\n \n after_slice = destination.next\n destination.next = slice_start\n slice_start.next.next.next = after_slice\n current = current.next\n end\nend",
"def balanced_shard\n # TODO Disabling balanced shard until we rework counts to go faster\n #@_ar_sharded_balance_count ||= 0\n #@_ar_sharded_semaphore ||= Mutex.new\n #returning_shard = nil\n #\n ## Do a thread sync on the balancing agent so we don't rebalance while\n ## we are retrieving a shard class\n #@_ar_sharded_semaphore.synchronize do\n #\n # # Rebalance every 10000 lookups\n # if @_ar_sharded_balance_count.to_i > 10000\n # @_ar_sharded_laggers = []\n #\n # # Find the leaders count\n # # TODO this is a bottle neck on large sets.\n # max_count = 0\n # @_ar_cached_shard_classes.each do |shard_class|\n # curr_count = shard_class.count\n # max_count = curr_count if curr_count > max_count\n # end\n #\n # # Designate the laggers\n # # You are a lagger if you are 10% behind the leader\n # @_ar_cached_shard_classes.each do |shard_class|\n # curr_count = shard_class.count\n # @_ar_sharded_laggers << shard_class if (max_count * 0.9) > curr_count\n # end\n #\n # #After rebalancing reset the counter\n # @_ar_sharded_balance_count = 0\n # end\n #\n # # If we have laggers favor them half the time to have them catch up\n # if @_ar_sharded_laggers.present? && rand >= 0.5\n # returning_shard = @_ar_sharded_laggers.sample\n # else\n # returning_shard = random_shard\n # end\n #\n # @_ar_sharded_balance_count += 1\n #end\n #\n #returning_shard\n @_ar_cached_shard_classes.sample\n end",
"def crossover!(random, rate, c1, c2)\n \n # Perform crossover operation on a set proportion of requests.\n return unless rate <= random.rand\n\n # Calculate crossover points X and Y, then swap the substrings between\n # the two input chromosomes at those loci.\n x = random.rand(1...([c1.length, c2.length].min - 1))\n y = random.rand(x...([c1.length, c2.length].min))\n\n # Use a temporary buffer to perform the swap.\n t = c1[x...y]\n c1[x...y] = c2[x...y]\n c2[x...y] = t\n\nend",
"def place_ships!\n\t\t[\n\t\t\t['T', 2],\n\t\t\t['D', 3],\n\t\t\t['S', 3],\n\t\t\t['B', 4],\n\t\t\t['C', 5]\n\t\t].each do |ship|\n\t\t\tplace_ship(ship[0], ship[1])\n\t\tend\n\tend",
"def original_scheduling_initial!(partitions)\n # Phase 1: Sort partitions by sites.size\n partitions.sort_by_sites!\n\n # Phase 2: Initial filling\n bin_assigner = 0\n full_bins = 0\n partitions.size.times do\n if @list[bin_assigner].total_sites + partitions.first.sites.size <= @sites_lower_bound\n @list[bin_assigner].add!([partitions.first])\n partitions.drop!(1)\n\n # Edge case handling for perfect fit\n if @list[bin_assigner].total_sites == @sites_lower_bound\n full_bins += 1\n @sites_lower_bound -= 1 if full_bins == @list.size - @sites_rounding_adjustment\n end\n\n else\n break\n end\n\n bin_assigner = (bin_assigner + 1) % @list.size\n end\n partitions\n end",
"def order; end",
"def order; end",
"def placement_groups\n @placement_groups ||= init_placement_groups\n end",
"def pile_over(a, b)\n move_array(a, b)\n end",
"def organizingContainers2(containers)\n containers.each_with_index do |current_container, index|\n # Ball in current index of current_container will not move\n # For example, container 0 with ball 0\n\n # Loop through other containers\n containers[index+1..-1].each_with_index do |other_container, index2|\n ball_n = index + 1 + index2\n next if other_container[ball_n] == 0 || current_container[ball_n] == 0\n\n # Swap balls between two containers\n diff = [current_container[ball_n], other_container[index]].min\n\n current_container[index] += diff\n current_container[ball_n] -= diff\n other_container[index] -= diff\n other_container[ball_n] += diff\n end\n\n # If after going through all other containers, still have other balls in current container\n if current_container[index+1..-1].sum > 0\n return 'Impossible'\n end\n end\n\n 'Possible'\nend",
"def round_robin_pairings(tournament)\n pairs = {}\n players = tournament.players.to_a\n\n players.each do |player|\n other_players(player, players).each do |opponent|\n pairs[key_for(player, opponent)] ||= { home_player: player, away_player: opponent }\n end\n end\n\n pairs\n end",
"def onepoint_crossover(parent1, parent2, percent)\n point = parent1.size * percent/100.0\n parent1[0..point] = parent2[0..point]\n parent1\n end",
"def connection_pool_ramp_increment\n super\n end",
"def place_object\n @board.place_object *next_position\n end",
"def assign_batches(runs = self.all)\n current_batch = 1\n #sort by when it was created\n runs = runs.sort{|a, b| a.created_at <=> b.created_at}\n runs.each_with_index do |s, i|\n if i > 0 and s.created_at - runs[i - 1].created_at > TimeBetweenBatches\n current_batch += 1\n end\n s.batch = current_batch\n end\n end",
"def arrange\n\t\t\n\tend",
"def make_outer_connections\n per_batch = 1000\n\n outer_neigh = Answer.where(:question_id.ne => self.question_id, :team_id => self.team_id).shuffle[0..99]\n\nouter_neigh.each do |a|\n #0.step(outer_neigh.count, per_batch) do |offset|\n # outer_neigh.limit(per_batch).skip(offset).each do |a|\n if self.id != a.id\n SimilarityMachine::create_connection(self,a)\n end\n # end\n #end\nend\n\n true\n end",
"def adapted_scheduling_initial!(partitions)\n bin_index = 0\n full_bins = 0\n partitions.size.times do\n if @list[bin_index].size + partitions.first.size <= @operations_lower_bound\n @list[bin_index].add!([partitions.first])\n partitions.drop!(1)\n\n # Edge case handling for perfect fit\n if @list[bin_index].size == @operations_lower_bound\n full_bins += 1\n @operations_lower_bound -= 1 if full_bins == @list.size - @operations_rounding_adjustment\n end\n\n else\n break\n end\n\n bin_index = (bin_index + 1) % @list.size\n end\n @list = @list.sort\n\n partitions\n end",
"def replaced(from, to)\n\t\tsuper if defined? super\n\t\tif (from.distribute? && to.distribute?) && (to.self_owned? || from.self_owned?)\n\t\t unless Distributed.updating?(self) || (Distributed.updating?(from) && Distributed.updating?(to))\n\t\t\tDistributed.each_updated_peer(from) do |peer|\n\t\t\t peer.transmit(:plan_replace, self, from, to)\n\t\t\tend\n\t\t end\n\t\tend\n\t end",
"def test_it_denies_valid_placement_if_ship_is_in_any_cells\n # Testing first ship\n @board.place(@cruiser, [\"A1\", \"A2\", \"A3\"])\n assert_equal false, @board.valid_placement?(@submarine, [\"A1\", \"B1\"])\n assert_equal false, @board.valid_placement?(@submarine, [\"A2\", \"B2\"])\n assert_equal false, @board.valid_placement?(@submarine, [\"A3\", \"B3\"])\n\n assert_equal true, @board.valid_placement?(@submarine, [\"B1\", \"B2\"]) # Horizontal\n assert_equal true, @board.valid_placement?(@submarine, [\"B1\", \"C1\"]) # Vertical\n end",
"def avoid_roads(width, height, bad)\n\n routes = Array.new(height + 1) { Array.new(width + 1) { 0 } } # how many routes to a block?\n\n routes.each_with_index do |row, i|\n row.each_index do |j|\n if (i == 0 && j == 0)\n routes[0][0] = 1\n elsif i == 0\n routes[i][j] = routes[0][j - 1] unless is_obstructed?(i, j, i, j - 1, bad)\n elsif j == 0\n routes[i][j] = routes[i - 1][0] unless is_obstructed?(i, j, i - 1, j, bad)\n else\n top = (is_obstructed?(i, j, i - 1, j, bad) ? 0 : routes[i - 1][j])\n left = (is_obstructed?(i, j, i, j - 1, bad) ? 0 : routes[i][j - 1])\n routes[i][j] = top + left\n end\n end\n end\n\n return routes[height][width]\nend",
"def swap; end",
"def left\n check_placement\n\n super\n end",
"def multi_parent_crossover(random, parents)\n Array.new(parents[0].length) { |i| parents[random.rand(parents.length)][i] }\nend",
"def broadcasting; end",
"def redistribute_to_segments(seg_one, scpos_one, seg_two, scpos_two, remaining_cluster)\n #scpos is short for 'segment center position'\n sc1x, sc1y = scpos_one[0], scpos_one[1]\n sc2x, sc2y = scpos_two[0], scpos_two[1]\n\n first_seg = seg_one\n second_seg = seg_two\n remaining_cluster.each do |x,y|\n s1_xdiff_sq = (sc1x - x) ** 2\n s1_ydiff_sq = (sc1y - y) ** 2\n s1_sq_sum = s1_xdiff_sq + s1_ydiff_sq\n s1_distance = s1_sq_sum ** 0.5\n\n s2_xdiff_sq = (sc2x - x) ** 2\n s2_ydiff_sq = (sc2y - y) ** 2\n s2_sq_sum = s2_xdiff_sq + s2_ydiff_sq\n s2_distance = s2_sq_sum ** 0.5\n \n if s1_distance < s2_distance\n first_seg << [x,y]\n elsif s2_distance < s1_distance\n \tsecond_seg << [x,y]\n else #if their distances are equal, send to the smaller of the two segments\n \tif first_seg.length < second_seg.length \n \t first_seg << [x,y]\n \telse\n \t second_seg << [x,y]\n \tend\n end\n end\n segments = [first_seg, second_seg]\n return segments \t\n end",
"def move\n super\n gravitize\n end",
"def move_pile(play1, play2)\n if play2.empty?\n play2.concat(play1)\n play1.clear\n elsif (within_one?(play1[0].rank.to_i, play2[-1].rank.to_i))\n play2.concat(play1)\n play1.clear\n else\n end\nend",
"def run_order\n 0\n end",
"def run_order\n 0\n end",
"def placement\n\t\t[\n\t ['Champ', 16],\n\t ['Runner-up', 12],\n\t ['Third', 10],\n\t ['Fourth', 9],\n\t ['Fifth', 7],\n\t ['Sixth', 6],\n\t ['Seventh', 4],\n\t ['Eighth', 3]\n\t]\n\n\tend",
"def strategy\n BatchApi::Processor::Sequential\n end",
"def exchange\n offspring = Route.new self\n offspring.operation = \"exchange\"\n \n # pick three indices at least two apart\n begin\n indices = Array.new(3) { rand(points.size + 1) }.sort\n end until (indices[0] - indices[1]).abs >= 1 &&\n (indices[1] - indices[2]).abs >= 1\n\n # return the points such that those b/w the pairs of indices are\n # exchanged\n offspring.points =\n @points[0...indices[0]] +\n @points[indices[1]...indices[2]] +\n @points[indices[0]...indices[1]] +\n @points[indices[2]...points.size]\n\n offspring\n end",
"def move_lower_in_queue\n return unless lower_item_in_queue\n\n acts_as_queue_class.transaction do\n lower_item_in_queue.decrement_queue_position\n increment_queue_position\n end\n end",
"def testReorderingChangingCrossPartition\n executeSimpleTest(\n [ [ 'T1', 'R1', 900, 5, ['T2'], '==== ='],\n [ 'T2', 'R2', 800, 2, [], ' =='],\n [ 'T3', 'R2', 700, 2, ['T4'], ' =='],\n [ 'T4', 'R1', 600, 2, ['T5'], ' =='],\n [ 'T5', 'R3', 1000, 2, [], ' =='],\n [ 'T6', 'R4', 100, 5, ['T5'], '====='],\n [ 'T7', 'R2', 200, 2, ['T8'], '=='],\n [ 'T8', 'R5', 2000, 2, [], ' =='],\n [ 'T9', 'R6', 300, 3, ['T8'], '==='] ] )\n end",
"def shift_servers!\n srv = @servers.pop\n if srv\n @servers.unshift(srv)\n srv\n end\n end",
"def initiate\n primary, *secondaries = @nodes.shuffle\n\n primary.promote\n secondaries.each(&:demote)\n\n return primary, secondaries\n end",
"def create_master_schedule_work_orders\n create_course_offerings_work_order(\"elementary\")\n create_course_offerings_work_order(\"middle\")\n create_course_offerings_work_order(\"high\")\n end",
"def crossover(city_names2)\n # Copy 2 cities at a time thereby preserving the edge between them\n city_names_new = []\n max_index = city_names.size - 1\n index = 0\n while index <= max_index - 1\n parent = (rand > 0.5 ? @city_names : city_names2)\n city_names_new << parent[index] << parent[index + 1]\n index += 1\n end\n \n # Remove dup cities\n city_names_new.uniq!\n \n # Make a list of missing cities\n missing_cities = []\n city_names.each do |city| \n missing_cities << city unless city_names_new.include?(city)\n end\n \n city_names_new.concat(missing_cities)\n @city_names = city_names_new\n @type = \"Hybrid\"\n end",
"def move_disk(from,to)\n @towers[to] << @towers[from][-1]\n @towers[from].pop\n nil\nend",
"def place x, y, horizontal\n if @ship_holes.empty?\n @length.times do |a, b| \n @ship_holes << Hole.new(x,y)\n if horizontal \n x += 1\n else\n y += 1\n end\n end\n end\n end",
"def make_inner_connections\n per_batch = 1000\n\n inner_neigh = Answer.where(:question_id => self.question_id, :team_id => self.team_id).shuffle[0..99]\n\ninner_neigh.each do |a|\n #0.step(inner_neigh.count, per_batch) do |offset|\n # inner_neigh.limit(per_batch).skip(offset).each do |a|\n if self.id != a.id\n SimilarityMachine::create_connection(self,a)\n end\n #end\n # end\nend\n\n true\n end",
"def testTasksReorderingWithPredecessor\n # TODO: Code the interchangeable days feature, and uncomment after\n# executeSimpleTest(\n# [ [ 'T1', 'R1', 800, 4, [], '=== ='],\n# [ 'T2', 'R2', 100, 2, ['T3'], '=='],\n# [ 'T3', 'R1', 500, 2, ['T4'], ' =='],\n# [ 'T4', 'R3', 900, 2, [], ' =='],\n# [ 'T5', 'R4', 200, 5, ['T4'], '====='] ] )\n executeSimpleTest(\n [ [ 'T1', 'R1', 800, 4, [], '== =='],\n [ 'T2', 'R2', 100, 2, ['T3'], '=='],\n [ 'T3', 'R1', 500, 2, ['T4'], ' =='],\n [ 'T4', 'R3', 900, 2, [], ' =='],\n [ 'T5', 'R4', 200, 5, ['T4'], '====='] ] )\n end",
"def crossover(p0, p1)\n children = []\n if rand < @rate\n c0, c1 = Chromosome.new, Chromosome.new\n min = [p0.length, p1.length].min\n index = rand(min)\n for i in index...min\n c0 << p0[i].copy\n c1 << p1[i].copy\n end\n children << fill(c0, p1)\n children << fill(c1, p0)\n end\n children\n end",
"def execute_merger(placed_sur_tiles, orphan, placed_tile)\n other_tiles = []\n if orphan\n num = 1\n else\n num = 0\n end\n hotel_name1 = placed_sur_tiles[0].hotel\n hotel_name2 = placed_sur_tiles[1].hotel\n game_hotel1 = self.game_hotels.where(name: hotel_name1).first\n game_hotel2 = self.game_hotels.where(name: hotel_name2).first\n if game_hotel1.chain_size > game_hotel2.chain_size || game_hotel1.chain_size == game_hotel2.chain_size\n dominant_hotel = game_hotel1.hotel\n acquired_hotel = game_hotel2\n self.acquired_hotel = game_hotel2.name\n self.dominant_hotel = game_hotel1.name\n self.save\n color = dominant_hotel.color\n c = game_hotel2.hotel.color\n game_tiles = self.game_tiles.where(hotel: hotel_name2)\n game_tiles.each do |tile|\n tile.hotel = dominant_hotel.name\n tile.save\n temp = [tile.tile.row, tile.tile.column, c]\n other_tiles << temp\n end\n placed_tile.hotel = dominant_hotel.name\n placed_tile.save\n acquired_hotel_size = game_hotel2.chain_size\n game_hotel1.chain_size += game_tiles.length + num + 1\n game_hotel1.save\n game_hotel1.update_share_price\n game_hotel2.chain_size = 0\n game_hotel2.save\n game_hotel2.update_share_price\n elsif game_hotel2.chain_size > game_hotel1.chain_size\n dominant_hotel = game_hotel2.hotel\n acquired_hotel = game_hotel1\n self.acquired_hotel = game_hotel1.name\n self.dominant_hotel = game_hotel2.name\n self.save\n color = dominant_hotel.color\n c = game_hotel1.hotel.color\n game_tiles = self.game_tiles.where(hotel: hotel_name1)\n game_tiles.each do |tile|\n tile.hotel = dominant_hotel.name\n tile.save\n temp = [tile.tile.row, tile.tile.column, c]\n other_tiles << temp\n end\n placed_tile.hotel = dominant_hotel.name\n placed_tile.save\n acquired_hotel_size = game_hotel1.chain_size\n game_hotel2.chain_size += game_tiles.length + num + 1\n game_hotel2.save\n game_hotel2.update_share_price\n game_hotel1.chain_size = 0\n game_hotel1.save\n game_hotel1.update_share_price\n end\n\n [color, other_tiles, dominant_hotel, acquired_hotel, acquired_hotel_size]\n end",
"def greedy1_fill!(remaining_partitions)\n remaining_partitions.each do |src_partition|\n # Test each site ...\n src_partition.sites.each do |site|\n\n simulation_result_below_bound = {}\n simulation_result_above_bound = {}\n # ... in each bin ...\n self.each_with_index do |bin, bin_index|\n target_partition = bin.list[src_partition.name]\n if target_partition.nil?\n # Creating a new partition is more costly than the worst case\n operations = @operations_worst_case + 1\n else\n # Simulate insertion of site into existing partition of current bin\n operations = target_partition.incr_add_sites!([site], simulate = true)\n end\n # Check if bin.size is smaller than lower_bound. Save simulation_result accordingly to prefer addition below lower_bound.\n if bin.update_size!.size < @operations_lower_bound\n simulation_result_below_bound.merge!({operations => bin_index})\n else\n simulation_result_above_bound.merge!({operations => bin_index})\n end\n\n end\n\n # Insert at lowest operation cost\n best = if simulation_result_below_bound.empty?\n simulation_result_above_bound.min_by { |operations, bin_index| operations }\n else\n simulation_result_below_bound.min_by { |operations, bin_index| operations }\n end\n target_partition = @list[best[1]].list[src_partition.name]\n if target_partition.nil?\n @list[best[1]].add!([Partition.new(src_partition.name, [site], src_partition.tree)])\n else\n target_partition.incr_add_sites!([site])\n end\n\n end\n end\n end",
"def joinToOnBoardList(onBoardList)\n onBoardList.each{|demand|\n self.addSharedWith(demand) ;\n demand.addSharedWith(self) ;\n }\n end"
] |
[
"0.6329997",
"0.5912668",
"0.58263886",
"0.5501614",
"0.53285956",
"0.5323742",
"0.5299722",
"0.5284247",
"0.5208789",
"0.5192774",
"0.51694274",
"0.51518357",
"0.5129385",
"0.51264477",
"0.5107037",
"0.5098357",
"0.5088619",
"0.50847155",
"0.50799716",
"0.50762427",
"0.5071099",
"0.5045757",
"0.5023014",
"0.49948794",
"0.4985015",
"0.49818003",
"0.49781343",
"0.4947746",
"0.4947746",
"0.492096",
"0.4918249",
"0.49067542",
"0.49052396",
"0.48766866",
"0.4868785",
"0.48652536",
"0.48601535",
"0.48583925",
"0.48566326",
"0.4854397",
"0.48512894",
"0.48484698",
"0.48400524",
"0.48149556",
"0.48106572",
"0.48058084",
"0.47990435",
"0.47980225",
"0.4790322",
"0.4782839",
"0.47739258",
"0.47715583",
"0.4755755",
"0.47550815",
"0.47549257",
"0.47536498",
"0.47514775",
"0.47492784",
"0.47451252",
"0.47362992",
"0.47362992",
"0.47297165",
"0.472863",
"0.47273844",
"0.47236493",
"0.47223198",
"0.47186944",
"0.47167784",
"0.4713598",
"0.4711793",
"0.47098768",
"0.4709652",
"0.47017878",
"0.4701252",
"0.46953872",
"0.46897238",
"0.4686064",
"0.46841508",
"0.46765187",
"0.4663804",
"0.46611163",
"0.46585009",
"0.46524262",
"0.46524262",
"0.46380514",
"0.463793",
"0.4633988",
"0.46283504",
"0.46258724",
"0.46251804",
"0.46245322",
"0.46226567",
"0.46198085",
"0.46135464",
"0.46135044",
"0.46119148",
"0.46109617",
"0.46020237",
"0.4601727",
"0.45972553",
"0.45952672"
] |
0.0
|
-1
|
GET /preparar_mates/1 GET /preparar_mates/1.json
|
def show
@empresa = Empresa.find(params[:empresa_id])
@producto = @empresa.productos.find(params[:producto_id])
@preparar_mate = @producto.preparar_mates.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_mates(session, options={})\n json_request \"mates\", {:session => session}, options\n end",
"def show \n @inmate = Inmate.find(params[:id])\n render json: @inmate\n end",
"def show\n @mate = Mate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {mate: @mate} }\n end\n end",
"def index\n @mld_mates = MldMate.all\n end",
"def show\n @team_mate = TeamMate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_mate }\n end\n end",
"def get_room_mate\n \tif !params[:room_mate_id].blank?\n \t\t@user = User.find_by_id params[:room_mate_id]\n \t\tif !@user.nil?\n \t\t\trender :json => {:success => true, :message => \"Room mate found\", :user => @user}, :status => 200\n \t\telse\n \t\t\trender :json => {:success => false, :message => \"Room mate not found\"}, :status => :not_acceptable\n \t\tend\n\t\tend \t\n end",
"def show\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def index\n #@teammates = Teammate.all\n @teammates = Teammate.order('lastname')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teammates }\n end\n end",
"def index\n @teammates = @pitch.teammates\n @current_obj = @teammates\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end",
"def show\n @mattress = Mattress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mattress }\n end\n end",
"def show\n @teammate = Teammate.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teammate }\n end\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end",
"def show\n @climate = Climate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climate }\n end\n end",
"def show\n @protein = Protein.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protein }\n end\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def getMsa\r\n census_geo, url = CensusApi.getGeoInfo(params[:lat], params[:lon])\r\n @Output = MsaMapping.getMsaByGeo(census_geo[:partialGeoId])\r\n render :json => @Output\r\n end",
"def index\n @mining_wastes = []\n Rails.logger.debug params.inspect\n\n if params[:owner_id]\n if (params[:owner_id] && ( !params[:labor_id].nil? && params[:labor_id] != \"\" ))\n labor = Labor.find params[:labor_id]\n @mining_wastes = labor.mining_wastes\n else\n owner = Owner.find params[:owner_id]\n if owner\n @mining_wastes = owner.mining_wastes \n else\n @mining_wastes = []\n end\n end\n else\n if params[:region_id] && params[:commune_id]\n # region = Region.find params[:region_id]\n commune = Commune.find params[:commune_id]\n @mining_wastes = commune.mining_wastes\n else\n if params[:commune_id]\n commune = Commune.find params[:commune_id]\n @mining_wastes = commune.mining_wastes\n end\n if params[:region_id]\n region = Region.find params[:region_id]\n @mining_wastes = region.mining_wastes\n end\n end\n end\n respond_to do |format|\n format.json { render json: @mining_wastes.as_json(methods: [:coords, :formated_resolution, :formated_resolution_date, :formated_resolution_closure_date, :formated_resolution_closure_number, :labor_name, :owner_name, :formated_utm_north, :formated_utm_east, :formated_partial_ton, :formated_total_ton, :formated_total_volume, :formated_partial_volume, :commune_id]), status: :ok }\n end\n end",
"def show\n @plate = Plate.find(params[:id])\n\n render json: @plate\n end",
"def show\n @leader = Leader.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leader }\n end\n end",
"def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end",
"def show\n team = Team.find(params[:id])\n image_url = team.image.url\n members = team.members.select(:name, :surname)\n member_names = []\n members.each do |m|\n member_names.push(m.name + \" \" + m.surname)\n end\n team = team.attributes\n\n team[:members] = member_names\n team[:image] = image_url\n render json: team\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @predicts = Predict.where(params[:matchpick_id])\n @matchpick = Matchpick.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @predict }\n end\n end",
"def current_swimmers\n team = Team.find_by_id( params[:id] )\n if team\n render( json: team.swimmers.uniq.to_a )\n else\n render( json: [] )\n end\n end",
"def show\n @student_cell_leader = StudentCellLeader.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_cell_leader }\n end\n end",
"def index\n @grams = Gram.all #if we wanted to make an app so that user can only see their own pin make = current_user.pins.all if not Gram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grams }\n end\n end",
"def show\n @missionmaker = Missionmaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def show\n render json: @mover\n end",
"def show\n @mrj = Mrj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mrj }\n end\n end",
"def show\n @moresmallarmorinfo = Moresmallarmorinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallarmorinfo }\n end\n end",
"def show\n @primer = Primer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @primer }\n end\n end",
"def show\n @microposr = Microposr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposr }\n end\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @players_prize }\n end\n end",
"def index\n type = @current_user.user_type\n if type == 'Rapper'\n matches = @current_user.producer_matches\n render json: matches\n else\n matches = @current_user.rapper_matches\n render json: matches\n end\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def show\n @mineral = Mineral.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mineral }\n end\n end",
"def show\n \n @protectora = Protectora.find(params[:id])\n @nombreProtectora = Protectora.find(params[:id]).nombre\n @mis_mascotas = Mascotum.find(:all, :conditions => {:protectora => @nombreProtectora})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protectora }\n end\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def show\n @jm_verse = JmVerse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jm_verse }\n end\n end",
"def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @materia }\n end\n end",
"def show\n render json: @rock\n end",
"def index\n #since trainers is conncected to gym\n #find the gym where the id of gym is equal to the trainer\n #SO THIS WILL TARGET SPECEFIC PEOPLE WHOS GYM.ID IS EQUAL TO TRAINER gym_id\n @gym=Gym.find(params[:gym_id])\n @trainers=Trainer.where(gym_id: @gym.id)\n render json: @trainers, include: :clients, status: :ok\n end",
"def index\n @organisms = Organism.find(:all, :conditions => {:has_proteins => true})\n @dataset = params[:dataset]\n proteins = Protein.find(:all, :conditions => {:has_hits_public => true})\n @h_proteins = {}\n proteins.map{|p| @h_proteins[p.id]=p}\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisms }\n end\n end",
"def index_coin\n @nodes = Node.where(coin: params[:coin].upcase).order(client_type: :asc ,name: :asc, version: :desc)\n\n render json: @nodes\n end",
"def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end",
"def show\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ami }\n end\n end",
"def index\n @profiles = Profile.all\n respond_to do |format|\n format.html\n format.json do\n @profiles = Profile.near(\n [\n current_user.profile.latitude,\n current_user.profile.longitude\n ], params[:radius]\n ).distinct\n @profiles = @profiles.where.not(id: current_user.profile.id)\n @profiles = @profiles.min_age(params[:min_age]) if params[:min_age].present?\n @profiles = @profiles.max_age(params[:max_age]) if params[:max_age].present?\n @profiles = @profiles.by_gender(params[:gender]) if params[:gender].present?\n @profiles = @profiles.by_activity(params[:activity])\n\n render json: @profiles.map{|profile| profile.attributes.merge(image: profile.image.url(:medium))}\n end\n end\n end",
"def show\n @mint_coin = @coin.mint_coins.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mint_coin }\n end\n end",
"def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end",
"def show\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material }\n end\n end",
"def show\n @material = Material.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material }\n end\n end",
"def show\n @imp2_raman = Imp2Raman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp2_raman }\n end\n end",
"def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end",
"def show\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposst }\n end\n end",
"def show\n @imp_raman = ImpRaman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp_raman }\n end\n end",
"def show\n respond_to do |format|\n format.json\n format.json_api { render json: @material }\n format.html\n end\n end",
"def index\n @materias = Materia.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materias }\n end\n end",
"def new\n @mate = Mate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: {mate: @mate} }\n end\n end",
"def show\n @ref_protein = RefProtein.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_protein }\n end\n end",
"def show\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stone }\n end\n end",
"def index\n @followships = Follower.all\n render json: @followships\n end",
"def show\n @retro = Retro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retro }\n end\n end",
"def index\n if params[:part_id]\n @materials = Material.find(:all, :conditions => [\"part_id = ?\", params[:part_id]])\n else\n @materials = Material.all\n end\n respond_to do |format|\n format.html\n format.json { render :json => @materials }\n end\n end",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def show\n @enzyme = Enzyme.find(params[:id])\n @hmm_profiles = @enzyme.hmm_profiles.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enzyme }\n end\n end",
"def show\n @messege = Messege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messege }\n end\n end",
"def index\n @stars = Star.all\n render :json => @stars\n end",
"def show\n render json: Server.where(name: params[:name]).first\n end",
"def show\n @roadcrime = Roadcrime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roadcrime }\n end\n end",
"def index\n @players = Player.all\n render json: @players\n end",
"def index\n @ownerships = ownerships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ownerships }\n end\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def show\n @plane = Plane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plane }\n end\n end",
"def index\n @addresses = Address.all.map { |a| [a.latitude, a.longitude, a.magnitude] }.flatten\n render json: [[\"Connectivity\",[@addresses]],[\"Population\",[@addresses]]]\n end",
"def get_pokemon_JSON\n r = \n {\n :p1 => JSON.parse(self.pokeserver(self.p1)), \n :p2 => JSON.parse(self.pokeserver(self.p2)), \n :p3 => JSON.parse(self.pokeserver(self.p3)), \n :p4 => JSON.parse(self.pokeserver(self.p4)), \n :p5 => JSON.parse(self.pokeserver(self.p5)), \n :p6 => JSON.parse(self.pokeserver(self.p6)) \n }\n \n JSON.generate(r)\n end",
"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",
"def index\n @championships = Championship.all\n\n render json: @championships\n end",
"def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end",
"def show\n render json: @championship\n end",
"def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end",
"def index\n champions = Champion.all\n render json: champions\n end",
"def show\n @omatsuri = Omatsuri.find_by_code(params[:omatsuri]) if params[:omatsuri]\n @omatsuri ||= Omatsuri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @omatsuri }\n format.json { render :json => @omatsuri.json_attributes } \n end\n end",
"def show\n\n @moretinymap = Moretinymap.find(params[:id])\n\n @guardmobs = Moretinymob.find_all_by_moretinymap_id_and_is_guard(params[:id], true, :include => :moretinymobinfo)\n @intrudermobs = Moretinymob.find_all_by_moretinymap_id_and_is_guard(params[:id], false, :include => :moretinymobinfo)\n\n @intrudermobtrail = Moretinymobtrail.first(:include => :moretinymob, :conditions => [\"moretinymobs.is_guard = ?\", false])\n\n @mobbattles = Moretinymobbattle.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moretinymap }\n end\n end",
"def show\n @material = Material.find(params[:id])\n #TODO: improve visual style of material.show page\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material }\n end\n end",
"def show\n @profesore = Profesore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesore }\n end\n end",
"def show\n @personerium = Personerium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personerium }\n end\n end",
"def match_multiple\n if Roommate.match(params)\n set_roommates\n flash[:success] = 'Roommates were successfully matched!'\n respond_to do |format|\n format.html { redirect_to roommates_url }\n format.json { head :no_content }\n format.js\n end\n else\n flash[:danger] = 'Roommates could not be matched.'\n end\n end",
"def index\n @primeminesters = Primeminester.all\n end",
"def index\n @players = Player.all\n render json: @players, status: 200\n end",
"def show\n render json: @material_type\n end",
"def index\n @material_types = MaterialType.all\n\n render json: @material_types\n end",
"def show\n render json: @light\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def show\n # user = User.find_by_token(params[:token])\n # # @user = User.find(params[:id])\n matches = current_user.matches\n matches.each do |match|\n match['players'] = Array.new(match.users)\n end\n\n render json: {user: current_user, decks: current_user.decks, matches: matches}\n end"
] |
[
"0.6900137",
"0.61212534",
"0.6053895",
"0.59736115",
"0.56997615",
"0.56443334",
"0.56409895",
"0.56301665",
"0.5618191",
"0.55862665",
"0.5568842",
"0.55616003",
"0.5523325",
"0.55153346",
"0.55008334",
"0.54803485",
"0.546482",
"0.5419408",
"0.5419333",
"0.54159236",
"0.54145634",
"0.53832066",
"0.536838",
"0.5350381",
"0.534751",
"0.5333694",
"0.5328239",
"0.5327492",
"0.53227115",
"0.5317055",
"0.5311131",
"0.5310653",
"0.53088725",
"0.53064555",
"0.5296485",
"0.529467",
"0.5293492",
"0.52917755",
"0.52817696",
"0.5281173",
"0.527078",
"0.52608305",
"0.52591383",
"0.5255898",
"0.5246471",
"0.5237848",
"0.523776",
"0.5232167",
"0.5231629",
"0.5229737",
"0.5225598",
"0.52182066",
"0.52113605",
"0.52093446",
"0.519064",
"0.5189547",
"0.5189547",
"0.5172656",
"0.5165327",
"0.5164559",
"0.5163081",
"0.51586115",
"0.51559496",
"0.51435006",
"0.51413137",
"0.51367116",
"0.5130831",
"0.5126272",
"0.5121891",
"0.5113432",
"0.5111346",
"0.51093954",
"0.5109065",
"0.5105137",
"0.51043874",
"0.5104006",
"0.5102618",
"0.51008147",
"0.5097046",
"0.5092247",
"0.50905275",
"0.5089524",
"0.5084059",
"0.5082284",
"0.5074145",
"0.5073538",
"0.5072572",
"0.50699216",
"0.5068835",
"0.50687844",
"0.5068195",
"0.50633955",
"0.506269",
"0.5058127",
"0.505321",
"0.50490856",
"0.5047438",
"0.50404274",
"0.50392884",
"0.50387853"
] |
0.5412004
|
21
|
POST /preparar_mates POST /preparar_mates.json
|
def create
@empresa = Empresa.find(params[:empresa_id])
@producto = @empresa.productos.find(params[:producto_id])
@preparar_mate = @producto.preparar_mates.build(preparar_mate_params)
respond_to do |format|
if @preparar_mate.save
format.html { redirect_to empresa_producto_preparar_mates_path, notice: 'Preparar mate was successfully created.' }
format.json { render :show, status: :created, location: @preparar_mate }
else
format.html { render :new }
format.json { render json: @preparar_mate.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @mate = Mate.new(params[:mate])\n\n respond_to do |format|\n if @mate.save\n format.html { redirect_to @mate, notice: 'Mate was successfully created.' }\n format.json { render json: {mate: @mate}, status: :created, location: @mate }\n else\n format.html { render action: \"new\" }\n format.json { render json: {errors: @mate.errors}, status: :unprocessable_entity }\n end\n end\n end",
"def get_mates(session, options={})\n json_request \"mates\", {:session => session}, options\n end",
"def create\n unless admin_priveledge?\n redirect_to teammates_path, :notice => \"Die noetigen Rechte fehlen.\"\n return\n end\n\n @teammate = Teammate.new(params[:teammate])\n\n respond_to do |format|\n if @teammate.save\n format.html { redirect_to @teammate, :notice => 'Teammate was successfully created.' }\n format.json { render :json => @teammate, :status => :created, :location => @teammate }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @teammate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n #@mld_mate = MldMate.new(mld_mate_params)\n @mld_mate = current_user.mld_mates.build(mld_mate_params)\n\n respond_to do |format|\n if @mld_mate.save\n format.html { redirect_to @mld_mate, notice: \"Mld mate was successfully created.\" }\n format.json { render :show, status: :created, location: @mld_mate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @mld_mate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team_mate = TeamMate.new(params[:team_mate])\n\n respond_to do |format|\n if @team_mate.save\n format.html { redirect_to @team_mate, notice: 'Team mate was successfully created.' }\n format.json { render json: @team_mate, status: :created, location: @team_mate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_mate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @animal = Animal.new(animal_params)\n @animal.preys_id = @animal.preys_id.gsub('\"\", ', '')\n @animal.predators_id = @animal.predators_id.gsub('\"\", ', '')\n\n respond_to do |format|\n if @animal.save\n format.html { redirect_to @animal, notice: 'Animal was successfully created.' }\n format.json { render :show, status: :created, location: @animal }\n else\n format.html { render :new }\n format.json { render json: @animal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def nomination_params\n params.require(:saec_team).permit(\n :unit_commander_title,\n :unit_commander_first_name,\n :unit_commander_last_name,\n :unit_commander_suffix,\n :unit_commander_phone,\n :unit_commander_email,\n :unit_commander_organization,\n :nominating_official_title,\n :nominating_official_first_name,\n :nominating_official_last_name,\n :nominating_official_suffix,\n :nominating_official_phone,\n :nominating_official_email,\n :nominating_point_of_contact_title,\n :nominating_point_of_contact_first_name,\n :nominating_point_of_contact_last_name,\n :nominating_point_of_contact_suffix,\n :nominating_point_of_contact_phone,\n :nominating_point_of_contact_email,\n :nominating_point_of_contact_organization_address_1,\n :nominating_point_of_contact_organization_address_2,\n :nominating_point_of_contact_city,\n :nominating_point_of_contact_state,\n :nominating_point_of_contact_zip,\n :nominating_point_of_contact_country,\n :award_option_id,\n :nominee_title,\n :nominee_first_name,\n :nominee_last_name,\n :nominee_suffix,\n :nominee_position_title,\n :nominee_email,\n :nominee_organization,\n :nominee_command,\n :endorsement_letter,\n :submission_form_award_narrative,\n :nominee_organization_logo,\n :nomination_type_id,\n :nomination_year,\n :nominee_team_name,\n :submission_form_award_narrative_cache,\n :endorsement_letter_cache,\n :nominee_organization_logo_cache,\n :nominee_photograph_one,\n :nominee_photograph_one_cache,\n :nominee_photograph_two,\n :nominee_photograph_two_cache)\n end",
"def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end",
"def create\n @janken = Janken.new(janken_params)\n @janken.hand = params[:commit]\n @janken.name = '名無しさん' if @janken.name == \"\"\n @janken.room = 1 unless @janken.room\n\n respond_to do |format|\n if @janken.save\n\n\t# 対戦相手を取得\n\t@enemy = @janken.previous if @janken.previous\n\n\t@result = @janken.judge\n\n format.html { render :result, notice: 'Janken was successfully created.' }\n format.json { render :index, status: :created, location: @janken }\n else\n format.html { render :new }\n format.json { render json: @janken.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maestro = Maestro.new(maestro_params)\n @maestro.nombre_m =@maestro.nombre_m.capitalize\n @maestro.ap_paterno_m =@maestro.ap_paterno_m.capitalize\n @maestro.ap_materno_m =@maestro.ap_materno_m.capitalize\n \n respond_to do |format|\n if @maestro.save\n format.html { redirect_to @maestro, notice: 'Registro de Maestro actualizado correctamente.' }\n format.json { render :show, status: :created, location: @maestro }\n else\n format.html { render :new }\n format.json { render json: @maestro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @enzyme = Enzyme.new(params[:enzyme])\n @hmm_profiles = HmmProfile.find_all_by_id(params[:hmm_profile_ids])\n @parent_candidates = Enzyme.all\n\n respond_to do |format|\n if @enzyme.save\n if @hmm_profiles\n @hmm_profiles.each do |profile|\n enzyme_profile = EnzymeProfile.new()\n enzyme_profile.hmm_profile_id = profile.id\n enzyme_profile.enzyme_id = @enzyme.id\n enzyme_profile.save\n end\n end\n format.html { redirect_to @enzyme, notice: 'Enzyme was successfully created.' }\n format.json { render json: @enzyme, status: :created, location: @enzyme }\n else\n @hmm_profiles = HmmProfile.all\n format.html { render action: \"new\" }\n format.json { render json: @enzyme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maze = current_user.mazes.new(maze_params)\n generateMaze\n respond_to do |format|\n if @maze.save\n format.html { redirect_to @maze, notice: 'Labirinto criado com sucesso.' }\n format.json { render :show, status: :created, location: @maze }\n else\n format.html { render :new }\n format.json { render json: @maze.errors, status: :unprocessable_entity }\n end\n end\n #respond_to do |format|\n #format.html { redirect_to new_maze_path}\n end",
"def create\n @mini_map_road = MiniMapRoad.new(params[:mini_map_road])\n\n respond_to do |format|\n if @mini_map_road.save\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully created.' }\n format.json { render json: @mini_map_road, status: :created, location: @mini_map_road }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n unless @member.set_region_admin == \"1\"\n @member.region_id = current_member.region_id\n end\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n @uplines = Member.order(\"fullname\")\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def janken_params\n params.require(:janken).permit(:name, :hand, :room)\n end",
"def create\n @mind_map = MindMap.new(mind_map_params)\n @mind_map.user_id = current_user.id \n if @mind_map.save\n render :show, status: :created\n else\n render json: @mind_map.errors, status: :unprocessable_entity\n end\n end",
"def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end",
"def create\n @stone = Stone.new(stone_params)\n\n \n if @stone.save\n respond_with @stone\n else\n render json: @stone.errors, status: :unprocessable_entity \n end\n \n \n end",
"def create\n @prepair = Prepair.new(prepair_params)\n\n respond_to do |format|\n if @prepair.save\n format.html { redirect_to @prepair, notice: 'Prepair was successfully created.' }\n format.json { render :show, status: :created, location: @prepair }\n else\n format.html { render :new }\n format.json { render json: @prepair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rayon_params\n params.require(:rayon).permit(:code, :nom, :is_active)\n end",
"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",
"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",
"def create\n\n randomRace if params[:npc][:race_id].size == 0\n @npc = Race.find(params[:npc][:race_id]).npcs.create(npc_params)\n \n respond_to do |format|\n if @npc.save\n format.html { redirect_to @npc, notice: 'Npc was successfully created.' }\n format.json { render :show, status: :created, location: @npc }\n else\n format.html { render :new }\n format.json { render json: @npc.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n @student_cell_leader = StudentCellLeader.new(params[:student_cell_leader])\n\n respond_to do |format|\n if @student_cell_leader.save\n format.html { redirect_to @student_cell_leader, notice: 'Student cell leader was successfully created.' }\n format.json { render json: @student_cell_leader, status: :created, location: @student_cell_leader }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_cell_leader.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def create\n @teammate = Teammate.new(teammate_params)\n\n respond_to do |format|\n if @teammate.save\n format.html { redirect_to pitch_teammate_path(@pitch, @teammate), notice: \"Um pedido de confirmação foi enviado para #{@teammate.user.name}\" }\n format.json { render :show, status: :created, location: [@pitch, @teammate] }\n else\n format.html { render :new }\n format.json { render json: @teammate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kota_stone = KotaStone.new(kota_stone_params)\n\n respond_to do |format|\n if @kota_stone.save\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kota_stone }\n else\n format.html { render action: 'new' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @primer = @sequence.primers.new(primer_params)\n \n\n respond_to do |format|\n if @primer.save\n format.html { redirect_to @sequence, notice: 'Primer was successfully created.' }\n format.json { render :show, status: :created, location: @sequence }\n else\n format.html { render :new }\n format.json { render json: @sequence.errors, status: :unprocessable_entity }\n end\n end\n @primer.refine\n @primer.calculate_tm\n @primer.fill_sequence_name\n @primer.calculate_length\n end",
"def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end",
"def create\n @rayon = Rayon.new(params[:rayon])\n\n respond_to do |format|\n if @rayon.save\n format.html { redirect_to @rayon, notice: 'Rayon was successfully created.' }\n format.json { render json: @rayon, status: :created, location: @rayon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pin = current_user.pins.new(params[:pin])\n \n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def create\n @prestation = Prestation.new(prestation_params)\n @matter = Matter.find(params[:prestation][:matter_id])\n\n respond_to do |format|\n if @prestation.save\n format.html { redirect_to edit_prestation_path(@prestation), notice: 'Prestation was successfully created.' }\n format.json { render :show, status: :created, location: @prestation }\n else\n format.html { render :new }\n format.json { render json: @prestation.errors, status: :unprocessable_entity }\n end\n end\n end",
"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",
"def create\n @male_pole_jump = MalePoleJump.new(male_pole_jump_params)\n\n respond_to do |format|\n if @male_pole_jump.save\n format.html { redirect_to action:index, notice: 'Male pole jump was successfully created.' }\n format.json { render :show, status: :created, location: @male_pole_jump }\n else\n format.html { render :new }\n format.json { render json: @male_pole_jump.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maturi = Maturi.new(maturi_params)\n\n respond_to do |format|\n if @maturi.save\n format.html { redirect_to @maturi, notice: 'Maturi was successfully created.' }\n format.json { render :show, status: :created, location: @maturi }\n else\n format.html { render :new }\n format.json { render json: @maturi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def maker_master_params\n params.require(:maker_master).permit(:maker_name)\n end",
"def create\n @estado_remate = EstadoRemate.new(estado_remate_params)\n\n respond_to do |format|\n if @estado_remate.save\n format.html { redirect_to @estado_remate, notice: 'Estado remate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @estado_remate }\n else\n format.html { render action: 'new' }\n format.json { render json: @estado_remate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stone = Stone.new(params[:stone])\n\n respond_to do |format|\n if @stone.save\n format.html { redirect_to @stone, notice: 'Stone was successfully created.' }\n format.json { render json: @stone, status: :created, location: @stone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proteinname = Proteinname.new(proteinname_params)\n\n respond_to do |format|\n if @proteinname.save\n format.html { redirect_to @proteinname, notice: 'Proteinname was successfully created.' }\n format.json { render :show, status: :created, location: @proteinname }\n else\n format.html { render :new }\n format.json { render json: @proteinname.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maker_master = MakerMaster.new(maker_master_params)\n\n respond_to do |format|\n if @maker_master.save\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully created.' }\n format.json { render :show, status: :created, location: @maker_master }\n else\n format.html { render :new }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @materia_prima = MateriaPrima.new(materia_prima_params)\n\n respond_to do |format|\n if @materia_prima.save\n format.html { redirect_to @materia_prima, notice: 'Materia prima was successfully created.' }\n format.json { render action: 'show', status: :created, location: @materia_prima }\n else\n format.html { render action: 'new' }\n format.json { render json: @materia_prima.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pinjam = Pinjam.new(pinjam_params)\n\n respond_to do |format|\n if @pinjam.save\n format.html { redirect_to @pinjam, notice: 'Pinjam was successfully created.' }\n format.json { render :show, status: :created, location: @pinjam }\n else\n format.html { render :new }\n format.json { render json: @pinjam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manga = Manga.new(manga_params)\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @protein = Protein.new(params[:protein])\n\n respond_to do |format|\n if @protein.save\n format.html { redirect_to @protein, notice: 'Protein was successfully created.' }\n format.json { render json: @protein, status: :created, location: @protein }\n else\n format.html { render action: \"new\" }\n format.json { render json: @protein.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mini_game = MiniGame.new(mini_game_params)\n if @mini_game.save\n render json: @mini_game, status: :ok\n else\n render json: @mini_game.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pin = current_user.pins.new(params[:pin])\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @start_male_pole_jump = StartMalePoleJump.new(start_male_pole_jump_params)\n\n respond_to do |format|\n if @start_male_pole_jump.save\n format.html { redirect_to action:index, notice: 'Start male pole jump was successfully created.' }\n format.json { render :show, status: :created, location: @start_male_pole_jump }\n else\n format.html { render :new }\n format.json { render json: @start_male_pole_jump.errors, status: :unprocessable_entity }\n end\n end\n end",
"def preparar_mate_params\n params.require(:preparar_mate).permit(:título, :descrición)\n end",
"def create\n @mover = Mover.new(mover_params)\n\n if @mover.save\n render json: @mover, status: :created, location: @mover\n else\n render json: @mover.errors, status: :unprocessable_entity\n end\n end",
"def create\n @profesium = Profesium.new(profesium_params)\n\n respond_to do |format|\n if @profesium.save\n format.html { redirect_to @profesium, notice: 'Profesium was successfully created.' }\n format.json { render :show, status: :created, location: @profesium }\n else\n format.html { render :new }\n format.json { render json: @profesium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def stone_params\n params.require(:stone).permit(:info)\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @pin = @current_user.pins.new(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(params[:member])\n @member.house = current_member.house\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to root_url, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maker = Maker.new(maker_params)\n\n respond_to do |format|\n if @maker.save\n format.html { redirect_to @maker, notice: \"Maker was successfully created.\" }\n format.json { render :show, status: :created, location: @maker }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @maker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def match_multiple\n if Roommate.match(params)\n set_roommates\n flash[:success] = 'Roommates were successfully matched!'\n respond_to do |format|\n format.html { redirect_to roommates_url }\n format.json { head :no_content }\n format.js\n end\n else\n flash[:danger] = 'Roommates could not be matched.'\n end\n end",
"def update_house\n get_rep_from_api[\"results\"][0][\"members\"].each do |rep|\n Representative.create(\n pp_id: rep[\"id\"],\n first_name: rep[\"first_name\"],\n last_name: rep[\"last_name\"],\n party: rep[\"party\"],\n in_office: rep[\"in_office\"],\n state: rep[\"state\"],\n votes_with_party_pct: rep[\"votes_with_party_pct\"],\n district: rep[\"district\"]\n )\n end\nend",
"def create\n @pin = current_user.pins.build(pin_params)\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mata_matum = MataMatum.new(mata_matum_params)\n\n respond_to do |format|\n if @mata_matum.save\n format.html { redirect_to @mata_matum, notice: 'Mata matum was successfully created.' }\n format.json { render :show, status: :created, location: @mata_matum }\n else\n format.html { render :new }\n format.json { render json: @mata_matum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maker = Maker.new(maker_params)\n\n respond_to do |format|\n if @maker.save\n format.html { redirect_to @maker, notice: 'Maker was successfully created.' }\n format.json { render :show, status: :created, location: @maker }\n else\n format.html { render :new }\n format.json { render json: @maker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pin = current_user.pins.build(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if info = parse_input(params)\n name = info.delete(:name)\n alt_names = info.delete(:alt_names)\n obstacles = info.delete(:obstacles)\n\n if spot = SkateSpot.new(info)\n spot.alt_names = alt_names.map! { |n| SpotName.find_or_create_by(:name => n, :spot => spot) } if alt_names\n spot.name = SpotName.find_or_create_by(:name => name, :spot => spot) if name\n spot.obstacles = obstacles.map! { |o| Obstacle.create(:type => ObstacleType.where(:name => o['type']).first, :geometry => o['geometry'], :spot => spot) } if obstacles\n\n return render :json => { :status => (spot.save == true ? :success : :unprocessable_entity) }\n end\n end\n\n render :json => { :status => :unprocessable_entity }\n\n rescue ActiveRecord::RecordNotSaved\n render :json => { :status => :unprocessable_entity }\n end",
"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",
"def create\n # authorize preorder_conversition\n member = Member.where(id: params[:preorder_conversition][:member_id]).first\n @preorder_conversition = @site.preorder_conversitions.new(permitted_attributes(PreorderConversition).merge(user_id: current_user.id, member_name: member.name, member_phone: member.mobile_phone))\n if @preorder_conversition.save\n render json: {status: 'ok', url: agent_preorder_conversitions_path}\n else\n render json: {status: 'error', message:@preorder_conversition.errors.full_messages.join(',')}\n end\n end",
"def create\n @leader = Leader.new(params[:leader])\n\n respond_to do |format|\n if @leader.save\n format.html { redirect_to @leader, notice: 'Leader was successfully created.' }\n format.json { render json: @leader, status: :created, location: @leader }\n else\n format.html { render action: \"new\" }\n format.json { render json: @leader.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @primeminester = Primeminester.new(primeminester_params)\n\n respond_to do |format|\n if @primeminester.save\n format.html { redirect_to @primeminester, notice: 'Primeminester was successfully created.' }\n format.json { render :show, status: :created, location: @primeminester }\n else\n format.html { render :new }\n format.json { render json: @primeminester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pin = Pin.new(pin_params)\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render :show, status: :created, location: @pin }\n else\n format.html { render :new }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n#@pin = Pin.new(pin_params)\n@pin = current_user.pins.new(pin_params)\n\nrespond_to do |format|\nif @pin.save\nformat.html { redirect_to @pin, notice: 'Pin was successfully created.' }\nformat.json { render action: 'show', status: :created, location: @pin }\nelse\nformat.html { render action: 'new' }\nformat.json { render json: @pin.errors, status: :unprocessable_entity }\nend\nend\nend",
"def create\n @online_judge = OnlineJudge.new(online_judge_params)\n @online_judge.user = current_user\n\n respond_to do |format|\n if @online_judge.save\n format.html { redirect_to current_user, notice: 'Online judge was successfully created.' }\n format.json { render :show, status: :created, location: @online_judge }\n else\n format.html { render :new }\n format.json { render json: @online_judge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pin = Pin.new(params[:pin])\n if @pin.name.blank?\n @pin.name = \"#{@pin.latitude}, #{@pin.longitude}\"\n json_string = open(\"http://maps.googleapis.com/maps/api/geocode/json?latlng=#{@pin.latitude},#{@pin.longitude}&sensor=true\") { |f| f.read }\n results = JSON.parse(json_string)[\"results\"]\n if results.size > 0 && ! results[0][\"formatted_address\"].empty?\n @pin.name = results[0][\"formatted_address\"]\n end\n end\n\n respond_to do |format|\n if @pin.save\n format.html { redirect_to @pin, notice: 'Pin was successfully created.' }\n format.json { render json: @pin, status: :created, location: @pin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n client= Client.new\n client.cedula= params[:cedula]\n client.sector= params[:sector]\n client.nombre= params[:nombre]\n client.telefono= params[:telefono]\n client.pagina= params[:pagina]\n client.direccion= params[:direccion]\n if client.save\n render(json: client, status: 201 , location: client)\n else \n render(json: client.errors, status: 422)\n end\n end",
"def create\n @plasmid_probe = PlasmidProbe.new(plasmid_probe_params)\n\n respond_to do |format|\n if @plasmid_probe.save\n format.html { redirect_to @plasmid_probe, notice: 'Plasmid probe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @plasmid_probe }\n else\n format.html { render action: 'new' }\n format.json { render json: @plasmid_probe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plate = @restaurante.plates.create(plate_params)\n @plate.ratings ||= []\n @plate.clients_ratings ||= []\n\n respond_to do |format|\n if @plate.save\n format.html { redirect_to restaurante_plate_path(@restaurante, @plate),\n notice: 'Plato creado exitosamente.' }\n format.json { render :show, status: :created, location: @plate }\n else\n format.html { render :new }\n format.json { render json: @plate.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def index\n @mld_mates = MldMate.all\n end",
"def update\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @preparar_mate = @producto.preparar_mates.find(params[:id])\n respond_to do |format|\n if @preparar_mate.update(preparar_mate_params)\n format.html { redirect_to empresa_producto_preparar_mates_path, notice: 'Preparar mate was successfully updated.' }\n format.json { render :show, status: :ok, location: @preparar_mate }\n else\n format.html { render :edit }\n format.json { render json: @preparar_mate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #for multiple entries\n params[:member_id].zip(params[:mem]).each do |mid,tm|\n @race_timing_grp_evnt = RaceTimingGrpEvnt.new(params[:race_timing_grp_evnt])\n @race_timing_grp_evnt.member_id = mid.to_i\n @race_timing_grp_evnt.gtime = tm\n @race_timing_grp_evnt.save\n end\n\n respond_to do |format|\n if @race_timing_grp_evnt.save\n format.html { redirect_to @race_timing_grp_evnt, notice: 'Race timing grp evnt was successfully created.' }\n format.json { render json: @race_timing_grp_evnt, status: :created, location: @race_timing_grp_evnt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @race_timing_grp_evnt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @protectora = Protectora.new(params[:protectora])\n\n respond_to do |format|\n if @protectora.save\n format.html { redirect_to @protectora, notice: 'Protectora was successfully created.' }\n format.json { render json: @protectora, status: :created, location: @protectora }\n else\n format.html { render action: \"new\" }\n format.json { render json: @protectora.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mnemonic = Mnemonic.new(mnemonic_params)\n\n respond_to do |format|\n if @mnemonic.save\n format.html { redirect_to @mnemonic, notice: 'Mnemonic was successfully created.' }\n format.json { render :show, status: :created, location: @mnemonic }\n else\n format.html { render :new }\n format.json { render json: @mnemonic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n parent_building_material = BuildingMaterial.where(name: building_material_params[\"name\"]).first\n if parent_building_material\n @building_material = parent_building_material.dup\n @building_material.building_material = parent_building_material\n @building_material.section_id = building_material_params[\"section_id\"]\n else\n @building_material = BuildingMaterial.new(building_material_params);\n end\n\n if @building_material.save\n render json: @building_material, status: :created, location: @building_material\n else\n render nothing: true, status: :bad_request\n end\n end",
"def create\n\n client = Cliente.new\n\n client.nombre = params[:nombre]\n client.cedula = params[:cedula]\n client.pagina = params[:pagina]\n\n client.dirrecion = params[:dirrecion]\n client.telefono = params[:telefono]\n \n client.sector = params[:sector]\n \n\n if client.save\n \n\n render(json: client,status: 201 ,location: client)\n else\n\n render(json: client.errors,status: 422 )\n\n end\n end",
"def create\n json = ActiveSupport::JSON.decode(params[:player])\n @player = Player.new\n @player.gender = json[\"gender\"]\n @player.username = json[\"username\"]\n @player.uuid = json[\"uuid\"]\n @player.last_location = json[\"location\"]\n @player.player_monsters = [ PlayerMonster.new({ :nickname => json[\"starting_monster\"][\"nickname\"],\n :monster_id => json[\"starting_monster\"][\"id\"],\n :caught_location => json[\"location\"]\n }) ]\n if @player.save\n render :json => { :success => true, :player => @player } , :status => 200\n else\n render :json => { :success => false, :message => @player.errors } , :status => 400\n end\n end",
"def create\n apartment = Apartment.create(apartment_params)\n render json: apartment\n end",
"def create\n @mob = Mob.new\n @mob.user_id = User.where('username LIKE ?', mob_params[:username]).first.id\n @mob.user_idz = params[:usernames].split(',').map{|u| User.find_by_username(u).id }.join(',')\n @mob.destination = params[:destination]\n\n respond_to do |format|\n if @mob.save\n format.html { redirect_to @mob, notice: 'Mob was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mob }\n else\n format.html { render action: 'new' }\n format.json { render json: @mob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mld_mate_params\n params.require(:mld_mate).permit(:first_name, :last_name, :email, :whatsapp, :github, :user_id)\n end",
"def create\n @missionmaker = Missionmaker.new(params[:missionmaker])\n\n respond_to do |format|\n if @missionmaker.save\n format.html { redirect_to @missionmaker, notice: 'Missionmaker was successfully created.' }\n format.json { render json: @missionmaker, status: :created, location: @missionmaker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @missionmaker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @primer = Primer.new(params[:primer])\n\n respond_to do |format|\n if @primer.save\n format.html { redirect_to @primer, notice: 'Primer was successfully created.' }\n format.json { render json: @primer, status: :created, location: @primer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @primer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manga = Manga.new(manga_params)\n @manga.tags = @params_tags\n @manga.author = @author\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n @exam.patient = @patient\n\n if @exam.save\n render json: @exam, include: [:point_po, :point_or, :point_n, :point_a], methods: :maxillary_depth_angle, status: :created\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n species = Faker::Games::Pokemon.name\n nickname = Faker::Name.first_name\n trainer = Trainer.find(params[:trainer_id])\n if trainer.pokemons.length < 6\n pokemon = Pokemon.create(nickname: nickname, species: species, trainer_id: params[:trainer_id])\n render json: pokemon\n else\n render json: {message: \"Pokemon cannot be created\"}, status: 400\n end\n end",
"def create\n @moresmallarmorinfo = Moresmallarmorinfo.new(params[:moresmallarmorinfo])\n\n respond_to do |format|\n if @moresmallarmorinfo.save\n format.html { redirect_to @moresmallarmorinfo, notice: 'Moresmallarmorinfo was successfully created.' }\n format.json { render json: @moresmallarmorinfo, status: :created, location: @moresmallarmorinfo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmallarmorinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pincode = Pincode.new(pincode_params)\n \n respond_to do |format|\n if @pincode.save\n #format.html { redirect_to @pincode, notice: 'Pincode was successfully created.' }\n format.html { redirect_to @pincode}\n format.json { render :show, status: :created, location: @pincode }\n else\n format.html { render :new }\n format.json { render json: @pincode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @representative_profile = RepresentativeProfile.new(representative_profile_params)\n\n respond_to do |format|\n if @representative_profile.save\n format.html { redirect_to @representative_profile, notice: 'Representative profile was successfully created.' }\n format.json { render :show, status: :created, location: @representative_profile }\n else\n format.html { render :new }\n format.json { render json: @representative_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rebateable = find_rebateable\n @rebate = @rebateable.rebates.build(params[:rebate])\n @sector_names = params[:sector_names] || []\n @industry_names = params[:industry_names] || []\n @rebate.tag_names = @sector_names.join(',') + \",\" + @industry_names.join(',')\n\n respond_to do |format|\n if @rebate.save\n format.html { redirect_to :id => nil }\n format.json { render json: @rebate, status: :created, location: @rebate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rebate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def premise_params\n params.require(:premise).permit(:building_address, :tenant_name, :occupancy_status, :availability_status, :retail_type, :retail_sub_type, :retailer_footprint, :retail_price_point, :retailer_heritage, :retailer_value, :retailer_occurence, :location_quality, :premise_quality, :quality_ranking, :class_mix, :corner_store, :percent_of_bldg_retail, :premise_type, :basement_sf, :ground_fl_sf, :mezzazine, :upper_fl_sf, :step_up_or_down, :number_of_retail_stories, :street_frontage, :approx_retail_sf, :street_frontage_ratio, :ceiling, :contains_retail, :submarket, :total_number_of_retail_space, :total_retail_space, :zip_code, :xcord, :ycord, :building_status, :borocode, :borough, :bbl, :block, :lot, :frequency_of_demand, :location_appearance, :walkability_score, :viability_score, :demographic, :zip_code_from, :zip_code_to, :submarket_health_index, :gentrifcation_score, :footfall_index, :block_appeal, :target_shopper_profile, :stability_index, :growth_index, :retailer_viability, :venting, :social_media, :total_bldg_front, :active, :mailer_building_number, :mailer_street, :mailer_street_type, :mailer_city, :mailer_state, :mailer_zip_code, :location_quality_grade, :premise_quality_grade, :listing_brokerage, :listing_broker_name, :listing_broker_email, :listing_broker_number, :tenant_contact_name, :tenant_contact_phone_number, :tenant_contact_email, :tenant_contact_address, :owner_contact_name, :owner_contact_phone_number, :owner_contact_email, :owner_contact_address, :unique_id_addedem, :unique_id_complete, :corridor, :lattitude, :longitude, :venting, :previous_tenant, :notes)\n end",
"def create\n @mountain = Mountain.new(mountain_params)\n\n respond_to do |format|\n if @mountain.save\n format.html { redirect_to @mountain, notice: 'Mountain was successfully created.' }\n format.json { render :show, status: :created, location: @mountain }\n else\n format.html { render :new }\n format.json { render json: @mountain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prim = Prim.new(prim_params)\n\n respond_to do |format|\n if @prim.save\n format.html { redirect_to @prim, notice: 'Prim was successfully created.' }\n format.json { render :show, status: :created, location: @prim }\n else\n format.html { render :new }\n format.json { render json: @prim.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.55769044",
"0.53530544",
"0.5340133",
"0.5335051",
"0.52413374",
"0.5225603",
"0.5192981",
"0.5163182",
"0.51625496",
"0.5141869",
"0.51200545",
"0.5104154",
"0.51031977",
"0.5053567",
"0.50192183",
"0.49981737",
"0.49896193",
"0.4987082",
"0.49710417",
"0.49698752",
"0.49600768",
"0.49593842",
"0.49435925",
"0.4939557",
"0.4933635",
"0.4925554",
"0.49223962",
"0.49186826",
"0.49160612",
"0.4907559",
"0.48994026",
"0.48979506",
"0.4893426",
"0.4888188",
"0.48823085",
"0.4880142",
"0.4871863",
"0.4868463",
"0.48502994",
"0.48409152",
"0.48374313",
"0.48287806",
"0.48276782",
"0.48202845",
"0.48198476",
"0.48160598",
"0.48147008",
"0.48018497",
"0.4801793",
"0.47992763",
"0.4793166",
"0.47925064",
"0.477973",
"0.47790346",
"0.47783273",
"0.47752658",
"0.47559884",
"0.47536042",
"0.47469726",
"0.47451496",
"0.47443378",
"0.47434694",
"0.4737466",
"0.47306788",
"0.47282138",
"0.47266087",
"0.47242504",
"0.47187594",
"0.47170794",
"0.4715086",
"0.47113523",
"0.4711213",
"0.47074798",
"0.47041765",
"0.47008273",
"0.46940506",
"0.4689834",
"0.4687661",
"0.46873084",
"0.46831682",
"0.46829408",
"0.46827507",
"0.46795225",
"0.46783647",
"0.46779174",
"0.46775544",
"0.4673009",
"0.4672901",
"0.4670524",
"0.46702167",
"0.46687138",
"0.46685594",
"0.46670562",
"0.46655387",
"0.46648982",
"0.46628484",
"0.46599823",
"0.4658135",
"0.4657894",
"0.46549013"
] |
0.6040503
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.