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 |
|---|---|---|---|---|---|---|
DELETE /code_samples/1 DELETE /code_samples/1.json
|
def destroy
@code_sample.destroy
respond_to do |format|
format.html { redirect_to code_samples_url, notice: 'Code sample was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n # @sample = Sample.find(params[:id])\n # @sample.destroy\n\n# respond_to do |format|\n# format.html { redirect_to samples_url }\n# format.json { head :no_content }\n# end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mycometer_coc_sample.destroy\n respond_to do |format|\n format.html { redirect_to mycometer_coc_samples_url, notice: 'Mycometer coc sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\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 @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(samples_url) }\n format.xml { head :ok }\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 @cocoon_example.destroy\n respond_to do |format|\n format.html { redirect_to cocoon_examples_url, notice: 'Cocoon example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @patient_sample = PatientSample.find(params[:id])\n @patient_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_samples_url }\n format.json { head :no_content }\n end\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 destroy\n @image_to_sample.destroy\n respond_to do |format|\n format.html { redirect_to image_to_samples_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_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\n client.delete(\"/#{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 api(\"Delete\")\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\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\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def destroy\n @example_code.destroy\n respond_to do |format|\n format.html { redirect_to example_codes_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @example.destroy\n respond_to do |format|\n format.html { redirect_to examples_url, notice: 'Operação realizada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @column_sample.destroy\n respond_to do |format|\n format.html { redirect_to column_samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_set = SampleSet.find(params[:id])\n @project = Project.find(@project_property.project_id)\n @sample_set.destroy\n respond_to do |format|\n format.html { redirect_to sample_sets_url }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def destroy\n @text_sample.destroy\n respond_to do |format|\n format.html do\n redirect_to text_samples_url,\n notice: 'Text sample was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_type = SampleType.find(params[:id])\n @sample_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def sample_for_delete(src = :delete_example)\n current = delete_id && Manifest.find_by(id: delete_id)\n return current if current && (src == :delete_example)\n current&.delete\n new_record(src).tap do |record|\n self.delete_id = record.id if record.save!\n end\n end",
"def delete\n end",
"def destroy\n if admin?\n @sample_identifier.destroy\n respond_to do |format|\n format.html { redirect_to sample_identifiers_url, notice: 'Sample identifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' }\n format.js { flash[:notice] = 'Task was successfully destroyed.'}\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\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 @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def destroy\n @fitness_sample = FitnessSample.find(params[:id])\n @fitness_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => 'index', :action => 'index') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @multi_spectral_sample.destroy\n respond_to do |format|\n format.html { redirect_to multi_spectral_samples_url, notice: 'Multi spec sample was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def test_delete_file()\n\n path = 'folder/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n request = DeleteFileRequest.new(path, versionId, storage)\n\n result = @storage_api.delete_file(request)\n assert result.code == 200,'Error while deleting document'\n\n end",
"def delete(uri, parameters)\n response = Unirest.delete uri, parameters: parameters\n response.body\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def delete(path)\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n date = gmtdate\n headers = {\n 'Host' => @aliyun_upload_host,\n 'Date' => date,\n 'Authorization' => sign('DELETE', bucket_path, '', '', date)\n }\n url = path_to_url(path)\n response = RestClient.delete(url, headers)\n response.code == 204 ? url : nil\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 delete\n \n end",
"def delete\n if @test.destroy\n return render json: { message: 'Test was removed succesfully.', error: false }\n else\n return render json: { message: 'Error :Something went wrong. Test was not removed.', error: true }\n end\n end",
"def destroy\n @api_hello.destroy\n respond_to do |format|\n format.html { redirect_to api_hellos_url, notice: 'Hello was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @sample_type.destroy\n respond_to do |format|\n format.html { redirect_to sample_types_url, notice: \"Sample type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.content)\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @experiment_raw_dataset.destroy\n respond_to do |format|\n format.html { redirect_to experiment_raw_datasets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dummy = Dummy.find(params[:id])\n @dummy.destroy\n\n respond_to do |format|\n format.html { redirect_to dummies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n ensure_client && ensure_uri\n response = @client.rest_delete(@data['uri'], { 'Accept-Language' => 'en_US' }, @api_version)\n @client.response_handler(response)\n true\n end",
"def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @copyeditor_test.destroy\n respond_to do |format|\n format.html { redirect_to copyeditor_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end"
] |
[
"0.71839494",
"0.71839494",
"0.7168637",
"0.71536934",
"0.70669526",
"0.6961494",
"0.6961494",
"0.6961494",
"0.6961494",
"0.6961494",
"0.69059694",
"0.6855563",
"0.6843512",
"0.68383676",
"0.68169045",
"0.68169045",
"0.68169045",
"0.68169045",
"0.67387795",
"0.6698845",
"0.6684311",
"0.6681971",
"0.66640043",
"0.6663135",
"0.660025",
"0.6592956",
"0.65816885",
"0.6566898",
"0.6548665",
"0.6548233",
"0.6546984",
"0.65406734",
"0.65378153",
"0.6533124",
"0.65047944",
"0.65046644",
"0.6500629",
"0.64954114",
"0.64910597",
"0.6482719",
"0.6477661",
"0.6477661",
"0.6469048",
"0.64307415",
"0.6405704",
"0.639888",
"0.63928",
"0.6383316",
"0.63674664",
"0.6365565",
"0.6365565",
"0.6350026",
"0.63480216",
"0.63470155",
"0.6346428",
"0.63408583",
"0.6336729",
"0.6330799",
"0.6329595",
"0.6324193",
"0.6323345",
"0.6323345",
"0.63219076",
"0.63219076",
"0.63219076",
"0.63219076",
"0.63219076",
"0.63219076",
"0.63219076",
"0.6313426",
"0.6313426",
"0.63115054",
"0.63032323",
"0.6280656",
"0.6278731",
"0.6278089",
"0.6276137",
"0.6268916",
"0.6255851",
"0.6253592",
"0.6241451",
"0.62405676",
"0.62385225",
"0.62363476",
"0.6234992",
"0.6230503",
"0.62277865",
"0.62268835",
"0.62255824",
"0.6225415",
"0.6225174",
"0.621293",
"0.62052816",
"0.6205177",
"0.6201275",
"0.62003213",
"0.61985296",
"0.6197983",
"0.6193821",
"0.6191358"
] |
0.73903066
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_code_sample
@code_sample = CodeSample.friendly.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def code_sample_params
params.require(:code_sample).permit(:title, :versions, :description, :code, :featured, :code_info)
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
|
TODO: we could assign a function to window.onerror to track last js error public
|
def cause
raise NotImplementedError
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def onerror(&blk); super; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def get_js_error_feedback\n jserror_descriptions = \"\"\n begin\n jserrors = @driver.execute_script(\"return window.JSErrorCollector_errors.pump()\")\n jserrors.each do |jserror|\n @logger.debug \"ERROR: JS error detected:\\n#{jserror['errorMessage']} (#{jserror['sourceName']}:#{jserror['lineNumber']})\"\n jserror_descriptions += \"JS error detected:#{jserror['errorMessage']} (#{jserror['sourceName']}:#{jserror['lineNumber']})\n\"\n end\n rescue Exception => e\n @logger.debug \"Checking for JS errors failed with: #{e.message}\"\n end\n jserror_descriptions\n end",
"def server_errors; end",
"def error(url); end",
"def external_errors\n @external_errors ||= {}\n end",
"def script_error(path, error); end",
"def multiple_base_js_failure\n reset_all_computed_instance_vars\n raise MultipleBaseJsError\n end",
"def javascript_prologue\n 'throw \"error\";'\n end",
"def error(exception) nil ; end",
"def original_error; end",
"def original_error; end",
"def on_error(err)\n raise err\n end",
"def error\n nil\n end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errorhandling\n end",
"def error?; end",
"def error?; end",
"def error?; end",
"def on_error error\n raise error\n end",
"def error\n end",
"def error\n nil\n end",
"def on_error(msg)\n end",
"def load_error; end",
"def on_error(error); @parent.on_error(@env, error); end",
"def errors=(_); end",
"def error!(url); end",
"def server_error?; end",
"def error(nvae)\n end",
"def error_handling\n @@error_handling ||= nil\n end",
"def error\n end",
"def on_error\n @on_error || DEFAULT_ON_ERROR\n end",
"def error!\n @error = true\n end",
"def server_error\n\n end",
"def last_err\n api(\"LastErr\")\n end",
"def handle_error(result)\n return if result[\"subtype\"] != \"error\"\n\n case result[\"className\"]\n when \"TimedOutPromise\"\n raise ScriptTimeoutError\n when \"MouseEventFailed\"\n raise MouseEventFailed.new(result[\"description\"])\n else\n raise JavaScriptError.new(result)\n end\n end",
"def on_error(error_token_id, error_value, value_stack); end",
"def err\n @err\n end",
"def error\r\n @error\r\n end",
"def error(ex) [:error, ex]; end",
"def log_request_errors(page)\n return if QA::Runtime::Browser.blank_page?\n\n url = page.driver.browser.current_url\n QA::Runtime::Logger.debug \"Fetching API error cache for #{url}\"\n\n cache = page.execute_script <<~JS\n return !(typeof(Interceptor)===\"undefined\") ? Interceptor.getCache() : null;\n JS\n\n return unless cache&.dig('errors')\n\n grouped_errors = group_errors(cache['errors'])\n\n errors = grouped_errors.map do |error_metadata, request_id_string|\n \"#{error_metadata} -- #{request_id_string}\"\n end\n\n unless errors.nil? || errors.empty?\n QA::Runtime::Logger.error \"Interceptor Api Errors\\n#{errors.join(\"\\n\")}\"\n end\n\n # clear the cache after logging the errors\n page.execute_script <<~JS\n Interceptor && Interceptor.saveCache({});\n JS\n end",
"def error\n @error\n end",
"def error_mode; end",
"def error_message; end",
"def inject_error(e)\n websocket_error(e)\n end",
"def errmsg(message); end",
"def errno; end",
"def error_log\n end",
"def error_log\n end",
"def error_log\n end",
"def fatal; end",
"def error\n @last_error && @last_error.error\n end",
"def store_failure_on_next message\r\n raise 'Not supported in Selenium Core at the moment'\r\n end",
"def render_error\n nil\n end",
"def render_error\n nil\n end",
"def on_error?\n @kind == :on_error\n end",
"def error_number; end",
"def stderr; end",
"def stderr; end",
"def stderr; end",
"def stderr; end",
"def exceptions; end",
"def before_server_error(exception); end",
"def error_handler()\n @error_handler\n end",
"def check_errors;\n end",
"def recover_from(_error); end",
"def catch_exceptions; end",
"def error?()\n #This is a stub, used for indexing\n end",
"def on_error(&callback)\n @err_cb, @err_cb_overridden = callback, true\n end",
"def rescue_action(e)\n\n # sometimes, Rails likes to pass you instance variables that you don't want\n # this should get rid of any junk that the previous renders left behind that rails failed to clean up\n erase_render_results\n #forget_variables_added_to_assigns\n reset_variables_added_to_assigns\n \n @error = e\n @error_name = e.class.to_s.demodulize.underscore\n\n @error_trace = @error.backtrace\n @error_message = @error.to_s.gsub('<', '<').gsub('>', '>')\n\n if(@error.respond_to? :status_code)\n @status = @error.status_code\n elsif(DEFAULT_RESCUE_RESPONSES.has_key? @error.class.to_s)\n @status = DEFAULT_RESCUE_RESPONSES[@error.class.to_s]\n else\n @status = DEFAULT_RESCUE_RESPONSE\n end\n \n if logger.level > Logger::INFO\n logger.error %{\n Processing #{self.class.name}\\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]\n Session ID: #{@_session.session_id if @_session and @_session.respond_to?(:session_id)}\n Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(params).inspect : params.inspect}}\n end\n logger.error %{\n Error: #{@error.clean_message} (status: #{@status})\n Trace: #{(@error_trace.is_a? Array)? @error_trace.join(\"\\n\\t \") : @error_trace }\n }\n\n respond_to do |format|\n format.html do\n begin\n render :partial => \"shared/errors/error\", :layout => 'error', :status => @status\n rescue\n super(e)\n end\n end\n format.js do\n begin\n render :template => \"shared/errors/error\"\n rescue\n render :update do |page|\n page.alert \"There has been an error, and then another error occured while first error was being processed... Too bad. The original error was: #{@error.to_s}.\"\n page.alert \"The additional error was: #{$!.to_s}.\"\n end\n end\n end\n end\n \n rescue_with_handler(e) or notify_airbrake(e)\n end",
"def handle_perform_error(_e); end",
"def error\n @obj['error']\n end",
"def log_error(exception); end",
"def inject_error(e)\n handle_internal_close(e)\n end",
"def handle_error(msg)\n @errors[msg] = true\nend",
"def load_error=(_arg0); end",
"def non_xhr_javascript_response?; end",
"def check_errors;\n end",
"def handle_get_error(err, selector)\n puts \"Error #{err.class}: #{err}\"\n puts err.backtrace if MNV[:debug]\n\n MNV[selector].empty?\n ensure\n MNV[selector] = \"\"\n end",
"def errback &block\n super\n end",
"def errback &block\n super\n end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def after_safe_load_failed(file, error)\n Log.error(error)\n end"
] |
[
"0.67494404",
"0.64479005",
"0.64479005",
"0.64479005",
"0.64479005",
"0.64479005",
"0.64479005",
"0.64479005",
"0.6435499",
"0.63773024",
"0.6302577",
"0.6272955",
"0.62500525",
"0.62468773",
"0.6241184",
"0.623738",
"0.62148887",
"0.62148887",
"0.61710334",
"0.6126671",
"0.6101138",
"0.6101138",
"0.6101138",
"0.6101138",
"0.6101138",
"0.6101138",
"0.6101138",
"0.6101138",
"0.6101138",
"0.60813755",
"0.6062741",
"0.6062741",
"0.6062741",
"0.6041985",
"0.6033106",
"0.6027607",
"0.6027404",
"0.60198766",
"0.5998157",
"0.5977103",
"0.5961723",
"0.59493506",
"0.59484404",
"0.58998847",
"0.58928376",
"0.58889383",
"0.58825004",
"0.5867274",
"0.5845308",
"0.5841543",
"0.5758006",
"0.5755576",
"0.57377625",
"0.5735682",
"0.57294357",
"0.5691053",
"0.56802976",
"0.5676475",
"0.56739277",
"0.5670914",
"0.56707567",
"0.56598043",
"0.56598043",
"0.56598043",
"0.5654301",
"0.5646403",
"0.5639668",
"0.5637197",
"0.5637197",
"0.5633591",
"0.5611725",
"0.5609747",
"0.5609747",
"0.5609747",
"0.5609747",
"0.56068724",
"0.5599054",
"0.5595072",
"0.55944955",
"0.5581272",
"0.5578164",
"0.55744535",
"0.5568751",
"0.55605894",
"0.5547794",
"0.55261886",
"0.55131465",
"0.551207",
"0.55096954",
"0.55005205",
"0.5485429",
"0.5481855",
"0.5476236",
"0.54702324",
"0.54702324",
"0.54681724",
"0.54681724",
"0.54681724",
"0.54681724",
"0.54681724",
"0.5466332"
] |
0.0
|
-1
|
public full_message public inspect public
|
def java_script_object
@js_wrapper
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def inspect; message; end",
"def inspect\n \"#<#{self.class.name}: #{message}>\"\n end",
"def message; end",
"def message; end",
"def message; end",
"def message; end",
"def message; end",
"def message; end",
"def description\n self[:message]\n end",
"def to_s; message; end",
"def message\n end",
"def message\n @_message\n end",
"def message\n @_message\n end",
"def message(message) end",
"def message() end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect_message(message, scope, inspection)\n end",
"def message\n @message\n end",
"def inspect(*) end",
"def inspect(*) end",
"def inspect(*) end",
"def inspect(*) end",
"def inspect(*) end",
"def inspect\n redacted_string(:inspect)\n end",
"def inspect\n redacted_string(:inspect)\n end",
"def message\n __getobj__\n end",
"def message\n __getobj__\n end",
"def message\n __getobj__\n end",
"def message\n to_s\n end",
"def message\n to_s\n end",
"def msg; end",
"def msg; end",
"def msg; end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect\n end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def foorth_message\r\n \"#{self.foorth_code} #{self.message}\"\r\n end",
"def inspect\n \"#<#{self.class.name}:#{self.object_id}, #{inspector(:@messages)}>\"\n end",
"def message\n @message || super\n end",
"def inspect\n \"\"\n end",
"def inspect_details\n ''\n end",
"def message\n\t\t@message \n\tend",
"def msg=(_); end",
"def msg=(_); end",
"def message\n \n end",
"def message( message )\n\tend",
"def status_message; end"
] |
[
"0.82042533",
"0.75174487",
"0.74912155",
"0.74912155",
"0.74912155",
"0.74912155",
"0.74912155",
"0.74912155",
"0.7262634",
"0.71599984",
"0.709416",
"0.7063028",
"0.7063028",
"0.70591396",
"0.70509076",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.69943976",
"0.6988998",
"0.69724506",
"0.69531685",
"0.69531685",
"0.69531685",
"0.69531685",
"0.69531685",
"0.69445026",
"0.69445026",
"0.69348705",
"0.69348705",
"0.69348705",
"0.6934342",
"0.6934342",
"0.6916407",
"0.6916407",
"0.6916407",
"0.6890765",
"0.6890765",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870454",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6870045",
"0.6859698",
"0.6851648",
"0.6796668",
"0.67912835",
"0.6786835",
"0.6785492",
"0.67492324",
"0.67492324",
"0.6739925",
"0.67287177",
"0.6722207"
] |
0.0
|
-1
|
Create a new configuration populated with values from the environment.
|
def initialize
@content_root = ENV.fetch('CONTENT_ROOT', '')
@envelope_dir = ENV.fetch('ENVELOPE_DIR', File.join(Dir.pwd, '_site', 'deconst-envelopes'))
@asset_dir = ENV.fetch('ASSET_DIR', File.join(Dir.pwd, '_site', 'deconst-assets'))
@verbose = ENV.fetch('VERBOSE', '') != ''
@content_id_base = ENV.fetch('CONTENT_ID_BASE', '').gsub(%r{/\Z}, '')
@jekyll_document = ENV.fetch('JEKYLL_DOCUMENT', '')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def config_from_env\n CONFIGURABLE_WITH_ENV.each_with_object({}) do |option, env_vars|\n if value = option_from_env(option)\n env_vars[option] = value\n end\n end\n end",
"def config=(env, override_configurations = T.unsafe(nil)); end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def initialize(options = {})\n @config = env_options.merge(options)\n end",
"def initialize(config)\n\n @config = CONFIG.merge config # apply given configuration over defaults\n\n # Sanity check the supplied config for required sane values\n CONFIG_REQUIRED.each { |k| abort \"A #{k} is required\" unless @config.has_key? k }\n @config.each { |k,v| abort(\"An empty #{k} cannot be used\") if v.nil? or (v.respond_to?(:empty) && v.empty?) }\n\n log \"Initialising environment '#{config(:name)}'\"\n\n # Uncomment the below line to prohibit source and destination being the same\n abort(\"source and destination are the same\") if config(:source)==config(:destination)\n\n @paths = {source: @config[:source], destination: Dir.mktmpdir}\n if File.basename(@paths[:source]) == 'content'\n paths[:root] = File.dirname(@paths[:source])\n else\n paths[:root] = path(:source)\n paths[:source] = path(:root) + '/content'\n end\n paths[:config] = path(:root) + '/config.js'\n\n # Check paths are valid\n paths.each do |name,path|\n do_or_die(File.exists?(path), \"#{name} path '#{path}' is good\",\n \"#{name} path #{path} not found\")\n end\n\n # hold hidden tags as array\n @config[:hide_tags] = config(:hide_tags) ? config(:hide_tags).split(',') : []\n\n # hold replace regexes as hash http://rubular.com/r/MYNXsibGh3\n if config(:replace)\n h = {}\n config(:replace).scan(/([^\\s]\\w+):(.*?)(?=($|\\s\\w+:))/) { |k,v| h[k] = v }\n @config[:replace] = h\n end\n\n # Load Ghost configuration file\n do_or_die(gconfig = File.read(path(:config)),\"read config ok\",\"read config failed\")\n gconfig.gsub!(/^\\s*?\\/\\/.*?\\n/m,'') # remove comments from config\n \n # Get database file\n match_dbfile = gconfig.match(/#{config(:ghost_environment)}:\\s*{.*?database:\\s*{.*?connection:\\s*{.*?filename:.*?([\\w-]*?\\.db)/m)\n dbfile = match_dbfile.nil? ? abort(\"unable to find database file name for '#{config(:ghost_environment)}' environment in configuration file\") : match_dbfile[1]\n paths[:database] = path(:source) + '/data/' + dbfile\n \n # Open database\n dbfile = path(:database)\n do_or_die(File.exists?(dbfile),\"database #{dbfile} found\",\n \"Cannot find database file #{dbfile}\")\n do_or_die(self.db = SQLite3::Database.new(dbfile, readonly: true),'database opened',\n \"Could not initialise database #{dbfile}\")\n db.results_as_hash = true\n \n # Load settings from database\n @settings = {}\n query = \"select key,value from settings\"\n do_or_die(db.execute(query).each{|s| @settings.update s[0].to_sym => s[1]},\n 'read settings','unable to read settings')\n #settings.each { |k,v| log \"setting(#{k}) = #{v}\" }\n \n # Set the URL that will be used as the root on exported blogs\n if config.include?(:url)\n settings[:url] = config(:url)\n else\n # Get site URL from config file and put it into settings array\n match_url = gconfig.match(/#{config(:ghost_environment)}:\\s*{.*?url:\\s*'(.*?)'/m)\n url = match_url.nil? ? abort(\"unable to find url for #{config(:ghost_environment)} environment\") : match_url[1]\n settings[:url] = url\n end\n \n # Build posts query\n @queries = {}\n queries[:posts] = 'SELECT posts.*, users.name as author_name from posts' \\\n << ' INNER JOIN users ON posts.author_id = users.id'\n \n whand = ' WHERE' # will change to 'AND' for subsequent clauses\n unless config(:with_tags).nil? \n queries[:posts] << whand << ' EXISTS (' \\\n << 'SELECT 1 FROM posts_tags' \\\n << ' INNER JOIN tags ON tags.id = posts_tags.tag_id' \\\n << ' WHERE posts_tags.post_id = posts.id' \\\n << ' AND tags.name IN (' \\\n << config(:with_tags).split(',').map {|t| \"'#{t}'\" }.join(',') \\\n << '))' \n whand = ' AND'\n end\n \n unless config(:without_tags).nil?\n queries[:posts] << whand << ' NOT EXISTS (SELECT 1 FROM posts_tags' \\\n << ' INNER JOIN tags ON tags.id = posts_tags.tag_id' \\\n << ' WHERE posts_tags.post_id = posts.id' \\\n << ' AND tags.name IN (' \\\n << config(:without_tags).split(/[ ,]/).map {|t| \"'#{t}'\" }.join(',') \\\n << '))' \n whand = ' AND'\n end\n \n queries[:posts] << whand << \" posts.status == 'published'\" if config(:published) \n queries[:posts] << ' ORDER BY posts.published_at DESC'\n\n # Debugging limit\n #queries[:posts] << \" LIMIT #{config[:maximum_posts]}\" if config[:maximum_posts]\n queries[:posts] << \" LIMIT 1\" if @@limit_posts\n\n # Load export filters\n export_filters = []\n config(:export_filters).split(',').each do |f|\n f = f.to_s\n if match = f.match(/(\\S*?)\\?(.*)/)\n f = match[1]\n parameters = CGI.parse(match[2]).each_with_object({}){|(k,v),h| h[k.to_sym] = v.first}\n end\n log \"Loading #{f} export filter\"\n begin\n require_relative 'export_filters/export_'+f\n rescue LoadError\n abort(\"Failed to load export filter '#{f}'\")\n end\n export_filters << Object.const_get('ExportFilter_'+f).new(self,parameters)\n end\n\n # Run all posts through each filter\n db.execute(queries[:posts]) { |post| export_filters.each { |f| f.export_post(post) } }\n\n # Close the database\n db.close \n \n # Close all export filters\n export_filters.each { |f| f.close }\n\n # Run the publishers\n if config(:destination)\n require_relative 'publishers/publisher'\n Publisher.new(self).publish\n end\n\n # Remove temporary export directory\n FileUtils.rmtree(path(:destination), secure: true)\n\n end",
"def initialize\n configure_via_yaml\n configure_via_env\n end",
"def env_config\n @env_config ||= {}\n end",
"def environment name, config=nil, &block\n environments[name] = klass.configure(config, &block)\n end",
"def configure(environment = nil, &blk)\n configurations.add(environment, &blk)\n end",
"def set_config(env, override_configurations = T.unsafe(nil)); end",
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def initialize\n # Load configuration file\n require 'yaml'\n @env = HashWithIndifferentAccess.new(YAML.load_file(File.join(File.dirname(__FILE__), '..', 'config', 'environments', \"#{ENV['RACK_ENV']}.yml\")))\n end",
"def configure!(env = RAILS_ENV)\n raise \"Can't determine Rails environment. Do you need to set RAILS_ENV?\" unless env\n merger = proc {|k,a,b| (Hash === a && Hash === b) ? a.merge(b, &merger) : b }\n configuration.merge!(@environments[env], &merger).freeze\n end",
"def create_config\n self.config = {} if !self.config\n end",
"def create_config\n self.config = {} if !self.config\n end",
"def config_for(environment=:development)\n if self.config.present?\n env_config = self.config[environment.to_s]\n else\n env_config = {\n 'host' => ENV['RIAK_HOST'],\n 'http_port' => ENV['RIAK_HTTP_PORT'],\n 'pb_port' => ENV['RIAK_PB_PORT']\n }\n end\n env_config\n end",
"def create_config \n @config = ::Capistrano::Configuration.new\n if @cloud.debug || @cloud.verbose \n @config.logger.level = @cloud.debug ? ::Capistrano::Logger::MAX_LEVEL : ::Capistrano::Logger::INFO\n else\n @config.logger.level = ::Capistrano::Logger::IMPORTANT\n end\n \n capfile = returning Array.new do |arr|\n Dir[\"#{::File.dirname(__FILE__)}/recipies/*.rb\"].each {|a| arr << \"require '#{a}'\" }\n arr << \"ssh_options[:keys] = '#{@cloud.full_keypair_basename_path}'\"\n \n arr << set_poolparty_roles\n end.join(\"\\n\")\n \n @config.provisioner = self\n @config.cloud = @cloud\n \n @config.load(:string => capfile)\n \n @cloud.deploy_file ? @config.load(@cloud.deploy_file) : @config.set(:user, @cloud.user)\n end",
"def initialize_from_env\n conf_prefix = self.env_variable_prefix.upcase\n\n ENV.keys.reject { |key|\n key !~ /^#{conf_prefix}/ # Ignore everything that doesn't match the prefix\n }.each { |key|\n variable = key[conf_prefix.size..-1].downcase\n\n self.store(variable, ENV[key])\n }\n\n after_initialize\n dump\n end",
"def export_config_to_env\n ENV['TAOBAO_API_KEY'] = config['app_key']\n ENV['TAOBAO_SECRET_KEY'] = config['secret_key']\n ENV['TAOBAO_ENDPOINT'] = config['endpoint']\n ENV['TAOBAO_AUTHORIZE'] = config['authorize']\n ENV['TAOBAO_TOKEN'] = config['token']\n ENV['TAOBAO_AUTHORIZE_REDIRECT_URI'] = config['authorize_redirect_uri']\n ENV['TAOBAO_TOKEN_REDIRECT_URI'] = config['token_redirect_uri']\n end",
"def initialize(config = {})\n init_config(config)\n raise ClientError.new \"Environment Variables must be specified as a hash, not a #{config[:environment].class}\" unless config[:environment].is_a?(Hash)\n end",
"def initialize( location = 'stage', env_file = File.expand_path(\"#{__FILE__}/../../config/stage.sh\"))\n @location = location\n @env_file = env_file\n envfile_hash = process_env_file( env_file )\n #ENV explicit settings override values found in a locations config file\n @data = Hash[ SQA_ECOMM_SERVER_URL: ENV.fetch( 'SQA_ECOMM_SERVER_URL', envfile_hash['SQA_ECOMM_SERVER_URL'] ),\n SQA_ECOMM_API_SERVER_URL: ENV.fetch( 'SQA_ECOMM_API_SERVER_URL', envfile_hash['SQA_ECOMM_API_SERVER_URL'] ),\n SQA_ECOMM_DB_SERVER: ENV.fetch( 'SQA_ECOMM_DB_SERVER', envfile_hash['SQA_ECOMM_DB_SERVER'] ),\n SQA_ECOMM_DB: ENV.fetch( 'SQA_ECOMM_DB', envfile_hash['SQA_ECOMM_DB'] ),\n SQA_ECOMM_DB_UPDATE_USER: ENV.fetch( 'SQA_ECOMM_DB_UPDATE_USER', envfile_hash['SQA_ECOMM_DB_UPDATE_USER'] ),\n SQA_ECOMM_DB_UPDATE_PW: ENV.fetch( 'SQA_ECOMM_DB_UPDATE_PW', envfile_hash['SQA_ECOMM_DB_UPDATE_PW'] ),\n SQA_ECOMM_DB_READONLY_USER: ENV.fetch( 'SQA_ECOMM_DB_READONLY_USER', envfile_hash['SQA_ECOMM_DB_READONLY_USER'] ),\n SQA_ECOMM_DB_READONLY_PW: ENV.fetch( 'SQA_ECOMM_DB_READONLY_PW', envfile_hash['SQA_ECOMM_DB_READONLY_PW'] ),\n SQA_ORACLE_DB_SERVER: ENV.fetch( 'SQA_ORACLE_DB_SERVER', envfile_hash['SQA_ORACLE_DB_SERVER'] ),\n SQA_ORACLE_DB_UPDATE_USER: ENV.fetch( 'SQA_ORACLE_DB_UPDATE_USER', envfile_hash['SQA_ORACLE_DB_UPDATE_USER'] ),\n SQA_ORACLE_DB_UPDATE_PW: ENV.fetch( 'SQA_ORACLE_DB_UPDATE_PW', envfile_hash['SQA_ORACLE_DB_UPDATE_PW'] ),\n SQA_ORACLE_DB_READONLY_USER: ENV.fetch( 'SQA_ORACLE_DB_READONLY_USER', envfile_hash['SQA_ORACLE_DB_READONLY_USER'] ),\n SQA_ORACLE_DB_READONLY_PW: ENV.fetch( 'SQA_ORACLE_DB_READONLY_PW', envfile_hash['SQA_ORACLE_DB_READONLY_PW'] ),\n SQA_HJ_DB_SERVER: ENV.fetch( 'SQA_HJ_DB_SERVER', envfile_hash['SQA_HJ_DB_SERVER'] ),\n SQA_HJ_DB: ENV.fetch( 'SQA_HJ_DB', envfile_hash['SQA_HJ_DB'] ),\n SQA_HJ_DB_UPDATE_USER: ENV.fetch( 'SQA_HJ_DB_UPDATE_USER', envfile_hash['SQA_HJ_DB_UPDATE_USER'] ),\n SQA_HJ_DB_UPDATE_PW: ENV.fetch( 'SQA_HJ_DB_UPDATE_PW', envfile_hash['SQA_HJ_DB_UPDATE_PW'] ),\n SQA_HJ_DB_READONLY_USER: ENV.fetch( 'SQA_HJ_DB_READONLY_USER', envfile_hash['SQA_HJ_DB_READONLY_USER'] ),\n SQA_HJ_DB_READONLY_PW: ENV.fetch( 'SQA_HJ_DB_READONLY_PW', envfile_hash['SQA_HJ_DB_READONLY_PW'] ),\n SQA_RUDI_SERVER: ENV.fetch( 'SQA_RUDI_SERVER', envfile_hash['SQA_RUDI_SERVER'] ),\n SQA_RUDI_VERSION: ENV.fetch( 'SQA_RUDI_VERSION', envfile_hash['SQA_RUDI_VERSION'] ),\n SQA_UNIBLAB_SERVER: ENV.fetch( 'SQA_UNIBLAB_SERVER', envfile_hash['SQA_UNIBLAB_SERVER'] ),\n SQA_UNIBLAB_VERSION: ENV.fetch( 'SQA_UNIBLAB_VERSION', envfile_hash['SQA_UNIBLAB_VERSION'] ) ]\n end",
"def prepare_environment(env)\n load_environment_properties(env)\n raise 'environment problem:environment not found' if @env_config.nil?\n create_required_files @env_config\n load_master_config @env_config['config_file']\n end",
"def config\n @config ||= YAML.load_file(config_file)[environment]\n end",
"def construct_environment(envs)\n envs.each do |key, value|\n if value\n value = value.to_s\n value = nil if value.length == 0\n end\n ENV[key.to_s] = value\n end\nend",
"def setup_config(environment, config_file, applicaton_root)\n begin\n config = YAML::load(File.open(config_file))[environment]\n @api_key = config['api-key'] unless config['api-key'].nil?\n @ssl_enabled = config['ssl'] unless config['ssl'].nil?\n @log_level = config['log-level'] unless config['log-level'].nil?\n @enabled = config['enabled'] unless config['enabled'].nil?\n @remote_port = config['remote-port'].to_i unless config['remote-port'].nil?\n @remote_host = config['remote-host'] unless config['remote-host'].nil?\n @adapter_name = config['adapter'] unless config['adapter'].nil?\n @work_dir = config['work_dir'] unless config['work_dir'].nil?\n @send_user_data = config['send-user-data'] unless config['send-user-data'].nil?\n\n @applicaton_root = applicaton_root\n\n log_config_info\n rescue Exception => e\n raise ConfigurationException.new(\"Unable to load configuration #{config_file} for environment #{environment} : #{e.message}\")\n end\n end",
"def initialize(config={}, &block)\n env = config.delete(:environment)\n self.config = Mash.new\n self.setup(self.defaults(env).merge(config))\n self.use(&block) if block_given?\n end",
"def environment=(env)\n self.config[:environment] = env.to_sym\n end",
"def env=(environment); end",
"def env=(environment); end",
"def to_env\n CONFIGURABLE_WITH_ENV.each_with_object({}) do |option, env|\n unless (value = @config[option]).nil?\n env[\"#{ ViteRuby::ENV_PREFIX }_#{ option.upcase }\"] = value.to_s\n end\n end.merge(ViteRuby.env)\n end",
"def initialize\n credentials = self.rails_credentials\n\n CONFIG_PARAMS.each do |param, config|\n value = (\n config[:sources]&.map { |s| credentials[s] }&.compact&.first ||\n config[:env_vars]&.map { |v| ENV[v] }&.compact&.first\n )\n\n if (value)\n if (config[:parse])\n instance_variable_set(config[:ivar], config[:parse].call(value))\n else\n instance_variable_set(config[:ivar], value)\n end\n else\n case (config[:default])\n when Proc\n instance_variable_set(config[:ivar], config[:default].call)\n else\n instance_variable_set(config[:ivar], config[:default])\n end\n end\n end\n end",
"def load!\n configs = {}\n @array.each_with_index do |obj, idx|\n next unless obj.start_with?('--' + @env_prefix)\n\n value = extract_value(obj, idx + 1)\n key = obj.split('=').first\n .sub(/^--#{@env_prefix}_?/, '')\n .downcase.split('__')\n recursive_set(configs, key, split_env_string(value))\n end\n configs\n end",
"def env_config\n OPTIONS.each do |name|\n if value = ENV[name]\n __send__(\"#{name}=\",value)\n end\n end\n end",
"def initialize\n @options = ArgumentParser.parse\n Environment.environment = @options[:environment] || \"production\"\n + @options.delete(:environment)\n end",
"def config(app_env)\n config = self.settings['config'] || {}\n all = config['all'] || {}\n\n # overwrite all configs with the environment specific ones\n all.merge(config[app_env] || {})\n end",
"def create_config_base\n # Create keys directory for environment\n FileUtils.cd(self.project_root) { FileUtils.mkdir_p \"config/environments/#{self.name}\" }\n FileUtils.cd(\"#{project_root}/config/environments/#{self.name}\") { FileUtils.mkdir_p %w{steps keys} }\n # Create ssh key for puppet user if environment is vagrant\n generate_puppet_user_keys('vagrant') if self.name == 'vagrant'\n end",
"def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend",
"def make_env build_spec\n env = []\n\n build_spec.env.keys.each { |k| env << \"#{k}=#{build_spec.env[k]}\" }\n\n unless @no_credentials\n sts_client = Aws::STS::Client.new profile: @profile\n session_token = sts_client.get_session_token\n credentials = session_token.credentials\n\n env << \"AWS_ACCESS_KEY_ID=#{credentials[:access_key_id]}\"\n env << \"AWS_SECRET_ACCESS_KEY=#{credentials[:secret_access_key]}\"\n env << \"AWS_SESSION_TOKEN=#{credentials[:session_token]}\"\n\n ssm = Aws::SSM::Client.new credentials: session_token\n build_spec.parameter_store.keys.each do |k|\n name = build_spec.parameter_store[k]\n param_value = ssm.get_parameter(:name => name, :with_decryption => true).parameter.value\n env << \"#{k}=#{param_value}\"\n end\n end\n\n add_region_variables env\n\n env\n end",
"def initialize\n @configurations = {}\n end",
"def configure\n @environment = facts.fetch(\"chef_environment\"){\"development\"}.downcase\n @fqdn = facts.fetch(\"fqdn\"){\"\"}\n @app_names = facts.fetch(\"trebuchet\"){[]}\n end",
"def create_environment(options={})\n if option_settings = options.delete('OptionSettings')\n options.merge!(AWS.indexed_param('OptionSettings.member.%d', [*option_settings]))\n end\n if options_to_remove = options.delete('OptionsToRemove')\n options.merge!(AWS.indexed_param('OptionsToRemove.member.%d', [*options_to_remove]))\n end\n request({\n 'Operation' => 'CreateEnvironment',\n :parser => Fog::Parsers::AWS::ElasticBeanstalk::CreateEnvironment.new\n }.merge(options))\n end",
"def configure_settings\n @env = deep_merge(env.dup, configuration[:env]) if configuration[:env]\n @vm = vm.merge(configuration[:vm]) if configuration[:vm]\n end",
"def build_environment(autoinst)\n environment = {\n \"AYTESTS_FILES_DIR\" => files_dir.to_s,\n \"AYTESTS_PROVIDER\" => provider.to_s,\n \"AYTESTS_WEBSERVER_PORT\" => WEBSERVER_PORT,\n \"AYTESTS_MAC_ADDRESS\" => MAC_ADDRESS\n }\n linuxrc_file = autoinst.sub_ext(\".linuxrc\")\n environment[\"AYTESTS_LINUXRC\"] = File.read(linuxrc_file).chomp if linuxrc_file.exist?\n environment\n end",
"def setup\n FileUtils.cp(VALID_CONFIG_JSON_ORIG, CONFIG_JSON)\n @config = Thermoserver::Configuration.new\n @api_key = @config.api_key\n end",
"def read_config\n db_config = YAML.load_file('config/database.yml.production')\n set :db_user, db_config[rails_env][\"username\"]\n set :db_password, db_config[rails_env][\"password\"] \n set :db_name, db_config[rails_env][\"database\"]\nend",
"def read_config\n db_config = YAML.load_file('config/database.yml.production')\n set :db_user, db_config[rails_env][\"username\"]\n set :db_password, db_config[rails_env][\"password\"] \n set :db_name, db_config[rails_env][\"database\"]\nend",
"def application_environment\n {\n infra: {\n provider: cluster.config.provider,\n },\n platform: {\n feature_set: current_feature_set,\n infra: {\n resources: {\n storage: {\n buckets:\n infra.settings.components.object_storage.components.each_with_object({}) do |(name, config), hash|\n hash[name] = Hash.new\n hash[name]['name'] = \"#{name}-#{bucket_base}\"\n config.to_hash.reject { |key| key.eql?(:services) }.each_pair { |key, value| hash[name][key] = value }\n end,\n services:\n infra.settings.components.object_storage.components.each_with_object({}) do |(name, config), hash|\n config.services.each do |dir|\n hash[dir] = \"#{name}\"\n end\n end\n },\n cdns: infra.settings.components.cdn.components.to_hash\n }\n }\n }\n }\n end",
"def environment(configuration, chain)\n\t\t\tchain = chain.partial(self)\n\t\t\t\n\t\t\t# Calculate the dependency chain's ordered environments:\n\t\t\tenvironments = chain.provisions.collect do |provision|\n\t\t\t\tBuild::Environment.new(&provision.value)\n\t\t\tend\n\t\t\t\n\t\t\t# Merge all the environments together:\n\t\t\tenvironment = Build::Environment.combine(*environments)\n\t\t\t\n\t\t\tenvironment.merge do\n\t\t\t\tdefault platforms_path configuration.platforms_path\n\t\t\tend\n\t\tend",
"def initialize(env_name, name, url, configuration_hash = {})\n super(env_name, name, configuration_hash)\n\n @url = url\n @configuration_hash = @configuration_hash.merge(build_url_hash).freeze\n end",
"def config(app_env)\n name, env = app_env.split(SEPARATOR)\n config = self.settings['config'] || {}\n all = config['all'] || {}\n\n app_configs = (config[name] && config[name].reject { |k,v| v.class == Hash }) || {}\n # overwrite app configs with the environment specific ones\n merged_environment_configs = app_configs.merge((config[name] && config[name][env]) || {})\n\n # overwrite all configs with the environment specific ones\n all.merge(merged_environment_configs)\n end",
"def initialize(options = {})\n application_configuration.merge!(options)\n configuration_options.each do |key|\n send(\"#{key}=\", application_configuration[key])\n end\n end",
"def initialize(env, config)\n @env = env\n @config = config\n end",
"def with(environment)\n _config_store.add_env environment\n yield if block_given?\n ensure\n _config_store.pop_env\n end",
"def initialize(options = {})\n opts = options.to_h.dup\n @env = Mooncell::Env.new(env: opts.delete(:env) || ENV)\n LOCK.synchronize { load_env_vars! }\n end",
"def initialize(filename, environment = nil)\n raise \"Config #{filename} not found\" unless File.exist? filename\n @filename = filename\n @environment = environment || current_environment\n end",
"def config\n @config ||=\n begin\n raise(ConfigError, \"Cannot find config file: #{file_name}\") unless File.exist?(file_name)\n\n env_config = self.class.load_yaml(ERB.new(File.new(file_name).read).result)[env]\n raise(ConfigError, \"Cannot find environment: #{env} in config file: #{file_name}\") unless env_config\n\n env_config = self.class.send(:deep_symbolize_keys, env_config)\n self.class.send(:migrate_old_formats!, env_config)\n end\n end",
"def config\n root.join('config', 'environment.rb')\n end",
"def config\n Config.new(@sources, @deployments)\n end",
"def env(name, value)\n Stairs.configuration.env_adapter.set name, value\n end",
"def env\n\t\t@rootDir = Dir.new( @rootDir )\n\n\t\t# config file exist\n\t\tif Dir.exist?( @configDir )\n\t\t\t@configDir = Dir.new( @configDir )\n\t\telse\n\t\t\t@configDir = Dir.mkdir( @configDir )\n\t\tend\n\n\t\t@configFile = File.join( @configDir, @configFile )\n\n\t\t# parse config file\n\t\t@configFile = File.new( @configFile ) unless !File.exist?( @configFile )\n\n\t\t@configFile = JSON.parse( @configFile )\n\n\t\tif @configFile['webroot'] == nil\n\t\t\t@configFile['webroot'] = @@webroot\n\t\tend\n\n\t\tif @configFile['port'] == nil\n\t\t\t@configFile['port'] = @@port\n\t\tend\n\tend",
"def create_configuration\n Configuration.new(\n access_token: ENV.fetch('SQUARE_SANDBOX_TOKEN', 'AccessToken'),\n environment: 'sandbox', http_callback: HttpResponseCatcher.new\n )\n end",
"def initialize_environment\n end",
"def initialize_environment\n end",
"def from_env\r\n return if not @name\r\n @owner = true\r\n replace( ENV[@name] )\r\n end",
"def load_environment!(opts=nil)\n env_path = File.join(root_path, 'sc-config')\n env_path = File.join(root_path, 'sc-config.rb') if !File.exists?(env_path)\n \n @environment = {}\n if File.exists?(env_path)\n f = File.read(env_path)\n eval(f) # execute the config file as if it belongs.\n end\n\n # Override any all options with load_opts\n if build_numbers = @load_opts[:build_numbers]\n @load_opts.delete(:build_numbers)\n build_numbers.each do | bundle_name, build_number |\n env = @environment[bundle_name.to_sym] ||= {}\n env[:build_number] = build_number\n end\n end\n \n (@environment[:all] ||= {}).merge!(@load_opts)\n\n end",
"def env\n config.env\n end",
"def env\n config.env\n end",
"def independent_config\n initial_config.deep_merge(persistent_config_hash)\n end",
"def initialize attributes={}\n self.config = attributes[:config]\n end",
"def load_config()\n self.config = Kitchenplan::Config.new().config\n end",
"def app_config\n {\n env: Rails.env,\n host: ENV[\"RENDER_EXTERNAL_URL\"],\n veue: {\n env: ENV[\"VEUE_ENV\"] || \"dev\",\n revision: ENV[\"RENDER_GIT_COMMIT\"] || `git rev-parse HEAD`,\n branch: ENV[\"RENDER_GIT_BRANCH\"] || `git branch --show-current`,\n },\n service: {\n id: ENV[\"RENDER_SERVICE_ID\"],\n name: ENV[\"RENDER_SERVICE_NAME\"],\n pod: ENV[\"RENDER_POD_NAME\"],\n },\n appsignal: {\n key: ENV[\"APPSIGNAL_FRONTEND_KEY\"],\n },\n }\n end",
"def initialize(name = nil, env_name_prefix: '', env_suffix: '', extends: nil)\n @name = name&.to_sym\n @extends = extends\n @env = extends&.instance_variable_get(:@env)\n @env_default = extends&.instance_variable_get(:@env_default)\n @namespaces = extends&.namespaces&.dup || { }\n @parameters = extends&.parameters&.dup || { }\n @env_suffix = env_suffix\n @env_name_prefix = name ? Configature::Support.extend_env_prefix(env_name_prefix, name) : ''\n\n @config_name = extends&.config_name || name\n\n yield(self) if (block_given?)\n end",
"def load_environment_file(f)\n do_or_die(File.exists?(f),\"Loading environments from #{f}\",\n \"Environment file #{f} does not exist\")\n supp_envs = YAML.load_file(f)\n supp_envs.each_with_object([]) do |(name,options),envs|\n\n # store the environment name inside its configuration hash\n options[:name] = name\n \n # translate alternative keywords for export filters\n %w(filter filters export-filters).each do |f|\n if options.include?(f) \n options[:export_filters] = options[f].split(/[ ,]/)\n options.delete(f) \n end \n end \n\n options = options.each_with_object({}){|(k,v),h| h[k.to_sym] = v} # symbolise keys\n\n # convert arrays into comma-delimited strings\n options = options.each_with_object({}) do |(k,v),h|\n h[k] = v.is_a?(Array) ? v.join(',') : v\n end\n\n # convert space-delimited into comma-delimited strings\n %i(destination with_tags without_tags).each do |f|\n options[f] = options[f].split(/[ ,]/).join(',') if options.include?(f)\n end\n\n envs << options # add hash to environments array\n end\n end",
"def load(options = {})\n @provider_dir = Path.provider\n\n # load base\n @base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base), Config::Tag)\n @base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base), Config::Tag)\n @base_common = load_json( Path.named_path(:common_config, Path.provider_base), Config::Object)\n @base_provider = load_json( Path.named_path(:provider_config, Path.provider_base), Config::Provider)\n\n # load provider\n @nodes = load_all_json(Path.named_path([:node_config, '*'], @provider_dir), Config::Node)\n @common = load_json( Path.named_path(:common_config, @provider_dir), Config::Object)\n @secrets = load_json( Path.named_path(:secrets_config, @provider_dir), Config::Secrets)\n @common.inherit_from! @base_common\n\n # For the default environment, load provider services, tags, and provider.json\n log 3, :loading, 'default environment...'\n env('default') do |e|\n e.services = load_all_json(Path.named_path([:service_config, '*'], @provider_dir), Config::Tag, :no_dots => true)\n e.tags = load_all_json(Path.named_path([:tag_config, '*'], @provider_dir), Config::Tag, :no_dots => true)\n e.provider = load_json( Path.named_path(:provider_config, @provider_dir), Config::Provider, :assert => true)\n e.services.inherit_from! @base_services\n e.tags.inherit_from! @base_tags\n e.provider.inherit_from! @base_provider\n validate_provider(e.provider)\n end\n\n # create a special '_all_' environment, used for tracking the union\n # of all the environments\n env('_all_') do |e|\n e.services = Config::ObjectList.new\n e.tags = Config::ObjectList.new\n e.provider = Config::Provider.new\n e.services.inherit_from! env('default').services\n e.tags.inherit_from! env('default').tags\n e.provider.inherit_from! env('default').provider\n end\n\n # For each defined environment, load provider services, tags, and provider.json.\n environment_names.each do |ename|\n next unless ename\n log 3, :loading, '%s environment...' % ename\n env(ename) do |e|\n e.services = load_all_json(Path.named_path([:service_env_config, '*', ename], @provider_dir), Config::Tag, :env => ename)\n e.tags = load_all_json(Path.named_path([:tag_env_config, '*', ename], @provider_dir), Config::Tag, :env => ename)\n e.provider = load_json( Path.named_path([:provider_env_config, ename], @provider_dir), Config::Provider, :env => ename)\n e.services.inherit_from! env('default').services\n e.tags.inherit_from! env('default').tags\n e.provider.inherit_from! env('default').provider\n validate_provider(e.provider)\n end\n end\n\n # apply inheritance\n @nodes.each do |name, node|\n Util::assert! name =~ /^[0-9a-z-]+$/, \"Illegal character(s) used in node name '#{name}'\"\n @nodes[name] = apply_inheritance(node)\n end\n\n # do some node-list post-processing\n cleanup_node_lists(options)\n\n # apply control files\n @nodes.each do |name, node|\n control_files(node).each do |file|\n begin\n node.eval_file file\n rescue ConfigError => exc\n if options[:continue_on_error]\n exc.log\n else\n raise exc\n end\n end\n end\n end\n end",
"def initialize\n\t\t@configurations = Array.new\n\tend",
"def configure(name: nil, ports: [], volumes: [], env: {}, create_args: [])\n @settings[name] ||= { :ports => [], :volumes => [], :env => {}, :create_args => []}\n @settings[name][:ports].concat(ports)\n @settings[name][:volumes].concat(volumes)\n @settings[name][:env].merge!(env)\n @settings[name][:create_args].concat(create_args)\n end",
"def test_single_environment_set_env_no_name\n cfg = DBGeni::Config.new\n cfg.load(\"environment('foo') { } \\n\")\n cfg.set_env\n assert_equal('foo', cfg.current_environment)\n end",
"def config\n config = {}\n config['recipes'] = []\n config['recipes'] |= hash_path(@default_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(@default_config, 'recipes', @platform) || []\n @group_configs.each do |group_name, group_config|\n config['recipes'] |= hash_path(group_config, 'recipes', 'global') || []\n config['recipes'] |= hash_path(group_config, 'recipes', @platform) || []\n end\n people_recipes = @people_config['recipes'] || {}\n config['recipes'] |= people_recipes['global'] || []\n config['recipes'] |= people_recipes[@platform] || []\n config['attributes'] = {}\n config['attributes'].deep_merge!(@default_config['attributes'] || {}) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n @group_configs.each do |group_name, group_config|\n config['attributes'].deep_merge!(group_config['attributes']) { |key, old, new| Array.wrap(old) + Array.wrap(new) } unless group_config['attributes'].nil?\n end\n people_attributes = @people_config['attributes'] || {}\n config['attributes'].deep_merge!(people_attributes) { |key, old, new| Array.wrap(old) + Array.wrap(new) }\n config\n end",
"def setup()\n @configuration = {}\n @configuration.merge!(defaults)\n @configuration\n end",
"def config\n {\n :APP_NAME => APP_NAME,\n :APP_ENV => APP_ENV,\n :AWS_ACCESS_KEY_ID => AMI_ACCESS_KEY_ID,\n :AWS_SECRET_ACCESS_KEY => AMI_SECRET_ACCESS_KEY\n }\nend",
"def configure (*envs, &block)\n\n (@configures ||= []) << [ envs.collect { |e| e.to_s }, block ]\n end",
"def configure var={}\n \t{path: './', version: '0.1.0', mode: 'production'}.merge(var)\n end",
"def init(config)\n config.each{|k, v|\n @config[k] = v\n }\n end",
"def global_config_from(machine)\n env = machine.env.config_global\n end",
"def with_environment(env)\n save_vals = env.keys.collect { |k| [k, ENV[k.to_s]] }\n begin\n env.each { |k, v| ENV[k.to_s] = v }\n yield\n ensure\n save_vals.each { |k, v| ENV[k.to_s] = v }\n end\nend",
"def default_environment=(env); end",
"def env(name, id, registry = '')\n Env.new(registry + repository_name, id.to_s, config[name.to_s])\n end",
"def initialize(*args, &block)\n @id = self.class.get_id\n if args.first.is_a?(String)\n base_name = args.slice!(0)\n else\n base_name = \"e.#{@id}\"\n end\n variant_keys = (Rscons.application.active_variants || []).map do |variant|\n variant[:key]\n end.compact\n @name = [base_name, *variant_keys].join(\"-\")\n options = args.first || {}\n unless Cache.instance[\"configuration_data\"][\"configured\"]\n raise \"Project must be configured before creating an Environment\"\n end\n super(options)\n # Hash of Thread object => {Command} or {Builder}.\n @threads = {}\n @registered_build_dependencies = {}\n # Set of side-effect files that have not yet been built.\n @side_effects = Set.new\n @builder_sets = []\n @build_targets = {}\n @user_deps = {}\n # Hash of builder name (String) => builder class (Class).\n @builders = {}\n @build_hooks = {pre: [], post: []}\n unless options[:exclude_builders]\n DEFAULT_BUILDERS.each do |builder_class_name|\n builder_class = Builders.const_get(builder_class_name)\n builder_class or raise \"Could not find builder class #{builder_class_name}\"\n add_builder(builder_class)\n end\n end\n @echo =\n if options[:echo]\n options[:echo]\n elsif Rscons.application.verbose\n :command\n else\n :short\n end\n @build_root = \"#{Rscons.application.build_dir}/#{@name}\"\n @n_threads = Rscons.application.n_threads\n @build_steps = 0\n self.class.register(self)\n if block\n Environment.running_environment = self\n block[self]\n Environment.running_environment = nil\n end\n end",
"def with_environment(env); end",
"def build_environment(env, env_yaml, platform)\n # substitute vcenter resources from vcenter.yml for location defined in environment file\n env_yaml['vcenter'] = platform.vcenter[env_yaml['vcenter']]\n # merge component resources from environment file and platform definition\n # platform info will be inserted where not found in env files, env overrides will be unchanged\n #\n # Note: this function does not do error checking for components that exist in env file but\n # not in Platform definition. Such files will be retained but not have any Platform\n # component info. The Build command will run error checking before building, but to support\n # the debugging value of the list command only hash.merge! is performed at this point.\n platform.components.each do |component, _config|\n env_yaml['components'][component].merge!(platform.components[component]) { |_key, v1, _v2| v1 } unless env_yaml['components'][component].nil?\n end\n # substitute network and components for specified values from platform definition files\n env_yaml['components'].each do |component, _config|\n env_yaml['components'][component]['network'] = platform.network[env_yaml['components'][component]['network']]\n env_yaml['components'][component]['compute'] = platform.compute[env_yaml['components'][component]['compute']]\n unless env_yaml['components'][component]['runlist'].nil?\n env_yaml['components'][component]['runlist'] = run_list(env_yaml['components'][component]['runlist'], env_yaml['components'][component]['componentrole'], component)\n end\n end\n unless env_yaml['vcenter'].nil?\n # append env name to destination folder if appendenv == true\n env_yaml['vcenter']['destfolder'] += (env_yaml['vcenter']['appendenv'] ? '/' + env.to_s : '')\n # prepend app name to domain if appenddomain == true\n env_yaml['vcenter']['appenddomain'] ? env_yaml['vcenter']['domain'] = '.' + platform.name + '.' + env_yaml['vcenter']['domain'] : ''\n end\n env_yaml\n end",
"def initialize\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n end",
"def default_config\n data = {\n 'acr_values' => ENV['acr_values'] || 'http://idmanagement.gov/ns/assurance/ial/1',\n 'client_id' => ENV['client_id'] || 'urn:gov:gsa:openidconnect:sp:sinatra',\n 'mock_irs_client_id' => ENV['mock_irs_client_id'] ||\n 'urn:gov:gsa:openidconnect:sp:mock_irs',\n 'redirect_uri' => ENV['redirect_uri'] || 'http://localhost:9292/',\n 'sp_private_key_path' => ENV['sp_private_key_path'] || './config/demo_sp.key',\n 'redact_ssn' => true,\n 'cache_oidc_config' => true,\n }\n\n # EC2 deployment defaults\n\n env = ENV['idp_environment'] || 'int'\n domain = ENV['idp_domain'] || 'identitysandbox.gov'\n\n data['idp_url'] = ENV.fetch('idp_url', nil)\n unless data['idp_url']\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n end\n data['sp_private_key'] = ENV.fetch('sp_private_key', nil)\n\n data\n end",
"def initialize env\n @env = env\n super()\n end",
"def initialize env\n @env = env\n super()\n end",
"def load!\n if !loaded?\n @loaded = true\n\n logger.info(\"environment\") { \"Loading configuration...\" }\n load_config!\n\n self\n end\n end",
"def configuration\n @config ||= setup\n end",
"def load_config!\n config = YAML.load_file @config_path\n\n unless config.key? @environment\n raise ClientError, \"No configuration found for specified environment `#{@environment}'\"\n end\n\n @config = config[@environment]\n @config.deeper_merge! DEFAULT_CONFIG\n\n emit :config_load\n end",
"def initialize_environment(args, options, config)\n raise Errors::CLIMissingEnvironment.new if !config[:env]\n @env = config[:env]\n @env.ui = UI::Shell.new(@env, shell) if !@env.ui.is_a?(UI::Shell)\n end"
] |
[
"0.70851594",
"0.665301",
"0.65740186",
"0.65740186",
"0.65740186",
"0.65740186",
"0.6555943",
"0.6526633",
"0.64551026",
"0.64226204",
"0.6369767",
"0.6290395",
"0.6279958",
"0.6275706",
"0.62677073",
"0.6252293",
"0.6249908",
"0.6249908",
"0.6202572",
"0.61791444",
"0.6114194",
"0.6077905",
"0.6071139",
"0.60197103",
"0.60130805",
"0.60107833",
"0.600696",
"0.60049504",
"0.5980293",
"0.59621483",
"0.59488934",
"0.59488934",
"0.5944988",
"0.59288096",
"0.5928099",
"0.59206945",
"0.59206295",
"0.5911294",
"0.58982086",
"0.58833975",
"0.58244455",
"0.5822672",
"0.58193743",
"0.5818894",
"0.5787892",
"0.5783192",
"0.578275",
"0.57679987",
"0.57679987",
"0.5762553",
"0.5734261",
"0.5717246",
"0.5707427",
"0.5703968",
"0.5690197",
"0.56887364",
"0.5687769",
"0.56790614",
"0.56771713",
"0.5676943",
"0.5670963",
"0.5667235",
"0.5665803",
"0.5662648",
"0.5660959",
"0.5660959",
"0.56554615",
"0.56549406",
"0.5645126",
"0.5645126",
"0.56439525",
"0.5640849",
"0.5630335",
"0.5627757",
"0.56247556",
"0.5620076",
"0.5614945",
"0.5611771",
"0.5608044",
"0.5606896",
"0.56003296",
"0.55990607",
"0.55918884",
"0.5589599",
"0.5580683",
"0.5577285",
"0.5569663",
"0.5564873",
"0.5564197",
"0.5561898",
"0.5553903",
"0.5547706",
"0.5547638",
"0.5546852",
"0.55417657",
"0.5541183",
"0.5541183",
"0.55386615",
"0.55351365",
"0.5532899",
"0.5526345"
] |
0.0
|
-1
|
Determine and report (to stderr) whether or not we have enough information to prepare.
|
def validate
reasons = []
if @content_id_base.empty?
reasons << "CONTENT_ID_BASE is missing. It should be the common prefix used to generate " \
"IDs for content within this repository."
end
unless reasons.empty?
$stderr.puts "Unable to prepare content because:"
$stderr.puts
$stderr.puts reasons.map { |r| " * #{r}\n"}.join
$stderr.puts
@should_submit = false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sanityCheck\n @executor.nil? and raise \"Executor has not been initialized.\"\n @manipulator.nil? and raise \"Manipulator has not been initialized.\"\n @monitor.nil? and raise \"Monitor has not been initialized.\"\n @subject.nil? and raise \"Subject has not been initialized.\"\n end",
"def check_sanity\n errors = []\n [:site, :uri, :user, :password, :confdir].each do |sym|\n if @config[sym].nil?# or @config[sym].empty?\n errors << \"Option '#{sym}' is required\"\n end\n end\n unless errors.empty?\n $stderr.puts 'ERROR: The following problems were detected:'\n errors.map { |e| $stderr.puts \" * #{e}\" }\n $stderr.puts \"\\nConfiguration options:\\n\"\n ap @config\n exit 1\n end\n end",
"def prepare\n true\n end",
"def prepare\n true\n end",
"def prepare\n prepare_prerequisites\n @prepared = true\n end",
"def test_required\n required = true\n if @subject.nil? || @subject.empty?\n WhoToWho.log.warn 'you need define a subject'\n required = false\n end\n\n if @content.nil? || @content.empty?\n WhoToWho.log.warn 'you need define a file or a file not empty for you mail template'\n required = false\n end\n\n if @list_link.nil? || @list_link.empty? || @list_link.size < 2\n WhoToWho.log.warn 'The list of data need define by a file. This file can\\'t be empty or only one data'\n required = false\n end\n\n if ActionMailer::Base.smtp_settings.empty?\n WhoToWho.log.warn 'The configuration of your SMTP account can\\'t be empty'\n required = false\n end\n\n if @from.nil? || @from.empty?\n WhoToWho.log.warn 'You need define a from in your mail settings.'\n required = false\n end\n\n unless required\n puts @full_print\n exit\n end\n end",
"def prepare\n prepare_sources\n prepare_rubygems\n prepare_gems\n end",
"def check_mandatory!\n if options.work_dir.nil?\n kill \"missing file operand\"\n end\n if options.contents_template.nil?\n kill \"could not find contents template\"\n end\n end",
"def sanity_checks_on_parameters()\n # Check that all necessary properties are here.\n raise(\"Properties file must contain a value for 'source_dir'\") if @source_dir == nil\n raise(\"Properties file must contain a value for 'known_exceptions'\") if @known_exceptions_file == nil\n raise(\"Properties file must contain a value for 'skip_directories'\") if @skip_directories_list == nil\n raise(\"Properties file must contain a value for 'file_matchers'\") if @file_match_list == nil\n raise(\"Properties file must contain a value for 'report_level'\") if @report_level_string == nil\n\n if !File.exist?(@source_dir)\n raise \"Source directory does not exist: #{@source_dir}\"\n end\n\n if !File.exist?(@known_exceptions_file)\n raise \"Known exceptions file does not exist: #{@known_exceptions_file}\"\n end\n end",
"def setup?\n @setup\n end",
"def sanity_check\n # Check iptables FILTER table for our chef chain\n begin\n shell_out!('iptables -nL Promethean')\n rescue Mixlib::ShellOut::ShellCommandFailed\n\tinfo(\"Defining Promethean chain\")\n shell_out!('iptables -N Promethean')\n end\n\n # Check iptables FILTER INPUT chain for a jump to our chef chain\n unless shell_out!('iptables -nL INPUT').stdout.lines.find { |line| line =~ /^Promethean[ ]*all/ }\n\tinfo(\"Adding Promethean chain to input table\")\n shell_out!('iptables -A INPUT -j Promethean')\n end\n\n # Check the header of our file\n # If it's not there, blast the file and rewrite the header\n res = @new_resource\n saved_header = nil\n if ::File.exist?(res.script_path) and ::File.size(res.script_path) > 0\n saved_header = ::File.open(res.script_path) { |f| f.readline.chomp }\n end\n header = 'iptables -F Promethean'\n if saved_header.nil? || saved_header != header\n info(\"No header in #{res.script_path}, writing #{header}\")\n\t::File.open(res.script_path, 'w') do |f|\n f.puts header\n end\n return true\n end\n\n false\nend",
"def prepare(options = {})\n raise \"prepare not implemented\"\n end",
"def check_error\n if @errors.empty?\n false\n else\n @log.error(@taskname) { \"--- Configuration for #{@taskname} ---\" }\n @doc.each do |doc|\n @log.error(@taskname) { \"#{doc}\" }\n end\n @log.error(@taskname) { \"--- Errors found for #{@taskname} ---\" }\n @errors.each do |error|\n @log.error(@taskname) { \" #{error}\" }\n end\n @log.fatal(@taskname) { 'terminated' }; exit\n end\n end",
"def fail_without_prereqs(packer_yaml, simp_conf_yaml, vars_json)\n raise \"ERROR: Test dir not found at '#{@test_dir}'\" unless File.directory?(@test_dir)\n\n if @verbose\n warn(\n '', \"Contents of test_dir (#{@test_dir}):\",\n Dir[\"#{@test_dir}/*\"].map { |x| \" #{File.basename(x)}\\n\" }.join, ''\n )\n end\n # TODO: we shouldn't handle these files, we should accept data\n raise \"ERROR: packer.yaml not found at '#{packer_yaml}'\" unless File.file?(packer_yaml)\n raise \"ERROR: simp.conf.yaml not found at '#{simp_conf_yaml}'\" unless File.file?(simp_conf_yaml)\n raise \"ERROR: vars.json not found at '#{vars_json}'\" unless File.file?(vars_json)\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 exit!\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 exit!\n end\n rescue LoadError => bam\n @log.error bam\n exit!\n end\n \n return true\n end",
"def prepare_command\n info(\"Preparing the SUT and Pester dependencies...\")\n resolve_downloads_paths!\n really_wrap_shell_code(install_command_script)\n end",
"def prepare\n raise NotImplementedError\n end",
"def prepared?\n @prepared\n end",
"def env_check\n unless Position.count.zero?\n $stderr.puts \"Position table is not empty! (needs to be truncated first)\"\n exit(5)\n end\n end",
"def env_check\n unless Position.count.zero?\n $stderr.puts \"Position table is not empty! (needs to be truncated first)\"\n exit(5)\n end\n end",
"def prepare\n started_at = DateTime.now.to_s\n prepare_deploy\n prepare_common_installation\n puppet_installation\n create_prepare_checkpoint(started_at)\n end",
"def prepared?\n @prepared\n end",
"def check_configuration_options\r\n if ($project_name == \"\")\r\n\t raise 'Project name must be set' \r\n\tend\r\n\tif ($repo_key == \"\")\r\n raise 'Repository is required'\r\n end\r\n\tif ($target_repo_key == \"\")\r\n raise 'Target repository is required'\r\n\tend\r\n\tif ($username == \"\")\r\n raise 'Codeporting username must be provided'\r\n\tend\r\n\tif ($password == \"\")\r\n raise 'Codeporting password must be provided'\r\n\tend\r\n end",
"def precheck\n if !BinarySolo.dir_valid?\n puts \"this is not a binary_solo directoy => better run $ binarysolo init\".colorize(:red)\n false\n elsif !BinarySolo.config_valid?\n puts \"your config is invalid - but I dont have any details for you (yet)\".colorize(:red)\n false\n else\n true\n end\nend",
"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 prepared?\n !!@prepared\n end",
"def prepared?\n !!@prepared\n end",
"def SanityCheck(silent)\n return true # FIXME!\n if !@init_pkg_data_complete\n if !silent\n Builtins.y2error(\n \"PackageSlideShow::SanityCheck(): Slide show not correctly initialized: \" +\n \"PackageSlideShow::InitPkgData() never called!\"\n )\n end\n return false\n end\n\n if Ops.less_than(@current_src_no, 1) || Ops.less_than(@current_cd_no, 1)\n # nothing to install but something is going to be deleted, so it's OK\n if Pkg.IsAnyResolvable(:package, :to_remove)\n return true\n elsif !silent\n Builtins.y2error(\n -1,\n \"PackageSlideShow::SanityCheck(): Illegal values for current_src_no (%1) or current_cd_no (%2)\",\n @current_src_no,\n @current_cd_no\n )\n Builtins.y2milestone(\"total sizes: %1\", @total_sizes_per_cd_per_src)\n end\n return false\n end\n\n true\n end",
"def check\n unless check_tables\n puts \"CBAC: not properly initialized: one or more tables are missing. Did you install it correctly? (run generate)\"\n return false\n end\n\n return true\n end",
"def prepare\n @prepare ||= default_prepare\n end",
"def verify_configuration\n if options.config_check?\n unless File.exists?(\"#{Rails.root}/config/initializers/cambium.rb\")\n help_message('cambium_prereqs')\n exit\n end\n end\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n end",
"def prepare\n unless File.readable?(@config[:cache_directory]) &&\n File.writable?(@config[:cache_directory])\n raise NotAccessible, @config[:cache_directory]\n end\n true\n end",
"def config_tool_needed?\n false\n end",
"def prepare\n if not File.exists?(OBS_BUILD_DIR)\n FileUtils.mkdir_p OBS_BUILD_DIR\n end\n cleanup\n end",
"def needed_if_relevant?\n false\n end",
"def check_required\n # handle case where no files or text were passed (a tty is connected or STDIN is EOF in the latter case)\n return unless @options.files.to_a.empty? && (@stdin.tty? || @stdin.eof?) # to_a.empty? handles nil or empty case\n\n puts 'Either specify input file(s) or pipe text to STDIN'\n show_help\n end",
"def options_valid?\n loaded_config? &&\n output_base_valid? &&\n have_sample_ids? &&\n sample_ids_in_config?\nend",
"def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end",
"def report_ready\n self.logger.info \"Opbeat #{VERSION} ready to catch errors\"\n end",
"def validate_params\n puts\n puts \"You're about to import data in your '#{Rails.env}' instance.\"\n puts \"You'll use the following source files:\"\n puts \" users: #{options['users'] || '-'} \"\n puts \" projects: #{options['projects'] || '-'}\"\n puts \" issues: #{options['issues'] || '-'}\"\n puts\n puts \"/!\\\\ Make sure to have a backup of your database before continuing.\"\n puts\n print 'Is this ok ? [y/n]: '\n STDOUT.flush\n ok = STDIN.gets.chomp!\n exit 2 if ok != 'y'\n puts\n end",
"def prepare\n return if @@prepared\n @@prepared = true\n FileUtils.mkdir_p(File.dirname(logfile))\n File.write(logfile, '')\n end",
"def needed_if_relevant?\n false\n end",
"def check_environment\n load_rscribd\n check_config\n check_fields\n end",
"def failed?\n closed? && !has_met_requirement?\n end",
"def prepare\n end",
"def check_environment\n if @hostname == nil || @port == nil || @username == nil || @api_key == nil\n raise \"environment variables not set. Please check that you have the following set...\\nJENKINS_HOSTNAME\\nJENKINS_PORT\\nJENKINS_USERNAME\\nJENKINS_API_KEY\"\n end\nend",
"def check_environment\n if @hostname == nil || @port == nil || @username == nil || @api_key == nil\n raise \"environment variables not set. Please check that you have the following set...\\nJENKINS_HOSTNAME\\nJENKINS_PORT\\nJENKINS_USERNAME\\nJENKINS_API_KEY\"\n end\nend",
"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 failed?\n #FIXME: this should probably be refactored\n warnings_to_display.any?\n end",
"def puppet_detailed_exit_code_indicates_error?(ec)\n return (ec == 4 or ec == 6 or ec == 1)\n end",
"def setup\n @bigquery = $bigquery\n @prefix = $prefix\n @storage = $storage\n @bucket = $bucket\n @samples_bucket = $samples_bucket\n @samples_public_table = $samples_public_table\n @kms_key = $kms_key\n @kms_key_2 = $kms_key_2\n\n refute_nil @bigquery, \"You do not have an active bigquery to run the tests.\"\n refute_nil @prefix, \"You do not have an bigquery prefix to name the datasets and tables with.\"\n refute_nil @storage, \"You do not have an active storage to run the tests.\"\n refute_nil @bucket, \"You do not have a storage bucket to run the tests.\"\n refute_nil @samples_bucket, \"You do not have a bucket with sample data to run the tests.\"\n refute_nil @samples_public_table, \"You do not have a table with sample data to run the tests.\"\n refute_nil @kms_key, \"You do not have a kms key to run the tests.\"\n refute_nil @kms_key_2, \"You do not have a second kms key to run the tests.\"\n\n super\n end",
"def prepare()\n end",
"def check_for_required_files(opts={})\n missing_files = 0\n $generated_files.each do |f|\n if !File.exists?(f)\n puts \"Required file missing: #{f}\"\n missing_files +=1\n end\n end\n if missing_files > 0\n error = \"#{missing_files} required files not found. Run `rake build` before deploying.\"\n if opts[:warning] then puts error else fail error end\n end\nend",
"def report_ready\n write_verbose_log(\"Notifier #{VERSION} ready to catch errors\", :info)\n end",
"def environmentOK?()\n\tcommandsMissing = []\n\tNEEDED_COMMANDS.each{ |command|\n\t\tif !which(command)\n\t\t\tcommandsMissing.push(command)\n\t\tend\n\t}\n\tif commandsMissing.size > 0\n\tputs \"You are missing following programs:\\n\"\n\tcommandsMissing.each { |command|\n\t\tputs \"\\t#{command}\\n\"\n\t}\n\treturn false\n\tend\n\treturn true\nend",
"def correct_setup?\n return required_keys_and_proper_remote_configuration_repo? &&\n local_configuration_repo_exists?\n end",
"def valid?\n gemfile? && gemfile_lock? && gem?(\"rake\") &&\n (gem?(\"thin\") || gem?(\"puma\")) && config_ru? &&\n rakefile? && task?(\"db:migrate\") && task?(\"db:setup\")\n end",
"def prepare\n end",
"def prepare\n end",
"def pre_run_check\n Puppet.warning(\"#{self[:name]}: Doing some pre-run checks\")\n binding.pry if defined?(Pry)\n end",
"def setup?\n @options\n end",
"def setup?\n @options\n end",
"def ready_to_create?\n valid? && processed? && import_level_ok?\n end",
"def prepare_for_installation; end",
"def options_parsed?\n opts = OptionParser.new() do |o|\n o.on('-v','--version') { output_version($stdout); exit(0) }\n o.on('-h','--help') { output_help($stdout); exit(0) }\n o.on('-V', '--verbose') { @options.verbose = true }\n o.on('-D', '--debug') { @options.debug = true }\n o.on('-l', '--local') { @options.run_local = true }\n\n o.on(\"-d\",\"--delay\", \"=REQUIRED\") do |amount|\n @options.delay = amount.to_i\n end\n\n o.on(\"-c\",\"--config\", \"=REQUIRED\") do |conf_file|\n @options.config_file = conf_file\n end\n\n o.on(\"-o\",\"--output\", \"=REQUIRED\") do |output_destination|\n @options.output_base = output_destination\n end\n\n o.on(\"-s\",\"--scheduler\", \"=REQUIRED\") do |qopts|\n @options.scheduler_opts = qopts\n end\n\n o.on(\"-t\",\"--tmp\", \"=REQUIRED\") do |topts|\n @options.tmp_dir_base = topts\n end\n end\n\n opts.parse!(@args) rescue return false\n @options.samples = @args\n return true\nend",
"def prepare\n # We get NotImplementedError by Tilt when we don't have this method\n end",
"def sanity_check\n if bootstrap_vault_item && (bootstrap_vault_json || bootstrap_vault_file)\n ui.warn \"--vault-item given with --vault-list or --vault-file, ignoring the latter\"\n end\n\n if bootstrap_vault_json && bootstrap_vault_file\n ui.warn \"--vault-list given with --vault-file, ignoring the latter\"\n end\n end",
"def dump_help_if_requested\n return unless self[:help]\n dump_help\n exit\n end",
"def check_configuration\n raise Nimbus::ConfigurationError, \"The mtry sample size must be smaller than the total SNPs count.\" if @tree_SNP_sample_size > @tree_SNP_total_count\n end",
"def check_release_preconditions build_info\n return \"#{options[:path]} doesn't appear to be a valid package dir\" unless Util.is_a_wooget_package_dir options[:path]\n return \"Not a full release - #{build_info.version}\" if build_info.version =~ /prerelease/\n end",
"def ensure_puppet_env\n if @options[:dry_run]\n msg = \"Skipping creation of SIMP omni-environment for '#{@options[:puppet_env]}': --dry-run enabled\"\n logger.notice(msg.magenta.bold)\n # Assume stock SIMP environment setup, since we can't necessarily extract\n # the correct Puppet env info\n @options[:puppet_env_info] = Simp::Cli::Config::Item::DEFAULT_PUPPET_ENV_INFO\n else\n env_helper = Simp::Cli::Config::SimpPuppetEnvHelper.new(\n @options[:puppet_env], @options[:start_time]\n )\n\n status_code, status_details = env_helper.env_status\n details_msg = status_details.split(\"\\n\").map { |line| ' >> ' + line }.join(\"\\n\")\n\n if status_code == :creatable\n create_new_puppet_env(env_helper, details_msg)\n elsif status_code == :exists\n # a usable, existing {Puppet + secondary environment} exists\n handle_existing_puppet_env(env_helper, details_msg)\n else\n # The existing SIMP omni-environment has failed minimal validation\n # and is unusable.\n # TODO Tell users to save off and then remove the Puppet and secondary\n # environments that may exist, run 'simp config' again, and then restore\n # any local customizations?\n msg = \"Unable to configure: Invalid SIMP omni-environment for '#{@options[:puppet_env]}' exists:\\n\"\n msg += details_msg\n raise Simp::Cli::ProcessingError.new(msg)\n end\n\n # Set remaining @options based on the Puppet environment\n unless @options[:hiera_output_file]\n @options[:hiera_output_file] = File.join(\n @options[:puppet_env_info][:puppet_env_datadir],\n Simp::Cli::CONFIG_GLOBAL_HIERA_FILENAME\n )\n end\n end\n end",
"def prepare!; end",
"def prepare!; end",
"def precheck\n end",
"def prepare!\n prepare_in_parallel!\n end",
"def check(options)\n errors = []\n [\n [\"/usr/bin/iostat\", \"sysstat\"]\n ].each do |filename, package|\n errors << \"Cannot find `#{filename}`. Please run `apt-get install #{package}` to resolve this.\" if !File.exists?(filename)\n end\n\n if errors.empty?\n puts \"Everything seems to be in place. You're good to go.\"\n else\n errors.each { |error| puts errors }\n exit(1)\n end\n end",
"def pre_verify(packer)\n total = packer.machines.map(&:memory).inject { |a, e| a + e }\n physical = ::Chef.node['memory']['total'].to_i / 1024\n fail \"The fragments chosen require (#{total}MB) more than three \" \\\n \" of the physical memory (#{physical}MB) on this machine.\" \\\n if total > (physical * 0.75)\n end",
"def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end",
"def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end",
"def verify_required_data_files!\n unless File.exists?(\"#{@working_directory}/drupal-filesystem.tar.gz\") && File.exists?(\"#{@working_directory}/drupal-db.sql.gz\")\n raise StandardError.new(\"Cannot locate both 'drupal-filesystem.tar.gz' and 'drupal-db.sql.gz' in directory '#{@working_directory}'.\")\n end\n end",
"def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return false unless @options[:host] && @options[:model]\n end\n\n true\n end",
"def prepare_for_tests( runs, collectors )\n if Maadi::Expert::Expert::is_expert?( @expert ) and Maadi::Organizer::Organizer::is_organizer?( @organizer )\n if @organizer.works_with?( @expert.domain )\n Maadi::post_message(:Info, 'Expert and Organizer are compatible')\n else\n Maadi::post_message(:Warn, \"Expert (#{@expert.domain}) is NOT compatible with Organizer (#{@organizer.supported_domains.join(', ')})\")\n return false\n end\n\n unless @expert.is_ready?\n @expert.prepare\n end\n\n unless @organizer.is_ready?\n @organizer.prepare\n end\n\n if @expert.is_ready? && @organizer.is_ready?\n collectors.each do |collector|\n collector.log_options( @expert )\n collector.log_options( @organizer )\n end\n\n parameters = @expert.parameters( 'all' )\n ready = @organizer.available_parameters( parameters, runs )\n\n if ready\n Maadi::post_message(:More, 'Generator is ready')\n return true\n end\n else\n Maadi::post_message(:Warn, 'Expert or Organizer NOT ready')\n end\n else\n Maadi::post_message(:Warn, 'Expert or Organizer NOT correct type/initialized')\n end\n\n return false\n end",
"def parsed_options?\n opts = OptionParser.new\n opts.on('-v', '--version') { output_version; exit 0 }\n opts.on('-h', '--help') { output_usage }\n \n opts.on('-r', '--run s', String) { |test| @options.test = test }\n opts.on('-m', '--min-sleep i', Integer) { |min| @options.min = min }\n opts.on('-M', '--max-sleep i', Integer) { |max| @options.max = max }\n opts.on('-H', '--host s', String) { |host| @options.host = host } \n opts.on('-d', '--db s', String) { |db| @options.db = db }\n opts.on('-p', '--port i', Integer) { |port| @options.port = port }\n opts.on('-u', '--user s', String) { |user| @options.user = user }\n opts.on('-w', '--password s', String) { |password| @options.password = password }\n opts.on('-t', '--time i', Integer) { |time| @options.time = time }\n opts.on('-T', '--threads i', Integer) { |threads| @options.threads = threads }\n opts.on('-D', '--documents i', Integer) { |documents| @options.documents = documents }\n opts.on('-i', '--iterations i', Integer){ |iterations| @options.iterations = iterations }\n \n opts.on('-P', '--prepare') { @options.step = :prepare }\n opts.on('-C', '--cleanup') { @options.step = :cleanup }\n opts.on('-R', '--runonly') { @options.step = :run }\n opts.on('-A', '--all') { @options.step = :all }\n \n opts.parse!(@arguments) rescue return false\n true\n end",
"def post_processing\n @opts.each do |opt|\n if opt.required? && !@results.key?(opt.to_sym)\n fail \"The option #{opt.to_sym} is required\"\n end\n end\n end",
"def prepare; end",
"def prepare; end",
"def prepare; end",
"def have_sample_ids?\n if @options.samples && @options.samples.size > 0\n return true\n end\n @stderr.puts \"Missing sample id(s) to processor\"\n return false\nend",
"def tests_contain_errors?\n $?.exitstatus == PHPUNIT_ERRORS_EXITCODE\n end",
"def configure_early?\n true\n end",
"def check_for_errors\n return unless @chunks.any? { |chunk| chunk.first[0] == :error }\n errors = @chunks.find_all { |chunk| chunk[0] == :error }\n $stderr.puts \"WARNING: found the following errors: #{errors.map(&last).inspect}\"\n end",
"def testPrepareFileFail\n initTestCase do\n setupTempFile do |iTmpFileName|\n lTransferFile = WEACE::Master::TransferFile.new(iTmpFileName)\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [lTransferFile] ]\n ]\n $Context[:DummySenderPrepareError] = RuntimeError.new('Preparing error')\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :Error => RuntimeError\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal(\n [\n [ 'DummyUser',\n { 'DummyTool' => {\n 'DummyAction' => [\n [lTransferFile]\n ]\n }\n }\n ]\n ],\n getSlaveClientQueue\n )\n assert_equal({iTmpFileName => 1}, getTransferFiles)\n end\n end\n end\n end"
] |
[
"0.60802853",
"0.604605",
"0.5985647",
"0.5985647",
"0.59699684",
"0.58934075",
"0.58794045",
"0.56214064",
"0.56115824",
"0.5609108",
"0.56026334",
"0.5597771",
"0.5582721",
"0.5571713",
"0.5541828",
"0.5532825",
"0.55272156",
"0.55221486",
"0.54941916",
"0.54941916",
"0.5491377",
"0.54592055",
"0.54528713",
"0.5451624",
"0.5447098",
"0.5447098",
"0.5447098",
"0.53705144",
"0.53705144",
"0.53608274",
"0.5359741",
"0.5351476",
"0.5350182",
"0.53340703",
"0.53340703",
"0.53340703",
"0.53340703",
"0.53340703",
"0.53340703",
"0.53340703",
"0.5324339",
"0.53130156",
"0.52835083",
"0.52828115",
"0.52807796",
"0.52688587",
"0.5264621",
"0.5259204",
"0.5245008",
"0.5241706",
"0.52403",
"0.52368003",
"0.523373",
"0.52320105",
"0.5216777",
"0.5216777",
"0.52150464",
"0.52002645",
"0.5199782",
"0.51974356",
"0.51971257",
"0.51943785",
"0.5187761",
"0.51810336",
"0.51808167",
"0.5167474",
"0.5157206",
"0.5157206",
"0.5151743",
"0.514075",
"0.514075",
"0.5137463",
"0.512496",
"0.5110762",
"0.5095333",
"0.509487",
"0.50896955",
"0.5087553",
"0.50813544",
"0.50758636",
"0.50734556",
"0.50734556",
"0.5068301",
"0.50664335",
"0.5064775",
"0.5061772",
"0.5051671",
"0.5050987",
"0.5049434",
"0.50481296",
"0.50474983",
"0.5035059",
"0.5015779",
"0.5014647",
"0.5014647",
"0.5014647",
"0.4997294",
"0.49967876",
"0.49889278",
"0.49838567",
"0.49801826"
] |
0.0
|
-1
|
Supports Postgres only. Needs to be moved to ActiveRecord extensions.
|
def direct_import_from_csv(dataset, opts = {:to => nil, :delimiter => nil, :header => nil})
delimiter = opts[:delimiter] || ","
header = "HEADER" if opts[:header] == true
table = opts[:to].table_name
raise TypeError if dataset.class != String
ActiveRecord::Base.connection.execute("COPY #{table} FROM '#{dataset}' DELIMITER \'#{delimiter}\' CSV #{header}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def target_postgresql_version; end",
"def postgres\n @postgres ||= Connections::Postgres.new(options: @postgres_options)\n end",
"def postgresql?\n config = ActiveRecord::Base.configurations[Rails.env]\n config && config['adapter'] == 'postgresql'\n end",
"def postgresql_version\n 100000\n end",
"def postgresql_gem\n gem 'pg'\n end",
"def target_postgresql_version=(_arg0); end",
"def postgresql_version\n if undecorated_connection.respond_to?(:postgresql_version)\n super\n else\n undecorated_connection.send(:postgresql_version)\n end\n end",
"def postgresql_version\n if undecorated_connection.respond_to?(:postgresql_version)\n super\n else\n undecorated_connection.send(:postgresql_version)\n end\n end",
"def orm; end",
"def subscribe_sql_active_record; end",
"def sql_modes; end",
"def prepare(*args)\n ps = super\n ps.extend(::Sequel::Postgres::DatasetMethods::PreparedStatementMethods)\n ps\n end",
"def connect\n @connection = ::NB::DB::PooledDBConnection.new(@connection_parameters[0]) do\n conn = ::NB::DB::FiberedPostgresConnection.connect(*@connection_parameters[1..(@connection_parameters.length-1)])\n=begin\n ::NB::DB::FiberedPostgresConnection.translate_results = false if ::NB::DB::FiberedPostgresConnection.respond_to?(:translate_results=)\n # Ignore async_exec and async_query when using postgres-pr.\n @async = @config[:allow_concurrency] && @connection.respond_to?(:async_exec)\n # Use escape string syntax if available. We cannot do this lazily when encountering\n # the first string, because that could then break any transactions in progress.\n # See: http://www.postgresql.org/docs/current/static/runtime-config-compatible.html\n # If PostgreSQL doesn't know the standard_conforming_strings parameter then it doesn't\n # support escape string syntax. Don't override the inherited quoted_string_prefix.\n NB.neverblock(false) do\n if supports_standard_conforming_strings?\n self.class.instance_eval do\n define_method(:quoted_string_prefix) { 'E' }\n end\n end\n # Money type has a fixed precision of 10 in PostgreSQL 8.2 and below, and as of\n # PostgreSQL 8.3 it has a fixed precision of 19. PostgreSQLColumn.extract_precision\n # should know about this but can't detect it there, so deal with it here.\n money_precision = (postgresql_version >= 80300) ? 19 : 10\n ::ActiveRecord::ConnectionAdapters::PostgreSQLColumn.module_eval(<<-end_eval)\n def extract_precision(sql_type)\n if sql_type =~ /^money$/\n #{money_precision}\n else\n super\n end\n end\n end_eval\n #configure_connection\n end\n\t conn\n=end\n end\n end",
"def target_sql_mode; end",
"def initialize_postgres_adapter\n @primary_keys = {}\n @primary_key_sequences = {}\n @supported_types = {}\n procs = @conversion_procs = CONVERSION_PROCS.dup\n procs[1184] = procs[1114] = method(:to_application_timestamp)\n end",
"def setup_for_postgres\n ActiveRecord::Base.establish_connection adapter: \"postgresql\", \n database: \"active_symbol_test\",\n :username=>:active_symbol_test, :password=>\"active_symbol_test\"\n setup_db\nend",
"def pg\n uri = URI.parse( hpg_resolve(shift_argument, \"DATABASE_URL\").url )\n config = {\n 'name' => gen_datasource_name(\"PostgreSQL\"),\n 'type' => \"POSTGRESQL\",\n 'config' => {\n 'host' => uri.host,\n 'port' => uri.port || 5432,\n 'database' => uri.path[1..-1],\n 'username' => uri.user,\n 'password' => uri.password,\n 'use_ssl' => true,\n 'validate_ssl_cert' => false\n }\n }\n open_jackdb(config)\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n case type.to_s\n when 'binary'\n # PostgreSQL doesn't support limits on binary (bytea) columns.\n # The hard limit is 1Gb, because of a 32-bit size field, and TOAST.\n case limit\n when nil, 0..0x3fffffff; super(type)\n else raise(ActiveRecordError, \"No binary type has byte size #{limit}.\")\n end\n when 'text'\n # PostgreSQL doesn't support limits on text columns.\n # The hard limit is 1Gb, according to section 8.3 in the manual.\n case limit\n when nil, 0..0x3fffffff; super(type)\n else raise(ActiveRecordError, \"The limit on text can be at most 1GB - 1byte.\")\n end\n when 'integer'\n return 'integer' unless limit\n\n case limit\n when 1, 2; 'smallint'\n when 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n when 'datetime'\n return super unless precision\n\n case precision\n when 0..6; \"timestamp(#{precision})\"\n else raise(ActiveRecordError, \"No timestamp type has precision of #{precision}. The allowed range of precision is from 0 to 6\")\n end\n else\n super\n end\n end",
"def execute_sql(my_sql)\n pg_result = ActiveRecord::Base.connection.execute(my_sql)\n\n # In this example we are just calling #to_a to convert the PG::Result to an\n # Array. PG::Result has a nice API for slicing and dicing itself so you may\n # want to to something clever instead. See\n # https://www.rubydoc.info/gems/pg/PG/Result for details.\n #\n # The important bit here is that we are copying all the data we care about\n # out of the PG::Result in preparation for later clearing the PG::Result\n results = pg_result.to_a\n\n # Calling #clear on the PG::Result is the important bit of cleanup and the\n # whole reason this method exists. See\n # https://www.rubydoc.info/gems/pg/PG/Result#clear-instance_method\n pg_result.clear\n\n yield results if block_given?\n\n results\nend",
"def real_column; end",
"def setup_connection(conn)\n conn = super(conn)\n conn.extend(Sequel::Swift::Postgres::AdapterMethods)\n conn.db = self\n conn.apply_connection_settings\n conn\n end",
"def sql_query(sql)\n db = PG.connect(:dbname => 'todo_book', :host => 'localhost')\n query_result = db.exec(sql)\n db.close\n\n return query_result\nend",
"def run_sql(sql, arr = [])\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'native_plants'})\n results = db.exec_params(sql, arr)\n db.close\n return results\nend",
"def load_postgres_driver()\n require 'postgres'\nrescue LoadError\n require 'rubygems'\n require 'rbconfig'\n sad = Config::CONFIG['sitearchdir']\n postgres_dir = sad.chomp('-gnu')\n $:.unshift(postgres_dir)\n require 'postgres'\nrescue LoadError\n # On SUSE, FreeBSD the driver is called ruby-postgres and is a gem\n require 'ruby-postgres'\nend",
"def process_postgres(target)\n {\n :schema => 'iglu:com.snowplowanalytics.snowplow.storage/postgresql_config/jsonschema/1-0-0',\n :data => {\n :name => target['name'],\n :host => target['host'],\n :database => target['database'],\n :port => target['port'],\n :sslMode => target['ssl_mode'].upcase,\n :schema => target['table'].split('.')[0],\n :username => target['username'],\n :password => target['password'],\n :purpose => 'ENRICHED_EVENTS'\n }\n }\nend",
"def pg_jsonb\n Sequel::Postgres::JSONBHash.new(self)\n end",
"def postgres_plain_connection(ip)\n PG::Connection.new(\n host: ip,\n user: DB_USER,\n dbname: DB_NAME,\n port: DB_PORT,\n password: DB_PASSWORD,\n connect_timeout: \"1\",\n )\nend",
"def run_sql(sql)\n connection = PG.connect(dbname: \"facebook_lab\", host: \"localhost\")\n result = connection.exec(sql)\n connection.close\n result\nend",
"def supports_ranges?\n postgresql_version >= 90200\n end",
"def sql_with_postgres_pgp(event)\n filter = /(pgp_sym_(encrypt|decrypt))\\(((.|\\n)*?)\\)/i\n\n event.payload[:sql] = event.payload[:sql].gsub(filter) do |_|\n \"#{$1}([FILTERED])\"\n end\n\n sql_without_postgres_pgp(event)\n end",
"def aggregate_db_storage_type; end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless NO_LIMIT_TYPES.include?(t = type.to_s.downcase.to_sym)\n\n native_type = NATIVE_DATABASE_TYPES[t]\n native_type.is_a?(Hash) ? native_type[:name] : native_type\n end",
"def target_sql_mode=(_arg0); end",
"def revert_postgres_type( type )\n case type\n when /\\Acharacter varying/\n return :String, :default_size => 255\n when /\\Acharacter/\n return :String, :fixed => true, :default_size => 255\n when /\\Atext\\z/\n return :String, :text => true\n when /\\Abytea\\z/\n return :blob\n when /\\Atimestamp/\n return :timestamp\n end\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super if defined?(::Jdbc::H2) || type.to_s != 'integer' || limit == nil\n\n type\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n if type == :decimal\n # Force an explicit scale if none supplied to specify the fixed\n # point form of Virtuoso's DECIMAL type. If no scale is specified,\n # the Virtuoso DECIMAL type stores floating point values.\n precision ||= 32\n scale ||= 0\n end\n super(type, limit, precision, scale)\n end",
"def connect_to_old_db\n ActiveRecord::Base.establish_connection(\n :adapter => \"postgresql\",\n :host => \"localhost\",\n :username => \"postgres\",\n :password => \"vegpuf\",\n :database => \"affluence_staging_25_june\"\n )\nend",
"def create_products_table\n c = PGconn.new(:host => \"localhost\", :dbname => dbname)\n c.exec %q{\n CREATE TABLE products (\n id SERIAL PRIMARY KEY,\n name varchar(255),\n price decimal,\n description text\n );\n }\n c.close\nend",
"def run_sql(sql)\n conn = PG.connect(dbname: 'goodfoodhunting')\n result = conn.exec(sql)\n conn.close\n return result\nend",
"def run_sql(sql)\n conn = PG.connect(dbname: 'movies')\n result = conn.exec(sql)\n conn.close\n result\nend",
"def pg_jsonb\n Sequel::Postgres::JSONBArray.new(self)\n end",
"def snapshots_redact_sql_queries; end",
"def connection\n @pg\n end",
"def table_name; \"gdo_module\"; end",
"def postgresql_database\n # FIXME work in progress\n #encoding = \"-E #{configuration[:postgresql][:encoding]}\" if configuration[:postgresql][:encoding]\n encoding = ''\n template = \"-T #{configuration[:postgresql][:template_database]}\" if configuration[:postgresql][:template_database]\n\n exec \"postgresql_database\",\n :command => \"/usr/bin/createdb -O #{database_environment[:username]} #{encoding} #{template} #{database_environment[:database]}\",\n :unless => \"/usr/bin/psql -l | grep #{database_environment[:database]}\",\n :user => 'postgres',\n :require => exec('postgresql_user'),\n :before => exec('rake tasks')#,\n # :notify => exec('rails_bootstrap') # TODO make this configurable to work with multi_server\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false)\n case type.to_s\n when 'binary'\n case limit\n when 0..0xfff; \"varbinary(#{limit})\"\n when nil; \"blob\"\n when 0x1000..0xffffffff; \"blob(#{limit})\"\n else raise(ActiveRecordError, \"No binary type has character length #{limit}\")\n end\n when 'integer'\n case limit\n when 1\n 'tinyint' + (unsigned ? ' unsigned' : '')\n when 2\n 'smallint' + (unsigned ? ' unsigned' : '')\n when 3\n 'mediumint' + (unsigned ? ' unsigned' : '')\n when nil, 4, 11 # compatibility with MySQL default\n if unsigned\n 'int(10) unsigned'\n else\n 'int(10)'\n end\n when 5..8\n 'bigint' + (unsigned ? ' unsigned' : '')\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}\")\n end\n when 'text'\n case limit\n when 0..0xff; 'tinytext'\n when nil, 0x100..0xffff; 'text'\n when 0x10000..0xffffff; 'mediumtext'\n when 0x1000000..0xffffffff; 'longtext'\n else raise(ActiveRecordError, \"No text type has character length #{limit}\")\n end\n else\n super\n end\n end",
"def subscribe_sql_active_record=(_arg0); end",
"def connect_to_migration_db\n ActiveRecord::Base.establish_connection(\n adapter: 'postgresql',\n encoding: 'unicode',\n pool: 10,\n url: ENV['MIGRATION_DB_URL']\n )\n ActiveRecord::Base.connection.execute(\n \"SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;\"\n )\n end",
"def run_sql(sql)\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend",
"def sql_state; end",
"def postgres_query(sql=nil,doprint=false)\n ip = datastore['RHOST']\n port = datastore['RPORT']\n postgres_login unless self.postgres_conn\n unless self.postgres_conn\n return {:conn_error => true}\n end\n if self.postgres_conn\n sql ||= datastore['SQL']\n vprint_status \"#{ip}:#{port} Postgres - querying with '#{sql}'\"\n begin\n resp = self.postgres_conn.query(sql)\n rescue RuntimeError => e\n case sql_error_msg = e.to_s.split(\"\\t\")[1] # Deal with some common errors\n when \"C42601\"\n sql_error_msg += \" Invalid SQL Syntax: '#{sql}'\"\n when \"C42P01\"\n sql_error_msg += \" Table does not exist: '#{sql}'\"\n when \"C42703\"\n sql_error_msg += \" Column does not exist: '#{sql}'\"\n when \"C42883\"\n sql_error_msg += \" Function does not exist: '#{sql}'\"\n else # Let the user figure out the rest.\n if e == Timeout::Error\n sql_error_msg = 'Execution expired'\n elsif sql_error_msg.nil?\n sql_error_msg = e.inspect\n else\n sql_error_msg += \" SQL statement '#{sql}' returns #{e.inspect}\"\n end\n end\n return {:sql_error => sql_error_msg}\n end\n postgres_print_reply(resp,sql) if doprint\n return {:complete => resp}\n end\n end",
"def standard_sql?\n !legacy_sql?\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:\r\n if native = native_database_types[type]\r\n if type == :integer\r\n column_type_sql = 'integer'\r\n elsif type == :string and !limit.nil?\r\n \"varchar (#{limit})\"\r\n else\r\n super(type, limit, precision, scale)\r\n end\r\n else\r\n super(type, limit, precision, scale)\r\n end\r\n end",
"def _schema_ds\n @_schema_ds ||= begin\n ds = metadata_dataset.select{[\n pg_attribute[:attname].as(:name),\n SQL::Cast.new(pg_attribute[:atttypid], :integer).as(:oid),\n SQL::Cast.new(basetype[:oid], :integer).as(:base_oid),\n SQL::Function.new(:format_type, basetype[:oid], pg_type[:typtypmod]).as(:db_base_type),\n SQL::Function.new(:format_type, pg_type[:oid], pg_attribute[:atttypmod]).as(:db_type),\n SQL::Function.new(:pg_get_expr, pg_attrdef[:adbin], pg_class[:oid]).as(:default),\n SQL::BooleanExpression.new(:NOT, pg_attribute[:attnotnull]).as(:allow_null),\n SQL::Function.new(:COALESCE, SQL::BooleanExpression.from_value_pairs(pg_attribute[:attnum] => SQL::Function.new(:ANY, pg_index[:indkey])), false).as(:primary_key),\n Sequel[:pg_type][:typtype],\n (~Sequel[Sequel[:elementtype][:oid]=>nil]).as(:is_array),\n ]}.\n from(:pg_class).\n join(:pg_attribute, :attrelid=>:oid).\n join(:pg_type, :oid=>:atttypid).\n left_outer_join(Sequel[:pg_type].as(:basetype), :oid=>:typbasetype).\n left_outer_join(Sequel[:pg_type].as(:elementtype), :typarray=>Sequel[:pg_type][:oid]).\n left_outer_join(:pg_attrdef, :adrelid=>Sequel[:pg_class][:oid], :adnum=>Sequel[:pg_attribute][:attnum]).\n left_outer_join(:pg_index, :indrelid=>Sequel[:pg_class][:oid], :indisprimary=>true).\n where{{pg_attribute[:attisdropped]=>false}}.\n where{pg_attribute[:attnum] > 0}.\n order{pg_attribute[:attnum]}\n\n # :nocov:\n if server_version > 100000\n # :nocov:\n ds = ds.select_append{pg_attribute[:attidentity]}\n\n # :nocov:\n if server_version > 120000\n # :nocov:\n ds = ds.select_append{Sequel.~(pg_attribute[:attgenerated]=>'').as(:generated)}\n end\n end\n\n ds\n end\n end",
"def to_sql\n nil\n end",
"def query_name(v_quote)\n\n begin\n\n # connect to the database\n conn = PG.connect(dbname: 'test', user: 'something', password: '4321')\n\n # prepare SQL statement\n conn.prepare('q_statement',\n \"select details.id, name, age, quote\n from details\n join quotes on details.id = quotes.details_id\n where quote = $1\")\n\n # execute prepared SQL statement\n rs = conn.exec_prepared('q_statement', [v_quote])\n\n # deallocate prepared statement variable\n conn.exec(\"deallocate q_statement\")\n\n # return array of values returned by SQL statement\n return rs.values[0]\n\n rescue PG::Error => e\n\n puts 'Exception occurred'\n puts e.message\n\n ensure\n\n conn.close if conn\n\n end\n\nend",
"def bound_attributes\n if Torque::PostgreSQL::AR521\n visitor = ::Arel::Visitors::PostgreSQL.new(ActiveRecord::Base.connection)\n visitor.accept(self.arel.ast, ::Arel::Collectors::Bind.new).value\n else\n return super unless self.auxiliary_statements_values.present?\n bindings = self.auxiliary_statements_values.map(&:bound_attributes)\n (bindings + super).flatten\n end\n end",
"def pg_table_name\n table_name\n end",
"def sql_string\n self\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false, auto_increment = false)\n case type.to_s\n when 'integer'\n case limit\n when 1\n 'tinyint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when 2\n 'smallint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when 3\n 'mediumint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when nil, 4, 11 # compatibility with MySQL default\n if unsigned\n 'int(10) unsigned' + (auto_increment ? ' AUTO_INCREMENT' : '')\n else\n 'int(10)'\n end\n when 5..8\n 'bigint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}\")\n end\n when 'text'\n case limit\n when 0..0xff; 'tinytext'\n when nil, 0x100..0xffff; 'text'\n when 0x10000..0xffffff; 'mediumtext'\n when 0x1000000..0xffffffff; 'longtext'\n else raise(ActiveRecordError, \"No text type has character length #{limit}\")\n end\n else\n super\n end\n end",
"def type_to_sql(type, limit: nil, precision: nil, scale: nil, **) # :nodoc:\n # MSSQL's NVARCHAR(n | max) column supports either a number between 1 and\n # 4000, or the word \"MAX\", which corresponds to 2**30-1 UCS-2 characters.\n #\n # It does not accept NVARCHAR(1073741823) here, so we have to change it\n # to NVARCHAR(MAX), even though they are logically equivalent.\n #\n # See: http://msdn.microsoft.com/en-us/library/ms186939.aspx\n #\n type = type.to_sym if type\n native = native_database_types[type]\n\n if type == :string && limit == 1_073_741_823\n 'nvarchar(max)'\n elsif NO_LIMIT_TYPES.include?(type)\n super(type)\n elsif %i[int integer].include?(type)\n if limit.nil? || limit == 4\n 'int'\n elsif limit == 2\n 'smallint'\n elsif limit == 1\n 'tinyint'\n else\n 'bigint'\n end\n elsif type == :uniqueidentifier\n 'uniqueidentifier'\n elsif %i[datetime time].include?(type)\n precision ||= 7\n column_type_sql = (native.is_a?(Hash) ? native[:name] : native).dup\n if (0..7).include?(precision)\n column_type_sql << \"(#{precision})\"\n else\n raise(\n ArgumentError,\n \"No #{native[:name]} type has precision of #{precision}. The \" \\\n 'allowed range of precision is from 0 to 7, even though the ' \\\n 'sql type precision is 7 this adapter will persist up to 6 ' \\\n 'precision only.'\n )\n end\n else\n super\n end\n end",
"def only_correct_postgres_version\n %w(8.4 9.0 9.1 9.2 9.3 9.4 9.5 9.6).each do |version|\n if version != postgresql_version.to_s # need to_s, because YAML may think it's a float\n package \"postgresql-#{version}\", :ensure => :absent\n package \"postgresql-contrib-#{version}\", :ensure => :absent\n end\n end\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:\n if type == :enum\n native = native_database_types[type]\n column_type_sql = native[:name] || 'enum'\n \n column_type_sql << \"(#{limit.map { |v| quote(v) }.join(',')})\"\n column_type_sql \n else\n # Edge rails fallback for Rails 1.1.6. We can remove the\n # rescue once everyone has upgraded to 1.2.\n begin\n __type_to_sql_enum(type, limit, precision, scale)\n rescue ArgumentError\n __type_to_sql_enum(type, limit)\n end\n end\n end",
"def connection\n ActiveRecord::Base.connection\n end",
"def connection\n ActiveRecord::Base.connection\n end",
"def select(db); end",
"def select(db); end",
"def use_scrooge?(model_class, original_sql)\n original_sql =~ select_regexp(model_class.table_name) &&\n model_class.columns_hash.has_key?(model_class.primary_key) &&\n original_sql !~ ScroogeRegexJoin\n end",
"def scope_with_scrooge?( sql )\n sql =~ scrooge_select_regex && \n columns_hash.has_key?(self.primary_key.to_s) &&\n sql !~ ScroogeRegexJoin\n end",
"def psql(args)\n \"psql -X -q #{args}\"\nend",
"def psql\n uri = generate_ingress_uri(\"Connecting\")\n ENV[\"PGPASSWORD\"] = uri.password\n ENV[\"PGSSLMODE\"] = 'require'\n system \"psql -U #{uri.user} -h #{uri.host} -p #{uri.port || 5432} #{uri.path[1..-1]}\"\n end",
"def getDatabaseType\n return ActiveRecord::Base.connection.adapter_name\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n case type.to_s\n when 'integer'\n return 'integer' unless limit\n\n case limit\n when 1, 2; 'smallint'\n when nil, 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n else\n super\n end\n end",
"def quoted_table_name\n case self.connection.adapter_name\n when 'PostgreSQL'\n original_quoted_table_name.downcase\n else\n original_quoted_table_name\n end\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n \n if limit.nil? || limit == 4\n 'integer'\n elsif limit < 4\n 'smallint'\n else\n 'bigint'\n end\n end",
"def pg_gem_conn__from psql_db\n db_name,\n db_user,\n db_password,\n db_host,\n db_port,\n db_connection = array__from psql_db\n\n db_port ||= 5432\n\n require 'socket'\n db_connection ||= PG::Connection.open(\n :hostaddr => (IPSocket.getaddress db_host),\n :port=> db_port,\n :dbname=> db_name,\n :user=> db_user,\n :password => db_password,\n ) rescue nil\n [\n db_name,\n db_user,\n db_password,\n db_host,\n db_port,\n db_connection,\n ]\n end",
"def db\n @connection.pg rescue nil\n end",
"def run_sql(sql)\n conn = PG.connect(dbname: \"memetube\", host: \"localhost\")\n begin\n result = conn.exec(sql)\n ensure\n conn.close\n end\n result\nend",
"def preconditions\n ActiveRecord::VERSION::MAJOR >= 6 &&\n Helper.postgresql? &&\n primary_field? &&\n column.sql_type.to_s.match(TARGET_COLUMN_TYPE)\n end",
"def new_pg_info(session)\n result = nil\n save_result = postgres_exec(\"INSERT INTO session_replicas (start_date,created_at,updated_at,origin_id,info) VALUES ('#{session.start_date_time.utc.strftime('%Y-%m-%d %H:%M:%S')}',NOW(),NOW(),#{session.id},JSON('#{USERS_POSTGRES_CONNECTION.escape_string(session.to_lactic_json)}'))\")\n result = save_result && save_result.cmd_tuples()!=0\n\n result\n\n end",
"def relation_by_sql_form\n # Nothing to do here\n end",
"def postgresql_not_unique_error_class\n /(PG::UniqueViolation)|(ActiveRecord::RecordNotUnique)|(ActiveRecord::JDBCError)/\n end",
"def save()\n db = PG.connect({\n dbname: 'houses',\n host: 'localhost'\n })\n\nsql = \"INSERT INTO houses\n(address, value, num_bedrooms, year) VALUES\n($1, $2, $3, $4) RETURNING *\"\nvalues = [@address, @value, @num_bedrooms, @year]\ndb.prepare(\"save\", sql)\nresult = db.exec_prepared(\"save\", values)\n@id = result[0]['id'].to_i()\n\ndb.close()\nend",
"def run_sql(sql)\n\tconn = PG.connect(dbname: \"video_store\", host: 'localhost')\n\tresult = conn.exec(sql)\n\tconn.close\n\tresult \nend",
"def to_cql\n fail NotImplementedError\n end",
"def test_date_value\n row = SqlRow.new(SqlRowType.new('table', :id => :integer, :text => :date))\n row[:text] = Date.parse('2015-01-01')\n assert_equal \"'2015-01-01'\", row.sql_for(:text, :postgresql)\n end",
"def run_sql(sql)\n #connect to the|db|\n conn = PG.connect(:dbname => 'rogbloll')\n\n\n #execute the db in the argument\n res = conn.exec(sql)\n\n #now close the db\n conn.close\n\n #now return the result of the query...\n res\n\n\n \n end",
"def test_raw_insert_bind_param_with_q_mark_deprecated; end",
"def pg_jsonb(v)\n case v\n when Postgres::JSONBObject\n v\n when Array\n Postgres::JSONBArray.new(v)\n when Hash\n Postgres::JSONBHash.new(v)\n when Postgres::JSONObject\n v = v.__getobj__\n Postgres::JSONDatabaseMethods.jsonb_primitive_wrapper(v).new(v)\n else\n Sequel.pg_jsonb_op(v)\n end\n end",
"def create_movies_table\n c = PGconn.new(:host => \"localhost\", :dbname => \"test\")\n c.exec %q{\n CREATE TABLE movies (\n id PRIMARY KEY,\n title TEXT,\n description TEXT,\n rating INTEGER\n );\n }\n c.close\nend",
"def raw_connection\n ActiveRecord::Base.connection.raw_connection\n end",
"def oracle; end",
"def pg_gem_batch__from psql_db, db_queries\n psql_db = array__from psql_db\n db_queries = array__from db_queries\n pg_gem_conn = pg_gem_conn__from psql_db\n pg_connection = pg_gem_conn[5]\n batch = [pg_connection].product db_queries\n end",
"def orm_patches_applied; end",
"def psql_on_app_db(*args)\n psql_on_db(fetch(:pg_database), *args)\n end",
"def type_to_sql(type, limit: nil, precision: nil, scale: nil, size: limit_to_size(limit, type), unsigned: nil, **)\n sql =\n case type.to_s\n when \"integer\"\n integer_to_sql(limit)\n when \"text\"\n type_with_size_to_sql(\"text\", size)\n when \"blob\"\n type_with_size_to_sql(\"blob\", size)\n when \"binary\"\n if (0..0xfff) === limit\n \"varbinary(#{limit})\"\n else\n type_with_size_to_sql(\"blob\", size)\n end\n else\n super\n end\n\n sql = \"#{sql} unsigned\" if unsigned && type != :primary_key\n sql\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n return 'integer' unless limit\n\n case limit\n when 1, 2; 'smallint'\n when 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n end",
"def to_pg_query(query, language)\n pg_syntax = query.gsub(/\\W+/, \" | \").gsub(/ \\| and \\| /, \" & \").gsub(/ \\| or \\| /, \" | \").gsub(/ \\| not \\| /, \" | !\")\n sanitize_sql_array [\"to_tsquery('#{language}', ?)\", pg_syntax]\n end",
"def sql\n @context.sql\n end",
"def database_column_type\n :string\n end",
"def connect_to_db(db='thesis')\n ActiveRecord::Base.establish_connection(\n :adapter => \"postgresql\",\n :host => \"localhost\",\n :username => \"thesis\",\n :password => \"thesis\",\n :database => db.to_s,\n :encoding => \"utf8\"\n )\nend"
] |
[
"0.69039094",
"0.6826688",
"0.6645085",
"0.65970147",
"0.64158607",
"0.6412464",
"0.6356771",
"0.6355766",
"0.6298663",
"0.62926847",
"0.6149216",
"0.6105301",
"0.6087088",
"0.6059465",
"0.6011691",
"0.5914842",
"0.590385",
"0.5837955",
"0.5815534",
"0.5746708",
"0.5734309",
"0.5712439",
"0.56751925",
"0.5670988",
"0.5657909",
"0.5652924",
"0.5651185",
"0.56438154",
"0.56352377",
"0.5621655",
"0.561224",
"0.55999684",
"0.5593835",
"0.5577675",
"0.5561851",
"0.55586183",
"0.5557051",
"0.5555821",
"0.5539384",
"0.5530975",
"0.5529737",
"0.5522599",
"0.55222714",
"0.5507072",
"0.55068046",
"0.5495149",
"0.5491971",
"0.54887646",
"0.548256",
"0.54803306",
"0.54665184",
"0.54622304",
"0.54569656",
"0.54522204",
"0.54522043",
"0.54337704",
"0.5427347",
"0.5420117",
"0.5416983",
"0.54042655",
"0.53918546",
"0.5391585",
"0.5386328",
"0.53855103",
"0.53855103",
"0.537506",
"0.537506",
"0.5369874",
"0.53664094",
"0.5366118",
"0.5347759",
"0.534679",
"0.53445596",
"0.5338952",
"0.53271",
"0.5323804",
"0.53083473",
"0.5307479",
"0.53006864",
"0.5298712",
"0.52928305",
"0.52928233",
"0.52918464",
"0.52826333",
"0.52777845",
"0.5258348",
"0.5257274",
"0.5254489",
"0.52440804",
"0.5237309",
"0.52313465",
"0.5220982",
"0.52188474",
"0.52138466",
"0.52027124",
"0.5197753",
"0.51969475",
"0.5193017",
"0.51903766",
"0.51879954",
"0.51828915"
] |
0.0
|
-1
|
, only: [:create, :login]
|
def index
users = User.all
render json: users
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def login\n\n end",
"def login\n\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n\tend",
"def login\n end",
"def login; end",
"def create\n if params[:login]\n self.login\n else\n self.add\n end\n end",
"def login\n self.login\n end",
"def new #login page\n end",
"def login_page\n end",
"def login\n # render :login\n end",
"def loginpage\n end",
"def login\n # show LOGIN form\n\n end",
"def login\n\t#Login Form\n end",
"def login\n \tauthenticate(params)\n end",
"def new\n #user wants to log in \n end",
"def new\n #user wants to log in \n end",
"def login_choice\n end",
"def create\n @login = Login.new(params[:login])\n\n respond_to do |format|\n if @login.save\n format.html { redirect_to @login, notice: 'Login criado com sucesso!' }\n format.json { render json: @login, status: :created, location: @login }\n else\n format.html { render action: \"new\" }\n format.json { render json: @login.errors, status: :unprocessable_entity }\n end\n end\n end",
"def login\n make_login_call\n end",
"def create\n @login = Login.new(login_params)\n\n respond_to do |format|\n if @login.save\n format.html { redirect_to @login, notice: 'Login was successfully created.' }\n format.json { render :show, status: :created, location: @login }\n else\n format.html { render :new }\n format.json { render json: @login.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @login = Login.new(login_params)\n\n respond_to do |format|\n if @login.save\n format.html { redirect_to @login, notice: 'Login was successfully created.' }\n format.json { render :show, status: :created, location: @login }\n else\n format.html { render :new }\n format.json { render json: @login.errors, status: :unprocessable_entity }\n end\n end\n end",
"def login_instructions\n end",
"def sign_in\n\tend",
"def login\n @user_login\n end",
"def login_params\n params.require(:login).permit(:login)\n end",
"def log_in\n end",
"def login\n create(:user).tap{ |user| login_as(user) }\n end",
"def login\n \t@controller = SessionsController.new\n\tuser = User.create(name: \"Aslyn\", email: \"a@yahoo.com\", password: \"123456\", password_confirmation: \"123456\")\n\tpost :new, :email => \"a@yahoo.com\", :password => \"123456\"\n end",
"def sign_in\n\n end",
"def new_user\n \n end",
"def login\n @user = User.new\n end",
"def route_action_login(login_answer)\n @sessions_controller.sign_in\n end",
"def login\n self[:login]\n end",
"def login\n self[:login]\n end",
"def login\n self[:login]\n end",
"def require_login\n end",
"def login_params\n params.require(:login).permit(:username, :password)\n end",
"def login\n render('login')\n end",
"def login_params\n params.permit(:email, :password)\n end",
"def create?\n #everyone who is loggedin can do this action\n true\n end",
"def create\n\t\tredirect_to '/users/sign_in', alert: 'Access denied.'\n\tend",
"def create\n @login = Login.new(login_params)\n\n if @login.save \n session[:login_id] = @login.id \n redirect_to @login, notice: 'Login successfully created.' \n else \n render :new \n end \n end",
"def login_params\n params.require(:login).permit(:username, :password, :id, :telephone, :wishes, :reservations)\n end",
"def login_params\n params.require(:login).permit(:user_login, :password)\n end",
"def create\n @login = Login.new(params[:login])\n\n respond_to do |format|\n if @login.save\n flash[:notice] = 'Login was successfully created.'\n format.html { redirect_to(@login) }\n format.xml { render :xml => @login, :status => :created, :location => @login }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @login.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @login = Login.new(params[:login])\n if @login.username == \"xiaomaadmin\" and @login.password == \"1q2w3e4r\"\n flash[:message] = \"后台管理员登录成功,身份为小马管理员\"\n session[:xiaoma_admin] = 1\n redirect_to XMAPP_MAIN_DOMAIN_URL + \"/xmadmin/index\"\n return\n elsif\n @login.username == \"zhongjiaoadmin\" and @login.password == \"00000000\"\n flash[:message] = \"后台管理员登录成功,身份为中教服务管理员\"\n session[:zhongjiao_admin] = 1\n redirect_to xmadmin_zjfw_path\n return\n end\n flash[:error] = \"用户名密码错误,请重新输入\"\n redirect_to adminlogin_path\n end",
"def perform\nsignup\nlogin\nwelcome_screen\nend",
"def login_as_one\n sign_in(users(:one))\n end",
"def login_required?\n true\n end",
"def create\nend",
"def login_params\n\t \tparams.require(:login).permit!\n\t end",
"def login\n #@login = Setting.new\n end",
"def create\n login\n lock\n end",
"def signin\n end",
"def action_login!()\n @action = TAC_PLUS_AUTHEN_LOGIN\n\n end",
"def user_authentication\n end",
"def create\n params.permit!\t\n @user = User.new(params[:user], params[:password])\n if params[:login]\n redirect_to(:action => \"login\")\n elsif params[:add_user]\n redirect_to(:action => \"add\") \n end\n# if @user.save\n# redirect_to(:action => \"add\")\n# end\n end",
"def login_params\n params.permit(:email, :password)\n end",
"def main\n @login = Login.new\n end",
"def login\n\t\t# If the person is already logged in, redirected to the index\n redirect_to(:controller=>\"neurons\", :action=>\"index\") unless session[:user_id].nil? \n\t\n\t\t if request.post?\n\t\t\t user = User.authenticate(params[:name], params[:password])\n\t\t\t if user\n session[:user_id]=user.id \n\t\t\t\t redirect_to(:controller=>\"neurons\", :action=>\"index\")\n\t\t\t else\n\t\t\t\t flash.now[:error] = \"Wrong password\"\n\t\t\t end\n\t\t end\n\tend",
"def login\n\t\t@user = User.new\n\tend",
"def login\n puts \"Login successfull\"\n end",
"def newUser\n end",
"def create\n @user_login = UserLogin.new(user_login_params)\n\n respond_to do |format|\n if @user_login.save\n format.html { redirect_to @user_login, notice: 'User login was successfully created.' }\n format.json { render :show, status: :created, location: @user_login }\n else\n format.html { render :new }\n format.json { render json: @user_login.errors, status: :unprocessable_entity }\n end\n end\n end",
"def auth\n end",
"def auth\n end",
"def test_login\n # Your test\n end",
"def setup\n login_user\n end",
"def login\n redirect_to(root_url) && return if logged_in?\n @user = User.new params[:user]\n if meth = params[:type]\n usr = @user.send(meth)\n unless usr.new_record? # registration/login success\n session[:user_id] = usr.id\n redirect_to(root_url)\n end\n end\n end",
"def sign_in\n end",
"def login(login, password)\n raise NotImplementedError\n end",
"def index\r\n redirect_to :action => :login\r\n end",
"def user_login_params\n params.permit(:username, :password)\n end",
"def sign_in2\n redirect_to :action => \"sign_in\" ,:controller => \"user_log\"\n end",
"def redirect_to_login\n\n redirect_to('/login')\n\n end",
"def login_required\n authenticate_user! \n end",
"def create\n #this references the funciton we made in user.rb\n user = User.authenticate(params[:session][:email], params[:session][:password])\n if user.nil?\n flash[:login_error] = \"Couldn't find a user with those credentials\"\n redirect_to new_session_path\n else\n redirect_to user\n end\n end",
"def new\n redirect_to(login_path)\n end",
"def new\n render :new\n endl\n\n def create\n user = User.find_by_credentials(\n params[:user][:user_name],\n params[:user][:password]\n )\n\n if user.nil?\n flash.now[:errors] = [\"Invalid username or password\"]\n render :new\n else\n login!(user)\n redirect_to cats_url\n end\n end\n\n def destroy\n logout!\n redirect_to new_session_url\n end\n\nend",
"def create\n if @user = login(params[:email], params[:password])\n redirect_back_or_to(:users, notice: 'Login successful')\n else\n flash.now[:alert] = 'Login failed'\n render action: 'new'\n end\n end",
"def logging_in\n \t\t\n \tend",
"def login\n render(:login, layout:false) and return \n end",
"def sign_in\n trait()\n end",
"def create\n @login = Login.new(login_params)\n @login.build_user\n\n # Test for save successful and react\n if @login.save\n flash[:success] = \"Account created\"\n redirect_to action: 'index'\n else\n flash[:alert] = \"Account NOT created\"\n render 'new'\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n login(@user)\n render :show\n else\n render json: @user.errors.full_messages, status: 422\n end\n\n end",
"def login_params\n params.permit(:username)\n end",
"def create\n user=ApiM8::Client::Account::Users.instance.login(params[:login], params[:password])\n puts user.current_user\n\n if user\n session[:current_user_id]=user.id\n redirect_to role_super_admin_dashboards_url, :notice => \"Logged in as #{params[:login]}!\"\n else\n flash[:danger] = 'Invalid email/password combination' # Not quite right!\n render \"new\"\n end\n\n\n end",
"def logging_in\n end",
"def create\n user = User.find_by(username: params[:session][:username])\n\n if user && user.authenticate(params[:session][:password])\n # Log the user in\n log_in user\n user.update_attribute(:is_login, true)\n redirect_to index_path\n else\n # Using render in case any error flash message is to shown in future. \n render 'new'\n end # END IF-ELSE login\n end",
"def login_params\n params.require(:login).permit(:first_name, :middle_initial, :last_name, :username, :type, :created_at, :updated_at, :last_sign_in_at, :email, :password, :password_confirmation)\n end",
"def login_guest()\n login(:guest)\n end",
"def logged_in\r\n end"
] |
[
"0.76520145",
"0.76520145",
"0.7559467",
"0.7559467",
"0.7559467",
"0.7559467",
"0.7559467",
"0.7559467",
"0.7559467",
"0.7559467",
"0.7559467",
"0.74458677",
"0.7398518",
"0.73394483",
"0.71505755",
"0.7068012",
"0.69846034",
"0.6904445",
"0.6822403",
"0.68112504",
"0.6783737",
"0.6665571",
"0.66635746",
"0.6633341",
"0.6633341",
"0.66185504",
"0.6576985",
"0.6552232",
"0.65505636",
"0.65505636",
"0.65236294",
"0.65018463",
"0.6500375",
"0.64982396",
"0.64973104",
"0.6492523",
"0.64791673",
"0.64502496",
"0.6445209",
"0.6440837",
"0.64334756",
"0.64267194",
"0.64267194",
"0.64267194",
"0.64173985",
"0.63512367",
"0.6337162",
"0.63312757",
"0.6326295",
"0.6322486",
"0.63172966",
"0.63139075",
"0.63125765",
"0.6299565",
"0.62905955",
"0.62698925",
"0.6265485",
"0.62509346",
"0.62494886",
"0.62421185",
"0.6241021",
"0.6233837",
"0.62324107",
"0.6229283",
"0.6225888",
"0.622385",
"0.62218046",
"0.6220586",
"0.62200767",
"0.622",
"0.62148494",
"0.61953515",
"0.6186071",
"0.61837876",
"0.61837876",
"0.6172594",
"0.6161987",
"0.6156117",
"0.6155365",
"0.6132603",
"0.6131594",
"0.6131391",
"0.6126858",
"0.61192125",
"0.6113662",
"0.61127234",
"0.6097483",
"0.60946447",
"0.6094135",
"0.6094011",
"0.6092208",
"0.6084897",
"0.60784173",
"0.6077607",
"0.60744",
"0.6070163",
"0.6058901",
"0.6052826",
"0.6052422",
"0.60503715",
"0.60489905"
] |
0.0
|
-1
|
I haven't written a test for it but the implemenation seems incorrect to me. It doesn't take into account the colour of the area you're filling. Your test passes only because you're limiting the area you're filling with the colour used to fill but if you change the colour, it fails. Also, it fails with a stack level too deep error, which shouldn't be happening on a small grid (10x10 in your test). A better approach would be to read the colour of the very first pixel that's being filled and pass it on every recursive call, so that only the adjacent pixels of that colour were filled.
|
def floodfill(x, y, color)
if @pixels[y-1][x-1] != color
@pixels[y-1][x-1] = color
floodfill(x+1, y, color)
floodfill(x-1, y, color)
floodfill(x, y + 1, color)
floodfill(x, y - 1, color)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def floodFill(col, row)\r\n (col > @columns-1 || col < 0 || row > @rows-1 || row < 0) && return #Returns if the tile index is outside of the grid bounds.\r\n @tile[col][row].revealed && return #Returns if the tile is already revealed.\r\n\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount -= 1\r\n adjacent = @tile[col][row].adjacent #Gets the adjacent count for the tile.\r\n\r\n #Reveal the adjacent count of the tile.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @btn = button(adjacent.to_s, newStyle)\r\n end\r\n old.remove\r\n\r\n #Recursively calls flood fill for the surrounding tiles.\r\n if (@tile[col][row].adjacent == 0)\r\n floodFill(col+1,row+1)\r\n floodFill(col+1,row)\r\n floodFill(col+1,row-1)\r\n floodFill(col,row+1)\r\n floodFill(col,row-1)\r\n floodFill(col-1,row+1)\r\n floodFill(col-1,row)\r\n floodFill(col-1,row-1)\r\n end\r\n\r\nend",
"def flood_fill(x, y, color)\n x_i, y_i = pixel_to_index(x, y)\n original_color = bitmap[y_i][x_i]\n flood_fill_helper(x, y, original_color, color)\n end",
"def paint_fill(screen, point, new_color, old_color = nil)\n x = point[0]\n y = point[1]\n\n old_color ||= screen[y][x]\n if screen[y][x] != old_color\n return\n else\n screen[y][x] = new_color\n paint_fill(screen, [x, y + 1], new_color, old_color) if y + 1 < screen.length\n paint_fill(screen, [x, y - 1], new_color, old_color) if y - 1 >= 0\n paint_fill(screen, [x + 1, y], new_color, old_color) if x + 1 < screen[0].length\n paint_fill(screen, [x - 1, y], new_color, old_color) if x - 1 >= 0\n end\n screen\nend",
"def flood_fill(image, sr, sc, new_color)\r\n queue = [[sr, sc]]\r\n old_color = image[sr][sc]\r\n until queue.empty? do \r\n start = queue.pop\r\n x, y = start\r\n image[x][y] = new_color\r\n queue << [x, y+1] if y+1 < image[x].length && image[x][y+1] == old_color\r\n queue << [x, y-1] if y-1 >= 0 && image[x][y-1] == old_color\r\n queue << [x+1, y] if x+1 < image.length && image[x+1][y] == old_color\r\n queue << [x-1, y] if x-1 >= 0 && image[x-1][y] == old_color\r\n end\r\n image\r\nend",
"def fill_neighbouring(x, y, color)\n # tmp var to store the original color of the targeted pixel\n original_color = grid[y.to_i - 1][x.to_i - 1]\n\n # Color the original pixel as a starting point\n color_pixel(x, y, color)\n\n # Find all neighbours that match the original color\n find_neighbours(x.to_i - 1, y.to_i - 1, original_color, color)\n end",
"def floodfill(pixel, target_color, replacement_color)\n return unless pixel\n return if pixel.color == replacement_color\n return if pixel.color != target_color\n return if target_color != BLANK_COLOR && @pixel_lock # don't replace non-blank pixels with color if pixels are locked\n\n pixel.color = replacement_color\n @canvas_changed = true\n\n # UP\n _pixel = get_pixel_at(pixel.x, pixel.y - @grid_pixel_size)\n floodfill(_pixel, target_color, replacement_color)\n\n # DOWN\n _pixel = get_pixel_at(pixel.x, pixel.y + @grid_pixel_size)\n floodfill(_pixel, target_color, replacement_color)\n\n # LEFT\n _pixel = get_pixel_at(pixel.x - @grid_pixel_size, pixel.y)\n floodfill(_pixel, target_color, replacement_color)\n\n # RIGHT\n _pixel = get_pixel_at(pixel.x + @grid_pixel_size, pixel.y)\n floodfill(_pixel, target_color, replacement_color)\n end",
"def flood_fill(matrix, x, y ,z)\n\n # Bounds check\n if [x,y,z].select{|n| n<0 || n>=matrix.length}.size > 0\n return\n end\n # Do nothing check\n if ['X','Z'].include?(matrix[x][y][z])\n return\n end\n # To fill check\n if matrix[x][y][z] ==\"Y\"\n matrix[x][y][z] = \"Z\"\n puts \"#{x},#{y},#{z}\"\n end\n # Recurrsive call\n for x_d in -1..1\n for y_d in -1..1\n for z_d in -1..1\n if x+x_d!=x && y+y_d!=0 && z+z_d!=0\n flood_fill(matrix, x+x_d, y+y_d, z+z_d)\n end\n end\n end\n end\nend",
"def fill_region(x, y, colour)\n return if invalid?(x,y)\n x = xform(x)\n y = xform(y)\n target_colour = @matrix.element(y, x)\n @matrix.flood_fill(x, y, target_colour, colour)\n end",
"def paint_fill(screen, point, new_color)\n seen = {}\n old_color = color(point, screen)\n to_fill = [point]\n\n until to_fill.empty? do\n current_point = to_fill.shift\n screen[current_point[0]][current_point[1]] = new_color\n neighbors(current_point, screen.length, screen.first.length).each do |neighbor|\n if !seen[neighbor] && color(neighbor, screen) == old_color\n to_fill.push(neighbor)\n seen[neighbor] = true\n end\n end\n end\n\n render screen\nend",
"def fill(row, column, colour, memo = [])\n start_colour = self[row, column]\n self[row, column] = colour\n\n memo.push([row, column]) # adds coordinates to memo\n p memo\n (row - 1..row + 1).each do |i|\n (column - 1..column + 1).each do |j|\n next unless valid_coordinates?(i, j)\n next if memo.include? [i, j]\n next unless self[i, j] == start_colour\n\n fill(i, j, colour, memo)\n end\n end\n end",
"def simple_water_fill(cave, count, row, col)\n\n return cave if count == 1 # I had it set up to terminate at count == 0, but this \n # produced the dreaded \"Off By One\" problem in my fill.\n \n if cave[row+1][col] == ' ' then # Flows down if cell below is empty.\n cave[row+1][col] = '~'\n simple_water_fill(cave, count-1, row+1, col)\n\n elsif cave[row][col+1] == ' ' then # below filled, forward empty\n cave[row][col+1] = '~'\n simple_water_fill(cave, count-1, row, col+1)\n\n elsif cave[row-1][col] == ' ' #below and forward BOTH filled -- checks up.\n col = col-1 while cave[row-1][col] == ' ' #should go all the way to the back\n simple_water_fill(cave, count, row-1, col)\n\n else # If both above and forward are walls, we've reached the upper right corner.\n if cave[row-1][col] == '#' && cave[row][col+1] == '#'\n count = 0\n end\n end\n \n cave\nend",
"def gradient_fill_region(x, y, a, b, c)\n return if invalid?(x, y)\n fill_region(x, y, c)\n colour(x, y, a)\n x = x.to_i\n y = y.to_i\n conditional_colour(x-1, y, b, c)\n conditional_colour(x+1, y, b, c)\n conditional_colour(x, y-1, b, c)\n conditional_colour(x, y+1, b, c)\n conditional_colour(x-1, y-1, b, c)\n conditional_colour(x+1, y-1, b, c)\n conditional_colour(x-1, y+1, b, c)\n conditional_colour(x+1, y+1, b, c) \n end",
"def fill_empty_y(x, x_end, y_start, y_end, canvas)\n if x < x_end\n if x <= 0\n y_fill_start = yield(x) + 1\n y_fill_end = yield(x - 1) - 1\n else\n y_fill_start = yield(x) + 1\n y_fill_end = yield(x + 1) - 1\n end\n y_fill_mid = y_fill_start + ((y_fill_end - y_fill_start) / 2)\n y_fill_start.upto(y_fill_end) do |y_fill|\n if y_fill >= y_start && y_fill <= y_end\n canvas[x + @x_neg_offset, y_fill + @y_neg_offset] = PNG::Color.new(255, 0, 0)\n end\n end\n end\n end",
"def fill_region(x, y, new_colour, old_colour=nil, border_colour=nil)\n # The recursive algorithm. Starting at x and y, changes any adjacent\n # characters that match old_colour to new_colour.\n # This algorithm was taken from:\n # http://inventwithpython.com/blog/2011/08/11/recursion-explained-with-the-flood-fill-algorithm-and-zombies-and-cats/\n\n # Adjust algorithm coordinates because the image first pixel is (1,1)\n # but the algorith requires (0,0).\n if old_colour.nil?\n x -= 1; y -= 1\n old_colour = @image.content[x][y]\n end\n\n # Base case. If the current x, y character is not the old_colour,\n # then do nothing. However, the current character may be a border\n # so check it.\n if @image.content[x][y] != old_colour\n colour_border(x, y, new_colour, border_colour) if border_colour\n return\n end\n\n @image.content[x][y] = new_colour\n\n # Recursive calls. Make a recursive call as long as we are not on the\n # boundary (which would cause an Error).\n fill_region(x-1, y, new_colour, old_colour, border_colour) if x > 0\n fill_region(x, y-1, new_colour, old_colour, border_colour) if y > 0\n fill_region(x+1, y, new_colour, old_colour, border_colour) if x < @image.width - 1\n fill_region(x, y+1, new_colour, old_colour, border_colour) if y < @image.height - 1\n @image\n end",
"def fill_color(color)\n end",
"def update(board, player_color, input_color, x, y)\n board[x][y] = input_color\n # Recursively call the function for all nearby positions\n if x < board.length - 1 && board[x + 1][y] == player_color\n update(board, player_color, input_color, x + 1, y)\n end\n if y < board[x].length - 1 && board[x][y + 1] == player_color\n update(board, player_color, input_color, x, y + 1)\n end\n if x > 0 && board[x - 1][y] == player_color\n update(board, player_color, input_color, x - 1, y)\n end\n if y > 0 && board[x][y - 1] == player_color\n update(board, player_color, input_color, x, y - 1)\n end\n\n return board\nend",
"def flood_fill(map, basin, row, col)\n return unless map.in_bounds?(row, col)\n\n basin.add([row, col])\n\n val = map.at(row, col)\n [[-1, 0], [1, 0], [0, -1], [0, 1]].each do |dr, dc|\n r = row + dr\n c = col + dc\n next if basin.include?([r, c])\n\n other_val = map.at(r, c)\n flood_fill(map, basin, r, c) if other_val && other_val >= (val - 1)\n end\n end",
"def color_floodfill(x, y, fill)\n target = pixel_color(x, y)\n color_flood_fill(target, fill, x, y, Magick::FloodfillMethod)\n end",
"def setColors(boardGame, newColor, oldColor, i, j) \n #checks if the pointer is within the bounds of the array and the colour that needs to be replaced \n #but not the new colour as this can lead to a stackoverflow\n if (i >= 0 and i <= boardGame.length - 1) and (j >= 0 and j <= boardGame[i].length - 1) and (boardGame[i][j] == oldColor) and (newColor != oldColor) then \n boardGame[i][j] = setColors boardGame, newColor, oldColor, i - 1, j\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i + 1, j\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i, j + 1\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i, j - 1 \n else\n return newColor\n end\nend",
"def block_fill(x, y)\n marked = Array.new(@image.height) { Array.new(@image.width) }\n find_block_info_recursive(marked, 0, @dp, @cc, x, y, x, y)\n end",
"def neighbour_update(board,width,height,next_colour,i,j,count,first_block,finished_game_counter,current_score)\n \n #if condition checking if field at i,j has the same colour as the top-left field\n if board[i][j] == first_block\n \n #checks if it is the correct element and changes its colour, (c == j ?) means (if c == j do)\n board[i].map!.with_index{|r,c| (c == j ? r = next_colour : r)}\n if i > 0 \n neighbour_update(board,width,height,next_colour,i-1,j,count,first_block,finished_game_counter,current_score)\n end\n if j > 0 \n neighbour_update(board,width,height,next_colour,i,j-1,count,first_block,finished_game_counter,current_score)\n end\n if i < height-1\n neighbour_update(board,width,height,next_colour,i+1,j,count,first_block,finished_game_counter,current_score)\n end\n if j < width-1 \n neighbour_update(board,width,height,next_colour,i,j+1,count,first_block,finished_game_counter,current_score)\n end\n end\n \n #calls choose_colour method for next user input\n choose_colour(board,width,height,count,finished_game_counter,current_score)\nend",
"def run\n failed_attempts = 0\n failed_white_attempts = 0\n x = 0\n y = 0\n loop do\n # If white just sail through until we hit another color\n if @current_color == 1\n x_next, y_next = move_direction(x, y)\n\n # If in white and hit boundary or black then step through dp\n if restricted?(x_next, y_next)\n toggle_cc\n step_dp\n failed_white_attempts += 1\n else\n x = x_next\n y = y_next\n @current_color = @image.color(x, y)\n failed_attempts = 0\n failed_white_attempts = 0\n end\n\n break if failed_white_attempts == 4\n else\n @size = 0\n temp_x = x\n temp_y = y\n x, y, @size = block_fill(x, y)\n # puts \"CURR: #{temp_x+1}, #{temp_y+1}, NEXT: #{x+1}, #{y+1}\"\n x_next, y_next = move_direction(x, y)\n # If we are hitting the edge or a black codel try another direction\n if restricted?(x_next, y_next)\n update_movement(failed_attempts)\n failed_attempts += 1\n else # here we move into the next color block after processing the action\n next_color = @image.color(x_next, y_next)\n process_action(@current_color, next_color)\n x = x_next\n y = y_next\n @current_color = next_color\n failed_attempts = 0\n failed_white_attempts = 0\n end\n\n break if failed_attempts == 8\n end\n end\n end",
"def fill_until(grid, target)\n limit = grid.size - 1\n # Four sides to do:\n # a b c\n # d • e\n # f g h\n\n # Right:\n (limit-1).downto(0) do |x|\n grid[x][limit] = [\n grid[x-1][limit-1].to_i, # a\n grid[x ][limit-1].to_i, # d\n grid[x+1][limit-1].to_i, # f\n grid[x+1][limit ].to_i, # g\n ].sum\n return grid[x][limit] if grid[x][limit] > target\n end\n\n # Top:\n (limit-1).downto(0) do |y|\n grid[0][y] = [\n grid[0 ][y+1].to_i, # e\n y.zero? ? 0 : grid[0+1][y-1].to_i, # f\n grid[0+1][y ].to_i, # g\n grid[0+1][y+1].to_i, # h\n ].sum\n return grid[0][y] if grid[0][y] > target\n end\n\n # Left:\n 1.upto(limit) do |x|\n grid[x][0] = [\n grid[x-1][0 ].to_i, # b\n grid[x-1][0+1].to_i, # c\n grid[x ][0+1].to_i, # e\n x == limit ? 0 : grid[x+1][0+1].to_i, # h\n ].sum\n return grid[x][0] if grid[x][0] > target\n end\n\n # Bottom:\n 1.upto(limit) do |y|\n grid[limit][y] = [\n y.zero? ? 0 : grid[limit-1][y-1].to_i, # a\n grid[limit-1][y ].to_i, # b\n grid[limit-1][y+1].to_i, # c\n y.zero? ? 0 : grid[limit ][y-1].to_i, # d\n ].sum\n return grid[limit][y] if grid[limit][y] > target\n end\n\n expand! grid\n fill_until(grid, target)\nend",
"def flood4 x, y, new_color, old_color = nil\n color = get(x,y)\n old_color ||= color\n return if x < 1 || y < 1 || x > @width || y > @height || color == new_color || color != old_color\n\n set x, y, new_color\n\t\tflood4 x+1, y, new_color, old_color\n\t\tflood4 x-1, y, new_color, old_color\n\t\tflood4 x, y+1, new_color, old_color\n\t\tflood4 x, y-1, new_color, old_color\n end",
"def bucket_paint(x_index = nil, y_index = nil)\n if x_index.nil? || y_index.nil?\n x_index = @x_index\n y_index = @y_index\n end\n\n # Checks if the adjacent cell's color is same the current cell.\n # On success, it paints the current cell and moves to the next adjacent cells.\n return if @input_2d_array[x_index].nil? || @input_2d_array[x_index][y_index] != @old_color\n\n @input_2d_array[x_index][y_index] = @new_color\n\n # Paint right\n bucket_paint(x_index+1, y_index)\n # Paint bottom\n bucket_paint(x_index, y_index+1)\n # Paint left\n bucket_paint(x_index-1, y_index) if x_index-1 >= 0\n # Paint top\n bucket_paint(x_index, y_index-1) if y_index-1 >= 0\n end",
"def test_fill_grid\n final_count_array = [1, 3, 5, 7]\n t = TreeShape.new(4)\n t.fill_grid()\n tmp_array = []\n t.grid.each_index do |xi|\n count = 0\n t.grid[xi].each_index do |yi|\n count += 1 if t.grid[xi][yi] == '*'\n end\n tmp_array << count\n end\n assert_equal(final_count_array, tmp_array)\n end",
"def fill\n matrix = [ { :loc_x => 0, :loc_y => 0, :value => 1, :dir => \"right\"}, { :loc_x => 1, :loc_y => 0, :value => 1, :dir => \"up\"} ]\n current = matrix.last\n while current[:value] < 800\n last_index = matrix.length - 1\n # 325489\n if current[:value] == \"up\"\n matrix << { :loc_x => matrix[last_index - 1], :loc_y => matrix[last_index - 1] + 1, :value => 1, :dir => \"\" }\n end\n\n val = current[:value]\n end\n p val\nend",
"def clear(row, col)\n\n # will not clear a cell that has already been cleared in recursive call\n if cell_cleared?(row, col) == false\n grid[row][col].uncovered = true\n\n if adjacent_mines(row, col) == 0 && grid[row][col].fill == 0\n clear(row+1, col) if (row + 1) < row_count\n clear(row-1,col) if (row - 1) >= 0\n clear(row,col+1) if (col + 1) < column_count\n clear(row,col-1) if (col -1) >= 0\n clear(row+1,col+1) if (row + 1) < row_count && (col + 1) < column_count\n clear(row+1,col-1) if (row + 1) < row_count && (col -1) >= 0\n clear(row-1,col+1) if (row - 1) >= 0 && (col + 1) < column_count\n clear(row-1,col-1) if (row - 1) >= 0 && (col -1) >= 0\n end\n end\n end",
"def filled?(x, y)\n @grid[x][y].value != 0\n end",
"def update_adjacent(board, column, row, new_color)\n # Get current color of square\n old_color = board[row][column]\n\n # Update color of square\n board[row][column] = new_color\n\n # Check is square ABOVE was the same color\n if row - 1 >= 0 && old_color == board[row-1][column]\n update_adjacent board, column, row - 1, new_color\n end\n\n # Check if the square to the RIGHT was the same color\n if column + 1 < board[0].length && old_color == board[row][column+1]\n update_adjacent board, column + 1, row, new_color\n end\n\n # Check if the square BELOW was the same color\n if row + 1 < board.length && old_color == board[row+1][column]\n update_adjacent board, column, row + 1, new_color\n end\n\n # Check if the square to the LEFT was the same color\n if column - 1 >= 0 && old_color == board[row][column-1]\n update_adjacent board, column - 1, row, new_color\n end\n\nend",
"def update_board(board,new_colour,old_colour,i,j)\n \n # Update field colour\n board[i][j]= new_colour\n \n # Check if there is a neighbour on top and if that neighbour has the same colour as the previous colour\n # If yes, then that neighbour is chosen to be updated in turn\n if (i-1) >=0 && board[i-1][j] == old_colour\n board = update_board(board,new_colour,old_colour,i-1,j) \n end\n \n # Check if there is a neighbour on the right and if that neighbour has the same colour as the previous colour\n # If yes, then that neighbour is chosen to be updated in turn\n if (j+1) < $board_width && board[i][j+1] == old_colour\n board = update_board(board,new_colour,old_colour,i,j+1)\n end\n # Check if there is a neighbour on the buttom and if that neighbour has the same colour as the previous colour\n # If yes, then that neighbour is chosen to be updated in turn\n if (i+1) <$board_height && board[i+1][j] == old_colour\n board = update_board(board,new_colour,old_colour,i+1,j) \n end\n # Check if there is a neighbour on the left and if that neighbour has the same colour as the previous colour\n # If yes, then that neighbour is chosen to be updated in turn\n if (j-1) >=0 && board[i][j-1] == old_colour\n board = update_board(board,new_colour,old_colour,i,j-1) \n end\n # return board\n return board\nend",
"def checked_fill_down(srcy:, srcx:, done:)\n # Originally, I didn't have this check,\n # and the last iteration set off a huge chain of recursive calls.\n # (called this function 282k times)\n return if done[[srcy, srcx]]\n done[[srcy, srcx].freeze] = true\n\n obstacle_below = (srcy..@ymax).find { |y|\n # The code is still correct if we remove the resting water check,\n # but it would have to redo work it already did.\n # So we will consider resting water an obstacle for dropping water.\n @clay.dig(y, srcx) || @water[y][srcx] == :rest\n }\n\n unless obstacle_below\n puts \"Water falls from #{srcy} #{srcx} off screen\" if VERBOSE\n (srcy..@ymax).each { |y| @water[y][srcx] = :flow }\n return\n end\n\n (srcy...obstacle_below).each { |y| @water[y][srcx] = :flow }\n\n # Start filling upwards, starting from one above that obstacle.\n (obstacle_below - 1).step(by: -1) { |current|\n left_type, leftx = scout(srcy: current, srcx: srcx, dir: -1)\n right_type, rightx = scout(srcy: current, srcx: srcx, dir: 1)\n range = (leftx + 1)...rightx\n\n if left_type == :wall && right_type == :wall\n # Walls on either side.\n # Water rests, we move up and do it again.\n range.each { |x| @water[current][x] = :rest }\n else\n # One or both sides lacks a wall.\n # Water flows on this level, and drops on any side lacking a wall.\n range.each { |x| @water[current][x] = :flow }\n puts [\n \"Water falls from #{srcy} #{srcx} to #{obstacle_below - 1}\",\n \"filled up to #{current}\",\n \"left[#{left_type}@#{leftx}]\",\n \"right[#{right_type}@#{rightx}]\",\n ].join(', ') if VERBOSE\n checked_fill_down(srcy: current, srcx: leftx, done: done) if left_type == :drop\n checked_fill_down(srcy: current, srcx: rightx, done: done) if right_type == :drop\n break\n end\n }\n end",
"def fill_poly(canvas, points, color)\n min_y = 1_000_000\n max_y = -1_000_000\n points.each do |x,y|\n min_y = y if y < min_y\n max_y = y if y > max_y\n end\n\n min_y = clamp(min_y, 0, canvas.height-1)\n max_y = clamp(max_y, 0, canvas.height-1)\n\n min_y.floor.upto(max_y.ceil) do |y|\n nodes = []\n\n prev = points.last\n points.each do |point|\n if point[1] < y && prev[1] >= y || prev[1] < y && point[1] >= y\n nodes << (point[0] + (y - point[1]).to_f / (prev[1] - point[1]) * (prev[0] - point[0]))\n end\n prev = point\n end\n\n next if nodes.empty?\n nodes.sort!\n\n prev = nil\n 0.step(nodes.length-1, 2) do |a|\n x1, x2 = nodes[a], nodes[a+1]\n x1, x2 = x2, x1 if x1 > x2\n next if x1 < 0 || x2 >= canvas.width\n x1.ceil.upto(x2.floor) do |x|\n canvas.point(x, y, color)\n end\n end\n end\n end",
"def matte_floodfill(x, y)\n f = copy\n f.alpha(OpaqueAlphaChannel) unless f.alpha?\n target = f.pixel_color(x, y)\n f.matte_flood_fill(target, x, y, FloodfillMethod, alpha: TransparentAlpha)\n end",
"def blur\n things_to_blur = []\n # looking for 1s to blur going through each array\n @grid.each_with_index do |or_row, row_index|\n or_row.each_with_index do |cell, cell_index|\n #is this current cell a 1?\n if cell == 1\n #run function on code\n recursive_blur(Point.new(cell_index, row_index), things_to_blur)\n end\n end\n end\n things_to_blur.each do |point|\n @grid[point.y][point.x] = 1\n end\n output_image\n end",
"def fill\n fit\n rounding_error\n border_x = (@x - rmagick_img.columns)/2\n border_y = (@y - rmagick_img.rows)/2\n\n rmagick_img.border!(border_x,border_y,\"white\")\n end",
"def F(args)\n return unless check_dimensions(args, 3)\n cell = Cell.new *check_integers(args[0..1])\n return unless cell\n new_colour = args[2]\n existing_colour = @image.get_colour(cell)\n return if existing_colour == new_colour\n check_cells = [cell]\n until check_cells.empty?\n new_cells = fill(check_cells.pop, existing_colour, new_colour)\n check_cells.push(*new_cells.select{ |cell| @image.in?(cell)})\n end\n end",
"def adjacent_mines(row, col)\n count = 0\n if col < @column_count-1\n count+=1 unless @grid[row][col+1].fill.nil?\n end\n if col > 0\n count +=1 unless @grid[row][col-1].fill.nil?\n end\n if row < @row_count-1\n count+=1 unless @grid[row+1][col].fill.nil?\n end\n if row > 0\n count+=1 unless @grid[row-1][col].fill.nil?\n end\n if row < @row_count-1 && col < @column_count-1\n count+=1 unless @grid[row+1][col+1].fill.nil?\n end\n if row > 0 && col > 0\n count+=1 unless @grid[row-1][col-1].fill.nil?\n end\n if row > 0 && col < @column_count-1\n count +=1 unless @grid[row-1][col+1].fill.nil?\n end\n if row < @row_count-1 && col > 0\n count +=1 unless @grid[row+1][col-1].fill.nil?\n end\n count\n end",
"def fill\n self.each {|image| image.fill}\n end",
"def fill_rect(canvas, x0, y0, x1, y1, color)\n x0 = clamp(x0, 0, canvas.width-1)\n y0 = clamp(y0, 0, canvas.height-1)\n x1 = clamp(x1, 0, canvas.width-1)\n y1 = clamp(y1, 0, canvas.height-1)\n [x0, x1].min.ceil.upto([x0, x1].max.floor) do |x|\n [y0, y1].min.ceil.upto([y0, y1].max.floor) do |y|\n canvas.point(x, y, color)\n end\n end\n end",
"def fill_all test \n\t\t$logger.info \"entered\"\n\n\t\t(0...ai.rows).each do |row|\n\t\t\t(0...ai.cols).each do |col|\n\t\t\t\tfill_square test, ai.map[row][col]\n\t\t\t\tFiber.yield\n\t\t\tend\n\t\tend\n\tend",
"def check_blocking_pieces(positions) # works fucking brilliantly love it and testing in pry is so fucking great fucking love your workflow\n positions.each_with_index do |move, index| # omg this is using each perfectly, because if it doesn't return inside this helper method it'll just return what was passed to it as is that's what .each is good for - either doing some random action for each enumeration or even more ideally just returning a different value if something inside is different or returning the whole thing if not fucking incredible\n piece = @board.grid[move[0]][move[1]]\n if !piece.is_a?(NullPiece) # only get the moves before the first blocking piece is found, immediately return once/if a non NullPiece is found in the path # if the current position is not a null piece, then return this with a truncated version of the array\n piece.color == self.color ? (return positions.slice(0...index)) : (return positions.slice(0..index)) # check if the piece is of the same color or not - if it is of the same color, then don't include it in possible moves, if not of the same color, include it in the possible moves since you can capture it. Normally you use @color vs self.color but in this case it does seem to be more readable and make more sense to run self.color since you already have an attr_getter for it why not. And perfect use case for a protected method if you didn't need the color anywhere else let's see :) you might not let's do it just because protected methods are so cool # GOD THIS SHIT WORKS SO FUCKING GOOD AHHHHHHH\n end\n end\nend",
"def fill_spec\n zeros = count_zeros # how many to fill\n begin\n last_zeros = zeros\n (0..8).each{|i|\n (0..8).each{|j|\n next if @board[i][j] != 0 # skip filled spaces\n choices = find_choices(i, j)\n raise \"Illegal Board #{i+1} #{j+1}\" if choices.length == 0\n @board[i][j] = choices[0] if choices.length == 1\n }\n }\n zeros = count_zeros\n # if filled some, possibly others are now fully specified\n end while ((zeros > 0) && (last_zeros > zeros))\n end",
"def check_checkmate(d_color)\n for row in 0..7\n for col in 0..7\n this_sq=self.get_square(row,col)\n\n if this_sq.occupied==true\n this_piece=this_sq.piece\n #only choosing defenders pieces\n if this_piece.color==d_color\n #getting this piece's move list\n pos_moves = this_piece.movement(row,col,self)\n\n #For every possible defending move, checking if check remains\n # return false\n unless pos_moves.empty?\n for move in pos_moves\n #creating a board to explore\n board2=DeepClone.clone self\n move_piece(board2, row, col, move[0], move[1])\n #if a move break check, return false\n if !board2.check_check(d_color)\n return false\n end\n\n end\n end\n end\n end\n end\n end\n\n return true\n end",
"def adjacent_clear(row,col)\n square = 1\n breaker = 0\n rowscols = []\n possibilities = [[row + square,col],[row,col + square],[row + square,col + square],[row - square,col],[row,col - square],[row - square,col - square],[row + square, col - square], [row - square, col + square]]\n if adjacent_mines(row,col) == 0 && row + square <= @row_count && row - square >= 0 && col + square <= @column_count && col - square >= 0\n possibilities.each do |position|\n rowscols << position\n end\n while row + square <= @row_count && row - square >= 0 && col + square <= @column_count && col - square >= 0\n square += 1\n possibilities.each do |check|\n breaker += adjacent_mines(check[0],check[1])\n end\n if breaker == 0\n possibilities.each do |check|\n rowscols << check\n end\n else\n break\n end\n possibilities = [[row + square,col],[row,col + square],[row + square,col + square],[row - square,col],[row,col - square],[row - square,col - square],[row + square, col - square], [row - square, col + square]]\n end\n end\n rowscols << [row,col]\n rowscols\n end",
"def on_filled_hole(node)\n # first node is the goal abstract value\n idx = @selection.shift + 1\n node.children[idx]\n end",
"def adjacent_mines(row, col)\n\n count = 0\n\n count += 1 if (row + 1) < row_count && grid[row+1][col].fill == 1\n count += 1 if (row - 1) >= 0 && grid[row-1][col].fill == 1\n count += 1 if (col + 1) < column_count && grid[row][col+1].fill == 1\n count += 1 if (col -1) >= 0 && grid[row][col-1].fill == 1\n count += 1 if (row + 1) < row_count && (col + 1) < column_count && grid[row+1][col+1].fill == 1\n count += 1 if (row + 1) < row_count && (col -1) >= 0 && grid[row+1][col-1].fill == 1\n count += 1 if (row - 1) >= 0 && (col + 1) < column_count && grid[row-1][col+1].fill == 1\n count += 1 if (row - 1) >= 0 && (col -1) >= 0 && grid[row-1][col-1].fill == 1\n\n return count\n end",
"def cover_starred_zeroes!()\n num = 0 \n @matrix_size.times{|c|\n if col_has_star?(c)\n cover_col!(c)\n num += 1\n end\n }\n if num >= @matrix_size\n return :done\n else\n return 4\n end\n end",
"def draw_board\n @board = stack do\n fill rgb(210,105,30)\n rect BOARD_SQUARE_POS[:board_start], BOARD_SQUARE_POS[:board_start], BLOCK_DIMENTION*CHECKERS_WIDTH , BLOCK_DIMENTION*CHECKERS_HEIGHT\n fill rgb(245,222,179)\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n rect BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*x, BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*y, BLOCK_DIMENTION,BLOCK_DIMENTION if x.even? && y.even?\n rect BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*x, BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*y, BLOCK_DIMENTION,BLOCK_DIMENTION if !x.even? && !y.even?\n end\n end\n end\nend",
"def paint(painted_map, x, y, brush_size)\n return if [x, y].max + brush_size > @size\n y.upto(y + brush_size - 1) do |yy|\n x.upto(x + brush_size - 1) do |xx|\n painted_map [yy][xx] = 1\n end\n end\n end",
"def graph\n x_start = -1 * @x_neg_offset;\n x_end = @x_pos_offset;\n y_start = -1 * @y_neg_offset;\n y_end = @y_pos_offset;\n canvas = PNG::Canvas.new(@x_pos_offset + @x_neg_offset + 1, @y_pos_offset + @y_neg_offset + 1);\n x_start.upto(x_end) do |x|\n y_start.upto(y_end) do |y|\n # 255,255,255:white 0,0,0:black\n r = g = b = x == 0 || y == 0 ? 0 : 255\n\n if y == yield(x)\n # 255,0,0:red\n r = 255\n g = 0\n b = 0\n end\n\n # This is one way to prevent this method from being called on white coordinates.\n if g != 255\n canvas[x + @x_neg_offset, y + @y_neg_offset] = PNG::Color.new(r, g, b)\n end\n end\n\n fill_empty_y(x, x_end, y_start, y_end, canvas) { |x| yield(x) }\n end\n png = PNG.new(canvas)\n png.save(@out_file)\n end",
"def background_fill\n @background_fill ||= begin\n digest = \"0.#{Digest::MD5.hexdigest(@name).to_i(16).to_s}\".to_f\n index = (digest * (@background_colors.length - 1)).round\n @background_colors[index]\n end\n end",
"def remove_filled_rows\n (0...@board_height).each do |row|\n index_range = row * @board_width...(row + 1) * @board_width\n if @board[index_range].reduce(:+) == @board_width\n @board[index_range] = Array.new(10, 0)\n end\n end\n end",
"def setup\n size 200, 200 \n no_stroke\n background 0 \n c = load_image \"cait.jpg\" \n xoff, yoff = 0, 0\n p = 2\n pix = p * 3 \n (c.width * c.height).times do |i| \n pixel = c.pixels[i] \n fill red( pixel ), 0, 0\n rect xoff, yoff, p, pix \n fill 0, green( pixel ), 0\n rect xoff+p, yoff, p, pix \n fill 0, 0, blue( pixel )\n rect xoff+p*2, yoff, p, pix \n xoff += pix\n if xoff >= (width-pix)\n xoff = 0\n yoff += pix\n end\n end \nend",
"def contains_mine?(row, col)\n grid[row][col].fill == 1\n end",
"def change_grid(x:, y:, color:)\n return if (x > max_x) || (x < 0)\n return if (y > max_y) || (y < 0)\n col = effective_color(x: x, y: y, color: color)\n grid_apply_color(x, y, col)\n end",
"def setfillcolorind(*)\n super\n end",
"def fill_paint(paint)\n end",
"def fill(cx, cy, half_width, half_height)\n surface = cy\n\n ((cx - half_width)..(cx + half_width)).each { |x|\n ((cy - half_height)..(cy + half_height)).each { |y|\n put_block(x, y, @block_map[:dirt].dup)\n }\n }\n\n put_block(0, 0, @block_map[:rock].dup)\n end",
"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 fill(color)\n @window.fill_with(color)\n end",
"def measure map, x, y \n if map[x][y] != 'land' || x >= 6 || y >= 6 #Ensures water, counted land, and coordinates\n return 0 #off the grid aren't counted.\n end\n \n size = 1\n map[x][y] = 'counted land' #Marks the starting tile as something bedsides Land. Every tile surrounding the starting tile becomes the \"new starting tile\" as the the recursion happens.\n \n size = size + measure(map, x-1, y-1) #Each of these lines is run again and again until\n size = size + measure(map, x, y-1) #a non-land square is encountered. \n size = size + measure(map, x+1, y-1) #That's the recursive part.\n size = size + measure(map, x-1, y)\n size = size + measure(map, x+1, y)\n size = size + measure(map, x-1, y+1)\n size = size + measure(map, x, y+1)\n size = size + measure(map, x+1, y+1)\n \n size\nend",
"def scan\n\t\t\t(1..MAX_Y_AXIS).each do |y|\n\t\t\t\treset_values\n\t\t\t\t(1..MAX_X_AXIS).each do |x|\n\n\t\t\t\t\timg_pixel_color = @image.pixel_color(x, y)\n\t\t\t\t\t\n\t\t\t\t\tif img_pixel_color.red <= COLOR_THRESHOLD\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t@left_eye_width = @left_eye_width + 1 if @glabella_width < 1\n\t\t\t\t\t\twrite_to_image(x, y, 'purple')\n\n\t\t\t\t\t\tif @left_eye_width >= MIN_EYE_WIDTH and @left_eye_width < MAX_EYE_WIDTH and @glabella_width > @left_eye_width and @glabella_width < (@left_eye_width * 2) and @left_eye_width >= MIN_EYE_WIDTH\n\t\t\t\t\t\t\treturn true if check_glabella(x, y)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t@glabella_width = 0\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t# we've encountered a white pixel but cannot assume that it is a glabella\n\t\t\t\t\t\t# so we do a count of white pixels across before it encounters another black pixel\n\t\t\t\t\t\t@glabella_start_x_position = x if @glabella_width == 0\n\t\t\t\t\t\t@glabella_start_y_position = y if @glabella_width == 0\n\t\t\t\t\t\t@glabella_width = @glabella_width + 1\n\t\t\t\t\t\twrite_to_image(x, y, '#eee')\n\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn false\n\t\tend",
"def dfs(i, j, visited, m, group)\n # These arrays are used to get row and\n # column numbers of 4 neighbours\n # of a given cell\n rowNbr = [-1, 0, 0, 1]\n colNbr = [ 0, -1, 1, 0]\n\n # Mark this cell as visited\n visited[i][j] = true\n group += 1\n #puts \"dfs #{i}, #{j} group:#{group}\"\n # Recurse for all connected neighbours\n 0.upto(4 - 1) do |k|\n if isSafe(i + rowNbr[k], j + colNbr[k], visited, m)\n # puts \"k:#{k} i:#{i + rowNbr[k]}, j:#{j + colNbr[k]}\"\n group = dfs(i + rowNbr[k], j + colNbr[k], visited, m, group)\n end\n end\n #puts \"RETURN:#{group}\"\n return group\nend",
"def check_win?(board)\n total_squares = board.length * board[0].length\n completed_squares = 0\n height = board.length\n width = board[0].length\n\n # Loop through each square of the board\n (0...height).each do |row|\n (0...width).each do |column|\n # Increment counter if square matches color\n completed_squares += 1 if board[row][column] == board[0][0]\n end\n end\n\n # Check if all of the squares are the same color\n if total_squares == completed_squares\n return true\n else\n return false\n end\nend",
"def fill_square test, source\n\t\tif source.done_region\n\t\t\ttargets = test.get_source_targets source\n\t\t\ttargets.each do |t|\n\t\t\t\tfill_region source, t[0], t[1]\n\t\t\tend\n\t\tend\n\tend",
"def full?(board)\n filled_tiles = 0\n board.each { |tile| tile == \"X\" || tile == \"O\" ? (filled_tiles += 1) : ()}\n filled_tiles == 9 ? (return true) : (return false)\nend",
"def fill_grid(grid)\r\n\tmax = grid.length - 1\r\n\t(1..max).each do |row|\r\n\t\t(1..max).each do |col|\r\n\t\t\tgrid[row][col] = (grid[row][col - 1]) + (grid[row -1][col])\r\n\t\tend\r\n\tend\r\nend",
"def fill_rect(*args)\n raise \"not implemented\"\n end",
"def horizontal_win(color)\n 6.times do |row|\n current_row = @board[(row*7)..(row*7+6)]\n continuous_row_count = 0\n position = 0\n while(position < current_row.length && continuous_row_count != 4) do\n if(current_row[position].style[:fill] == color)\n continuous_row_count += 1\n else\n continuous_row_count = 0\n end\n position+= 1\n end\n\n if continuous_row_count >= 4\n return true\n end\n end\n false\n end",
"def fill_row(x1, x2, y, colour)\n return if invalid?(x1,y) || invalid?(x2,y)\n x1.upto(x2) do |i|\n colour(i,y,colour)\n end\n end",
"def fill_border(loc, fill_color = GREEN, opacity = 255, thickness: 4)\n fill_color.alpha = opacity\n tl, tr, bl, br = pixel_top_left(loc[:x], loc[:y]), pixel_top_right(loc[:x], loc[:y]),\n pixel_bottom_left(loc[:x], loc[:y]), pixel_bottom_right(loc[:x], loc[:y])\n\n make_quad( tl, tr.left(thickness), tl.down(thickness),\n tr.left(thickness).down(thickness), fill_color, opacity, loc[:z] )\n\n make_quad( tr.left(thickness), tr, br.left(thickness).up(thickness),\n br.up(thickness), fill_color, opacity, loc[:z] )\n\n make_quad( bl.right(thickness).up(thickness), br.up(thickness),\n bl.right(thickness), br, fill_color, opacity, loc[:z] )\n\n make_quad( tl.down(thickness), tl.right(thickness).down(thickness),\n bl, bl.right(thickness), fill_color, opacity, loc[:z])\n end",
"def color_fill_to_border(x, y, fill)\n color_flood_fill(border_color, fill, x, y, Magick::FillToBorderMethod)\n end",
"def fill_cell(loc = {}, fill_color = BLUE, opacity = 255)\n fill_color.alpha = opacity\n tl, tr, bl, br = pixel_top_left(loc[:x], loc[:y]), pixel_top_right(loc[:x], loc[:y]),\n pixel_bottom_left(loc[:x], loc[:y]), pixel_bottom_right(loc[:x], loc[:y])\n make_quad(tl, tr.left(1), bl.up(1), br.left(1).up(1), fill_color, opacity, loc[:z])\n end",
"def bmp_circle(color = Color.new(255,255,255), r = (self.width/2), tx = (self.width/2), ty = (self.height/2), hollow = false)\n # basic circle formula\n # (x - tx)**2 + (y - ty)**2 = r**2\n for x in 0...self.width\n f = (r**2 - (x - tx)**2)\n next if f < 0\n y1 = -Math.sqrt(f).to_i + ty\n y2 = Math.sqrt(f).to_i + ty\n if hollow\n self.set_pixel(x, y1, color)\n self.set_pixel(x, y2, color)\n else\n self.fill_rect(x, y1, 1, y2 - y1, color)\n end\n end\n end",
"def circle_filled(x, y, r)\n\t\t@screen.drawAAFilledCircle x, y, r, @color_fg\n\tend",
"def clear(row, col)\n unless cell_cleared?(row,col)\n @grid[row][col].uncovered = true\n if adjacent_mines(row,col) == 0\n clear(row, col+1) if col < @column_count-1\n clear(row, col-1) if col > 0\n clear(row+1, col) if row < @row_count-1\n clear(row-1, col) if row > 0\n clear(row+1, col+1) if row < @row_count-1 && col < @column_count-1\n clear(row-1, col-1) if row > 0 && col > 0\n clear(row-1, col+1) if row > 0 && col < @column_count-1\n clear(row+1, col-1) if row < @row_count-1 && col > 0\n end\n end\n end",
"def blur_image(distance)\r\n @length = @image.length\r\n @width = 0\r\n @image.each do |x|\r\n x.each do |cell|\r\n @width += 1\r\n end\r\n end\r\n i = 0\r\n j = 0\r\n n = distance\r\n while n > 0\r\n i = 0\r\n j = 0 \r\n while i < @length\r\n j = 0\r\n while j < @width\r\n if @image[i][j] == 1\r\n\r\n # This looks down from the rows\r\n if i < @length - 1\r\n if @image[i+1][j] == 0\r\n @image[i+1][j] = 2\r\n end\r\n end\r\n\r\n # This looks up from the rows\r\n if i > 0 && @image[i-1][j] == 0\r\n @image[i-1][j] = 2 \r\n end\r\n\r\n # This looks to the right until it gets to the end.\r\n if @image[i][j+1] == 0\r\n @image[i][j+1] = 2\r\n end\r\n\r\n # This looks to te left. I tried to set this so it will never look over the side of the array.\r\n # I'm afraid of what might happen if my program does that too muc.\r\n if j > 0 && @image[i][j - 1] == 0\r\n @image[i][j - 1] = 2\r\n end\r\n end\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n # This code goes back through the array and turns the temporary shade values into 1s for output.\r\n i = 0\r\n j = 0\r\n while i < @length\r\n j = 0\r\n while j < @width\r\n if @image[i][j] == 2\r\n @image[i][j] = 1\r\n end\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n n -= 1\r\n puts n\r\n end\r\n \r\n puts \"Inside blur_image\\n\"\r\n puts \"\\n\"\r\n end",
"def fill_matrix!\n\n @max_cell = -1 # value at max_cell\n @max_cell_row = 0 # row of max_cell\n @max_cell_column = 0 # column of max_cell\n\n (1..@height-1).each do |row|\n (1..@width-1).each do |column|\n compute(row, column)\n end\n end\n\n end",
"def recur_divide(x, y, w, h, dir)\n #we first check the size of our given part of the maze\n if w >= 5 and h >= 5\n #then we set where we want to add the wall in the maze\n check_h_cut = dir == \"H_cut\"\n c = (w-1)/2\n wall_x = x + (check_h_cut ? 1 : (rand(c - 1)+1)*2)\n r = (h-1)/2\n wall_y = y + (check_h_cut ? (rand(r - 1)+1)*2 : 1)\n\n #the incrementing number for maze\n incre_x = check_h_cut ? 2 : 0\n incre_y = check_h_cut ? 0 : 2\n\n #every time we break the maze into two part, we need to leave a hole in\n #the wall so that we could enter from one part to the other\n hole_x = wall_x + (check_h_cut ? rand(c)*2 : 0)\n hole_y = wall_y + (check_h_cut ? 0 : rand(r)*2)\n wall_length = check_h_cut ? c : r\n\n #draw the wall here\n wall_length.times do\n if wall_x != hole_x || wall_y != hole_y\n maze_mat[wall_y][wall_x] = 1\n end\n wall_x += incre_x\n wall_y += incre_y\n end\n\n #recirsively divide the maze into two parts and then draw the wall the the two parts\n new_x = x\n new_y = y\n new_w = check_h_cut ? w : wall_x - x + 1\n new_h = check_h_cut ? wall_y - y + 1 : h\n recur_divide(new_x, new_y, new_w, new_h, cut_dir(new_w, new_h)) #this is the top/left part of the maze\n new_x = check_h_cut ? x : wall_x\n new_y = check_h_cut ? wall_y : y\n new_w = check_h_cut ? w : w - wall_x + x\n new_h = check_h_cut ? h - wall_y + y : h\n recur_divide(new_x, new_y, new_w, new_h, cut_dir(new_w, new_h)) #this is the bottom/right part of the maze\n end\n end",
"def generateBoard(row, col, num_mines)\n# Step 1 create board\n board = Array.new(row) { Array.new(col) {-1}}\n# Step 2 place random mines on board\n until num_mines < 1\n temp_x = rand(row)\n temp_y = rand(col)\n \n if board[temp_x][temp_y] != \"*\"\n board[temp_x][temp_y] = \"*\" \n num_mines -= 1 \n end\n end\n \n# Step 3 Iterate each tile skipping mines\n board.each_index do |x|\n board.each_index do |y|\n next if board[x][y] == \"*\"\n count = 0\n \n # Step 3a\n # check within bounds and count mines\n min_x = x - 1\n max_x = x + 1\n min_y = y - 1\n max_y = y + 1\n \n (min_x..max_x).each do |x|\n (min_y..max_y).each do |y|\n if (x >= 0 && x < row) && (y >= 0 && y < col)\n count += 1 if board[x][y] == \"*\"\n end\n end\n end\n \n board[x][y] = count\n end\n end\n \n # return board\n board\nend",
"def update_canvas()\n for x in 0...$width\n for y in 0...$height\n \n neighbor_count = count_neighbors(x, y)\n\n if $canvas[x][y] == 1\n if neighbor_count < 2 or neighbor_count > 3\n $canvas[x][y] = 0\n end\n else\n if neighbor_count == 3\n $canvas[x][y] = 1\n end\n end\n end\n end\nend",
"def generate_solution\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n until ary.count(0).zero?\n ary.each_with_index do |num, ind|\n row = calculate_area(ind + 1, :row)\n col = calculate_area(ind + 1, :col)\n box = calculate_area(ind + 1, :box)\n row_neighbours = tile_range.to_a.select {|n| calculate_area(n, :row).eql? row}\n col_neighbours = tile_range.to_a.select {|n| calculate_area(n, :col).eql? col}\n box_neighbours = tile_range.to_a.select {|n| calculate_area(n, :box).eql? box}\n neighbours = (row_neighbours + col_neighbours + box_neighbours).uniq!.map {|n| n -= 1}\n neighbouring_values = []\n neighbours.each {|n| neighbouring_values << ary[n]}\n options = (0..area_size).to_a.reject! {|x| neighbouring_values.compact.include?(x)}\n if options == []\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n break\n end\n ary[ind] = options.sample\n end\n end\n return ary.join\n end",
"def clear(row, col)\n while cell_cleared?(row, col) == false\n cleared_locations << [row, col]\n if adjacent_mines(row, col) == 0\n (-1..1).each do |i|\n (-1..1).each do |j|\n r = row + i\n c = col + j\n if r >= 0 || c >= 0 || r <= 19 || c <= 19 || (r != row && c != col)\n clear(r, c)\n end\n end\n end\n end\n end\n end",
"def full?(board) #check if the board is full\n board.each_with_index do |position, index|\n if position_taken?(board, index) == false \n return false\n end\n end\n return true\nend",
"def draw_circle_filled(cx,cy,r,color, z)\n c_color = convert_color(color)\n\n x1, y1 = 0, -r\n circ = 2 * Math::PI * r\n step = 360 / circ\n step.step(45, step) { |a|\n x2, y2 = offset_x(a, r), offset_y(a, r)\n @screen.draw_quad \\\n cx + x1, cy + y1, c_color, cx + x2, cy + y2, c_color,\n cx - x2, cy + y2, c_color, cx - x1, cy + y1, c_color, z\n @screen.draw_quad \\\n cx - x1, cy - y1, c_color, cx - x2, cy - y2, c_color,\n cx + x2, cy - y2, c_color, cx + x1, cy - y1, c_color, z\n @screen.draw_quad \\\n cx + y1, cy + x1, c_color, cx + y2, cy + x2, c_color,\n cx - y2, cy + x2, c_color, cx - y1, cy + x1, c_color, z\n @screen.draw_quad \\\n cx - y1, cy - x1, c_color, cx - y2, cy - x2, c_color,\n cx + y2, cy - x2, c_color, cx + y1, cy - x1, c_color, z\n x1, y1 = x2, y2\n }\n @screen.draw_quad \\\n cx + x1, cy + y1, c_color, cx - y1, cy - x1, c_color,\n cx + y1, cy - x1, c_color, cx - x1, cy + y1, c_color, z\n @screen.draw_quad \\\n cx - x1, cy - y1, c_color, cx + y1, cy + x1, c_color,\n cx - y1, cy + x1, c_color, cx + x1, cy - y1, c_color, z\n end",
"def draw_circle_filled(cx,cy,r,color, z)\n c_color = convert_color(color)\n\n x1, y1 = 0, -r\n circ = 2 * Math::PI * r\n step = 360 / circ\n step.step(45, step) { |a|\n x2, y2 = offset_x(a, r), offset_y(a, r)\n @screen.draw_quad \\\n cx + x1, cy + y1, c_color, cx + x2, cy + y2, c_color,\n cx - x2, cy + y2, c_color, cx - x1, cy + y1, c_color, z\n @screen.draw_quad \\\n cx - x1, cy - y1, c_color, cx - x2, cy - y2, c_color,\n cx + x2, cy - y2, c_color, cx + x1, cy - y1, c_color, z\n @screen.draw_quad \\\n cx + y1, cy + x1, c_color, cx + y2, cy + x2, c_color,\n cx - y2, cy + x2, c_color, cx - y1, cy + x1, c_color, z\n @screen.draw_quad \\\n cx - y1, cy - x1, c_color, cx - y2, cy - x2, c_color,\n cx + y2, cy - x2, c_color, cx + y1, cy - x1, c_color, z\n x1, y1 = x2, y2\n }\n @screen.draw_quad \\\n cx + x1, cy + y1, c_color, cx - y1, cy - x1, c_color,\n cx + y1, cy - x1, c_color, cx - x1, cy + y1, c_color, z\n @screen.draw_quad \\\n cx - x1, cy - y1, c_color, cx + y1, cy + x1, c_color,\n cx - y1, cy + x1, c_color, cx + x1, cy - y1, c_color, z\n end",
"def mexican_blanket_magic(colours)\n ptr = -1\n pattern = []\n colours.size.times do\n # Next 10 lines build the gradient\n 5.times { pattern[ptr += 1] = colours[0] }\n pattern[ptr+=1] = colours[1]\n\n 4.times { pattern[ptr+=1] = colours[0] }\n 2.times { pattern[ptr+=1] = colours[1] }\n\n 3.times { pattern[ptr+=1] = colours[0] }\n 3.times { pattern[ptr+=1] = colours[1] }\n\n 2.times { pattern[ptr+=1] = colours[0] }\n 4.times { pattern[ptr+=1] = colours[1] }\n\n pattern[ptr+=1] = colours[0]\n 5.times { pattern[ptr+=1] = colours[1] }\n\n # This is our black stripe which divides the gradients\n n = rand(100)\n if n <= 20 # Aprox. 20% chance of 3px wide line\n 3.times { pattern[ptr+=1] = \"black\" }\n elsif n >= 80 # Aprox. 20% chance of 7px wide line\n 7.times { pattern[ptr+=1] = \"black\" }\n end # Aprox. 60% chance of no line\n\n # Aprox. 20% chance we will get a diagonal bar\n # of random colour and size (<= 21px)\n if rand(100) < 20\n clr = colours[rand(colours.size)]\n (rand(20)+1).times { pattern[ptr+=1] = clr }\n end\n\n # Rotate through the colours in order\n cs = colours.shift\n colours.push(cs)\n end\n\n # Pad out the pattern to match image width\n ptr = -1\n while pattern.size < COLUMNS\n pattern << pattern[ptr+=1]\n end\n return pattern\nend",
"def color_valid_positions\n return if @item.nil?\n \n center_color = Color.new(83,142,250)\n outer_color = Color.new(250,40,100)\n \n cx = cy = (contents.width-@grid_square_size)/@grid_square_size/2 * @grid_square_size + 1\n sq = @grid_square_size-1\n\n points = !(t = @item.tbs_spec_range).nil? ? t[$game_temp.tb_event.dir_to_sym_era] : simple_range\n \n return if points.nil?\n \n points.each do |v|\n offset_x, offset_y = v.x * @grid_square_size, v.y * @grid_square_size\n sz = grid_side\n px,py = cx + offset_x + sq, cy + offset_y + sq\n contents.fill_rect(px-sq,py-sq,sq,sq, outer_color) if px < sz && py < sz\n end\n contents.fill_rect(cx, cy,sq,sq, center_color) # center\n end",
"def grow_unblocked_moves_in_dir(dx,dy)\n start_x, start_y = self.pos\n #start for rook white === [7,0]\n # [6,0]\n # [5,0]\n # [4,0]\n # [3,0]\n # [2,0]\n\n dx = -1 #first iteration UP\n dy = 0\n\n\n 1.step do |i|\n start_x += dx\n start_y += dy\n if self.board.rows[start_x][start_y].empty? #[6,0]\n\n end\n # create an array to collect moves\n\n # get the piece's current row and current column\n\n\n # in a loop:\n # continually increment the piece's current row and current column to \n # generate a new position\n # stop looping if the new position is invalid (not on the board); the piece \n # can't move in this direction\n # if the new position is empty, the piece can move here, so add the new \n # position to the moves array\n # if the new position is occupied with a piece of the opposite color, the \n # piece can move here (to capture the opposing piece), so add the new \n # position to the moves array\n # but, the piece cannot continue to move past this piece, so stop looping\n # if the new position is occupied with a piece of the same color, stop looping\n\n # return the final moves array\n end\n \nend",
"def colour_graoh(colors, graph)\n graph.nodes.each do |node|\n \n all_neighbouring_colors = []\n \n node.neighbours.each do |neighbour|\n all_neighbouring_colors << neighbour.color if !all_neighbouring_colors.include?(neighbour.color)\n end\n \n colors.each do |color|\n node.color = color if !all_neighbouring_colors.include?(color)\n break\n end\nend",
"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 check_next_holes(original_x, original_y)\n\t\tif @direction == 1\n\t\t\tx = original_x + 1\n\t\t\ty = original_y + 0\n\t\telsif @direction == 2\n\t\t\tx = original_x + 1\n\t\t\ty = original_y + 1\n\t\telsif @direction == 3\n\t\t\tx = original_x + 0\n\t\t\ty = original_y + 1\n\t\telsif @direction == 4\n\t\t\tx = original_x - 1\n\t\t\ty = original_y + 1\n\t\telsif @direction == 5\n\t\t\tx = original_x - 1\n\t\t\ty = original_y + 0\n\t\telsif @direction == 6\n\t\t\tx = original_x - 1\n\t\t\ty = original_y - 1\n\t\telsif @direction == 7\n\t\t\tx = original_x + 0\n\t\t\ty = original_y - 1\n\t\telsif @direction == 8\n\t\t\tx = original_x + 1\n\t\t\ty = original_y - 1\n\t\telse\n\t\t\tx = 0\n\t\tend\n\t\t\n\t\tif x > 0 && x < 8 && y > 0 && y < 7 && @game_won == false\n\t\t\tnew_key = \"#{x}-#{y}\"\n\t\t\tif @game_board[new_key].owned_by_player == @current_player\n\t\t\t\t@line_count += 1\n\t\t\t\tif @line_count == 4\n\t\t\t\t\t@game_won = true\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\treturn check_next_holes(x, y)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t@direction += 1\n\t\t\t\tif @direction > 8\n\t\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\t@line_count = 1\n\t\t\t\t\treturn check_next_holes(@x_to_check, @y_to_check)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def fill(r=0, g=0, b=0, a=1)\n case r\n when Color\n g = r.g\n b = r.b\n a = r.a\n r = r.r\n end\n CGContextSetRGBFillColor(@ctx, r, g, b, a) # RGBA\n @fill = true\n end",
"def checkmate? color\n return false unless check?(color)\n pieces = select_all_pieces_of(color)\n pieces.each do |piece|\n piece.possible_moves.each do |move|\n if movement_helper?(piece.position, move, piece.color)\n test_board = self.deep_dup\n test_board.make_move(piece.position, move)\n return false unless test_board.check?(color)\n end\n end\n end\n true\n end",
"def fill_color(color=nil)\n cur_page.fill_color(color)\n end",
"def draw_fill_rect(rect, color, _fill_type = fill_type)\n bmp = self.bitmap\n rect = Convert.Rect(rect) unless rect.is_a?(Rect) # Rect#try_cast\n return if rect.empty?\n case _fill_type\n ## default style\n when :null\n when :flat, :default\n bmp.fill_rect(rect, color)\n when :round\n bmp.round_fill_rect(rect, color)\n when :blend\n bmp.blend_fill_rect(rect, color)\n when :blend_round\n bmp.round_blend_fill_rect(rect, color)\n when :smooth, :smooth_round\n ## smooth style\n color2 = color.blend.darken(0.08) # kinda heavy\n r1 = rect.dup\n r2 = r1.contract(anchor: border_anchor, amount: border_size)\n if _fill_type == :smooth\n ## block\n bmp.blend_fill_rect(r1, color2)\n bmp.blend_fill_rect(r2, color)\n elsif _fill_type == :smooth_round\n ## rounded\n bmp.round_blend_fill_rect(r1, color2)\n bmp.round_blend_fill_rect(r2, color)\n end\n else\n raise ArgumentError, \"invalid fill_type #{_fill_type}\"\n end\n return rect\n end",
"def each_bfs (option_hash={:full_traverse=>true})\n def adjust_context context, dir\n con = context.dup\n case dir\n when 0 then con[:y] += 1\n when 1 then con[:x] += 1\n when 2 then con[:y] -= 1\n when 3 then con[:x] -= 1\n end\n return con\n end\n color_list, white_list = [], []\n full_traverse = option_hash[:full_traverse] \n yield_x_range, yield_y_range = option_hash[:yield_range]\n\n # white list contains data to yield and process each pass.\n white_list << [self, {:x=>0, :y=>0}]\n color_list << self\n\n # while we still have something to act upon process it.\n # And yield the result to our block of code.\n while !white_list.empty?\n r, context = white_list.shift()\n\n yield(r, context) if yield_x_range == nil || yield_y_range == nil || (yield_x_range === context[:x] && yield_y_range === context[:y])\n\n r.each_dir do |e| \n next if full_traverse == false && (e.flags_state.is_set(:soft_door) || e.flags_state.is_set(:closed))\n if e.towards_room.gri == nil\n e.do_delete\n next\n end\n if !color_list.include?(e.towards_room.gri)\n white_list << [e.towards_room.gri, adjust_context(context, e.direction)]\n color_list << e.towards_room.gri \n end\n end\n end\n return nil\n end",
"def fill_polygon(coordinates:, color: nil, colour: nil)\n return if coordinates.nil? || coordinates.count < 6 || (color.nil? && colour.nil?)\n\n colors = colors_to_a(color || colour)\n ext_fill_polygon(coordinates, colors)\n update_texture if @update\n end",
"def get_flat_block(x,y)\n\t\tflat = true\n\t\th = @matrix[x][y]\n\t\tn = 1\n\t\tputs \"height: #{h}\"\n\t\twhile x+n < @size\n\t\t\tputs \"\"\n\t\t\tputs \"n: #{n}\"\n\t\t\t(x..x+n).each do |i|\n\t\t\t\tputs \"\"\n\t\t\t\tputs \"i: #{i}\"\n\t\t\t\tputs \"@matrix[x+n][i]: #{x+n},#{i} #{@matrix[x+n][i]}\"\n\t\t\t\tputs \"@matrix[i][y+n]: #{i},#{y+n} #{@matrix[i][y+n]}\"\n\t\t\t\tif @matrix[x+n][i] != h || @matrix[i][y+n] != h\n\t\t\t\t\tputs \"blah @matrix[x+n][i]: #{x+n},#{i} #{@matrix[x+n][i]}\"\n\t\t\t\t\tputs \"blah @matrix[i][y+n]: #{i},#{y+n} #{@matrix[i][y+n]}\"\t\n\t\t\t\t\treturn n\n\t\t\t\tend\n\t\t\tend\n\t\t\tn+=1\n\t\t\tputs \"\"\n\t\t\tputs \"#{x+n} < #{@size}\"\n\t\tend\n\t\treturn n\n\tend"
] |
[
"0.7119922",
"0.6965181",
"0.6864852",
"0.6861658",
"0.6798411",
"0.6793343",
"0.6761053",
"0.6688027",
"0.6616791",
"0.65391827",
"0.6428579",
"0.6405382",
"0.6401684",
"0.6350412",
"0.62816596",
"0.6251833",
"0.62218",
"0.6150228",
"0.6107627",
"0.6072554",
"0.6034519",
"0.6002111",
"0.5948691",
"0.5946827",
"0.5924827",
"0.59232324",
"0.5880334",
"0.5846539",
"0.5838938",
"0.5832286",
"0.58307415",
"0.58152515",
"0.58020395",
"0.5778825",
"0.5735566",
"0.57270604",
"0.5719947",
"0.5679499",
"0.56744534",
"0.5644427",
"0.56358176",
"0.56095695",
"0.5598231",
"0.55936104",
"0.55854845",
"0.55733323",
"0.5554477",
"0.5552634",
"0.55307865",
"0.54961824",
"0.54812855",
"0.54742104",
"0.5471156",
"0.5460996",
"0.5448719",
"0.54478735",
"0.54299134",
"0.5429868",
"0.5425345",
"0.5417597",
"0.541058",
"0.53961736",
"0.5395568",
"0.5393753",
"0.53860426",
"0.5384029",
"0.5380197",
"0.53712076",
"0.536526",
"0.53455067",
"0.5341584",
"0.533165",
"0.5328609",
"0.5319867",
"0.5319559",
"0.5317334",
"0.53070825",
"0.5303725",
"0.5302835",
"0.5296369",
"0.5293961",
"0.5292343",
"0.52829176",
"0.5276422",
"0.5273439",
"0.52703345",
"0.52703345",
"0.5268573",
"0.5265993",
"0.5264392",
"0.52590114",
"0.5257577",
"0.5254113",
"0.5237325",
"0.52333206",
"0.5223764",
"0.5220918",
"0.5218321",
"0.5217145",
"0.5214716"
] |
0.7314697
|
0
|
Due Care is taken not to make all these methods global
|
def initialize( controller )
super( controller );
colorFillClass = widgetClass('HooColorFill')
li = widgetClass("HooLoremIpsumView")
simpleButton = widgetClass('HooFormButtonSimple')
toggleButton = widgetClass('HooFormButtonSimple')
@window.showGrid;
colorFillView = colorFillClass.new()
@window.contentView.addSubView( colorFillView )
liInstance = li.new()
colorFillView.addSubView( liInstance )
lambda {
@simpleButton1 = simpleButton.new( :initialState=>1 );
@simpleButton1.img = '../images/buttons/simple-button/3-state-combine.png';
@simpleButton1.size = [105,45];
@simpleButton1.labelStates = ['-- --', 'Submit', 'Pressed'];
@simpleButton1.initialState = 1;
@simpleButton1.labelColor = '#fff'
@simpleButton1.action = '/widgets/_ajaxPostTest'
#@simpleButton1.javascript = "this.hookupAction( function(){
# alert('Holy Cock');
#});";
@window.contentView.addSubView( @simpleButton1 );
}.call
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def internal; end",
"def methods() end",
"def implementation; end",
"def implementation; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def global\n raise NotImplementedError\n end",
"def global; end",
"def refutal()\n end",
"def common\n \n end",
"def private_method\n end",
"def custom; end",
"def custom; end",
"def probers; end",
"def wrapper; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def internal_methods; end",
"def who_we_are\r\n end",
"def overrides; end",
"def operations; end",
"def operations; end",
"def schubert; 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 isolated; end",
"def isolated; end",
"def public; end",
"def public; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def _all; end",
"def global?; end",
"def weber; end",
"def suivre; end",
"def external; end",
"def zuruecksetzen()\n end",
"def internal?; end",
"def functions\n\n end",
"def apis; 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 registry; end",
"def registry; end",
"def called_from; end",
"def called_from; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def public_method; end",
"def calls; end",
"def calls; end",
"def delegating_method; end",
"def globals; end",
"def globals; end",
"def methods=(_arg0); end",
"def implemented_in; end",
"def api; end",
"def api; end",
"def runnable_methods; end",
"def runnable_methods; end",
"def interface; end",
"def interface; end",
"def handle; end",
"def init\n\n end",
"def rossini; end",
"def accessibility; end",
"def how_it_works\r\n end",
"def extra; end",
"def ignore_method_conflicts; end",
"def call\n # implement in subclasses\n end",
"def pausable; end",
"def hidden_apis=(_arg0); end",
"def define; end",
"def strategy; end",
"def internship_passed; end",
"def global?; true end",
"def extended(*) end"
] |
[
"0.7921942",
"0.7226431",
"0.71834815",
"0.7179939",
"0.7179939",
"0.7140155",
"0.7140155",
"0.7140155",
"0.7140155",
"0.70414156",
"0.7016301",
"0.69167167",
"0.6815069",
"0.67985386",
"0.6795256",
"0.6795256",
"0.6730885",
"0.6673475",
"0.6604983",
"0.6604983",
"0.6604983",
"0.6598287",
"0.65439975",
"0.65152925",
"0.64941233",
"0.64941233",
"0.6476297",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6472281",
"0.6468818",
"0.6468818",
"0.6412663",
"0.6412663",
"0.63999915",
"0.63999915",
"0.63999915",
"0.63999915",
"0.6396619",
"0.638741",
"0.6387356",
"0.6364998",
"0.63376653",
"0.6318065",
"0.63161117",
"0.6312473",
"0.6306793",
"0.63043296",
"0.63043296",
"0.63043296",
"0.63043296",
"0.63043296",
"0.63043296",
"0.63043296",
"0.63043296",
"0.6297419",
"0.6297419",
"0.6255625",
"0.6255625",
"0.6241255",
"0.6241255",
"0.6241255",
"0.6241255",
"0.62062854",
"0.61990964",
"0.61990964",
"0.6157984",
"0.6139735",
"0.6139735",
"0.6137754",
"0.6118041",
"0.6113573",
"0.6113573",
"0.60849655",
"0.60849655",
"0.60800135",
"0.60800135",
"0.6075528",
"0.60666037",
"0.6064463",
"0.6063576",
"0.606197",
"0.6060083",
"0.605817",
"0.6046019",
"0.6044821",
"0.604216",
"0.60327977",
"0.60261446",
"0.6001055",
"0.5999424",
"0.5985844"
] |
0.0
|
-1
|
GET /contests/1 GET /contests/1.json
|
def show
redirect_to :controller => 'sessions', :action => 'connect' if !session[:access_token]
@contest = Contest.find(params[:id])
client = Instagram.client(:access_token => session[:access_token])
@user = client.user
pictures = client.tag_recent_media('mazeh9art')
pictures.data.each do |p|
picture = Picture.find_or_initialize_by_instagram_id(p.id)
picture.update_attributes(title: p.caption.text, url: p.images.standard_resolution.url )
end
gon.pics = pictures #Contest.first.getNextPictures()
respond_to do |format|
format.html # show.html.erb
format.json { render json: @contest }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def show\n @submissions = Contests.get_contest_submissions(params[:id])\n unless @submissions.nil?\n render json: @submissions\n return\n end\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def show\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contestant }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n respond_to do |format|\n format.html { render :layout => \"ai_contest\" }\n #format.json { render json: @ai_contest }\n end\n end",
"def index\n @contests = current_user.contests\n end",
"def get_contest\n @contest = Contest.find_by_id(params[:id])\n return if check_nil_object(@contest)\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def show\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @optin_contestant }\n end\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def show\n include_admin = @current_user.is_admin?\n @submissions_table = @contest.all_submissions_table(include_admin)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problems }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def index\n @contests = @event.contests\n end",
"def show\n @contest = Contest.find(params[:id])\n \n add_breadcrumb \"Tramanta\", :root_path\n add_breadcrumb @contest.name.capitalize, @contest\n\n @title_content = @contest.name\n \t@meta_description_content = @contest.instructions\n @og_type = 'article'\n @og_image = 'http://www.tramanta.com'+@contest.image.url(:xl)\n @og_description = @contest.name+' - '+@contest.instructions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def get_contest\n @contest = Contest.find_by_id(params[:contest_id])\n return if check_nil_object(@contest)\n end",
"def show\n #REQUIRES: existence of contest with :id\n #EFFECTS: allows rendering of one particular contest and its properties\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def status\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}\") )\n end",
"def index\n @contests = Contest.find(:all, :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def set_contest\n @contest = Contest.friendly.find(params[:id])\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n @team_challenges = TeamChallenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @team_challenges }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contest\n\t\t\t@contest = Contest.find(params[:id])\n\t\tend",
"def new\n add_breadcrumb \"nueva\", :new_contest_path\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def retrieve_attempted\n\t\trender json: @@contests_attempted_shared\n\tend",
"def index\n @contestants = Contestant.all\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def get_contestsolution\n @contestsolution = Contestsolution.find_by_id(params[:id])\n return if check_nil_object(@contestsolution)\n @contestproblem = @contestsolution.contestproblem\n @contest = @contestproblem.contest\n end",
"def get_contestproblem\n @contestproblem = Contestproblem.find_by_id(params[:id])\n return if check_nil_object(@contestproblem)\n @contest = @contestproblem.contest\n end",
"def get_contest2\n @contest = Contest.find_by_id(params[:contest_id])\n return if check_nil_object(@contest)\n end",
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def show\n @contest = Contest.find(params[:id])\n @num_probs = @contest.puzzle_ident == 3 ? 3 : 2\n if @contest.start > DateTime.now\n unless current_user.is_admin\n redirect_to contests_path, alert: \"That contest has not yet started\"\n return\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def show\n @team_challenge = TeamChallenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team_challenge }\n end\n end",
"def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end",
"def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end",
"def show\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def get_current_contest\n @contest = Contest.where(\"start_date < :today AND end_date >= :today\", {today: Date.today}).order(created_at: :desc).active.first\n if @contest.nil?\n render json: {status: \"error\", code: 404, message: \"No active contest found\" }\n end\n end",
"def index\n @contest = Contest.find_by(path: params[:contest])\n @participant = @contest.participants.find_by(path: params[:participant])\n @submits = @participant.submits\n\n @navpill\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submits }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @challenge }\n end\n end",
"def show\n\n @competitions = Competition.all\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n @participated = @contest.participants.include? @current_user\n\n current = DateTime.now\n @state = @contest.begin_date > current ? Contest::STATE_BEFORE\n : @contest.end_date > current ? Contest::STATE_CURRENT\n : Contest::STATE_AFTER\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n\n @contestant = Contestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contestant }\n end\n end",
"def index\n @contestants = Contestant.all\n\n if @contestants.count > 2\n first_id = @contestants.first.id\n last_id = @contestants.last.id\n winner = rand(first_id..last_id)\n @winner = Contestant.find(winner)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contestants }\n end\n end",
"def new\n block_non_user\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @puzzle = Puzzle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @contest] }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @title = \"View Team Challenge Score\"\n @challenge_grade = ChallengeGrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge_grade }\n end\n end",
"def get_contestproblem2\n @contestproblem = Contestproblem.find_by_id(params[:contestproblem_id])\n return if check_nil_object(@contestproblem)\n @contest = @contestproblem.contest\n end",
"def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def set_contest\n @contest = Contest.where(:is_live => true).first\n end",
"def show\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @playground }\n end\n end",
"def show\n @competition = Competition.includes(:challenges).find(params[:id])\n end",
"def show\n # Find the challenge in database to see if it exsits.\n @challenge = Challenge.find(params[:id])\n\n if @challenge\n # Restructure challenge and return as JSON.\n @challenge = restructure_challenge(@challenge)\n render json: {challenge: @challenge}\n else\n # Return JSON with error message.\n error = \"Challenge with that id does not exsits\"\n render json: {error: error}\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def new\n @ai_contest = AiContest.new\n @ai_contest.owner_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ai_contest }\n end\n end",
"def show\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end",
"def contests()\n\t\tself.as_contestants.collect{|c| c.contest }\n\tend",
"def contest_params\n params[:contest]\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n end",
"def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end",
"def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end",
"def set_contest\n @contest = Contest.find_by_slug!(params[:contest_id])\n end"
] |
[
"0.8039824",
"0.80027866",
"0.79434526",
"0.79434526",
"0.7894636",
"0.78603256",
"0.74444187",
"0.73176265",
"0.73176265",
"0.73176265",
"0.73176265",
"0.7205758",
"0.7156151",
"0.7156151",
"0.71495616",
"0.7118187",
"0.7028238",
"0.6884724",
"0.6837134",
"0.6814197",
"0.6814197",
"0.6757925",
"0.67245495",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.66942734",
"0.6684733",
"0.6683046",
"0.6676025",
"0.666305",
"0.66576815",
"0.6645285",
"0.6638757",
"0.6582603",
"0.6563115",
"0.6550674",
"0.6542214",
"0.6542039",
"0.6542039",
"0.6542039",
"0.65173924",
"0.649216",
"0.6473898",
"0.64714223",
"0.643028",
"0.6428822",
"0.6427494",
"0.6420713",
"0.6406576",
"0.6386852",
"0.63659686",
"0.63645667",
"0.63612735",
"0.63421583",
"0.6341572",
"0.6330421",
"0.6318123",
"0.63108957",
"0.6306589",
"0.6286191",
"0.6283374",
"0.6282897",
"0.62647015",
"0.6244773",
"0.62397736",
"0.6215018",
"0.62084967",
"0.6201794",
"0.6155441",
"0.6130417",
"0.6126309",
"0.6126157",
"0.61103743",
"0.6103228",
"0.6101493",
"0.6095954",
"0.60845727",
"0.60845727",
"0.60845727",
"0.60845727",
"0.6081174",
"0.60692203",
"0.60660565",
"0.60615",
"0.606092",
"0.606092",
"0.60562205",
"0.604813",
"0.6035212",
"0.6034032",
"0.6033922",
"0.6033922",
"0.6021501",
"0.60055226",
"0.60012937"
] |
0.0
|
-1
|
GET /contests/new GET /contests/new.json
|
def new
@contest = Contest.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @contest }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end",
"def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n add_breadcrumb \"nueva\", :new_contest_path\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n block_non_user\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n\n @contestant = Contestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contestant }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @optin_contestant = OptinContestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @optin_contestant }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @ai_contest = AiContest.new\n @ai_contest.owner_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ai_contest }\n end\n end",
"def create\n contest = contest_params[:contest]\n puts contest\n @contest = Contests.create(contest_params)\n respond_to do |format|\n unless @contest.nil?\n @contest[:createContest] = @contest[\"createContest\"]\n format.html { redirect_to \"/contests/view/#{@contest[:createContest]}\" }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @contest] }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @casestudy = Casestudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casestudy }\n end\n end",
"def new\n @challenge = Challenge.new\n add_breadcrumb 'new', @challenge\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end",
"def new\n @contestproblem = Contestproblem.new\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to(@contest, :notice => 'Contest was successfully created.') }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def new\n @solution = Solution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end",
"def new\n @cont = Cont.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cont }\n end\n end",
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @court }\n end\n end",
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html { render \"new\", :layout=>false}\n format.json { render json: @court }\n end\n end",
"def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end",
"def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(@contest) }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n #EFFECTS: Allows rendering of a form for inputting information to create a new contest.\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @nightclub = Nightclub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nightclub }\n end\n end",
"def create\n @game = @contest.games.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to contest_games_path, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end",
"def new\n @petition = Petition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @petition }\n end\n end",
"def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @playground = Playground.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @playground }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.json { render json: @project }\n format.html # new.html.erb\n end\n end",
"def new\n @playground = Playground.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @playground }\n end\n end",
"def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @experiment = Experiment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n kick and return if not is_god?\n @puzzle = Puzzle.new\n @other_puzzles = Puzzle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @project }\n end\n end",
"def new\n @team_challenge = TeamChallenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team_challenge }\n end\n end",
"def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end",
"def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end",
"def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end",
"def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end",
"def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end",
"def new\n @interview = Interview.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interview }\n end\n end",
"def new\n @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @tournament = Tournament.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tournament }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @game = Game.new\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end",
"def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end"
] |
[
"0.8337197",
"0.818067",
"0.8151273",
"0.7914055",
"0.76858914",
"0.753359",
"0.753359",
"0.753359",
"0.7529654",
"0.75065213",
"0.75065213",
"0.73803174",
"0.73803174",
"0.73803174",
"0.73363173",
"0.72187024",
"0.72187024",
"0.72187024",
"0.72105795",
"0.7195674",
"0.70550776",
"0.70239294",
"0.7022277",
"0.7018993",
"0.6996564",
"0.6996564",
"0.69832486",
"0.6953534",
"0.69478554",
"0.69238347",
"0.69110566",
"0.6902075",
"0.6900335",
"0.6887398",
"0.68820405",
"0.68820405",
"0.6875422",
"0.68705094",
"0.6865546",
"0.68628895",
"0.6853171",
"0.68505514",
"0.68437445",
"0.68322676",
"0.6827169",
"0.68265224",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.68140066",
"0.6812175",
"0.68078226",
"0.6800914",
"0.6800149",
"0.6799134",
"0.6799134",
"0.67820925",
"0.6781094",
"0.6780428",
"0.6778586",
"0.677832",
"0.677832",
"0.6769992",
"0.6769761",
"0.6769761",
"0.67662996",
"0.67639446",
"0.67624825",
"0.67603976",
"0.67603976",
"0.67603976",
"0.67603976",
"0.675082",
"0.6749333",
"0.6749333",
"0.6749333",
"0.6749333",
"0.67481786",
"0.6745166",
"0.6741374"
] |
0.84163564
|
0
|
POST /contests POST /contests.json
|
def create
@contest = Contest.new(params[:contest])
respond_to do |format|
if @contest.save
format.html { redirect_to @contest, notice: 'Contest was successfully created.' }
format.json { render json: @contest, status: :created, location: @contest }
else
format.html { render action: "new" }
format.json { render json: @contest.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @contest = @event.contests.build(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [@event, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: @contest }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @contest] }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to contest_path(@contest.path)+'/upload', \n notice: 'Contest was successfully created.' \n }\n #format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @contest.user_id = current_user.id\n parse_and_create_teams(params[:teams]) if params[:teams]\n \n respond_to do |format|\n if @contest.save\n create_open_post\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(contests_path) }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to(@contest, :notice => 'Contest was successfully created.') }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n contest = contest_params[:contest]\n puts contest\n @contest = Contests.create(contest_params)\n respond_to do |format|\n unless @contest.nil?\n @contest[:createContest] = @contest[\"createContest\"]\n format.html { redirect_to \"/contests/view/#{@contest[:createContest]}\" }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end",
"def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(@contest) }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n block_non_user\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n Dir::mkdir(\"task_data/contests/#{@contest.id}\")\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end",
"def create\n respond_to do |format|\n if @ai_contest.update_attributes(permitted_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully created.' }\n format.json { render json: @ai_contest, status: :created, location: @ai_contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def create\n @game = @contest.games.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to contest_games_path, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n params.require(:contest).permit(:name, :active_round, :posted, :api_key)\n end",
"def create_contest\n\t\t@contest = Contest.new(contest_params)\n\t\t# Store the name of the product for easier readability\n\t\t#binding.pry\n\t\t@contest.product_id = Product.find_by_shopify_product_id(contest_params[:product_id]).try(:name) if contest_params[:product_id].present?\n\t\t@contest.account_id = current_account.id\n\t\t@contest.order_id = 1\n\t\trespond_to do |format|\n\t\t if @contest.save\n\t\t\t# Pick a winner\n\t\t\tcandidates = Order.candidate_list(params)\n\t\t\tcontest_results = ContestResults.new(candidates)\n\t\t\t# Save the winner\n\t\t\t@contest.update_attribute(:order_id, contest_results.results)\n\t\t\tformat.html { redirect_to root_path, notice: \"Contest Winner: <a href='#{order_path(@contest.order)}'>#{@contest.order.email}</a>\" }\n\t\t\tformat.json { render action: 'show', status: :created, location: @contest }\n\t\t else\n\t\t\tformat.html { redirect_to root_path, alert: \"Unable to create a Contest\" }\n\t\t\tformat.json { render json: @contest.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\tend",
"def submit\n\t\tcontest_id = get_params[:contest_id]\n\t\tstudent_id = current_student.id\n\t\tcproblem_id = get_params[:cproblem_id]\n\t\tstatus = get_params[:status]\n\t\tCproblem.submit(contest_id, cproblem_id, student_id, status)\n\t\trender json: {}\n\tend",
"def create\n if is_admin?\n @contest = current_user.contests.build(contest_params)\n\n if @contest.save\n redirect_to contest_path(:id => @contest.id)\n else\n flash[:notice] = \"contest couldn't be created\"\n redirect_to questions_path\n end\n else\n flash[:notice] = 'not sufficient permission'\n redirect_to questions_path\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @problem_count = 4\n\n @contest.begin_date_str = params[:begin_date]\n @contest.end_date_str = params[:end_date]\n\n problems = []\n for i,p in params[:problems]\n number = p[:number]\n score = p[:score]\n\n next if number.blank? && score.blank?\n @contest.errors[:problem] << \"#{i}'s number is invalid.\" and next if number.blank?\n @contest.errors[:problem] << \"#{i}'s score is invalid.\" and next if score.blank?\n\n aoj_problem = AOJ::Problem.new(number)\n @contest.errors[:problem] << \"#{i} is invalid.\" and next unless aoj_problem.valid?\n problem = Problem.new({\n number: number.to_i,\n name: aoj_problem.name,\n score: score.to_i,\n contest: @contest,\n })\n problems << problem\n end\n @contest.problems = problems\n\n @contest.errors[:problems] << 'are required more than 0.' if problems.size==0\n\n\n unless @contest.errors.empty?\n render action: 'new' and return\n end\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_contest\n @contest = Contest.new(contest_params)\n # Store the name of the product for easier readability\n @contest.product_name = Product.find_by_shopify_product_\n id(contest_params[:product_id]).try(:name) if contest_\n params[:product_id].present?\n respond_to do |format|\n if @contest.save\n # Pick a winner\n candidates = Order.candidate_list(params)\n contest_results = ContestResults.new(candidates)\n # Save the winner\n @contest.update_attribute(:order_id,\n contest_results.results)\n format.html { redirect_to root_path, notice: \"Contest Winner: <a href='#{order_path(@contest.order)}'>#{@contest.order.email}</a>\" }\n format.json { render action: 'show', status: :created,\n location: @contest }\n else\n format.html { redirect_to root_path, alert: \"Unable to\n create a Contest\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n # TODO set case based on rights\n # all for admin\n # only vice for committee_head\n # only judge for jury_head\n # etc\n params.require(:contest).permit(:name, :starts_at, :ends_at, :regulations, :committee_head_ids, :jury_head_ids, :committee_vice_ids, jury_judge_ids: [])\n end",
"def create\n @optin_contestant = OptinContestant.new(params[:optin_contestant])\n\n respond_to do |format|\n if @optin_contestant.save\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully created.' }\n format.json { render json: @optin_contestant, status: :created, location: @optin_contestant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n params.require(:contest).permit(:name, :description)\n end",
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def new\n add_breadcrumb \"nueva\", :new_contest_path\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def create\n @book_contest = BookContest.new(book_contest_params)\n\n respond_to do |format|\n if @book_contest.save\n format.html { redirect_to @book_contest, notice: 'Book contest was successfully created.' }\n format.json { render :show, status: :created, location: @book_contest }\n else\n format.html { render :new }\n format.json { render json: @book_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n block_non_user\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def index\n @contests = @event.contests\n end",
"def show\n @submissions = Contests.get_contest_submissions(params[:id])\n unless @submissions.nil?\n render json: @submissions\n return\n end\n end",
"def contest_params\n params.require(:contest).permit(:name, :contest_type, :description, :judging_criteria, :additional_details, :start_date, :end_time, :reward, :premium, :sponsor, :status, :private, :admin_id)\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def create\n @bracketcontest = Bracketcontest.new(bracketcontest_params)\n # This next statement is due to Manager inheriting from Competition.\n @bracketcontest.competition = @manager.as_competition()\n @bracketcontest.bracketgrouping_id = @bracketgrouping.id\n\n respond_to do |format|\n if @bracketcontest.save\n\t save_contestants()\n\t flash[:notice] = 'Bracketcontest was successfully created.' \n\t format.html { redirect_to edit_bracketgrouping_bracketcontest_path(@bracketgrouping, @bracketcontest)}\n\t format.json { render :show, status: :created, location: @bracketcontest }\n\telse\n flash[:alert] = 'Unable to save new Bracket Contest. ' + @bracketcontest.errors.full_messages().join(\" \")\n format.html { render :new }\n format.json { render json: @bracketcontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n params[:contest]\n end",
"def contest_params\n\t\t\tparams.require(:contest).permit(:title, :start_time, :finish_time, :description)\n\t\tend",
"def create\n @contest = Contest.new(params.require(:contest).permit(:number, :description, :medal))\n\n if @contest.save\n flash[:success] = \"Concours ajouté.\"\n redirect_to @contest\n else\n render 'new'\n end\n end",
"def create\n @showdown = Showdown.new(showdown_params)\n if params.has_key?(:contestant)\n contestants = []\n params[:contestant].each_with_index do |contestant, index|\n if Contestant.where(name: contestant).count > 0\n contestants << Contestant.where(name: contestant).first\n else\n contestant = Contestant.create(name: contestant)\n contestant.portrait_url = JSON.parse(params[\"portrait#{index + 1}\"])[0]['url']\n if contestant.save\n contestants << contestant\n end\n end\n end\n if params.has_key?(:stats)\n params[:stats].each do |index, stat_row|\n stat = Stat.create(showdown: @showdown, description: stat_row[:description])\n ContestantStat.create(stat: stat, value: stat_row[:contestant1], contestant: contestants.first)\n ContestantStat.create(stat: stat, value: stat_row[:contestant2], contestant: contestants.last)\n end\n end\n @showdown.contestants = contestants\n end\n\n respond_to do |format|\n if @showdown.save\n format.html { redirect_to @showdown, notice: 'Showdown was successfully created.' }\n format.json { render :show, status: :created, location: @showdown }\n else\n format.html { render :new }\n format.json { render json: @showdown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n params.require(:contest).permit(:user_id, \n :league, \n :name, \n :gameset_id,\n :size, \n :starttime, \n :game_id, \n :game_ids => [], \n :games_attributes => [:id, :name,\n :entries_attributes => [:id, :user_id, :game_id, :weight, :selected_winner_id, :contest_id]\n ])\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def index\n @contests = current_user.contests\n end",
"def contest_params\n params.require(:contest).permit(:nombre, :banner, :url, :descripcion, :premio, :fechainicio, :fechafin, :administrator_id)\n end",
"def index\n @contestants = Contestant.all\n end",
"def contest_params\n params[\"params\"].require(:contest).permit(:contest_type, :battlepet_traits => [], :battlepets => [])\n end",
"def new\n\n @contestant = Contestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contestant }\n end\n end",
"def contest_params\n params.require(:contest).permit(:description_en, :description_ja,\n :end_at, :name_en, :name_ja, :score_baseline,\n :start_at, :status, :password)\n end",
"def index\n @contest = Contest.find_by(path: params[:contest])\n @participant = @contest.participants.find_by(path: params[:participant])\n @submits = @participant.submits\n\n @navpill\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submits }\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def process_contest(jasper, contest_id = nil)\n contest_id = jasper.contest_id if contest_id == nil\n dContest = nil\n contest_params = extract_contest_params_hash(jasper)\n if (contest_id)\n dContest = updateOrCreateContest(contest_id, contest_params)\n else\n dContest = Contest.create(contest_params)\n end\n if dContest\n process_scores(dContest, jasper)\n end\n dContest\nend",
"def create\n @contest_entry = ContestEntry.new(params[:contest_entry])\n\n respond_to do |format|\n if @contest_entry.save\n format.html { redirect_to new_contest_entry_path, :notice => 'Contest was successfully entered.' }\n format.xml { render :xml => @contest_entry, :status => :created, :location => @contest_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def set_contest\n\t\t\t@contest = Contest.find(params[:id])\n\t\tend",
"def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_contest\n @contest = Contest.friendly.find(params[:id])\n end",
"def create\n contestorganization = Contestorganization.create(params.require(:contestorganization).permit(:contest_id, :user_id))\n redirect_to contest_path(contestorganization.contest)\n end",
"def update\n @contest =Contest.find_by_id(params[:contest_id])\n\n if !@contest.nil?\n @contest.content = params[:contest_content]\n @contest.detail = params[:contest_detail]\n @contest.save\n\n if request.xhr?\n render :json => {\n :status => \"success\"\n }\n end\n else\n if request.xhr?\n render :json => {\n :status => \"failure\"\n }\n end\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n #MODIFIES: the database\n #EFFECTS: updates the database with information about contest with :id provided by the user\n # in the form rendered by the 'new' method\n @contest = Contest.new(params[:contest])\n \n @index =0\n \t@key_words = ['First Year', 'Second Year', 'Cramming', 'Donezo', 'Ballin',\n \t'Mr. Jefferson', 'Lawnie', 'Comm School', 'Cav Man', 'Streaking', 'Winter',\n \t'Bro', 'Incompatible', 'Too Much Facebook']\n# \n# #NEW CODE ADDED TO SCAFFOLDED METHOD\n# @is_active = 'true'\n# \t @hours = 0\n# \t @name=key_words[index]\n# \t @index++ \t \n# #END OF NEW CODE\n# \n \n respond_to do |format|\n if @contest.save\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(@contest) }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n \tend\n \t \n end",
"def destroy\r\n @contest.destroy\r\n respond_to do |format|\r\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def contest_params\n params.require(:contest).permit(:name, :starts_in)\n end",
"def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @test.done.blank?\n redirect_to root_path, warning: \"This test have not finished yet\"\n return\n end\n params[:submission] = {}\n params[:submission][:user_id] = current_user.id\n @submission = @test.submissions.create(submission_params)\n respond_to do |format|\n if @submission.save\n @test.questions.each do |question|\n question.answers.each do |answer|\n answer.answers_of_questions.create({choice: false, question_id: question.id, submission_id: @submission.id})\n end\n end\n format.html { redirect_to edit_test_submission_path(@test, @submission) }\n else\n format.html { render :new }\n end\n end\n end",
"def index\n @contests = Contest.find(:all, :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to admin_contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @gotcha = Gotcha.new(params[:gotcha])\n\n respond_to do |format|\n if @gotcha.save\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully created.' }\n format.json { render json: @gotcha, status: :created, location: @gotcha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @team_challenges = TeamChallenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @team_challenges }\n end\n end",
"def create\n @test = Test.create!(test_params)\n\n render json: @test\n end"
] |
[
"0.7152174",
"0.7103855",
"0.70241404",
"0.70208913",
"0.69897294",
"0.695391",
"0.68805426",
"0.68404317",
"0.68307537",
"0.68174773",
"0.6759615",
"0.6731611",
"0.67187345",
"0.67118084",
"0.6692199",
"0.6692199",
"0.66318876",
"0.66176033",
"0.6520299",
"0.6520299",
"0.6520299",
"0.6520299",
"0.65089417",
"0.6475509",
"0.64315784",
"0.6342171",
"0.6270461",
"0.62629926",
"0.6192201",
"0.617658",
"0.612865",
"0.6126723",
"0.611971",
"0.6110996",
"0.6110996",
"0.6096046",
"0.6089086",
"0.6088324",
"0.60711634",
"0.6058476",
"0.604821",
"0.6047567",
"0.6047527",
"0.6047527",
"0.603183",
"0.603183",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60157955",
"0.5952712",
"0.5947898",
"0.59425944",
"0.58959156",
"0.5890836",
"0.5880081",
"0.5866825",
"0.58536714",
"0.58355",
"0.58186406",
"0.5814973",
"0.5814619",
"0.58050555",
"0.5802681",
"0.5790118",
"0.5787183",
"0.5785035",
"0.5782465",
"0.57753545",
"0.57746994",
"0.57646805",
"0.57432234",
"0.5728277",
"0.5718328",
"0.5700197",
"0.5700197",
"0.5700197",
"0.5700197",
"0.56997097",
"0.5677862",
"0.5659604",
"0.5641331",
"0.56233394",
"0.56082803",
"0.5605624",
"0.5583407",
"0.5583407",
"0.5583407",
"0.55762047",
"0.5567733",
"0.5554577",
"0.55437106",
"0.554355"
] |
0.74872786
|
0
|
PUT /contests/1 PUT /contests/1.json
|
def update
@contest = Contest.find(params[:id])
respond_to do |format|
if @contest.update_attributes(params[:contest])
format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @contest.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @contest = Contest.find_by(path: params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to contest_path(@contest.path)+'/upload' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, :notice => 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @contest.update(contest_params)\r\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @contest }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @contest.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to [@event, @contest], notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @contest }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest =Contest.find_by_id(params[:contest_id])\n\n if !@contest.nil?\n @contest.content = params[:contest_content]\n @contest.detail = params[:contest_detail]\n @contest.save\n\n if request.xhr?\n render :json => {\n :status => \"success\"\n }\n end\n else\n if request.xhr?\n render :json => {\n :status => \"failure\"\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: [:admin, @contest] }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n block_non_user\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(contests_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to a_contests_url, notice: I18n.t('a.contests.notices.create') }\n format.json { head :no_content }\n else\n set_data_for_edit_form\n format.html { render action: 'edit' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to(@contest, :notice => 'Contest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ai_contest = AiContest.find(params[:id])\n\n respond_to do |format|\n if @ai_contest.update_attributes(ai_contest_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: updates the database with info about contest with \"id provided by user via 'edit.'\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @contest = Contest.find(params[:id])\n\n if not params[:contest][:category_id].nil?\n @category = Category.find(params[:contest][:category_id])\n @contest.category = @category\n end\n\n if not params[:contest][:event_id].nil?\n @event = Event.find(params[:contest][:event_id])\n @contest.event = @event\n end\n\n if not params[:contest][:judge_sheet_id].nil?\n @judge_sheet = JudgeSheet.find(params[:contest][:judge_sheet_id])\n @contest.judge_sheet = @judge_sheet\n end\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, :notice => 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n\t\t\t@contest = Contest.find(params[:id])\n\t\tend",
"def update\n @contest = Contest.find(params[:contest_id])\n\n respond_to do |format|\n if @editorial.update(editorial_params)\n format.html { redirect_to admin_contest_path(@contest), notice: 'Editorial was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_contest_path(@contest) }\n else\n format.html { render :edit }\n format.json { render json: @editorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contestID = params[:id]\n submissionID = params[:contestID]\n res = Contests.set_winner(contestID, submissionID)\n # email using mailjet\n contest = Contests.get_contest(contestID).first\n test = \"Congrats on winning the contest: #{contest[\"title\"]}, You have won $#{contest[\"price\"]}!\"\n system(\"curl -X POST --user \\\"7c80d03e683e8c7313d50629a9feafb7:434aaee16cb9e82e6ff117fc2716c2c7\\\" https://api.mailjet.com/v3/send/message -F from='kelvin.ma23@gmail.com' -F to=james.gibbons@gmail.com -F subject='Congrats on winning!' -F text='#{test}'\")\n redirect_to \"/contests/view/#{contestID}\"\n end",
"def update\n respond_to do |format|\n if @bracketcontest.update(bracketcontest_params)\n\tsave_contestants()\n\tflash[:notice] = 'Bracketcontest was successfully updated.' \n format.html { redirect_to [@bracketgrouping, @bracketcontest]}\n format.json { render :show, status: :ok, location: @bracketcontest }\n else\n format.html { render :edit }\n format.json { render json: @bracketcontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n if @optin_contestant.update_attributes(params[:optin_contestant])\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contestant.update(contestant_params)\n format.html { redirect_to @contestant, notice: 'Contestant was successfully updated.' }\n format.json { render :show, status: :ok, location: @contestant }\n else\n format.html { render :edit }\n format.json { render json: @contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contestant.update(contestant_params)\n format.html { redirect_to @contestant, notice: 'Contestant was successfully updated.' }\n format.json { render :show, status: :ok, location: @contestant }\n else\n format.html { render :edit }\n format.json { render json: @contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contest\n @contest = Contest.friendly.find(params[:id])\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_contest.update(book_contest_params)\n format.html { redirect_to @book_contest, notice: 'Book contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_contest }\n else\n format.html { render :edit }\n format.json { render json: @book_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @ai_contest.update_attributes(permitted_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully created.' }\n format.json { render json: @ai_contest, status: :created, location: @ai_contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contest\n @contest = Contest.find_by_slug!(params[:contest_id])\n end",
"def set_contest\n #@contest = Contest.find(params[:contest_id])\n if @entry\n @contest = @entry.contest\n else\n @contest= Contest.find(params[:contest_id])\n end\n end",
"def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end",
"def create\n @contest = @event.contests.build(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [@event, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: @contest }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to contest_path(@contest.path)+'/upload', \n notice: 'Contest was successfully created.' \n }\n #format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @contest] }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n if @contestant.update_attributes(params[:contestant])\n format.html { render action: 'thankyou'}#redirect_to @contestant, notice: 'Contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def update\n if @contest.update_attributes(params.require(:contest).permit(:number, :description, :medal))\n flash[:success] = \"Concours modifié.\"\n redirect_to contest_path\n else\n render 'edit'\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @challenge ||= Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team_challenge = TeamChallenge.find(params[:id])\n\n respond_to do |format|\n if @team_challenge.update_attributes(params[:team_challenge])\n format.html { redirect_to @team_challenge, :notice => 'Team challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team_challenge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end",
"def update\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n nombreImagen = SecureRandom.uuid + File.extname(contest_params[:banner].original_filename)\n carpeta = File.join(Rails.public_path, \"uploaded_images\", Time.now.strftime(\"%Y-%m-%d\"))\n rutaAbsoluta = File.join(carpeta, nombreImagen)\n FileUtils.mkdir_p(carpeta)\n File.open(rutaAbsoluta, 'wb') do |f|\n f.write(contest_params[:banner].read)\n end\n \n params[:contest][:banner] = \"/uploaded_images/\" + Time.now.strftime(\"%Y-%m-%d\") + \"/\" + nombreImagen\n params[:contest][:url] = \"http://\" + request.host + \":\" + (request.port.to_s) +\"/contests/join/\" + params[:contest][:url]\n\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @contest }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"cases/#{id}\",options)\n response.case\n end",
"def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to [@clclass,@exercise], notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: [@clclass,@exercise].errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: I18n.t('exercises.updated') }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @study_case.update(study_case_params)\n render :show, status: :ok\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end",
"def submit\n\t\tcontest_id = get_params[:contest_id]\n\t\tstudent_id = current_student.id\n\t\tcproblem_id = get_params[:cproblem_id]\n\t\tstatus = get_params[:status]\n\t\tCproblem.submit(contest_id, cproblem_id, student_id, status)\n\t\trender json: {}\n\tend",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end",
"def contest_params\n params.require(:contest).permit(:name, :active_round, :posted, :api_key)\n end",
"def update\n @story = Story.find(params[:id])\n @story.update_attributes(params[:story])\n respond_with @story\n end",
"def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def set_regularcontest\n @regularcontest = Regularcontest.find(params[:id])\n end",
"def set_contestant\n @contestant = Contestant.find(params[:id])\n end",
"def set_contestant\n @contestant = Contestant.find(params[:id])\n end",
"def set_contestant\n @contestant = Contestant.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @criterion = Criterion.find(params[:id])\n\n if @criterion.update_attributes(params[:criterion])\n head :no_content\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post = @contest.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(@post) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7452851",
"0.7452833",
"0.7441542",
"0.7191935",
"0.71750563",
"0.7164745",
"0.7117877",
"0.705355",
"0.70395637",
"0.7026145",
"0.69851846",
"0.6976812",
"0.69482785",
"0.6924179",
"0.69112897",
"0.67661893",
"0.67661893",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.67142934",
"0.6535673",
"0.6516422",
"0.6472743",
"0.6467889",
"0.6432117",
"0.6417549",
"0.6417549",
"0.6404684",
"0.63111335",
"0.63111335",
"0.63111335",
"0.6308509",
"0.6307323",
"0.62750924",
"0.6190771",
"0.61481744",
"0.6124303",
"0.6094022",
"0.6080321",
"0.6075212",
"0.6073242",
"0.6054178",
"0.6038532",
"0.60332114",
"0.599993",
"0.5993445",
"0.5993445",
"0.5993214",
"0.59878755",
"0.59876275",
"0.5983491",
"0.5961615",
"0.5939891",
"0.59193057",
"0.59136397",
"0.5906577",
"0.5906577",
"0.5906577",
"0.5906577",
"0.58962613",
"0.58943343",
"0.58936346",
"0.58936346",
"0.5892689",
"0.5863258",
"0.58622557",
"0.5859768",
"0.5853722",
"0.5832476",
"0.5828141",
"0.5824858",
"0.5815993",
"0.58106244",
"0.58035",
"0.57963014",
"0.57953817",
"0.57928",
"0.57928",
"0.5774506",
"0.5767811",
"0.57671505",
"0.5766244",
"0.5756513",
"0.57564044",
"0.57549286",
"0.57549286",
"0.57549286",
"0.5753911",
"0.57534707",
"0.5751995",
"0.57514614",
"0.57514614",
"0.57514614"
] |
0.74279934
|
4
|
DELETE /contests/1 DELETE /contests/1.json
|
def destroy
@contest = Contest.find(params[:id])
@contest.destroy
respond_to do |format|
format.html { redirect_to contests_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url, :notice => 'Contest was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n block_non_user\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to admin_contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @contest.destroy\r\n respond_to do |format|\r\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to event_contests_url(@event), notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find_by(path: params[:id])\n\n destroy_directory(@contest.path)\n destroy_problems(@contest)#with submits\n destroy_participants(@contest)\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n #format.json { head :no_content }\n end\n end",
"def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @editorial.contest\n @editorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Editorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contestant.destroy\n respond_to do |format|\n format.html { redirect_to contestants_url, notice: 'Contestant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @problem.contest\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contestant.destroy\n redirect_to root_path\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_contest.destroy\n respond_to do |format|\n format.html { redirect_to book_contests_url, notice: 'Book contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @contestorganization.contest\n @contestorganization.destroy\n redirect_to contest_path(contest)\n end",
"def destroy\n @gotcha = Gotcha.find(params[:id])\n @gotcha.destroy\n\n respond_to do |format|\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ci_experiment.destroy\n respond_to do |format|\n format.html { redirect_to ci_experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge.destroy\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge ||= Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @routine_interview = RoutineInterview.find(params[:id])\n @routine_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to routine_interviews_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exerciseoverview.destroy\n respond_to do |format|\n format.html { redirect_to exerciseoverviews_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_case_result.destroy\n respond_to do |format|\n format.html { redirect_to test_case_results_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\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 @exercice = Exercice.find(params[:id])\n @exercice.destroy\n\n respond_to do |format|\n format.html { redirect_to exercices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_challenge = TeamChallenge.find(params[:id])\n @team_challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to team_challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to clclass_exercises_path(@clclass) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_stuff.destroy\n respond_to do |format|\n format.html { redirect_to test_stuffs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_test = TeamTest.find(params[:id])\n @team_test.destroy\n\n respond_to do |format|\n format.html { redirect_to team_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: \"Exercise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to contest_games_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @case_study.destroy\n respond_to do |format|\n format.html { redirect_to :delete, flash: { message: 'Case study was successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_task.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @post = Post.find(params[:id])\n #@post = @contest.posts.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drug_test = DrugTest.find(params[:id])\n @drug_test.destroy\n\n respond_to do |format|\n format.html { redirect_to drug_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jsontest.destroy\n respond_to do |format|\n format.html { redirect_to jsontests_url, notice: 'Jsontest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end",
"def destroy\n @testimonial = Testimonial.find(params[:id])\n @testimonial.destroy\n\n respond_to do |format|\n format.html { redirect_to testimonials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_execution.destroy\n respond_to do |format|\n format.html { redirect_to exercise_executions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.80987906",
"0.80896854",
"0.7983932",
"0.79219407",
"0.7868613",
"0.7868047",
"0.78431594",
"0.7790738",
"0.77683955",
"0.77683955",
"0.77683955",
"0.77602553",
"0.76734424",
"0.76611394",
"0.75796723",
"0.7568219",
"0.74781656",
"0.7476672",
"0.73513526",
"0.7268441",
"0.7155321",
"0.71370775",
"0.70659256",
"0.7042214",
"0.697022",
"0.693286",
"0.693286",
"0.6919242",
"0.6897613",
"0.68239444",
"0.682189",
"0.68146",
"0.6804745",
"0.6795882",
"0.6792481",
"0.67920727",
"0.6784444",
"0.67834353",
"0.6782923",
"0.675645",
"0.6750939",
"0.6743145",
"0.6730391",
"0.6729766",
"0.6729411",
"0.67277694",
"0.67277694",
"0.67277694",
"0.67277694",
"0.6727354",
"0.6722641",
"0.6722641",
"0.67139775",
"0.67035896",
"0.6700461",
"0.66996664",
"0.6699662",
"0.66977143",
"0.66952604",
"0.6694699",
"0.6677491",
"0.66759896",
"0.66714215",
"0.6667993",
"0.66677463",
"0.666657",
"0.6666349",
"0.66610146",
"0.66608155",
"0.6658696",
"0.6655315",
"0.66467637",
"0.66449857",
"0.66407335",
"0.6638612",
"0.6634207",
"0.6634207",
"0.66339153",
"0.6630586",
"0.6630107",
"0.6627829",
"0.66277385",
"0.66237277",
"0.6618027",
"0.6616832",
"0.66150326",
"0.6613457",
"0.6613003",
"0.66125107",
"0.66109014",
"0.6610273",
"0.660821",
"0.66065997",
"0.66065997",
"0.66065997",
"0.6604989",
"0.6604989"
] |
0.8085642
|
4
|
swagger_controller :channels, "User Channels" swagger_api :index do summary "Retreive all channels" param :query, 'user[email]', :string, :required param :query, 'user[authentication_token]', :string, :required end swagger_api :show do summary "Retrieve the information of a channel" param :path, :id, :integer, :required param :query, 'user[email]', :string, :required param :query, 'user[authentication_token]', :string, :required end swagger_api :update do summary "Update the position of a channel" param :path, :id, :integer, :required param :body, :body, :channel, :required end swagger_api :destroy do summary "Deletes a channel or remove user from a channel" param :path, :id, :integer, :required param :path, :user_id, :integer, :optional param :form, 'user[email]', :string, :required param :form, 'user[authentication_token]', :string, :required end swagger_api :create do summary "Creates a channel or add a user to the channel" param :path, :user_id, :integer, :optional param :form, 'user[email]', :string, :required param :form, 'user[authentication_token]', :string, :required param :form, 'channel[title]', :string, :required param :form, 'channel[longitude]', :float, :required param :form, 'channel[latitude]', :float, :required end swagger_model :channel do description "The editable information of a channel" property :latitude, :float, :optional, "The latitude of a channel" property :longitude, :float, :optional, "The longitude of a channel" property :creator_id, :integer, :optional, "The id of the owner of the channel" property :user, :user_credentials, :required, "The user credentials" end swagger_model :user_credentials do description "The user login information" property :email, :string, :required, "User email" property :authentication_token, :string, :required, "User authentication_token" end
|
def index
@channels = Channel.all
render json: @channels
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def configure_swagger\n SwaggerClient::Swagger.configure do |config|\n config.api_key = 'special-key'\n config.host = 'petstore.swagger.io'\n config.base_path = '/v2'\n end\nend",
"def open_api_spec\r\n OpenAPISpecController.instance\r\n end",
"def index\n @sales_channel = SalesChannel.find(params[:sales_channel_id])\n @sales_channel_apis = @sales_channel.apis\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sales_channel_apis }\n end\n end",
"def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end",
"def channel_params\n params.require(:channel).permit(:url, :name, :user_id)\n end",
"def index\n @channels = Channel.all\n @channel = Channel.find_by_id(params[:channel_id])\n if !@channel.blank?\n @visit = Visit.where(user_id: current_user.id, visitable_id: @channel.id, visitable_type: 'Channel').first\n if !@visit.blank?\n @visit.destroy\n end\n Visit.create(user_id: current_user.id, visitable_id: @channel.id, visitable_type: 'Channel')\n @activity = Activity.create(user_id: current_user.id, activity_type: 'View', target_type: 'Channel', target_id: @channel.id)\n end\n end",
"def channel_params\n params.require(:channel).permit(:name, :description, :user_id, :privacy)\n end",
"def index\n @channels = Channel.all\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @channels }\n end\n end",
"def create\n @sales_channel = SalesChannel.find(params[:sales_channel_id])\n @sales_channel_api = SalesChannelApi.new(params[:sales_channel_api])\n @sales_channel_api.sales_channel = @sales_channel\n\n respond_to do |format|\n if @sales_channel_api.save\n format.html { redirect_to @sales_channel_api, :notice => 'Sales channel api was successfully created.' }\n format.json { render :json => @sales_channel_api, :status => :created, :location => @sales_channel_api }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sales_channel_api.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def channel_params\n params.require(:channel).permit(:channel_name, :channel_type, :workspace_id)\n end",
"def index\n @slack_channels = SlackChannel.search_and_paginate(params)\n end",
"def index\n @channels = ChannelDecorator.all\n\n respond_with @channels\n end",
"def channel_params\n params.require(:channel).permit(:name, :description, :url, :video_ids => [])\n end",
"def channel_params\n params[:channel].permit(:name, :description)\n end",
"def index\n @channels = Channel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @channels }\n end\n end",
"def channel_params\n params.require(:channel).permit(:channel_id, :channel_description, :channel_status)\n end",
"def channel_params\n params.require(:channel).permit(:ch_name,:status_id,:purpose,:workspace_id)\n end",
"def user_channel_params\n params.require(:user_channel).permit(:user_id, :channel_id)\n end",
"def api; end",
"def api; end",
"def setup_api\n #\n @api = Api.new(current_user)\n\n #\n if white_listed?(path)\n return\n end\n\n #\n token = params[:token] || request.headers['X-Api-Token'] || request.headers['X-API-TOKEN']\n\n unless token.blank?\n user = nil\n token = Token.where(:kind => 'api', :uuid => token.to_s).first\n\n if token and token.context.is_a?(User)\n user = token.context\n end\n\n if user\n @api.user = user\n else\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n email, password = http_basic_auth_info\n\n if !email.blank? and !password.blank?\n user = User.where(:email => email).first\n\n if user and user.password == password\n @api.user = user\n else\n headers['WWW-Authenticate'] = ('Basic realm=\"\"' % realm)\n render(:nothing => true, :status => :unauthorized)\n return\n end\n else\n if defined?(current_user) and current_user\n @api.user = current_user\n else\n @api.user = nil\n #headers['WWW-Authenticate'] = ('Basic realm=\"\"' % realm)\n #render(:nothing => true, :status => :unauthorized)\n #return\n end\n end\n end\n\n #\n unless @api.route?(@path) or @path == 'index'\n render :nothing => true, :status => 404\n end\n end",
"def create\n @admin_channel = Admin::Channel.new(admin_channel_params)\n @admin_channel.user_id = current_user.id\n @admin_channel.short_title = get_short_title('channel', @admin_channel.title) if @admin_channel.short_title.blank?\n\n respond_to do |format|\n if @admin_channel.save\n update_tag(@admin_channel)\n format.html { redirect_to @admin_channel, notice: '栏目添加成功.' }\n format.json { render action: 'show', status: :created, location: @admin_channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @universal_channels = UniversalChannel.all\n end",
"def index\n @channels = Channel.all\n end",
"def index\n @channels = Channel.all\n end",
"def api_endpoint\n 'index'\n end",
"def connectors_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_get ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'display_name'] = opts[:'display_name'] if opts[:'display_name']\n query_params[:'image'] = opts[:'image'] if opts[:'image']\n query_params[:'get_it_url'] = opts[:'get_it_url'] if opts[:'get_it_url']\n query_params[:'short_description'] = opts[:'short_description'] if opts[:'short_description']\n query_params[:'long_description'] = opts[:'long_description'] if opts[:'long_description']\n query_params[:'enabled'] = opts[:'enabled'] if opts[:'enabled']\n query_params[:'oauth'] = opts[:'oauth'] if opts[:'oauth']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_7')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def api_perms\n ident = :api\n text = 'API Permissions'\n desc = 'All permissions that have to do with the API.'\n options = [:true, :false, :flow]\n def_option = :flow\n\n api_global = write_permission_group(ident, text, desc, options, def_option)\n\n ActiveRecord::Base.descendants.each do |m|\n next unless m.included_modules.include?(GraphQL::QLModel)\n root = write_permission_group(hashify(m), m.to_s, 'Actions corresponding to ' + m.to_s.pluralize, options, def_option)\n\n see = write_permission_group(:see, 'Viewable Fields', 'Regulate which fields of this model a user can see.', options, def_option)\n\n m.graph_fields.each do |f|\n g = write_permission(\"View #{f}\", \"Allow the user to see #{f}.\", hashify(f), options, def_option)\n g.add_to_group(see)\n end\n\n see.add_to_group(root)\n\n find_by = write_permission_group(:query, 'Query By', 'Regulate which fields of this model a user query by.', options, def_option)\n\n m.graph_finders.each do |f|\n finder = write_permission(\"Query by #{f}\", \"Allow the user to query by #{f}.\", hashify(f), options, def_option)\n finder.add_to_group(find_by)\n end\n\n find_by.add_to_group(root)\n\n root.add_to_group(api_global)\n end\n\n mutations = write_permission_group(:mutations, 'Mutations', 'Regulate which mutations a user can perform.', options, def_option)\n\n AvicusSchema.types.each do |f|\n f.each do |a|\n next unless a.is_a?(GraphQL::ObjectType) && a.name.include?('Payload')\n mut = a.name.gsub('Payload', '')\n write_permission(\"Execute #{mut}\", \"Allow the user to execute the #{mut} mutation.\", hashify(mut), options, def_option).add_to_group(mutations)\n end\n end\n\n mutations.add_to_group(api_global)\n\n global_options = {\n text: text,\n desc: desc,\n options: options,\n def_option: def_option\n }\n\n PermissionsGenerator.new('API', true, global_options, api_global, [])\nend",
"def index\r\n @channels = current_user.channels.all\r\n end",
"def index\n # p 'in users, BookingsController'\n @conversations = Conversation.where(user_id: @user.id)\n # p @conversations\n if @conversations\n conversations_serializer = parse_json @conversations\n json_response \"Indexed user's conversations successfully\", true, {conversations: conversations_serializer}, :ok\n else\n json_response \"Cannot find conversations for user\", false, {}, :not_found\n end\n # @flat = Flat.order(created_at: :desc)\n # @flat = policy_scope(Flat).order(created_at: :desc)\n\n # authorize @cars\n end",
"def slack_channel_params\n params.require(:slack_channel).permit(:slack_channel_id, :name, :is_general, :is_archived, :is_channel, :created_date, :slack_code, :last_read, :unread_count, :slack_team_id)\n end",
"def admin_channel_params\n params.require(:admin_channel).permit(:user_id, :parent_id, :typo, :title, :short_title, :tmp_index, :tmp_list, :tmp_detail, :keywords, :description, :image_path, :content)\n end",
"def documentation_params\n params.require(:documentation).permit(:title, :description, :category)\n end",
"def index\n @channel_users = ChannelUser.all\n end",
"def index\n render jsonapi: authorized_collection, each_serializer: Connection::Serializer\n end",
"def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"def index\n @api_v1_user_device_infos = Api::V1::UserDeviceInfo.all\n end",
"def channel_params\n params.require(:channel).permit(:name)\n end",
"def initialize(*args)\n route(:get, \"/channels\", :list)\n route(:put, CHANNEL_REGEXP, :join)\n route(:delete, CHANNEL_REGEXP, :part)\n route(:post, CHANNEL_REGEXP, :message)\n super(*args)\n end",
"def apis; end",
"def channel_user_params\n params.require(:channel_user).permit(:channel_id, :user_id)\n end",
"def get_channels_index_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PublicChannelsPublicChannelsApi.get_channels_index ...\"\n end\n # resource path\n local_var_path = \"/public/channels/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'PublicChannelIndex')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PublicChannelsPublicChannelsApi#get_channels_index\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def minimal\n {\n swagger: '2.0',\n info: {\n version: '0.0.0',\n title: 'Simple API'\n }\n }\n end",
"def new\n @role = Role.find(2) \n @channels = @role.users\n @channel_info = ChannelInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel_info }\n end\n end",
"def create\n @channel = Channel.new(channel_params)\n respond_to do |format|\n if @channel.save\n format.json { render :show, status: :created, location: @channel}\n else\n format.json { render json: @channel.errors, status: :unprocessable_entity}\n end\n end\n end",
"def channel_params\r\n params.require(:channel).permit(:name)\r\n end",
"def schema_websocket_help(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SchemaApi#schema_websocket_help ...\"\n end\n \n # resource path\n path = \"/schema/websocketHelp\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SchemaApi#schema_websocket_help. Result: #{result.inspect}\"\n end\n return result\n end",
"def index\n @api_docs_services = api_docs_services.all\n respond_with(@api_docs_services)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.json { render :json => BioCatalogue::Api::Json.index(\"users\", json_api_params, @users).to_json }\n format.bljson { render :json => BioCatalogue::Api::Bljson.index(\"users\", @users).to_json }\n end\n end",
"def show\n @sales_channel_api = SalesChannelApi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sales_channel_api }\n end\n end",
"def index\n build_resource({})\n respond_with self.resource\n end",
"def index\n channel = params[:forminfo]\n @channels = Channel.all\n if channel != nil\n @forminfo = Video.new\n if channel['cid'] != nil\n @forminfo.cid = channel['cid']\n @channel = channel['cid']\n else\n @forminfo.cid = channel\n @channel = channel\n end\n else\n @channel = @channels[0].cid rescue 0\n end\n\n @videos = Video.where(:video_type => 1,:cid => @channel).order(\"id DESC\")\n if current_user != nil\n respond_to do |format|\n format.html # index.html.erb\n end\n else\n redirect_to :controller => \"users\",:action => \"sign_in\"\n end\n end",
"def create\n @universal_channel = UniversalChannel.new(universal_channel_params)\n\n respond_to do |format|\n if @universal_channel.save\n format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully created.' }\n format.json { render :show, status: :created, location: @universal_channel }\n else\n format.html { render :new }\n format.json { render json: @universal_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_only; end",
"def api_only; end",
"def api_only; end",
"def index\n self.class.load! unless self.class.loaded?\n render json: Swagger::Blocks.build_root_json([self.class])\n end",
"def channel_params\n params[:channel].permit(:querysc,:currentPosition)\n end",
"def update\n @sales_channel_api = SalesChannelApi.find(params[:id])\n\n respond_to do |format|\n if @sales_channel_api.update_attributes(params[:sales_channel_api])\n format.html { redirect_to @sales_channel_api, :notice => 'Sales channel api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sales_channel_api.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @sales_channels = SalesChannel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sales_channels }\n end\n end",
"def channel_params\n params.require(:channel).permit(:name, :purpose, member_ids: [])\n end",
"def index\n @api_hellos = Api::Hello.all\n end",
"def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n @channel.users << @user\n @channel.save\n flash[:notice] = 'Channel was successfully created.'\n format.html { redirect_to(@channel) }\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n flash[:warning] = 'Could not create channel'\n logger.debug @channel.errors.full_messages\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n # if the endpoint is the demo endpoint for checking credentials,\n # just return a straightforward success response\n if params[:endpoint] == \"demo_endpoint\"\n render json: {\"message\" => \"Success! You've made an API request with valid credentials!\"}\n else\n # If the params POSTed are not a valid combination of filters to use, i\n # the \"request\" will fail.\n request = EndpointRequest.new(@user_key, params)\n # request.failed is an error message if the filters aren't permitted for this key.\n unless request.failed\n # The 'response' will fail if there are no columns for this key for this\n # resource, or if resource name was invalid.\n response = EndpointResponse.new(@user_key, params)\n unless response.failed\n render json: JSON(response.to_hash), status: 200\n else\n # response.failed is an error message if something went wrong.\n render json: {\"message\" => response.failed }\n end\n else\n render json: {\"message\" => request.failed }\n end\n end\n end",
"def update!(**args)\n @all_authenticated_users = args[:all_authenticated_users] if args.key?(:all_authenticated_users)\n @cap_token_holder = args[:cap_token_holder] if args.key?(:cap_token_holder)\n @chat = args[:chat] if args.key?(:chat)\n @circle = args[:circle] if args.key?(:circle)\n @cloud_principal = args[:cloud_principal] if args.key?(:cloud_principal)\n @contact_group = args[:contact_group] if args.key?(:contact_group)\n @email_owner = args[:email_owner] if args.key?(:email_owner)\n @event = args[:event] if args.key?(:event)\n @gaia_group = args[:gaia_group] if args.key?(:gaia_group)\n @gaia_user = args[:gaia_user] if args.key?(:gaia_user)\n @host = args[:host] if args.key?(:host)\n @ldap_group = args[:ldap_group] if args.key?(:ldap_group)\n @ldap_user = args[:ldap_user] if args.key?(:ldap_user)\n @mdb_group = args[:mdb_group] if args.key?(:mdb_group)\n @mdb_user = args[:mdb_user] if args.key?(:mdb_user)\n @oauth_consumer = args[:oauth_consumer] if args.key?(:oauth_consumer)\n @postini_user = args[:postini_user] if args.key?(:postini_user)\n @rbac_role = args[:rbac_role] if args.key?(:rbac_role)\n @rbac_subject = args[:rbac_subject] if args.key?(:rbac_subject)\n @resource_role = args[:resource_role] if args.key?(:resource_role)\n @scope = args[:scope] if args.key?(:scope)\n @signing_key_possessor = args[:signing_key_possessor] if args.key?(:signing_key_possessor)\n @simple_secret_holder = args[:simple_secret_holder] if args.key?(:simple_secret_holder)\n @social_graph_node = args[:social_graph_node] if args.key?(:social_graph_node)\n @square = args[:square] if args.key?(:square)\n @youtube_user = args[:youtube_user] if args.key?(:youtube_user)\n @zwieback_session = args[:zwieback_session] if args.key?(:zwieback_session)\n end",
"def update!(**args)\n @all_authenticated_users = args[:all_authenticated_users] if args.key?(:all_authenticated_users)\n @cap_token_holder = args[:cap_token_holder] if args.key?(:cap_token_holder)\n @chat = args[:chat] if args.key?(:chat)\n @circle = args[:circle] if args.key?(:circle)\n @cloud_principal = args[:cloud_principal] if args.key?(:cloud_principal)\n @contact_group = args[:contact_group] if args.key?(:contact_group)\n @email_owner = args[:email_owner] if args.key?(:email_owner)\n @event = args[:event] if args.key?(:event)\n @gaia_group = args[:gaia_group] if args.key?(:gaia_group)\n @gaia_user = args[:gaia_user] if args.key?(:gaia_user)\n @host = args[:host] if args.key?(:host)\n @ldap_group = args[:ldap_group] if args.key?(:ldap_group)\n @ldap_user = args[:ldap_user] if args.key?(:ldap_user)\n @mdb_group = args[:mdb_group] if args.key?(:mdb_group)\n @mdb_user = args[:mdb_user] if args.key?(:mdb_user)\n @oauth_consumer = args[:oauth_consumer] if args.key?(:oauth_consumer)\n @postini_user = args[:postini_user] if args.key?(:postini_user)\n @rbac_role = args[:rbac_role] if args.key?(:rbac_role)\n @rbac_subject = args[:rbac_subject] if args.key?(:rbac_subject)\n @resource_role = args[:resource_role] if args.key?(:resource_role)\n @scope = args[:scope] if args.key?(:scope)\n @signing_key_possessor = args[:signing_key_possessor] if args.key?(:signing_key_possessor)\n @simple_secret_holder = args[:simple_secret_holder] if args.key?(:simple_secret_holder)\n @social_graph_node = args[:social_graph_node] if args.key?(:social_graph_node)\n @square = args[:square] if args.key?(:square)\n @youtube_user = args[:youtube_user] if args.key?(:youtube_user)\n @zwieback_session = args[:zwieback_session] if args.key?(:zwieback_session)\n end",
"def channels_list\n get \"channels\"\n end",
"def index\n @page_num = 0\n if params[:page_num]\n @page_num = params[:page_num]\n end\n page_size = 5\n @total_page = ((ChannelClass.all.count(:id).to_i - 1)/page_size )+1\n @channels = ChannelClass.all.order(\"updated_at desc\").limit(page_size).offset(@page_num.to_i * page_size.to_i)\n \n Rails.logger.info \"-----------------------page_num=#{@page_num}--------------------------------------\"\n Rails.logger.info \"-----------------------total_page=#{@total_page}--------------------------------------\"\n \n #fresh_when(etag: [@channels])\n render 'index', :layout => 'admin'\n end",
"def channel_params\n params.require(:channel).permit(:name, :description, :p_type, :g_type, :i_type ,:avatar, :crop_x, :crop_y, :crop_w, :crop_h, :caller)\n end",
"def update\n #only user can modify \n unless current_user.has_role?(:admin) || current_user.has_role?(:user)\n redirect_to admin_channels_path, alert: \"没有权限\"\n return\n end\n\n admin_channel_params[:user_id] = current_user.id\n\n respond_to do |format|\n if @admin_channel.update(admin_channel_params)\n update_tag(@admin_channel)\n if @admin_channel.short_title.blank?\n @admin_channel.short_title = get_short_title('channel', @admin_channel.title)\n @admin_channel.save!\n end\n\n format.html { redirect_to @admin_channel, notice: '栏目更新成功.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize\n @swagger = '2.0'\n @base_path = '/'\n @cleanning = true\n @compress = false\n @sort = 'tag'\n end",
"def index\n @collaborators = @schema.user_schemas.map do |user_schema|\n {\n id: user_schema.user.id,\n username: user_schema.user.username,\n email: user_schema.user.email,\n image: user_schema.user.image,\n access_mode: user_schema.access_mode_integer\n }\n end\n end",
"def create\n @channel_user = ChannelUser.new(channel_user_params)\n\n respond_to do |format|\n if @channel_user.save\n format.html { redirect_to @channel_user, notice: 'Channel user was successfully created.' }\n format.json { render :show, status: :created, location: @channel_user }\n else\n format.html { render :new }\n format.json { render json: @channel_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(channel_params)\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(channel_params)\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api\n @api\n end",
"def channel_params\n params.permit(:max_age, :min_age, :channel_url, tags: [])\n end",
"def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render json: @channel, status: :created, location: @channel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @category_of_playlists_channels = current_user_category_of_playlists\n end",
"def update\n respond_to do |format|\n if @universal_channel.update(universal_channel_params)\n format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @universal_channel }\n else\n format.html { render :edit }\n format.json { render json: @universal_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_params\n if params[:user][:password] == \"\" or params[:user][:password_confirmation] == \"\"\n if can? :manage, User\n params.require(:user).permit(:email, :role, user_channels_attributes: [:id, :channel_id, :role, :success, :error])\n else \n params.require(:user).permit(:email, user_channels_attributes: [:id, :channel_id, :success, :error])\n end\n else\n if can? :manage, User\n params.require(:user).permit(:email, :role, :password, :password_confirmation, user_channels_attributes: [:id, :channel_id, :role, :success, :error])\n else\n params.require(:user).permit(:email, :password, :password_confirmation, user_channels_attributes: [:id, :channel_id, :success, :error])\n end \n end\n end",
"def index\n @youtubechannels = Youtubechannel.all\n end",
"def index\n @user_device_configurations = UserDeviceConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_device_configurations }\n end\n end",
"def update\n respond_to do |format|\n if @channel.update(channel_params)\n format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @channel }\n else\n format.html { render :edit }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @channel.update(channel_params)\n format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }\n format.json { render :show, status: :ok, location: @channel }\n else\n format.html { render :edit }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @api_v1_concerns = Api::V1::Concern.all\n end",
"def crud\n # TODO: The `Array` below has the four letters that make up the `CRUD`\n # acronym. Update each element of the array so that you write out the\n # four verbs that describe the CRUD actions.\n\n ['C', 'R', 'U', 'D']\nend",
"def create_default_channels\n private_chan = Channel.new\n private_chan.user_id = self.id\n private_chan.title = \"Private Videos\"\n private_chan.private = true\n private_chan.save\n \n public_chan = Channel.new\n public_chan.user_id = self.id\n public_chan.title = \"Public Videos\"\n public_chan.save\n \n featured_chan = Channel.new\n featured_chan.user_id = self.id\n featured_chan.title = \"Featured Videos\"\n featured_chan.featured = true\n featured_chan.save\n end",
"def APICall params = {}\n \n path = params[:path]\n method = params[:method] || 'GET'\n payload = params[:payload] || nil\n \n params.delete(:method)\n params.delete(:path)\n params.delete(:payload)\n \n a = Time.now.to_f\n \n http = Net::HTTP.new(@infra[:domain]+'.zendesk.com',443)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true\n \n uri = %{#{@infra[:path]}#{path}}\n uri << '?'+params.map{ |key,val| \"#{key}=#{val}\" }.join('&') if params && params.count > 0\n uri = URI.escape uri\n \n reqs = {\n 'GET' => Net::HTTP::Get.new(uri),\n 'POST' => Net::HTTP::Post.new(uri),\n 'PUT' => Net::HTTP::Put.new(uri),\n 'DELETE' => Net::HTTP::Delete.new(uri)\n }\n req = reqs[method]\n \n content_type = 'application/json'\n content_type = 'application/binary' if path.include? 'uploads'\n req.content_type = content_type\n \n req.basic_auth @username,@infra[:authentication]\n \n req.body = payload if method == 'POST' || method == 'PUT'\n \n response = http.request req\n \n code = response.code.to_f.round\n body = response.body\n \n b = Time.now.to_f\n c = ((b-a)*100).round.to_f/100\n \n final = {code: code.to_i,body: nil}\n final = final.merge(body: JSON.parse(body)) if method != 'DELETE' && code != 500\n final = final.merge(time: c)\n \n @api += 1\n \n final\n \n end",
"def list_user_communication_channels(user_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"user_id is required\" if user_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :user_id => user_id\n )\n\n # resource path\n path = path_replace(\"/v1/users/{user_id}/communication_channels\",\n :user_id => user_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response.map {|response|CommunicationChannel.new(response)}\n end",
"def new\n @channel = Channel.new\n\n respond_with @channel\n end",
"def list_resources\n 'channels'\n end",
"def create\n @channel = Channel.new(params[:channel])\n @channel.user = current_user\n flash[:notice] = t('controllers.channels.channel_was_successfully_created') if @channel.save\n\n respond_with @channel\n end",
"def index\n @channels = Channel.where(:user_id => current_user.id).to_a\n end",
"def channels(params = {page:1})\n http.get('/channels', params)\n end",
"def api_hello_params\n params.require(:api_hello).permit(:name)\n end",
"def destroy\n @sales_channel_api = SalesChannelApi.find(params[:id])\n @sales_channel_api.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_channel_apis_url }\n format.json { head :no_content }\n end\n end",
"def api_config_params\n params.require(:api_config).permit(:username, :password, :security_token, :client_id, :client_secret)\n end",
"def create\n @slack_channel = SlackChannel.new(slack_channel_params)\n\n respond_to do |format|\n if @slack_channel.save\n format.html { redirect_to @slack_channel, notice: 'Slack channel was successfully created.' }\n format.json { render :show, status: :created, location: @slack_channel }\n else\n format.html { render :new }\n format.json { render json: @slack_channel.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.63487923",
"0.5909661",
"0.5733724",
"0.57287383",
"0.5578284",
"0.5572897",
"0.5501468",
"0.5500546",
"0.55002093",
"0.5499937",
"0.5483446",
"0.54654956",
"0.54368263",
"0.5435152",
"0.54279554",
"0.54052234",
"0.5387846",
"0.53864014",
"0.5370787",
"0.53571904",
"0.53571904",
"0.5353812",
"0.5329999",
"0.5329547",
"0.5326533",
"0.5326533",
"0.5322541",
"0.53159124",
"0.5305631",
"0.5302191",
"0.5231174",
"0.52310044",
"0.5228125",
"0.5221592",
"0.52063197",
"0.5197838",
"0.5196573",
"0.5193549",
"0.51901644",
"0.5176903",
"0.5176027",
"0.5173289",
"0.5172961",
"0.5169425",
"0.51667184",
"0.51608235",
"0.5154068",
"0.51487285",
"0.51336485",
"0.51100165",
"0.50988686",
"0.5089024",
"0.5084111",
"0.50802076",
"0.50649095",
"0.50649095",
"0.50649095",
"0.5061842",
"0.5059192",
"0.5057628",
"0.5049072",
"0.5039837",
"0.50356364",
"0.50334233",
"0.5033193",
"0.5031744",
"0.5031744",
"0.50278",
"0.502649",
"0.50247204",
"0.5020373",
"0.50143117",
"0.50064796",
"0.49820387",
"0.49771592",
"0.49771592",
"0.49595326",
"0.49561164",
"0.49549076",
"0.49468362",
"0.4940498",
"0.49203032",
"0.4913127",
"0.49111372",
"0.4901797",
"0.4901797",
"0.4901542",
"0.4895308",
"0.48944795",
"0.48918325",
"0.48886865",
"0.4880065",
"0.48789525",
"0.48786175",
"0.48744026",
"0.4868954",
"0.4868793",
"0.48677766",
"0.48580384",
"0.48576722"
] |
0.49544272
|
79
|
GET /vanos/1 GET /vanos/1.json
|
def show
@vano = Vano.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @vano }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @vanos = Vano.all\n end",
"def show\n @volantino = Volantino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volantino }\n end\n end",
"def show\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vodka }\n end\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def show\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbo }\n end\n end",
"def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voprosy }\n end\n end",
"def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"def show\n @vocalium = Vocalium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vocalium }\n end\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n render json: @vat\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @vnic = Vnic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vnic }\n end\n end",
"def show\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def show\n @verbindung = Verbindung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbindung }\n end\n end",
"def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @livro }\n end\n end",
"def show\n @pinglun = Pinglun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinglun }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end",
"def show\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noto }\n end\n end",
"def show\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pago }\n end\n end",
"def show\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plannegocio }\n end\n end",
"def get_aos_version_by_name(args = {}) \n get(\"/aosversions.json/version/#{args[:aosVersionName]}\", args)\nend",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def show\n @po = Po.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @po }\n end\n end",
"def show\n @tramo = Tramo.find(params[:id])\n @proyecto_id = params[:proyecto_id]\n @vanos = @tramo.vanos\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tramo }\n end\n end",
"def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"def show\n render json: @api_v1_todo\n end",
"def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"def show\n @pologeno = Pologeno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pologeno }\n end\n end",
"def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end",
"def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vano }\n end\n end",
"def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end",
"def new\n @vano = Vano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vano }\n end\n end",
"def show\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aviso }\n end\n end",
"def index\n @vistos = Visto.all\n end",
"def show\n @api_version = ApiVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_version }\n end\n end",
"def show\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \t\t\trender json: @usuario.pedidos.find(@pedido.id)\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \t\t\trender json: @negocio.pedidos.find(@pedido.id)\n \t\tend\n \tend",
"def show\n @cliente = Cliente.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def index\n @viajes = Viaje.all\n end",
"def show\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientepedido }\n end\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def show\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneo }\n end\n end",
"def show\n @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuario_id: @venta.usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end",
"def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end",
"def show\n @v1_order = V1::Order.find(params[:id])\n\n if @v1_order.nil?\n render json: @v1_order, message: 'Resource not found', status: 404\n else\n render json: @v1_order, message: 'OK', status: 200\n end\n end",
"def show\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monnaie }\n end\n end",
"def show\n @vampire = Vampire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vampire }\n end\n end",
"def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def index\n #@verses = Verse.all\n @verses = Verse.paginate(page: params[:page]) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verses }\n end\n end",
"def show\n @version = Version.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end",
"def show\n @tv = Tv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv }\n end\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def show\n @admin_version = Admin::Version.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_version }\n end\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def show\n render json: @verb\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def index\n @api_versions = ApiVersion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_versions }\n end\n end",
"def show\n @ovos = Ovo.where(galinha_id: @galinha.galinha_id)\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\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 show\n @viaje = Viaje.find(params[:id])\n @sitio = Site.find(@viaje.site_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @viaje }\n end\n end",
"def show\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ano }\n end\n end",
"def show\n @pedido = Pedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pedido }\n end\n end",
"def show\n @voivodeship = Voivodeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voivodeship }\n end\n end",
"def show\n @kazoku = Kazoku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kazoku }\n end\n end",
"def show\n @trnodo = Trnodo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end"
] |
[
"0.6829573",
"0.6780538",
"0.671385",
"0.67125195",
"0.6626964",
"0.66235274",
"0.6606887",
"0.66032594",
"0.65865487",
"0.6581894",
"0.6528772",
"0.6516062",
"0.6447883",
"0.64475924",
"0.6440455",
"0.64249116",
"0.64249116",
"0.64249116",
"0.642256",
"0.6390795",
"0.638326",
"0.63730824",
"0.6360079",
"0.6351273",
"0.6347671",
"0.63358724",
"0.63315505",
"0.63315505",
"0.62830794",
"0.62826097",
"0.6266487",
"0.6253586",
"0.6248119",
"0.6230128",
"0.62192446",
"0.62016356",
"0.6197999",
"0.618283",
"0.6181535",
"0.61752427",
"0.61752427",
"0.61752427",
"0.6169253",
"0.61652076",
"0.6163666",
"0.6162908",
"0.6159876",
"0.6159615",
"0.6158613",
"0.6157896",
"0.61527115",
"0.61497414",
"0.6139349",
"0.61361074",
"0.6129013",
"0.6116708",
"0.61145175",
"0.611315",
"0.6111832",
"0.6109874",
"0.6104619",
"0.6103222",
"0.61010355",
"0.6097766",
"0.60946697",
"0.6093438",
"0.60920143",
"0.60842717",
"0.6083106",
"0.6073225",
"0.60723203",
"0.6067571",
"0.60673904",
"0.60661805",
"0.6063751",
"0.6060997",
"0.6056686",
"0.6051442",
"0.6048585",
"0.6036665",
"0.60351044",
"0.6033597",
"0.60323393",
"0.60322356",
"0.6030723",
"0.6029264",
"0.60254747",
"0.6021237",
"0.6010084",
"0.6008903",
"0.60084665",
"0.60062355",
"0.60024107",
"0.59999967",
"0.5994389",
"0.5993818",
"0.5992818",
"0.59892166",
"0.5987093",
"0.5983632"
] |
0.7074363
|
0
|
GET /vanos/new GET /vanos/new.json
|
def new
@vano = Vano.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @vano }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @volantino = Volantino.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @volantino }\n end\n end",
"def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end",
"def new\n @vodka = Vodka.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vodka }\n end\n end",
"def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end",
"def new\n @vocacionada = Vocacionada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vocacionada }\n end\n end",
"def new\n @verbo = Verbo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verbo }\n end\n end",
"def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end",
"def new\n @trnodo = Trnodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def new\n @torneo = Torneo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torneo }\n end\n end",
"def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @viaje = Viaje.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @viaje }\n end\n end",
"def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def new\n @pologeno = Pologeno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pologeno }\n end\n end",
"def new\n @vet = Vet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vet }\n end\n end",
"def new\n @verse = Verse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verse }\n end\n end",
"def new\n @verse = Verse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verse }\n end\n end",
"def new\n @verse = Verse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verse }\n end\n end",
"def new\n @verbindung = Verbindung.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verbindung }\n end\n end",
"def new\n @torso = Torso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torso }\n end\n end",
"def new\n @pedido = Pedido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pedido }\n end\n end",
"def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @livro = Livro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @livro }\n end\n end",
"def new\n authorize! :manage, LopMonHocSinhVien\n @lop_mon_hoc_sinh_vien = @lop_mon_hoc.lop_mon_hoc_sinh_viens.build\n respond_to do |format|\n format.html { render :layout => (request.headers['X-PJAX'] ? false : true)}\n format.json { render json: @lop_mon_hoc_sinh_vien }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end",
"def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end",
"def new\n @plannegocio = Plannegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plannegocio }\n end\n end",
"def new\n @presenza = Presenza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presenza }\n end\n end",
"def new\n @posto = Posto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posto }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recurso }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end",
"def new\n @venta = Venta.new(:fecha => Date.today, confirmada: true)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venta }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @safra_verdoso = SafraVerdoso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def new\n @ovode = Ovode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ovode }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv }\n end\n end",
"def new\n @ventas_presupuesto = Ventas::Presupuesto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end",
"def new\n @monnaie = Monnaie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monnaie }\n end\n end",
"def new\n @przedmiot = Przedmiot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @przedmiot }\n end\n end",
"def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end",
"def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end",
"def new\n @voprosy = Voprosy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voprosy }\n end\n end",
"def new\n @ano = Ano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ano }\n end\n end",
"def new\n @tenni = Tenni.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenni }\n end\n end",
"def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def new\n @sotrudniki = Sotrudniki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sotrudniki }\n end\n end",
"def new\n @producto = Producto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @producto }\n end\n end",
"def new\n @tipo_vehiculo = TipoVehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def new\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aviso }\n end\n end",
"def new\n @nave = Nave.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nave }\n end\n end",
"def new\n @seguidore = Seguidore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def new\n @asociado = Asociado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asociado }\n end\n end",
"def new\n @cliente = Cliente.new\n localidad_new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"def new\n @ongoing = Ongoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ongoing }\n end\n end",
"def new\n @archivo = Archivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @archivo }\n end\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @socio }\n end\n end",
"def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def new\n @obj = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obj }\n end\n end",
"def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produto }\n end\n end",
"def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end",
"def new\n @dato = Dato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dato }\n end\n end",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def new\n @pun = Pun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pun }\n end\n end",
"def new\n @recinto = Recinto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recinto }\n end\n end",
"def new\n @orgao = Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgao }\n end\n end",
"def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def new\n @vnic = Vnic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vnic }\n end\n end",
"def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @socio }\n end\n end",
"def new\n @unp = Unp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unp }\n end\n end",
"def new\n @pony = Pony.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pony }\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 @propuesta = Propuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @propuesta }\n end\n end",
"def new\n @vegetable = Vegetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end",
"def new\n @kazoku = Kazoku.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @kazoku }\n end\n end",
"def new\n @reltramovano = Reltramovano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reltramovano }\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def new\n @goody = Goody.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goody }\n end\n end"
] |
[
"0.74409693",
"0.73978406",
"0.7373073",
"0.73017687",
"0.7276522",
"0.72739065",
"0.7255778",
"0.72509056",
"0.7245187",
"0.7237352",
"0.7231472",
"0.7224756",
"0.7209617",
"0.71968424",
"0.7194532",
"0.7192254",
"0.71458995",
"0.71458995",
"0.71458995",
"0.7123853",
"0.7121329",
"0.71207726",
"0.7116253",
"0.7112968",
"0.7109963",
"0.7104945",
"0.7091887",
"0.7083691",
"0.7083691",
"0.70819134",
"0.70799065",
"0.70754695",
"0.70721835",
"0.7069454",
"0.70608336",
"0.70477146",
"0.7044872",
"0.70442855",
"0.7039077",
"0.7039077",
"0.7037752",
"0.7031426",
"0.7023569",
"0.7023569",
"0.7023569",
"0.7023569",
"0.7023569",
"0.7023549",
"0.7013637",
"0.70066905",
"0.70057136",
"0.70048743",
"0.7000061",
"0.699065",
"0.6989082",
"0.69873816",
"0.69802606",
"0.6979639",
"0.69793314",
"0.6976724",
"0.69766605",
"0.69745016",
"0.6971868",
"0.6961217",
"0.69609386",
"0.6960546",
"0.69564855",
"0.69534636",
"0.6945706",
"0.69413644",
"0.69372183",
"0.69323474",
"0.6932199",
"0.6931095",
"0.69276285",
"0.69276285",
"0.69276285",
"0.69276285",
"0.69276285",
"0.6927493",
"0.69235116",
"0.69193095",
"0.69147813",
"0.69124955",
"0.69120073",
"0.69113386",
"0.69113386",
"0.69045323",
"0.6898951",
"0.68885756",
"0.6884562",
"0.6882779",
"0.6881249",
"0.68804467",
"0.68749195",
"0.68716043",
"0.6869352",
"0.6868115",
"0.68656546",
"0.6860569"
] |
0.75199854
|
0
|
POST /vanos POST /vanos.json
|
def create
@vano = Vano.new(params[:vano])
respond_to do |format|
if @vano.save
format.html { redirect_to @vano, notice: 'Vano was successfully created.' }
format.json { render json: @vano, status: :created, location: @vano }
else
format.html { render action: "new" }
format.json { render json: @vano.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @vano = Vano.new(vano_params)\n\n respond_to do |format|\n if @vano.save\n format.html { redirect_to @vano, notice: 'Vano was successfully created.' }\n format.json { render :show, status: :created, location: @vano }\n else\n format.html { render :new }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @vodka = Vodka.new(params[:vodka])\n\n respond_to do |format|\n if @vodka.save\n format.html { redirect_to @vodka, notice: 'Vodka was successfully created.' }\n format.json { render json: @vodka, status: :created, location: @vodka }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vodka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @visto = Visto.new(visto_params)\n\n\n respond_to do |format|\n if @visto.save\n format.html { redirect_to @visto, notice: 'Visto was successfully created.' }\n format.json { render :show, status: :created, location: @visto }\n else\n format.html { render :new }\n format.json { render json: @visto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend",
"def create\n @vongdau = Vongdau.new(vongdau_params)\n\n respond_to do |format|\n if @vongdau.save\n format.html { redirect_to @vongdau, notice: 'Vongdau was successfully created.' }\n format.json { render :show, status: :created, location: @vongdau }\n else\n format.html { render :new }\n format.json { render json: @vongdau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @videoo = Videoo.new(videoo_params)\n\n respond_to do |format|\n if @videoo.save\n format.html { redirect_to @videoo, notice: 'Videoo was successfully created.' }\n format.json { render :show, status: :created, location: @videoo }\n else\n format.html { render :new }\n format.json { render json: @videoo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @volantino = Volantino.new(params[:volantino])\n\n respond_to do |format|\n if @volantino.save\n format.html { redirect_to @volantino, notice: 'Volantino was successfully created.' }\n format.json { render json: @volantino, status: :created, location: @volantino }\n else\n format.html { render action: \"new\" }\n format.json { render json: @volantino.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venta = Venta.new(params[:venta])\n\n respond_to do |format|\n if @venta.save\n format.html { redirect_to @venta, notice: 'Venta was successfully created.' }\n format.json { render json: @venta, status: :created, location: @venta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vano = Vano.new(params[:vano])\n\n respond_to do |format|\n if @vano.save\n format.html { redirect_to(@vano, :notice => 'Vano was successfully created.') }\n format.xml { render :xml => @vano, :status => :created, :location => @vano }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vano.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @uva = Uva.new(uva_params)\n\n respond_to do |format|\n if @uva.save\n format.html { redirect_to @uva, notice: 'Uva was successfully created.' }\n format.json { render :show, status: :created, location: @uva }\n else\n format.html { render :new }\n format.json { render json: @uva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ventas_presupuesto = Ventas::Presupuesto.new(params[:ventas_presupuesto])\n @ventas_presupuesto.vendedor = current_user.id\n\n respond_to do |format|\n if @ventas_presupuesto.save\n format.html { redirect_to @ventas_presupuesto, notice: 'Presupuesto was successfully created.' }\n format.json { render json: @ventas_presupuesto, status: :created, location: @ventas_presupuesto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ventas_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Revista.new(revista_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Revista was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @viaje = Viaje.new(viaje_params)\n\n respond_to do |format|\n if @viaje.save\n format.html { redirect_to @viaje, notice: 'Viaje was successfully created.' }\n format.json { render :show, status: :created, location: @viaje }\n else\n format.html { render :new }\n format.json { render json: @viaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @unova = Unova.new(unova_params)\n\n respond_to do |format|\n if @unova.save\n format.html { redirect_to @unova, notice: 'Unova was successfully created.' }\n format.json { render :show, status: :created, location: @unova }\n else\n format.html { render :new }\n format.json { render json: @unova.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @onsen = Onsen.new(onsen_params)\n\n respond_to do |format|\n if @onsen.save\n format.html { redirect_to @onsen, notice: 'Onsen was successfully created.' }\n format.json { render :show, status: :created, location: @onsen }\n else\n format.html { render :new }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venta = Venta.new(venta_params)\n\n respond_to do |format|\n if @venta.save\n format.html { redirect_to @venta, notice: 'Venta was successfully created.' }\n format.json { render :show, status: :created, location: @venta }\n else\n format.html { render :new }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @veiculo_motorista = VeiculoMotorista.new(veiculo_motorista_params)\n\n respond_to do |format|\n if @veiculo_motorista.save\n format.html { redirect_to @veiculo_motorista, notice: 'Veiculo motorista was successfully created.' }\n format.json { render :show, status: :created, location: @veiculo_motorista }\n else\n format.html { render :new }\n format.json { render json: @veiculo_motorista.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Crear nuevo voto\n @voto = Voto.new(params[:voto])\n\n # Asociarlo con el usuario\n @voto.usuario_id = current_usuario.id\n\n # Asociarlo con la Pregunta o Respuesta\n votable_type = params[:voto][:votable_type]\n votable_id = params[:voto][:votable_id]\n if votable_type=='Pregunta'\n @voto.votable = Pregunta.find(votable_id)\n else\n @voto.votable = Respuesta.find(votable_id)\n end\n\n respond_to do |format|\n if @voto.save\n resp = {\n :votos_total => @voto.votable.votos_total,\n :votos_menos => @voto.votable.votos_menos,\n :votos_mas => @voto.votable.votos_mas\n }\n format.json { render json: resp, status: :created, location: @voto }\n else\n format.json { render json: @voto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @relatorio_plano_de_voo = RelatorioPlanoDeVoo.new(relatorio_plano_de_voo_params)\n\n respond_to do |format|\n if @relatorio_plano_de_voo.save\n format.html { redirect_to @relatorio_plano_de_voo, notice: 'Relatorio plano de voo was successfully created.' }\n format.json { render :show, status: :created, location: @relatorio_plano_de_voo }\n else\n format.html { render :new }\n format.json { render json: @relatorio_plano_de_voo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end",
"def create\n @vod = Vod.new(vod_params)\n #@vod.push_to_elaine if @vod.elaineid.zero?\n\n respond_to do |format|\n if @vod.save\n format.html { redirect_to @vod, notice: 'Vod was successfully created.' }\n format.json { render :show, status: :created, location: @vod }\n else\n format.html { render :new }\n format.json { render json: @vod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @safra_verdoso = SafraVerdoso.new(params[:safra_verdoso])\n\n respond_to do |format|\n if @safra_verdoso.save\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { render json: @safra_verdoso, status: :created, location: @safra_verdoso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vrsta_inventara = VrstaInventara.new(vrsta_inventara_params)\n\n respond_to do |format|\n if @vrsta_inventara.save\n format.html { redirect_to vrsta_inventaras_url, notice: 'Vrsta inventara je uspješno stvorena.' }\n format.json { render :show, status: :created, location: @vrsta_inventara }\n else\n format.html { render :new }\n format.json { render json: @vrsta_inventara.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @veterinario = Veterinario.new(veterinario_params)\n\n respond_to do |format|\n if @veterinario.save\n format.html { redirect_to @veterinario, notice: 'Veterinario was successfully created.' }\n format.json { render :show, status: :created, location: @veterinario }\n else\n format.html { render :new }\n format.json { render json: @veterinario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @veterinario = Veterinario.new(veterinario_params)\n\n respond_to do |format|\n if @veterinario.save\n format.html { redirect_to @veterinario, notice: \"Veterinario was successfully created.\" }\n format.json { render :show, status: :created, location: @veterinario }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @veterinario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ovode = Ovode.new(params[:ovode])\n\n respond_to do |format|\n if @ovode.save\n format.html { redirect_to @ovode, notice: 'ovode was successfully created.' }\n format.json { render json: @ovode, status: :created, location: @ovode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ovode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @verma = Verma.new(verma_params)\n\n respond_to do |format|\n if @verma.save\n format.html { redirect_to @verma, notice: 'Verma was successfully created.' }\n format.json { render :show, status: :created, location: @verma }\n else\n format.html { render :new }\n format.json { render json: @verma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @veiculo = Veiculo.new(params[:veiculo])\n\n respond_to do |format|\n if @veiculo.save\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully created.' }\n format.json { render :json => @veiculo, :status => :created, :location => @veiculo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @verbo = Verbo.new(params[:verbo])\n\n respond_to do |format|\n if @verbo.save\n format.html { redirect_to @verbo, notice: 'Verbo was successfully created.' }\n format.json { render json: @verbo, status: :created, location: @verbo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verbo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @votacion = Votacion.new(votacion_params)\n @votacion.etapa = \"Previa a la votación.\"\n respond_to do |format|\n if @votacion.save\n format.html { redirect_to @votacion, notice: 'La votación se creo correctamente.' }\n format.json { render :show, status: :created, location: @votacion }\n else\n format.html { render :new }\n format.json { render json: @votacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end",
"def create\n @kazoku = Kazoku.new(params[:kazoku])\n\n respond_to do |format|\n if @kazoku.save\n format.html { redirect_to @kazoku, :notice => 'Kazoku was successfully created.' }\n format.json { render :json => @kazoku, :status => :created, :location => @kazoku }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @kazoku.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @vano = Vano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vano }\n end\n end",
"def create\n @oeuvre = Oeuvre.new(oeuvre_params)\n\n respond_to do |format|\n if @oeuvre.save\n format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully created.' }\n format.json { render :show, status: :created, location: @oeuvre }\n else\n format.html { render :new }\n format.json { render json: @oeuvre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @souvenior = Souvenior.new(souvenior_params)\n\n respond_to do |format|\n if @souvenior.save\n format.html { redirect_to root_path, notice: 'Souvenior was successfully created.' }\n format.json { render :show, status: :created, location: @souvenior }\n else\n format.html { render :new }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vinculo = Vinculo.new(vinculo_params)\n\n respond_to do |format|\n if @vinculo.save\n format.html { redirect_to @vinculo, notice: 'Vinculo was successfully created.' }\n format.json { render :show, status: :created, location: @vinculo }\n else\n format.html { render :new }\n format.json { render json: @vinculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_visa = MyVisa.new(my_visa_params)\n\n respond_to do |format|\n if @my_visa.save\n format.html { redirect_to @my_visa, notice: 'My visa was successfully created.' }\n format.json { render :show, status: :created, location: @my_visa }\n else\n format.html { render :new }\n format.json { render json: @my_visa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nodo = Nodo.new(nodo_params)\n\n respond_to do |format|\n if @nodo.save\n #format.html { redirect_to @nodo, notice: 'Nodo was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @nodo }\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n else\n format.html { render action: 'new' }\n format.json { render json: @nodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ventaganancium = Ventaganancium.new(ventaganancium_params)\n\n respond_to do |format|\n if @ventaganancium.save\n format.html { redirect_to @ventaganancium, notice: 'Ventaganancium was successfully created.' }\n format.json { render :show, status: :created, location: @ventaganancium }\n else\n format.html { render :new }\n format.json { render json: @ventaganancium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nippou = Nippou.new(nippou_params)\n\n respond_to do |format|\n if @nippou.save\n format.html { redirect_to @nippou, notice: 'Nippou was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nippou }\n else\n format.html { render action: 'new' }\n format.json { render json: @nippou.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @torneo_apartura = TorneoApartura.new(torneo_apartura_params)\n\n respond_to do |format|\n if @torneo_apartura.save\n format.html { redirect_to @torneo_apartura, notice: 'Torneo apartura was successfully created.' }\n format.json { render :show, status: :created, location: @torneo_apartura }\n else\n format.html { render :new }\n format.json { render json: @torneo_apartura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vendedor = Vendedor.new(vendedor_params)\n\n respond_to do |format|\n if @vendedor.save\n format.html { redirect_to @vendedor, notice: t('.sucesso') }\n format.json { render :show, status: :created, location: @vendedor }\n else\n format.html { render :new }\n format.json { render json: @vendedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servidor = Servidor.new(servidor_params)\n\n respond_to do |format|\n if @servidor.save\n format.html { redirect_to servidores_path, success: 'Servidor cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @servidor }\n else\n format.html { render :new }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @voprosy = Voprosy.new(params[:voprosy])\n\n respond_to do |format|\n if @voprosy.save\n format.html { redirect_to @voprosy, notice: 'Voprosy was successfully created.' }\n format.json { render json: @voprosy, status: :created, location: @voprosy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voprosy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kodomo = Kodomo.new(kodomo_params)\n\n respond_to do |format|\n if @kodomo.save\n format.html { redirect_to @kodomo, notice: 'Kodomo was successfully created.' }\n format.json { render :show, status: :created, location: @kodomo }\n else\n format.html { render :new }\n format.json { render json: @kodomo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vacuna = Vacuna.new(vacuna_params)\n @vacuna.mascota_id = @mascota.id\n respond_to do |format|\n if @vacuna.save\n format.html { redirect_to @vacuna, notice: 'Vacuna Agregada exitosamente' }\n format.json { render :show, status: :created, location: @vacuna }\n else\n format.html { render :new }\n format.json { render json: @vacuna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @torneo = Torneo.new(params[:torneo])\n\n respond_to do |format|\n if @torneo.save\n format.html { redirect_to @torneo, notice: 'Torneo was successfully created.' }\n format.json { render json: @torneo, status: :created, location: @torneo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def CreateView params = {}\n \n APICall(path: 'views.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @torso = Torso.new(params[:torso])\n\n respond_to do |format|\n if @torso.save\n format.html { redirect_to @torso, notice: 'Torso was successfully created.' }\n format.json { render json: @torso, status: :created, location: @torso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servidor = Servidor.new(servidor_params)\n\n respond_to do |format|\n if @servidor.save\n format.html { redirect_to @servidor, notice: 'Servidor was successfully created.' }\n format.json { render :show, status: :created, location: @servidor }\n else\n format.html { render :new }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_ventum = TipoVentum.new(tipo_ventum_params)\n\n respond_to do |format|\n if @tipo_ventum.save\n format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_ventum }\n else\n format.html { render :new }\n format.json { render json: @tipo_ventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @noto = Noto.new(params[:noto])\n\n respond_to do |format|\n if @noto.save\n format.html { redirect_to @noto, :notice => 'Noto was successfully created.' }\n format.json { render :json => @noto, :status => :created, :location => @noto }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @noto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @proovedor = Proovedor.new(proovedor_params)\n\n respond_to do |format|\n if @proovedor.save\n format.html { redirect_to @proovedor, notice: 'Proovedor was successfully created.' }\n format.json { render :show, status: :created, location: @proovedor }\n else\n format.html { render :new }\n format.json { render json: @proovedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_venda = TipoVenda.new(tipo_venda_params)\n\n respond_to do |format|\n if @tipo_venda.save\n format.html { redirect_to @tipo_venda, notice: 'Tipo venda was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_venda }\n else\n format.html { render :new }\n format.json { render json: @tipo_venda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Objeto.new(objeto_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Objeto was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento_de_servicio = AsientoDeServicio.new(asiento_de_servicio_params)\n\n respond_to do |format|\n if @asiento_de_servicio.save\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @asiento_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vendedor_cliente = VendedorCliente.new(vendedor_cliente_params)\n\n respond_to do |format|\n if @vendedor_cliente.save\n format.html { redirect_to @vendedor_cliente, notice: 'Vendedor cliente was successfully created.' }\n format.json { render :show, status: :created, location: @vendedor_cliente }\n else\n format.html { render :new }\n format.json { render json: @vendedor_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ponderacion = Ponderacion.new(ponderacion_params)\n\n respond_to do |format|\n if @ponderacion.save\n format.html { redirect_to @ponderacion, notice: 'Ponderacion was successfully created.' }\n format.json { render :show, status: :created, location: @ponderacion }\n else\n format.html { render :new }\n format.json { render json: @ponderacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vocalium = Vocalium.new(params[:vocalium])\n\n respond_to do |format|\n if @vocalium.save\n format.html { redirect_to @vocalium, :notice => 'Vocalium was successfully created.' }\n format.json { render :json => @vocalium, :status => :created, :location => @vocalium }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @vocalium.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trnodo = Trnodo.new(params[:trnodo])\n\n respond_to do |format|\n if @trnodo.save\n format.html { redirect_to @trnodo, notice: 'Trnodo was successfully created.' }\n format.json { render json: @trnodo, status: :created, location: @trnodo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trnodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servicio = Servicio.new(params[:servicio])\n\n respond_to do |format|\n if @servicio.save\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully created.' }\n format.json { render :json => @servicio, :status => :created, :location => @servicio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @archdiocese = Archdiocese.new(archdiocese_params)\n\n if @archdiocese.save\n render json: @archdiocese, status: :created, location: @archdiocese\n else\n render json: @archdiocese.errors, status: :unprocessable_entity\n end\n end",
"def create\n @servidor = Servidor.new(servidor_params)\n\n respond_to do |format|\n if @servidor.save\n format.html { redirect_to @servidor, notice: 'Servidor criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @servidor }\n else\n format.html { render action: 'new' }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @onda = Onda.new(onda_params)\n\n respond_to do |format|\n if @onda.save\n format.html { redirect_to ondas_path, notice: 'Onda was successfully created.' }\n format.json { render :show, status: :created, location: @onda }\n else\n format.html { render :new }\n format.json { render json: @onda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @anteproyecto_observacion = AnteproyectoObservacion.new(anteproyecto_observacion_params)\n\n respond_to do |format|\n if @anteproyecto_observacion.save\n format.html { redirect_to @anteproyecto_observacion, notice: 'Anteproyecto observacion was successfully created.' }\n format.json { render :show, status: :created, location: @anteproyecto_observacion }\n else\n format.html { render :new }\n format.json { render json: @anteproyecto_observacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_veiculo = TipoVeiculo.new(tipo_veiculo_params)\n\n respond_to do |format|\n if @tipo_veiculo.save\n format.html { redirect_to @tipo_veiculo, notice: 'Tipo veiculo was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_veiculo }\n else\n format.html { render :new }\n format.json { render json: @tipo_veiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n vaga = Vaga.new(vaga_params)\n if vaga.save\n render json: {status: 'SUCCESSO', message:'Vaga adicionada com sucesso!', data:vaga},status: :ok\n else\n render json: {status: 'ERRO', message:'Houve um erro ao adicionar a vaga.', data:vaga.errors},status: :unprocessable_entity\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def new\n @vodka = Vodka.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vodka }\n end\n end",
"def create\n @vachana = Vachana.new(params[:vachana])\n\n respond_to do |format|\n if @vachana.save\n format.html { redirect_to @vachana, notice: 'Vachana was successfully created.' }\n format.json { render json: @vachana, status: :created, location: @vachana }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vachana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vachana = Vachana.new(params[:vachana])\n\n respond_to do |format|\n if @vachana.save\n format.html { redirect_to @vachana, notice: 'Vachana was successfully created.' }\n format.json { render json: @vachana, status: :created, location: @vachana }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vachana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vice = Vice.new(vice_params)\n\n respond_to do |format|\n if @vice.save\n format.html { redirect_to @vice, notice: 'Vice was successfully created.' }\n format.json { render :show, status: :created, location: @vice }\n else\n format.html { render :new }\n format.json { render json: @vice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vuelo = Vuelo.new(vuelo_params)\n\n respond_to do |format|\n if @vuelo.save\n format.html { redirect_to @vuelo, notice: 'Vuelo was successfully created.' }\n format.json { render :show, status: :created, location: @vuelo }\n else\n format.html { render :new }\n format.json { render json: @vuelo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @artesano = Artesano.new(artesano_params)\n\n respond_to do |format|\n if @artesano.save\n format.html { redirect_to @artesano, notice: 'Artesano was successfully created.' }\n format.json { render :show, status: :created, location: @artesano }\n else\n format.html { render :new }\n format.json { render json: @artesano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @panneau = Panneau.new(panneau_params)\n\n respond_to do |format|\n if @panneau.save\n format.html { redirect_to @panneau, notice: 'Panneau was successfully created.' }\n format.json { render :show, status: :created, location: @panneau }\n else\n format.html { render :new }\n format.json { render json: @panneau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @safra_verdoso = SafraVerdoso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra_verdoso }\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 @tiponovedad = Tiponovedad.new(tiponovedad_params)\n\n respond_to do |format|\n if @tiponovedad.save\n format.html { redirect_to @tiponovedad, notice: 'Tiponovedad was successfully created.' }\n format.json { render :show, status: :created, location: @tiponovedad }\n else\n format.html { render :new }\n format.json { render json: @tiponovedad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoenvolvido = Tipoenvolvido.new(tipoenvolvido_params)\n\n respond_to do |format|\n if @tipoenvolvido.save\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoenvolvido }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pologeno = Pologeno.new(params[:pologeno])\n\n respond_to do |format|\n if @pologeno.save\n format.html { redirect_to @pologeno, notice: 'Pologeno was successfully created.' }\n format.json { render json: @pologeno, status: :created, location: @pologeno }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pologeno.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @verbindung = Verbindung.new(params[:verbindung])\n\n respond_to do |format|\n if @verbindung.save\n format.html { redirect_to @verbindung, notice: 'Verbindung was successfully created.' }\n format.json { render json: @verbindung, status: :created, location: @verbindung }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verbindung.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plannegocio = Plannegocio.new(params[:plannegocio])\n\n respond_to do |format|\n if @plannegocio.save\n format.html { redirect_to @plannegocio, notice: 'Plannegocio was successfully created.' }\n format.json { render json: @plannegocio, status: :created, location: @plannegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plannegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posto = Posto.new(posto_params)\n\n respond_to do |format|\n if @posto.save\n format.html { redirect_to @posto, notice: 'Posto was successfully created.' }\n format.json { render :show, status: :created, location: @posto }\n else\n format.html { render :new }\n format.json { render json: @posto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @postavka = Postavka.new(postavka_params)\n\n respond_to do |format|\n if @postavka.save\n format.html { redirect_to @postavka, notice: 'Postavka was successfully created.' }\n format.json { render action: 'show', status: :created, location: @postavka }\n else\n format.html { render action: 'new' }\n format.json { render json: @postavka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_aos_version_box(args = {}) \n post(\"/aosversions.json/aosversionbox\", args)\nend",
"def create\n @tipo_negocio = TipoNegocio.new(params[:tipo_negocio])\n\n respond_to do |format|\n if @tipo_negocio.save\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully created.' }\n format.json { render json: @tipo_negocio, status: :created, location: @tipo_negocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @noyau = Noyau.new(noyau_params)\n\n respond_to do |format|\n if @noyau.save\n format.html { redirect_to @noyau, notice: 'Noyau was successfully created.' }\n format.json { render :show, status: :created, location: @noyau }\n else\n format.html { render :new }\n format.json { render json: @noyau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @verse = Verse.new(params[:verse])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @verse, notice: 'Verse was successfully created.' }\n format.json { render json: @verse, status: :created, location: @verse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @verse = Verse.new(params[:verse])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @verse, notice: 'Verse was successfully created.' }\n format.json { render json: @verse, status: :created, location: @verse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eva = Eva.new(eva_params)\n\n respond_to do |format|\n if @eva.save\n format.html { redirect_to :back, notice: '✔ 評価が送信されました' }\n format.json { render :show, status: :created, location: @eva }\n else\n format.html { render :new }\n format.json { render json: @eva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Dato.new(dato_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Dato was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.65094936",
"0.6346268",
"0.6317516",
"0.6213228",
"0.61727434",
"0.61343896",
"0.60662377",
"0.6063277",
"0.6059031",
"0.6041116",
"0.60224843",
"0.60210156",
"0.6019828",
"0.6013145",
"0.5997783",
"0.59836125",
"0.59815365",
"0.5971525",
"0.59701365",
"0.5959958",
"0.5947081",
"0.59436804",
"0.593724",
"0.5929832",
"0.59279317",
"0.59150714",
"0.58982253",
"0.5889876",
"0.58888906",
"0.5886403",
"0.58525383",
"0.58198357",
"0.5816907",
"0.58142924",
"0.58133715",
"0.58121556",
"0.58120185",
"0.58013904",
"0.5770021",
"0.5761425",
"0.576066",
"0.57534844",
"0.57362354",
"0.57308435",
"0.57297385",
"0.5729334",
"0.57262254",
"0.57239807",
"0.5717635",
"0.5715501",
"0.5713981",
"0.5710863",
"0.57087094",
"0.57077575",
"0.57018507",
"0.5698101",
"0.56971174",
"0.56970394",
"0.56954336",
"0.5691417",
"0.5690313",
"0.5689634",
"0.56884223",
"0.56857586",
"0.56823057",
"0.567846",
"0.56775504",
"0.56721735",
"0.56703144",
"0.5665696",
"0.5664155",
"0.56636214",
"0.56608814",
"0.56556916",
"0.5654663",
"0.5649825",
"0.5645134",
"0.5642079",
"0.5642079",
"0.5632478",
"0.5626218",
"0.5625134",
"0.56238985",
"0.5623725",
"0.5623478",
"0.5623091",
"0.5619692",
"0.5617926",
"0.56178224",
"0.5616406",
"0.56157064",
"0.5615369",
"0.5614462",
"0.56136847",
"0.5610241",
"0.5610181",
"0.5606158",
"0.5606158",
"0.56053597",
"0.5605358"
] |
0.653171
|
0
|
PUT /vanos/1 PUT /vanos/1.json
|
def update
@vano = Vano.find(params[:id])
respond_to do |format|
if @vano.update_attributes(params[:vano])
format.html { redirect_to @vano, notice: 'Vano was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @vano.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 put!\n request! :put\n end",
"def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend",
"def put(*args)\n request :put, *args\n end",
"def update\n respond_to do |format|\n if @vano.update(vano_params)\n format.html { redirect_to @vano, notice: 'Vano was successfully updated.' }\n format.json { render :show, status: :ok, location: @vano }\n else\n format.html { render :edit }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put(*args)\n request(:put, *args)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @voc = Voc.find(params[:id])\n @voc.user_id = current_user.id\n respond_to do |format|\n if @voc.update_attributes(params[:voc])\n format.html { redirect_to @voc, notice: 'Voc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n if @vano.update_attributes(params[:vano])\n format.html { redirect_to(@vano, :notice => 'Vano was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vano.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n if @voprosy.update_attributes(params[:voprosy])\n format.html { redirect_to @voprosy, notice: 'Voprosy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voprosy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @volantino = Volantino.find(params[:id])\n\n respond_to do |format|\n if @volantino.update_attributes(params[:volantino])\n format.html { redirect_to @volantino, notice: 'Volantino was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @volantino.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @venta = Venta.find(params[:id])\n\n respond_to do |format|\n if @venta.update_attributes(params[:venta])\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\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 @videoo.update(videoo_params)\n format.html { redirect_to @videoo, notice: 'Videoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @videoo }\n else\n format.html { render :edit }\n format.json { render json: @videoo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n if @observacao_vocacionada.update_attributes(params[:observacao_vocacionada])\n format.html { redirect_to @observacao_vocacionada}\n flash[:notice] = \"Registro alterado com sucesso!\"\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observacao_vocacionada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aviso.update(aviso_params)\n format.html { redirect_to avisos_path, notice: 'Aviso was successfully updated.' }\n format.json { render :show, status: :ok, location: @aviso }\n else\n format.html { render :edit }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @vat.update(vat_params)\n head :no_content\n else\n render json: @vat.errors, status: :unprocessable_entity\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def put url, object = nil\n request url, HTTP::Put, object\n end",
"def update\n respond_to do |format|\n if @servidor.update(servidor_params)\n format.html { redirect_to @servidor, notice: 'Servidor atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def create_method\n :put_json\n end",
"def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @unova.update(unova_params)\n format.html { redirect_to @unova, notice: 'Unova was successfully updated.' }\n format.json { render :show, status: :ok, location: @unova }\n else\n format.html { render :edit }\n format.json { render json: @unova.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vice.update(vice_params)\n format.html { redirect_to @vice, notice: 'Vice was successfully updated.' }\n format.json { render :show, status: :ok, location: @vice }\n else\n format.html { render :edit }\n format.json { render json: @vice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_todo\n @api_v1_todo = Todo.find(params[:id])\n end",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def atualiza_um_pet_existente(objeto)\n uri = \"#{ENV['BASE_URI']}/pet\"\n \n without_authentication('put', uri, objeto.to_json)\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n if @vodka.update_attributes(params[:vodka])\n format.html { redirect_to @vodka, notice: 'Vodka was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vodka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ovode = Ovode.find_by_url(params[:id])\n\n respond_to do |format|\n if @ovode.update_attributes(params[:ovode])\n format.html { redirect_to @ovode, notice: 'ovode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ovode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servidor.update(servidor_params)\n format.html { redirect_to servidores_path, success: 'Servidor atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servidor }\n else\n format.html { render :edit }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vitamina.update(vitamina_params)\n format.html { redirect_to @vitamina, notice: 'Vitamina was successfully updated.' }\n format.json { render :show, status: :ok, location: @vitamina }\n else\n format.html { render :edit }\n format.json { render json: @vitamina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @svote.update(svote_params)\n format.html { redirect_to @svote, notice: 'Svote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @svote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vod.update(vod_params)\n format.html { redirect_to @vod, notice: 'Vod was successfully updated.' }\n format.json { render :show, status: :ok, location: @vod }\n else\n format.html { render :edit }\n format.json { render json: @vod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_aos_version_box(args = {}) \n post(\"/aosversions.json/aosversionbox\", args)\nend",
"def update\n respond_to do |format|\n if @servidor.update(servidor_params)\n format.html { redirect_to @servidor, notice: 'Servidor was successfully updated.' }\n format.json { render :show, status: :ok, location: @servidor }\n else\n format.html { render :edit }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servidor.update(servidor_params)\n format.html { redirect_to @servidor, notice: 'Servidor was successfully updated.' }\n format.json { render :show, status: :ok, location: @servidor }\n else\n format.html { render :edit }\n format.json { render json: @servidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(revista_params)\n format.html { redirect_to @objeto, notice: 'Revista was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\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 @via = Via.find(params[:id])\n\n respond_to do |format|\n if @via.update_attributes(params[:via])\n flash[:notice] = 'Via was successfully updated.'\n format.html { redirect_to(@via) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @via.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @souvenior.update(souvenior_params)\n format.html { redirect_to @souvenior, notice: 'Souvenior was successfully updated.' }\n format.json { render :show, status: :ok, location: @souvenior }\n else\n format.html { render :edit }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def update\n respond_to do |format|\n if @venta.update(venta_params)\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { render :show, status: :ok, location: @venta }\n else\n format.html { render :edit }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vocacionada = Vocacionada.find(params[:id])\n\n respond_to do |format|\n if @vocacionada.update_attributes(params[:vocacionada])\n format.html { redirect_to vocacionadas_url}\n flash[:notice] = \"Registro alterado com sucesso!\"\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vocacionada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aviso.update(aviso_params)\n format.html { redirect_to @aviso, notice: 'Aviso was successfully updated.' }\n format.json { render :show, status: :ok, location: @aviso }\n else\n format.html { render :edit }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vinculo.update(vinculo_params)\n format.html { redirect_to @vinculo, notice: 'Vinculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @vinculo }\n else\n format.html { render :edit }\n format.json { render json: @vinculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @octopus.update(octopus_params)\n format.html { redirect_to octopi_path, notice: 'Octopus was successfully updated.' }\n format.json { render :show, status: :ok, location: @octopus }\n else\n format.html { render :edit }\n format.json { render json: @octopus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n if @aviso.update_attributes(params[:aviso])\n format.html { redirect_to @aviso, notice: 'Aviso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vacina.update(vacina_params)\n format.html { redirect_to @vacina, notice: \"Vacina was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vacina }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vacina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_visto\n @visto = Visto.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @uva.update(uva_params)\n format.html { redirect_to @uva, notice: 'Uva was successfully updated.' }\n format.json { render :show, status: :ok, location: @uva }\n else\n format.html { render :edit }\n format.json { render json: @uva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n #update venues trought users controller\n\n @user = User.find_by(authentication_token: request.headers['Authorization'])\n\n if @user.is_venue?\n @user.venue.update(venue_params)\n if @user.venue.update(venue_params)\n render json: {status: :ok}\n else\n render json: {msg: 'Invalid params'}\n end\n else\n render json: {msg: 'You dont own a venue'}, status: :error\n end\n \n\n end",
"def update\n respond_to do |format|\n if @vrsta_inventara.update(vrsta_inventara_params)\n format.html { redirect_to vrsta_inventaras_url, notice: 'Vrsta inventara je uspješno ažurirana.' }\n format.json { render :show, status: :ok, location: @vrsta_inventara }\n else\n format.html { render :edit }\n format.json { render json: @vrsta_inventara.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @votacion.update(votacion_params)\n format.html { redirect_to @votacion, notice: 'La votación se edito correctamente.' }\n format.json { render :show, status: :ok, location: @votacion }\n else\n format.html { render :edit }\n format.json { render json: @votacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @veiculo_motorista.update(veiculo_motorista_params)\n format.html { redirect_to @veiculo_motorista, notice: 'Veiculo motorista was successfully updated.' }\n format.json { render :show, status: :ok, location: @veiculo_motorista }\n else\n format.html { render :edit }\n format.json { render json: @veiculo_motorista.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @onsen.update(onsen_params)\n format.html { redirect_to @onsen, notice: 'Onsen was successfully updated.' }\n format.json { render :show, status: :ok, location: @onsen }\n else\n format.html { render :edit }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def update\n respond_to do |format|\n if @my_visa.update(my_visa_params)\n format.html { redirect_to @my_visa, notice: 'My visa was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_visa }\n else\n format.html { render :edit }\n format.json { render json: @my_visa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @relatorio_plano_de_voo.update(relatorio_plano_de_voo_params)\n format.html { redirect_to @relatorio_plano_de_voo, notice: 'Relatorio plano de voo was successfully updated.' }\n format.json { render :show, status: :ok, location: @relatorio_plano_de_voo }\n else\n format.html { render :edit }\n format.json { render json: @relatorio_plano_de_voo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vacina.update(vacina_params)\n format.html { redirect_to @vacina, notice: 'Vacina editada com sucesso.' }\n format.json { render :show, status: :ok, location: @vacina }\n else\n format.html { render :edit }\n format.json { render json: @vacina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vacuna.update(vacuna_params)\n format.html { redirect_to @vacuna, notice: 'Vacuna was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacuna }\n else\n format.html { render :edit }\n format.json { render json: @vacuna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @visa.update(visa_params)\n\t\t\t\tformat.html { redirect_to @visa, notice: 'Visa was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @visa }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @visa.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update(*args)\n put(*args)\n end"
] |
[
"0.6466889",
"0.633817",
"0.6320665",
"0.62113655",
"0.62092394",
"0.6105025",
"0.60748714",
"0.6063246",
"0.59944105",
"0.59539396",
"0.59413433",
"0.5915456",
"0.5911947",
"0.5862531",
"0.58585703",
"0.58584934",
"0.5844563",
"0.58098227",
"0.58069044",
"0.57905406",
"0.57785094",
"0.57729495",
"0.5761131",
"0.57371575",
"0.5733496",
"0.5716442",
"0.5700663",
"0.5674912",
"0.5662348",
"0.56593317",
"0.56571734",
"0.56516224",
"0.5649629",
"0.56378853",
"0.56273794",
"0.5626146",
"0.56239575",
"0.5622389",
"0.56202126",
"0.5618417",
"0.5617502",
"0.5614364",
"0.5614364",
"0.5610592",
"0.5608852",
"0.5605544",
"0.5605326",
"0.56051534",
"0.5591523",
"0.5589837",
"0.5585239",
"0.5585222",
"0.5582598",
"0.5582598",
"0.5582379",
"0.55818456",
"0.557951",
"0.5576289",
"0.5575767",
"0.5569415",
"0.5569415",
"0.5568371",
"0.5565181",
"0.5562717",
"0.55601764",
"0.5547203",
"0.55452543",
"0.55422294",
"0.55399275",
"0.5539637",
"0.5538184",
"0.5537479",
"0.55339694",
"0.5532329",
"0.55303836",
"0.55303836",
"0.55303836",
"0.5524036",
"0.55204695",
"0.5519785",
"0.5519122",
"0.55129147",
"0.55122554",
"0.55103076",
"0.55091995",
"0.5507524",
"0.5501454",
"0.5501395",
"0.55007136",
"0.54987085",
"0.5490583",
"0.5490583",
"0.5490583",
"0.5490583",
"0.5490583",
"0.5490583",
"0.5490583",
"0.5490583",
"0.5488562",
"0.5486477"
] |
0.6172887
|
5
|
DELETE /vanos/1 DELETE /vanos/1.json
|
def destroy
@vano = Vano.find(params[:id])
@vano.destroy
respond_to do |format|
format.html { redirect_to vanos_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vano.destroy\n respond_to do |format|\n format.html { redirect_to vanos_url, notice: 'Vano was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete path\n make_request(path, \"delete\", {})\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 @ovode = Ovode.find_by_url(params[:id])\n @ovode.destroy\n\n respond_to do |format|\n format.html { redirect_to ovodes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete!\n request! :delete\n end",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n @observacao_vocacionada.destroy\n\n respond_to do |format|\n format.html { redirect_to observacao_vocacionadas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vodka = Vodka.find(params[:id])\n @vodka.destroy\n\n respond_to do |format|\n format.html { redirect_to vodkas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visto.destroy\n respond_to do |format|\n format.html { redirect_to vistos_url, notice: 'Visto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @svote.destroy\n respond_to do |format|\n format.html { redirect_to svotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @voc = Voc.find(params[:id])\n @voc.destroy\n\n respond_to do |format|\n format.html { redirect_to vocs_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+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 @vano = Vano.find(params[:id])\n @vano.destroy\n\n respond_to do |format|\n format.html { redirect_to(vanos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @unova.destroy\n respond_to do |format|\n format.html { redirect_to unovas_url, notice: 'Unova was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verbo = Verbo.find(params[:id])\n @verbo.destroy\n\n respond_to do |format|\n format.html { redirect_to verbos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vod.destroy\n respond_to do |format|\n format.html { redirect_to vods_url, notice: 'Vod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_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 @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to revistas_url, notice: 'Revista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trnodo = Trnodo.find(params[:id])\n @trnodo.destroy\n\n respond_to do |format|\n format.html { redirect_to trnodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @volantino = Volantino.find(params[:id])\n @volantino.destroy\n\n respond_to do |format|\n format.html { redirect_to volantinos_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @votacion.destroy\n respond_to do |format|\n format.html { redirect_to votacions_url, notice: 'Votacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\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 @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @octopus.destroy\n respond_to do |format|\n format.html { redirect_to octopi_url, notice: 'Octopus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_visa.destroy\n respond_to do |format|\n format.html { redirect_to my_visas_url, notice: 'My visa was successfully destroyed.' }\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!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vendamesa.destroy\n respond_to do |format|\n format.html { redirect_to vendamesas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to objetos_url, notice: 'Objeto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to objetos_url, notice: 'Objeto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url, flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servidor.destroy\n respond_to do |format|\n format.html { redirect_to servidores_path, notice: 'Servidor excluído com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordem_servico.destroy\n respond_to do |format|\n format.html { redirect_to ordem_servicos_url, notice: t('messages.cadastro_removido') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noto = Noto.find(params[:id])\n @noto.destroy\n\n respond_to do |format|\n format.html { redirect_to notos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\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 destroy\n @servidor.destroy\n respond_to do |format|\n format.html { redirect_to servidores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @sivic_plano.destroy\n respond_to do |format|\n format.html { redirect_to sivic_planos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventas_agrupador_cliente.destroy\n respond_to do |format|\n format.html { redirect_to ventas_agrupador_clientes_url, notice: 'Agrupador cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventas_agrupador_cliente.destroy\n respond_to do |format|\n format.html { redirect_to ventas_agrupador_clientes_url, notice: 'Agrupador cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vende = Vende.find([params[:id1],params[:id2],params[:id3]])\n @vende.destroy\n respond_to do |format|\n format.html { redirect_to vende_index_path, notice: 'A compra foi removida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end"
] |
[
"0.7635278",
"0.7225469",
"0.7017266",
"0.6978059",
"0.69667196",
"0.69404894",
"0.6909755",
"0.6909755",
"0.6909755",
"0.6909755",
"0.6901307",
"0.68969226",
"0.68740904",
"0.6865582",
"0.685141",
"0.6843221",
"0.6838565",
"0.6834352",
"0.68157345",
"0.6811135",
"0.68090856",
"0.6805486",
"0.6805486",
"0.6782727",
"0.6781014",
"0.67766523",
"0.6776507",
"0.67736965",
"0.6773143",
"0.67720723",
"0.67707646",
"0.67662174",
"0.6748099",
"0.67477685",
"0.6739198",
"0.6734541",
"0.6734541",
"0.6734541",
"0.67332935",
"0.6731099",
"0.67143065",
"0.67042947",
"0.67000806",
"0.6698837",
"0.6697797",
"0.6697797",
"0.669508",
"0.66948116",
"0.6693118",
"0.66880816",
"0.6685067",
"0.6676337",
"0.66747075",
"0.6674694",
"0.667283",
"0.6670528",
"0.6668631",
"0.6667826",
"0.66669714",
"0.66642773",
"0.66497207",
"0.6646094",
"0.664602",
"0.6643921",
"0.6642533",
"0.66377175",
"0.66368884",
"0.6636809",
"0.66363794",
"0.6634495",
"0.6631169",
"0.6624601",
"0.6624257",
"0.6622591",
"0.662237",
"0.6614875",
"0.6613655",
"0.6611292",
"0.6611292",
"0.6607381",
"0.6606834",
"0.6606224",
"0.66026556",
"0.6602569",
"0.66006577",
"0.65987444",
"0.65984267",
"0.6595694",
"0.65926677",
"0.6590371",
"0.6586911",
"0.6586063",
"0.65858245",
"0.6583529",
"0.658259",
"0.65808",
"0.65774757",
"0.65774757",
"0.65748256",
"0.65725434"
] |
0.7125306
|
2
|
depends on contacts & checks
|
def migrate_contact_entity_linkages
contacts_for_keys = @source_redis.keys('contacts_for:*')
all_entity_names_by_id = @source_redis.hgetall('all_entity_names_by_id')
contacts_for_keys.each do |contacts_for_key|
unless contacts_for_key =~ /\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\z/
raise "Bad regex for '#{contacts_for_key}'"
end
entity_id = $1
check_name = $2
entity_name = all_entity_names_by_id[entity_id]
contact_ids = @source_redis.smembers(contacts_for_key)
next if contact_ids.empty?
contacts = contact_ids.collect {|c_id| find_contact(c_id) }
contacts.each do |contact|
@check_ids_by_contact_id_cache[contact.id] ||= []
end
tag_for_check = proc do |en, cn, tn|
check = find_check(en, cn)
check.tags << find_tag(tn, :create => true)
contacts.each do |contact|
@check_ids_by_contact_id_cache[contact.id] << check.id
end
end
if check_name.nil?
# interested in entity, so apply to all checks for that entity
tag_name = "entity_#{entity_name}"
all_checks_for_entity = @source_redis.zrange("all_checks:#{entity_name}", 0, -1)
all_checks_for_entity.each do |check_name|
tag_for_check.call(entity_name, check_name, tag_name)
end
else
# interested in check
tag_for_check.call(entity_name, check_name,
"check_#{entity_name}:#{check_name}")
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def contact; end",
"def contacts\r\n\r\n end",
"def scrape_contacts; end",
"def contact \n\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n\n end",
"def contact\n\n end",
"def contactus\r\n end",
"def common\n #if Contact.where(:organization_id => current_user.organization.id).any?\n # #@users = current_user.organization.contacts.group_by{|u| u.first_name[0]}\n # @users = Contact.where(:organization_id => current_user.organization.id).order(\"name,first_name\")\n #end\n # Contact.all.each do |contact|\n # contact.update_column :created_by, current_user.id\n # end\n begin\n lastcontact = current_user.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n unless lastcontact.present?\n lastcontact = current_user.organization.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n\n end\n if lastcontact.present?\n if lastcontact && lastcontact.activity_type == \"IndividualContact\"\n @contact = IndividualContact.find(lastcontact.activity_id)\n get_contact_attrs\n elsif lastcontact && lastcontact.activity_type == \"CompanyContact\"\n @contact = CompanyContact.find(lastcontact.activity_id)\n get_contact_attrs\n end\n else\n contacts=current_user.organization.individual_contacts\n @contact = contacts.last\n get_contact_attrs\n end\n rescue ActiveRecord::RecordNotFound\n flash[:bowarning]=\"It seems you don't have sufficient privilege to access this item or something went wrong with your account permissions. Please contact Admin to get this fixed.\"\n #redirect_to contacts_path\n end\n\n end",
"def app_contact\n end",
"def contactus\n end",
"def add_contacts\n \tap \"adding contacts\"\n # asking whether we are already authorized\n AddressBook.request_authorization unless AddressBook.authorized?\n\n \n if AddressBook.authorized?\n 25.times do\n person = AddressBook::Person.create(\n :first_name => Forgery::Name.first_name, \n :last_name => Forgery::Name.last_name, \n :email => [{ :value => Forgery(:internet).email_address , :label => 'Home'}], :phones => [{ :value => rand(10 ** 10).to_s, :label => 'Mobile'}])\n end\n else\n #ap \"This app is not authorized to access the address book.\"\n end\n #enVd\n end",
"def modify_contact\n\n end",
"def transfer_contacts(appdata,customfieldscheck)\n\n puts \"Importing Contacts...\"\n\n #SOURCE APP\n #---------------------------------------\n\n puts \"=> Initializing Source App\"\n #initialize source app\n initialize_infusionsoft(appdata[:src_appname], appdata[:src_apikey])\n\n puts \"=> Getting Source Custom Fields\"\n #get list of contact custom fields\n #then store the list of names in an array to add to fields for lookup\n source_app_custom_fields = get_table('DataFormField')\n contact_fields = []\n contact_fields = FIELDS['Contact'].map(&:clone)\n source_app_custom_fields.each { |cf| contact_fields.push(\"_\" + cf['Name']) if cf['FormId'] == -1 }\n\n puts \"=> Getting Source Contacts\"\n #Option 1\n #________\n #get all contacts from the source app\n all_contacts = get_table('Contact',contact_fields)\n\n #Option 2\n #________\n #get contacts with specific criteria\n #all_contacts = get_table('Contact',contact_fields,{Id: 282589})\n #all_contacts += (get_table('Contact',contact_fields,{OwnerID: 118786}))\n\n #reduce list of custom fields to create by detecting which fields have data\n fields_with_data = []\n all_contacts.each { |c| fields_with_data |= c.keys }\n custom_fields_to_import = fields_with_data.grep(/^_/)\n source_app_custom_fields.reject! { |cf| custom_fields_to_import.exclude? '_' + cf['Name']}\n\n\n puts \"=> Getting Source Opt Outs\"\n #get list of opted out emails\n opted_out_emails = get_table('EmailAddStatus').select { |email| OPT_OUT_STATUSES.include? email['Type'] }\n\n puts \"=> Getting Source Lead Sources\"\n #get list of Lead Sources and Categories from source app\n source_app_lead_source_categories = get_table('LeadSourceCategory')\n source_app_lead_sources = get_table('LeadSource')\n\n puts \"=> Getting Source Users\"\n #get list of users for comparing username to source app\n source_app_users = get_table('User')\n\n puts \"=> Getting Source App Settings\"\n #gets lists of app settings for comparing to dest app, stored as arrays\n source_types = Infusionsoft.data_get_app_setting('Contact','optiontypes').split(',')\n source_titles = Infusionsoft.data_get_app_setting('Contact','optiontitles').split(',')\n source_suffixes = Infusionsoft.data_get_app_setting('Contact','optionsuffixes').split(',')\n source_phonetypes = Infusionsoft.data_get_app_setting('Contact','optionphonetypes').split(',')\n source_faxtypes = Infusionsoft.data_get_app_setting('Contact','optionfaxtypes').split(',')\n\n\n #DESTINATION APP\n #--------------------------------------\n\n #INITIALIZATION\n #______________\n puts \"=> Initializing Dest App\"\n #initialize destination app\n initialize_infusionsoft(appdata[:dest_appname], appdata[:dest_apikey])\n\n #LEAD SOURCE\n #___________\n\n puts \"=> Importing Lead Sources...\"\n\n #creates Lead Sources and Categories if they don't exist\n #Adds all category names and lead source names to hashes to compare\n dest_app_lead_source_categories = {}\n get_table('LeadSourceCategory').each { |cat| dest_app_lead_source_categories[cat['Id']] = cat['Name'] }\n\n dest_app_lead_sources = {}\n get_table('LeadSource').each { |src| dest_app_lead_sources[src['Id']] = src['Name'] }\n\n #adds lead source categories to dest app, and sets the ID of the source app lead source category equal to the category created\n #only adds lead source category if it doesn't already exist in dest app\n category_relationship = {}\n source_app_lead_source_categories.each { |cat|\n category_relationship[cat['Id']] = dest_app_lead_source_categories.key(cat['Name']) || Infusionsoft.data_add('LeadSourceCategory',cat)\n }\n\n #create empty hash with default relationship of 0 to 0\n lead_source_relationship = {0=>0}\n source_app_lead_sources.each do |src|\n #swaps old category ID with new category ID\n src['LeadSourceCategoryId'] = category_relationship[src['LeadSourceCategoryId']] unless src['LeadSourceCategoryId'] == 0\n\n #creates lead source if it doesn't exist by the same name\n lead_source_relationship[src['Id']] = dest_app_lead_sources.key(src['Name']) || Infusionsoft.data_add('LeadSource',src)\n end\n\n #FKID AND CONTACT CUSTOM FIELDS\n #__________________\n\n puts \"=> Importing Custom Fields...\"\n\n #creates Source App Contact and Company ID custom fields if they don't exist\n @@source_app_contact_id = create_custom_field('Source App Contact ID')['Name']\n @@source_app_company_id = create_custom_field('Source App Company ID')['Name']\n\n #create contact custom fields if the custom fields check is true\n #also maps the source app custom fields to any existing custom fields in the dest app\n rename_mapping = {}\n\n source_app_custom_fields.each do |cf|\n #checks if app has ANY custom fields; also skips any of type 25, which is unknown, or when it's not a contact custom field\n next if cf.nil? || cf['DataType'] == 25 || cf['FormId'] != -1\n field = create_custom_field(cf['Label'],0,'Contact',DATATYPES[DATATYPE_IDS[cf['DataType']]]['dataType'],cf['Values'])\n rename_mapping['_' + cf['Name']] = field['Name']\n end if customfieldscheck\n\n\n #switches the 'Id' key to be 'Source App Contact ID'\n #switches the 'CompanyID' key to be 'Source App Company ID'\n rename_mapping['Id'] = @@source_app_contact_id\n rename_mapping['CompanyID'] = @@source_app_company_id\n\n #USERS\n #_____\n puts \"=> Creating User Relationship\"\n #Matches up users based on their 'GlobalUserId' which is the Infusionsoft ID\n users_relationship = create_user_relationship(source_app_users,get_table('User'))\n\n #APP SETTINGS\n #____________\n puts \"=> Generating App Settings Differences\"\n\n #Get differene between source app settings and dest app settings\n $types = source_types - Infusionsoft.data_get_app_setting('Contact','optiontypes').split(',')\n $titles = source_titles - Infusionsoft.data_get_app_setting('Contact','optiontitles').split(',')\n $suffixes = source_suffixes - Infusionsoft.data_get_app_setting('Contact','optionsuffixes').split(',')\n $phonetypes = source_phonetypes - Infusionsoft.data_get_app_setting('Contact','optionphonetypes').split(',')\n $faxtypes = source_faxtypes - Infusionsoft.data_get_app_setting('Contact','optionfaxtypes').split(',')\n\n #CREATE IMPORT TAG\n #_________________\n\n puts \"=> Creating Import Tag...\"\n\n #check if Category and Tag already exist\n existing_cat_id = Infusionsoft.data_query('ContactGroupCategory',1000,0,{'CategoryName' => 'Application Transfer'},['Id'])\n existing_tag_id = Infusionsoft.data_query('ContactGroup',\n 1000,\n 0,\n {'GroupCategoryId' => existing_cat_id.first['Id'], 'GroupName' => \"Data from #{appdata[:src_appname]}\"},\n ['Id']) unless existing_cat_id.to_a.empty?\n\n import_tag_cat_id = existing_cat_id.to_a.empty? ? Infusionsoft.data_add('ContactGroupCategory',{'CategoryName' => 'Application Transfer'}) : existing_cat_id.first['Id']\n import_tag_id = existing_tag_id.to_a.empty? ? Infusionsoft.data_add('ContactGroup',{'GroupCategoryId' => import_tag_cat_id, 'GroupName' => \"Data from #{appdata[:src_appname]}\"}) : existing_tag_id.first['Id']\n\n #GET CONTACTS THAT HAVE ALREADY BEEN TRANSFERRED\n #_______________________________________________\n dest_contacts = get_table(\"Contact\",[@@source_app_contact_id],{@@source_app_contact_id => \"_%\"}).map { |c| c[@@source_app_contact_id]}\n\n #ADD CONTACTS\n #____________\n\n puts \"=> Adding contacts...\"\n\n #adds each contact in the list of contacts to destination app\n #swaps lead source IDs before import to dest app lead source ID\n #swaps user ID to destination app user ID based on users_relationship matching\n dest_emails = []\n all_contacts.each do |contact|\n next if dest_contacts.include? contact['Id'].to_s #skips importing contacts that have previously been transferred\n contact.keys.each { |k| contact[ rename_mapping[k] ] = contact.delete(k).to_s if rename_mapping[k] }\n contact.delete('AccountId')\n contact['LeadSourceId'] = lead_source_relationship[contact['LeadSourceId']]\n contact['OwnerID'] = users_relationship[contact['OwnerID']] || 0\n contact_id = Infusionsoft.contact_add(contact) unless contact[@@source_app_contact_id] == contact[@@source_app_company_id]\n Infusionsoft.contact_add_to_group(contact_id, import_tag_id) unless contact_id.nil?\n dest_emails |= [contact['Email']]\n end\n\n puts \"=> Opting Out Emails\"\n #opt out all emails that were opted out in the source app\n opted_out_emails.each do |email|\n Infusionsoft.email_optout(email, 'Source App Opt Out') if dest_emails.include? email\n end\n\n puts \"Contacts Imported.\"\n end",
"def parse_contacts\n case params[:importer]\n when GMAIL, YAHOO, HOTMAIL\n request.env['omnicontacts.contacts'].map { |c| [c[:email], c[:email]] }.to_json\n when LINKEDIN then fetch_linkedin_contacts\n end\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 fetch_contacts!\n create_agent\n prepare\n scrape_contacts\n end",
"def is_contact?(); @type == GRT_CONTACT; end",
"def validate_contacts\n # we assume they are set at this point\n # contacts are unique\n contacts = [ self.requester, self.subject_expert, self.sponsor ]\n if Set.new(contacts).length != contacts.length\n add_validation 'All contacts must be unique'\n end\n\n # sponsor should be higher than expert, and expert higher than requester\n # ranks are reversed, rank 1 is top (board chairman)\n if self.sponsor.title.rank >= self.subject_expert.title.rank\n add_validation 'Sponsor should be a higher rank than the Subject Expert'\n end\n if self.subject_expert.title.rank >= self.requester.title.rank\n add_validation 'Subject Expert should be a higher rank than the Requester'\n end\n\n # contacts are co-located!\n if Set.new(contacts.map { |contact| contact.office.mail_code }).length > 1\n add_validation 'All contacts should be co-located'\n end\n end",
"def contacts\n\t\t@user = current_user\n\t\tcheck_if_myself\n\t\t@contacts = @user.contacts\n\tend",
"def contacts\n\t #begin\n\t autopilot_contact = params[\"contact\"]\n\t autopilot_event = params[\"event\"]\n\t if autopilot_contact.has_key?(\"Company\") && autopilot_contact[\"Company\"] != \"\"\n company_id = get_freshdesk_company_id(autopilot_contact[\"Company\"])\n #Rails.logger.debug \"comp id==>#{company_id}\"\n autopilot_contact[\"Company\"] = company_id \n end\n @freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n @freshdesk_data[\"company_id\"] = autopilot_contact[\"Company\"] unless autopilot_contact[\"Company\"] == \"\"\n\n\t #@freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n\t get_custom_fields(autopilot_contact)\n\t if autopilot_event == \"contact_added\"\n\t \t response = contact_added(@freshdesk_data)\n\t elsif autopilot_event == \"contact_updated\"\n\t\t #Rails.logger.info \"Update response from autopilotttttttttttttttttt\"\n\t response = contact_updated(@freshdesk_data, @freshdesk_contact_id)\n\t\t #Rails.logger.debug \"#{response}\"\t\t\n\t end \n\t response.parsed_response.has_key?(\"errors\") ? failure_response(response) : success_response\n\t #rescue Exception => e\n\t #\tputs e.message\n\t #end\n\tend",
"def primary_service_learning_contacts\n u = Unit.find_by_abbreviation(\"carlson\")\n c = contacts.find(:all, :conditions => {:organization_contact_units => {:unit_id => u.id, :primary_contact => true}})\n c.empty? ? position_supervisor_contacts : c\n end",
"def contact\n # STUB\n end",
"def contact_info(contact)\n super # placeholder so that I can add some doc\n end",
"def add_contact(ownnick, person)\n return ret_fail('can not add yourself') if person == ownnick #you cant add yourself !\n\n usr = User.first(:nickname=>person)\n return ret_fail('no such user') if usr == nil #user does not exist !\n\n ownusr = User.first(:nickname => ownnick) #get own record to get the contact list\n return ret_fail('already in list') if ownusr.contacts.first(:userid => usr.id) != nil\n\n c = ownusr.contacts.new\n c.userid = usr.id\n puts usr.id\n puts c.userid\n c.authgiven = 'f'\n c.save\n\n return ret_success\nend",
"def contacts(params = {})\n # contacts in this group\n @contacts = nil\n contacts!\n end",
"def contact_mix_2\n $testCaseID = \"VT229-0020\"\n con_remove\n createContact 20\n @contact = Rho::RhoContact.find(:all, :per_page => 5, :offset => 5, :select => [\"id\", \"last_name\"], :conditions => {:phone => 'is_nil', :email => 'is_nil'})\n puts @contact\n redirect :action => :index\n end",
"def validate\n validates_contact\n end",
"def initialize#(contacts)\n\t\t@contacts = [] #if we have different contacts with the same name we need to add another value to give each contact a unique identifier to differentiate between them\n\tend",
"def contacts\n collection = CapsuleCRM::ContactCollection.new(self,CapsuleCRM::Contact, [])\n collection.concat emails\n collection.concat phone_numbers\n collection.concat websites\n collection.concat addresses\n collection\n end",
"def contacts() @contacts ||= Flickr::Contacts.new(self) end",
"def contact_mix\n $testCaseID = \"VT229-0019\"\n con_remove\n createContact 20\n @contact = Rho::RhoContact.find(:all, :per_page => 5, :offset => 5, :select => [\"id\", \"last_name\"], :conditions => {:phone => 'not_nil', :email => 'not_nil'})\n puts @contact\n redirect :action => :index\n end",
"def initialize #what attritubes\n\t\t@contacts = []\n\tend",
"def initialize\n\t\t@contacts = []\n\t\t#@index = 1000 #1003 for 2 rolodexes with 3 contacts.\n\tend",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def prepare_contacts\n return unless defined? @user\n @user.user_default_emails.sort_by{|a| a.role_id.to_i}\n end",
"def contact_add_check(user, action_user)\n\t\tunless (current_user.id == user.to_i) && (current_user.contacts.where(id: action_user).count == 0)\n\t\t\traise ActionController::RoutingError, 'Not Found'\n\t\tend\n\tend",
"def fetch_contact_info\n lambda {\n user.vet360_contact_info\n }\n end",
"def ur_contact_update\n #skip if all three field are empty\n if params[:ur_contact][:name].blank? && params[:ur_contact][:email].blank? && params[:ur_contact][:telephone].blank? then\n Rails.logger.info \"Zero info on contact for reservation #{params[:user_reservation_id]}. Skipping...\"\n head :ok\n return\n end\n\n #skip if there's no name\n if params[:ur_contact][:name].blank? then\n Rails.logger.info \"Name field is blank. Skipping...\"\n end\n\n #load the user reservation\n ur = UserReservation.find(params[:user_reservation_id])\n\n #skip if the reservation method is online\n if ur.online? then\n Rails.logger.info \"Reservation #{params[:user_reservation_id]} is created online. Skipping...\"\n head :ok\n return\n end\n\n #scenario #1a: ur_contact id is detected\n if !params[:ur_contact][:id].empty? then\n Rails.logger.info \"Linking contact #{params[:ur_contact][:id]} to reservation #{params[:user_reservation_id]}...\"\n\n ur.update_attributes({contact_id:params[:ur_contact][:id], contact_type:params[:ur_contact][:type]})\n\n head :accepted\n return\n end\n\n #screnario #2: current ur has a contact_id, check if it's big change or not\n # if the name is the same, just update the email/telephone, otherwise go to\n if !ur.contact_id.blank? && params[:ur_contact][:id].empty? then\n if ur.contact.name == params[:ur_contact][:name] then\n #sanity checks, the contact type is UrContact and you own it\n if ur.contact_type == \"UrContact\" then\n UrContact.transaction do\n ur.contact.update_attributes({email:params[:ur_contact][:email], telephone:params[:ur_contact][:telephone]})\n end\n head :accepted\n return\n else\n head :ok\n return\n end\n end\n end\n\n #screnario #3: no current contact, or the chages are too big\n # default screnario is to create a new contact and link it\n Rails.logger.info \"Creating new contact for reservation #{params[:user_reservation_id]}...\"\n UrContact.transaction do\n #create the ur contact\n urContact = current_user.ur_contacts.new({name:params[:ur_contact][:name],\n email:params[:ur_contact][:email], telephone:params[:ur_contact][:telephone]})\n if urContact.save then\n ur.update_attributes({contact_id:urContact.id, contact_type:\"UrContact\"})\n head :created\n return\n else\n render json: {errors:urContact.errors.messages}, status: :internal_server_error\n end\n end\n\n end",
"def fetch_contacts\n case params[:importer]\n when OTHER_EMAIL then params[:emails].split(',')\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, LINKEDIN then params[:contacts]\n end\n end",
"def contacts\n contact_client.contacts\n end",
"def contact\n\t\t@contact\n\tend",
"def contact\n\t\t@contact\n\tend",
"def contacts!(params = {})\n # contacts in this group\n @contacts = nil\n contacts\n end",
"def contact_delate_check(user, action_user)\n\t\tunless (current_user.id == user.to_i) && (current_user.contacts.where(id: action_user).count > 0)\n\t\t\traise ActionController::RoutingError, 'Not Found'\n\t\tend\n\tend",
"def index\n ignore = contact_emails_rejected\n @contacts = resource_owner.contacts.reject do |c|\n ignore.include?(c.emailaddress.downcase)\n end.each{ |c| authorize c }\n session[:ret_url] = contacts_path\n end",
"def contact_create(contact)\n super # placeholder so that I can add some doc\n end",
"def contact_create(contact)\n super # placeholder so that I can add some doc\n end",
"def set_contact_method\n\n\tcontact_method = ContactMethod.find_by_contact_method_type_code_and_contact_method_code(self.contact_method_type_code,self.contact_method_code)\n\t if contact_method != nil \n\t\t self.contact_method = contact_method\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'contact_method_type_code' and 'contact_method_code' is invalid- it must be unique\")\n\t\t return false\n\tend\nend",
"def contacts\n\t\t@contact = Contact.first();\n\tend",
"def get_matters_and_contacts\n\t\tget_matters\n\t\tget_all_contacts\n\tend",
"def index\n @invalid_contacts = Contact.last_import.invalid_contact\n @valid_contacts = Contact.last_import.valid_contact\n end",
"def contacts(reload = false)\n self.cache(CostAgent::Contact, :all, reload) do\n (self.api(\"contacts\")/\"contact\").collect do |contact|\n projects = self.projects(:all, reload).select { |p| p.contact_id == (contact/\"id\").first.inner_text.to_i }\n Contact.new(\n :id => (contact/\"id\").first.inner_text.to_i,\n :organisation_name => (contact/\"organisation-name\").first.inner_text,\n :first_name => (contact/\"first-name\").first.inner_text,\n :last_name => (contact/\"last-name\").first.inner_text,\n :address1 => (contact/\"address1\").first.inner_text,\n :address2 => (contact/\"address2\").first.inner_text,\n :address3 => (contact/\"address3\").first.inner_text,\n :town => (contact/\"town\").first.inner_text,\n :region => (contact/\"region\").first.inner_text,\n :country => (contact/\"country\").first.inner_text,\n :postcode => (contact/\"postcode\").first.inner_text,\n :phone_number => (contact/\"phone-number\").first.inner_text,\n :email => (contact/\"email\").first.inner_text,\n :billing_email => (contact/\"billing-email\").first.inner_text,\n :contact_name_on_invoices => (contact/\"contact-name-on-invoices\").first.inner_text == \"true\",\n :sales_tax_registration_number => (contact/\"sales-tax-registration-number\").first.inner_text,\n :uses_contact_invoice_sequence => (contact/\"uses-contact-invoice-sequence\").first.inner_text == \"true\",\n :account_balance => (contact/\"account-balance\").first.inner_text.to_f,\n :projects => projects)\n end\n end\n end",
"def resolve(firstname:,lastname:,phonenumbers:,emails:,twitterusername:)\n begin\n contact = Contact.create({firstname: firstname, lastname:lastname,twitterusername:twitterusername })\n phonenumbers.each do |item| \n phoneNum = {contact_id:contact.id}\n hashItem = Hash item\n Phonenumber.create(phoneNum.merge(hashItem))\n end\n emails.each do |item|\n email = {contact_id:contact.id}\n hashItem = Hash item\n Email.create(email.merge(hashItem))\n end\n rescue ActiveRecord::RecordInvalid => e\n puts \"error adding contact record\"\n {\n contact: nil,\n errorMessage: 'failed to create contact'\n }\n end\n # fetch particular contact you just created and output that\n {contact:Contact.find(contact.id)}\n end",
"def contact\n @contact ||= get_contact(@data_object.user_contact)\n end",
"def initialize\n @contacts = []\n end",
"def initialize\n @contacts = []\n end",
"def populatecontactfields\n #This code is for solving the Edit accounts crash - 14-06-2010\n @account= (params[:account_id].present?? Account.find(params[:account_id]) : Account.new()) \n @contact = Contact.new()\n @contact_stage=@company.contact_stages\n @lead_status=true\n render :partial=>'/common/newcontact',:object=>@contact\n end",
"def build_lookup_belongs(blank = nil)\n # TODO: Remove rescue statement\n @sms_templates = SmsTemplate.find_all_for_select_option('')\n @message_signature = \"\\n--\\n#{self.current_user.display_name.truncate(24)}\"\n @sms_recipients = AddressbookContact.find(:all, :order => 'name ASC')\n \n end",
"def show_contact_details?\n my_record? || add_contact_details? || super_admin?\n end",
"def primary_contact?\n primary_contact.present?\n end",
"def modify_existing_contact\n self.to_contact.modify_existing_contact.to_contact\n end",
"def contacts\n @contacts ||= DebtorContactProxy.new(self)\n end",
"def get_contacts\n\n #@company = Benefits.find.params[:company_id]\n #@contacts = @company.contacts\n\n Rails.logger.warn \"#{:areabenefit_id} jajaxxx\"\n @contacts = Benefit.where(areabenefit_id: params[:areabenefit_id], asistencia: '1')\n end",
"def show\n\n @contact_addresses = @user.contact.contact_addresses\n @extra = @user.extra_detail\n @numbers = @user.contact.phone_numbers\n @agent = ClientAgent.agents(@user).first\n @global_setting = @user.global_setting\n\n if current_user != @user \n if !current_user.is_broker_of?(@user) && @user.has_agent_and_is?(current_user)\n flash[:notice] = \"You can't see this, Sorry\";\n redirect_to(application_cases_path);\n end\n end\n\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def contact\n \t@contact = Contact.new\n end",
"def contact_fields\n if contact_type == 'contact'\n validates_length_of :first_name, minimum: 2, maximum: 20 if validates_presence_of :first_name\n validates_length_of :last_name, minimum: 2, maximum: 20 if validates_presence_of :last_name\n end\n end",
"def case\n @account = @case.account\n # find the account we are grabing contacts from. this is used in the pulldown selection menu.\n if id = params[:from_account]\n @selected_account = Sfaccount.find(id)\n end\n # super users can only add themselves.\n if current_contact.portal_privilege == AppConstants::PRIVILEGE[:super_user]\n @instruction_text = \"Your current access level is \\\"Super User\\\" and you can only subscribe 1 contact: yourself.\"\n @contacts = [current_contact]\n else\n @contacts = (@selected_account || @account).contacts\n if current_contact.portal_privilege == AppConstants::PRIVILEGE[:user_manager]\n @instruction_text = \"Your current access level is \\\"User Manager\\\" and you can subscribe other contacts from your company.\"\n end\n end\n @subscribers = @case.watcher ? @case.watcher.contacts : []\n # set siblings if (a) this account can view child accounts and (b) it has sibling accounts\n @siblings = (@account.portal_case_scope__c == Sfaccount::SCOPES[:children_accounts] and @account.sibling_accounts) ? @account.sibling_accounts.reject { |a| a.contacts(true).empty? } : []\n end",
"def display_contacts\n # Fill this in\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods\n Contact.all.each do |contacts|\n puts \":#{contacts.full_name}, #{contacts.email}, #{contacts.id}, #{contacts.note}\"\n end\n end",
"def contacts\n contacts = params[:contacts].map{|c| c[1]}\n if contacts\n logger.debug \">>> received #{contacts.length} contacts\"\n end\n render :text => \"ok\"\n end",
"def contacts\r\n @contact = @customer.contact_people.find_by_id params[:id]\r\n \r\n # Delete contact\r\n if @contact && params[:method] == \"delete\"\r\n @store_user.my_account_log(@contact,\"Delete Contact #{@contact.name}\")\r\n @contact.destroy\r\n @customer.update_ax( :contacts => [@contact] )\r\n redirect_to :id => nil\r\n end\r\n \r\n # Add or update contact\r\n if request.post? && params[:contact]\r\n @contact ||= @customer.contact_people.build\r\n @contact.attributes = params[:contact]\r\n if @contact.save\r\n redirect_to :id => nil\r\n else\r\n @customer.contact_people.delete @contact\r\n render\r\n end\r\n \r\n # Synchronize customer\r\n @customer.update_ax( :contacts => [@contact] ) if @contact.errors.empty?\r\n @store_user.my_account_log(@contact,\"Add or Update Contact #{@contact.name}\")\r\n end\r\n end",
"def rebuild_accessibilities( emails=nil )\r\n emails ||= self.contact_people.collect{ |contact| contact.email }\r\n emails << self.email\r\n StoreUser.transaction do\r\n StoreUser.update_all( \"erp_account_number = NULL\", [\"erp_account_number = ?\", self.account_num] )\r\n StoreUser.update_all(\r\n \"erp_account_number = '#{self.account_num}'\",\r\n ['email_address in (?)', emails]\r\n ) unless emails.empty?\r\n end\r\n end",
"def contacts\n @contacts ||= @ab.people.map {|abperson| Macabee::Contact.new(abperson, :macabee => self)}\n end",
"def set_contact\n @category = \"Contact\"\n @contact = resource_owner.contacts.find(params[:id])\n end",
"def account\n # find the account we are grabing contacts from\n if id = params[:from_account]\n @selected_account = Sfaccount.find(id)\n end\n # super users can only add themselves.\n if current_contact.portal_privilege == AppConstants::PRIVILEGE[:super_user]\n @instruction_text = \"Your current access level is \\\"Super User\\\" and you can only subscribe 1 contact: yourself.\"\n @contacts = [current_contact]\n else\n @contacts = (@selected_account || @account).contacts\n if current_contact.portal_privilege == AppConstants::PRIVILEGE[:user_manager]\n @instruction_text = \"Your current access level is \\\"User Manager\\\" and you can subscribe other contacts from your company.\"\n end\n end\n # the current subscribers\n @subscribers = @account.watcher ? @account.watcher.contacts : []\n # set siblings if (a) this account can view child accounts and (b) it has sibling accounts\n @siblings = ((@account.portal_case_scope__c == Sfaccount::SCOPES[:children_accounts] and @account.sibling_accounts) ? @account.sibling_accounts.reject { |a| a.contacts(true).empty? } : [])\n \n end",
"def set_primary_contact\n company = Company.find(params[:company_id]) if params[:company_id].present?\n @log_msg = \"Contact \" + company.contact.to_s + \" marked/unmarked as Primary Contact by user \" + current_user.id.to_s if company.present? && params[:primary_contact].present? && company.update_attributes(:contact => params[:primary_contact])\n \n return render :partial => \"contacts\", :locals => {:company_contacts => company.contacts, :company => company} \n end",
"def finished_contacts\n @contacts.where(contact_type: 'PBX').where.not(answered: nil, call_ended: nil, service_id: 120)\n end",
"def initialize\n\t\t@contacts = [] #empty arrary to hold entire contact list.\n\tend",
"def check_contact_info\n @user = current_user\n if @user.invalid?\n return redirect_to edit_user_path(current_user)\n end\n end",
"def contact_update(args)\n super # placeholder so that I can add some doc\n end",
"def contact_update(args)\n super # placeholder so that I can add some doc\n end",
"def print_contacts(contacts)\n\nend"
] |
[
"0.7484399",
"0.7415514",
"0.7192713",
"0.712471",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70585734",
"0.70137876",
"0.70137876",
"0.6983926",
"0.6834389",
"0.68133247",
"0.6704329",
"0.65554345",
"0.6550109",
"0.65181124",
"0.6482372",
"0.6428907",
"0.6428907",
"0.6424972",
"0.627005",
"0.62500566",
"0.6246502",
"0.6227656",
"0.6181897",
"0.61519843",
"0.61485577",
"0.61256737",
"0.6120726",
"0.609401",
"0.60414517",
"0.6031536",
"0.60293925",
"0.6012676",
"0.6011865",
"0.5985675",
"0.5980739",
"0.5971954",
"0.5971954",
"0.5971954",
"0.5971954",
"0.5971954",
"0.59640974",
"0.59524196",
"0.59084165",
"0.5897972",
"0.5894247",
"0.58895564",
"0.5888437",
"0.5888437",
"0.5874599",
"0.587345",
"0.5867545",
"0.5854671",
"0.5854671",
"0.5843376",
"0.58422244",
"0.5839935",
"0.5814104",
"0.58126545",
"0.5806346",
"0.58013135",
"0.57813156",
"0.57813156",
"0.57771564",
"0.5776074",
"0.5771742",
"0.5762632",
"0.57622313",
"0.5757131",
"0.57570875",
"0.5745318",
"0.57406914",
"0.5740678",
"0.5738759",
"0.57373095",
"0.5736173",
"0.5734245",
"0.5727241",
"0.57264423",
"0.57215345",
"0.5721245",
"0.5721236",
"0.5716519",
"0.57139784",
"0.57115436",
"0.569622",
"0.56938976",
"0.56938976",
"0.5692811"
] |
0.0
|
-1
|
depends on contacts, media, checks
|
def migrate_rules
notification_rules_keys = @source_redis.keys('contact_notification_rules:*')
contact_counts_by_id = {}
check_counts_by_id = {}
notification_rules_keys.each do |notification_rules_key|
raise "Bad regex for '#{notification_rules_key}'" unless
notification_rules_key =~ /\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\z/
contact_id = $1
contact = find_contact(contact_id)
contact_num = contact_counts_by_id[contact.id]
if contact_num.nil?
contact_num = contact_counts_by_id.size + 1
contact_counts_by_id[contact.id] = contact_num
end
check_ids = @check_ids_by_contact_id_cache[contact.id]
rules = []
notification_rule_ids = @source_redis.smembers(notification_rules_key)
notification_rule_ids.each do |notification_rule_id|
notification_rule_data = @source_redis.hgetall("notification_rule:#{notification_rule_id}")
time_restrictions = Flapjack.load_json(notification_rule_data['time_restrictions'])
entities = Set.new( Flapjack.load_json(notification_rule_data['entities']))
regex_entities = Set.new( Flapjack.load_json(notification_rule_data['regex_entities']))
tags = Set.new( Flapjack.load_json(notification_rule_data['tags']))
regex_tags = Set.new( Flapjack.load_json(notification_rule_data['regex_tags']))
# collect specific matches together with regexes
regex_entities = regex_entities.collect {|re| Regexp.new(re) } +
entities.to_a.collect {|entity| /\A#{Regexp.escape(entity)}\z/}
regex_tags = regex_tags.collect {|re| Regexp.new(re) } +
tags.to_a.collect {|tag| /\A#{Regexp.escape(tag)}\z/}
media_states = {}
Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|
next if !!Flapjack.load_json(notification_rule_data["#{fail_state}_blackhole"])
media_types = Flapjack.load_json(notification_rule_data["#{fail_state}_media"])
unless media_types.nil? || media_types.empty?
media_types_str = media_types.sort.join("|")
media_states[media_types_str] ||= []
media_states[media_types_str] << fail_state
end
end
media_states.each_pair do |media_types_str, fail_states|
rule = Flapjack::Data::Rule.new
rule.time_restrictions = time_restrictions
rule.conditions_list = fail_states.sort.join("|")
rule.save
media = media_types_str.split('|').each_with_object([]) do |media_type, memo|
medium = contact.media.intersect(:transport => media_type).all.first
memo << medium unless medium.nil?
end
rule.media.add(*media) unless media.empty?
checks_for_rule = Flapjack::Data::Check.intersect(:id => check_ids)
checks = if regex_entities.empty? && regex_tags.empty?
checks_for_rule.all
else
# apply the entities/tag regexes as a filter
checks_for_rule.select do |check|
entity_name = check.name.split(':', 2).first
if regex_entities.all? {|re| re === entity_name }
# copying logic from https://github.com/flapjack/flapjack/blob/68a3fd1144a0aa516cf53e8ae5cb83916f78dd94/lib/flapjack/data/notification_rule.rb
# not sure if this does what we want, but it's how it currently works
matching_re = []
check_tags.each do |check_tags|
matching_re += regex_tags.select {|re| re === check_tag }
end
matching_re.size >= regex_tags.size
else
false
end
end
end
tags = checks.collect do |check|
check_num = check_counts_by_id[check.id]
if check_num.nil?
check_num = check_counts_by_id.size + 1
check_counts_by_id[check.id] = check_num
end
tag = Flapjack::Data::Tag.new(:name => "migrated-contact_#{contact_num}-check_#{check_num}|")
tag.save
check.tags << tag
tag
end
rule.tags.add(*tags) unless tags.empty?
rules << rule
end
end
contact.rules.add(*rules)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def contact; end",
"def contacts\r\n\r\n end",
"def common\n #if Contact.where(:organization_id => current_user.organization.id).any?\n # #@users = current_user.organization.contacts.group_by{|u| u.first_name[0]}\n # @users = Contact.where(:organization_id => current_user.organization.id).order(\"name,first_name\")\n #end\n # Contact.all.each do |contact|\n # contact.update_column :created_by, current_user.id\n # end\n begin\n lastcontact = current_user.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n unless lastcontact.present?\n lastcontact = current_user.organization.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n\n end\n if lastcontact.present?\n if lastcontact && lastcontact.activity_type == \"IndividualContact\"\n @contact = IndividualContact.find(lastcontact.activity_id)\n get_contact_attrs\n elsif lastcontact && lastcontact.activity_type == \"CompanyContact\"\n @contact = CompanyContact.find(lastcontact.activity_id)\n get_contact_attrs\n end\n else\n contacts=current_user.organization.individual_contacts\n @contact = contacts.last\n get_contact_attrs\n end\n rescue ActiveRecord::RecordNotFound\n flash[:bowarning]=\"It seems you don't have sufficient privilege to access this item or something went wrong with your account permissions. Please contact Admin to get this fixed.\"\n #redirect_to contacts_path\n end\n\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact\n end",
"def contact \n\n end",
"def contact\n\n end",
"def contact\n\n end",
"def is_contact?(); @type == GRT_CONTACT; end",
"def scrape_contacts; end",
"def contactus\r\n end",
"def media_status\n super\n end",
"def app_contact\n end",
"def media_company?\n \tperson.profile.type == 'MediaCompany' \t\n end",
"def contact\n # STUB\n end",
"def contactus\n end",
"def transfer_contacts(appdata,customfieldscheck)\n\n puts \"Importing Contacts...\"\n\n #SOURCE APP\n #---------------------------------------\n\n puts \"=> Initializing Source App\"\n #initialize source app\n initialize_infusionsoft(appdata[:src_appname], appdata[:src_apikey])\n\n puts \"=> Getting Source Custom Fields\"\n #get list of contact custom fields\n #then store the list of names in an array to add to fields for lookup\n source_app_custom_fields = get_table('DataFormField')\n contact_fields = []\n contact_fields = FIELDS['Contact'].map(&:clone)\n source_app_custom_fields.each { |cf| contact_fields.push(\"_\" + cf['Name']) if cf['FormId'] == -1 }\n\n puts \"=> Getting Source Contacts\"\n #Option 1\n #________\n #get all contacts from the source app\n all_contacts = get_table('Contact',contact_fields)\n\n #Option 2\n #________\n #get contacts with specific criteria\n #all_contacts = get_table('Contact',contact_fields,{Id: 282589})\n #all_contacts += (get_table('Contact',contact_fields,{OwnerID: 118786}))\n\n #reduce list of custom fields to create by detecting which fields have data\n fields_with_data = []\n all_contacts.each { |c| fields_with_data |= c.keys }\n custom_fields_to_import = fields_with_data.grep(/^_/)\n source_app_custom_fields.reject! { |cf| custom_fields_to_import.exclude? '_' + cf['Name']}\n\n\n puts \"=> Getting Source Opt Outs\"\n #get list of opted out emails\n opted_out_emails = get_table('EmailAddStatus').select { |email| OPT_OUT_STATUSES.include? email['Type'] }\n\n puts \"=> Getting Source Lead Sources\"\n #get list of Lead Sources and Categories from source app\n source_app_lead_source_categories = get_table('LeadSourceCategory')\n source_app_lead_sources = get_table('LeadSource')\n\n puts \"=> Getting Source Users\"\n #get list of users for comparing username to source app\n source_app_users = get_table('User')\n\n puts \"=> Getting Source App Settings\"\n #gets lists of app settings for comparing to dest app, stored as arrays\n source_types = Infusionsoft.data_get_app_setting('Contact','optiontypes').split(',')\n source_titles = Infusionsoft.data_get_app_setting('Contact','optiontitles').split(',')\n source_suffixes = Infusionsoft.data_get_app_setting('Contact','optionsuffixes').split(',')\n source_phonetypes = Infusionsoft.data_get_app_setting('Contact','optionphonetypes').split(',')\n source_faxtypes = Infusionsoft.data_get_app_setting('Contact','optionfaxtypes').split(',')\n\n\n #DESTINATION APP\n #--------------------------------------\n\n #INITIALIZATION\n #______________\n puts \"=> Initializing Dest App\"\n #initialize destination app\n initialize_infusionsoft(appdata[:dest_appname], appdata[:dest_apikey])\n\n #LEAD SOURCE\n #___________\n\n puts \"=> Importing Lead Sources...\"\n\n #creates Lead Sources and Categories if they don't exist\n #Adds all category names and lead source names to hashes to compare\n dest_app_lead_source_categories = {}\n get_table('LeadSourceCategory').each { |cat| dest_app_lead_source_categories[cat['Id']] = cat['Name'] }\n\n dest_app_lead_sources = {}\n get_table('LeadSource').each { |src| dest_app_lead_sources[src['Id']] = src['Name'] }\n\n #adds lead source categories to dest app, and sets the ID of the source app lead source category equal to the category created\n #only adds lead source category if it doesn't already exist in dest app\n category_relationship = {}\n source_app_lead_source_categories.each { |cat|\n category_relationship[cat['Id']] = dest_app_lead_source_categories.key(cat['Name']) || Infusionsoft.data_add('LeadSourceCategory',cat)\n }\n\n #create empty hash with default relationship of 0 to 0\n lead_source_relationship = {0=>0}\n source_app_lead_sources.each do |src|\n #swaps old category ID with new category ID\n src['LeadSourceCategoryId'] = category_relationship[src['LeadSourceCategoryId']] unless src['LeadSourceCategoryId'] == 0\n\n #creates lead source if it doesn't exist by the same name\n lead_source_relationship[src['Id']] = dest_app_lead_sources.key(src['Name']) || Infusionsoft.data_add('LeadSource',src)\n end\n\n #FKID AND CONTACT CUSTOM FIELDS\n #__________________\n\n puts \"=> Importing Custom Fields...\"\n\n #creates Source App Contact and Company ID custom fields if they don't exist\n @@source_app_contact_id = create_custom_field('Source App Contact ID')['Name']\n @@source_app_company_id = create_custom_field('Source App Company ID')['Name']\n\n #create contact custom fields if the custom fields check is true\n #also maps the source app custom fields to any existing custom fields in the dest app\n rename_mapping = {}\n\n source_app_custom_fields.each do |cf|\n #checks if app has ANY custom fields; also skips any of type 25, which is unknown, or when it's not a contact custom field\n next if cf.nil? || cf['DataType'] == 25 || cf['FormId'] != -1\n field = create_custom_field(cf['Label'],0,'Contact',DATATYPES[DATATYPE_IDS[cf['DataType']]]['dataType'],cf['Values'])\n rename_mapping['_' + cf['Name']] = field['Name']\n end if customfieldscheck\n\n\n #switches the 'Id' key to be 'Source App Contact ID'\n #switches the 'CompanyID' key to be 'Source App Company ID'\n rename_mapping['Id'] = @@source_app_contact_id\n rename_mapping['CompanyID'] = @@source_app_company_id\n\n #USERS\n #_____\n puts \"=> Creating User Relationship\"\n #Matches up users based on their 'GlobalUserId' which is the Infusionsoft ID\n users_relationship = create_user_relationship(source_app_users,get_table('User'))\n\n #APP SETTINGS\n #____________\n puts \"=> Generating App Settings Differences\"\n\n #Get differene between source app settings and dest app settings\n $types = source_types - Infusionsoft.data_get_app_setting('Contact','optiontypes').split(',')\n $titles = source_titles - Infusionsoft.data_get_app_setting('Contact','optiontitles').split(',')\n $suffixes = source_suffixes - Infusionsoft.data_get_app_setting('Contact','optionsuffixes').split(',')\n $phonetypes = source_phonetypes - Infusionsoft.data_get_app_setting('Contact','optionphonetypes').split(',')\n $faxtypes = source_faxtypes - Infusionsoft.data_get_app_setting('Contact','optionfaxtypes').split(',')\n\n #CREATE IMPORT TAG\n #_________________\n\n puts \"=> Creating Import Tag...\"\n\n #check if Category and Tag already exist\n existing_cat_id = Infusionsoft.data_query('ContactGroupCategory',1000,0,{'CategoryName' => 'Application Transfer'},['Id'])\n existing_tag_id = Infusionsoft.data_query('ContactGroup',\n 1000,\n 0,\n {'GroupCategoryId' => existing_cat_id.first['Id'], 'GroupName' => \"Data from #{appdata[:src_appname]}\"},\n ['Id']) unless existing_cat_id.to_a.empty?\n\n import_tag_cat_id = existing_cat_id.to_a.empty? ? Infusionsoft.data_add('ContactGroupCategory',{'CategoryName' => 'Application Transfer'}) : existing_cat_id.first['Id']\n import_tag_id = existing_tag_id.to_a.empty? ? Infusionsoft.data_add('ContactGroup',{'GroupCategoryId' => import_tag_cat_id, 'GroupName' => \"Data from #{appdata[:src_appname]}\"}) : existing_tag_id.first['Id']\n\n #GET CONTACTS THAT HAVE ALREADY BEEN TRANSFERRED\n #_______________________________________________\n dest_contacts = get_table(\"Contact\",[@@source_app_contact_id],{@@source_app_contact_id => \"_%\"}).map { |c| c[@@source_app_contact_id]}\n\n #ADD CONTACTS\n #____________\n\n puts \"=> Adding contacts...\"\n\n #adds each contact in the list of contacts to destination app\n #swaps lead source IDs before import to dest app lead source ID\n #swaps user ID to destination app user ID based on users_relationship matching\n dest_emails = []\n all_contacts.each do |contact|\n next if dest_contacts.include? contact['Id'].to_s #skips importing contacts that have previously been transferred\n contact.keys.each { |k| contact[ rename_mapping[k] ] = contact.delete(k).to_s if rename_mapping[k] }\n contact.delete('AccountId')\n contact['LeadSourceId'] = lead_source_relationship[contact['LeadSourceId']]\n contact['OwnerID'] = users_relationship[contact['OwnerID']] || 0\n contact_id = Infusionsoft.contact_add(contact) unless contact[@@source_app_contact_id] == contact[@@source_app_company_id]\n Infusionsoft.contact_add_to_group(contact_id, import_tag_id) unless contact_id.nil?\n dest_emails |= [contact['Email']]\n end\n\n puts \"=> Opting Out Emails\"\n #opt out all emails that were opted out in the source app\n opted_out_emails.each do |email|\n Infusionsoft.email_optout(email, 'Source App Opt Out') if dest_emails.include? email\n end\n\n puts \"Contacts Imported.\"\n end",
"def active_media\n super\n end",
"def parse_contacts\n case params[:importer]\n when GMAIL, YAHOO, HOTMAIL\n request.env['omnicontacts.contacts'].map { |c| [c[:email], c[:email]] }.to_json\n when LINKEDIN then fetch_linkedin_contacts\n end\n end",
"def contact_info(contact)\n super # placeholder so that I can add some doc\n end",
"def media_resource?\n true\n end",
"def media\n super\n end",
"def media_type; end",
"def media_type; end",
"def news_and_media\n # blank\n end",
"def modify_contact\n\n end",
"def process_attachment\n return true unless d = parsed_attachment_data\n\n case self.attachment_type\n when 'link', 'generic'\n # Parse generic attachment attributes into string for the message attribute\n if self.message.blank?\n mesg = ''\n mesg << \"#{d['name']}\\n\" unless d['name'].blank?\n mesg << \"#{d['caption']}\\n\" unless d['caption'].blank?\n mesg << \"#{d['description']}\\n\" unless d['description'].blank?\n self.update_attribute(:message, mesg) unless mesg.blank?\n end\n when 'photo'\n # Add photo to be downloaded if it is a photo from a facebook album.\n # requires the backup_source object, which means this object must be created AND\n # associated with its activity_stream (from which we derive the member attribute, \n # then the facebook backup source object, phew!)\n if facebook_photo? && !backup_photo && member\n # add to album (create one if necessary)\n # need to retrieve our facebook backup source object for album creation\n begin\n # If photo doesn't belong to this user, use a catch-all photo album \n # to store them\n bs = member.backup_sources.facebook.first\n album = if d['photo']['owner'] != member.facebook_id.to_s\n # This sucks...why doesn't find_or_create work with extra attributes?\n BackupPhotoAlbum.find_or_create_facebook_friends_album(bs.id)\n else\n BackupPhotoAlbum.find_or_create_by_backup_source_id_and_source_album_id(bs.id, d['photo']['aid'])\n end\n\n # If Facebook is trying to be sneaky and only passing the small thumbnail image, \n # we replace _s with _n to get the larger image instead. This will definitely \n # bite us in the ass when FB changes formats.\n d['src'].gsub!(/_s\\.jpg$/, '_n.jpg')\n \n BackupPhoto.create(:backup_photo_album => album,\n :source_photo_id => d['photo']['pid'],\n :source_url => d['src'],\n :caption => self.message)\n rescue\n logger.error \"FacebookActivityStreamItem::process_attachment exception: \" + $!\n raise\n end\n end\n end\n true\n end",
"def attachment; end",
"def contacts() @contacts ||= Flickr::Contacts.new(self) end",
"def case_media_list\n\t\t@case_media_attachments = @surgery_case.case_media.case_media_attachments\n\tend",
"def media_sfp\n super\n end",
"def check_content_phone_invitations\n if phone_number.present? && phone_number_changed?\n ContentPhoneInvitation.search_and_run_emailprayer_invitations_for(self)\n ContentPhoneInvitation.search_and_run_prayer_invitations_for(self)\n ContentPhoneInvitation.search_and_run_answer_invitations_for(self)\n end\n if (phone_number.present? && phone_number_changed?) || email_changed?\n ContentPhoneInvitation.search_and_run_church_invitations_for(self)\n end\n end",
"def additional_info\n @contact=Contact.find_by_id(params[:id])\n @contact.attributes = {:name=>params[:name],:comment=>params[:comments],:phone_number =>params[:phone] }\n if @contact.save && ( simple_captcha_valid? || params[:field] == \"skip\" )\n UserMailer.delay.contact_us(@contact)\n render :update do |page|\n page.replace_html \"get_started2\", :partial => \"thanks_page\"\n page.call \"load_completer\"\n end\n else\n render :update do |page|\n page.replace_html \"error_msg\",\"Image and text were different\"\n page.replace_html \"name_error_msg\", \"Provide a valid name\" if !@contact.errors[:name].blank?\n page.replace_html \"phone_error_msg\", \"Provide a valid Phone Number\" if !@contact.errors[:phone_number].blank?\n page.call \"load_completer\"\n end\n end\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 show\n #@socialmediasite = current_login.socialmediasites.find(session[:ssid])\n busprofile = @socialmediasite.sssearchby\n if busprofile == 'business phone'\n busprofile = Business.first.bphone.first\n else\n busprofile = Business.first.bname.gsub(/\\s+/,\"+\")\n end\n\n if @socialmediasite.ssname.downcase.include? \"twitter\"\n @app_url = [@socialmediasite.ssurl, \"#{busprofile}\", @socialmediasite.ssurlquery, @socialmediasite.ssaccesstoken, @socialmediasite.ssaccesstokensecretkey, @socialmediasite.ssconsumerkey, @socialmediasite.ssconsumersecret].compact.join(\"\") || \"http://news.google.com\"\n begin\n @news = twitter_client.search(\"#{busprofile}\").take(100)\n if @news.blank?\n # @news = OpenStruct.new(:code => nil, :message => \"Invalid domain or authentication\")\n @news_code = 404\n @news_message = \"Invalid authentication\"\n\n else\n @news_body = @news\n @news_code = 200\n @news_message = \"ok\"\n end \n end\n else\n if @socialmediasite.ssname.downcase.include? \"google\"\n @app_url = [@socialmediasite.ssurl, \"#{busprofile}\", @socialmediasite.ssaccesstoken, @socialmediasite.ssaccesstokensecretkey, @socialmediasite.ssconsumerkey, @socialmediasite.ssconsumersecret].compact.join(\"\") || \"http://news.google.com\"\n # for google needs 2 passes for place detail search, this is the 1st pass\n \n gethttp\n # check the result after 1st pass\n if @news.message.downcase.include? \"ok\"\n result=JSON.parse(@news_body)\n temp = Ssdmapping.recursive_select(\"place_id\", result)\n unless temp.blank?\n # flash[:alert] = temp[0]\n temp.each do |v|\n #flash[:alert] = \"#{v['value']}\"\n #find the placeid should only be the first one\n @placeid = \"#{v['value']}\" if @placeid.nil?\n end\n #2nd pass after obtaining the placeid from the 1st pass\n @app_url = [@socialmediasite.ssurlquery, @placeid, @socialmediasite.ssaccesstoken, @socialmediasite.ssaccesstokensecretkey, @socialmediasite.ssconsumerkey, @socialmediasite.ssconsumersecret].compact.join(\"\") || \"http://news.google.com\"\n end\n end\n else \n @app_url = [@socialmediasite.ssurl, \"#{busprofile}\", @socialmediasite.ssurlquery, @socialmediasite.ssaccesstoken, @socialmediasite.ssaccesstokensecretkey, @socialmediasite.ssconsumerkey, @socialmediasite.ssconsumersecret].compact.join(\"\") || \"http://news.google.com\"\n end\n gethttp\n end\nend",
"def process_media_items(user)\n can :read, MediaItem do |item|\n item.user == user || (item.assignment && can?(:read, item.assignment))\n end\n\n can :manage, MediaItem do |item|\n item.user == user || (item.assignment && can?(:manage, item.assignment))\n end\n end",
"def create\n @contact = Contact.new\n old_user=User.where(\"email=?\",params[:contact][:contact_email]).last\n @contact.user_id=session[:user].user_id\n @contact.contact_email=params[:contact][:contact_email]\n @contact.contact_name=params[:contact][:contact_name]\n @contact.avatar=params[:contact][:avatar]\n @contact.app_user_id= old_user.user_id if !old_user.nil?\n @contact.contact_from= \"myapp\" \n @contact.contact_type= old_user ? \"member\" : \"non_member\"\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def register_share_visibilities(contact)\n #should have select here, but proven hard to test\n posts = Post.where(:author_id => contact.person_id, :public => true).limit(100)\n p = posts.map do |post|\n ShareVisibility.new(:contact_id => contact.id, :shareable_id => post.id, :shareable_type => 'Post')\n end\n ShareVisibility.import(p) unless posts.empty?\n nil\n end",
"def photos\n @album = Album.find(params[:id])\n \n unless read_fragment(:part => \"photos_#{@album.id}\")\n @photos = @album.photos\n @has_photos = @photos.length != 0\n end\n\n#if request.user_agent.downcase.include? \"google\"\n# UserMailer.notify_admins(\"Album photos for #{@album.title} has been requested by a google bot\").deliver\n# end\n\n respond_to do |format|\n format.html { render :layout => false}\n format.xml { render :xml => @user }\n end\n end",
"def check_mixed_resources\n end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def contact; Contact.get(self.contact_id); end",
"def ur_contact_update\n #skip if all three field are empty\n if params[:ur_contact][:name].blank? && params[:ur_contact][:email].blank? && params[:ur_contact][:telephone].blank? then\n Rails.logger.info \"Zero info on contact for reservation #{params[:user_reservation_id]}. Skipping...\"\n head :ok\n return\n end\n\n #skip if there's no name\n if params[:ur_contact][:name].blank? then\n Rails.logger.info \"Name field is blank. Skipping...\"\n end\n\n #load the user reservation\n ur = UserReservation.find(params[:user_reservation_id])\n\n #skip if the reservation method is online\n if ur.online? then\n Rails.logger.info \"Reservation #{params[:user_reservation_id]} is created online. Skipping...\"\n head :ok\n return\n end\n\n #scenario #1a: ur_contact id is detected\n if !params[:ur_contact][:id].empty? then\n Rails.logger.info \"Linking contact #{params[:ur_contact][:id]} to reservation #{params[:user_reservation_id]}...\"\n\n ur.update_attributes({contact_id:params[:ur_contact][:id], contact_type:params[:ur_contact][:type]})\n\n head :accepted\n return\n end\n\n #screnario #2: current ur has a contact_id, check if it's big change or not\n # if the name is the same, just update the email/telephone, otherwise go to\n if !ur.contact_id.blank? && params[:ur_contact][:id].empty? then\n if ur.contact.name == params[:ur_contact][:name] then\n #sanity checks, the contact type is UrContact and you own it\n if ur.contact_type == \"UrContact\" then\n UrContact.transaction do\n ur.contact.update_attributes({email:params[:ur_contact][:email], telephone:params[:ur_contact][:telephone]})\n end\n head :accepted\n return\n else\n head :ok\n return\n end\n end\n end\n\n #screnario #3: no current contact, or the chages are too big\n # default screnario is to create a new contact and link it\n Rails.logger.info \"Creating new contact for reservation #{params[:user_reservation_id]}...\"\n UrContact.transaction do\n #create the ur contact\n urContact = current_user.ur_contacts.new({name:params[:ur_contact][:name],\n email:params[:ur_contact][:email], telephone:params[:ur_contact][:telephone]})\n if urContact.save then\n ur.update_attributes({contact_id:urContact.id, contact_type:\"UrContact\"})\n head :created\n return\n else\n render json: {errors:urContact.errors.messages}, status: :internal_server_error\n end\n end\n\n end",
"def contact_info(xml)\n super # placeholder so that I can add some doc\n end",
"def contact_update(args)\n super # placeholder so that I can add some doc\n end",
"def contact_update(args)\n super # placeholder so that I can add some doc\n end",
"def create\n contacts = fetch_contacts\n case params[:importer]\n when LINKEDIN then send_linkedin_message(contacts)\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, OTHER_EMAIL then send_emails(contacts)\n when FACEBOOK then current_user.increase_invites_count!(params[:sended_invites].to_i)\n end\n redirect_after_send\n end",
"def apply_omniauth(omniauth)\n if omniauth['provider'] == 'facebook'\n\n #Buscar info\n self.email = omniauth['info']['email']\n self.name = omniauth['info']['name']\n\n #location é composto por \"Cidade, Pais\"\n if omniauth['info']['location'] != nil\n location = omniauth['info']['location'].split(\", \")\n else\n location = ''\n end\n #location = omniauth['info']['location'].split(\", \")\n\n #buscar cidade do location\n\n city = City.find_by city: location[0]\n if city != nil\n \tself.city = city\n end\n\n\n #buscar imagem\n #if omniauth['info']['image']!=nil\n # self.avatar = URI.parse(omniauth['info']['image'])\n #end\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n elsif omniauth['provider'] == 'twitter'\n #Buscar info\n self.name = omniauth['info']['name']\n\n #buscar cidade do location\n city = City.find_by city: omniauth['info']['location']\n if city != nil\n \tself.city = city\n end\n\n #buscar imagem\n #if omniauth['info']['image']!=nil\n # self.avatar = URI.parse(omniauth['info']['image'])\n #end\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n elsif omniauth['provider'] == 'google_oauth2'\n #Buscar info\n self.email = omniauth['info']['email']\n self.name = omniauth['info']['name']\n\n #Google não contem cidade\n\n omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end\n\n end",
"def show\n @social1 = Social.where(id: params[:id])\n if user_signed_in?\n @urls = []\n @location = GeoIP.new('lib/GeoLiteCity.dat').city(current_user.current_sign_in_ip)\n # @location = GeoIP.new('lib/GeoLiteCity.dat').city('110.136.133.185')\n @socials = Social.where(city: @location.city_name)\n @contact_author = User.where(name: @social.creator)\n @photo = @social.photos.where(default: true)\n videos = @social.media_urls.map(&:url)\n images = @social.photos.map(&:image_url)\n media_urls = images + videos\n media_urls.each do |url|\n if url.match(Regexp.union(/youtube.com/, /vimeo.com/))\n video = VideoInfo.new(url)\n @urls << video.thumbnail_small\n elsif url.match(/soundcloud.com/)\n soundcloud = HTTParty.get(\"http://api.soundcloud.com/resolve.json?url=#{url}&client_id=8f624be8e4a0dbb19d303b829a85501b\")\n @urls << soundcloud.parsed_response['artwork_url']\n else\n @urls << url\n end\n end\n else\n @socials = Social.all\n @photo = @social.photos.where(default: true)\n @contact_author = User.where(name: @social.creator)\n end\n end",
"def contact_create(contact)\n super # placeholder so that I can add some doc\n end",
"def contact_create(contact)\n super # placeholder so that I can add some doc\n end",
"def refresh\n self.first_name, self.last_name, self.email =\n @redis.hmget(\"contact:#{@id}\", 'first_name', 'last_name', 'email')\n self.media = @redis.hgetall(\"contact_media:#{@id}\")\n self.media_intervals = @redis.hgetall(\"contact_media_intervals:#{self.id}\")\n self.media_rollup_thresholds = @redis.hgetall(\"contact_media_rollup_thresholds:#{self.id}\")\n\n # similar to code in instance method pagerduty_credentials\n if service_key = @redis.hget(\"contact_media:#{@id}\", 'pagerduty')\n self.pagerduty_credentials =\n @redis.hgetall(\"contact_pagerduty:#{@id}\").merge('service_key' => service_key)\n end\n end",
"def audios_test\n end",
"def checks; end",
"def who_we_are\r\n end",
"def sharing \n end",
"def show\n @provider_comment = ProviderComment.new\n @appointment = @provider.appointments.build\n @provider_comments = @provider.provider_comments.paginate(:page => params[:page], :per_page => 6)\n @provider_attachments = @provider.provider_attachments.all\n\n\nif @provider.provider_attachments.present?\nprepare_meta_tags(title: @provider.nombre,\n description: @provider.productos, \n keywords: @provider.tags\n)\nend\n\n\n end",
"def attach; end",
"def send_im(fromnick,tonick,message)\n return ret_fail('can not send IM to yourself') if fromnick==tonick #self-explainatory\n\n usr = User.first(:nickname=>fromnick) #find own record\n return ret_fail('own user not found') if usr == nil #must be error\n\n tousr = User.first(:nickname=>tonick)\n return ret_fail('addressee not found') if tousr == nil #must be error\n\n contact = usr.contacts.first(:userid => tousr.id)\n return ret_fail('not in list') if contact == nil #that nick is not in contact list!\n\n\n if message['type'] != 'auth_request' #Normal message\n return ret_fail('not authorized') if contact.authgiven != 't' #failure: not authorized!\n else #its an authorization request!\n return ret_fail('already given') if contact.authgiven == 't' #already has permission!\n return ret_fail('already sent') if contact.authgiven == 'p' #already sent a request!\n\n #ok... its a valid auth request... so set state to 'p' and update db record\n contact.authgiven = 'p' #awaiting to be answered\n contact.save\n end\n\n #append message to addressees message queue, update database record\n msg = tousr.messages.new\n msg.data = JSON.generate({'from'=>fromnick, 'message'=>message})\n msg.save\n\n return ret_success\nend",
"def set_contact\n @contact = Contact.find(params[:id])\n @extend_demography = @contact.extend_informations\n add_breadcrumb @contact, @contact\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def get_external_data\n @wikipedia_data = wikipedia_data\n @imdb_data = imdb_data\n @fullcontact_data = fullcontact_data if shop.social_scans_remaining > 0\n true if @wikipedia_data || @imdb_data || @fullcontact_data\n end",
"def fetch_contacts!\n create_agent\n prepare\n scrape_contacts\n end",
"def get_matters_and_contacts\n\t\tget_matters\n\t\tget_all_contacts\n\tend",
"def show\n @user = User.find(params[:user_id])\n @mycontact = Mycontact.find(params[:mycontact_id])\n # @meetings = @mycontact.meetings\n @meeting = Meeting.find(params[:id])\n @userfiles = @meeting.userfiles\n end",
"def show\n @user = User.find(params[:id])\n if @user.facebook\n @friends = @user.facebook.get_connections(\"me\", \"friends\")\n @friends.each do |face| \n id = face[\"id\"]\n if FacebookFriend.where(:facebook_id => id, :user_id => current_user.id).exists?\n else\n name = face[\"name\"]\n friend = FacebookFriend.new(:name => name, :facebook_id => id, :user_id => current_user.id)\n friend.save\n end\n end\n @facefriends = FacebookFriend.where(:user_id => current_user.id).asc(:name)\n #would be nice if this was kept to just the exists clause, OC, check contact.rb clear_delete method\n @facefriends = @facefriends.any_of({ :contact_id.exists => false }, { :contact_id => \"\" }) \n end\n #@friends.sort_by{|e| e[\"name\"]}\n \n if @user.linkedin\n @connections = @user.linkedin.connections\n @connections = @connections.all\n @connections.each do |connection|\n\tid = connection.id\n if LinkedinConnection.where(:linkedin_id => id, :user_id => current_user.id).exists?\n else\n name = connection.first_name + \" \" + connection.last_name\n if connection.id != \"private\"\n connection = LinkedinConnection.new(:name => name, :linkedin_id => id, :user_id => current_user.id)\n connection.save\n end\n end\n end\n @linkedin = LinkedinConnection.where(:user_id => current_user.id).asc(:name)\n @linkedin = @linkedin.any_of({ :contact_id.exists => false }, { :contact_id => \"\" }) \n end\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :user, :json => @user }\n end\n end",
"def content_methods; end",
"def matter_contact_records\n get_comp_id = get_company_id\n @contacts = Contact.get_contact_records(current_company,get_comp_id) \n @matters = Matter.get_matter_records(get_comp_id, get_employee_user_id)\n end",
"def get_in_touch_process\n require \"net/http\"\n\trequire \"uri\"\n @contact_us = Contact.new(contact_params)\n respond_to do |format|\n if @contact_us.valid? && @contact_us.valid_with_captcha? # if main site model validates the params data and captcha \n contact_info = params[:contact]\n userIP = request.remote_ip\n\t\tsetURL = \"http://www.geoplugin.net/json.gp?ip=\"+userIP\n\t\turi = URI.parse(setURL)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\trequest = Net::HTTP::Get.new(uri.request_uri)\n\t\tresponse = http.request(request)\n\t\tdata = JSON.parse(response.body)\n\t\tcontact_info['location'] = data['geoplugin_city']+', '+data['geoplugin_region']+', '+data['geoplugin_countryName']\n\t\t \t\t\t\t\t\n if contact_info[:email].present? && contact_info[:message].present?\n if UserMailer.get_in_touch(contact_info).deliver #sending email through user mailer function \n format.json {render json: {'response' => 'email_success'}}\n else\n format.json {render json: {'response' => 'email_failed'}}\n end \n end\n else \n format.json { render json: @contact_us.errors } # if model does not validate true, then sending model errors as response in json format\n end\n end\n end",
"def get_links(blob)\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Entering\")\n link = []\n\n if !blob[\"link\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding link #{blob[\"link\"]}\")\n\n link = ::Api::Helpers::Parser.get_documents({:text => blob[\"link\"]})\n\n #reset the mime to system type. give higher priority to mime found by our system\n mime = ::Api::Helpers::Parser.map_type_to_mime(blob[\"type\"])\n\n link[0][:mime] = mime if mime != AppConstants.mime_remote_link\n\n link[0][:description] = blob[\"description\"]\n link[0][:title] = blob[\"name\"]\n\n link[0][:provider] =~ /facebook.com/ ? link[0][:ignore] = true : link[0][:ignore] = false\n\n link[0][:source_object_id] = blob[\"object_id\"]\n\n #extract image_url\n if !blob[\"picture\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] CGI EXTRACTION #{cgi}\")\n\n u = URI.unescape(blob[\"picture\"])\n cgi = CGI::parse(u)\n\n #internal images are encoded in src(fbcdn) and external are encoded in\n url = cgi[\"url\"]\n url = cgi[\"src\"] if url.blank?\n\n\n if !cgi.blank? and !url.blank?\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding Picture Url #{link[0][:image_url]} \")\n\n link[0][:image_url] = url[0]\n link[0][:image_width] = cgi[\"w\"][0] if !cgi[\"w\"].blank?\n link[0][:image_height] = cgi[\"h\"][0] if !cgi[\"h\"].blank?\n end\n end\n end\n\n #attach embedded links also link array\n #duplicate document is removed in create_activity\n if !blob[\"message\"].blank?\n\n embedded_links = ::Api::Helpers::Parser.get_documents({:text => blob[\"message\"]})\n if link.blank?\n link = embedded_links if !embedded_links.blank?\n else\n embedded_links.each do |elem|\n #remove duplicates ..\n #give priority to attr[links] as they will be mostly resolved\n next if link[0][:url] == elem[:url]\n link << elem\n end\n end\n end\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Leaving \")\n link\n rescue => e\n Rails.logger.error(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] **** RESCUE **** => #{e.message} for #{blob.inspect}\")\n return []\n end",
"def support_multiple_source?; end",
"def set_callbacks\n validate :merge_media_errors\n before_save :remove_old_media\n end",
"def index\n\t\tcase_media = current_user.case_media.map(&:case_media_attachments).flatten.map{|attachment| attachment if attachment.attachment_type=='image'}.compact\n\t # check condition for case media is present or not.\n\t\tif case_media.present?\n\t\t# response to the JSON\n\t render json: { success: true, response: case_media.map(&:attachment).as_json }\n\t else\n\t render :json=> { success: false, message: \"Media are not present\" },:status=> 203\n\t end \n\tend",
"def controlled_resources\n @controlled_resources ||= if params[:media_name]\n super.where(type: singular_linked_media_type)\n else\n super\n end\n end",
"def social_promo\n\n\t @artist = Artist.find_by_url_slug(params[:url_slug])\n\n\t #params set with Query strings\n\n\t if params[:object] == \"album\"\n\t\t @album = Album.find(params[:song_album_or_event_id])\n\n @object_name = @album.al_name\n @promo_url = artist_show_album_url(@artist.url_slug,@album.album_url_slug)\n @object_image = @album.art\n\n @album\n\n\t\t #in application controller\n\t\t album_social(@artist,@album)\n\n\t elsif params[:object] == \"song\"\n\n\t\t #in application controller\n\t\t @song = Song.find(params[:song_album_or_event_id])\n\n @object_name = @song.song_name\n @promo_url = artist_show_song_url(@artist.url_slug,@song.song_url_slug)\n @object_image = @song.image\n\n\t\t song_social(@artist,@song)\n\t end\n\n\t #overides the album and or song default facebook url. For the social promo page, you have to like the artist. this is b/c following an artist is like subscribing to their content\n\t facebook_url(@artist)\n\n\t respond_to do |format|\n\t\t format.html\n\t\t format.xml\n\t\t format.json {\n\t\t\t render :json => {\n\t\t\t\t\t :success => true,\n\t\t\t\t\t :\"#content\" => render_to_string(\n\t\t\t\t\t\t\t :action => 'social_promo.html.erb',\n\t\t\t\t\t\t\t :layout => false\n\t\t\t\t\t ),\n\t\t\t }\n\t\t }\n\n\t end\n end",
"def attach_support!\n attachments.inline['phone.png'] = email_cdn_file '/img/phone.png'\n attachments.inline['voicemail.png'] = email_cdn_file '/img/voicemail.png'\n end",
"def import\n if request.post?\n login = params[:email].to_s\n password = params[:password].to_s\n begin\n case params[:lib]\n when \"gmail.com\"\n @contacts = Contacts::Gmail.new(login, password)\n when \"yahoo.com\"\n @contacts = Contacts::Yahoo.new(login, password)\n when \"yahoo.co.in\"\n @contacts = Contacts::Yahoo.new(login, password)\n when \"hotmail.com\"\n @contacts = Contacts::Hotmail.new(login+\"@hotmail.com\", password)\n when \"aol.in\"\n @contacts = Contacts::Aol.new(login+\"@aol.in\", password)\n else\n @contacts = Contacts::Plaxol.new(login, password)\n end\n @contacts = @contacts.contacts\n\n rescue\n flash.now[:error] = I18n.t('contact.import.error')\n render :action => \"index\"\n return\n end\n for contact in @contacts\n email = params[:lib] == 'hotmail.com' ? contact[0].to_s.strip : contact[1].to_s.strip\n name = params[:lib] == 'hotmail.com' ? contact[1].to_s.strip : contact[0].to_s.strip\n if !ImportedContact.exists?(:email => email, :user_id => current_user.id)\n ImportedContact.new(:user_id => current_user.id, :name => name.to_s, :email => email).save\n end\n end\n redirect_to user_contacts_path(current_user)\n return\n end\n render :action => \"index\"\n end",
"def requests_manage\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\t@requests = ContactRequest.project_contact.need_contact\r\n\r\n\t\t\trender layout: 'layout_back'\r\n\t\tend",
"def private; end",
"def create\r\n if verif_admin\r\n\t @contact = Contact.new(params[:contact])\r\n\t \r\n\t respond_to do |format|\r\n\t\t if @contact.save\r\n\t\t\t if (params[:fichier] != \"\")\r\n\t\t\t File.open(\"#{RAILS_ROOT}/public/images/contacts/\"+@contact.firstname+@contact.lastname+\".jpg\", \"wb\") do |f| \r\n\t\t\t\t f.write(params[:fichier].read)\r\n\t\t\t end\r\n\t\t\t @contact.picture = @contact.firstname+@contact.lastname+\".jpg\"\r\n\t\t\t @contact.save\r\n\t\t end\r\n\t\t\t flash[:notice] = 'Contact was successfully created.'\r\n\t\t\t format.html { redirect_to(@contact) }\r\n\t\t\t format.xml { render :xml => @contact, :status => :created, :location => @contact }\r\n\t\t else\r\n\t\t\t format.html { render :action => \"new\" }\r\n\t\t\t format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\r\n\t\t end\r\n\t end\r\nelse\r\n\tredirect_to :controller => 'admins', :action => 'index'\r\nend \r\n end",
"def index\n @user = User.find(params[:user_id])\n @mycontact = Mycontact.find(params[:mycontact_id])\n @meeting = Meeting.find(params[:meeting_id])\n if @meeting\n @userfiles = @meeting.userfiles\n else\n @userfiles = Userfile.all\n end\n end",
"def show_contact_details?\n my_record? || add_contact_details? || super_admin?\n end",
"def show\n @message = Message.with_attached_images.friendly.find(params[:id])\n @comments = Message.friendly.find(params[:id]).comments\n case\n when params[:locale] == \"en\"\n @message_name = @message.en_name\n @message_content = @message.en_content\n @message_external_rich_links = @message.en_external_rich_links\n @message_action_item = @message.en_action_item\n when params[:locale] == \"zh_TW\"\n @message_name = @message.zh_tw_name\n @message_content = @message.zh_tw_content\n @message_external_rich_links = @message.zh_tw_external_rich_links\n @message_action_item = @message.zh_tw_action_item\n when params[:locale] == \"zh_CN\"\n @message_name = @message.zh_cn_name\n @message_content = @message.zh_cn_content\n @message_external_rich_links = @message.zh_cn_external_rich_links\n @message_action_item = @message.zh_cn_action_item\n when params[:locale] == \"vi\"\n @message_name = @message.vi_name\n @message_content = @message.vi_content\n @message_external_rich_links = @message.vi_external_rich_links\n @message_action_item = @message.vi_action_item\n when params[:locale] == \"hmn\"\n @message_name = @message.hmn_name\n @message_content = @message.hmn_content\n @message_external_rich_links = @message.hmn_external_rich_links\n @message_action_item = @message.hmn_action_item\n end\n up_likes\n down_likes\n end",
"def ensure_others\n self.description ||= self.title\n self.url ||= \"http://www.google.com\"\n self.image_url ||= \"https://s33.postimg.cc/pjju7pp9b/shire.jpg\"\n end",
"def before_save \n \n #\n # upload bundle image\n #\n if( @uploadfile )\n \n # clean up first all existing image files\n [\"jpeg\", \"gif\", \"png\"].each do |ext| \n f = fq_bundle_image_filename( ext )\n if File.exists?(f) \n File.delete(f)\n end\n end\n \n # write the upload file\n extention = @uploadfile.content_type.gsub(/^image\\//, '').downcase.chomp\n out = File.open( fq_bundle_image_filename( extention ), \"w\" )\n out.write( @uploadfile.read )\n out.close\n \n # integrate link in description\n desc = self.description \n # filter operations can be inserted later on\n updated_img_lnk = \"[[File:#{bundle_resouce_file_name}.#{extention}]]\"\n desc = desc.gsub( /\\[\\[file:.*?\\.((jpeg)|(jpg)|(png)|(gif))\\]\\]/i, updated_img_lnk )\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" + updated_img_lnk\n end\n self.description = desc\n end\n\n\n #\n # copy prompt sample for bundle description (/upload/audio)\n #\n if( @sample_file_id )\n audio_source = AudioSource.find_by_file_id( @sample_file_id, :conditions => { :bundle_source_id=>self.id } )\n logger.info( @sample_file_id )\n if( audio_source )\n # copy file\n audio_source = audio_source.fq_mp3_filename\n audio_target = \"public/upload/audio/\" + bundle_resouce_file_name + \".mp3\"\n \n %x[cp #{audio_source} #{audio_target}]\n sample_prompt_file_tag = \"[[File:#{bundle_resouce_file_name}.mp3]]\"\n \n # integrate prompt sample in description\n desc = self.description\n desc = desc.gsub( /\\[\\[file:.*?\\.((mp3))\\]\\]/i, sample_prompt_file_tag )\n\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" +sample_prompt_file_tag\n end\n \n self.description = desc \n end\n end\n\n end",
"def show\n @message = Message.find_by(id: params[:id])\n\tif isEntityOwner?(@message) and params[:preview_mode] == 'true'\n\t\t#themes part\n\t\t#@theme = Theme.find_by(id: @message.theme_id, status_id: ([1, 3]))\n #@photo_album = @message.photo_album\n #@photo = Photo.find_by(id: @message.photo_id, status_id: 1)\n\t\t#if @theme != nil\n\t\t#\t@title = @header = \"Ответы на сообщение от #{@message.created_at.to_s(:ru_datetime)}\"\n\t\t#\t@path_array = [\n\t\t#\t\t\t\t\t {:name => 'Клубная жизнь', :link => '/visota_life'},\n\t\t#\t\t\t\t {:name => @theme.topic.name, :link => topic_path(@theme.topic)},\n\t\t#\t\t\t {:name => @theme.name, :link => theme_path(@theme)},\n\t\t#\t\t\t {:name => @title, :link => ''}\n\t\t#\t\t\t ]\n\t\t#end\n\t\t#themes part end\n\t\t#photos part\n #if @photo_album != nil\n # if @photo != nil\n #\t\t\t@title = @header = \"Комментарий к фото\"\n #\t\t\t@path_array = [\n # {:name => 'Медиа', :link => '/media'},\n\t\t# {:name => 'Фотоальбомы', :link => '/media?t=albums&c=all'},\n\t\t# {:name => @photo_album.category_name, :link => \"/media?t=albums&c=#{@photo_album.category_id}\"},\n\t\t# {:name => @photo_album.name,:link => photo_album_path(@photo_album)},\n # {:name => @title}\n #\t\t\t\t\t ]\n # else\n \t#\t\t@title = @header = \"Комментарий к фотоальбому\"\n # \t\t@path_array = [\n # {:name => 'Медиа', :link => '/media'},\n #\t\t\t\t\t\t {:name => 'Фотоальбомы', :link => '/media?t=albums&c=all'},\n #\t\t\t\t\t\t {:name => @photo_album.category_name, :link => \"/media?t=albums&c=#{@photo_album.category_id}\"},\n #\t\t\t\t\t\t {:name => @photo_album.name, :link => photo_album_path(@photo_album)},\n # {:name => @title}\n #\t\t\t\t\t ]\n # end\n\t\t#end\n\n\t\t#photos part end\n\t\t#videos part\n\t\t#@video = Video.find_by(id: @message.video_id)\n\t\t#if @video != nil\n\t\t#\t@title = \"Ответы комментарий от #{@message.created_at.to_s(:ru_datetime)}\"\n\t\t#\t@path_array = [\n\t\t#\t\t\t\t\t{:name => 'Видео', :link => videos_path},\n\t\t#\t\t\t\t\t{:name => @video.category_name, :link => videos_path(:c => @video.category_path)},\n\t\t#\t\t\t\t\t{:name => @video.alter_name, :link => video_path(@video)},\n\t\t#\t\t\t\t\t{:name => @title, :link => '/'}\n\t\t#\t\t\t\t ]\n\t\t#end\n\t\t#videos part end\n\t\t#@messages = @message.get_visible_tread\n\t\trespond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render :json => @message }\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end"
] |
[
"0.6366829",
"0.59400487",
"0.5905234",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58620995",
"0.58468467",
"0.57976425",
"0.57976425",
"0.57802975",
"0.5773208",
"0.57536185",
"0.5703567",
"0.56273997",
"0.55645424",
"0.55151004",
"0.5502847",
"0.54947805",
"0.54911685",
"0.547196",
"0.5456485",
"0.545473",
"0.54358757",
"0.54132444",
"0.54132444",
"0.5406654",
"0.5339265",
"0.53141946",
"0.5313275",
"0.52897364",
"0.52510333",
"0.5240463",
"0.52267164",
"0.5214808",
"0.5193113",
"0.5193113",
"0.51784974",
"0.5171328",
"0.5164128",
"0.51601547",
"0.5148874",
"0.5147485",
"0.51313055",
"0.51313055",
"0.51313055",
"0.51313055",
"0.51313055",
"0.51206005",
"0.5104636",
"0.5099194",
"0.5099194",
"0.5097795",
"0.50960386",
"0.50826174",
"0.5078427",
"0.5078427",
"0.50763035",
"0.5062653",
"0.5059053",
"0.505289",
"0.5045743",
"0.50451654",
"0.50373673",
"0.50248563",
"0.5019907",
"0.5000183",
"0.4992862",
"0.4992294",
"0.4991303",
"0.49893868",
"0.4981239",
"0.4969722",
"0.49654397",
"0.4955058",
"0.49477518",
"0.4944811",
"0.49346456",
"0.49260038",
"0.49243918",
"0.49178976",
"0.49148333",
"0.49050435",
"0.4903968",
"0.49037585",
"0.48999456",
"0.48969162",
"0.4895446",
"0.4894854",
"0.48939005",
"0.48909804"
] |
0.0
|
-1
|
Variables that do not depend on the environment name.
|
def simple_variables
strong_memoize(:simple_variables) do
scoped_variables(environment: nil)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end",
"def extract_environment_variables! #:nodoc:\n args.delete_if do |arg|\n next unless arg.match(/^(\\w+)=(.*)$/)\n ENV[$1] = $2\n end\n end",
"def env_vars\n @env ||= calculate_env_vars\n end",
"def env_brine_vars\n ENV.select{|k, v| k.start_with? 'BRINE_VAR_'}\n .transform_keys{|k| k.delete_prefix 'BRINE_VAR_' }\n end",
"def environment_variables\n global_variables = @config.environment_variables\n process_vars = @config.process_options[@name] ? @config.process_options[@name]['env'] || {} : {}\n process_local_vars = @config.local_process_options[@name] ? @config.local_process_options[@name]['env'] || {} : {}\n global_variables.merge(process_vars.merge(process_local_vars)).each_with_object({}) do |(key, value), hash|\n hash[key.to_s] = value.to_s\n end\n end",
"def getVariablesToInstantiate\n return {\n :ProjectUnixName => 'myproject'\n }\n end",
"def env_vars\n {\n \"VMWARE_USER\" => auth.userid || \"\",\n \"VMWARE_PASSWORD\" => auth.password || \"\",\n \"VMWARE_HOST\" => auth.host || \"\"\n }\n end",
"def variables\n {\n 'customId' => @custom_id,\n 'environmentName' => @app_env,\n 'programmingLanguage' => 'RUBY',\n 'workflowName' => @workflow_name\n }\n end",
"def private_env_vars\n {\n 'DISCONTINUE_API' => \"http://#{ENV['MACHINE_IP']}:8080\",\n 'AWS_REGION' => build.build_config.aws_region,\n 'S3_BUCKET' => build.build_config.aws_cache_bucket,\n 'AWS_ACCESS_KEY_ID' => build.build_config.aws_access_key,\n 'AWS_SECRET_ACCESS_KEY' => build.build_config.aws_access_secret,\n }\n end",
"def filtered_env; end",
"def global_variables() end",
"def calculate_env_vars\n found = Beaker::Options::OptionsHash.new\n found = found.merge(format_found_env_vars(collect_env_vars(ENVIRONMENT_SPEC)))\n found[:answers] = select_env_by_regex('\\\\Aq_')\n\n found.delete_if { |_key, value| value.nil? or value.empty? }\n found\n end",
"def env_vars_prefix\n self.class.parent.name.underscore.upcase.tr('/', '_')\n end",
"def hacked_env\n @hacked_env ||= {}\n end",
"def env_vars\n {\n \"AWS_ACCESS_KEY_ID\" => auth.userid || \"\",\n \"AWS_SECRET_ACCESS_KEY\" => auth.password || \"\",\n \"AWS_SECURITY_TOKEN\" => auth.auth_key\n }.delete_nils\n end",
"def variables\n context.variables.keys - context.allowed_variables\n end",
"def forward_local_env(env_variable_patterns); end",
"def suppress_env_vars(*vars, &block)\n cache = {}\n vars.each do |var|\n cache[var] = ENV[var]\n end\n\n begin \n vars.each do |var|\n ENV[var] = nil\n end\n yield block\n ensure\n cache.each_pair do |key, value|\n ENV[key] = value\n end\n end\n end",
"def var_names\n @var_names ||= eval \"local_variables\", get_binding\n end",
"def _env(e_name)\n __t_stringish(e_name)\n _jinja.env[__attribute_key(e_name)]\n end",
"def original_env; end",
"def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end",
"def export_dynatrace_app_environment_variables\n profiled_dir = File.join(@app_dir, '.profile.d')\n FileUtils.mkdir_p(profiled_dir)\n\n variables = {}\n variables[RUXIT_APPLICATION_ID] = application_id\n variables[RUXIT_HOST_ID] = host_id\n\n env_file_name = File.join(profiled_dir, '0dynatrace-app-env.sh')\n env_file = File.new(env_file_name, 'w')\n variables.each do |key, value|\n env_file.puts(\"export #{key}=\\\"${#{key}:-#{value}}\\\"\") # \"${VAR1:-default value}\"\n end\n env_file.close\n end",
"def env_vars\n env = {\n \"ANSIBLE_NET_USERNAME\" => auth.userid || \"\",\n \"ANSIBLE_NET_PASSWORD\" => auth.password || \"\",\n \"ANSIBLE_NET_AUTHORIZE\" => auth.authorize ? \"1\" : \"0\"\n }\n\n env[\"ANSIBLE_NET_AUTH_PASS\"] = auth.become_password || \"\" if auth.authorize\n env[\"ANSIBLE_NET_SSH_KEYFILE\"] = network_ssh_key_file if auth.auth_key\n env\n end",
"def get_apollo_variables(env)\n\tapollo_env_vars = {}\n\tapollo_prefix = /^APOLLO_/\n\n\tenv.each { |key, value|\n\t\tif key.match(apollo_prefix)\n\t\t\tkey_name = key.gsub(apollo_prefix, '').to_sym\n\t\t\tapollo_env_vars[key_name] = value\n\t\tend\n\t}\n\n\treturn apollo_env_vars\nend",
"def env_name(key); end",
"def local_env(body)\n env = ''\n vtmp = @var.dup\n vtmp[:pub_rsa] = '[PUBLIC RSA KEY]'\n vtmp[:prv_rsa] = '[PRIVATE RSA KEY]'\n vtmp[:user_keys] = @var[:user_keys].collect { |k,_| k }\n vtmp.each { |k,v| env << \"#{(k.to_s + ' '*20)[0,20]} => #{v.inspect}\\n\" }\n _notice \" -- Current Environment Variables --\\n#{env}\"\nend",
"def get_vars(instruction)\n dictionary = {\n 'definition' => ['os_type_id','iso_file','boot_cmd_sequence','postinstall_files'],\n 'kickstart' => ['reponame','pkgs'],\n 'preseed' => ['suite','pkgs'],\n 'autoinst' => ['pkgs']\n }\n # 'kickstart_file' option in definition.rb is deprecated\n # erb_vars = ['os_type_id','iso_file','boot_cmd_sequence','kickstart_file','postinstall_files']\n return dictionary[instruction]\n end",
"def static_env; end",
"def static_env; end",
"def static_env; end",
"def registered_env_vars\n @registered_env_vars = @registered_env_vars || {}\n end",
"def registered_env_vars\n @registered_env_vars = @registered_env_vars || {}\n end",
"def default_environment_variables\n environment_variables.select &:default\n end",
"def env_values\n @parse[@env] || @parse[@env.to_s] || {}\n end",
"def env_secret name\n if (path = ENV[\"#{name}_FILE\"])\n if File.readable? path\n return File.read(path).strip\n else\n raise \"The file pointed to by #{name}_FILE is not readable!\"\n end\n end\n\n ENV[name]\nend",
"def from_env\r\n return if not @name\r\n @owner = true\r\n replace( ENV[@name] )\r\n end",
"def load_vars\n config = YAML.load_file(@config_file)\n @dev_port = config[\"development\"][\"port\"] ||= @default_dev_port\n @dev_pid = config[\"development\"][\"pid\"] ||= @default_dev_pid\n @dev_log = config[\"development\"][\"log\"] ||= @default_dev_log\n @prod_port = config[\"production\"][\"port\"] ||= @default_prod_port\n @prod_pid = config[\"production\"][\"pid\"] ||= @default_prod_pid\n @prod_log = config[\"production\"][\"log\"] ||= @default_prod_log\nend",
"def get_env(key)\n\n end",
"def env_key; end",
"def unset_bundler_env_vars\n empty_env = with_environment { with_unbundled_env { ENV.to_h } }\n aruba_env = aruba.environment.to_h\n (aruba_env.keys - empty_env.keys).each do |key|\n delete_environment_variable key\n end\n empty_env.each do |k, v|\n set_environment_variable k, v\n end\n end",
"def env_without_bundler(env)\n re = /\\ABUNDLE|RBENV|GEM/\n\n bundler_keys = env.select { |var, _| var.to_s.match(re) }.keys\n bundler_keys.reduce({}) do |hash, (k, _)|\n hash[k] = nil\n hash\n end\n end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def clean_env_vars\n envs = %w(\n REPORT_SERVICE_SELF_URL REPORT_SERVICE_URL REPORT_SERVICE_TOKEN\n )\n envs.each { |e| ENV.delete(e) }\nend",
"def required_environment_variables\n environment_variables.select &:required\n end",
"def env_vars\n { \"OS_CLIENT_CONFIG_FILE\" => os_credentials_file }\n end",
"def load_envvars\n Pkg::Params::ENV_VARS.each do |v|\n if var = ENV[v[:envvar].to_s]\n case v[:type]\n when :bool\n self.instance_variable_set(\"@#{v[:var]}\", Pkg::Util.boolean_value(var))\n when :array\n self.instance_variable_set(\"@#{v[:var]}\", string_to_array(var))\n else\n self.instance_variable_set(\"@#{v[:var]}\", var)\n end\n end\n end\n end",
"def xgetenv(name)\n if ENV.key?(name) then\n return ENV[name]\n end\n $stderr.printf(\"environment variable %p not defined - maybe you need to run 'loadvs'\\n\")\n exit(1)\nend",
"def environment_names\n @environment_names ||= [nil] + env.tags.collect {|name, tag| tag['environment']}.compact\n end",
"def prep_variables\n end",
"def apply_variables_to_environment!(options = {})\n variables_to_apply = variables.except(\"RACK_ENV\", \"RAILS_ENV\")\n \n variables_to_apply.each do |key, value|\n if !ENV.has_key?(key.to_s) || options[:overwrite] == true\n ENV[key.to_s] = value.to_s\n end\n end\n \n variables_to_apply\n end",
"def env=(environment); end",
"def env=(environment); end",
"def generic_envs\n\t\t\treturn [\"production\", \"sandbox\"]\n\t\tend",
"def option_from_env(name)\n ViteRuby.env[\"#{ ViteRuby::ENV_PREFIX }_#{ name.upcase }\"]\n end",
"def env\n %w[INSTALLATION=1] + extra_env\n end",
"def ignore_env_proxy; end",
"def ignore_env_proxy; end",
"def ignore_env_proxy; end",
"def local_variables() end",
"def ndvars\n vars.reject(&:distinguished?)\n end",
"def ndvars\n vars.reject(&:distinguished?)\n end",
"def ndvars\n vars.reject(&:distinguished?)\n end",
"def environment\n return @vars unless @vars.nil?\n\n # If not set, Try to find them...\n glob_path = File.join(@deployment_home, @settings.env_file_glob_path)\n regexp_find = glob_path.gsub(/\\*/, '(.*)')\n Dir[glob_path].each do | file_name |\n # Get the environment name from the file part of the glob path:\n # e.g. given ./environments/ci_mgt/kb8or.yaml\n # get ci_mgt from ./environments/*/kb8or.yaml\n /#{regexp_find}/.match(file_name)\n env_name = $1\n if env_name == @env_name\n debug \"env=#{env_name}\"\n # Ensure we set the defaults as vars BEFORE we add environment specifics:\n @vars = @settings.defaults\n env_vars = Context.resolve_env_file(file_name)\n @vars = @vars.merge(env_vars)\n @vars = @vars.merge(@overridden_vars)\n @vars['env'] = env_name\n @environment_file = file_name\n break\n end\n end\n # Now finaly, update the settings now we know the environment!\n unless @vars\n @vars = {}\n end\n @settings = @settings.new(@vars)\n update_k8context\n debug \"vars=#{vars}\"\n @vars\n end",
"def env\r\n original_env.merge(hacked_env)\r\n end",
"def fetch_variable(var_name, required: false)\n raise \"#{var_name} is a required variable\" if ENV[var_name].nil? && required\n\n return false if ENV[var_name] && ENV[var_name].downcase == 'false'\n ENV[var_name]\nend",
"def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end",
"def env(variable_name, variable_value, &block); end",
"def environment_variables\n return [] unless options[\"environment_variables\"]\n options[\"environment_variables\"].map do |options|\n EnvironmentVariable.new options\n end\n end",
"def environment\n verify_environment\n ENV['ENV']\nend",
"def vars\n @vars ||= soln.keys\n @vars\n end",
"def env_defaults\n DataCache.env_defaults\n end",
"def variables\n {}\n end",
"def thread_variables\n _locals.keys\n end",
"def get_variables (fei_or_wfid=nil)\n\n return get_expression_pool.fetch_engine_environment.variables \\\n unless fei_or_wfid\n\n fetch_exp(fei_or_wfid).get_environment.variables\n end",
"def capture_variables(line)\n noncomment, _ = line.split(\"#\", 2)\n noncomment.scan(/ENV(?:\\[|\\.fetch\\()['\"]([^'\"]+)['\"]/).flatten\n end",
"def get_environment_strings\n env_ptr = GetEnvironmentStringsW()\n\n # pass :invalid => :replace to the Ruby String#encode to use replacement characters\n pairs = env_ptr.read_arbitrary_wide_string_up_to(65534, :double_null, { :invalid => :replace })\n .split(?\\x00)\n .reject { |env_str| env_str.nil? || env_str.empty? || env_str[0] == '=' }\n .reject do |env_str|\n # reject any string containing the Unicode replacement character\n if env_str.include?(\"\\uFFFD\")\n Puppet.warning(_(\"Discarding environment variable %{string} which contains invalid bytes\") % { string: env_str })\n true\n end\n end\n .map { |env_pair| env_pair.split('=', 2) }\n Hash[ pairs ]\n ensure\n if env_ptr && ! env_ptr.null?\n if FreeEnvironmentStringsW(env_ptr) == FFI::WIN32_FALSE\n Puppet.debug \"FreeEnvironmentStringsW memory leak\"\n end\n end\n end",
"def initialize_from_env\n conf_prefix = self.env_variable_prefix.upcase\n\n ENV.keys.reject { |key|\n key !~ /^#{conf_prefix}/ # Ignore everything that doesn't match the prefix\n }.each { |key|\n variable = key[conf_prefix.size..-1].downcase\n\n self.store(variable, ENV[key])\n }\n\n after_initialize\n dump\n end",
"def environ\n case environment\n when 'production' then :prd\n when 'staging' then :stg\n when 'test' then :tst\n when 'development' then :dev\n end\n end"
] |
[
"0.7047515",
"0.6882864",
"0.68726313",
"0.6766753",
"0.6686882",
"0.6574362",
"0.6564002",
"0.65490276",
"0.65183884",
"0.6507424",
"0.6490663",
"0.6482867",
"0.64455396",
"0.63930196",
"0.6390161",
"0.6377418",
"0.63727313",
"0.6349514",
"0.6337908",
"0.6326876",
"0.63033116",
"0.6284374",
"0.6268996",
"0.6268677",
"0.62666696",
"0.62209576",
"0.62175643",
"0.6210621",
"0.61924684",
"0.61924684",
"0.61924684",
"0.6187336",
"0.6187336",
"0.6168187",
"0.6166279",
"0.6156826",
"0.6156395",
"0.6130154",
"0.6129156",
"0.6122882",
"0.61166686",
"0.6106903",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6104067",
"0.6103488",
"0.6101792",
"0.60888547",
"0.60887164",
"0.6088051",
"0.6084465",
"0.60671335",
"0.6047229",
"0.60436857",
"0.60436857",
"0.6023884",
"0.6021285",
"0.6015035",
"0.60049087",
"0.60049087",
"0.60049087",
"0.6004901",
"0.5997519",
"0.5997519",
"0.5997519",
"0.5987633",
"0.5985311",
"0.5981691",
"0.5969386",
"0.5957066",
"0.59522897",
"0.5944474",
"0.5944149",
"0.59378064",
"0.5935456",
"0.59079456",
"0.59006155",
"0.5900366",
"0.5899905",
"0.5898901",
"0.5879882"
] |
0.6407643
|
13
|
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) Space Complexity: O(n^2)
|
def top_k_frequent_elements(list, k)
return [] if list == []
hash = Hash.new(0)
counter = 0;
list.each do |value|
hash[value] = [] if hash[value].nil?
hash[value]+=1
end
if k > hash.size()
raise ArgumentError, "Not Enough Values to Display"
end
solution = hash.max(k){ |a, b| b<=>a}
p solution
numbers = []
solution.each do |array|
numbers << array[0]
end
return numbers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 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 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 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 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 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 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 # 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 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 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 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 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?\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\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 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 return [] if list.empty?\n \n element_count = {}\n \n list.each do |element|\n if element_count[element].nil?\n element_count[element] = 1\n else\n element_count[element] += 1\n end\n end\n \n sorted_elements = element_count.sort_by(&:first)\n \n i = 0\n max_nums = []\n k.times do\n max_nums << sorted_elements[i][0]\n i += 1\n end\n \n return max_nums\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 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_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 # 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 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 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 # 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(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 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 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 \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 # 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 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 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 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 # 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 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_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 k_largest_elements(array, k)\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 most_common_value(a)\n a.group_by do |e|\n e\n end.values.max_by(&:size).first\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 k_largest_elements2(array, k) \n result = BinaryMinHeap.new\n k.times do\n result.push(array.pop)\n end\n until array.empty?\n result.push(array.pop)\n result.extract\n end\n result.store\nend",
"def find_k_biggest_number(array, k)\n numbers = []\n\n array.each do |element|\n numbers << element if numbers.size < k\n if element > numbers.min\n numbers.delete(numbers.min)\n numbers.push(element)\n end\n end\n\n numbers\nend",
"def find_key(cipher)\n (0..2).map do |offset|\n # Create a sublist starting at the given offset, taking every 3rd element\n elems = cipher.values_at(*(offset..cipher.length).step(3))\n # Find the most common item\n item = elems.group_by { |x| x }.values.max_by { |vs| vs.size }.first\n # We assume it's an int representing the ord of the space character\n item ^ \" \".ord\n end\nend",
"def k_select(a, start, fin, k)\n # fin is last index in array range\n # partition, if ind swapped is == k, then kth element\n if start == fin\n return a[start]\n end\n \n a, idx = random_partition(a, start)\n part_kth_largest = fin - idx + 1\n if part_kth_largest == k\n return a[idx]\n elsif k > part_kth_largest\n return k_select(a, start, idx - 1, k - part_kth_largest)\n else\n return k_select(a, idx + 1, fin, k)\n end\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 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 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_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 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 top_3\n freq_hash = each_with_object(Hash.new(0)) { |v, h| h[v] += 1 }\n freq_hash.sort_by { |k, v| -v }.first(3).map(&:first)\n end",
"def find_kth_largest(nums, k)\n min, max = nums[0], nums[0]\n nums.each {|x| \n min = [min, x].min\n max = [max, x].max\n }\n while min <= max \n mid = (min + max) / 2\n count = 0;\n nums.each{|x| count += 1 if x >= mid}\n if count >= k\n min = mid + 1\n else\n max = mid - 1\n end\n end\n return max\nend",
"def kth_largest(arr, k, left = 0, right = arr.length - 1)\n if k > 0 && k <= right - left + 1\n pivot = partition(arr, left, right)\n if right - pivot == k - 1\n return arr[pivot]\n end\n\n if right - pivot > k - 1\n return kth_largest(arr, k, pivot + 1, right)\n end\n# [1,2,3,4,5]\n# if pivot is arr[2]\n# then k is k - (right - pivot + 1)\n kth_largest(arr, k - right + pivot - 1, left, pivot - 1)\n end\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 returnK(list, k)\n count = list.count\n target = count - k\n list.each_with_index do |link, j|\n if j == target\n return link\n end\n end\nend",
"def find_kth_largest(nums, k)\n nums.shuffle!\n helper(nums, 0, nums.length-1, k)\nend",
"def frequent_itemsets\n k = 2\n l = [nil, large_one_itemsets]\n\n # Transform itemsets into a mapping of tid to {Itemset}\n tid_itemsets = database.map do |tid, items|\n [tid, items.map do |item|\n l[k - 1].find { |itemset| itemset.items[0] == item }\n end.compact.to_set]\n end\n\n until l[k - 1].empty?\n cks = gen(l[k - 1])\n kth_tid_itemsets = Hamster::Hash[{}]\n\n tid_itemsets.each do |tid, set_of_itemsets|\n # Find candidate itemsets in ck contained in the transaction\n cts = set_of_itemsets.flat_map do |ck_1|\n ck_1.extensions.select do |ck|\n ck.generators.subset?(set_of_itemsets)\n end\n end.to_set\n\n # Register the support for each transaction candidate\n cts.each { |ct| ct.support += 1 }\n\n # Update the transaction candidate list for the next k value\n kth_tid_itemsets = kth_tid_itemsets.merge(tid => cts) unless cts.empty?\n end\n\n l[k] = cks.select { |candidate| candidate.support >= min_support }\n tid_itemsets = kth_tid_itemsets.map do |tid, cts|\n [tid, cts.select { |c| l[k].include?(c) }.to_set]\n end\n\n k += 1\n end\n\n l.flatten.compact.map(&:to_h)\n end",
"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 kth_largest(arr, k)\n curr = 0\n h = Heap.new\n\n k.times do \n h.insert(arr[curr])\n curr += 1\n end\n\n while curr < arr.length \n if arr[curr] > h.peek\n h.remove\n h.insert(arr[curr])\n end\n\n curr += 1\n end\n\n h.remove\nend",
"def k_largest(a,k)\n\treturn if a == nil || a.size == 0\t\n\tmin_heap = MinHeap.new() # Initialize a min heap.\n\tcount = 0\n\tresult = [] # REsult array to store output.\n\tfor i in 0..a.size-1 do\n\t\t# Insert element in min heap and increment count.\n\t\tmin_heap.insert(a[i])\n\t\tcount = count + 1\n\t\t# If count is greater than k, then pop element from heap and decrement count.\n\t\t# Note: to implement heap, we have taken first element in heap as nil.\n\t\tif count == k+1\n\t\t\tmin_heap.pop\n\t\t\tcount = count -1\n\t\tend\n\tend\n\t# When whole array is traversed, pop every element from heap and insert in result array.\n\twhile !min_heap.empty? do\n\t\tpoppped_item = min_heap.pop\n\t\tresult << poppped_item\n\tend\n\treturn result.reverse # Return by reversing result array as elements are in ascending order.\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 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 k_closest(points, k)\n arr = points.map { |point| [euclidean_distance(point, [0, 0]), point] }.sort\n\n res = []\n k.times { res << arr.delete_at(0)[1] }\n res\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 findKth(nums1,nums2,k)\nend",
"def most_common_number(arr)\n max = 0\n arr.each do |el|\n max = el if arr.count(el) > max\n end\n max\nend",
"def use_KNN(training, prediction, k_number = 5)\r\n y = []\r\n distances = []\r\n training.each do |vector|\r\n y.push(vector.pop)\r\n distances.push(calculate_distance(prediction, vector))\r\n end\r\n k_first = []\r\n\r\n k_number.times do\r\n index = distances.index(distances.min)\r\n k_first.push(y[index])\r\n\r\n distances.delete_at(index || distances.length)\r\n y.delete_at(index || distances.length)\r\n end\r\n\r\n result = k_first.max_by { |i| k_first.count(i) }\r\n return result\r\nend",
"def majority_element(nums)\n counter_hash = Hash.new(0)\n\n nums.each do |num|\n counter_hash[num] += 1\n end\n\n counter_hash.find { |k,v| v == counter_hash.values.max }.first\nend",
"def find_kth_largest(nums, k)\n nums.sort[-k]\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 calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end",
"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 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 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 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 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 smallest_k(ranges, k)\nend",
"def kth_largest(arr, k)\n return nil if k > arr.length\n heaped, remaining = arr[0..k-1], arr[k..-1]\n heap = Heap.new(heaped)\n remaining.each do |n|\n if n > heap.top \n heap.pop!\n heap.push(n)\n end\n end\n heap.top\nend",
"def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend",
"def choose(n, k)\n return [[]] if n.nil? || n.empty? && k == 0\n return [] if n.nil? || n.empty? && k > 0\n return [[]] if n.size > 0 && k == 0\n c2 = n.clone\n c2.pop\n new_element = n.clone.pop\n choose(c2, k) + append_all(choose(c2, k-1), new_element)\n end",
"def maximumToys(prices, k)\n counter = 0\n prices.sort.each do |price|\n if (price <= k)\n counter += 1\n k -= price\n else\n break\n end\n end\n counter\nend",
"def electionsWinners(votes, k)\n m = votes.max\n m_count = 0\n winners = votes.select{|x|\n m_count += 1 if m == x\n x+k > m }.size\n if( 0 == winners)\n 1 == m_count ? 1 : 0\n else \n winners\n end\nend",
"def quickselect(lst, k)\n if lst.size <= 1\n return lst[0]\n else\n medians = []\n lst.each_slice(5).to_a.each{|g| medians << g.sort[g.size/2]}\n pivot = quickselect(medians, lst.size/10)\n left, right = lst.select{|x| x < pivot}, lst.select{|x| x > pivot}\n l = left.size\n if k == l + 1\n return pivot\n elsif k <= l\n return quickselect(left, k)\n else\n return quickselect(right, k-l-1)\n end\n end\nend",
"def faster_frequent_words(text, k)\n # FasterFrequentWords(Text , k)\n # FrequentPatterns ← an empty set\n # FrequencyArray ← ComputingFrequencies(Text, k)\n # maxCount ← maximal value in FrequencyArray\n # for i ←0 to 4**k − 1\n # if FrequencyArray(i) = maxCount\n # Pattern ← NumberToPattern(i, k)\n # add Pattern to the set FrequentPatterns\n # return FrequentPatterns\n\n # Input: A string Text and an integer k.\n # Output: All most frequent k-mers in Text.\n\n # Sample Input:\n # ACGTTGCATGTCGCATGATGCATGAGAGCT\n # 4\n\n # Sample Output:\n # CATG GCAT\n\n frequent_patterns = []\n frequency_array = frequency_array(text, k)\n max_count = 0\n frequency_array.each {|count| max_count = count if count > max_count }\n (0..(4**k - 1)).each do |i|\n if frequency_array[i] == max_count\n pattern = number_to_pattern(i,k)\n frequent_patterns << pattern\n end\n end\n\n return frequent_patterns\n end",
"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 find_1(arr, k)\n l = arr.length\n result = []\n arr.each_index do |i|\n (i+1).upto(l-1) do |j|\n result << [arr[i], arr[j]] if (arr[i] + arr[j]) == k\n end\n end\n result\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 most_frequent(nums)\n hash = {}\n max_occurence = 0\n\n nums.each do |num|\n if !hash.has_key?(num.to_s)\n hash[num.to_s] = 1\n else\n hash[num.to_s] += 1\n if max_occurence < hash[num.to_s] \n max_occurence = hash[num.to_s]\n end\n end\n end\n\n hash.select { |key, value| value == max_occurence }\n .map { |key, value| key.to_i} \nend",
"def mode(array)\n frequency = Hash.new\n array.each do |x|\n array.count(x)\n frequency[x] = array.count(x)\n end\n\n most_frequent = Array.new\n max = frequency.max_by { |x, y| y}\n min = frequency.min_by { |x, y| y}\n if min == max\n frequency.each do |x,y| \n most_frequent = most_frequent.push(x)\n end\n else\n most_frequent[0] = max[0]\n end\n return most_frequent\nend",
"def getKth(nums1, nums2, k)\n p \"nums1: #{nums1} nums2: #{nums2} k: #{k}\"\n\n return nums2[k] if nums1.size == 0\n return nums1[k] if nums2.size == 0\n\n mid1 = nums1.size / 2\n mid2 = nums2.size / 2\n\n if nums1[mid1] > nums2[mid2]\n return getKth(nums2, nums1, k)\n end\n\n if mid1 + mid2 + 1 > k\n return getKth(nums1, nums2[0...mid2], k)\n else\n return getKth(nums1[mid1+1..-1], nums2, k - mid1 - 1)\n end\nend",
"def mode array\n greatestRepeats = 0\n frequent = []\n array.each do |current|\n totalCurrent = array.count current\n puts \"For \" + current.to_s + \" we have found: \" + totalCurrent.to_s + \" repeats\"\n if totalCurrent > greatestRepeats\n counter = 0\n while frequent.length > 0 #wipe frequent\n frequent.delete(counter)\n counter += 1\n end\n greatestRepeats = totalCurrent\n frequent.push current\n elsif totalCurrent == greatestRepeats && totalCurrent > 0 #add without wiping frequent\n frequent.push current\n end\n end\n\n frequent.uniq\nend",
"def k_closest_points(arr, k)\n temp = []\n \n arr[0..k-1].each do |coords|\n temp << Math.sqrt((coords[0] ** 2 + coords[1] ** 2))\n end\n\n arr[k..-1].each do |coords|\n distance = Math.sqrt((coords[0] ** 2 + coords[1] ** 2))\n\n max_idx = 0\n temp.each_with_index { |temp_dist, i| max_idx = i if temp_dist > temp[max_idx] }\n\n temp[max_idx] = distance if distance < temp[max_idx]\n end\n\n temp\nend",
"def majority_element(nums)\n return nums.first if nums.size == 1\n return nums.sort[nums.size/2]\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(list)\n my_hash = {}\n list.each do |item| \n if my_hash[item]\n my_hash[item] += 1\n else\n my_hash[item] = 1\n end\n end\n max_count = my_hash.values.max\n my_hash.select { |key, value| value == max_count }.keys\nend",
"def select_actors_greedy(k, r, n, actor_list)\n # pick the actor with the most movies as first actor\n result_a = [0]\n result_m = actor_list[0][1].clone\n result_q = result_m.length\n\n # store the indexes of actors that are still being considered\n actor_indexes = Array(1..n)\n\n # pick the remaining k-1 actors (since 1st has been picked)\n 1.upto(k-1) do |i|\n best_index = actor_indexes[0] # first actor still being considered\n best_q = result_q\n best_m = result_m.clone\n\n # examine all the actors still being considered\n for index in actor_indexes do\n # optimisation\n # don't go on if the remaining actors are too small to improve on\n # the currently found best quality\n break if result_q + actor_list[index][1].length < best_q\n\n # get all the movies that the actors are in (without duplicates)\n c_movies = best_m.clone | actor_list[index][1]\n\n # replace if better than previous solution\n if c_movies.length > best_q\n best_index = index\n best_q = c_movies.length\n best_m = c_movies\n end\n end\n\n # take the best found solution\n result_a << best_index\n result_q = best_q\n result_m = best_m\n actor_indexes.delete(best_index)\n end\n\n # convert actor ID to actor names\n return result_a.map { |i| actor_list[i][0] }\nend",
"def find_smallest_common_number(a1, a2, a3)\n a1i = 0\n a2i = 0\n a3i = 0\n\n while a1i < a1.size && a2i < a2.size && a3i < a3.size\n return a1[a1i] if (a1[a1i] == a2[a2i]) && (a1[a1i]== a3[a3i])\n min = [a1[a1i], a2[a2i], a3[a3i]].min\n if min == a1[a1i]\n a1i += 1\n elsif min == a2[a2i]\n a2i += 1\n else\n a3i += 1\n end\n end\n return nil\nend",
"def find_k(k,arr)\n\t#need to sort the array\n\t#then can do negative index to find it\n\t#we can use quicksort\n\tdriver(lt,rt)\n\t#its sorted\n\t#then find the kth element, easy\n\tk = k * -1\n\tarr[k]\nend"
] |
[
"0.8254349",
"0.82195437",
"0.82076234",
"0.81828433",
"0.81789684",
"0.81527865",
"0.8146139",
"0.8143594",
"0.8132496",
"0.81318384",
"0.81297475",
"0.81083286",
"0.8103692",
"0.8087182",
"0.8085673",
"0.8078475",
"0.8044227",
"0.8034774",
"0.8007754",
"0.7993153",
"0.79674107",
"0.7963166",
"0.79605174",
"0.79603606",
"0.7952181",
"0.7952181",
"0.7952181",
"0.7952181",
"0.79507554",
"0.7950652",
"0.7946596",
"0.79240334",
"0.7911055",
"0.7910605",
"0.7882328",
"0.784643",
"0.78037786",
"0.775235",
"0.72071284",
"0.7064262",
"0.67202955",
"0.6535297",
"0.6504108",
"0.63899285",
"0.63485104",
"0.6289479",
"0.6250555",
"0.6178074",
"0.6159311",
"0.61543727",
"0.61414844",
"0.60510814",
"0.60283834",
"0.6018189",
"0.6004882",
"0.6002298",
"0.5972559",
"0.59670293",
"0.59388226",
"0.5930231",
"0.59255534",
"0.591448",
"0.59113026",
"0.59006",
"0.5898314",
"0.5890842",
"0.586753",
"0.58449626",
"0.5832974",
"0.5828308",
"0.58209515",
"0.5813126",
"0.5801431",
"0.5794644",
"0.57940644",
"0.5783439",
"0.577956",
"0.57740563",
"0.5769872",
"0.5742371",
"0.5727638",
"0.5720217",
"0.5704064",
"0.56995213",
"0.5692229",
"0.56886435",
"0.5685805",
"0.5685329",
"0.5663998",
"0.56605595",
"0.566",
"0.56574196",
"0.5654187",
"0.5645334",
"0.56447285",
"0.56346405",
"0.5633246",
"0.5632642",
"0.5609976",
"0.5609821"
] |
0.80297536
|
18
|
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)
raise NotImplementedError, "Method hasn't been implemented yet!"
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 valid_sudoku(table)\n \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 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 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 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 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.8212088",
"0.81887585",
"0.81469035",
"0.8069628",
"0.80010355",
"0.79224867",
"0.78968567",
"0.76087445",
"0.7594696",
"0.73546576",
"0.7341427",
"0.7301686",
"0.7012823",
"0.69957775",
"0.6977555",
"0.69177145",
"0.685407",
"0.6809085",
"0.6776621",
"0.67565316",
"0.67110926",
"0.6702839",
"0.66949123",
"0.66743773",
"0.6671723",
"0.6662107",
"0.6601863",
"0.6533325",
"0.6518245",
"0.64914745",
"0.64594245",
"0.6427697",
"0.6418856",
"0.64109415",
"0.640699",
"0.6387403",
"0.6385768",
"0.63852197",
"0.6358063",
"0.6335753",
"0.63262767",
"0.6312467",
"0.6302803",
"0.6302788",
"0.6297411",
"0.628004",
"0.6279195",
"0.627616",
"0.6271877",
"0.6266847",
"0.6265899",
"0.623912",
"0.62208635",
"0.6215034",
"0.62040377",
"0.6194868",
"0.6183578",
"0.61794186",
"0.6174503",
"0.6157554",
"0.61561847",
"0.61549544",
"0.6152687",
"0.61483777",
"0.61434776",
"0.6135546",
"0.60992306",
"0.6086823",
"0.6083832",
"0.6076706",
"0.60475653",
"0.60423905",
"0.6038392",
"0.60169506",
"0.6005562",
"0.60041493",
"0.5995414",
"0.5994407"
] |
0.6489313
|
52
|
GET /positioncoefficients GET /positioncoefficients.xml
|
def index
@positioncoefficients = Positioncoefficient.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @positioncoefficients }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @positioncoefficient = Positioncoefficient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def new\n @positioncoefficient = Positioncoefficient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def create\n @positioncoefficient = Positioncoefficient.new(params[:positioncoefficient])\n\n respond_to do |format|\n if @positioncoefficient.save\n format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully created.') }\n format.xml { render :xml => @positioncoefficient, :status => :created, :location => @positioncoefficient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @positioncoefficient = Positioncoefficient.find(params[:id])\n\n respond_to do |format|\n if @positioncoefficient.update_attributes(params[:positioncoefficient])\n format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @company = Company.find(params[:company_id])\n @positions = @company.positions\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end",
"def destroy\n @positioncoefficient = Positioncoefficient.find(params[:id])\n @positioncoefficient.destroy\n\n respond_to do |format|\n format.html { redirect_to(positioncoefficients_url) }\n format.xml { head :ok }\n end\n end",
"def stops_by_position\n get '/gtfs/stops/geosearch/'\n end",
"def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end",
"def index\n @proximities = Proximity.all\n end",
"def langrage_coefficients\n # TODO\n end",
"def polynomial_coefficients(p, i)\n [p[3][i] - 3 * p[2][i] + 3 * p[1][i] - p[0][i],\n 3 * p[2][i] - 6 * p[1][i] + 3 * p[0][i],\n 3 * p[1][i] - 3 * p[0][i],\n p[0][i]]\n end",
"def get_lots_coordinates\n xml = get_lots\n coords = xml.xpath '/ArrayOflot/lot/latitude | /ArrayOflot/lot/longitude'\n coords.each_slice(2).to_a.map { |p| [p[0].text, p[1].text] }\n end",
"def get_possible_patterns_at_position(position, coefficients)\n x, y = position\n possible_patterns = coefficients[x][y]\nend",
"def get_coins\n get(\"/getcoins\")\n end",
"def index\n @positions = Position.all(:order=>'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end",
"def index\n @pclevels = Pclevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pclevels }\n end\n end",
"def get_operators\r\n url = CLX.paths[:operator]\r\n @http_client.get(url)\r\n end",
"def index\n @pos = Po.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pos }\n end\n end",
"def get(idx=0) \n extra = \"\"\n @extra_args.each do | key, val | \n extra << \"&#{key}=#{val}\"\n end \n self.parse_response(@client.get(\"#{@uri.path}?#{@context_objects[idx].kev}#{extra}\")) \n end",
"def call\n uri = URI.parse(\"http://api.sejmometr.pl/posiedzenia/BZfWZ/projekty\")\n end",
"def index\n @vdocs_requirements = @contract.vdocs_requirements.order(\"code\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vdocs_requirements }\n end\n end",
"def show\r\n @position_hist = PositionHist.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.rhtml\r\n format.xml { render :xml => @position_hist.to_xml }\r\n end\r\n end",
"def coeffs\n assign_names(@coeffs)\n end",
"def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end",
"def show\n @cash_position = CashPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cash_position }\n end\n end",
"def fit\n @coefficients = [1.0, 2.0]\n end",
"def fit\n @coefficients = [1.0, 2.0]\n end",
"def coefficients(type=:array)\n if type==:array\n @coefficients\n elsif type==:hash\n h={}\n @fields.size.times {|i|\n h[@fields[i]]=@coefficients[i]\n }\n h\n end\n end",
"def positions(id)\n get(\"/accounts/#{id}/positions\")['positions']\n end",
"def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end",
"def index\n # @candidates = Candidate.all\n @candidates = Position.find(params[:position_id]).candidates\n end",
"def get(params={})\n rpc_call :get, params\n end",
"def fit\n @coefficients = [0.0/0.0, 1.0]\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @formula }\n end\n end",
"def index\n @ppos_prerequisites = PposPrerequisite.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ppos_prerequisites }\n end\n end",
"def get(position)\n @listener.get_to_positions(position.to_positions)\n end",
"def positions\n Easybill::Api::Positions\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def show\n @financial_position = FinancialPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @financial_position }\n end\n end",
"def get_positions(account_id, options={})\n request_params = build_bp_params(account_id, options)\n\n uri = URI.parse BALANCES_AND_POSITIONS_URL\n uri.query = URI.encode_www_form(request_params)\n\n response = HTTParty.get(uri, headers: {'Cookie' => \"JSESSIONID=#{@session_id}\"}, timeout: 10)\n if response.code != 200\n raise TDAmeritradeApiError, \"HTTP response #{response.code}: #{response.body}\"\n end\n\n bp_hash = {\"error\"=>\"failed\"}\n result_hash = Hash.from_xml(response.body.to_s)\n if result_hash['amtd']['result'] == 'OK' then\n bp_hash = result_hash['amtd']['positions']\n end\n\n bp_hash\n rescue Exception => e\n raise TDAmeritradeApiError, \"error in get_positions() - #{e.message}\" if !e.is_ctrl_c_exception?\n end",
"def get_position_request\n @position_request = PositionRequest.find(params[:id])\n end",
"def init_coefficients\n weight_keys = @model.weights.keys\n \n @model.output_size[0].times do\n row = []\n @model.output_size[1].times do\n row << weight_keys\n end\n @coefficients << row\n end\n end",
"def index\n respond_to do |format|\n format.html { render action: 'index' } # index.html.erb\n format.json # index.json.erb\n format.xml { render xml: positions }\n end\n end",
"def new\n @cash_position = CashPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cash_position }\n end\n end",
"def index\n @criterions = Criterion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criterions }\n end\n end",
"def get(params, url=\"https://baconipsum.com/api?\")\n if params[\"paras\"] && params[\"sentences\"]\n puts \"Just a warning that sentences override paras...\"\n end\n endpoint = url + URI.encode_www_form(params)\n print \"Endpoint is : \"\n puts endpoint\n body = open(endpoint).read\n return body\nend",
"def params\n @params ||= @document.root.get_elements(\"params/param\").map {|e|\n XmlRpc::API::Message.parse_value(e.elements[\"value\"])\n } \n end",
"def get_xml_lines()\n open(\"#{BASE_URL}/#{@base_currency}.xml\").readlines.find_all do |line| \n line =~ /1 #{@base_currency} =/\n end\n end",
"def show\n @promotions = @condition.promotions\n @coefficients = @condition.coefficients\n end",
"def get_position_list\n\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end",
"def index\n @order_positions = OrderPosition.all\n end",
"def fetchControlPoints(url, mapID)\n url = URI(url.to_s+'maps/'+mapID.to_s+'/control_points.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n JSON.parse(data)\n end",
"def index\n @degrees = Degree.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @degrees }\n end\n end",
"def index\n @account_features = AccountFeature.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @account_features.to_xml }\n end\n end",
"def getParameters()\n printDebugMessage('getParameters', 'Begin', 1)\n xmlDoc = restRequest(baseUrl + '/parameters/')\n doc = REXML::Document.new(xmlDoc)\n printDebugMessage('getParameters', 'End', 1)\n return doc.root.elements['//parameters']\n end",
"def show\n @position = Position.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n \n end\n end",
"def proximity\r\n \tcurentDate = Time.now\r\n\r\n \t#recherche de tous les calendrier\r\n \tcaldav = Calendrier.where(\"date >= '#{curentDate}'\")\r\n\r\n \t#creation d'un tableau vide\r\n \tmarche = Array.new \r\n \tcaldav.each do |f|\r\n \t\tmarche.push(Calendrier.find(f.id).markets.all)\r\n \tend\r\n \trender json: marche\r\n end",
"def getCoeffs\n raw_coeffs = $stdin.readline\n split_coeffs = raw_coeffs.split(',')\n \n coeffs = []\n \n split_coeffs.each do |sc| \n coeffs.push sc.to_f\n end\n \n coeffs\nend",
"def new\n @financial_position = FinancialPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @financial_position }\n end\n end",
"def index\n @variates = Variate.all\n\n respond_to do |format|\n format.html\n format.xml { render xml: @variates.to_xml }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end",
"def show\n @paroquia = Paroquia.find(params[:id])\n @coordenadores = @paroquia.coordenadores\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paroquia }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def get path_and_params\n start if not @pid\n @lock.synchronize do\n @last_use = Time.new.to_f\n\n # Make request to xtractr\n uri = URI.parse(\"http://127.0.0.1:#{@port}/#{path_and_params}\")\n response = Net::HTTP.get_response(uri)\n\n # Copy headers from response\n headers = {}\n response.each_header {|name,val| headers[name] = val}\n\n return response.code.to_i, headers, response.body\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def show\n @position_history = PositionHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position_history }\n end\n end",
"def get_info(lat, lon)\n Net::HTTP.get(URI(\"https://api.3geonames.org/#{lat},#{lon}.json\"))\nend",
"def index\n @positions = @portfolio.positions\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @points }\n end\n end",
"def index\n if params[:x1]\n @places = Place.by_bounds( params[:x1], params[:y1], params[:x2], params[:y2], params )\n end\n #@places = Place.without_nodes\n respond_with(@places)\n end",
"def info_by_pos(pos)\n MSPhysics::Newton::CurvySlider.get_info_by_pos(@address, pos)\n end",
"def get_xml_lines()\r\nopen(\"#{BASE_URL}/#{@base_currency}.xml\").readlines.find_all do |line|\r\nline =~ /1 #{@base_currency} =/\r\nend\r\nend",
"def index\n @positives = Positive.all\n @positives_json= Positive.all.map(&:lonlat).as_json\n\n\n\n\n\n end",
"def index\n @positions = Position.all\n end",
"def index\r\n @cuentum = Cuentum.find(params[:cuentum_id])\r\n @credits = @cuentum.credits\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @credits}\r\n end\r\n end",
"def index\n @labor_cost_lines = LaborCostLine.scoped\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @labor_cost_lines }\n end\n end",
"def show\n @executive_position = ExecutivePosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @executive_position }\n end\n end",
"def make_request\n if @test\n host = 'wwwcie.ups.com'\n else\n host = 'www.ups.com'\n end\n\n path = \"/ups.app/xml/Rate\"\n server = Net::HTTP.new(host, 443)\n data = @xml_pieces.collect{|p| p.to_s}.join(\"\\n\")\n if @debug\n File.open(@debug_request_path, 'w') do |file|\n file.puts data\n end\n end\n headers = { \"Content-Type\" => \"text/xml\"}\n server.use_ssl = true\n resp = server.post(path, data, headers)\n if @debug\n File.open(@debug_response_path, 'w') do |file|\n file.puts resp.body\n end\n end\n prices = parse_response(resp.body)\n end",
"def show\n @pclevel = Pclevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pclevel }\n end\n end",
"def show\n @employee_position_hist = EmployeePositionHist.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @employee_position_hist.to_xml }\n end\n end",
"def index\n #location = GeoIp.geolocation('99.104.74.184')\n #companies = Company.within(5, :origin => [location[:latitude],location[:longitude]])\n #raise companies.inspect\n @companies = Company.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end",
"def new\n @position = Position.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def commission\n get 'commission'\n end",
"def mpc(params = {})\n scope 'default'\n get('mpc/', params)\n end",
"def points\n MSPhysics::Newton::CurvySlider.get_points(@address)\n end",
"def points\n MSPhysics::Newton::CurvySlider.get_points(@address)\n end",
"def index\n @parcels = Parcel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @parcels }\n end\n end",
"def index\n @position_mappers = PositionMapper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @position_mappers }\n end\n end",
"def show\n @curve = Curve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curve }\n end\n end",
"def show\n @service_learning_position = @organization_quarter.positions.find(params[:id])\n session[:breadcrumbs].add @service_learning_position.title(true, true, false)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_learning_position }\n end\n end",
"def getex\n url = prefix + \"getex\" + id_param\n return response(url)\n end",
"def index\n @places = Place.lookfor(params[:q])\n @places = @places.map{|p| {:tag=>p.tag,:id=>p.id,:name=>p.name}}\n respond_to do |format|\n format.xml { render :xml => @places }\n end\n end"
] |
[
"0.65258884",
"0.6046247",
"0.5679516",
"0.5533102",
"0.5532579",
"0.53812826",
"0.5181406",
"0.5174721",
"0.51607746",
"0.50951135",
"0.5091188",
"0.50303143",
"0.5020803",
"0.49832216",
"0.4978589",
"0.4956052",
"0.4905392",
"0.4902835",
"0.48825383",
"0.48513266",
"0.48492032",
"0.48382324",
"0.48342466",
"0.48286465",
"0.48227847",
"0.4819733",
"0.4819733",
"0.48149365",
"0.48047698",
"0.48018932",
"0.48000136",
"0.47918516",
"0.47878653",
"0.47856155",
"0.47818503",
"0.47651565",
"0.4752216",
"0.4724831",
"0.47102705",
"0.47001046",
"0.46981514",
"0.46906507",
"0.46897715",
"0.46685472",
"0.46666795",
"0.46530467",
"0.46500692",
"0.46411055",
"0.46370763",
"0.4626427",
"0.46228445",
"0.46228445",
"0.46212456",
"0.46209753",
"0.4620561",
"0.45856446",
"0.4577993",
"0.45756957",
"0.45630985",
"0.45612845",
"0.45542482",
"0.45534295",
"0.454218",
"0.45407313",
"0.45407313",
"0.45402187",
"0.45395407",
"0.45384943",
"0.45332342",
"0.45332342",
"0.45332342",
"0.45332342",
"0.4526859",
"0.45192775",
"0.45191926",
"0.45158762",
"0.4512073",
"0.45042056",
"0.4499707",
"0.4499352",
"0.4490609",
"0.44903925",
"0.44885954",
"0.44882792",
"0.4470079",
"0.4466003",
"0.44657502",
"0.44648635",
"0.44593987",
"0.44569126",
"0.44564363",
"0.44563687",
"0.44526413",
"0.44526413",
"0.44488555",
"0.4445714",
"0.44443163",
"0.44380257",
"0.4433481",
"0.44322175"
] |
0.7403955
|
0
|
GET /positioncoefficients/1 GET /positioncoefficients/1.xml
|
def show
@positioncoefficient = Positioncoefficient.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @positioncoefficient }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @positioncoefficients = Positioncoefficient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positioncoefficients }\n end\n end",
"def new\n @positioncoefficient = Positioncoefficient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def create\n @positioncoefficient = Positioncoefficient.new(params[:positioncoefficient])\n\n respond_to do |format|\n if @positioncoefficient.save\n format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully created.') }\n format.xml { render :xml => @positioncoefficient, :status => :created, :location => @positioncoefficient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @company = Company.find(params[:company_id])\n @positions = @company.positions\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end",
"def update\n @positioncoefficient = Positioncoefficient.find(params[:id])\n\n respond_to do |format|\n if @positioncoefficient.update_attributes(params[:positioncoefficient])\n format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @positioncoefficient = Positioncoefficient.find(params[:id])\n @positioncoefficient.destroy\n\n respond_to do |format|\n format.html { redirect_to(positioncoefficients_url) }\n format.xml { head :ok }\n end\n end",
"def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @formula }\n end\n end",
"def show\r\n @position_hist = PositionHist.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.rhtml\r\n format.xml { render :xml => @position_hist.to_xml }\r\n end\r\n end",
"def index\n @pos = Po.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pos }\n end\n end",
"def index\n @proximities = Proximity.all\n end",
"def index\n @positions = Position.all(:order=>'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def get(idx=0) \n extra = \"\"\n @extra_args.each do | key, val | \n extra << \"&#{key}=#{val}\"\n end \n self.parse_response(@client.get(\"#{@uri.path}?#{@context_objects[idx].kev}#{extra}\")) \n end",
"def index\n respond_to do |format|\n format.html { render action: 'index' } # index.html.erb\n format.json # index.json.erb\n format.xml { render xml: positions }\n end\n end",
"def show\n @cash_position = CashPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cash_position }\n end\n end",
"def index\n @ppos_prerequisites = PposPrerequisite.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ppos_prerequisites }\n end\n end",
"def stops_by_position\n get '/gtfs/stops/geosearch/'\n end",
"def show\n @financial_position = FinancialPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @financial_position }\n end\n end",
"def index\n @pclevels = Pclevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pclevels }\n end\n end",
"def show\n @position = Position.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n \n end\n end",
"def new\n @cash_position = CashPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cash_position }\n end\n end",
"def index\n @variates = Variate.all\n\n respond_to do |format|\n format.html\n format.xml { render xml: @variates.to_xml }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end",
"def index\n @criterions = Criterion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criterions }\n end\n end",
"def index\n @vdocs_requirements = @contract.vdocs_requirements.order(\"code\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vdocs_requirements }\n end\n end",
"def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @points }\n end\n end",
"def get(params={})\n rpc_call :get, params\n end",
"def show\n @employee_position_hist = EmployeePositionHist.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @employee_position_hist.to_xml }\n end\n end",
"def index\n @degrees = Degree.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @degrees }\n end\n end",
"def call\n uri = URI.parse(\"http://api.sejmometr.pl/posiedzenia/BZfWZ/projekty\")\n end",
"def new\n @financial_position = FinancialPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @financial_position }\n end\n end",
"def index\n if params[:x1]\n @places = Place.by_bounds( params[:x1], params[:y1], params[:x2], params[:y2], params )\n end\n #@places = Place.without_nodes\n respond_with(@places)\n end",
"def get path_and_params\n start if not @pid\n @lock.synchronize do\n @last_use = Time.new.to_f\n\n # Make request to xtractr\n uri = URI.parse(\"http://127.0.0.1:#{@port}/#{path_and_params}\")\n response = Net::HTTP.get_response(uri)\n\n # Copy headers from response\n headers = {}\n response.each_header {|name,val| headers[name] = val}\n\n return response.code.to_i, headers, response.body\n end\n end",
"def show\n @position = Position.find(params[:id])\n @dictionary = Dictionary.find(:all)\n @conceptual = @position.responsibilities.find(:all, :order => \"r_position\", :conditions => {:indicator => 1})\n @implementation = @position.responsibilities.find(:all, :order => \"i_position\", :conditions => {:indicator => 2})\n @support = @position.responsibilities.find(:all, :order => \"s_position\", :conditions => {:indicator => 3})\n @compliance = @position.responsibilities.find(:all, :order => \"c_position\", :conditions => {:indicator => 4})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n format.pdf do\n pdf = PositionPdf.new(@position, @dictionary, @conceptual, @implementation, @support, @compliance)\n send_data pdf.render, filename: \"JD_#{@position.job_title}\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n end",
"def show\n @executive_position = ExecutivePosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @executive_position }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def index\n # @candidates = Candidate.all\n @candidates = Position.find(params[:position_id]).candidates\n end",
"def new\n @position = Position.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def show\n @paroquia = Paroquia.find(params[:id])\n @coordenadores = @paroquia.coordenadores\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paroquia }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def get_position_request\n @position_request = PositionRequest.find(params[:id])\n end",
"def fit\n @coefficients = [0.0/0.0, 1.0]\n end",
"def getex\n url = prefix + \"getex\" + id_param\n return response(url)\n end",
"def show\n @service_learning_position = @organization_quarter.positions.find(params[:id])\n session[:breadcrumbs].add @service_learning_position.title(true, true, false)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_learning_position }\n end\n end",
"def show\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @approximate_service }\n end\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end",
"def index\n @parcels = Parcel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @parcels }\n end\n end",
"def fit\n @coefficients = [1.0, 2.0]\n end",
"def fit\n @coefficients = [1.0, 2.0]\n end",
"def get_operators\r\n url = CLX.paths[:operator]\r\n @http_client.get(url)\r\n end",
"def get_xml_lines()\n open(\"#{BASE_URL}/#{@base_currency}.xml\").readlines.find_all do |line| \n line =~ /1 #{@base_currency} =/\n end\n end",
"def show\n @position_history = PositionHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position_history }\n end\n end",
"def show\n @risk_probability = RiskProbability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @risk_probability }\n end\n end",
"def get(params, url=\"https://baconipsum.com/api?\")\n if params[\"paras\"] && params[\"sentences\"]\n puts \"Just a warning that sentences override paras...\"\n end\n endpoint = url + URI.encode_www_form(params)\n print \"Endpoint is : \"\n puts endpoint\n body = open(endpoint).read\n return body\nend",
"def index\n @quants = Quant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quants }\n end\n end",
"def show\n @parcel = Parcel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @parcel }\n end\n end",
"def show\n @parcel = Parcel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @parcel }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def get_coins\n get(\"/getcoins\")\n end",
"def index\n @exposures = Exposure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @exposures }\n end\n end",
"def get_lots_coordinates\n xml = get_lots\n coords = xml.xpath '/ArrayOflot/lot/latitude | /ArrayOflot/lot/longitude'\n coords.each_slice(2).to_a.map { |p| [p[0].text, p[1].text] }\n end",
"def get_possible_patterns_at_position(position, coefficients)\n x, y = position\n possible_patterns = coefficients[x][y]\nend",
"def index\n @variates = Variate.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @variates.to_xml }\n end\n end",
"def langrage_coefficients\n # TODO\n end",
"def show\n @curve = Curve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curve }\n end\n end",
"def index\n @modeles = Modele.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @modeles }\n end\n end",
"def get_xml_lines()\r\nopen(\"#{BASE_URL}/#{@base_currency}.xml\").readlines.find_all do |line|\r\nline =~ /1 #{@base_currency} =/\r\nend\r\nend",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calibration }\n end\n end",
"def show\n @degree = Degree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @degree }\n end\n end",
"def index\n @account_features = AccountFeature.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @account_features.to_xml }\n end\n end",
"def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end",
"def route_xml(route_id, query_params = nil)\n get(\"/routes/#{route_id}/xml\", query_params)\n end",
"def index\n @matriculas = Matricula.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matriculas }\n end\n end",
"def index\n @matriculas = Matricula.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matriculas }\n end\n end",
"def do_request(command, params)\n url = request_url(command, params)\n @xml_getter.fetch url\n end",
"def show\n @characteristic_quantification = CharacteristicQuantification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @characteristic_quantification }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @pclevel = Pclevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pclevel }\n end\n end",
"def index\n @semi_product_exchanges = SemiProductExchange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @semi_product_exchanges }\n end\n end",
"def index\n @spheres = Sphere.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @spheres }\n end\n end",
"def polynomial_coefficients(p, i)\n [p[3][i] - 3 * p[2][i] + 3 * p[1][i] - p[0][i],\n 3 * p[2][i] - 6 * p[1][i] + 3 * p[0][i],\n 3 * p[1][i] - 3 * p[0][i],\n p[0][i]]\n end",
"def show\n @oligo_order = OligoOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oligo_order }\n end\n end",
"def proximity\r\n \tcurentDate = Time.now\r\n\r\n \t#recherche de tous les calendrier\r\n \tcaldav = Calendrier.where(\"date >= '#{curentDate}'\")\r\n\r\n \t#creation d'un tableau vide\r\n \tmarche = Array.new \r\n \tcaldav.each do |f|\r\n \t\tmarche.push(Calendrier.find(f.id).markets.all)\r\n \tend\r\n \trender json: marche\r\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def index\n @pieces_commandes = PiecesCommande.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pieces_commandes }\n end\n end",
"def index\n @st_pis = StPi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_pis }\n end\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end",
"def get; end",
"def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @criterion }\n end\n end",
"def mpc(params = {})\n scope 'default'\n get('mpc/', params)\n end"
] |
[
"0.74998224",
"0.6315164",
"0.5776348",
"0.5688913",
"0.564511",
"0.5529654",
"0.54390216",
"0.533006",
"0.53189373",
"0.52742636",
"0.51853716",
"0.5152585",
"0.5140186",
"0.51255345",
"0.511978",
"0.5106641",
"0.50957143",
"0.50730157",
"0.50649565",
"0.4977526",
"0.49643642",
"0.49425685",
"0.49309596",
"0.49302715",
"0.4925735",
"0.49241906",
"0.49120048",
"0.49100706",
"0.49051777",
"0.4904886",
"0.48974764",
"0.4893611",
"0.48809847",
"0.4875141",
"0.48724627",
"0.4866092",
"0.48457485",
"0.4841955",
"0.48223823",
"0.48221233",
"0.48185933",
"0.4790862",
"0.4790862",
"0.4790862",
"0.4790862",
"0.47805145",
"0.47789422",
"0.47773194",
"0.47766244",
"0.47731373",
"0.4768491",
"0.47684902",
"0.4766863",
"0.4766863",
"0.47639126",
"0.47611925",
"0.47611925",
"0.47605845",
"0.4759966",
"0.47595346",
"0.47567582",
"0.47556853",
"0.47534272",
"0.47494045",
"0.47494045",
"0.4749026",
"0.474807",
"0.4744336",
"0.47386822",
"0.47376683",
"0.47341844",
"0.47325194",
"0.47313935",
"0.47283292",
"0.4728006",
"0.47240493",
"0.47233447",
"0.47123638",
"0.47111943",
"0.47032148",
"0.47027388",
"0.47023386",
"0.47023386",
"0.46990258",
"0.46966138",
"0.46899977",
"0.46897164",
"0.46874243",
"0.4682864",
"0.46827155",
"0.46783137",
"0.46760264",
"0.46748",
"0.46662652",
"0.46557128",
"0.46493113",
"0.46493113",
"0.4646361",
"0.46432614",
"0.46331602"
] |
0.68329537
|
1
|
GET /positioncoefficients/new GET /positioncoefficients/new.xml
|
def new
@positioncoefficient = Positioncoefficient.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @positioncoefficient }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @positioncoefficients = Positioncoefficient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positioncoefficients }\n end\n end",
"def create\n @positioncoefficient = Positioncoefficient.new(params[:positioncoefficient])\n\n respond_to do |format|\n if @positioncoefficient.save\n format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully created.') }\n format.xml { render :xml => @positioncoefficient, :status => :created, :location => @positioncoefficient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def new\n @position = Position.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def show\n @positioncoefficient = Positioncoefficient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def new\n @financial_position = FinancialPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @financial_position }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end",
"def new\n @cash_position = CashPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cash_position }\n end\n end",
"def new\n @executive_position = ExecutivePosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @executive_position }\n end\n end",
"def new\n @position_history = PositionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_history }\n end\n end",
"def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"def new\n @formula = Formula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @formula }\n end\n end",
"def new\n @position_member = PositionMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position_member }\n end\n end",
"def update\n @positioncoefficient = Positioncoefficient.find(params[:id])\n\n respond_to do |format|\n if @positioncoefficient.update_attributes(params[:positioncoefficient])\n format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @expression = Expression.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @expression }\n end\n end",
"def new\n @finanzposition = Finanzposition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finanzposition }\n end\n end",
"def new\n @position_mapper = PositionMapper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_mapper }\n end\n end",
"def new\n @exposition = Exposition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exposition }\n end\n end",
"def new\n @user_position = UserPosition.new\n @positions = Position.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_position }\n end\n end",
"def new\n @approximate_service = ApproximateService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @approximate_service }\n end\n end",
"def new\n @service_learning_position = ServiceLearningPosition.new\n @service_learning_position.organization_quarter_id = @organization_quarter.id\n @service_learning_position.times.build\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_learning_position }\n end\n end",
"def new\n @text_position = TextPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_position }\n end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @projection = Projection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @projection }\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 @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @pclevel = Pclevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pclevel }\n end\n end",
"def new\n @crew_position = CrewPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @crew_position }\n end\n end",
"def new\n @ppos_prerequisite = PposPrerequisite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ppos_prerequisite }\n end\n end",
"def new\n @curve = Curve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curve }\n end\n end",
"def new\n @history_point = HistoryPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @history_point }\n end\n end",
"def new\n @point = Point.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @parcel = Parcel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @parcel }\n end\n end",
"def new\n @parcel = Parcel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @parcel }\n end\n end",
"def new\n @st_pi = StPi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @st_pi }\n end\n end",
"def new\n @variable_charge = VariableCharge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @variable_charge }\n end\n end",
"def new\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price }\n end\n end",
"def new\n @precio = Precio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @precio }\n end\n end",
"def new\n @possess = Possess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @possess }\n end\n end",
"def new\n @lookup_bvmtpercentile = LookupBvmtpercentile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_bvmtpercentile }\n end\n end",
"def destroy\n @positioncoefficient = Positioncoefficient.find(params[:id])\n @positioncoefficient.destroy\n\n respond_to do |format|\n format.html { redirect_to(positioncoefficients_url) }\n format.xml { head :ok }\n end\n end",
"def new\n @offset = Offset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offset }\n end\n end",
"def new\n @ground_function = GroundFunction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ground_function }\n end\n end",
"def new\n @fundamental_daily_position_stat = Fundamental::DailyPositionStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamental_daily_position_stat }\n end\n end",
"def new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end",
"def new\n @quant = Quant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quant }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @power_total = Power::Total.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power_total }\n end\n end",
"def new\n @m_get_point = MGetPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_get_point }\n end\n end",
"def new\n @power = Power.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power }\n end\n end",
"def new\n @degree = Degree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @degree }\n end\n end",
"def new\n new_prc\n\n setup_campuses_and_semesters\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prc }\n end\n end",
"def new\n @checkpoint_removed = CheckpointRemoved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @checkpoint_removed }\n end\n end",
"def new\n @oligo_order = OligoOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @oligo_order }\n end\n end",
"def new\n @lista_precio = ListaPrecio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lista_precio }\n end\n end",
"def new\n @risk_probability = RiskProbability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @risk_probability }\n end\n end",
"def new\n @multiplier = Multiplier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @multiplier }\n end\n end",
"def new\n @position = Position.new\n @position.questions.build\n @categories = Category.find(:all)\n respond_to do |format|\n format.html\n format.xml { render :xml => @position }\n end\n end",
"def new\n @centricsteel = Centricsteel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @centricsteel }\n end\n end",
"def new\n @characteristic_quantification = CharacteristicQuantification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @characteristic_quantification }\n end\n end",
"def new\n @puffin_order = PuffinOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @puffin_order }\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\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 @degree = Degree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @degree }\n end\n end",
"def new\n @v_netweight = VNetweight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @v_netweight }\n end\n end",
"def new\n position_id = params[:id]\n @position = Position.find(params[:id])\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eco_parameter }\n end\n end",
"def new\n @pieces_commande = PiecesCommande.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pieces_commande }\n end\n end",
"def new\n @low_no_cost_improvement = LowNoCostImprovement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @low_no_cost_improvement }\n end\n end",
"def new\n @path = Path.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end",
"def new\n @tax_computation = TaxComputation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tax_computation }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @xpto = Xpto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xpto }\n end\n end",
"def new\n @pro_temp = ProTemp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pro_temp }\n end\n end",
"def new\n @alignment_position = AlignmentPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alignment_position }\n end\n end",
"def new\n @sphere = Sphere.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sphere }\n end\n end",
"def new\n @point_type = PointType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point_type }\n end\n end",
"def new\n @derivative = Derivative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @derivative }\n end\n end",
"def new\n @catalogs_priority = Catalogs::Priority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end",
"def new\n @periode = Periode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periode }\n end\n end",
"def new\n \t@internship_position = InternshipPosition.new\n\n \trespond_to do |format|\n \t\tformat.html #new.html.erb\n \t\tformat.json { render json: @internship_position }\n \tend\n end",
"def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end",
"def new\n @performs_at = PerformsAt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @performs_at }\n end\n end",
"def new\n @prediction = Prediction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prediction }\n end\n end",
"def new\n @graph_point = GraphPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graph_point }\n end\n end",
"def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\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 @position = Position.new\n @organisational = Dictionary.find(:all, :order => \"place ASC\", :conditions => {:indicator => 1})\n @functional = Dictionary.find(:all, :conditions => { :indicator => 2 })\n @method = Dictionary.find(:all, :conditions => { :indicator => 3 })\n @leadership = Dictionary.find(:all, :conditions => { :indicator => 4 })\n @social = Dictionary.find(:all, :conditions => { :indicator => 5 })\n\n 1.times { @position.organisationals.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\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 @partenaire = Partenaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partenaire }\n end\n end",
"def new\n @partenaire = Partenaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partenaire }\n end\n end",
"def new\n @p_stat = PStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @p_stat }\n end\n end",
"def new\n @employee_position_history = EmployeePositionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee_position_history }\n end\n end",
"def new\n @vertex = Vertex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vertex }\n end\n end",
"def new\n @tipp = Tipp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipp }\n end\n end",
"def new\n @event = Event.find(params[:event_id])\n @point_of_interest = PointOfInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point_of_interest }\n end\n end"
] |
[
"0.67789316",
"0.6614078",
"0.63938475",
"0.636018",
"0.6129326",
"0.6106632",
"0.6076105",
"0.6076105",
"0.6076105",
"0.6047523",
"0.600763",
"0.591057",
"0.5851495",
"0.58120257",
"0.5784976",
"0.5750409",
"0.5680605",
"0.5642594",
"0.56354",
"0.56230664",
"0.5603886",
"0.55830824",
"0.5578914",
"0.55767804",
"0.5570153",
"0.55645484",
"0.5553954",
"0.555196",
"0.5546425",
"0.55368805",
"0.55310184",
"0.5529618",
"0.55252683",
"0.550928",
"0.5484652",
"0.5484652",
"0.5470788",
"0.5456318",
"0.5456087",
"0.5455226",
"0.54373175",
"0.54334867",
"0.54301244",
"0.54297805",
"0.5424523",
"0.5423524",
"0.5415075",
"0.5405744",
"0.53982365",
"0.5396791",
"0.5396371",
"0.53897476",
"0.53870237",
"0.53869516",
"0.5385032",
"0.538302",
"0.5376344",
"0.5376161",
"0.5372016",
"0.5371577",
"0.536035",
"0.5358254",
"0.5357769",
"0.5352352",
"0.53495365",
"0.53452516",
"0.5341821",
"0.53360456",
"0.5333894",
"0.532255",
"0.5308282",
"0.53077585",
"0.5303067",
"0.5299636",
"0.5296177",
"0.529485",
"0.52904207",
"0.52838665",
"0.5280463",
"0.5277644",
"0.52767336",
"0.52713835",
"0.52699757",
"0.5265257",
"0.5264315",
"0.5259948",
"0.5256389",
"0.525615",
"0.52558136",
"0.5252953",
"0.52519184",
"0.524992",
"0.5242029",
"0.5241822",
"0.5241822",
"0.5241177",
"0.5240557",
"0.52381265",
"0.52367187",
"0.5231862"
] |
0.7581399
|
0
|
POST /positioncoefficients POST /positioncoefficients.xml
|
def create
@positioncoefficient = Positioncoefficient.new(params[:positioncoefficient])
respond_to do |format|
if @positioncoefficient.save
format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully created.') }
format.xml { render :xml => @positioncoefficient, :status => :created, :location => @positioncoefficient }
else
format.html { render :action => "new" }
format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @positioncoefficients = Positioncoefficient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positioncoefficients }\n end\n end",
"def new\n @positioncoefficient = Positioncoefficient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def update\n @positioncoefficient = Positioncoefficient.find(params[:id])\n\n respond_to do |format|\n if @positioncoefficient.update_attributes(params[:positioncoefficient])\n format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @positioncoefficient = Positioncoefficient.find(params[:id])\n @positioncoefficient.destroy\n\n respond_to do |format|\n format.html { redirect_to(positioncoefficients_url) }\n format.xml { head :ok }\n end\n end",
"def order_position_params\n params.require(:order_position).permit(:ordinal, :amount, :completed, :price)\n end",
"def create\n @order_position = OrderPosition.new(order_position_params)\n\n respond_to do |format|\n if @order_position.save\n format.html { redirect_to @order_position, notice: 'Order position was successfully created.' }\n format.json { render :show, status: :created, location: @order_position }\n else\n format.html { render :new }\n format.json { render json: @order_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_params\n params.require(:position).permit(:open_date, :close_date, :cost_cents, :quantity, :notes, :status, :portfolio_id, :stock_id)\n end",
"def position_params\n params.require(:position).permit(:instrument_id, :quantity, :cost, :date_acquired)\n end",
"def position_params\n params.require(:position).permit(:latitude, :longitude, :speed, :imei, :period)\n end",
"def position_params\n params.require(:position).permit(:latitude, :longitude, :speed, :imei, :period)\n end",
"def position_params\n json_params = ActionController::Parameters.new(JSON.parse(request.body.read))\n json_params.require(:position).permit(:address, :longitude, :latitude)\n end",
"def create\n @position = Position.new(params[:position])\n \n respond_to do |format|\n if @position.save\n format.html { redirect_to(@position, :notice => 'Position was successfully created.') }\n format.xml { render :xml => @position, :status => :created, :location => @position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @position = Position.new(params[:position])\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to(admin_position_path(@position), :notice => 'Position was successfully created.') }\n format.xml { render :xml => @position, :status => :created, :location => @position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fit\n @coefficients = [1.0, 2.0]\n end",
"def fit\n @coefficients = [1.0, 2.0]\n end",
"def create\n @financial_position = FinancialPosition.new(params[:financial_position])\n\n respond_to do |format|\n if @financial_position.save\n format.html { redirect_to(@financial_position, :notice => 'Financial position was successfully created.') }\n format.xml { render :xml => @financial_position, :status => :created, :location => @financial_position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @financial_position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fit\n @coefficients = [0.0/0.0, 1.0]\n end",
"def create\n @part_position = PartPosition.new(part_position_params)\n\n respond_to do |format|\n if @part_position.save\n format.html { redirect_to @part_position, notice: 'Part position was successfully created.' }\n format.json { render :show, status: :created, location: @part_position }\n else\n format.html { render :new }\n format.json { render json: @part_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position = Position.new(params[:position])\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render json: @position, status: :created, location: @position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position = Position.new(params[:position])\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render json: @position, status: :created, location: @position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position = Position.new(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position = Position.new(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position = Position.new(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @executive_position = ExecutivePosition.new(params[:executive_position])\n\n respond_to do |format|\n if @executive_position.save\n flash[:notice] = 'ExecutivePosition was successfully created.'\n format.html { redirect_to(@executive_position) }\n format.xml { render :xml => @executive_position, :status => :created, :location => @executive_position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @executive_position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(params[:order])\n @addresses = Address.where(:user_id => current_user.id)\n @order.status = 0;\n @order.delivery_cost = @order.delivery.cost\n @order.user = current_user\n @order_positions = current_user.basket.order_positions\n @order.order_positions = @order_positions\n @order.value = sum_price(@order_positions)\n\n respond_to do |format|\n if @order.save\n @order_positions.each do |op|\n op.container = @order\n op.save\n p = op.product\n p.availability -= op.amount\n p.save\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def formula_params\n params.require(:formula).permit(:sku, :descripcion, :lote, :unidad, :skuIngerdiente, :ingrediente, :requerimiento, :unidadIngrediente, :precioIngrediente)\n end",
"def create\n @position = @device.positions.new(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to device_positions_path(@device, @position), notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proximity = Proximity.new(proximity_params)\n\n respond_to do |format|\n if @proximity.save\n format.html { redirect_to @proximity, notice: 'Proximity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @proximity }\n else\n format.html { render action: 'new' }\n format.json { render json: @proximity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_params\n params.require(:position).permit(:id, :user_id, :company_name, :position_name, :position_description_url, :application_submitted, :cover_letter_submitted, :glassdoor_review, :notes, :date_application_submitted, :response_received, :status, :staffing_agency_name, :staffing_agency_phone, :staffing_agency_url, :staffing_agency_fax, :staffing_agency_address, :staffing_agency_point_of_contact, :staffing_agency_notes, :company_url, :company_phone, :company_address, :company_fax, :company_email_address, :staffing_agency_email_address, :referral_site)\n end",
"def create\n begin\n @new_position = @@data_util.hash_data_to_upper_case(params[:position], ['description'])\n @new_position[:createdby] = session[:username]\n @new_position[:mypclient_id] = session[:client_id]\n\n @position = Position.new(@new_position)\n if @position.save\n @@request_result[:success] = true\n @@request_result[:notice] =\"Position was successfully created.\"\n else\n @@request_result[:errormsg] = @position.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def show\n @positioncoefficient = Positioncoefficient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def to_arduino_params\n #params.require(:to_arduino).permit(:value)\n params.require(:to_arduino).permit(:x, :y, :z)\n end",
"def create\n @template_position = TemplatePosition.new(template_position_params)\n\n respond_to do |format|\n if @template_position.save\n format.html { redirect_to @template_position, notice: 'Template position was successfully created.' }\n format.json { render :show, status: :created, location: @template_position }\n else\n format.html { render :new }\n format.json { render json: @template_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position = Position.new(params[:position])\n @categories = Category.find(:all)\n\n respond_to do |format|\n if @position.save\n flash[:notice] = 'Position was successfully created.'\n format.html { redirect_to(@position) }\n format.xml { render :xml => @position, :status => :created, :location => @position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @text_position = TextPosition.new(params[:text_position])\n\n respond_to do |format|\n if @text_position.save\n format.html { redirect_to @text_position, notice: 'Text position was successfully created.' }\n format.json { render json: @text_position, status: :created, location: @text_position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def proposal_position_params\n params.require(:proposal_position).permit(:proposal_id, :price_item_id, :template_position_id, :price, :change_marker)\n end",
"def create\n @position = @portfolio.positions.build(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to portfolio_positions_path(@portfolio), notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crew_position = CrewPosition.new(params[:crew_position])\n\n respond_to do |format|\n if @crew_position.save\n format.html { redirect_to @crew_position, :notice => 'Crew position was successfully created.' }\n format.json { render :json => @crew_position, :status => :created, :location => @crew_position }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @crew_position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user_position = UserPosition.new(params[:user_position])\n\n respond_to do |format|\n if @user_position.save\n format.html { redirect_to @user_position, notice: 'User position was successfully created.' }\n format.json { render json: @user_position, status: :created, location: @user_position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_params\n params.require(:position).permit(:name)\n end",
"def init_coefficients\n weight_keys = @model.weights.keys\n \n @model.output_size[0].times do\n row = []\n @model.output_size[1].times do\n row << weight_keys\n end\n @coefficients << row\n end\n end",
"def create\n @entried_position = EntriedPosition.new(entried_position_params)\n\n respond_to do |format|\n if @entried_position.save\n format.html { redirect_to @entried_position, notice: 'Entried position was successfully created.' }\n format.json { render action: 'show', status: :created, location: @entried_position }\n else\n format.html { render action: 'new' }\n format.json { render json: @entried_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_params\n params.require(:position).permit(:name)\n end",
"def create\n @service_learning_position = @organization_quarter.positions.create(params[:service_learning_position])\n @service_learning_position.unit = @unit\n @service_learning_position.approved = false\n @service_learning_position.in_progress = true\n \n respond_to do |format|\n if @service_learning_position.save\n flash[:notice] = 'ServiceLearningPosition was successfully created.'\n format.html { redirect_to edit_service_learning_organization_position_path(@unit, \n @quarter, @organization, @service_learning_position, :anchor => 'description') }\n format.xml { render :xml => @service_learning_position, :status => :created, :location => @service_learning_position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service_learning_position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @part_position = PartPosition.new(part_position_params)\n # authorize(@part_position)\n\n respond_to do |format|\n if @part_position.save\n format.html { redirect_to @part_position, notice: 'Part position was successfully created.' }\n format.json { render :show, status: :created, location: @part_position }\n else\n format.html { render :new }\n format.json { render json: @part_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_params\n params.require(:position).permit(:hire, :experience, :fte, :year_id, :role_id, :person_id, :sport_id, :reported)\n end",
"def create\n \t@internship_position = InternshipPosition.new(internship_position_params)\n\n \trespond_to do |format|\n \t\tif @internship_position.save\n \t\t\tformat.html { redirect_to @internship_position, notice: 'Position was successfully created'}\n \t\t\tformat.json { render json: @internship_position, status: :created, location: @internship_position }\n \t\telse\n \t\t\tformat.html { render action: \"new\" }\n \t\t\tformat.json { render json: @internship_position.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n end",
"def create\n respond_to do |format|\n if position.save\n format.html { redirect_to( position, flash: { success: 'Position created.' } ) }\n format.xml { render xml: position, status: :created, location: position }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proposal_position = ProposalPosition.new(proposal_position_params)\n\n respond_to do |format|\n if @proposal_position.save\n format.html { redirect_to @proposal_position, notice: 'Proposal position was successfully created.' }\n format.json { render :show, status: :created, location: @proposal_position }\n else\n format.html { render :new }\n format.json { render json: @proposal_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_params\n params.require(:position).permit(:title, :description, :active)\n end",
"def orbit_params\n params.require(:orbit).permit(:name, :epoch, :first_derivative_of_mean_motion, :second_derivative_of_mean_motion, :b_star, :inclination, :apogee, :perigee, :period, :right_ascension_of_ascending_node, :eccentricity, :argument_of_perigee, :mean_anomaly, :mean_motion, :revolution_number, :tles, :satellite_id)\n end",
"def committee_position_params\n params.require(:committee_position).permit(:position, :name, :image_url, :description)\n end",
"def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end",
"def position_state_params\n params.require(:position_state).permit(:name, :position_id, :turn_id, :score, :trade_value, :money_income, :materials_income, :research_income, :saved_money, :saved_materials, :saved_research)\n end",
"def position_params\n params.require(:position).permit(:block_id, :piece_id, :grid_position)\n end",
"def part_position_params\n params.require(:part_position).permit(:part_id, :position_id, :safe_stock, :from_warehouse_id, :from_position_id)\n end",
"def create\n @character_geo_position = Character::GeoPosition.new(params[:character_geo_position])\n\n respond_to do |format|\n if @character_geo_position.save\n format.html { redirect_to @character_geo_position, notice: 'Geo position was successfully created.' }\n format.json { render json: @character_geo_position, status: :created, location: @character_geo_position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @character_geo_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n position = Position.new(params.permit(:address))\n \n if position.save\n render json: position, status: :created\n else\n render json: position.errors, status: :unprocessable_entity\n end\n end",
"def entried_position_params\n params.require(:entried_position).permit(:entry_id, :latitude, :longitude, :label, :owner_id)\n end",
"def points_transaction_params\n params.require(:points_transaction).permit(:user_id, :transaction_type, :number_of_points, :value_of_points, :notes, :approval_required, :approval_received, :admin_id)\n end",
"def coefficients(type=:array)\n if type==:array\n @coefficients\n elsif type==:hash\n h={}\n @fields.size.times {|i|\n h[@fields[i]]=@coefficients[i]\n }\n h\n end\n end",
"def create\n @admin_position = Position.new(admin_position_params)\n\n respond_to do |format|\n if @admin_position.save\n format.html { redirect_to admin_positions_path, notice: 'Position was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @hrms_position = Hrms::Position.new(hrms_position_params)\n\n respond_to do |format|\n if @hrms_position.save\n format.html { redirect_to @hrms_position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @hrms_position }\n else\n format.html { render :new }\n format.json { render json: @hrms_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_position_params\n params.require(:template_position).permit(:title, :price_item_id, :template_id, :template_item_id, :order)\n end",
"def create\n \n @user = User.find(params[:user_id])\n @position = @user.positions.build(params[:position])\n\n respond_to do |format|\n if @position.save\n flash[:notice] = 'Position was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { render :xml => @position, :status => :created, :location => @position }\n else\n @committees = Committee.all(:order => :code)\n @roles = []\n if !params[:position][:committee_id].blank?\n @roles = Role.all(:condition => [\"committee_id = ?\", params[:position][:committee_id]])\n end\n\n format.html { render :action => \"new\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def part_position_params\n params[:part_position]\n end",
"def powe_factor_nozzle_x_params\n params.require(:powe_factor_nozzle_x).permit(:number, :mide, :mode_proof, :lost_mv)\n end",
"def create\n @department_position = DepartmentPosition.new(department_position_params)\n\n respond_to do |format|\n if @department_position.save\n format.html { redirect_to @department_position, notice: 'Department position was successfully created.' }\n format.json { render :show, status: :created, location: @department_position }\n else\n format.html { render :new }\n format.json { render json: @department_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position = User.create(position_params)\n render json: @position, status: :accepted\n end",
"def create\n @unko_position = UnkoPosition.new(params[:unko_position])\n\n # 既に同じデバイスからの入力がないか確認\n @previous_unko_position = UnkoPosition.find_by_device_id(@unko_position.device_id)\n @previous_unko_position.delete if !@previous_unko_position.nil?\n\n respond_to do |format|\n if @unko_position.save\n format.html { redirect_to @unko_position, notice: 'Unko position was successfully created.' }\n format.json { render json: @unko_position, status: :created, location: @unko_position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unko_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def proximity_params\n params.require(:proximity).permit(:recording_id, :time, :proximity)\n end",
"def create\n @points_transaction = PointsTransaction.new(points_transaction_params)\n\n respond_to do |format|\n if @points_transaction.save\n format.html { redirect_to @points_transaction, notice: 'Points transaction was successfully created.' }\n format.json { render :show, status: :created, location: @points_transaction }\n else\n format.html { render :new }\n format.json { render json: @points_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finanzposition = Finanzposition.new(params[:finanzposition])\n #@finanzposition.users << current_user\n #@finanzposition.FinanzenNr << current_finanzens\n respond_to do |format|\n if @finanzposition.save\n format.html { redirect_to @finanzposition, notice: 'finanzposition was successfully created.' }\n format.json { render json: @finanzposition, status: :created, location: @finanzposition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @finanzposition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:weight, :service_type, :cost, :payment_mode, :status, :parcel_number)\n end",
"def new\n @order = Order.new\n @order_positions = current_user.basket.order_positions\n @addresses = Address.where(:user_id => current_user.id)\n @order.value = sum_price(@order_positions)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @semifinalposition = Semifinalposition.new(semifinalposition_params)\n\n respond_to do |format|\n if @semifinalposition.save\n format.html { redirect_to @semifinalposition, notice: 'Semifinalposition was successfully created.' }\n format.json { render :show, status: :created, location: @semifinalposition }\n else\n format.html { render :new }\n format.json { render json: @semifinalposition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trace_params\n params.require(:_json).map do |p|\n p.permit(:latitude, :longitude)\n end\n end",
"def admin_position_params\n params.require(:position).permit(:title, :rank)\n end",
"def prepare_request_data(session_id, pos_id)\r\n pos = pos_id || @parameters.pos_id.to_a.first\r\n\r\n ts = calculate_ts\r\n\r\n data = {\r\n :pos_id => pos,\r\n :session_id => session_id,\r\n :ts => ts,\r\n :sig => sign(pos, session_id, ts, @parameters.key1)\r\n }\r\n data\r\n end",
"def polynomial_coefficients(p, i)\n [p[3][i] - 3 * p[2][i] + 3 * p[1][i] - p[0][i],\n 3 * p[2][i] - 6 * p[1][i] + 3 * p[0][i],\n 3 * p[1][i] - 3 * p[0][i],\n p[0][i]]\n end",
"def financial_position1_params\n params.require(:financial_position1).permit(:Sector, :'2012-13', :'2013-14', :'2014-15', :'2015-16', :'2016-17', :'2017-18_BE', :Indicator)\n end",
"def create\n @position = Position.new(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to positions_path(anchor: \"row-#{@position.id}\"), notice: 'Position was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def coordinate_params\n params.require(:coordinate).permit(:name, :disposition, :superior_id,\n :order)\n end",
"def position_params\n params.require(:position).permit(:name, :kee, :klass_name)\n end",
"def create\n @contest_position = ContestPosition.new(contest_position_params)\n\n respond_to do |format|\n if @contest_position.save\n format.html { redirect_to @contest_position, notice: 'Contest position was successfully created.' }\n format.json { render action: 'show', status: :created, location: @contest_position }\n else\n format.html { render action: 'new' }\n format.json { render json: @contest_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def team_position_params\n params[:team_position]\n end",
"def position_params\n params.require(:position).permit(:title, :description, :fields_attributes).tap do |whitelisted|\n whitelisted[:fields] = params[:position][:fields]\n end\n end",
"def position_params\n position = params[:position]\n if position && !position.empty?\n params.require(:position).permit(:device_id, :when, :lng, :lat)\n else\n params.permit(:device_id, :when, :lng, :lat)\n end\n end",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def orbit_params\n params.require(:orbit).permit(:distance, :period, :angle, :index)\n end",
"def parola_params\n params.require(:parola).permit(:input, :output, :definition, :part_of_speech, :etymology_language, :tag_list)\n end",
"def points_transaction_params\n params.require(:points_transaction).permit()\n end",
"def create\n unread\n\n @cart = current_cart\n if @cart.line_items.empty?\n redirect_to :controller=>'main', :action=>'index', :notice => \"Your cart is empty\"\n return\n end\n\n\n @order = Order.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n\n @line_item = LineItem.find_by_cart_id(@cart)\n #getting branches\n supermarket = @line_item.product.seller.id\n @branches = Branch.find_all_by_seller_id(supermarket)\n\n # ******* sending request to PegPay server ******************\n # call the http post method\n @date = \"#{Time.now}\"\n url = URI.parse('https://41.190.131.222/pegpaytelecomsapi/PegPayTelecomsApi.asmx?WSDL')\n \n post_xml ='<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soap:Body>\n <PostTransaction xmlns=\"http://PegPayTelecomsApi/\">\n <trans>\n <DigitalSignature>'+ \"#{digital_signature}\" +'</DigitalSignature>\n <FromTelecom>'+ \"#{@order.pay_type}\" +'</FromTelecom>\n <ToTelecom>'+ \"#{@order.pay_type}\" +'</ToTelecom>\n <PaymentCode>1</PaymentCode>\n <VendorCode>MABIRA</VendorCode>\n <Password>81W30DI846</Password>\n <PaymentDate>'+ Date.today.strftime(\"%m/%d/%Y\") +'</PaymentDate>\n <Telecom></Telecom>\n <CustomerRef>'+\"#{@order.phone_no}\"+'</CustomerRef>\n <CustomerName>'+\"#{@order.name}\"+'</CustomerName>\n <TranAmount>'+\"#{@cart.total_price}\"+'</TranAmount>\n <TranCharge>0</TranCharge>\n <VendorTranId>1</VendorTranId>\n <ToAccount></ToAccount>\n <FromAccount>'+\"#{@order.phone_no}\"+'</FromAccount>\n <TranType>PULL</TranType>\n </trans>\n </PostTransaction>\n </soap:Body>\n </soap:Envelope>'\n\n peg_pay_status_code = make_http_request(url, post_xml)\n puts \"status code============================================\" \n puts peg_pay_status_code\n puts \"status code============================================\"\n # ******* end of sending request to yo! payments server ******************\n message=getTransactionStatus(peg_pay_status_code )\n message\n\n respond_to do |format|\n if peg_pay_status_code == 0\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n Notifier.order_received(@order).deliver\n flash[:notice] = 'Thank you for your order.' \n format.html { redirect_to(:controller=>'main', :action=>'index') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n else\n flash[:notice]= message\n\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @position_member = PositionMember.new(params[:position_member])\n\n respond_to do |format|\n if @position_member.save\n @user = User.find(@position_member.user_id)\n @user.access_level = 30\n @user.save!\n format.html { redirect_to(@position_member, :notice => 'Position member was successfully created.') }\n format.xml { render :xml => @position_member, :status => :created, :location => @position_member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @position_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def mesh_code_params\n params.require(:mesh_code).permit(:value, :rank, :southwest_lat, :southwest_long)\n end",
"def volunteer_position_params\n params.require(:volunteer_position).permit(:name, :description, :objective, :duties, :requirements, :contact, :contact_email, :visible)\n end",
"def create\n @position_mapper = PositionMapper.new(params[:position_mapper])\n\n respond_to do |format|\n if @position_mapper.save\n format.html { redirect_to @position_mapper, notice: 'Position mapper was successfully created.' }\n format.json { render json: @position_mapper, status: :created, location: @position_mapper }\n else\n format.html { render action: \"new\" }\n format.json { render json: @position_mapper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n data = []\n trace_params.each do |p|\n hash = {\n latitude: p[\"latitude\"],\n longitude: p[\"longitude\"]\n }\n data << hash\n end\n\n if Trace.upload_data(data)\n render json: {status: 'OK'}\n else\n render json: @trace.errors, status: :unprocessable_entity\n end\n end",
"def exposition_params\n params.require(:exposition).permit(:title, :text, :address, :start_time, :end_time, :start_date, :end_date)\n end",
"def update_positions\n unless request.post?\n render nothing: true\n return\n end\n\n @assignment = Assignment.find(params[:assignment_id])\n @criteria = @assignment.rubric_criteria\n position = 0\n\n params[:criterion].each do |id|\n if id != ''\n position += 1\n RubricCriterion.update(id, position: position)\n end\n end\n end"
] |
[
"0.63139105",
"0.60718316",
"0.58930624",
"0.5589935",
"0.54409516",
"0.5332197",
"0.5322689",
"0.52606946",
"0.52483875",
"0.5248295",
"0.52323455",
"0.51994646",
"0.5166757",
"0.51469284",
"0.51469284",
"0.51145875",
"0.5083312",
"0.5083286",
"0.5060266",
"0.5059451",
"0.5048136",
"0.50475585",
"0.50475585",
"0.50071067",
"0.5002479",
"0.5002142",
"0.4993352",
"0.4982947",
"0.49689326",
"0.49418232",
"0.49271828",
"0.49194846",
"0.48954752",
"0.48777947",
"0.48743594",
"0.48633096",
"0.48438784",
"0.4839381",
"0.48342475",
"0.48313713",
"0.48173723",
"0.4806271",
"0.48014662",
"0.4797868",
"0.47952342",
"0.47930187",
"0.47885305",
"0.47766364",
"0.47618744",
"0.47469229",
"0.47403365",
"0.47319725",
"0.47035873",
"0.46932375",
"0.4673338",
"0.4673273",
"0.46410432",
"0.46122408",
"0.46117854",
"0.4611518",
"0.4605927",
"0.46007615",
"0.4595599",
"0.4585401",
"0.45843658",
"0.458059",
"0.4578236",
"0.45750308",
"0.45692345",
"0.45558417",
"0.45555377",
"0.45512432",
"0.45452315",
"0.45419738",
"0.45418188",
"0.45386368",
"0.45384684",
"0.4536525",
"0.4522506",
"0.4522115",
"0.452085",
"0.45201898",
"0.45136306",
"0.45072913",
"0.45054996",
"0.4494504",
"0.4493018",
"0.44867963",
"0.44787115",
"0.4476493",
"0.4475184",
"0.44732943",
"0.44709527",
"0.44632292",
"0.446148",
"0.44569677",
"0.44509035",
"0.44466528",
"0.44443873",
"0.4441714"
] |
0.6944485
|
0
|
PUT /positioncoefficients/1 PUT /positioncoefficients/1.xml
|
def update
@positioncoefficient = Positioncoefficient.find(params[:id])
respond_to do |format|
if @positioncoefficient.update_attributes(params[:positioncoefficient])
format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @positioncoefficient = Positioncoefficient.new(params[:positioncoefficient])\n\n respond_to do |format|\n if @positioncoefficient.save\n format.html { redirect_to(@positioncoefficient, :notice => 'Positioncoefficient was successfully created.') }\n format.xml { render :xml => @positioncoefficient, :status => :created, :location => @positioncoefficient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @positioncoefficient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @positioncoefficients = Positioncoefficient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positioncoefficients }\n end\n end",
"def destroy\n @positioncoefficient = Positioncoefficient.find(params[:id])\n @positioncoefficient.destroy\n\n respond_to do |format|\n format.html { redirect_to(positioncoefficients_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @position = Position.find(params[:id])\n \n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to(@position, :notice => 'Position was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @positioncoefficient = Positioncoefficient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def update\n @position = Position.find(params[:id])\n\n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to(admin_position_path, :notice => 'Position was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \tparams[:position][:existing_question_attributes] ||= {}\n \t\n @position = Position.find(params[:id])\n respond_to do |format|\n if @position.update_attributes(params[:position])\n flash[:notice] = 'Position was successfully updated.'\n format.html { redirect_to(@position) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def update\n @position = Position.find(params[:id])\n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cash_position = CashPosition.find(params[:id])\n\n respond_to do |format|\n if @cash_position.update_attributes(params[:cash_position])\n format.html { redirect_to(@cash_position, :notice => 'Cash position was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cash_position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n respond_to do |format|\n if position.save\n format.html { redirect_to( position, flash: { success: 'Position updated.' } ) }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_position.update(order_position_params)\n format.html { redirect_to @order_position, notice: 'Order position was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_position }\n else\n format.html { render :edit }\n format.json { render json: @order_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_position\n begin\n recommendation = Recommendation.find(params[:id]) # grab the object\n recommendation.insert_at(params[:position].to_i) # update the object's order\n render :json => {:title => 'Success', :message => 'The order was updated successfuly.'}\n rescue\n logger.error $ERROR_INFO.inspect\n render :json => {:title => 'Error', :message => 'Ran into an error updating the order. Please try again.'}\n end\n end",
"def update\n # checks if user is authorized\n if authorise(request)\n # operation parameter tells what put operation should be done on vertex\n operation = params[:operation]\n case operation\n when 'connection'\n update_connection(params[:from_vertex_id], params[:to_vertex_id])\n when 'transformation'\n update_transformation(params[:id], params[:pos_x], params[:pos_y], params[:width],\n params[:height], params[:z_index])\n when 'attribute'\n update_attribute(params[:id], params[:name], params[:estimated_time], params[:clue],\n params[:description])\n else\n render json: { success: false, message: 'Operation does not exist' }, status: :bad_request\n end\n else\n render json: { success: false, message: 'Unauthorized' }, status: 401\n end\n end",
"def update\n respond_to do |format|\n if @proximity.update(proximity_params)\n format.html { redirect_to @proximity, notice: 'Proximity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proximity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @unko_position = UnkoPosition.find(params[:id])\n\n respond_to do |format|\n if @unko_position.update_attributes(params[:unko_position])\n format.html { redirect_to @unko_position, notice: 'Unko position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unko_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @executive_position = ExecutivePosition.find(params[:id])\n\n respond_to do |format|\n if @executive_position.update_attributes(params[:executive_position])\n flash[:notice] = 'ExecutivePosition was successfully updated.'\n format.html { redirect_to(@executive_position) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @executive_position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @position }\n else\n format.html { render :edit }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @position }\n else\n format.html { render :edit }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @position }\n else\n format.html { render :edit }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @financial_position = FinancialPosition.find(params[:id])\n\n respond_to do |format|\n if @financial_position.update_attributes(params[:financial_position])\n format.html { redirect_to(@financial_position, :notice => 'Financial position was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @financial_position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @positioncoefficient = Positioncoefficient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @positioncoefficient }\n end\n end",
"def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to portfolio_position_path(@portfolio), notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @position }\n else\n format.html { render :edit }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @position_member = PositionMember.find(params[:id])\n\n respond_to do |format|\n if @position_member.update_attributes(params[:position_member])\n format.html { redirect_to(@position_member, :notice => 'Position member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @position_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template_position.update(template_position_params)\n format.html { redirect_to @template_position, notice: 'Template position was successfully updated.' }\n format.json { render :show, status: :ok, location: @template_position }\n else\n format.html { render :edit }\n format.json { render json: @template_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @position_hist = PositionHist.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @position_hist.update_attributes(params[:position_hist])\r\n flash[:notice] = 'PositionHist was successfully updated.'\r\n format.html { redirect_to position_hist_url(@position_hist) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @position_hist.errors.to_xml }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to device_positions_path(@position.device), notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @position }\n else\n format.html { render :edit }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_position = UserPosition.find(params[:id])\n\n respond_to do |format|\n if @user_position.update_attributes(params[:user_position])\n format.html { redirect_to @user_position, notice: 'User position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @part_position.update(part_position_params)\n format.html { redirect_to @part_position, notice: 'Part position was successfully updated.' }\n format.json { render :show, status: :ok, location: @part_position }\n else\n format.html { render :edit }\n format.json { render json: @part_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @part_position.update(part_position_params)\n format.html { redirect_to @part_position, notice: 'Part position was successfully updated.' }\n format.json { render :show, status: :ok, location: @part_position }\n else\n format.html { render :edit }\n format.json { render json: @part_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @position = Position.find(params[:id]);\n @updated_position = @@data_util.hash_data_to_upper_case(params[:position], ['description'])\n @updated_position[:lastupdateby] = session[:username]\n\n if @position.update_attributes(@updated_position)\n @@request_result[:success] = true\n @@request_result[:notice] =\"Position was successfully updated.\"\n else\n @@request_result[:errormsg] = @position.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def update\n \t@internship_position = InternshipPosition.find(params[:id])\n\n \trespond_to do |format|\n \t\tif @internship_position.update_attributes(internship_position_params)\n \t\t\tformat.html { redirect_to @internship_position, notice: 'Posiiton was successfully updated.' }\n \t\t\tformat.json { head :no_content }\n \t\telse\n \t\t\tformat.html { render action: \"edit\" }\n \t\t\tformat.json { render json: @internship_position.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n end",
"def update\n @xpto = Xpto.find(params[:id])\n\n respond_to do |format|\n if @xpto.update_attributes(params[:xpto])\n format.html { redirect_to @xpto, notice: 'Xpto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @xpto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_params\n params.require(:position).permit(:open_date, :close_date, :cost_cents, :quantity, :notes, :status, :portfolio_id, :stock_id)\n end",
"def update\n respond_to do |format|\n# params[:inputkeys].collect! {|i|i.to_i}\n# params[:inputvalues].collect! {|i|i.to_i}\n# input = Hash[*params[:inputkeys].zip(params[:inputvalues]).flatten]\n# @formula.input = input\n#\n# params[:outputkeys].collect! {|i|i.to_i}\n# params[:outputvalues].collect! {|i|i.to_i}\n# output = Hash[*params[:outputkeys].zip(params[:outputvalues]).flatten]\n# @formula.output = output\n\n formula\n\n if @formula.update_attributes(params[:formula])\n \n flash[:notice] = 'Formula was successfully updated.'\n format.html { redirect_to(@formula) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @formula.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @text_position = TextPosition.find(params[:id])\n\n respond_to do |format|\n if @text_position.update_attributes(params[:text_position])\n format.html { redirect_to @text_position, notice: 'Text position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_helper(@position, position_params)\n end",
"def update\n @microposr = Microposr.find(params[:id])\n\n respond_to do |format|\n if @microposr.update_attributes(params[:microposr])\n format.html { redirect_to @microposr, notice: 'Microposr was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crew_position = CrewPosition.find(params[:id])\n\n respond_to do |format|\n if @crew_position.update_attributes(params[:crew_position])\n format.html { redirect_to @crew_position, :notice => 'Crew position was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crew_position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @volunteer_position\n @volunteer_position.update(volunteer_position_params)\n respond_with(@volunteer_position)\n end",
"def update\n @curve = Curve.find(params[:id])\n\n respond_to do |format|\n if @curve.update_attributes(params[:curve])\n format.html { redirect_to @curve, notice: 'Curve was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @position_history = PositionHistory.find(params[:id])\n\n respond_to do |format|\n if @position_history.update_attributes(params[:position_history])\n format.html { redirect_to @position_history, notice: 'Position history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @position_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @position = Position.find(params[:id])\n user = @position.user \n\n respond_to do |format|\n if @position.update_attributes(params[:position])\n flash[:notice] = 'Position was successfully updated.'\n format.html { redirect_to(user_path(user)) }\n format.xml { head :ok }\n else\n @committees = Committee.all(:order => :code)\n @roles = []\n if !params[:position][:committee_id].blank?\n @roles = Role.all(:condition => [\"committee_id = ?\", params[:position][:committee_id]])\n end\n\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def order_position_params\n params.require(:order_position).permit(:ordinal, :amount, :completed, :price)\n end",
"def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to positions_path, notice: 'Position was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to(@sphere, :notice => 'Sphere was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sphere.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entried_position.update(entried_position_params)\n format.html { redirect_to @entried_position, notice: 'Entried position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entried_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_position(account_name, pos_id, order_qty, escrow)\n action \"set escrow for position(#{pos_id}) to #{escrow}\"\n p = get(pos_id)\n p.escrow += escrow\n p.order_qty += order_qty\n end",
"def update_transformation(id, pos_x, pos_y, width, height, z_index)\n if id.nil? || pos_y.nil? || pos_x.nil? || width.nil? || height.nil? || z_index.nil?\n render json: { status: 'FAILED', message: 'Ensure correct parameters are given' }, status: :bad_request\n return\n end\n req = UpdateVertexRequest.new(id, pos_x, pos_y, width, height, z_index)\n resp = @@room_service.update_vertex(req)\n render json: { success: resp.success, message: resp.message }, status: :ok\n rescue StandardError\n render json: { success: false, message: 'Vertex might not exist' }, status: :bad_request\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 create\n @position = Position.new(params[:position])\n \n respond_to do |format|\n if @position.save\n format.html { redirect_to(@position, :notice => 'Position was successfully created.') }\n format.xml { render :xml => @position, :status => :created, :location => @position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @position_scene1.update(position_scene1_params)\n format.html { redirect_to @position_scene1, notice: 'Position scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @position_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @position_scene1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def position_params\n params.require(:position).permit(:instrument_id, :quantity, :cost, :date_acquired)\n end",
"def put!\n request! :put\n end",
"def update\n @position_mapper = PositionMapper.find(params[:id])\n\n respond_to do |format|\n if @position_mapper.update_attributes(params[:position_mapper])\n format.html { redirect_to @position_mapper, notice: 'Position mapper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @position_mapper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fit\n @coefficients = [1.0, 2.0]\n end",
"def fit\n @coefficients = [1.0, 2.0]\n end",
"def create\n @position = Position.new(params[:position])\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to(admin_position_path(@position), :notice => 'Position was successfully created.') }\n format.xml { render :xml => @position, :status => :created, :location => @position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @position.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(invoice_number, invoice_sequence)\n #xml = order_update_template % { status: status.to_i }\n #put_request(t_url(:order, order_id), xml)\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 @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def update\n @route_point = RoutePoint.find(params[:id])\n\n respond_to do |format|\n if @route_point.update_attributes(params[:route_point])\n format.html { redirect_to(@route_point, :notice => 'Route point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to([@layer, @point], :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fit\n @coefficients = [0.0/0.0, 1.0]\n end",
"def update\n respond_to do |format|\n if @position_scene3.update(position_scene3_params)\n format.html { redirect_to @position_scene3, notice: 'Position scene3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @position_scene3 }\n else\n format.html { render :edit }\n format.json { render json: @position_scene3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n if @point_consumption.update_attributes(params[:point_consumption])\n format.html { redirect_to @point_consumption, :notice => 'Point consumption was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @point_consumption.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trajectory = Trajectory.find(params[:id])\n\n respond_to do |format|\n if @trajectory.update_attributes(params[:trajectory])\n format.html { redirect_to @trajectory, notice: 'Trajectory was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trajectory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @market_order = MarketOrder.find(params[:id])\n\n respond_to do |format|\n if @market_order.update_attributes(params[:market_order])\n format.html { redirect_to(@market_order, :notice => 'MarketOrder was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @market_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n respond_to do |format|\n if @proposal_position.update(proposal_position_params)\n format.html { redirect_to @proposal_position, notice: 'Proposal position was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposal_position }\n else\n format.html { render :edit }\n format.json { render json: @proposal_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n if @microposst.update_attributes(params[:microposst])\n format.html { redirect_to @microposst, notice: 'Microposst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @field = Field.find(params[:id])\n if @field.update_attributes(x: params[:x],y: params[:y])\n render :xml => @field\n else\n render :xml => @field.errors\n end\n end",
"def update\n respond_to do |format|\n if @semifinalposition.update(semifinalposition_params)\n format.html { redirect_to @semifinalposition, notice: 'Semifinalposition was successfully updated.' }\n format.json { render :show, status: :ok, location: @semifinalposition }\n else\n format.html { render :edit }\n format.json { render json: @semifinalposition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(position)\n # don't update unless position has changed\n if position != @last_position_written\n pos_file = File.open(@position_file, \"w\")\n pos_file.write(\"#{position}\\n\")\n pos_file.close\n @last_position_written = position\n end\n end",
"def update\n respond_to do |format|\n if @orbit.update(orbit_params)\n format.html { redirect_to @orbit, notice: 'Orbit was successfully updated.' }\n format.json { render :show, status: :ok, location: @orbit }\n else\n format.html { render :edit }\n format.json { render json: @orbit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_vertex(request)\n raise 'Request null' if request.nil?\n\n vertex = Vertex.find_by_id(request.id)\n return UpdateVertexResponse.new(false, 'Vertex could not be found') if vertex.nil?\n\n vertex.posx = request.pos_x\n vertex.posy = request.pos_y\n vertex.width = request.width\n vertex.height = request.height\n vertex.z_index = request.z_index\n\n @response = if vertex.save\n UpdateVertexResponse.new(true, 'Vertex Updated')\n else\n UpdateVertexResponse.new(false, 'Incorrect Update Parameters')\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update\n respond_to do |format|\n if @hrms_position.update(hrms_position_params)\n format.html { redirect_to @hrms_position, notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @hrms_position }\n else\n format.html { render :edit }\n format.json { render json: @hrms_position.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(buffer)\n connection.post(\"#{configuration.path}/update\", buffer, {'Content-type' => 'text/xml;charset=utf-8'})\n end",
"def update\n authorize @document\n params = document_params\n params[:qr_code_position] = QrCodePosition.find(document_params[:position])\n \n respond_to do |format|\n if @document.update(params)\n format.html { redirect_to documents_path, notice: t('document.update.confirmation') }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @point = Point.find(params[:id])\n \n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to(@point, :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @powe_factor_nozzle_x.update(powe_factor_nozzle_x_params)\n format.html { redirect_to @powe_factor_nozzle_x, notice: 'Powe factor nozzle x was successfully updated.' }\n format.json { render :show, status: :ok, location: @powe_factor_nozzle_x }\n else\n format.html { render :edit }\n format.json { render json: @powe_factor_nozzle_x.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @power_order.update(power_order_params)\n render json: @power_order\n end",
"def update\n tmp = params[:extra_param]\n current_formula_id = tmp[:formula_id]\n respond_to do |format|\n if @extra_param.update(extra_param_params)\n format.html { redirect_to formula_path (current_formula_id), \n\tflash: {success: \"Extra param successfully updated\"} }\n format.json { render :show, status: :ok, location: @extra_param }\n else\n format.html { render :edit }\n format.json { render json: @extra_param.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n position = @portfolio.positions.find(params[:id])\n if position.instrument.symbol != params['instrument_symbol'] # Then we're changing instruments.\n position.instrument_id = nil\n input_params = add_param_instrument_id\n FeedWorker.perform_async('series_bulk_load', nil, params['instrument_symbol']) # Update series for this symbol.\n else\n input_params = position_params\n end\n if position.update(input_params)\n render json: @portfolio\n else\n render json: position.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to(@point, :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @qborentestimate = Qborentestimate.find(params[:id])\n\n respond_to do |format|\n if @qborentestimate.update_attributes(params[:qborentestimate])\n format.html { redirect_to @qborentestimate, notice: 'Qestimate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @qborentestimate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def update\n @old_point_tag = OldPointTag.find(params[:id])\n\n respond_to do |format|\n if @old_point_tag.update_attributes(params[:old_point_tag])\n format.html { redirect_to(@old_point_tag, :notice => 'Old point tag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @old_point_tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n\t@contract = @vdocs_requirement.contract\n\n respond_to do |format|\n if @vdocs_requirement.update_attributes(params[:vdocs_requirement])\n flash[:notice] = 'VdocsRequirement was successfully updated.'\n format.html { redirect_to(@vdocs_requirement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vdocs_requirement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to @sphere, notice: 'Sphere a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mt_overhead_energy_data = MtOverheadEnergyData.find(params[:id])\n\n respond_to do |format|\n if @mt_overhead_energy_data.update_attributes(params[:mt_overhead_energy_data])\n format.html { redirect_to(@mt_overhead_energy_data) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mt_overhead_energy_data.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end"
] |
[
"0.60126203",
"0.58573455",
"0.57445574",
"0.554824",
"0.54882663",
"0.54754776",
"0.54361254",
"0.54283375",
"0.5397946",
"0.53792685",
"0.5372173",
"0.5352605",
"0.53466403",
"0.52502984",
"0.5244632",
"0.5235216",
"0.52308124",
"0.5219644",
"0.5197457",
"0.51897436",
"0.51897436",
"0.51897436",
"0.5178068",
"0.5126195",
"0.51098794",
"0.50662994",
"0.50407654",
"0.503291",
"0.50269127",
"0.50128615",
"0.49888086",
"0.4978914",
"0.4978914",
"0.49700004",
"0.49685824",
"0.49560583",
"0.49551165",
"0.49511528",
"0.49424884",
"0.49326983",
"0.49237803",
"0.49228597",
"0.4905164",
"0.4898148",
"0.4897813",
"0.48977882",
"0.48937586",
"0.48915526",
"0.48858714",
"0.4877891",
"0.4863383",
"0.48529607",
"0.4845361",
"0.4841357",
"0.48369032",
"0.48335683",
"0.48332477",
"0.48321262",
"0.4830683",
"0.48262933",
"0.48262933",
"0.48132634",
"0.4802427",
"0.48020926",
"0.47859567",
"0.47831452",
"0.47784516",
"0.47760412",
"0.47686195",
"0.47564074",
"0.4746748",
"0.47378612",
"0.47185397",
"0.47168964",
"0.47156566",
"0.47142738",
"0.47083575",
"0.47060764",
"0.47013286",
"0.470093",
"0.47003847",
"0.46868652",
"0.46849003",
"0.46828565",
"0.46819556",
"0.468096",
"0.4679737",
"0.4678342",
"0.46780416",
"0.4677279",
"0.46770024",
"0.46756425",
"0.4674524",
"0.4672635",
"0.4672511",
"0.46723598",
"0.46640489",
"0.46613383",
"0.46603563",
"0.46500427"
] |
0.6778262
|
0
|
DELETE /positioncoefficients/1 DELETE /positioncoefficients/1.xml
|
def destroy
@positioncoefficient = Positioncoefficient.find(params[:id])
@positioncoefficient.destroy
respond_to do |format|
format.html { redirect_to(positioncoefficients_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @position = Position.find(params[:id])\n @position.destroy\n \n respond_to do |format|\n format.html { redirect_to(positions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cash_position = CashPosition.find(params[:id])\n @cash_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(cash_positions_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @cad_position = CadPosition.find(params[:id])\n @cad_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(cad_positions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_positions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(positions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @executive_position = ExecutivePosition.find(params[:id])\n @executive_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(executive_positions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @formula.destroy\n\n respond_to do |format|\n format.html { redirect_to(formulas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expression = Expression.find(params[:id])\n @expression.destroy\n\n respond_to do |format|\n format.html { redirect_to(expressions_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\r\n @position_hist = PositionHist.find(params[:id])\r\n @position_hist.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to position_hists_url }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @financial_position = FinancialPosition.find(params[:id])\n @financial_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(financial_positions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @exposition = Exposition.find(params[:id])\n @exposition.destroy\n\n respond_to do |format|\n format.html { redirect_to expositions_url }\n format.json { head :no_content }\n end\n end",
"def destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end",
"def destroy\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n @ppos_prerequisite.destroy\n\n respond_to do |format|\n format.html { redirect_to(ppos_prerequisites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @alignment_position = AlignmentPosition.find(params[:id])\n @alignment_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(alignment_positions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n position.destroy\n\n respond_to do |format|\n format.html { redirect_to( positions_url, flash: { success: \"Position destroyed.\" } ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @proximity.destroy\n respond_to do |format|\n format.html { redirect_to proximities_url }\n format.json { head :no_content }\n end\n end",
"def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end",
"def destroy\n @tuple = Tuple.find(params[:id])\n @tuple.destroy\n\n respond_to do |format|\n format.html { redirect_to(tuples_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @etx_file = EtxFile.find(params[:id])\n \n arr = @etx_file.ques_no.split(\",\")\n Question.destroy(arr)\n @etx_file.update_attributes(status: true)\n #@etx_file.destroy\n\n respond_to do |format|\n format.html { redirect_to etx_files_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @qx = Qx.find(params[:id])\n @qx.destroy\n\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @characteristic_quantification = CharacteristicQuantification.find(params[:id])\n @characteristic_quantification.destroy\n\n respond_to do |format|\n format.html { redirect_to(characteristic_quantifications_url) }\n format.xml { head :ok }\n end\n end",
"def removeNodeAtPos(xml, index)\n\n attribs = xml[\"nodeAttributes\"]\n size = xml[\"childCount\"].to_i\n returnHash = xml.delete(index)\n for j in (index+1)..size\n\n temp = xml.delete(j)\n xml[j-1] = temp\n end\n xml[\"childCount\"] = (size-1)\n return returnHash\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete_at(p0) end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @criteria = Criteria.find(params[:id])\n @criteria.destroy\n\n respond_to do |format|\n format.html { redirect_to(criterias_url) }\n format.xml { head :ok }\n end\n end",
"def delete_all(xpath); end",
"def destroy\n @position = Position.find(params[:id])\n Activity.create(content: \"#{@position.job_title}\", action: \"deleted\", office: \"#{@position.office}\", user_name: \"#{@position.user_name}\", link: \"#{@position.id}\")\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @position = Position.find(params[:id])\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tax_computation = TaxComputation.find(params[:id])\n @tax_computation.destroy\n\n respond_to do |format|\n format.html { redirect_to(tax_computations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @service_learning_position = ServiceLearningPosition.find(params[:id])\n @service_learning_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_learning_organization_positions_url(@unit, @quarter, @organization)) }\n format.xml { head :ok }\n end\n end",
"def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end",
"def destroy\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_product_xref = UserProductXref.find(params[:id])\n @user_product_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_product_xrefs_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete(songpos)\n send_request('delete %s' % songpos)\n end",
"def destroy\n @unko_position = UnkoPosition.find(params[:id])\n @unko_position.destroy\n\n respond_to do |format|\n format.html { redirect_to unko_positions_url }\n format.json { head :no_content }\n end\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 destroy\n @estimate_line_item = EstimateLineItem.find(params[:id])\n @estimate_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(estimate_line_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def test_putpoi_delete_already_deleted\n nd = create(:node, :deleted)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal nd.id, result[2]\n end",
"def clean_neo4j\n neo_connection.execute_query(\"START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx\")\nend",
"def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end",
"def remove_configuration_product\r\n # node = ProductPackageProduct.find(params[:id].to_i).destroy\r\n # redirect_to :action => \"configuration_products\", :id => node.parent_id\r\n ExampleConfigurationProduct.delete params[:id]\r\n redirect_to :action => \"configuration_products\", :id => params[:id]\r\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def destroy\n @position_member = PositionMember.find(params[:id])\n @position_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(position_members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n @checkpoint_removed.destroy\n\n respond_to do |format|\n format.html { redirect_to(checkpoint_removeds_url) }\n format.xml { head :ok }\n end\n end",
"def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\n end",
"def destroy\n @position = Position.find(params[:id])\n \n if !@position.agency_ids.nil?\n Agency.any_in(:position_ids => [@position.id]).each do |p|\n p.positions.delete(@position)\n p.save\n end\n @position.destroy\n else\n @position.destroy\n end\n respond_to do |format|\n format.html { redirect_to(\"/positions/#{params[:company_id]}/index\") }\n end\n \n \n \n end",
"def destroy\n @entried_position.destroy\n respond_to do |format|\n format.html { redirect_to entried_positions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xpto = Xpto.find(params[:id])\n @xpto.destroy\n\n respond_to do |format|\n format.html { redirect_to xptos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy(flat_params)\n end",
"def destroy\n @taxon_attribute = TaxonAttribute.find(params[:id])\n @taxon_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_attributes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @modele = Modele.find(params[:id])\n @modele.destroy\n\n respond_to do |format|\n format.html { redirect_to(modeles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @prd_attribute = PrdAttribute.find(params[:id])\n @prd_attribute.destroy\n\n #delete_rules()\n\n respond_to do |format|\n format.html { redirect_to(prd_attributes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @taxe_value = Taxe::Value.find(params[:id])\n @taxe_value.destroy\n\n respond_to do |format|\n format.html { redirect_to(taxe_values_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @weight_percentile = WeightPercentile.find(params[:id])\n @weight_percentile.destroy\n\n respond_to do |format|\n format.html { redirect_to(weight_percentiles_url) }\n format.xml { head :ok }\n end\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 destroy\n @position = Position.find(params[:id])\n user = @position.user\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to(user) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @serialize = Serialize.find(params[:id])\n @serialize.destroy\n\n respond_to do |format|\n format.html { redirect_to(serializes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_element(xpath)\n if NOKOGIRI\n @xml.xpath(xpath.to_s).remove\n else\n @xml.delete_element(xpath.to_s)\n end\n end",
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def destroy\n @employee_position_hist = EmployeePositionHist.find(params[:id])\n @employee_position_hist.destroy\n\n respond_to do |format|\n format.html { redirect_to employee_position_hists_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question_attribute = QuestionAttribute.find(params[:id])\n @question_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_attributes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @cita = Cita.find(params[:id])\n paciente_id=@cita.paciente_id\n Operation.delete_all \"cita_id = #{@cita.id}\"\n consulta=Consulta.find_by_cita_id(params[:id])\n consulta.update_attributes(:cita_id => nil)\n @cita.destroy\n \n respond_to do |format|\n format.html { redirect_to :controller => \"lab\",:action => \"crea_cita\",:id => paciente_id,:id_cons => consulta.id }\n format.xml { head :ok }\n end\n end",
"def purged_xml_for_clone\n local_structs_regex = []\n shape.local_structs.each do | struct |\n local_structs_regex << struct.name.underscore.downcase.dasherize\n end\n xml_doc.search('*[@resource-type=\"ActiveRecord\"]', *local_structs_regex.uniq).unlink\n xml_doc.search('file[@resource-type=\"Primitive\"]').each do |file|\n file['value'] = ''\n file['width'] = ''\n file['height'] = ''\n file['content_type'] = ''\n end\n xml_doc\n end",
"def destroy\n @elemento = Elemento.find(params[:id])\n @elemento.destroy\n\n respond_to do |format|\n format.html { redirect_to(elementos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n device = @position.device\n @position.destroy\n respond_to do |format|\n format.html { redirect_to device_positions_url(device), notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oligo_order = OligoOrder.find(params[:id])\n @oligo_order.destroy\n\n respond_to do |format|\n format.html { redirect_to(oligo_orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @periode = Periode.find(params[:id])\n @periode.destroy\n\n respond_to do |format|\n format.html { redirect_to(periodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @weight = Weight.find(params[:id])\n @weight.destroy\n\n respond_to do |format|\n format.html { redirect_to(weights_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @po = Po.find(params[:id])\n @po.destroy\n\n respond_to do |format|\n format.html { redirect_to(pos_url) }\n format.xml { head :ok }\n end\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @finanzposition = Finanzposition.find(params[:id])\n @finanzposition.destroy\n\n respond_to do |format|\n format.html { redirect_to finanzpositions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @coin_attribute = @coin.coin_attributes.find(params[:id])\n @coin_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_coin_attributes_path([@coin]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expression_relationship = ExpressionRelationship.find(params[:id])\n @expression_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to expression_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_position.destroy\n respond_to do |format|\n format.html { redirect_to order_positions_url, notice: 'Order position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n debug('Removing order directive')\n cmd = [command(:pcs), 'constraint', 'remove', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib])\n @property_hash.clear\n end",
"def destroy\n @svg_file = Cmtool::SvgFile.find(params[:id])\n @svg_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(cmtool.svg_files_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::SvgFile.model_name.human)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n project = Project.where(:user_id => current_user[:id]).first\n project.optimized = false\n project.loading = false\n project.save\n @nodes = Node.where(:user_id => current_user[:id])\n @nodes.each do |node|\n node.jobnumber = nil\n node.vehicle_id = nil\n node.servicetime = nil\n node.tour_id = nil\n node.save\n end\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @exalumno = @alumno.exalumno\n @exalumno.destroy\n\n respond_to do |format|\n format.html { redirect_to(alumno_path(@alumno)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @poblacionesespecial = Poblacionesespecial.find(params[:id])\n @poblacionesespecial.destroy\n\n respond_to do |format|\n format.html { redirect_to(poblacionesespeciales_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bom = Bom.find(params[:id])\n @bom.destroy\n\n respond_to do |format|\n format.html { redirect_to(boms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @point_of_interest = PointOfInterest.find(params[:id])\n @point_of_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to(point_of_interests_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 @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\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"
] |
[
"0.5921333",
"0.5915622",
"0.5900425",
"0.58856875",
"0.5871932",
"0.5863749",
"0.5847981",
"0.5796321",
"0.5786627",
"0.57745445",
"0.5736627",
"0.570602",
"0.56330585",
"0.56232315",
"0.56163514",
"0.5598683",
"0.5596947",
"0.5574214",
"0.5563767",
"0.5555509",
"0.5554605",
"0.55402946",
"0.55402285",
"0.5537131",
"0.55348307",
"0.5531907",
"0.5518323",
"0.5508121",
"0.55057824",
"0.5483181",
"0.5472509",
"0.54605055",
"0.54565275",
"0.5455928",
"0.5448635",
"0.54470855",
"0.5427468",
"0.5424773",
"0.5423145",
"0.54188865",
"0.5409486",
"0.54080707",
"0.54057676",
"0.5403139",
"0.54028547",
"0.540176",
"0.5396922",
"0.5393634",
"0.53907436",
"0.5389635",
"0.5387224",
"0.5385128",
"0.53813314",
"0.5375332",
"0.5375179",
"0.53654987",
"0.5364399",
"0.5364151",
"0.5364089",
"0.5363765",
"0.5359353",
"0.53591406",
"0.535812",
"0.53577536",
"0.5355937",
"0.53537214",
"0.5348931",
"0.5344091",
"0.53424364",
"0.5339908",
"0.533745",
"0.53358215",
"0.53356314",
"0.5333228",
"0.5330929",
"0.5330694",
"0.5326234",
"0.5319118",
"0.53134024",
"0.53065544",
"0.53047174",
"0.53036845",
"0.5302424",
"0.52984446",
"0.529812",
"0.5297565",
"0.529579",
"0.5294194",
"0.52938104",
"0.52925307",
"0.528702",
"0.5286654",
"0.5285379",
"0.52819544",
"0.52798206",
"0.5276796",
"0.52763593",
"0.5275987",
"0.52756774",
"0.5275152"
] |
0.7180604
|
0
|
Action to update a topic of Sticky
|
def update
Post.suspended_delta do
@topic.update_attributes(params[:topic])
end
if @topic.errors.empty?
flash[:notice] = "Topic Updated Successfully"
redirect_to @topic.forum
else
render :action => 'edit'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update!(**args)\n @topic = args[:topic] if args.key?(:topic)\n end",
"def update!(**args)\n @topic = args[:topic] if args.key?(:topic)\n end",
"def update!(**args)\n @topic = args[:topic] if args.key?(:topic)\n end",
"def update!(**args)\n @topic_name = args[:topic_name] if args.key?(:topic_name)\n end",
"def update!(**args)\n @topic_name = args[:topic_name] if args.key?(:topic_name)\n end",
"def update_topic\n forum_topic.updated_at = Time.now\n forum_topic.save!\n end",
"def update!(**args)\n @topic_state = args[:topic_state] if args.key?(:topic_state)\n end",
"def update!(**args)\n @topic_id = args[:topic_id] if args.key?(:topic_id)\n end",
"def update\n respond_with @topic.update(topic_params)\n end",
"def UpdateTopic id,params = {}\n \n APICall(path: \"topics/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @topic.update_attributes!(topic_params)\n json_response(@topic)\n end",
"def update!(**args)\n @pubsub_topic = args[:pubsub_topic] if args.key?(:pubsub_topic)\n end",
"def update_topic(org_unit_id, topic_id, content_topic) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/topics/#{topic_id}\"\n payload = {\n 'Title' => \"\",\n 'ShortTitle' => \"\",\n 'Type' => 0,\n 'TopicType' => 0,\n 'StartDate' => nil,\n 'EndDate' => nil,\n 'DueDate' => nil,\n 'IsHidden' => nil,\n 'IsLocked' => false,\n 'OpenAsExternalResource' => nil, # Added with LE v1.6 API\n 'Description' => nil,\n 'MajorUpdate' => nil, # Added with LE v1.12 API\n 'MajorUpdateText' => \"\", # Added with LE v1.12 API\n 'ResetCompletionTracking' => nil # Added with LE v1.12 API\n }.merge!(content_topic)\n check_content_topic_validity(content_topic)\n _put(query_string, payload)\nend",
"def update!(**args)\n @pubsub_topic_name = args[:pubsub_topic_name] if args.key?(:pubsub_topic_name)\n end",
"def update!(**args)\n @pubsub_topic_name = args[:pubsub_topic_name] if args.key?(:pubsub_topic_name)\n end",
"def update(topic, options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n body[:topic] = topic\n\n response = @client.put \"/api/topics/:id\", body, options\n\n return response\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update(params_topic)\n render json: topic, status: 200\n else\n render json: topic.errors, status: 422\n end\n\n end",
"def update\n @topic = Topic.find(params[:id])\n authorize @topic\n\n if @topic.update(topic_params)\n render 'api/v1/topics/show', status: :success\n else\n render json: @topic.errors, status: :unprocessable_entity\n end\n end",
"def update\n topic_breadcrums({\"display_text\": \"Update Topic\"})\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to topics_url, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n expire_front \n\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n p = @topic.posts\n if(p.user.nil?)\n p.user = current_user\n p.topic = @topic\n p.save!\n end\n \n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to(:action => \"show\", :notice => 'Topic was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n requires! :title\n requires! :body\n requires! :node_id\n\n raise AccessDenied unless can?(:update, @topic)\n\n if @topic.lock_node == false || can?(:lock_node, @topic)\n # Only admin can change node, when it's has been locked\n @topic.node_id = params[:node_id]\n\n if @topic.node_id_changed? || can?(:lock_node, @topic)\n # Lock node when admin update\n @topic.lock_node = true\n end\n end\n @topic.title = params[:title]\n @topic.body = params[:body]\n @topic.save!\n\n render \"show\"\n end",
"def increment\n topic.increment(1)\n end",
"def lock_topic!\n update_attribute(:locked, true)\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def update\n if @topic.topic_type.nil?\n @topic.topic_type = :yesno\n end\n \n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to \"/#{@topic.permalink}\", success: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_topic.update(api_v1_topic_params)\n format.html { redirect_to @api_v1_topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_topic }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_topic\n @topic = Admin::Topic.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n end\n end\n end",
"def topic=(value)\n @topic = value\n end",
"def update!(**args)\n @topic_name = args[:topic_name] if args.key?(:topic_name)\n @traffic_type = args[:traffic_type] if args.key?(:traffic_type)\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @topic.update!(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @message = args[:message] if args.key?(:message)\n @pubsub_topic = args[:pubsub_topic] if args.key?(:pubsub_topic)\n end",
"def update\n @admin_topic = Admin::Topic.find(params[:id])\n \n respond_to do |format|\n if @admin_topic.update_attributes(params[:admin_topic])\n format.html { redirect_to @admin_topic, :notice => 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admin_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_topic\n @topic = Topic.find(params[:topic_id])\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @topic = args[:topic] if args.key?(:topic)\n end",
"def update\n unless params[:is_draft]\n @topic.is_draft = false\n if @topic.update(topic_params)\n redirect_to @topic, success: 'Topic successfully published.'\n else\n render 'edit'\n end\n else\n @topic.is_draft = true\n if @topic.update(topic_params)\n redirect_to @topic, notice: 'Topic save as draft.'\n else\n render 'edit'\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:success] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @topic.update(topic_params)\n @topics = Topic.all\n @topic = Topic.new\n @flag = true\n else\n @flag = false\n end\n redirect_to topics_path\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def set_topic\n @topic = Topic.find(params[:id])\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update_attributes(topic_params)\n render :json => {:ok => true}, :head => :no_content\n else\n render :json => {:ok => false, :message => topic.errors}, :status => :unprocessable_entity\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to(@topic, :notice => 'Topic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(topic_params)\n format.html { redirect_to [@pool, @topic], notice: 'Topic was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # @topic = current_user.topics.find(topic_params)\n @topic = current_user.topics.find(params[:id])\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = \"Topic was successfully updated.\"\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params) \n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def topic(c, t)\n @socket << \"TOPIC #{c} :#{t}\"\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to group_topic_path(:id => @topic.id), notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update(topic_params)\n format.html { redirect_to topics_path, notice: 'Topic was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic }\n else\n format.html { render :edit }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @messages = args[:messages] if args.key?(:messages)\n @topic_id = args[:topic_id] if args.key?(:topic_id)\n end",
"def update\n if @topic.update(topic_params)\n redirect_to category_topic_path(params[:category_id], @topic)\n flash['success'] = 'sukces'\n else\n redirect_to category_topic_path(params[:category_id], @topic)\n flash['error'] = 'coś poszło nie tak'\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(topic_params)\n format.html { redirect_to(@topic, :notice => 'Topic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n flash[:notice] = 'Topic was successfully updated.'\n format.html { redirect_to(@forum) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(topic_params)\n format.html { redirect_to [:admin, @topic], notice: 'Topic was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.78336924",
"0.7833626",
"0.7833626",
"0.72487736",
"0.72487736",
"0.72369504",
"0.71856505",
"0.7148054",
"0.7118872",
"0.70974183",
"0.7091626",
"0.7086457",
"0.68585014",
"0.684564",
"0.684564",
"0.68262696",
"0.67747",
"0.67739725",
"0.67693985",
"0.6697203",
"0.6681895",
"0.66647214",
"0.6579814",
"0.6572097",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.65298706",
"0.6529502",
"0.65083057",
"0.65059495",
"0.650378",
"0.6500164",
"0.64987177",
"0.6496809",
"0.6496809",
"0.6484719",
"0.6475245",
"0.6468946",
"0.64604175",
"0.6458355",
"0.64555395",
"0.6453429",
"0.6453429",
"0.6453429",
"0.6453429",
"0.64515424",
"0.64510125",
"0.6448934",
"0.6448934",
"0.6448934",
"0.6448934",
"0.6448934",
"0.6441447",
"0.6441447",
"0.6434494",
"0.64333427",
"0.6425319",
"0.64184445",
"0.6409129",
"0.6407034",
"0.6406758",
"0.6404654",
"0.640032",
"0.639736",
"0.63956034",
"0.63956034",
"0.63956034",
"0.63956034",
"0.63956034",
"0.6393902",
"0.63895106",
"0.6388394",
"0.6382973",
"0.6372718",
"0.6364593",
"0.63608724"
] |
0.6422773
|
81
|
Override to set the database owner and call setup_gis
|
def create(master_established = false)
establish_master_connection unless master_established
extra_configs = { "encoding" => encoding }
extra_configs["owner"] = username if has_su?
connection.create_database(configuration["database"], configuration.merge(extra_configs))
setup_gis
rescue ::ActiveRecord::StatementInvalid => error
if /database .* already exists/ === error.message
raise ::ActiveRecord::Tasks::DatabaseAlreadyExists
else
raise
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_publication_owner(name, owner)\n typed_exec(\"ALTER PUBLICATION #{connection.quote_ident(name)} OWNER TO #{connection.quote_ident(owner)}\")\n end",
"def setup\n @factory = ::RGeo::Cartesian.preferred_factory(:srid => 3785)\n @geographic_factory = ::RGeo::Geographic.spherical_factory(:srid => 4326)\n cleanup_tables\n cleanup_caches\n end",
"def connect_local_admin\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :schema_search_path => 'public',\n :encoding => 'unicode',\n :database => 'postgres',\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end",
"def create_database\n system \"createdb #{@base_name}\"\n system \"psql -d #{@base_name} -c 'CREATE EXTENSION postgis;'\"\n end",
"def establish_master_connection\n establish_connection(configuration.merge(\n \"database\" => \"postgres\",\n \"password\" => su_password,\n \"schema_search_path\" => \"public\",\n \"username\" => su_username\n ))\n end",
"def data_center\n super\n end",
"def set_owner #:doc:\n self.owner_class.owner= get_current_owner\n end",
"def owner() self['owner'] || 'root' ; end",
"def autoset_owner\n bypass_auth do\n if accessor\n self.owner_id ||= accessor.id\n end\n end\n\n true # this is very important!\n end",
"def set_owner\n @owner = Owner.find_by_owner_user_id(current_owner_user.id)\n end",
"def use_database(db)\n self.database = db\n end",
"def owner=(_)\n end",
"def setup_for_postgres\n ActiveRecord::Base.establish_connection adapter: \"postgresql\", \n database: \"active_symbol_test\",\n :username=>:active_symbol_test, :password=>\"active_symbol_test\"\n setup_db\nend",
"def postgis_connection(config_)\n # FULL REPLACEMENT because we need to create a different class.\n conn_params_ = config_.symbolize_keys\n\n conn_params_.delete_if { |_, v_| v_.nil? }\n\n # Map ActiveRecords param names to PGs.\n conn_params_[:user] = conn_params_.delete(:username) if conn_params_[:username]\n conn_params_[:dbname] = conn_params_.delete(:database) if conn_params_[:database]\n\n # Forward only valid config params to PGconn.connect.\n conn_params_.keep_if { |k_, _| VALID_CONN_PARAMS.include?(k_) }\n\n # The postgres drivers don't allow the creation of an unconnected PGconn object,\n # so just pass a nil connection object for the time being.\n ::ActiveRecord::ConnectionAdapters::PostGISAdapter::MainAdapter.new(nil, logger, conn_params_, config_)\n end",
"def setup!\n setup_instance_methods!\n @owner_class.embedded_relations = @owner_class.embedded_relations.merge(name => self)\n @owner_class.aliased_fields[name.to_s] = store_as if store_as\n self\n end",
"def connect_remote_admin\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :schema_search_path => 'public',\n :encoding => 'unicode',\n :database => 'postgres',\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => ENV['DB_HOST'])\n end",
"def set_postgresql_service(database = nil, username = nil, password = nil)\n @database = database\n @user_name = username\n @password = password\n @service = Service::POSTGRESQL\n end",
"def __owner__= owner\n @__owner = owner\n end",
"def __spatial_column_name=(geom); end",
"def setup_database!\n mapper = Praxis::Application.instance.plugins[:praxis_mapper]\n Sequel.connect(mapper.config.repositories[\"default\"]['connection_settings'].dump) do |db|\n db.create_table! :people do\n primary_key :id\n string :name\n end\n end\nend",
"def create_database!(name=nil)\n db = if name\n self.server.database!(db_name_with_prefix(name))\n else\n self.database!\n end\n create_rotation_filter(db)\n if self.respond_to?(:design_doc)\n design_doc.sync!(db)\n # or maybe this?:\n #self.design_docs.each do |design|\n # design.migrate(to_db)\n #end\n end\n return db\n end",
"def allow_remote_database_url=(_arg0); end",
"def connect_local\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :encoding => 'unicode',\n :database => ENV['DB_NAME'], # accessmon\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end",
"def autosets_owner_on_create\n has_owner # this will do nothing if the user has already set up has_owner :something\n # the hook runs before validation so we can validate_associated\n before_validation_on_create :autoset_owner\n end",
"def initialize\n local_db = ActiveRecord::Base.connection_config\n @raw_connection = PG.connect(dbname: local_db[:database], host: 'localhost', port: local_db[:port])\n\n @source_db_config = {\n dbname: ENV[\"DB_NAME\"] || 'dd_demo',\n host: ENV[\"DB_HOST\"] || 'localhost'\n }\n\n raise \"SOURCE_BASE_URL missing!\" unless ENV['SOURCE_BASE_URL']\n\n @source_base_url = ENV[\"SOURCE_BASE_URL\"]\n @uploads_path = ENV['UPLOADS_PATH']\n @uploader = ImportScripts::Uploader.new\n\n if ENV['SOURCE_CDN']\n @source_cdn = ENV['SOURCE_CDN']\n end\n\n local_version = @raw_connection.exec(\"select max(version) from schema_migrations\")\n local_version = local_version.first['max']\n source_version = source_raw_connection.exec(\"select max(version) from schema_migrations\")\n source_version = source_version.first['max']\n\n if local_version != source_version\n raise \"DB schema mismatch. Databases must be at the same migration version. Local is #{local_version}, other is #{source_version}\"\n end\n\n @encoder = PG::TextEncoder::CopyRow.new\n\n @merged_user_ids = []\n @tags = {}\n @tag_groups = {}\n @uploads = {}\n @post_actions = {}\n @notifications = {}\n @badge_groupings = {}\n @badges = {}\n @email_tokens = {}\n\n @auto_group_ids = Group::AUTO_GROUPS.values\n\n # add your authorized extensions here:\n SiteSetting.authorized_extensions = ['jpg', 'jpeg', 'png', 'gif'].join('|')\n\n @sequences = {}\n end",
"def setup_database\n Hanami::Model.load!\n end",
"def create_geography_column_accessors!(options = {})\n options = {\n geography_columns: true\n }.merge(options)\n\n create_spatial_column_accessors!(options)\n end",
"def owner\n @owner ||= User.new(connection, :login => @attributes[:owner])\n end",
"def set_owner(owner)\n self.__owner__ = owner if owner\n self\n end",
"def determine_database\n self.class.database \n end",
"def database(loc)\n @db = GeoIPCity::Database.new(loc, :filesystem)\n end",
"def setup_connection(conn)\n conn = super(conn)\n conn.extend(Sequel::Swift::Postgres::AdapterMethods)\n conn.db = self\n conn.apply_connection_settings\n conn\n end",
"def master_db; machine_by_role('master_db'); end",
"def owner=(v) self['Owner'] = v end",
"def postgresql_database\n # FIXME work in progress\n #encoding = \"-E #{configuration[:postgresql][:encoding]}\" if configuration[:postgresql][:encoding]\n encoding = ''\n template = \"-T #{configuration[:postgresql][:template_database]}\" if configuration[:postgresql][:template_database]\n\n exec \"postgresql_database\",\n :command => \"/usr/bin/createdb -O #{database_environment[:username]} #{encoding} #{template} #{database_environment[:database]}\",\n :unless => \"/usr/bin/psql -l | grep #{database_environment[:database]}\",\n :user => 'postgres',\n :require => exec('postgresql_user'),\n :before => exec('rake tasks')#,\n # :notify => exec('rails_bootstrap') # TODO make this configurable to work with multi_server\n end",
"def owner=(_arg0); end",
"def owner=(_arg0); end",
"def setup_database_permissions(connection_string, db_name)\n # We tack on a space at the end to help regex matches\n connection_string += \" \"\n\n db_admin_user = connection_string.match db_string_regex('user')\n db_admin_user = db_admin_user[1]\n\n db_admin_password = connection_string.match db_string_regex('password')\n db_admin_password = db_admin_password[1]\n\n grant_sql = <<-SQL\n GRANT ALL PRIVILEGES ON #{db_name}.* TO #{db_admin_user}@localhost IDENTIFIED BY '#{db_admin_password}';\n SQL\n\n run \"#{connection_string} --execute=\\\"#{grant_sql}\\\"\"\nend",
"def initialize(sequel)\n @sequel = sequel\n @table_name = 'users'\n\n super()\n end",
"def setOwner _obj, _args\n \"_obj setOwner _args;\" \n end",
"def set_database(database)\n @database = database\n end",
"def master\n Mongo::Connection.from_uri(uri(self), optional.symbolize_keys).tap do |conn|\n conn.apply_saved_authentication\n end\n end",
"def set_owner\n @goal.owner = current_user\n end",
"def createAnalisysTables(conn)\n\t\n\n\t## Table: geo.eoo\n\tconn.exec(\"DROP TABLE IF EXISTS geo.eoo;\")\n\tconn.exec(\"CREATE TABLE geo.eoo(\n\t\t\t gid serial NOT NULL,\n\t\t\t id integer NOT NULL,\n\t\t\t CONSTRAINT eoo_pkey PRIMARY KEY (id),\n\t\t\t CONSTRAINT eoo_id_fkey FOREIGN KEY (id) REFERENCES geo.especies (id));\")\n\tconn.exec(\"SELECT AddGeometryColumn ('geo','eoo','geom',102033,'POLYGON',2);\")\n\tconn.exec(\"ALTER TABLE geo.eoo OWNER TO cncflora;\")\n\n\n\n\t## Table: geo.aoo\n conn.exec(\"DROP TABLE IF EXISTS geo.aoo;\")\n conn.exec(\"CREATE TABLE geo.aoo\n (gid serial NOT NULL,\n id integer,\n CONSTRAINT aoo_id_fkey FOREIGN KEY (id) REFERENCES geo.especies (id));\")\n\tconn.exec(\"SELECT AddGeometryColumn ('geo','aoo','geom',102033,'POLYGON',2);\")\n conn.exec(\"ALTER TABLE geo.aoo OWNER TO cncflora;\")\n\n\n\n\t## Table: geo.subpopulacoes\n\tconn.exec(\"DROP TABLE IF EXISTS geo.subpopulacao_remanescente;\")\n\tconn.exec(\"DROP TABLE IF EXISTS geo.subpopulacao_rodovia;\")\n\tconn.exec(\"DROP TABLE IF EXISTS geo.subpopulacao_mineracao;\")\n\tconn.exec(\"DROP TABLE IF EXISTS geo.subpopulacao_uc;\")\n\t#conn.exec(\"DROP TABLE IF EXISTS geo.subpopulacao_terra_indigena;\")\n\tconn.exec(\"DROP TABLE IF EXISTS geo.subpopulacao_incendios;\")\n\n\tconn.exec(\"DROP TABLE IF EXISTS geo.subpopulacoes;\")\n\tconn.exec(\"CREATE TABLE geo.subpopulacoes(\n\t\t\t gid serial NOT NULL,\n\t\t\t id integer,\n\t\t\t area_total double precision DEFAULT 0.0,\t\t\t \n\t\t\t area_remanescente double precision DEFAULT 0.0,\n\t\t\t area_rodovia double precision DEFAULT 0.0,\n\t\t\t remanescentes_sob_rodovia double precision DEFAULT 0.0,\n\t\t\t area_minerada double precision DEFAULT 0.0,\t\t\t \n\t\t\t area_uc double precision DEFAULT 0.0,\n\t\t\t area_remanescente_uc double precision DEFAULT 0.0,\n\t\t\t area_terra_indigena double precision DEFAULT 0.0,\n\t\t\t area_remanescente_terra_indigena double precision DEFAULT 0.0,\n\t\t\t porcentagem_remanescente double precision DEFAULT 0.0,\n\t\t\t porcentagem_rodovia double precision DEFAULT 0.0,\n\t\t\t porcentagem_minerada double precision DEFAULT 0.0,\n\t\t\t porcentagem_remanescente_rodovia double precision DEFAULT 0.0,\n\t\t\t porcentagem_remanescente_uc double precision DEFAULT 0.0,\n\t\t\t porcentagem_remanescente_terra_indigena double precision DEFAULT 0.0,\n\t\t\t total_incendios integer,\n\t\t\t indice_incendios double precision DEFAULT 0.0,\n\t\t\t CONSTRAINT subpopulacoes_pkey PRIMARY KEY (gid),\n\t\t\t CONSTRAINT subpopulacoes_id_fkey FOREIGN KEY (id) REFERENCES geo.especies (id));\")\n\tconn.exec(\"SELECT AddGeometryColumn ('geo','subpopulacoes','geom',102033,'POLYGON',2);\")\n\tconn.exec(\"ALTER TABLE geo.subpopulacoes OWNER TO cncflora;\")\n\n\n\n\t## Table: geo.subpopulacao_remanescente (relacionamento entre subpopulação, remanescentes e espécies. Antiga tabela remanescente_especie)\n\tconn.exec(\"CREATE TABLE geo.subpopulacao_remanescente(\n\t\t\t gid serial,\n\t\t\t gid_subpop integer,\n\t\t\t gid_remanescente integer,\n\t\t\t id integer NOT NULL,\n\t\t\t CONSTRAINT subpopulacao_remanescente_gid_pkey PRIMARY KEY (gid),\n\t\t\t CONSTRAINT subpopulacao_remanescente_gid_remanescente_fkey FOREIGN KEY (gid_remanescente) REFERENCES geo.remanescentes (gid),\n\t\t\t CONSTRAINT subpopulacao_remanescente_subpop_gid_fkey FOREIGN KEY (gid_subpop) REFERENCES geo.subpopulacoes (gid),\n\t\t\t CONSTRAINT subpopulacao_remanescente_id_fkey FOREIGN KEY (id) REFERENCES geo.especies (id));\")\n\tconn.exec(\"ALTER TABLE geo.subpopulacao_remanescente OWNER TO cncflora;\")\n\n\n\n\t## Table: geo.subpopulacao_rodovia\n\tconn.exec(\"CREATE TABLE geo.subpopulacao_rodovia(\n\t\t\t gid serial NOT NULL,\n\t\t\t gid_subpop integer,\n\t\t\t gid_rod integer,\n\t\t\t CONSTRAINT subpopulacao_rodovia_gid_pkey PRIMARY KEY (gid),\n\t\t\t CONSTRAINT subpopulacao_rodovia_gid_rod_fkey FOREIGN KEY (gid_rod) REFERENCES geo.rodovias (gid),\n\t\t\t CONSTRAINT subpopulacao_rodovia_gid_subpop_fkey FOREIGN KEY (gid_subpop) REFERENCES geo.subpopulacoes (gid));\")\n\tconn.exec(\"ALTER TABLE geo.subpopulacao_rodovia OWNER TO cncflora;\")\n\n\n\n\t## Table: geo.subpopulacao_mineracao\n\tconn.exec(\"CREATE TABLE geo.subpopulacao_mineracao(\n\t\t\t gid serial NOT NULL,\n\t\t\t gid_subpop integer,\n\t\t\t gid_mineracao integer,\n\t\t\t CONSTRAINT subpopulacao_mineracao_pkey PRIMARY KEY (gid),\n\t\t\t CONSTRAINT subpopulacao_mineracao_gid_mineracao_fkey FOREIGN KEY (gid_mineracao) REFERENCES geo.mineracao (gid),\n\t\t\t CONSTRAINT subpopulacao_mineracao_gid_subpop_fkey FOREIGN KEY (gid_subpop) REFERENCES geo.subpopulacoes (gid));\")\n\tconn.exec(\"ALTER TABLE geo.subpopulacao_mineracao OWNER TO cncflora;\")\n\n\n\n ## Table: geo.subpopulacao_incendios\n conn.exec(\"CREATE TABLE geo.subpopulacao_incendios(\n gid serial NOT NULL,\n gid_subpop integer,\n ano integer,\n mes integer,\n incendios integer,\n CONSTRAINT subpopulacao_incendios_gid_pkey PRIMARY KEY (gid),\n CONSTRAINT subpopulacao_incendios_gid_subpop_fkey FOREIGN KEY (gid_subpop) REFERENCES geo.subpopulacoes (gid));\")\n conn.exec(\"ALTER TABLE geo.subpopulacao_incendios OWNER TO cncflora;\")\n\n\n\n\t## Table: geo.subpopulacao_uc\n\tconn.exec(\"CREATE TABLE geo.subpopulacao_uc(\n\t\t\t gid serial NOT NULL,\n\t\t\t gid_subpop integer,\n\t\t\t gid_uc integer,\n\t\t\t CONSTRAINT subpopulacao_uc_gid_pkey PRIMARY KEY (gid),\n\t\t\t CONSTRAINT subpopulacao_uc_gid_subpop_fkey FOREIGN KEY (gid_subpop) REFERENCES geo.subpopulacoes (gid),\n\t\t\t CONSTRAINT subpopulacao_uc_gid_uc_fkey FOREIGN KEY (gid_uc) REFERENCES geo.ucs (gid));\")\n\tconn.exec(\"ALTER TABLE geo.subpopulacao_uc OWNER TO cncflora;\")\n\n\n=begin\n ## Table: geo.subpopulacao_terra_indigena\n conn.exec(\"CREATE TABLE geo.subpopulacao_terra_indigena(\n gid serial NOT NULL,\n gid_subpop integer,\n gid_terra_indigena integer,\n CONSTRAINT subpopulacao_terra_indigena_gid_pkey PRIMARY KEY (gid),\n CONSTRAINT subpopulacao_terra_indigena_gid_subpop_fkey FOREIGN KEY (gid_subpop) REFERENCES geo.subpopulacoes (gid),\n CONSTRAINT subpopulacao_terra_indigena_gid_uc_fkey FOREIGN KEY (gid_terra_indigena) REFERENCES geo.terra_indigena (gid));\")\n conn.exec(\"ALTER TABLE geo.subpopulacao_terra_indigena OWNER TO cncflora;\")\n\tputs \"CREATE TABLE - OK\"\n=end\n\n\n\n\t## Tabela: geo.tempos\n\tconn.exec(\"DROP TABLE IF EXISTS geo.tempos;\")\n\tconn.exec(\"CREATE TABLE geo.tempos(id integer NOT NULL,\n t_eoo double precision DEFAULT 0.0,\n t_aoo double precision DEFAULT 0.0,\n t_subpop double precision DEFAULT 0.0,\n t_subpop_rem double precision DEFAULT 0.0,\n t_subpop_rod double precision DEFAULT 0.0,\n t_subpop_min double precision DEFAULT 0.0,\n t_subpop_uc double precision DEFAULT 0.0,\n t_area_total_subpop double precision DEFAULT 0.0,\n t_area_rem double precision DEFAULT 0.0,\n t_area_min double precision DEFAULT 0.0,\n t_area_rod double precision DEFAULT 0.0,\n t_area_rem_rod double precision DEFAULT 0.0,\n t_area_uc double precision DEFAULT 0.0,\n t_area_rem_uc double precision DEFAULT 0.0,\n\t\t\t t_incendios_subpop double precision DEFAULT 0.0,\n t_total double precision DEFAULT 0.0,\n CONSTRAINT eoo_fkey FOREIGN KEY (id) REFERENCES geo.especies (id));\")\n conn.exec(\"ALTER TABLE geo.tempos OWNER TO cncflora;\")\n\n\n\n\n\nend",
"def set_db_options(options)\n\t\t\t\toptions[:collection]=options[:collection] || MongoozHash.get_class_name_without_namespace(self)\n\t\t\t\toptions[:db]=options[:db] || Mongooz.DEFAULT_DB\n\t\t\t\toptions[:host]=options[:host] || Mongooz.DEFAULT_HOST\n\t\t\t\toptions[:port]=options[:port] || Mongooz.DEFAULT_PORT\n\t\t\tend",
"def database \n # NOTE:: Having an instance variable here, causes problems\n # when having two Sinatra Apps, each with their own db setup.\n # the instance variable retains only the last setup, so the\n # first setup is overwritten.\n @database ||= ::DataMapper.setup(dm_setup_context, dm_database_url)\n end",
"def db\r\n @db ||= PG.connect(\r\n host: ENV['HOST'],\r\n user: ENV['USER_NAME'],\r\n password: ENV['PASSWORD'],\r\n dbname: ENV['DATABASE']\r\n )\r\nend",
"def switch_database\n # switch_to_database('entire_world')\n # switch_to_database('krakow')\n\n # create_new_gis_database('new_gis')\n # CartoCSSHelper::DataFileLoader.load_data_into_database(\"/home/mateusz/Downloads/export.osm\", true)\n # switch_databases('placenames', 'new_gis')\nend",
"def setup!\n ActiveRecord::Base.configurations[configuration_name] = db_config\n ActiveRecord::Base.establish_connection(configuration_name).connection\n self\n end",
"def set_owner(ownername)\n @result.owner = ownername\n end",
"def establish_postgres_connection(name = 'default')\n if database_config[name]\n ActiveRecord::Base.establish_connection(database_config[name][env].merge('database' => 'postgres',\n 'schema_search_path' => 'public'))\n end\n end",
"def owner; end",
"def owner; end",
"def postgres\n @postgres ||= Connections::Postgres.new(options: @postgres_options)\n end",
"def postgresql_user\n psql \"CREATE USER #{database_environment[:username]} WITH PASSWORD '#{database_environment[:password]}'\",\n :alias => \"postgresql_user\",\n :unless => psql_query('\\\\\\\\du') + \"| grep \\\"\\\\b#{database_environment[:username]}\\\\b\\\"\",\n :require => service('postgresql')\n end",
"def db; end",
"def db; end",
"def setprojectiontype(*)\n super\n end",
"def setup\n clear_db\n\n @db = Wgit::Database.new\n end",
"def ibmuser environment\n\nend",
"def set_owner_member\n self.organizations << self.owner\n end",
"def create_database\n DATA[:accounts].each do |account|\n CalendarCoordinator::AccountService.create(data: account).save\n end\n\n account = CalendarCoordinator::Account.first\n DATA[:calendars].each do |calendar|\n account.add_owned_calendar(calendar)\n end\n end",
"def orm; end",
"def database\n @database ||= determine_database\n end",
"def initializeORM()\n\t# nothing to do\nend",
"def apply_privileges(app_name=nil)\n return if credentials(app_name).nil?\n if is_postgresql()\n cmd_acl=\"GRANT CREATE ON SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL TABLES IN SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL FUNCTIONS IN SCHEMA PUBLIC TO PUBLIC;\\\n GRANT ALL ON ALL SEQUENCES IN SCHEMA PUBLIC TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO PUBLIC;\\\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO PUBLIC;\"\n# shell(cmd_acl,true)\n \n # reset the owner of the functions to the current user\n # when there is a 'privileged' app.\n app_name ||= @wrapped['director']['bound_app'] if @wrapped['director']\n if app_name\n cmd_select_fcts=\"SELECT pg_proc.proname FROM pg_catalog.pg_proc WHERE \\\n pg_proc.pronamespace=(SELECT pg_namespace.oid FROM pg_catalog.pg_namespace WHERE pg_namespace.nspname = 'public') \\\n AND pg_proc.proowner!=(SELECT oid FROM pg_roles WHERE rolname = 'postgres')\"\n current_owner=credentials()['username']\n unless current_owner\n STDERR.puts \"The application #{app_name} is not bound to the data-service #{name}; not applying the database privileges.\"\n return\n end\n fcts_name=shell(cmd_select_fcts,true,true)\n if fcts_name.empty?\n puts \"No need to re-assign the ownership of the functions in #{credentials()['name']}; the DB does not define its own functions.\" if VMC::Cli::Config.trace\n else\n fcts = fcts_name.split(\"\\n\").collect do |line|\n line.strip!\n \"'#{line}'\"\n end.join(',')\n cmd_change_fcts_owner=\"UPDATE pg_catalog.pg_proc \\\n SET proowner = (SELECT oid FROM pg_roles WHERE rolname = '#{current_owner}')\\\n WHERE pg_proc.proname IN (#{fcts})\"\n puts `sudo -u postgres psql --dbname #{credentials()['name']} -c \\\"#{cmd_change_fcts_owner}\\\" #{PSQL_RAW_RES_ARGS}`\n end\n end\n end\n end",
"def owner=(value)\n @owner = value\n end",
"def owner=(value)\n @owner = value\n end",
"def owner=(value)\n @owner = value\n end",
"def owner=(value)\n @owner = value\n end",
"def owner=(value)\n @owner = value\n end",
"def set_sybase_service(database = nil, domain = nil, username = nil, password = nil)\n @database = database\n @domain = domain\n @use_windows_auth = domain.nil?\n @user_name = username\n @password = password\n @service = Service::SYBASE\n end",
"def set_owner(id)\n self.owner_id = id\n end",
"def open\n create_database\n end",
"def initialize(database)\r\n @database = database\r\n end",
"def initialize(config)\n self.connection = ConnectionExtenders.db_connect config\n self.config = config\n self.manual_primary_keys = {}\n end",
"def owner_config\n edit do\n # Don't show owner field in new/edit\n exclude_fields :owner\n field :owner_id, :hidden do\n default_value do\n bindings[:view]._current_user.id\n end\n end\n end\n create do\n # Don't show owner field in new/edit\n exclude_fields :owner\n field :owner_id, :hidden do\n default_value do\n bindings[:view]._current_user.id\n end\n end\n end\n import do\n # Don't allow import to configure owner\n exclude_fields :owner\n end\nend",
"def grant_write_access(db, service)\n name = service.name\n db_connection = postgresql_connect(@postgresql_config[\"host\"],@postgresql_config[\"user\"],@postgresql_config[\"pass\"],@postgresql_config[\"port\"],name)\n service.bindusers.all.each do |binduser|\n user = binduser.user\n sys_user = binduser.sys_user\n sys_password = binduser.sys_password\n db_connection_sys_user = postgresql_connect(@postgresql_config[\"host\"],sys_user,sys_password,@postgresql_config[\"port\"],name)\n db_connection_sys_user.query(\"vacuum full\")\n db_connection_sys_user.close\n do_grant_query(db_connection,user,sys_user)\n end\n db_connection.query(\"grant create on schema public to public\")\n if get_postgres_version(db_connection) == '9'\n db_connection.query(\"grant all on all tables in schema public to public\")\n db_connection.query(\"grant all on all sequences in schema public to public\")\n db_connection.query(\"grant all on all functions in schema public to public\")\n else\n querys = db_connection.query(\"select 'grant all on '||tablename||' to public;' as query_to_do from pg_tables where schemaname = 'public'\")\n querys.each do |query_to_do|\n db_connection.query(query_to_do['query_to_do'].to_s)\n end\n querys = db_connection.query(\"select 'grant all on sequence '||relname||' to public;' as query_to_do from pg_class where relkind = 'S'\")\n querys.each do |query_to_do|\n db_connection.query(query_to_do['query_to_do'].to_s)\n end\n end\n db_connection.close\n service.quota_exceeded = false\n service.save\n rescue => e\n @logger.warn(\"PostgreSQL Node exception: #{e}\\n\" +\n e.backtrace.join(\"\\n\"))\n end",
"def initialize_database \n Object.send :const_set, :ORD, ActiveOrient::OrientDB.new( preallocate: false )\n if OrientDB::UsingJava\n Object.send :const_set, :DB, ActiveOrient::API.new( preallocate: false )\n else\n Object.send :const_set, :DB, ORD # ActiveOrient::OrientDB.new( preallocate: true )\n end\n\nend",
"def initialize_database \n Object.send :const_set, :ORD, ActiveOrient::OrientDB.new( preallocate: false )\n if OrientDB::UsingJava\n Object.send :const_set, :DB, ActiveOrient::API.new( preallocate: false )\n else\n Object.send :const_set, :DB, ORD # ActiveOrient::OrientDB.new( preallocate: true )\n end\n\nend",
"def alter_schemata\n end",
"def alter_schemata\n end",
"def set_transaction_variables\n sessionFactory = HibernateUtil.getSessionFactory(\"serverconf\")\n dialect = sessionFactory.getDialect\n if dialect.class == Java::EeRiaXroadCommonDb::CustomPostgreSQLDialect\n # If we are running on top of Postgres, the name of the logged-in\n # user must be made available within the transaction, for use\n # when updating the history table.\n # The value of user_name will go out of scope when the transaction\n # ends.\n query = @session.createSQLQuery(\n \"SET LOCAL xroad.user_name='#{current_user.name}'\")\n query.executeUpdate()\n end\n end",
"def database_connection\n\t\t\tPG.connect(dbname: \"Kung_Fu\")\n\t\tend",
"def ensure_physical_databases!\n @ensure_physical_databases ||= create_physical_databases\n end",
"def setup\n @user = users(:brock)\n end",
"def allow_remote_database_url; end",
"def db_settings\n cx = ActiveRecord::Base.connection_config.dup\n cx[:password] = '(hidden)'\n {\n current_database: Admin::MigrationGenerator.current_database,\n current_search_paths: Admin::MigrationGenerator.current_search_paths.join(', '),\n connection: cx\n }\n end",
"def initialize_db\n create_indexes_for_all_models\n end",
"def setorthographicprojection(*)\n super\n end",
"def initial_setup\n CORE.each { |c| c.auto_migrate! }\n end",
"def group_owner?\n super\n end",
"def group_owner?\n super\n end",
"def pg\n uri = URI.parse( hpg_resolve(shift_argument, \"DATABASE_URL\").url )\n config = {\n 'name' => gen_datasource_name(\"PostgreSQL\"),\n 'type' => \"POSTGRESQL\",\n 'config' => {\n 'host' => uri.host,\n 'port' => uri.port || 5432,\n 'database' => uri.path[1..-1],\n 'username' => uri.user,\n 'password' => uri.password,\n 'use_ssl' => true,\n 'validate_ssl_cert' => false\n }\n }\n open_jackdb(config)\n end",
"def owner=(attributes)\n @owner = User.new(attributes)\n end",
"def owner=(attributes)\n @owner = User.new(attributes)\n end",
"def default_orm=(orm)\n\t\t\t@default_orm = orm\n\t\tend",
"def get_layers\n conn = PG.connect(dbname: @base_name)\n conn.exec(\"SELECT * FROM geometry_columns\").field_values(\"f_table_name\")\n end",
"def schema_name\n @schema_name ||= owner_type.eql?('Root') ? owner.tenant.schema_name : schema_name_from_access_key_id\n end",
"def set_owner\n user = @conf['user'] || Process.uid\n group = @conf['group'] || Process.gid\n\n begin\n FileUtils.chown_R(user, group, @location)\n rescue StandardError => err\n Pemlogger.logit(err, :fatal)\n raise(err)\n end\n end"
] |
[
"0.5967111",
"0.58636177",
"0.5626587",
"0.5576757",
"0.55435574",
"0.5490979",
"0.54764825",
"0.54536545",
"0.54211426",
"0.5399195",
"0.5394341",
"0.5312541",
"0.5306964",
"0.5292873",
"0.52897614",
"0.5286431",
"0.5285781",
"0.52285874",
"0.5174421",
"0.51685476",
"0.51540464",
"0.51498586",
"0.5138686",
"0.5136332",
"0.51328087",
"0.5129745",
"0.51129925",
"0.51080745",
"0.5102053",
"0.50943184",
"0.5069818",
"0.5067338",
"0.50029397",
"0.5001445",
"0.49950308",
"0.4995015",
"0.4995015",
"0.49829414",
"0.49729988",
"0.49647236",
"0.4934869",
"0.49344447",
"0.492452",
"0.49174482",
"0.49168494",
"0.49153456",
"0.4914493",
"0.49090835",
"0.4898888",
"0.48904335",
"0.4884531",
"0.4883641",
"0.4883641",
"0.487879",
"0.4877004",
"0.4873924",
"0.4873924",
"0.4863725",
"0.48513025",
"0.48490682",
"0.48408854",
"0.4840609",
"0.4824575",
"0.4821674",
"0.481123",
"0.48109117",
"0.48098436",
"0.48098436",
"0.48098436",
"0.48098436",
"0.48098436",
"0.47927922",
"0.47915408",
"0.47893116",
"0.47828752",
"0.4782413",
"0.47716784",
"0.47712046",
"0.47703394",
"0.47703394",
"0.47698432",
"0.47698432",
"0.4769798",
"0.47668543",
"0.47497392",
"0.4747807",
"0.47470424",
"0.47458372",
"0.47423723",
"0.47413316",
"0.473113",
"0.47248504",
"0.47248504",
"0.47234628",
"0.47234282",
"0.47234282",
"0.4722037",
"0.47208878",
"0.4718371",
"0.47178528"
] |
0.55210555
|
5
|
Override to use su_username and su_password
|
def establish_master_connection
establish_connection(configuration.merge(
"database" => "postgres",
"password" => su_password,
"schema_search_path" => "public",
"username" => su_username
))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n super(\"ssh-userauth\")\n end",
"def session_passwd\n super\n end",
"def session_passwd\n super\n end",
"def passwd(*) end",
"def passwd(*) end",
"def setup_credentials\n\n cmd = @config[:path] + @command_line_tool + \" \" + @@login_command\n\n Open3.popen3( cmd ) { |input, output, error|\n input.puts @config[:url]\n input.puts @config[:user]\n input.puts @config[:password]\n input.close\n } \n\n end",
"def sql_user_opts(db_conf)\n user_opt = \"--user=#{db_conf['username']}\"\n password_opt = \"--password='#{db_conf['password']}'\"\n \"#{user_opt} #{password_opt if db_conf['password'].present?}\".strip\nend",
"def surun(command)\n password = fetch(:root_password, Capistrano::CLI.password_prompt(\"root password: \"))\n run(\"su - -c '#{command}'\") do |channel, stream, output|\n channel.send_data(\"#{password}n\") if output\n end\nend",
"def initialize(host, user, password, options = {})\n @host = host\n @user = user\n @password = password\n @status = 0\n @shell = nil\n @options = {\n :password => @password,\n :remember_host => false,\n :verbose => :warn,\n :non_interactive => true,\n :use_agent => false\n }.merge(options)\n\n # Pull the 'remember_host' key out of the hash because the SSH initializer will complain\n @remember_host = @options.delete(:remember_host)\n @su_user = @options.delete(:su_user)\n @su_password = @options.delete(:su_password)\n @passwordless_sudo = @options.delete(:passwordless_sudo)\n\n # Obsolete, delete if passed in\n @options.delete(:authentication_prompt_delay)\n end",
"def initialize(host, user, password = nil, options = {})\n @host = host\n @user = user\n @password = password\n\n @options = {\n :remember_host => false,\n :verbose => :warn,\n :non_interactive => true,\n :use_agent => false\n }.merge(options)\n\n @options[:password] = password if password\n\n # Pull our custom keys out of the hash because the SSH initializer will complain\n @remember_host = @options.delete(:remember_host)\n @su_user = @options.delete(:su_user)\n @su_password = @options.delete(:su_password)\n @passwordless_sudo = @options.delete(:passwordless_sudo)\n\n # Obsolete, delete if passed in\n @options.delete(:authentication_prompt_delay)\n end",
"def use_demo_credentials!\n self.username = 'demo'\n self.password = 'password'\n end",
"def username=(_arg0); end",
"def username=(_arg0); end",
"def username=(_arg0); end",
"def set_ssh_user(username, password)\n # Sets the credentials for a the remote SSH user\n @username = username\n @password = password\n end",
"def clean_args(args)\r\n require_arg(args, :username)\r\n require_arg(args, :password)\r\n args[:username] = args[:username].downcase\r\n args[:override] = false unless args.key?(:override)\r\n return args\r\n end",
"def username\n ENV['USER']\n end",
"def login\n username.set 'tomsmith'\n password.set 'SuperSecretPassword!'\n end",
"def basic_auth(u, p)\n @auth = {:username => u, :password => p}\n end",
"def setup_session_with_username\n method = 'smugmug.login.withPassword'\n setup_session_with [\"method=#{method}\",\"EmailAddress=#{@smug_user.email}\",\"Password=#{@smug_user.password}\"]\n end",
"def login_to_system(username='admin', password='dirtybird')\n self.username = username\n self.password = password\n\n # Hack to work-around issue with the login_page page object\n # where the password control is not available unless we \n # resize the browser.\n\n @browser.window.resize_to(1280, 1024)\n\n login\n end",
"def do_secure_accounts(instance)\n client = Client.open(instance, :no_password => true)\n q1 = \"UPDATE mysql.user SET Password = PASSWORD(\\'#{ROOT_PASSWORD}\\') where User = \\'root\\'\"\n q2 = \"UPDATE mysql.user SET Password = PASSWORD(\\'#{ROOT_PASSWORD}\\') where User = \\'\\'\"\n # q3 = \"CREATE USER \\'root\\'@\\'%.#{REPLICATION_DOMAIN}\\' IDENTIFIED BY \\'#{ROOT_PASSWORD}\\'\"\n # For testing with clients whose DHCP assigned IP address is not in DNS.\n q3 = \"CREATE USER \\'root\\'@\\'%' IDENTIFIED BY \\'#{ROOT_PASSWORD}\\'\"\n q4 = \"GRANT ALL PRIVILEGES ON *.* to \\'root\\'@\\'%\\' WITH GRANT OPTION\"\n q5 = \"FLUSH PRIVILEGES\"\n if client\n [q1, q2, q3, q4, q5].each do |query|\n puts query\n client.query(query)\n end\n end\n rescue Mysql2::Error => e\n puts e.message\n ensure\n client.close if client\n end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def set_auth(username, password)\r\n raise CLXException, 'Username must be a string' unless username.is_a? String\r\n raise CLXException, 'Password must be a string' unless password.is_a? String\r\n raise CLXException, 'Username can not be an empty string' unless username.length > 0\r\n raise CLXException, 'Password can not be an empty string' unless password.length > 0\r\n \r\n @username = username\r\n @password = password\r\n end",
"def add_default_auth(user, password, domain = T.unsafe(nil)); end",
"def set_basic_auth(config, options)\n if (login = options['login']) && (password = options['password'])\n \"#{login}:#{password}\"\n elsif (login = config.fetch('user.login') && (password = config.fetch('user.password')))\n \"#{login}:#{password}\"\n else\n nil\n end\n end",
"def bind_password\n super\n end",
"def passwd=(p0) end",
"def passwd=(p0) end",
"def authentication\n username = config[:svn_username]\n return \"\" unless username\n result = \"--username #{config[:svn_username]} \"\n result << \"--password #{config[:svn_password]} \"\n result\n end",
"def authentication\n auth = \"\"\n auth << \"--username #{variable(:scm_username)} \" if variable(:scm_username)\n auth << \"--password #{variable(:scm_password)} \" if variable(:scm_password)\n auth << \"--no-auth-cache\" if !auth.empty?\n auth\n end",
"def ssh_user(val=nil)\n from_setting_or_image_info :ssh_user, val, 'root'\n end",
"def logon2(username, password, dbname, mode)\n #This is a stub, used for indexing\n end",
"def username\n ENV.fetch(\"USERNAME\")\nend",
"def username\n ENV.fetch(\"USERNAME\")\nend",
"def process_auth\n return if username.empty? || password.empty?\n \"#{username}:#{password}\"\n end",
"def replication_credentials\n user = false\n pass = false\n if master || slaves.count > 0\n target = (@master ? self : @slaves[0])\n results = target.ssh_cmd(\"cat #{mysql_directory}/master.info | head -6 | tail -2\").split\n if results.count == 2 && results[0] != 'test'\n user, pass = results\n end\n end\n user && pass ? {user: user, pass: pass} : Jetpants.replication_credentials\n end",
"def user\n ENV['SERVER_USER']\n end",
"def ssh_user(arg=nil)\n set_or_return(:ssh_user, arg, :kind_of => String)\n end",
"def db_connection\n {:host => new_resource.superuser_host, :username => new_resource.superuser, :password => new_resource.superuser_password}\nend",
"def set_password; nil; end",
"def credentials(user, ssh_opts)\n @ssh_options=ssh_opts\n @user_name = user\n end",
"def initialize(\n username: self.class.username,\n password: self.class.password\n )\n @username = username.to_s.clone\n @password = password.to_s.clone\n end",
"def login(user='root', options={})\n current = functions\n begin\n @functions = nil\n \n path = capture_script(options) { yield }\n execute 'su', user, path, :l => true\n ensure\n @functions = current\n end\n chain_proxy\n end",
"def initialize(options = {})\n self.username = options[:username]\n self.password = options[:password]\n end",
"def capable_login_auth?; end",
"def post_init\n send_message :PASS, @settings[:server_password] if @settings[:server_password]\n send_message :USER, @settings[:ident], \"0\", \"0\", @settings[:realname]\n send_message :NICK, @settings[:nick]\n end",
"def initialize(options={})\n @system_id = options[:system_id] || Getty.system_id\n @system_pwd = options[:system_pwd] || Getty.system_pwd\n @user_name = options[:user_name] || Getty.user_name\n @user_pwd = options[:user_pwd] || Getty.user_pwd\n @connection_middleware = options[:connection_middleware] || Getty.connection_middleware || []\n @connection_middleware += DEFAULT_CONNECTION_MIDDLEWARE\n @ssl = options[:ssl] || { :verify => false }\n end",
"def userinfo\n if @user.nil?\n nil\n elsif @password.nil?\n @user\n else\n @user + ':' + @password\n end\n end",
"def puppet_user(host)\n puppet_config(host, 'user', section: 'master')\n end",
"def add_default_auth(user, pass, domain = T.unsafe(nil)); end",
"def initialize\n\t\t@auth = {\n\t\t\t:username=>ENV['impac_username'], \n\t\t\t:password=>ENV['impac_password']\n\t\t}\n\tend",
"def username(u)\n @config[:username] = u\n end",
"def login\n $log.debug \"Logging in\" \n `./nplogin #{@@username} #{@@password}`\n end",
"def username\n \"administrator\"\n end",
"def username\n self['default_rhlogin']\n end",
"def credentials\n return nil if username.nil? || password.nil?\n \"#{username}:#{password}\"\n end",
"def ascii_login_and_enable(session,new_body)\n authen_start = session.authen_start\n authen_cont = session.authen_cont\n\n if (!session.reply.body) # no previous conversation has taken place\n if (authen_start.body.user_len == 0)\n # request username\n new_body.status_getuser!\n new_body.server_msg = @tacacs_daemon.login_prompt\n else\n # request password\n session.getuser = authen_start.body.user\n new_body.status_getpass!\n new_body.flag_noecho!\n new_body.server_msg = @tacacs_daemon.password_prompt\n end\n\n else # make sure we got what we asked for in last reply\n if (session.reply.body.status_getuser?)\n if (authen_cont.body.user_msg_len != 0)\n # request password\n session.getuser = authen_cont.body.user_msg\n new_body.status_getpass!\n new_body.flag_noecho!\n new_body.server_msg = @tacacs_daemon.password_prompt\n\n else\n # fail\n new_body.status_fail!\n new_body.server_msg = \"Username requested but none provided.\"\n end\n\n elsif (session.reply.body.status_getpass?)\n if (authen_cont.body.user_msg_len != 0)\n # determine pass/fail status\n username = session.getuser\n password = authen_cont.body.user_msg\n pass_fail = authenticate(username, password, session.authen_start)\n\n # set reply based on pass_fail\n if (pass_fail[:pass])\n new_body.status_pass!\n else\n new_body.status_fail!\n new_body.server_msg = pass_fail[:msg]\n end\n\n else\n # fail\n new_body.status_fail!\n new_body.server_msg = \"Password requested but none provided.\"\n end\n\n else\n # all other statuses are in error, so some sort of internal error must have occured\n new_body.status_error!\n new_body.server_msg = \"Internal Server Error. Unexpected status for ASCII login/enable: #{session.reply.body.status}\"\n @tacacs_daemon.log(:erro,['msg_type=Authentication', \"message=#{new_body.server_msg}\", \"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n\n end\n end\n\n return(nil)\n end",
"def add_default_auth user, pass, domain = nil\n warn <<-WARN\nYou have supplied default authentication credentials that apply to ANY SERVER.\nYour username and password can be retrieved by ANY SERVER using Basic\nauthentication.\n\nTHIS EXPOSES YOUR USERNAME AND PASSWORD TO DISCLOSURE WITHOUT YOUR KNOWLEDGE.\n\nUse add_auth to set authentication credentials that will only be delivered\nonly to a particular server you specify.\n WARN\n\n @default_auth = [user, pass, domain]\n end",
"def replication_credentials\n {user: @config['mysql_repl_user'], pass: @config['mysql_repl_password']}\n end",
"def auth(username, password)\n @username, @password = username, password\n end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def username; end",
"def username; end",
"def username; end",
"def username; end",
"def set_admin_user(user, password)\n @user = user\n @password = password\n end",
"def password\n super\n end",
"def passwd\r\n @password = \"12345\"\r\n end",
"def set_connection()\n ::Jenkins::Client.configure do |c|\n c.username = self[:username]\n c.password = self[:password]\n c.url = self[:url]\n end\n end",
"def auth(user, password)\n @connection.bind(method: :simple, username: user.dn, password: password)\n end",
"def login_from_config\n self.current_user = User.find(BETY_USER) if defined? BETY_USER\n end",
"def setpwent\n ::Etc.setpwent\n end",
"def auth(username, password)\n @user = username\n @pass = password\n\n return self\n end",
"def debian_password\n nil\n end",
"def define_user\n case new_resource.im_install_mode\n when 'admin'\n user = if new_resource.user.nil?\n 'root'\n else\n unless im_user_exists_unix?(new_resource.user)\n Chef::Log.fatal \"User Name provided #{new_resource.user}, does not exist\"\n raise \"User Verification 1: User Name provided #{new_resource.user}, does not exist\"\n end\n new_resource.user\n end\n user\n when 'nonAdmin', 'group'\n user = if new_resource.user.nil?\n Chef::Log.fatal \"User Name not provided! Please provide the user that should be used to install your product\"\n raise \"User Name not provided! Please provide the user that should be used to install your product\"\n else\n unless im_user_exists_unix?(new_resource.user)\n Chef::Log.fatal \"User Name provided #{new_resource.user}, does not exist\"\n raise \"User Verification 1: User Name provided #{new_resource.user}, does not exist\"\n end\n new_resource.user\n end\n user\n end\nend",
"def define_user\n case new_resource.im_install_mode\n when 'admin'\n user = if new_resource.user.nil?\n 'root'\n else\n unless im_user_exists_unix?(new_resource.user)\n Chef::Log.fatal \"User Name provided #{new_resource.user}, does not exist\"\n raise \"User Verification 1: User Name provided #{new_resource.user}, does not exist\"\n end\n new_resource.user\n end\n user\n when 'nonAdmin', 'group'\n user = if new_resource.user.nil?\n Chef::Log.fatal \"User Name not provided! Please provide the user that should be used to install your product\"\n raise \"User Name not provided! Please provide the user that should be used to install your product\"\n else\n unless im_user_exists_unix?(new_resource.user)\n Chef::Log.fatal \"User Name provided #{new_resource.user}, does not exist\"\n raise \"User Verification 1: User Name provided #{new_resource.user}, does not exist\"\n end\n new_resource.user\n end\n user\n end\nend",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def username\n if @username.nil?\n if os_type(:nice, :not_extended) == 'Solaris'\n @username = @platform.exec(\"/usr/ucb/whoami\").strip\n else\n @username = @platform.exec(\"whoami\").strip\n end\n end\n \n @username\n end",
"def credentials=(_arg0); end",
"def credentials=(_arg0); end",
"def credentials=(_arg0); end",
"def credentials=(_arg0); end",
"def credentials=(_arg0); end",
"def initialize(basic_auth_user_name: nil, basic_auth_password: nil)\r\n Configuration.basic_auth_user_name = basic_auth_user_name if\r\n basic_auth_user_name\r\n Configuration.basic_auth_password = basic_auth_password if\r\n basic_auth_password\r\n end",
"def user_cred(role='admin', some_login,some_pass)\n if role == 'developer'\n @dev_user = some_login\n @dev_password = some_pass\n elsif role == 'admin'\n @admin_user = some_login\n @admin_password = some_pass\n end\n end",
"def enable_root(host)\n host['ssh'] = {:password => host['instance'].id}\n @logger.notify(\"netscaler: nsroot password is #{host['instance'].id}\")\n #if host['user'] != 'root'\n # host.exec(Command.new(\"modify sys db systemauth.disablerootlogin value false\"), :acceptable_exit_codes => [0,1])\n # for tries in 1..10\n # begin\n # #This command is problematic as the netscaler is not always done loading\n # if host.exec(Command.new(\"modify sys global-settings gui-setup disabled\"), :acceptable_exit_codes => [0,1]).exit_code == 0 and host.exec(Command.new(\"save sys config\"), :acceptable_exit_codes => [0,1]).exit_code == 0\n # backoff_sleep(tries)\n # break\n # elsif tries == 10\n # raise \"Instance was unable to be configured\"\n # end\n # rescue Beaker::Host::CommandFailure => e\n # @logger.debug(\"Instance not yet configured (#{e})\")\n # end\n # backoff_sleep(tries)\n # end\n # host['user'] = 'root'\n # host.close\n # sha256 = Digest::SHA256.new\n # password = sha256.hexdigest((1..50).map{(rand(86)+40).chr}.join.gsub(/\\\\/,'\\&\\&'))\n # host['ssh'] = {:password => password}\n # host.exec(Command.new(\"echo -e '#{password}\\\\n#{password}' | tmsh modify auth password admin\"))\n # @logger.notify(\"netscaler: Configured admin password to be #{password}\")\n # host.close\n #end\n end",
"def login\n # check if file credential exists\n if File.file?(@@credentials_file)\n puts 'Credentials file found!'.bold\n unless yes?(\"Overwrite #{@@credentials_file}? |no|\".bold.yellow)\n puts \"Aborted.\".red.bold\n exit\n end\n end\n\n # Ask for username and password, mask the password and make it\n # green if it's the correct password, red if the access was denied.\n # Aborts if the password is empty.\n puts 'Write your username and password for ' + 'RubyGems.org'.yellow.bold\n username = ask('Username:'.yellow.bold)\n password = ask('Password:'.yellow.bold, echo: false)\n (puts \"Aborted.\".red.bold; exit) if password.empty?\n\n # fakes a masked password as long as the username,\n # for style purposes only.\n masked_password = '*' * username.length\n print masked_password unless options[:show_password]\n\n begin\n Tmg.write_credentials(username, password)\n rescue RuntimeError\n puts \"\\b\" * masked_password.length + masked_password.red.bold\n puts 'Access Denied.'.red.bold\n exit\n else\n puts \"\\b\" * masked_password.length + masked_password.green.bold\n puts \"Credentials written to #{@@credentials_file}\".green.bold\n end\n end",
"def initialize opts\n @host = opts[:host]\n @pass = opts[:pass]\n @user = opts[:user]\n end"
] |
[
"0.68070596",
"0.64964235",
"0.64964235",
"0.6370419",
"0.6370419",
"0.63482475",
"0.62980735",
"0.62621254",
"0.62514716",
"0.6160244",
"0.6150333",
"0.610928",
"0.610928",
"0.610928",
"0.6104333",
"0.60956097",
"0.60879886",
"0.60374445",
"0.60262877",
"0.60214937",
"0.6005784",
"0.59976494",
"0.5980078",
"0.5980078",
"0.5980078",
"0.5980078",
"0.5976107",
"0.59748304",
"0.5973542",
"0.5973262",
"0.59718704",
"0.59718704",
"0.5968204",
"0.59555405",
"0.5925013",
"0.59210145",
"0.5893292",
"0.5893292",
"0.5892711",
"0.5890544",
"0.5886118",
"0.5860581",
"0.584361",
"0.5833861",
"0.58244354",
"0.58157146",
"0.5810082",
"0.57855576",
"0.5778298",
"0.57722384",
"0.5761633",
"0.57600296",
"0.5758436",
"0.5755904",
"0.57557374",
"0.5740314",
"0.57205653",
"0.57187366",
"0.57146484",
"0.57127047",
"0.57092106",
"0.57058245",
"0.57018816",
"0.5677901",
"0.5676888",
"0.5676888",
"0.5676888",
"0.5676888",
"0.5676888",
"0.5676888",
"0.567528",
"0.567528",
"0.567528",
"0.567528",
"0.5672417",
"0.5663668",
"0.5661096",
"0.565968",
"0.56577414",
"0.56528395",
"0.5646624",
"0.5645118",
"0.5631807",
"0.56246847",
"0.56246847",
"0.5614224",
"0.5614224",
"0.5614224",
"0.5614224",
"0.5614224",
"0.561302",
"0.56003827",
"0.56003827",
"0.56003827",
"0.56003827",
"0.56003827",
"0.5597866",
"0.5595225",
"0.5595071",
"0.5590876",
"0.5588827"
] |
0.0
|
-1
|
must figure out dependent destroy on polymorphic table
|
def is_about
downcased_noteable_type = self.noteable_type.downcase
if downcased_noteable_type == "comment"
if Comment.find(self.noteable_id).sentence == nil
self.destroy
"Notification Removed"
elsif Comment.find(self.noteable_id).sentence.paragraph.story
Comment.find(self.noteable_id).sentence.paragraph.story.title
else
"Notification Removed"
end
else
Course.find(Enrollment.find(self.noteable_id).course_id).name
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def detach parent\n\n # the ordinary *able table\n parent.send( self.class.to_s.underscore.pluralize).delete self\n\n # case child.class.to_s\n # when \"Event\",\"WageEvent\"\n # ev = Eventable.where( event: child, eventable: self)\n # ev.delete_all\n # when \"Printer\"\n # pr = Printable.where( printer: child, printable: self)\n # pr.delete_all\n # else\n # children = eval child.class.to_s.downcase.pluralize\n # children.delete child\n # end\n rescue\n false\n end",
"def perform_some_actions\n # It is to be called while destroying a Child record\n # But must not be called while destroying the parent record\n unless self.parent.destroyed?\n\n end\n end",
"def destroy(table)\n end",
"def destroy(*records)\n if self.class.name == \"ActiveRecord::Associations::HasManyThroughAssociation\"\n through_association.load_target\n records.each do |record|\n through_records_for(record).each do |through_record|\n through_record.before_remove if through_record.respond_to? :before_remove\n end\n end\n end\n super(*records)\n end",
"def delete_all\n @reflection.through_reflection.klass.delete_all(@reflection.through_reflection.primary_key_name => @owner.id)\n reload\n end",
"def after_destroy\n super\n touch_associations\n end",
"def destroy\n has_many_columns.each do |col|\n delete_candidates = self.send(col.name)\n\n delete_candidates.each do |candidate|\n candidate.delete if col.destroy == :delete\n candidate.destroy if col.destroy == :destroy\n end\n end\n delete\n end",
"def delete_relation_for association\n @relations.reject!{ |r| r.association == association || r.association == association.singularize}\n end",
"def destroy_dependents\n self.clouds.each do |cloud| cloud.destroy end\n self.groups.each do |group| group.destroy end\n self.roles.each do |role| role.destroy end\n self.recipes.each do |recipe| recipe.destroy end\n self.questions.each do |question| question.destroy end\n end",
"def destroy(also_opinions=false)\n opinions.each(&:destroy) if also_opinions\n super() \n end",
"def destroy_related\n \tdestroyable_ages = []\n\t \tage_bracket_ids = self.age_brackets.pluck(:id)\n \t\t\tage_bracket_ids.each do |id|\n \t\t\t\tagesets = AgeSet.where(age_bracket_id: id)\n if agesets.any? && agesets.count == 1\n destroyable_ages << agesets\n end\n\t\t\tend\n\t \tdestroyable_ages.each { |age| age.first.age_bracket.destroy }\n\t \tself.destroy \n end",
"def remove_orphans(type_id = nil)\n call(:delete, orphan_path(type_id))\n end",
"def destroy_associations\n end",
"def before_destroy; raise ActiveRecord::ReadOnlyRecord; end",
"def test_relationship_deletion\n #This is a superwork work rel\n rel = Relationship.find(309)\n n_superwork_rels = SuperworkRelationship.count\n n_work_rels = WorkRelationship.count\n \n rel.destroy\n assert_raise ActiveRecord::RecordNotFound do\n rel.reload\n end\n \n #check dependent columns are deleted\n assert_equal n_superwork_rels-1, SuperworkRelationship.count\n assert_equal n_work_rels -1, WorkRelationship.count\n end",
"def removing_plan_relation(transaction, parent, child, relations); end",
"def remove_dependent_entries\n product = self.product\n variants = (product.variants.present? ? product.variants : product.master)\n product.stock_products.where(:sellers_market_places_product_id=>self.id).destroy_all\n #product.title_managements.where(:market_place_id=>self.market_place_id).destroy_all\n #product.description_managements.where(:market_place_id=>self.market_place_id).destroy_all\n #variants.each do |variant|\n # variant.price_managements.where(:market_place_id=>self.market_place_id).destroy_all\n #end\n end",
"def drop_table(klass)\n # Remove leftover data from some join tabkes.\n klass.relations.each do |rel|\n if rel.class.to_s == \"Og::JoinsMany\" and rel.join_table\n target_class = rel.target_class\n exec \"DELETE FROM #{rel.join_table}\"\n end\n end\n exec \"DROP TABLE #{klass.table}\"\n end",
"def destroy_without_callbacks\n self.class.update_all(\n \"#{destroyed_field} = #{self.class.connection.quote(( field_destroyed.respond_to?(:call) ? field_destroyed.call : field_destroyed))}\",\n \"id = #{self.id}\"\n )\n end",
"def destroy\n self.class.where(:id => self.id).update_all(:is_mirrored => false) if self.is_mirrored?\n super\n end",
"def after_destroy\n ExhibitItem.destroy_all( [ \"exhibiting_id=? AND exhibiting_type=?\", self.id, self.class.name ] )\n ResourceListItem.destroy_all( [ \"resource_listing_id=? AND resource_listing_type=?\", self.id, self.class.name ] )\n PackageItem.destroy_all( [ \"packaging_id=? AND packaging_type=?\", self.id, self.class.name ] )\n end",
"def destroy\n\n destroyable = true\n\n gallery = Gallery.find(params[:id])\n parent_object = gallery.get_parent_object\n\n\n if(gallery.pictures.size>0)\n destroyable = false\n end\n\n if gallery.comments.size>0\n destroyable = false\n end\n\n\n\n if destroyable\n gallery.destroy\n else\n gallery.pictures.each do |picture|\n picture.suspend!\n end\n gallery.suspend!\n end\n\n respond_to do |format|\n flash[:notice] = I18n.t('galleries.controller.Successfully_destroyed')\n format.html { redirect_to(url_for_even_polymorphic(parent_object)) }\n format.xml { head :ok }\n end\n end",
"def rem_types_pgs\n \tpages = Page.where(type_id: self.id)\n\tpages.each do |p|\n\t p.fields.each do |f|\n\t \tf.destroy\n\t end\n\t p.type_id = nil\n\t p.save\n\tend\n end",
"def deleted\n @deleted.map do |index|\n if polymorphic?\n rod_id = @database.polymorphic_join_index(@offset,index)\n if rod_id != 0\n klass = Model.get_class(@database.polymorphic_join_class(@offset,index))\n end\n else\n klass = @klass\n rod_id = @database.join_index(@offset,index)\n end\n rod_id == 0 ? nil : klass.find_by_rod_id(rod_id)\n end\n end",
"def destroy\n DB.execute <<SQL\nDELETE FROM #{self.class.table}\nWHERE id = #{@hash['id']}\nSQL\n end",
"def test_destroy_dependents\n # Establish dependent relationship between Person and PersonalLegacyThing\n add_counter_column_to(Person, \"personal_legacy_things_count\")\n PersonalLegacyThing.reset_column_information\n\n # Make sure that counter incrementing doesn't cause problems\n p1 = Person.new(first_name: \"fjord\")\n p1.save!\n t = PersonalLegacyThing.new(person: p1)\n t.save!\n p1.reload\n assert_equal 1, p1.personal_legacy_things_count\n assert p1.destroy\n assert_equal true, p1.frozen?\n assert_raises(ActiveRecord::RecordNotFound) { Person.find(p1.id) }\n assert_raises(ActiveRecord::RecordNotFound) { PersonalLegacyThing.find(t.id) }\n ensure\n remove_counter_column_from(Person, \"personal_legacy_things_count\")\n PersonalLegacyThing.reset_column_information\n end",
"def before_destroy\n items.each(&:destroy)\n permissions.each(&:destroy)\n comments.each(&:destroy)\n super\n end",
"def remove_relation\n relation_scope.where(@id_key => deleted_remote_objects_ids)\n end",
"def define_after_destroy_callback(klass)\n # Clean up *all* leftover translations of this model, only once.\n b = self\n translation_classes = [class_name, *Mobility::Backends::Sequel::KeyValue::Translation.descendants].uniq\n klass.define_method :after_destroy do\n super()\n\n @mobility_after_destroy_translation_classes = [] unless defined?(@mobility_after_destroy_translation_classes)\n (translation_classes - @mobility_after_destroy_translation_classes).each do |translation_class|\n translation_class.where(:\"#{b.belongs_to}_id\" => id, :\"#{b.belongs_to}_type\" => self.class.name).destroy\n end\n @mobility_after_destroy_translation_classes += translation_classes\n end\n end",
"def og_delete(store, cascade = true)\n pk_field = self.class.primary_key\n pk_field = self.class.ann(pk_field, :field) || pk_field\n pk = instance_variable_get(\"@#{pk_field}\")\n\n transaction_raise do |tx|\n if cascade && descendants = self.class.ann(:self, :descendants)\n descendants.each do |descendant|\n case descendant\n when ManyToMany\n # delete all entries in the join table pointing to current obj\n tx.exec \"DELETE FROM #{descendant.join_table} WHERE #{descendant.owner_key}=#{store.quote(pk)}\"\n when BelongsTo\n # delete all objecs belonging to the current obj\n descendant.owner_class.find(:where => \"#{descendant.foreign_key} = #{store.quote(pk)}\", :extra_condition => nil).each {|x| x.delete }\n end\n end\n end\n # delete obj itself\n tx.exec \"DELETE FROM #{self.class.table} WHERE #{pk_field}=#{store.quote(pk)}\"\n end\n end",
"def destroy_constraints_statements(repository_name, model)\n model.many_to_one_relationships.map do |relationship|\n table_name = model.storage_name(repository_name)\n constraint_name = constraint_name(table_name, relationship.name)\n next unless constraint_exists?(table_name, constraint_name)\n\n destroy_constraints_statement(table_name, constraint_name)\n\n end.compact\n end",
"def destroy_without_callbacks\r\n where_clause_terms = [self.class.primary_key, quoted_id].transpose.map do |pair| \r\n \"(#{connection.quote_column_name(pair[0])} = #{pair[1]})\"\r\n end\r\n where_clause = where_clause_terms.join(\" AND \")\r\n unless new_record?\r\n connection.delete(\r\n \"DELETE FROM #{self.class.quoted_table_name} \" +\r\n \"WHERE #{where_clause}\",\r\n \"#{self.class.name} Destroy\"\r\n )\r\n end\r\n freeze\r\n end",
"def delete_all\n ActiveRecord::Base.send( :subclasses ).each do |subclass|\n if subclass.table_exists? && subclass.respond_to?(:delete_all)\n subclass.delete_all\n end\n end\n end",
"def destroy\n @low_type.destroy\n end",
"def clean_up\n if self.deleted?\n # clean room type mapping\n RoomTypeChannelMapping.find_all_by_room_type_id(self.id).each do |rtcm|\n rtcm.update_attribute(:deleted, true)\n end\n # clean master rate mapping\n RoomTypeMasterRateMapping.find_all_by_room_type_id(self.id).each do |rtmr|\n RoomTypeMasterRateChannelMapping.find_all_by_room_type_master_rate_mapping_id(rtmr.id).each do |rtc|\n rtc.update_attribute(:deleted, true)\n end\n rtmr.update_attribute(:deleted, true)\n end\n # clean availability link from\n RoomTypeInventoryLink.find_all_by_room_type_from_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n # clean availability link to\n RoomTypeInventoryLink.find_all_by_room_type_to_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n end\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end\n end",
"def destroy\n result = nil\n obj = self.inst_strip_braces(self.object)\n if obj\n # first delete the record from viewable list\n result = Rhom::RhomDbAdapter::delete_from_table(Rhom::TABLE_NAME,\n {\"object\"=>obj})\n # now add delete operation\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"update_type\"=>'delete'})\n end\n result\n end",
"def destroy\n # Delete all associated records first\n MysqlAdapter.delete \"DELETE FROM #{Record.table_name} WHERE domain_id = #{id}\"\n\n # Then proceed with deletion\n super\n rescue Mysql::Error\n false\n end",
"def destroy\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to polymorphic_path([@providerable, :provider_insurances]) }\n format.json { head :no_content }\n end\n end",
"def cascade\n if relation\n if relation.is_a?(Enumerable)\n relation.entries\n relation.each { |doc| doc.destroy }\n else\n relation.destroy\n end\n end\n end",
"def destroy\n return unless destroyable?\n super\n end",
"def destroy\n @type = Type.find(params[:id])\n @parent_type = Type.where(:parent_id => @type.id)\n respond_to do |format|\n if @type.destroy\n @parent_type.destroy_all\n flash.now[:notice] = 'Type was successfully deleted.'\n @type = Type.new\n get_paginated_types\n else\n flash.now[:error] = 'Type can not be removed because it is already in use.'\n end\n format.js\n end\n end",
"def delete(table, ids) # abstract\n end",
"def destroy; delete end",
"def destroy_taggings\n Tagging.where(:tag_id => self.id).each do |tagging|\n tagging.not_orphans = true\n tagging.destroy\n end\n end",
"def ensure_cascade_on_associations\n # ensure all BQ data is cleaned up first\n self.delete_convention_data\n self.study_files.each do |file|\n DataArray.where(study_id: self.id, study_file_id: file.id).delete_all\n end\n Gene.where(study_id: self.id).delete_all\n CellMetadatum.where(study_id: self.id).delete_all\n PrecomputedScore.where(study_id: self.id).delete_all\n ClusterGroup.where(study_id: self.id).delete_all\n StudyFile.where(study_id: self.id).delete_all\n DirectoryListing.where(study_id: self.id).delete_all\n UserAnnotation.where(study_id: self.id).delete_all\n UserAnnotationShare.where(study_id: self.id).delete_all\n UserDataArray.where(study_id: self.id).delete_all\n AnalysisMetadatum.where(study_id: self.id).delete_all\n StudyFileBundle.where(study_id: self.id).delete_all\n end",
"def delete\n # Figure out the table's name from the object we're calling the method on.\n table_name = self.class.to_s.pluralize.underscore\n CONNECTION.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\") # need to see if this one will work, if not look up.\n end",
"def test_stats_cascade_delete\n\t\tres = DB.exec(\"SELECT person_id FROM stats WHERE id=8\")\n\t\tassert_equal '5', res[0]['person_id']\n\t\tDB.exec(\"DELETE FROM people WHERE id=5\")\n\t\tres = DB.exec(\"SELECT person_id FROM stats WHERE id=8\")\n\t\tassert_equal 0, res.ntuples\n\tend",
"def remove_only_type_foreign_keys\n @foreign_keys.each { |table, foreign_keys|\n foreign_keys.delete_if { |key| key =~ /_type$/ }\n }\n end",
"def before_destroy\n\t\tsuper\n\t\tchrome_pdf_tasks.each { |t| t.destroy }\n\t\tdiff_stream.each { |c| c.destroy }\n\n\t\t# save photo list, so we can traverse it\n\t\tp = photos.collect { |x| x }\n\t\t# destroys the association\n\t\tremove_all_photos\n\t\t# remove orphan photos\n\t\tp.each do |photo|\n\t\t\t# destroy photos if we are the only book\n\t\t\tsuccess = true\n\t\t\tsuccess = photo.destroy if photo.books.count == 0\n\t\t\tPB.logger.error \"Could not destroy photo #{photo.id}\" unless success\n\t\tend\n\tend",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destoy_old_factors\r\n User_factor.all.each do |factor|\r\n factor.destroy\r\n end\r\n\r\n Film_factor.all.each do |factor|\r\n factor.destroy\r\n end\r\n\r\n Factor.all.each do |factor|\r\n factor.destroy\r\n end\r\n end",
"def clean_database\n [Entry, Room, User].each do |model|\n model.delete_all\n end\nend",
"def purge_associations\n EspRulesList.where(list_type: type, list_id: id).delete_all\n ExportedLead.where(list_type: type, list_id: id).delete_all\n MessageAutoResponse.where(esp_list_type: type, esp_list_id: id).delete_all\n end",
"def remove(type); end",
"def destroy\n ret_val = error_if_exists('destroy')\n # Rails.logger.debug (\"* Models::Deactivated.destroy - destroy error check ret_val: #{ret_val}\")\n super if ret_val\n return ret_val\n rescue ActiveRecord::InvalidForeignKey => e\n if errors\n errors.add(:base, I18n.translate('errors.error_dependencies' ) )\n end\n end",
"def destroy\n object_data.each {|o| ObjectDatum.find_by_guid(o.guid).destroy if o && ObjectDatum.find_by_guid(o.guid)}\n super\n end",
"def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end",
"def delete_orphans\n count = 0\n mapper.dataset.each do |content|\n unless valid_path?(content)\n content.destroy\n count += 1\n end\n end\n @dirty ||= (count > 0)\n count\n end",
"def before_destroy\n\n end",
"def cleanup_after_destroy\n ActiveRecord::Base.connection.execute(\"DELETE FROM dynamo_field_values WHERE model_id = #{self.id}\")\n end",
"def destroy\n run_callbacks :destroy do \n self.update_column(:deleted, true)\n end\n end",
"def did_destroy\n @destroyed = true\n self.class.identity_map.delete self.id\n self.class.all.delete self\n\n trigger_events(:destroy)\n end",
"def remove_relation\n relation_scope.where.not(@id_key => remote_objects_ids)\n end",
"def delete_all(klass)\n sql = \"DELETE FROM #{klass.table}\"\n sql << \" WHERE ogtype='#{klass}'\" if klass.schema_inheritance? and not klass.schema_inheritance_root?\n exec sql\n end",
"def destroy_owner!\n\t\tif not ActiveRecord::Base.connection.table_exists? 'model_owners'\n\t\t\treturn\n\t\tend\n\t\towner = ModelOwner.where(:inki_model_name => self.class.table_name, :model_id => self.id).first\n\t\towner.delete if owner\n\tend",
"def unlink\n self.transaction do\n self.class.factory.model.connection.execute <<-SQL\n ALTER TABLE #{name} NO INHERIT #{self.class.factory.model.table_name};\n ALTER TABLE #{name} RENAME TO #{name}_unlinked;\n SQL\n self.destroy\n end\n end",
"def destroy\n if !self.subscribers.blank?\n errors.add :base, \"There are patient insured dependencies for #{self.name}. Deletion is not allowed\"\n elsif !self.provider_insurances.blank?\n errors.add :base, \"There are provider insurance dependencies for #{self.name}. Deletion is not allowed\"\n else\n run_callbacks :destroy do\n self.update_column(:deleted, true)\n end\n end\n end",
"def _destroy(*)\n fail NotImplementedError\n end",
"def delete\n table_name = self.class.to_s.pluralize.underscore\n DATABASE.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\")\n end",
"def relation_destroy(kind = nil, sibling_id = nil)\n query = { :note_id => self.id }\n query[:kind] = kind if kind\n query[:sibling_id] = sibling_id if sibling_id\n Relation.destroy_all(query)\n end",
"def destroy\n raise NotImplementedError\n end",
"def before_destroyed\n end",
"def before_destroy\n self.product.destroy\n\nend",
"def clear_relations\n each_event { |ev| ev.clear_relations }\n\t super()\n self\n\tend",
"def before_destroy\n # can_destroyed?\n end",
"def before_destroy\n # can_destroyed?\n end",
"def before_destroy\n # can_destroyed?\n end",
"def destroy()\n\n super()\n end",
"def destroy!; end",
"def destroy_data\n # ActiveRecord::Base.connection.execute(\"DELETE FROM watchables\")\n end",
"def finalize\n Pez.destroy_all\n Comida.destroy_all\n Tiburon.destroy_all\n end",
"def handle_destroy\n obj = model.with_pk(normalized_type, request, request.id)\n model.hook(:before_destroy, request, obj)\n model.destroy(obj)\n model.hook(:after_destroy, request, obj)\n request.set_flash_notice(\"Deleted #{model.class_name}\")\n redirect(:delete, obj)\n end",
"def delete table\n table = table.to_sym\n @lookup = @lookup.reject { |k, v| k == table }\n @schema = @schema.reject { |k, v| k == table }\n nil\n end",
"def destroy(options = {})\n call_hooks 'destroy' do\n options = options.dup\n options[:omit_model_identifiers] ||= {}\n options[:omit_model_identifiers][model_identifier] = self\n self.class.association_columns.each do |name, col|\n delete_candidates = get_attr(name)\n Array(delete_candidates).each do |candidate|\n next if options[:omit_model_identifiers][candidate.model_identifier]\n if col.dependent == :destroy\n candidate.destroy(options)\n elsif col.dependent == :delete\n candidate.delete(options)\n end\n end\n end\n delete\n end\n self\n end",
"def destroy!(execute: true)\n keys = self.class.fields.map { |name| send(name).key }\n related_keys = self.class.relations.map(&method(:collect_relation_keys))\n\n (keys + related_keys).flatten.tap do |key_list|\n command :del, [key_list] if execute && key_list.any?\n end\n end",
"def check_destroyable\n if self.destroyable?\n true\n else\n ## Some generic message to come here\n self.errors[:base] << 'This record has associations and cannot be deleted.'\n false\n end\n end",
"def destroy\n @table_relation.destroy\n respond_to do |format|\n format.html { redirect_to edit_database_table_path(@database, @table), notice: 'Table relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n variants.destroy_all\n super\n end",
"def delete_rivalry_with(rival)\n \t rivalry(rival).destroy if self.is_rivals_with?(rival)\n \t end"
] |
[
"0.6654317",
"0.62547594",
"0.6190418",
"0.6168673",
"0.6152492",
"0.6117316",
"0.6096514",
"0.60938495",
"0.6024632",
"0.60083514",
"0.6004811",
"0.59926766",
"0.5987495",
"0.5975938",
"0.59620714",
"0.5870119",
"0.58695346",
"0.5867962",
"0.5860982",
"0.5856882",
"0.5851851",
"0.5809842",
"0.57920295",
"0.5791599",
"0.5789529",
"0.5786873",
"0.57697564",
"0.57501423",
"0.5706701",
"0.5695221",
"0.56931406",
"0.56752634",
"0.5672684",
"0.5671993",
"0.5671702",
"0.5666779",
"0.5666779",
"0.5666779",
"0.5665584",
"0.5665162",
"0.5662821",
"0.56463766",
"0.56344706",
"0.5625146",
"0.56207484",
"0.56154704",
"0.56124485",
"0.55807436",
"0.5580391",
"0.5578446",
"0.5576407",
"0.55732685",
"0.55706304",
"0.55706304",
"0.55706304",
"0.55706304",
"0.55706304",
"0.55706304",
"0.55706304",
"0.55706304",
"0.55706304",
"0.55706304",
"0.5570542",
"0.55631334",
"0.5561862",
"0.5558134",
"0.55563873",
"0.5555291",
"0.55523884",
"0.555034",
"0.55470157",
"0.55424553",
"0.5537325",
"0.553496",
"0.5529835",
"0.5520193",
"0.55146897",
"0.5504257",
"0.55004305",
"0.5492099",
"0.5488764",
"0.5488077",
"0.5487066",
"0.5484735",
"0.54842836",
"0.54837054",
"0.5480151",
"0.5480151",
"0.5480151",
"0.54765266",
"0.547207",
"0.54660803",
"0.54557085",
"0.54538965",
"0.54492074",
"0.5448819",
"0.5441818",
"0.54417294",
"0.54309106",
"0.54270643",
"0.54258937"
] |
0.0
|
-1
|
before_action :set_task, only: %i[ show edit update destroy ]
|
def index
@pagy, @tasks = pagy(apply_scopes(current_user.tasks), items: 5)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_task\n #byebug\n @task = Task.find(params[:id])\n\n case params[:action]\n when 'edit'\n admin_author_assignee_manager(@task, 'change this task') \n when 'update'\n admin_author_assignee_manager(@task, 'change this task') \n when 'destroy'\n admin_author_manager(@task, 'delete this task') \n end\n end",
"def edit\n # substituido pela funcao no before_action\n # @task = Task.find(params[:id])\n end",
"def show\n # @task = Task.find(params[:id])\n # substituido pela funcao no before_action\n end",
"def edit\n # @task = Task.find(params[:id])\n set_task\n end",
"def set_task\n @task = Task.includes(:todo).find(params[:id])\n @todo = @task.todo\n @list = @todo.list\n end",
"def set_task\n @task = Task.find(params[:id])\nend",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id]) # OG\n end",
"def set_task\n @task = Task.find(params[:task_id])\n end",
"def set_task\n @task = Task.find(params[:task_id])\n end",
"def set_task\n\t\t\t@task = Task.find(params[:id])\n\t\t\tnot_your_task if @task.user != current_user\n\t\tend",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end",
"def set_task\n @task = Task.find(params[:id])\n end"
] |
[
"0.76910704",
"0.7668901",
"0.7647632",
"0.72978556",
"0.72130585",
"0.7194126",
"0.7163046",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7159563",
"0.7146704",
"0.71246475",
"0.71246475",
"0.7108086",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428",
"0.7063428"
] |
0.0
|
-1
|
Automatically respond with 404 for ActiveRecord::RecordNotFound
|
def record_not_found
render :partial => "shared/error", :layout => "one_box", :status => 404, :locals => {:error_title => 'No hemos encontrado lo que buscabas', :error_message => 'Puedes haber tecleado mal la dirección o la página puede haber sido movida.'}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def not_found\n respond_with 404\n end",
"def record_not_found\n render json: \"Record not found\", status: 404\n end",
"def record_not_found\n render json: { error: { message: 'Record not found.' }}, status: :not_found\n end",
"def record_not_found!\n render partial: 'errors/404', status: 404 && return\n end",
"def not_found\n respond_with 404\n end",
"def record_not_found\n raise ActiveRecord::RecordNotFound\n end",
"def record_not_found\n render json: {error: I18n.t('errors.not_found')}.to_json, status: 404\n end",
"def render_record_not_found\n render :template => \"error/404\", :status => 404\n end",
"def record_not_found\n render json: {\n error: 'Record not found.'\n }, status: :not_found\n end",
"def record_not_found\n render json: {error: \"Record not found\"}.to_json, status: 404\n end",
"def record_not_found\n render :json => {:success=>false, :error_code => 404, :error_msg=>\"Record not Found\"}\n end",
"def create_record_for_not_found_response; end",
"def record_not_found\n ActiveRecord::RecordNotFound\n end",
"def record_not_found\n render json: ErrorSerializer.serialize({ record: \"Record not found.\" }), status: :not_found\n end",
"def rescue_action(exception)\n case exception\n when ActiveRecord::RecordNotFound\n render :text => 'Could not find the requested record!', :status => 404\n else\n super\n end\n end",
"def return_404\n render :json => {:error => \"not-found\"}.to_json, :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end",
"def rescue_not_found\n render nothing: true, status: 404\n end",
"def not_found\n render :status => 404\n end",
"def record_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to posts_path, :flash => { :alert => \"Record not found.\" }\n end",
"def record_not_found\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end",
"def record_not_found\n render :file => File.join(::Rails.root.to_s, 'public', '404.html'), :status => 404\n end",
"def not_found\n render :nothing => true, :status => 404\n end",
"def render_record_not_found\n record_name = !controller_name.blank? ? controller_name.singularize.titleize : \"Record\"\n respond_with(nil, :status => {:msg => \"#{record_name} not found\", :code => 404})\n end",
"def record_not_found\n \t\trender :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n \tend",
"def catch_not_found\n yield\n\n rescue ActiveRecord::RecordNotFound\n redirect_to root_path\n end",
"def handle_not_found(exception)\n raise exception\n end",
"def not_found\n render nothing: true, status: 404\n end",
"def record_not_found(exception)\n log_error(exception, request.fullpath)\n render \"errors/record_not_found\"\n end",
"def not_found\n render json: nil, status: :not_found\n end",
"def record_not_found(error)\n render json: {\n success: false,\n message: error.message\n }, status: :record_not_found\n end",
"def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"Hittades inte\"\n redirect_to root_url\n end",
"def record_not_found\n render :file => Rails.root.join('public','404.html'), :status => \"404 Not Found\", layout: false\n end",
"def object_not_found\n render json: 'Object not found', status: :not_found\n end",
"def render_404\n render template: '/shared/record_not_found', layout: false, status: :not_found\n end",
"def return_404_error\n\n render json: { success: false, error: I18n.t('errors.e_404'),\n status_code: 404 }, status: :not_found\n end",
"def resource_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :notice => \"Room not found.\"\n end",
"def not_found\n raise ActionController::RoutingError.new('Not Found')\n rescue\n render_404\n end",
"def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :flash => { :error => \"Record not found.\" }\n end",
"def not_found(exception)\n render json: { error: exception.message }, status: :not_found\n end",
"def not_found\n render status: :not_found\n end",
"def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :flash => { :error => \"Nº de protocolo inexistente!\" }\n end",
"def method_missing(*args)\n rescue_404\n end",
"def not_found\n response_error(code: 404, message: 'Object not found.')\n end",
"def route_eval\n super\n rescue ActiveRecord::RecordNotFound\n not_found\n end",
"def response_not_found\n render status: 404,\n json: {\n source: {\n pointer: request.original_url\n },\n errors: [ { message: \"Not Found\" } ]\n }\n end",
"def render_404\n render \"404\", :status => 404\n end",
"def not_found\n\n render_error( :not_found )\n\n end",
"def render_404\n raise ActionController::RoutingError.new('Not Found')\n end",
"def render_404\n redirect_to not_found_path\n end",
"def not_found\n render(\n json: {\n errors: [{\n type: \"Not Found\"\n }]\n },\n status: :not_found #alias for 404 in rails\n )\n end",
"def rescue404\n render 'public/404'\n end",
"def record_not_found_error\n if Rails.env == 'development'\n render # will give us the stack trace\n else\n flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')\n params.delete(:id)\n index\n render 'index', :status => 404\n end\n end",
"def handle_not_found(exception = nil)\n render \"shared/not_found\".freeze, status: 404\n end",
"def record_not_found\n redirect_to four_oh_four_url\n end",
"def not_found\n respond_not_found\n end",
"def not_found; end",
"def render_404\n render :text => '404 Error: not found', :status => 404 \n end",
"def record_not_found\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n logger.error(\"Attempt to #{action_name} invalid id #{params[:id]}\")\n flash[:error] = \"Invalid ID specified for #{action_name} action.\"\n redirect_to :action => 'index'\n end\n end",
"def respond_resource_not_found(path)\n log(\"#{path} Not Found\")\n make_response(nil, false, 404, \"Not Found\")\n end",
"def resource_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :notice => \"Room Category not found.\"\n end",
"def render_404\n render(\n json: {\n error_messages: ['Resource does not exist'],\n error_code: 'NOT_FOUND'\n },\n status: 404\n )\n end",
"def return_not_found\n return_error(error_code: 404, message: 'Not Found')\n end",
"def handle_not_found_error!\n raise Common::Exceptions::UnprocessableEntity.new(detail: 'Person Not Found')\n end",
"def check_404\n end",
"def record_not_found\n render file: 'public/404.zh-TW.html', stats: :not_found\n end",
"def not_found\n render :template => \"shared/rescues/not_found\", :status => 404 \n end",
"def rescue_record_not_found(exception)\n respond_to do |format|\n format.html\n format.js { render :template => \"Images/404.js.erb\", :locals => {:exception => exception} }\n end\n end",
"def render_figgy_404 # rubocop:disable Naming/VariableNumber\n respond_to do |format|\n format.html { render \"errors/not_found\", status: :not_found }\n format.json { head :not_found }\n end\n end",
"def invalid_document_id_error(exception)\n error_info = {\n \"status\" => \"404\",\n \"error\" => \"#{exception.class}: #{exception.message}\"\n }\n\n respond_to do |format|\n format.xml { render xml: error_info, status: :not_found }\n format.json { render json: error_info, status: :not_found }\n\n # default to HTML response, even for other non-HTML formats we don't\n # neccesarily know about, seems to be consistent with what Rails4 does\n # by default with uncaught ActiveRecord::RecordNotFound in production\n format.any do\n # use standard, possibly locally overridden, 404.html file. Even for\n # possibly non-html formats, this is consistent with what Rails does\n # on raising an ActiveRecord::RecordNotFound. Rails.root IS needed\n # for it to work under testing, without worrying about CWD.\n render \"errors/not_found\", status: :not_found\n end\n end\n end",
"def respond_with_not_found(exception = nil, error_code = \"not_found\")\n msg = exception ? exception.message : \"Not Found\"\n render partial: \"api/error\", locals: { message: msg, error_code: error_code }, status: 404\n return false\n end",
"def render_404\n render_optional_error_file(404)\n end",
"def not_found\n\n r = Result::Base.error(\n {\n internal_id: 'ac_1',\n general_error_identifier: 'resource_not_found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n )\n\n return render_api_response(r)\n\n end",
"def halt_not_found(exception)\n halt 404, json({ message: exception.reason })\n end",
"def render_404\n render json: {\n message: '404 Not Found',\n details: exception.error_codes\n }, status: 404\n end",
"def render_404\n render 'web/404', status: 404\n end",
"def render_404\n respond_to do |wants|\n wants.html do\n render(:template => \"#{DynamicErrors.config[:view_path]}/404\",\n :layout => DynamicErrors.config[:layout], :status => 404)\n end\n # TODO should have a response for XML and JSON requests?\n wants.all do\n render :nothing => true, :status => 404\n end\n end\n return true\n end",
"def prevent_not_found\n address = Address.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n redirect_to root_path\n\n end",
"def render_404\n render_error(\"The remote resource was not found\")\n end",
"def render_404(exception = nil)\n @not_found_path = exception.message if exception\n respond_to do |format|\n format.html { render template: 'errors/not_found', layout: 'application', status: 404 }\n format.all { render nothing: true, status: 404 }\n end\n end",
"def resource_not_found\n flash.now.alert = \"notifications.document.not_found\"\n @info = { id: params[:id] }\n render \"shared/html/404\" and return\n end",
"def not_found\n render json: { error: { message: 'There was nothing found at this address.' }}, status: :not_found\n end",
"def what_are_you_looking_for?\n raise Exceptions::NotFound.new(404, 'Not Found; You did not find what you were expecting because it is not here. What are you looking for?')\n end",
"def page_not_found\n render_404\n end",
"def show_not_found\n render_json_error(code: :show_not_found, status: :not_found)\n end",
"def rescue_not_found\n render \"#{Rails.root}/public/404.html\", status: 404\n end",
"def rescue_not_found\n render \"#{Rails.root}/public/404.html\", status: 404\n end",
"def render_404\n render :template => \"errors/404\", :status => :not_found, :layout => false\n end",
"def render_404\n respond_to do |format|\n format.html { render :file => \"#{Rails.root}/public/404\", :layout => false, :status => :not_found }\n format.xml { head :not_found }\n format.any { head :not_found }\n end\n end",
"def not_found\n status 404\n body \"not found\\n\"\n end",
"def not_found\n status 404\n body \"not found\\n\"\n end",
"def not_found\n status 404\n body \"not found\\n\"\n end"
] |
[
"0.7977074",
"0.7908341",
"0.7899114",
"0.7889307",
"0.78878707",
"0.78789586",
"0.7864075",
"0.7860034",
"0.7849858",
"0.7825134",
"0.776247",
"0.7757481",
"0.77490914",
"0.7729603",
"0.7714778",
"0.7624227",
"0.7610271",
"0.7610271",
"0.7610271",
"0.7610271",
"0.7610271",
"0.7610271",
"0.7610271",
"0.7610255",
"0.7610255",
"0.7610255",
"0.76095265",
"0.7585801",
"0.7578809",
"0.75571394",
"0.7553633",
"0.75513095",
"0.7524668",
"0.75161785",
"0.7512125",
"0.7509049",
"0.74980944",
"0.7484729",
"0.7465171",
"0.74504405",
"0.74459326",
"0.7435639",
"0.74082893",
"0.7398734",
"0.7388633",
"0.73856336",
"0.7382257",
"0.7380901",
"0.7374456",
"0.7370178",
"0.73581934",
"0.73466325",
"0.7332491",
"0.7331625",
"0.7314798",
"0.7283684",
"0.72629744",
"0.7262021",
"0.7248271",
"0.7242876",
"0.722455",
"0.7219071",
"0.72147685",
"0.7210181",
"0.72000533",
"0.7197089",
"0.71822995",
"0.71757114",
"0.71679175",
"0.71678334",
"0.7163348",
"0.71479136",
"0.71478605",
"0.71438277",
"0.7138611",
"0.712128",
"0.7110227",
"0.70984864",
"0.709639",
"0.709306",
"0.7087468",
"0.708675",
"0.7079115",
"0.70726174",
"0.7071448",
"0.7063463",
"0.70628303",
"0.70627064",
"0.70622295",
"0.7062174",
"0.70524323",
"0.70471644",
"0.7040228",
"0.70331794",
"0.70311517",
"0.70311517",
"0.7028271",
"0.70219845",
"0.70214695",
"0.70214695",
"0.70214695"
] |
0.0
|
-1
|
Register the validations here
|
def register_validation(field_sym,lamb_func_with_message)
lamb_func_with_message.each_index { |i|
if lamb_func_with_message[i].instance_of?(ValidatorFunctionUnit)
lamb_func_with_message[i] = {:f=>lamb_func_with_message[i]}
end
}
@__fields_to_validate ||= {}
@__fields_to_validate[field_sym] ||= []
@__fields_to_validate[field_sym] += lamb_func_with_message
# puts @__fields_to_validate.inspect
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate\n # add errors if not validate\n end",
"def run_validations\n true\n end",
"def run_validations!\n run_callbacks(:validation) do\n super\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 validation; end",
"def validation; end",
"def validator; 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 validations\n {}\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n\n end",
"def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end",
"def validate\n \n \n end",
"def extra_validations\n success\n end",
"def run_validations(context)\n __run_validations__(context)\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def subclass_validations ; true ; end",
"def validate\r\n\r\n end",
"def validations\n []\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validate\n super \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 validate!\n # pass\n end",
"def validate\n errors.clear\n self.class.validator.invoke self\n end",
"def validations\n valid_page_number? if page_number\n valid_period_name? if period_param\n valid_date? if date_param\n end",
"def errors\n self.class.validator.call self\n end",
"def validate\n super\n end",
"def enable_validations\n include ActiveModel::Validations unless respond_to?(:_validators)\n end",
"def validate!\n self.class.validators.each do |validator|\n validator.validate!(self)\n end\n nil\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 validations\n options_to_validations(@options)\n end",
"def validate\n validator_class.new(self).validate\n end",
"def pre_validation\n\n end",
"def pre_validation\n\n\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 validate!\n validate_redis\n validate_workers\n validate_options\n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def validate\r\n @invalid=false\r\n end",
"def validate\n raise NoMethodError, \"must define method 'validate'\"\n end",
"def assoc_validations_register\n @assoc_validations_register ||= []\n end",
"def add_validation_errors(value); 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 @invalid=false\n end",
"def validate!\n super()\n self\n end",
"def validate\r\n validate! rescue false\r\n end",
"def after_validate\n end",
"def supports_validations?\n true\n end",
"def validators\n []\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 self._errors = {}\n self.run_hook :validate\n not self.errors?\n end",
"def is_valid; end",
"def validate(options); end",
"def _before_validation\n end",
"def validate_me(validator)\n validator.validate self, checks\n end",
"def validate\n validate_vendor\n end",
"def validate\n validates_contact\n end",
"def validate_with_callbacks\n run_callbacks(:before_validation)\n validate_without_callbacks\n run_callbacks(:after_validation) if errors.empty?\n end",
"def before_validation_callback\n end",
"def validate!\n true\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 extended_validator\n notify_observers(:validate_application)\n end",
"def validate\n validate_root\n validate_associated\n valid?\n end",
"def apply_validations_for_text\n apply_validations_for_string\n end",
"def validate\n super\n if root? && (self.email.to_s.empty? || errors.invalid?(:email)) && self.phone.to_s.empty?\n errors.add(:base, \"Phone number or email address must be provided\".t)\n end\n if self.email\n unless self.organization.worldwide.map(&:site_domain).compact.include?(self.email_domain)\n errors.add(:email, \"not a valid email address at %{org}\".t % {:org => self.organization.root.name})\n end\n end\n end",
"def validate!\n validate_patches!\n validate_new_branch_name! if new_branch?\n validate_permissions!\n end",
"def validate\n valid?\n end",
"def custom_validator_directory_check\n if Dir[\"#{Rails.root}/app/validators\"].empty?\n @@errors[\"/validators\"] = [{:validators => \"not found\"}]\n end\n end",
"def validation\n # Rails.logger.debug \"#{self.class}.#{__method__} Default validator is empty\"\n end",
"def validate\n true\n end",
"def validations_for(klass)\n validations[klass] ||= []\n end",
"def validations\n CompiledValidations.new(@validations, @allow_keys)\n end",
"def field_validations\n @filters.each do |filter|\n validate_field_presence(filter.field_name) if filter.required?\n end\n end",
"def validate\n fail 'sub class to implement'\n end",
"def validate\n errors.clear\n instance_exec(&validate_block) if validate_block && get\n end",
"def validator=(_); end",
"def validate_all\n current_user.valid?(:save) && valid?(:create) && address_valid?(:save)\n end",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end",
"def validate_with(&block)\n validators << block\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\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([{: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\n each_field_with_value do |key, field, value|\n field.validate(value)\n end\n self\n end",
"def add_validators(model)\n Valle::Manager.add_validators(model)\n end",
"def is_valid?\n end",
"def load_validators(model, params)\n\n end",
"def validation_context\n {}\n end",
"def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n @validated = true\n end\n end",
"def is_valid\n\tend",
"def is_valid\n\tend",
"def validations\n super + [:map_region]\n end"
] |
[
"0.7569708",
"0.7502359",
"0.74852765",
"0.73412144",
"0.7326972",
"0.7326972",
"0.73187923",
"0.7314348",
"0.7227129",
"0.7215006",
"0.7215006",
"0.7215006",
"0.72024304",
"0.7174918",
"0.71515495",
"0.713861",
"0.71205837",
"0.7099116",
"0.70956177",
"0.70956177",
"0.70956177",
"0.70956177",
"0.70785695",
"0.7072853",
"0.70677567",
"0.6997694",
"0.6997694",
"0.6997694",
"0.6989348",
"0.6989348",
"0.6989348",
"0.696883",
"0.6941861",
"0.6900549",
"0.68882906",
"0.6870636",
"0.6869455",
"0.68404126",
"0.68380654",
"0.68258965",
"0.67857134",
"0.67530876",
"0.67513764",
"0.67433536",
"0.674038",
"0.6732491",
"0.67300034",
"0.6708459",
"0.6689995",
"0.6689601",
"0.6688059",
"0.668759",
"0.6674286",
"0.6658498",
"0.6648841",
"0.6637553",
"0.66357815",
"0.6603267",
"0.6594774",
"0.6590295",
"0.65801466",
"0.6531388",
"0.652974",
"0.6520148",
"0.6513105",
"0.64981085",
"0.64964",
"0.649206",
"0.6491379",
"0.64856684",
"0.6474282",
"0.64496475",
"0.6449201",
"0.6443308",
"0.642999",
"0.6428651",
"0.6420496",
"0.63884",
"0.6373809",
"0.63701075",
"0.6361243",
"0.6344701",
"0.6340413",
"0.6334628",
"0.632773",
"0.6326092",
"0.6313566",
"0.6279488",
"0.6274012",
"0.6273402",
"0.6271031",
"0.6263059",
"0.62519825",
"0.6251228",
"0.62392914",
"0.6238383",
"0.6229679",
"0.62177056",
"0.6216988",
"0.6216988",
"0.6216614"
] |
0.0
|
-1
|
Register the uniqueness validations
|
def register_uniqueness(field_sym)
@__fields_to_validate_uniqueness ||= {}
@__fields_to_validate_uniqueness[field_sym] = true
# puts @__fields_to_validate_uniqueness.inspect
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def preconditions\n validator.kind == :uniqueness\n end",
"def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end",
"def validates_uniqueness_of(*args)\n validates_with(UniquenessValidator, _merge_attributes(args))\n end",
"def validates_unique(*atts)\n message = (atts.pop[:message] if atts.last.is_a?(Hash)) || 'is already taken'\n atts.each do |a|\n ds = model.filter(Array(a).map{|x| [x, send(x)]})\n errors.add(a, message) unless (new? ? ds : ds.exclude(pk_hash)).count == 0\n end\n end",
"def after_save\n validate_uniqueness_as_run(:name)\n end",
"def allows_unique?\n true\n end",
"def uniqueness_generate\n self.uniqueness_options.each do |field, options|\n value = send(field)\n unless value.present?\n value = Uniqueness.generate(options)\n self.send(\"#{field}=\", value)\n end\n end\n end",
"def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end",
"def set_validations\n # TODO: Move below this line to the partition class itself\n @keys.each do |key|\n case key.type\n when :continuous\n partition_class.validates_uniqueness_of(\"#{key.column}_begin\", :scope => @keys.remaining_columns(\"#{key.column}_begin\"))\n partition_class.validates_uniqueness_of(\"#{key.column}_end\", :scope => @keys.remaining_columns(\"#{key.column}_end\"))\n when :discrete\n partition_class.validates_uniqueness_of(key.column, :scope => @keys.remaining_columns(key.column))\n end\n end\n end",
"def validate_unique *colnames\n\t\t\tcolnames.each { |colname|\n\t\t\t\tds = self.class.where colname => send(colname)\n\t\t\t\tds.filter!(~{primary_key => send(primary_key)}) unless new?\n\t\t\t\tif ds.count > 0\n\t\t\t\t\terrors.add(colname, 'must be unique.')\n\t\t\t\tend\n\t\t\t}\n\t\tend",
"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_uniqueness_of_email\n if Person.exists?(:email=>self.email,:user_id => self.user_id)\n self.errors.add(:email, :taken)\n return false\n else\n return true\n end\n end",
"def validates_uniqueness?(attribute)\n validator_of_type_exists?(validators_for(attribute), :uniqueness, false)\n end",
"def validate\n super\n validates_presence :account\n validates_unique :account\n end",
"def email_must_be_unique\n if ((Organization.where(['email = ? AND id <> ?', self.email, self.id]).count > 0) or\n (Volunteer.where(['email = ?', self.email]).count > 0))\n\n errors.add(:email, \"is already taken\")\n end\n end",
"def assoc_validations_register\n @assoc_validations_register ||= []\n end",
"def invalidate_duplicate_users\n difference = users.size - users.uniq.size\n errors.add(:users, 'Duplicate User entered') if difference != 0\n end",
"def check_id_uniqueness\n check('object id uniqueness') do |messages|\n list = [\n check_network_id_uniqueness,\n check_node_id_uniqueness,\n check_link_id_uniqueness,\n check_tp_id_uniqueness\n ]\n messages.push(list)\n messages.flatten!\n end\n end",
"def validates_email_uniqueness\n if validate_attributes == true\n if email and (Contact.find_by_email(email) or Lead.find(:first, :conditions => [\"email = ? and record_type_id = ?\",email,MOLTEN_REQUEST_RECORD_TYPE]))\n errors.add('email', \"A contact already exists with this email address.\")\n end\n end\n end",
"def uniqueness=(uniqueness)\n allowed_values = [\"NONE\", \"SERVER\", \"GLOBAL\"]\n if uniqueness && !allowed_values.include?(uniqueness)\n fail ArgumentError, \"invalid value for 'uniqueness', must be one of #{allowed_values}.\"\n end\n @uniqueness = uniqueness\n end",
"def before_create\n super\n self.check_unique_code\n end",
"def validate_unique_submission\n return unless existing_submission\n\n errors.clear\n errors[:base] << I18n.t('activerecord.errors.models.course/video/submission.'\\\n 'submission_already_exists')\n end",
"def define_and_validate(options={})\n @model = define_model :user, :username => :string, :email => :string, :public => :boolean, :deleted_at => :timestamp do\n validates_uniqueness_of :username, options\n end\n\n # Create a model\n User.create(:username => 'jose', :deleted_at => 1.day.ago, :public => false)\n\n validate_uniqueness_of(:username)\n end",
"def username_must_be_unique\n errors.add(:username, :taken) if username.present? && User.where(username: username).where.not(id: model.id).exists?\n end",
"def email_is_unique\n active_users = User.active.where(:email => self.email)\n active_users = active_users.exclude(self) unless self.new_record?\n errors.add :email, 'ya existe' if active_users.count(:id) > 0\n end",
"def validate_uniqueness(attribute_name, message = nil, &block)\n value = attributes[attribute_name]\n unless block.call(value)\n append_error(attribute_name, message || :is_duplicated)\n end\n end",
"def must_be_unique\n errors.add(:failed, I18n.t('room_type_master_rate_mappings.create.message.already_exist')) if\n !RoomTypeMasterRateMapping.find_by_pool_id_and_room_type_id(self.pool_id, self.room_type_id).blank?\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([{: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 add_rid_related_validations(options)\n validates(options[:field], presence: true)\n validates(options[:field], uniqueness: true) if options[:random_generation_method] != :uuid # If we're generating UUIDs, don't check for uniqueness\n end",
"def slug_uniqueness\n if name? and slug? and Quotum.where(slug: slug).where.not(id: id).exists?\n errors.add(:name, \"is unavailable\")\n end\n end",
"def validate_uniqueness_of_new_image_url\n self.errors[:\"image.url\"] = 'Image url has already been added to this collection' if self.dup_image?\n end",
"def validate_unique(record)\n return if provided(record).uniq.length == provided(record).length\n\n record.errors.add(\n options[:attribute],\n 'contains an option more than once'\n )\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([{: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_each(validator, name, value)\n scope = Array(@scope_keys).each_with_object({}) do |key, scope|\n scope[key] = validator.to_model[key]\n end\n validator.errors.add(name, message) unless unique?(name, value, scope)\n end",
"def value_uniqueness_without_scheme\n # if scheme is nil, then just unique for identifiable\n return unless Identifier.where(identifiable: identifiable, value: value).any?\n\n errors.add(:value, _('must be unique'))\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([{: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 unique_email_user\n if self.class.where(email: email).count > 0\n errors.add(:email, :taken)\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([{: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([{: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 uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end",
"def validate_on_create\n errors.add(:username, \"is already taken for store #{self.store.friendly_name}\") if User.find_by_username_and_store_id(self.username, self.store_id)\n end",
"def test_values_unique\n\n #Arrange\n @user3 = User.new\n @user4 = User.new\n\n # Act\n @user3.name = \"fede\"\n @user3.surname = \"guti\"\n @user3.username = \"fede3\"\n @user3.email = \"fede3@gmail.com\"\n @user3.password = \"123456789\"\n\n @user4.name = \"fede\"\n @user4.surname = \"guti\"\n @user4.username = \"luca\"\n @user4.email = \"luca@gmail.com\"\n @user4.password = \"123456789\"\n\n\n # Assert\n @user3.save\n @user4.save\n all_ok = assert_equal @user3.valid? && @user4.valid? , true\n\n # Act\n @user4.email = \"fede3@gmail.com\"\n @user4.save\n\n # Assert\n email_check = assert_equal @user4.valid?, false\n\n # Act\n @user4.email = \"luca@gmail.com\"\n @user4.username = \"fede3\"\n @user4.save\n\n # Assert\n user_check = assert_equal @user4.valid?, false\n\n # Assert\n assert_equal (all_ok || email_check || user_check) , true\n\n end",
"def validate_unique_submission\n existing = Course::Assessment::Submission.find_by(assessment_id: assessment.id,\n creator_id: creator.id)\n return unless existing\n\n errors.clear\n errors[:base] << I18n.t('activerecord.errors.models.course/assessment/'\\\n 'submission.submission_already_exists')\n end",
"def validate\n self.code = generate_unique_code\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([{: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 ensure_unique\n puts \"Ensuring uniqueness of user #{self.user_id.to_s} to recipe #{self.recipe_id.to_s}\"\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([{: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_attendances_uniqueness\n attendances.each do |attendance|\n next if attendance.justification_ids.blank?\n errors.add(:attendance_ids, \"a falta de #{attendance.date.month}/#{attendance.date.year} já tem justificativo.\")\n end\n end",
"def ensure_uniqueness_when_replicating(replication)\n # if uniqueness property is set, make sure the specified field is unique\n if params = replicable_opts(:uniqueness)\n # setup the params for the call to the generate_unique_field_value method\n params = params.merge(:mission => replication.to_mission, :dest_obj => replication.dest_obj)\n\n # get a unique field value (e.g. name) for the dest_obj (may be the same as the source object's value)\n unique_field_val = generate_unique_field_value(params)\n\n # set the value on the dest_obj\n replication.dest_obj.send(\"#{params[:field]}=\", unique_field_val)\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([{: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 value_uniqueness_with_scheme\n if new_record? && Identifier.where(identifier_scheme: identifier_scheme,\n identifiable: identifiable).any?\n errors.add(:identifier_scheme, _('already assigned a value'))\n end\n end",
"def define_and_validate(options={})\n @model = define_model :user, :id => DataMapper::Types::Serial, :username => String, :email => String, :public => DataMapper::Types::Boolean, :deleted_at => DateTime do\n validates_is_unique :username, options\n end\n\n # Create a model\n User.create(:username => 'jose', :deleted_at => 1.day.ago, :public => false)\n\n validate_is_unique(:username)\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\n if User.find_by_email(new_email)\n errors.add(:new_email, \"has already been taken\")\n end\n end",
"def validate\n errors.add(:username, \"already exists.\") if Player.get_player(username) != nil\n end",
"def should_validate_uniqueness_of(*attributes)\n message, scope, case_sensitive = get_options!(attributes, :message, :scoped_to, :case_sensitive)\n scope = [*scope].compact\n case_sensitive = true if case_sensitive.nil?\n\n attributes.each do |attribute|\n matcher = validate_uniqueness_of(attribute).\n with_message(message).scoped_to(scope)\n matcher = matcher.case_insensitive unless case_sensitive\n should matcher.description do\n assert_accepts(matcher, subject)\n end\n end\n end",
"def validate_unique_with_status\n psl = PersonSchoolLink.where(:person_id => self.person_id, :school_id => self.school_id).status_active\n if self.id\n psl = psl.where(\"id != #{self.id}\")\n end\n if psl.length > 0\n errors.add(:status, \"Username already associated with this school.\")\n end\n end",
"def merge_validates_uniqueness_of_login_field_options(options = {})\n self.validates_uniqueness_of_login_field_options = validates_uniqueness_of_login_field_options.merge(options)\n end",
"def uniqueness_for_school_and_subject\n school = School.find(school_id)\n school.courses.where(subject_id: subject_id).each do |course|\n if (course.call_number == call_number)\n errors.add(:course, 'course call number already exists')\n return\n elsif (course.friendly_name == friendly_name)\n errors.add(:course, 'course friendly name already exists')\n return\n end\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([{: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 unique_mobile_user\n if self.class.where(mobile: mobile).count > 0\n errors.add(:mobile, :taken)\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([{: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 raises_uniqueness_violation?(&block)\n transaction(:savepoint=>:only, &block)\n false\n rescue unique_constraint_violation_class => e\n e\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 slug_unique_in_clinic\n errors.add(:slug, \"Slug: #{slug} already in use\") unless\n slug_unique_in_clinic?\n end",
"def validates_as_unique(options = {})\n validated_columns = self.dimension_columns.map { |c| c.to_sym }\n return if validated_columns.empty?\n validates_each(validated_columns.first, options) do |record, attr_name, value|\n where_parts = []\n validated_columns.each do |column|\n value = record.send(column)\n if value.nil?\n # ignore\n elsif column == :start_time || column == :end_time\n where_parts << \"#{connection.quote_table_name(column)} = #{quote_value(value.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n else\n where_parts << \"#{connection.quote_table_name(column)} = #{quote_value(value)}\"\n end\n end\n\n if !where_parts.empty?\n # don't need this since we only validate as unique on create currently\n #unless record.new_record?\n #where_parts << \"#{connection.quote_table_name(primary_key)} <> #{quote_value(record.send(primary_key))}\"\n #end\n\n duplicates = self.find_by_sql(\"SELECT 1 FROM #{connection.quote_table_name(self.to_s.underscore.pluralize)} WHERE #{where_parts.join(\" AND \")}\")\n unless duplicates.empty?\n record.errors.add_to_base(\"Set of dimension columns is not unique\")\n end \n else\n record.errors.add_to_base('All columns in validates_as_unique constraint have nil values')\n end\n end\n end",
"def test_uniqueness_of_email\n person_repeat = Person.new(:email => @valid_person.email.upcase)\n assert !person_repeat.valid?\n assert_equal @error_messages[:taken], person_repeat.errors[:email][0], \"Test must be case sensitive.\"\n end",
"def test_uniqueness_name\n u = Unit.find(2)\n u2 = Unit.create( :name => 'horsemen')\n assert !u2.valid?\n end",
"def numero_fattura_must_be_unique_in_anno_and_data_fattura\n #return if field.blank?\n not_uniq = self.class.count(:conditions => [\"anno = ? AND numero_fattura = ? AND YEAR(data_fattura) = ?\", self.anno, self.numero_fattura, self.data_fattura.year])\n if not_uniq > 0\n #self.errors.add(:data_fattura, \"anno, numero_fattura e anno di data_fattura devono essere unici\")\n flash[:error] = \"anno, numero_fattura e anno di data_fattura devono essere unici\"\n end\n #not_uniq = self.class.where(:anno=>self.anno,:numero_fattura=>self.numero_fattura).where(\"YEAR(data_fattura) = ?\",data_fattura.year).first\n #self.errors.add(:data_fattura, \"anno, numero_fattura e anno di data_fattura devono essere unici\") if not_uniq\n end",
"def save(options = {})\n super\n rescue ActiveRecord::RecordNotUnique\n errors.add(:model_id, \"has already been taken\")\n false\n end",
"def validate_reuse_preconditions\n return unless self.class.resources.key?(reuse_as)\n\n attributes = unique_identifiers.each_with_object({ proposed: {}, existing: {} }) do |id, attrs|\n proposed = public_send(id)\n existing = self.class.resources[reuse_as][:resource].public_send(id)\n\n next if proposed == existing\n\n attrs[:proposed][id] = proposed\n attrs[:existing][id] = existing\n end\n\n unless attributes[:proposed].empty? && attributes[:existing].empty?\n raise ResourceReuseError, \"Reusable resources must use the same unique identifier(s). \" \\\n \"The #{self.class.name} to be reused as :#{reuse_as} has the identifier(s) #{attributes[:proposed]} \" \\\n \"but it should have #{attributes[:existing]}\"\n end\n end",
"def uniqueness_by_votable\n errors.add(\"you already voted!\") if Vote.where(votable: self.votable, user_id: self.user_id).count > 0\n end",
"def validate\n return HESResponder(\"Field and value required.\", \"ERROR\") unless params[:field] && params[:value]\n fs = ['email','username', 'altid']\n f = params[:field]\n if !fs.include?(f)\n return HESResponder(\"Can't check this field.\", \"ERROR\")\n end\n f = f.to_sym\n v = params[:value]\n if @promotion.users.where(\"LOWER(#{f}) = ?\", v.downcase).count > 0\n return HESResponder(f.to_s.titleize + \" is not unique within promotion.\", \"ERROR\")\n else\n return HESResponder()\n end\n end",
"def save_if_unique(column)\n save\n rescue ActiveRecord::RecordNotUnique => e\n self.errors.add(column, :taken)\n false\n end",
"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 ensure_unique\n puts \"Ensuring uniqueness of tag #{self.tag_id.to_s} to taggable #{self.entity_id.to_s} for user #{self.user_id.to_s}\"\n end",
"def ensure_search_terms_are_unique\n uniques = self.search_terms.dup.uniq\n if uniques != self.search_terms\n duplicates = find_duplicates(self.search_terms)\n errors.add(:search_terms, \"contains duplicated values: #{duplicates.join(', ')}\")\n end\n end",
"def check_unique\n bar = Bar.where(:name => self.name, :user_id => self.user_id)\n if bar != nil\n \treturn false\n end\n end",
"def validates_duplicity_of(attr_name, scope: nil)\n set_callback :save, :before, Callback.new(attr_name, scope)\n end",
"def test_rule_name_uniquess_for_a_person\n owner = people(:valid_person)\n rule_1 = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"and\")\n assert rule_1.save, \"Rule 1 cannot be saved.\"\n\n rule_2 = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"or\")\n assert !rule_2.save, \"Allows duplicate rule names for a person.\"\n end",
"def set_Unique(value)\n set_input(\"Unique\", value)\n end",
"def index_in_use_validation\n errors.add(:onewire_index, 'is already in use.') if index_in_use? onewire_index\n end",
"def unique=(val)\n self['unique'] = val\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([{: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 test_should_deny_duplicate_intitution\n intitution = create\n assert_valid intitution\n \n intitution = create\n assert_invalid intitution, \"User shouldn't be created\"\n end",
"def unique_email\n\t\treturn if email.blank?\n\t\tif Email.where(email: email).count > 0\n\t\t\terrors.add(:email, 'has already been taken')\n\t\tend\n\tend",
"def validator=(_); end",
"def postgresql_not_unique_error_class\n /(PG::UniqueViolation)|(ActiveRecord::RecordNotUnique)|(ActiveRecord::JDBCError)/\n end",
"def test_unique_book_isbn\n \n book = Book.new(:title => \"\",\n :isbn => \"978-0811827782\",\n :book_id => 1)\n \n assert !book.save\n assert_equal \"Please fill in!\", book.errors.on(:title)\n assert_equal \"Already in Database!\", book.errors.on(:isbn)\n end",
"def test_uniqueness_of\n # Create a page named 'test' and save it\n page1 = new_page()\n assert page1.save\n\n # Duplicate page name won't work\n page2 = new_page()\n assert !page2.save\n assert page2.errors.on(:name)\n\n # Fix name and it should work\n page2.name = 'test2'\n assert page2.save\n end",
"def test_uniqueness_of_username\n person_repeat = Person.new(:username => @valid_person.username.upcase)\n assert !person_repeat.valid?\n assert_equal @error_messages[:taken], person_repeat.errors[:username][0], \"Test must be case sensitive.\"\n end",
"def company_account_name_unique\n errors.add(:name, 'already exists') if name && account_name_exists?\n end",
"def validate_on_create=(_arg0); 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 unique_constraint_sql_fragment(_)\n 'UNIQUE'\n end",
"def site_membership_uniqueness\n return unless site && user\n\n existing_membership =\n user.site_memberships.where(site_id: site.id).where.not(id: id).first\n\n errors.add(:user, \"already has a membership to #{ site.url }\") if existing_membership\n end",
"def validate_date_uniqueness()\n self.subject_class.attendances.each do |at|\n if self.date_created == at.date_created\n errors.add(:date, \"already existed\")\n end\n end \n end",
"def uniqueness(attrs, conditions = nil)\n Array(attrs).each do |attr|\n next unless (value = @object.send(attr))\n\n dups = @object.class.dataset\n dups = dups.exclude(@object.model.primary_key => @object.pk) if @object.pk\n dups = dups.where(conditions) if conditions\n dups = dups.where(attr => value)\n\n error(attr, 'is already taken') unless dups.empty?\n end\n end",
"def validate_on_create; end",
"def validator; end"
] |
[
"0.7606207",
"0.7171119",
"0.6988157",
"0.69003606",
"0.686787",
"0.6673246",
"0.6542856",
"0.6540174",
"0.65135443",
"0.6268777",
"0.6264936",
"0.6209169",
"0.6149086",
"0.61488277",
"0.60979897",
"0.6078019",
"0.6047371",
"0.6019001",
"0.600618",
"0.5964764",
"0.5917258",
"0.5912495",
"0.59121996",
"0.5895493",
"0.58659893",
"0.58563584",
"0.5844162",
"0.5840038",
"0.5836445",
"0.58293283",
"0.5828489",
"0.5812304",
"0.5810257",
"0.5808496",
"0.58069974",
"0.5798805",
"0.5793039",
"0.5792628",
"0.5784634",
"0.57821697",
"0.577397",
"0.57576233",
"0.5752492",
"0.57326657",
"0.5726833",
"0.57251155",
"0.5706315",
"0.5703178",
"0.57022566",
"0.5699167",
"0.56991553",
"0.5693012",
"0.5691192",
"0.56451017",
"0.56187046",
"0.5611253",
"0.5600855",
"0.5597277",
"0.5596222",
"0.5594177",
"0.5590511",
"0.55797267",
"0.5577203",
"0.5573749",
"0.5566735",
"0.5566077",
"0.5564941",
"0.55592084",
"0.5550814",
"0.5543239",
"0.5531694",
"0.553",
"0.55267113",
"0.5524495",
"0.5513403",
"0.5507478",
"0.54566765",
"0.545094",
"0.54439366",
"0.5423125",
"0.54108244",
"0.54098666",
"0.54000103",
"0.5399537",
"0.53968596",
"0.53945154",
"0.5390905",
"0.53869694",
"0.5386001",
"0.5380005",
"0.53776854",
"0.53762186",
"0.53680325",
"0.53633183",
"0.5359938",
"0.5357513",
"0.5352747",
"0.5349076",
"0.5348804",
"0.534517"
] |
0.70031935
|
2
|
Returns true if business is paid through today.
|
def paid_thru_now
# Turn off March 1 of year following paid year
paid_thru_year >= (Date.today - 59).year
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def paid?\n unless self.last_paid_at.blank?\n return Time.now - 365.days < self.last_paid_at\n else\n return false\n end\n end",
"def paid?\n date_paid_out.present?\n end",
"def paid?\n !!paid_at\n end",
"def paid?\n payment_at?\n end",
"def overdue?\n next_payment_at && next_payment_at.to_date < Date.today\n end",
"def paid?\n !self.paid_at.nil?\n end",
"def due_today?\n @due_date == Date.today\n end",
"def paid?\n status == 'paid'\n end",
"def due_today?\n due_date == Date.due_today\n end",
"def payments_current_as_of?(this_date)\n return false if this_date.nil?\n\n membership_payment_expire_date = payment_expire_date(THIS_PAYMENT_TYPE)\n !membership_payment_expire_date.nil? && (membership_payment_expire_date > this_date)\n end",
"def due_today?\n @date == Date.today.to_s\n end",
"def payable?\n %w(confirmed bookkept).include?(workflow_state)\n end",
"def pending?\n start_date > Date.today\n end",
"def current_paid_contributer?\n return !(self.paid_contributer_until.blank?) && self.paid_contributer_until >= Time.now\n end",
"def paid?\n status == PAID\n end",
"def suspended?\n next_payment_at \\\n && (next_payment_at + UserSystem.account_grace_period).to_date < Date.today\n end",
"def upcoming?\n (!self.available_on.nil? && self.available_on > Date.today && self.available_on <= self.class.upcoming_on)\n end",
"def overdue?\n Date.today > to_date\n end",
"def past?\n due_on < Date.today\n end",
"def active?\n start_date <= Date.today and finish_date >= Date.today\n end",
"def upcoming?\n (start_date > Date.today)\n end",
"def active_this_wday?\n return true if date.present?\n today = Time.zone.today\n week_days.include? today.strftime('%A')\n end",
"def too_soon_to_renew?\n due_date_after_renewal <= due_date\n end",
"def voided?\n if voided_on_date.nil?\n false\n else\n (voided_on_date <= Date.today)\n end\n end",
"def active?\n self.expires_on > Date.today\n end",
"def booking_deadline_has_passed?\n Date.current > deadline\n end",
"def paid?\n status == 'paid'\n end",
"def paid?\n self.status == 'paid'\n end",
"def paid?\n current_transaction\n end",
"def current?\n period.same_month?(Time.now.utc.to_date) && !buyer_account.try!(:destroyed?)\n end",
"def paid_in_full?\n !payment_outstanding?\n end",
"def available?\n (!self.available_on.nil? && self.available_on <= Date.today)\n end",
"def overdue?\n @due_date < Date.today\n end",
"def due_later?\n @due_date > Date.today\n end",
"def paypal_paid?\n self.paypal_transactions.where(status: 'Completed').count >= 1\n end",
"def is_active?\n expiry >= Date.today\n end",
"def today?\n to_date == ::Date.current\n end",
"def future?\n Date.today <= finish\n end",
"def fully_paid?\n amount_owed <= 0\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 send?\n # TODO: rename to better name\n !Holiday.today?\n end",
"def today?\n @date == Date.today\n end",
"def overdue?\n if is_appointment?\n start_date.to_date < Time.zone.now.to_date\n else\n open? && end_date.to_date < Time.zone.now.to_date\n end\n end",
"def new?\n available_on + 1.month >= Time.zone.today ? true : false\n rescue\n false\n end",
"def live?\n !active_charge_start_date.future?\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 today?\n time.today?\n end",
"def hold_day?\n if date-7 < Time.zone.today && date >= Time.zone.today\n \"week_in\"\n elsif date < Time.zone.today\n \"finished\"\n end\n end",
"def current?\n active? || past_due?\n end",
"def today?\n self == ZDate.new\n end",
"def date_today?\n @today\n end",
"def has_appointment?(current_employee)\n appointments = current_employee.brand.appointments.where(customer_id: self.id)\n unless appointments.empty?\n if appointments.last.date >= Date.today\n true\n end\n else\n false\n end\n end",
"def pending?\n payment_at.nil?\n end",
"def paid?\n rate.present? && rate.cents > 0\n end",
"def is_pending?\n generated_at.nil? && !paid_on.nil?\n end",
"def time_over?\r\n return self.due_date <= Time.now\r\n end",
"def technically_paid?\n unconfirmed_value_paid >= value_needed\n end",
"def payed?\n !payment_entry.nil?\n end",
"def booking_is_available?(user, service, order_time)\n order_time > Time.new + 6.hours and user.id != service.user_id\n end",
"def public_holiday?\n HOLIDAYS.include? to_date\n end",
"def overdue?\n return true if @past_due\n false\n end",
"def embargo_active?\n embargo.blank? ? false : Time.zone.today < embargo\n end",
"def invoiceable?\n has_user_id = self.user.present?\n grace_date = self.created_at.to_date + GRACE_PERIOD\n\n self.employee? && has_user_id && grace_date < Date.today\n end",
"def invoiceable?\n has_user_id = self.user.present?\n grace_date = self.created_at.to_date + GRACE_PERIOD\n\n self.employee? && has_user_id && grace_date < Date.today\n end",
"def active?\n self.inactive_date && Time.now < self.inactive_date\n end",
"def can_pay_total?\n\n conf_payment_enabled = SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n conf_payment_total = (['total','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_total 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_total and self.total_paid == 0 and self.total_pending > 0\n else\n return false\n end\n\n end",
"def lessthan?\n if self.contractendon < 14.day.since.to_date && self.contractendon > Time.now.to_date\n return true\n end\n end",
"def today?\n today = Time.zone.today\n ((date.present? && date == today) ||\n (week_days.include? today.strftime('%A'))\n ) && start_at > time_now\n end",
"def is_going?\n self.is_active && (self.start_date < Time.now) && (!self.finish_date || self.finish_date > Time.now)\n end",
"def rainy_today?\n self.rainy_today == true\n end",
"def better_to_confirm\n ! (self.confirmed && (((Time.zone.now - self.confirmed).to_i / 86400) < 365))\n end",
"def pre_claim?\n return false if filing_date.blank?\n\n filing_days_old = (Time.zone.today - filing_date).to_i.days\n\n # If the filing date is 365 days old or older then true (used for showing the claim)\n (filing_days_old <= Rails.configuration.x.returns.amendable_days)\n end",
"def financial_aid_approved?\n !financial_aid_approved_at.blank?\n end",
"def overdue\n @date > Date.today\n end",
"def postpaid?\n postpaid.to_i == 1\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 overdue?\r\n @overdue = Time.now > @due_date\r\n end",
"def overdue?\n due < Date.current\n end",
"def on_order?\n !self.paid?\n end",
"def hold_day?\n if self.date-7 < Date.today && self.date > Date.today\n return \"week_in\"\n elsif self.date < Date.today\n return \"finished\"\n end\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 has_aired\n self.airdate < Time.now\n end",
"def current?\n start_date = DateTime.new(self.year, 6, 21)\n # end_date should be one year after the start_date\n end_date = DateTime.new(self.year + 1, 6, 20) # 21?\n\n start_date <= DateTime.now and DateTime.now <= end_date\n end",
"def overdue? ()\n\t\t@due_date < Time.now\n end",
"def purchasing?\n auction.buy_it_now_price == amount\n end",
"def new?\n (!self.available_on.nil? && self.available_on >= self.class.new_on && self.available_on <= Date.today)\n end",
"def upcoming?(test, days)\r\n\t\tif self.overdue.present?\r\n\t\t\tself.overdue.upcoming?(test, days)\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend",
"def with_address?(address)\n return false\n if address_today_paid(address) > 0\n (order_price + address_today_paid(address)) > Setting.instance.max_total_per_day\n end\n end",
"def booked?\n if self.appointments.count == 0\n return false # It is not booked.\n elsif self.appointments.count == 2\n return true # It is booked.\n elsif self.appointments.count == 1 and !self.appointments.last.closed?\n return false # It is not booked.\n else\n return true # It is booked.\n end\n end",
"def in_renewal_span?\n (0..7).include?(end_date.to_date - Time.zone.now.to_date)\n end",
"def is_status_free (date)\n that_date = date\n return that_date < Date.today \n #komentarz na przyszlosc: #Date.new(2009,6,13)\n end",
"def upcoming?(num)\n bday = self.birthday.strftime('%j').to_i\n today = Date.today.strftime('%j').to_i\n\n bday += 365 if bday < num+1\n return ((bday - today >-1) && (bday - today <= num))\n end",
"def is_published?\n\t !self.is_discontinued? && (Time.now >= Time.parse(self.date_available.to_s))\n\tend",
"def must_pay_to_avoid_cancellation\n\t\tif @event.start_date < (Time.now + 1.week) && @event.paid == false \n\t\t\t#cannot book event\n\t\tend\n\tend",
"def has_bookings_at_period(checkin_date, checkout_date)\n # convert to date if string\n checkin_date = Date.parse(checkin_date) if checkin_date.is_a? String\n checkout_date = Date.parse(checkout_date) if checkout_date.is_a? String\n # if no consistency in period\n return true if checkout_date < checkout_date\n # prevent charging dataset for more than 100 days long\n return true if (checkout_date-checkin_date) >= 100\n # raise error ?\n self.bookings.each do |booking|\n (booking.checkin..booking.checkout).each do |d|\n # booking for this outfit at these dates\n return true if (checkin_date..checkout_date).include? d\n end\n end\n # no booking at this date\n return false\n end",
"def bought?\n # paym\n end",
"def is_today?\r\n @at.strftime(\"%Y%m%d\") == DateTime.now.strftime(\"%Y%m%d\")\r\n end",
"def business_day?\n !holiday?\n end",
"def billing_yearly?\n numbering_period == 'yearly'\n end",
"def pay_by_phone?\n status == Enums::PaymentStatus::PAY_BY_PHONE\n end"
] |
[
"0.7834351",
"0.7636704",
"0.7320001",
"0.71789056",
"0.71392745",
"0.699476",
"0.6926821",
"0.68859845",
"0.68713886",
"0.687133",
"0.6860084",
"0.6796483",
"0.6763264",
"0.6752877",
"0.6740175",
"0.6691168",
"0.66271865",
"0.6626101",
"0.6621665",
"0.66160995",
"0.6603483",
"0.65946907",
"0.65887433",
"0.65864",
"0.658618",
"0.6585057",
"0.6560565",
"0.65556276",
"0.6550911",
"0.6538094",
"0.652087",
"0.64964575",
"0.6472885",
"0.64564323",
"0.64491814",
"0.64348733",
"0.64316154",
"0.6424658",
"0.64117163",
"0.6393731",
"0.639058",
"0.6388173",
"0.63870686",
"0.6384361",
"0.6370593",
"0.6364774",
"0.6362232",
"0.6356475",
"0.63427144",
"0.6337192",
"0.63361245",
"0.633418",
"0.6333986",
"0.63272506",
"0.6321991",
"0.63080025",
"0.63055885",
"0.63020545",
"0.6292592",
"0.6290555",
"0.6289795",
"0.6286812",
"0.6286606",
"0.6286606",
"0.62724805",
"0.62622565",
"0.6260917",
"0.625966",
"0.62458056",
"0.6240272",
"0.6237425",
"0.6209415",
"0.6195775",
"0.61901283",
"0.61896354",
"0.61884165",
"0.6183331",
"0.61819524",
"0.61807424",
"0.6173185",
"0.6170239",
"0.6156762",
"0.615604",
"0.61440754",
"0.61434823",
"0.61366206",
"0.6130871",
"0.6112662",
"0.61125153",
"0.6109066",
"0.61049855",
"0.6099211",
"0.60988724",
"0.60962903",
"0.60793334",
"0.6076661",
"0.60707307",
"0.6065898",
"0.6061288",
"0.6055743"
] |
0.6756987
|
13
|
Sets the coordinates for a business.
|
def set_coordinates
addrs = [
"#{address_line_1}",
"#{address_line_2}",
"#{address_line_1}, #{address_line_2}"
]
catch(:geocoded) do
addrs.each do |addr|
begin
loc = MultiGeocoder.geocode(
"#{addr}, #{city}, #{state} #{zip}"
)
if loc.success
self.lat = loc.lat
self.lng = loc.lng
throw :geocoded
end
rescue Exception => ex
puts " -> #{addr} did not resolve"
puts " -> #{ex.message}"
end
end
puts "did not match any combination of address1 and address2"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def coordinates=(coordinates)\n self.latitude, self.longitude = coordinates\n end",
"def set_business_geopoint\n @business_geopoint = BusinessGeopoint.find(params[:id])\n end",
"def xy=(value)\n set(:xy => value)\n end",
"def set_location_coordinates\n address = \"#{self.address.gsub('|', '+')}+\" +\n \", #{self.city}+\" +\n \", #{self.state unless self.state.nil?}+\" +\n \"#{self.country}\"\n address.gsub!(' ', '+')\n GetLocationCoordinatesJob.perform_later(self, address)\n end",
"def setxy(x, y)\n setpos y, x\n end",
"def set_x_y(x,y)\r\n @x=x\r\n @y=y\r\n self\r\n end",
"def xy=(coords)\n raise ArgumentError unless is_point?(coords)\n @xy = coords\n end",
"def at(*coordinates)\n position.coordinates = coordinates\n end",
"def set_coordinate\n @coordinate = Coordinate.find(params[:id])\n end",
"def set(x, y)\n @x = x\n @y = y\n self\n end",
"def at(x, y)\n self.coordinates = [x, y]\n end",
"def set_location(lon, lat)\n\t\tfactory = Driver.rgeo_factory_for_column(:location)\n\t\t# update(location: factory.point(lon,lat))\n\t\tself.location = factory.point(lon,lat)\n\tend",
"def set_business\n @business = Business.find(params[:id])\n @current_obj = @business\n end",
"def set_coord\n @coord = Coord.find(params[:id])\n end",
"def xy=(value); self.state = { :xy => value }; end",
"def set_loc(x, y)\n @curr_x = x\n @curr_y = y\n end",
"def set_business\n\t\t@business = Business.find(params[:id])\n\tend",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def setpoint\n @setpoint\n end",
"def set_businessline\n @businessline = Businessline.find(params[:id])\n end",
"def set_coordinate\n @coordinate = Coordinate.find(params[:id])\n end",
"def set_businessdocumentposition\n @businessdocumentposition = Billing::Businessdocumentposition.find(params[:id])\n end",
"def setBoundingBox\n return unless border_points_minus_removed.any?\n self.max_latitude = -100 #max latitude\n self.min_latitude = 100 #min latitude\n self.max_longitude = -200 #max longitude\n self.min_longitude = 200 #min longitude\n border_points_minus_removed.each do |point|\n self.max_latitude = max_latitude > point.latitude ? max_latitude : point.latitude\n self.min_latitude = min_latitude < point.latitude ? min_latitude : point.latitude\n self.max_longitude = max_longitude > point.longitude ? max_longitude : point.longitude\n self.min_longitude = min_longitude < point.longitude ? min_longitude : point.longitude\n end\n end",
"def coordinates=(coordinates)\n if coordinates && coordinates.is_a?(String)\n @coordinates = coordinates.strip\n end\n end",
"def set_location(map_id, x, y)\n @map_id = map_id\n @x = x\n @y = y\n refresh\n end",
"def set_business_area\n @business_area = BusinessArea.find(params[:id]) \n end",
"def set(x, y, width, height)\n @x = x\n @y = y\n @width = width\n @height = height \n end",
"def set(x, y, width, height)\n @x = x\n @y = y\n @width = width\n @height = height\n end",
"def office_location=(value)\n @office_location = value\n end",
"def set(x, y)\n @x, @y = x, y\n end",
"def setLonLat\n # keep in mind that this format is longitude, latitude, not the other way\n self.lonlat = \"POINT(#{longitude} #{latitude})\"\n end",
"def coordinates(value)\n @tileset.coordinates = value\n end",
"def set_office_location\n @office_location = @company.office_locations.find(params[:id])\n end",
"def set_business_sale\n @business_sale = BusinessSale.find(params[:id])\n end",
"def set_business\n @business = Business.find_by(id_string: params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def set_business\n @business = Business.find(params[:id])\n end",
"def place_at(x, y)\n\t\t@x = x\n\t\t@y = y\n\t\tcoords\n\tend",
"def xy=(coords)\n if coords.size != 2\n raise(ArgumentError, \"turtle needs two coordinates\")\n end\n x, y = coords\n must_be_number(x, 'x-coordinate')\n must_be_number(y, 'y-coordinate')\n @xy = x.to_f, y.to_f\n end",
"def setposition(x,y)\n\t\t@x = x\n\t\t@y = y\n\tend",
"def set_latlng!\n if ! self.physical_address1.blank? && ! self.physical_address_city.blank? && ! self.physical_address_state.blank? && ! self.physical_address_zip.blank? \n phys_addr = Geokit::Geocoders::YahooGeocoder.geocode self.physical_address1 + \",\" + \n self.physical_address_city + \",\" + self.physical_address_state + \" \" + self.physical_address_zip\n if phys_addr && ! phys_addr.lat.blank? && ! phys_addr.lng.blank? \n latlng = AddrLatlng.new(:agent_id => self.id, :lat => phys_addr.lat, :lng => phys_addr.lng)\n self.addr_latlng = latlng\n self.save\n end\n else\n if ! self.addr_latlng.blank?\n self.addr_latlng.destroy\n end\n end\n end",
"def place(x, y)\n self.robot_position = {\n x: x,\n y: y\n } if valid_coordinates?(x, y)\n end",
"def set_business_event\n @business_event = BusinessEvent.find(params[:id])\n end",
"def set_DisplayCoordinates(value)\n set_input(\"DisplayCoordinates\", value)\n end",
"def set_mybusiness\n @mybusiness = Mybusiness.find(params[:id])\n end",
"def setWaypointHousePosition _obj, _args\n \"_obj setWaypointHousePosition _args;\" \n end",
"def set_x_y(x, y)\n @x = x && !x.is_a?(Numeric) ? x.to_f : x\n @y = y && !y.is_a?(Numeric) ? y.to_f : y\n self\n end",
"def set_object_position(obj, value)\n obj.y = value\n end",
"def set_business_process\n @business_process = BusinessProcess.find(params[:id])\n end",
"def setcoord(type, value)\n @point_xy[type.to_sym] = value if ('x'..'y').cover?(type.to_s.downcase)\n chxyattr\n end",
"def set( *pos )\n if pos.length > 1\n if pos[0].kind_of? Symbol\n self.dir( *pos )\n else\n @x = Coord.set( pos[0] )\n @y = Coord.set( pos[1] )\n end\n else\n pos = pos[0]\n if pos.kind_of? Pos\n @x, @y = pos.xref, pos.yref\n else\n @x = Coord.set( pos[0] )\n @y = Coord.set( pos[1] )\n end\n end\n self\n end",
"def set_object_position(obj, value)\n obj.y = value if obj\n end",
"def set_business_owner\n @business_owner = BusinessOwner.find(params[:id])\n end",
"def set_business_trip_info\n @business_trip_info = BusinessTripInfo.find(params[:id])\n end",
"def setPlaces\n\n return unless area_changed?\n AreaPlace.delete child_area_place_ids\n return unless area > 0\n\n places = Place.find_by_bounding_box max_latitude, min_latitude, max_longitude, min_longitude\n\n places.each do |place|\n if place.area.nil? || self.area > place.area\n #Add if center point is in this area\n\tif inArea(place.centerLatitude, place.centerLongitude)\n AreaPlace.create(:area_id => id, :place_id => place.id)\n\tend\n end\n end\n end",
"def set_object_other_position(obj, value)\n obj.y = value if obj\n end",
"def setVehiclePosition _obj, _args\n \"_obj setVehiclePosition _args;\" \n end",
"def setB(b)\r\n @b = b\r\n end",
"def set_lonlat\n return unless persisted? && latitude.present? && longitude.present?\n\n sql = <<~SQL\n UPDATE stores\n SET lonlat = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326)\n WHERE id = #{id}\n SQL\n ActiveRecord::Base.connection.execute sql\n end",
"def ini( x, y )\n @x = Coord.set( x )\n @y = Coord.set( y )\n self\n end",
"def set_BoundingBox(value)\n set_input(\"BoundingBox\", value)\n end",
"def set_BoundingBox(value)\n set_input(\"BoundingBox\", value)\n end",
"def setOverlayPosition(coordinates)\n @overlayPosition = coordinates\n end",
"def set_business_listing\n @business_listing = BusinessListing.find(params[:id])\n end",
"def set_location\n @location = \"Minneapolis, MN\"\n end",
"def set_point(x,y,z)\n @screen_point.x = x\n @screen_point.y = y\n self.x = @screen_point.screen_x\n self.y = @screen_point.screen_y\n self.z = z\n end",
"def set_bus_line_direction\n @bus_line_direction = BusLineDirection.find(params[:id])\n end",
"def set_object_position(obj, value)\n obj.x = value\n end",
"def set_position(x, y)\n @pos_x = x\n @pos_y = y\n end",
"def set_address\n if @location\n @address = @locations.find(params['id'])\n else\n @address = Address.find(params['id'])\n end\n end",
"def set_sales_address\n @sales_address = Sales::Address.find(params[:id])\n end",
"def set_address\n @customer_ship_address = CustomerShipAddress.find(params[:id])\n end",
"def coordinate=(coordinate)\n raise 'not on table yet' unless @table\n raise 'out of table' unless table.is_on_table(coordinate)\n @coordinate = coordinate\n end",
"def set_bus\n @bus = Bus.find(params[:id])\n if @bus && @bus.user\n @bus.email = @bus.user.email\n end\n end",
"def set_object_position(obj, value)\n obj.x = value if obj\n end",
"def set_business_unit\n @business_unit = BusinessUnit.find(params[:id])\n end",
"def loc_x=(x)\n self.x = x\n end",
"def set_location(latitude, longitude, user_id)\n @latitude[user_id] = latitude\n @longitude[user_id] = longitude\n\n message = [user_id, @latitude[user_id], @longitude[user_id]].join(\",\")\n @pubnub.publish(\n channel: \"#{@event_id}_location\",\n message: message,\n http_sync: true\n ) { |env| log_event(env) }\n\n # Update parse\n location = get_user_event_location(user_id)\n location[\"latitude\"] = @latitude[user_id]\n location[\"longitude\"] = @longitude[user_id]\n PARSE_MUTEX.synchronize { location.save }\n end",
"def origin=(point)\n end",
"def column=(value)\n @coordinate.x = value\n end",
"def set_object_other_position(obj, value)\n obj.x = value if obj\n end",
"def assign_lon_lat_locator_fields\n box = getBoxForCoordinates( view_path_coordinates[\"LonLat\"] )\n self.nw_lon= box[0][0]\n self.nw_lat= box[0][1]\n self.se_lon= box[1][0]\n self.se_lat= box[1][1]\n end",
"def setWaypointPosition _obj, _args\n \"_obj setWaypointPosition _args;\" \n end",
"def position= o\n self.x = o.x\n self.y = o.y\n end",
"def set(date, latitude, longitude)\n calculate(:set, date, latitude, longitude)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def fax_set(number)\n self.fax.set number\n end",
"def address1_set(address)\n self.address1.set address\n end",
"def setBoundaries(boundaries)\n @boundaries = boundaries\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end"
] |
[
"0.63420475",
"0.63239855",
"0.62276506",
"0.6190533",
"0.6090764",
"0.60856366",
"0.60675246",
"0.5993829",
"0.5948529",
"0.58766675",
"0.5772516",
"0.5759539",
"0.57577324",
"0.5732269",
"0.5720599",
"0.5689424",
"0.5673951",
"0.5671426",
"0.5671426",
"0.5671426",
"0.5671426",
"0.5671426",
"0.5671426",
"0.5671426",
"0.5671426",
"0.5671426",
"0.5668429",
"0.566298",
"0.5650064",
"0.55941874",
"0.5579398",
"0.55721605",
"0.5551571",
"0.55212986",
"0.5503824",
"0.5481922",
"0.5471668",
"0.5443481",
"0.54362917",
"0.54144174",
"0.5364096",
"0.53566295",
"0.53482044",
"0.53379834",
"0.53379834",
"0.5323217",
"0.53117585",
"0.52933466",
"0.5264678",
"0.52373844",
"0.52320117",
"0.52233124",
"0.5208748",
"0.51884294",
"0.5179602",
"0.51697147",
"0.5169206",
"0.51620865",
"0.5148223",
"0.5141653",
"0.51297134",
"0.5126943",
"0.51234907",
"0.51220596",
"0.5109304",
"0.51021475",
"0.5098531",
"0.50898004",
"0.5087575",
"0.5087575",
"0.5087086",
"0.50676465",
"0.5047982",
"0.504072",
"0.5039404",
"0.5038663",
"0.50353605",
"0.5021952",
"0.5020433",
"0.5012976",
"0.50120026",
"0.5009112",
"0.49995014",
"0.4990444",
"0.4990172",
"0.49876925",
"0.49874136",
"0.49843082",
"0.49821314",
"0.4979748",
"0.49607444",
"0.49596462",
"0.4957481",
"0.49573454",
"0.49573454",
"0.49571916",
"0.49428788",
"0.49329984",
"0.4926706",
"0.4926706"
] |
0.49479866
|
96
|
takes a code returned by wepay oauth2 authorization and makes an api call to generate oauth2 token for this farmer.
|
def request_wepay_access_token(code, redirect_uri)
response = GemsUsage::Application::WEPAY.oauth2_token(code, redirect_uri)
if response['error']
raise "Error - "+ response['error_description']
elsif !response['access_token']
raise "Error requesting access from WePay"
else
self.wepay_access_token = response['access_token']
self.save
self.create_wepay_account
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n\t#create WePay account\n self.create_wepay_account\n end\nend",
"def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n end\nend",
"def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n #create wepay account\n self.create_wepay_account\n end\nend",
"def request_wepay_access_token(code, redirect_uri)\n response = Wefarm::Application::WEPAY.oauth2_token(code, redirect_uri)\n raise 'Error - ' + response['error_description'] if response['error']\n raise 'Error requesting access from WePay' unless response['access_token']\n self.wepay_access_token = response['access_token']\n save\n create_wepay_account\n end",
"def request_wepay_access_token(code, redirect_uri)\n\t\t#response = Wefarm::Application::WEPAY.oauth2_token(code, OAUTH_REDIRECT_URI + self.id.to_s)\n\t\tresponse = Wefarm::Application::WEPAY.oauth2_token(code, redirect_uri)\n\t\tif response['error']\n\t\t\traise \"Error - \"+ response['error_description']\n\t\telsif !response['access_token']\n\t\t raise \"Error requesting access from WePay\"\n\t\telse\n\t\t\tself.wepay_access_token = response['access_token']\n\t\t\tself.save\n\t\t\t\n\t\t\t#create WePay account\n\t\t\tself.create_wepay_account\n\t\tend\n\tend",
"def exchange_code_for_token\n current_user.update_attributes(:api_country_code => params[:country].downcase)\n body_params = token_request_body\n body_params << [\"code\", params[:code]]\n body_params << [\"grant_type\", \"authorization_code\"]\n body_params << [\"redirect_uri\", sage_accounting_config['sage_accounting']['callback_url']]\n\n get_token(body_params)\n redirect_to sage_accounting_data_path\n end",
"def step2\n initialize_vars\n url = \"#{@oauth_vars[:token_url]}?code=#{params[:code]}&grant_type=authorization_code&client_id=#{@oauth_vars[:client_id]}&client_secret=#{@oauth_vars[:client_secret]}&response_type=code&redirect_uri=#{@redirect_uri}\"\n rep = JSON.parse(get_json_from_https(url))\n session[:access_token] = rep[\"access_token\"]\n\n do_API_call\n end",
"def get_token(code)\n option = {\n url: \"#{self.bot_origin}/oauth/token\",\n header: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n param: {\n grant_type: \"authorization_code\",\n client_id: self.client_id,\n client_secret: self.client_secret,\n redirect_uri: self.redirect_uri,\n code: code\n }\n }\n response = post(option)\n json = JSON.parse(response.body)\n json[\"access_token\"]\n end",
"def request_token\n request = { query: { code: ENV['GOOGL_CODE'], \n client_id: ENV['GOOGL_CLIENT_ID'], \n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n redirect_uri: ENV['GOOGL_REDIRECT_URI'],\n grant_type: \"authorization_code\" } }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response\n end",
"def exchange_code_for_token(api, client, auth_code)\n client.auth_code.get_token(auth_code, redirect_uri: api.oauth_redirect)\n rescue OAuth2::Error => e\n fail_with_oauth_error(\n \"Failed to exchange auth_code for token (code=#{e.response.status})\",\n e.response\n )\n end",
"def token!(code)\n Vermonster::Client.connection.basic_auth(@client[:id], @client[:secret])\n\n options = { :grant_type => \"autorization_code\", :code => code }\n response = Vermonster::Client.connection.post \"/oauth/token\", options\n\n if response.body[\"access_token\"]\n @client = @client.merge(:token => response.body[\"access_token\"])\n\n self.connect!(@client[:token])\n\n\n if @client[:token]\n @client[:token]\n else\n false\n end\n else\n false\n end\n end",
"def request_wepay_access_token(code, redirect_uri)\n\t response = WEPAY.oauth2_token(code, redirect_uri)\n\t if response['error']\n\t raise \"Error - \"+ response['error_description']\n\t elsif !response['access_token']\n\t raise \"Error requesting access from WePay\"\n\t else\n\t \tputs \"need to get access token\"\n\t \tputs response['access_token']\n\t # self.wepay_access_token = response['access_token']\n\t # self.save\n\t self.update_columns(wepay_access_token: response['access_token'])\n\n\t\t#create WePay account\n\t self.create_wepay_account\n\t end\n\tend",
"def exchange_code(code)\n return nil unless token_account\n return nil unless token_account['token_endpoint']\n\n response = request(\n http_method: token_account['token_method'].downcase.to_sym,\n path: token_account['token_endpoint'],\n headers: { CONTENT_TYPE => token_account['token_post_content_type'] },\n body: {\n 'grant_type' => 'authorization_code',\n 'code' => code,\n 'client_id' => Kontena::Client::CLIENT_ID,\n 'client_secret' => Kontena::Client::CLIENT_SECRET\n },\n expects: [200,201],\n auth: false\n )\n response['expires_at'] ||= in_to_at(response['expires_in'])\n response\n end",
"def create\n client.authorization_code = params[:code]\n access_token = client.access_token!\n puts access_token\n end",
"def get_token(code)\n uri = URI.parse(URL[\"oauth_access\"])\n params = { :client_id => CLIENT_ID,\n :client_secret => CLIENT_SECRET,\n :code => code\n }\n uri.query = URI.encode_www_form( params )\n return JSON.parse(uri.open.read)\n end",
"def request_token(code)\n params = {\n code: code,\n client_id: client_id,\n client_secret: client_secret,\n redirect_uri: redirect_uri,\n grant_type: 'authorization_code'\n }.to_param\n\n header = { 'Content-Type' => 'application/x-www-form-urlencoded' }\n uri = URI(TOKEN_URL)\n net_http = Net::HTTP.new(uri.host, uri.port)\n net_http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = params\n response = net_http.request(request)\n if response.code == '200'\n data = JSON.load(response.body)\n @access_token = data['access_token']\n @refresh_token = data['refresh_token']\n @expires_in = data['expires_in']\n else\n raise StandardError.new(response.body)\n end\n end",
"def get_access_token(code, _options = {})\n conn = Faraday.new(url: base_url) do |faraday|\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n end\n params = access_token_params(code)\n conn.post do |req|\n req.url \"/api/oauth2/token\"\n req.body = params\n req.headers[\"Accept\"] = \"application/json\"\n end\n end",
"def codeExchange(code)\n # Upgrade the code into a token object.\n $authorization.code = code\n $authorization.fetch_access_token!\n $client.authorization = $authorization\n\n # TODO: move into verify_token function\n id_token = $client.authorization.id_token\n encoded_json_body = id_token.split('.')[1]\n\n # Base64 must be a multiple of 4 characters long, trailing with '='\n encoded_json_body += (['='] * (encoded_json_body.length % 4)).join('')\n json_body = Base64.decode64(encoded_json_body)\n body = JSON.parse(json_body)\n\n # You can read the Google user ID in the ID token.\n # \"sub\" represents the ID token subscriber which in our case\n # is the user ID. This sample does not use the user ID.\n gplus_id = body['sub']\n puts \"User ID: \"\n puts gplus_id.inspect\n\n # Serialize and store the token in the user's session.\n token_pair = TokenPair.new\n token_pair.update_token!($client.authorization)\n\n puts token_pair.inspect\nend",
"def get_authorization_code_with_http_info(selling_partner_id, developer_id, mws_auth_token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthorizationApi.get_authorization_code ...'\n end\n # verify the required parameter 'selling_partner_id' is set\n if @api_client.config.client_side_validation && selling_partner_id.nil?\n fail ArgumentError, \"Missing the required parameter 'selling_partner_id' when calling AuthorizationApi.get_authorization_code\"\n end\n # verify the required parameter 'developer_id' is set\n if @api_client.config.client_side_validation && developer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'developer_id' when calling AuthorizationApi.get_authorization_code\"\n end\n # verify the required parameter 'mws_auth_token' is set\n if @api_client.config.client_side_validation && mws_auth_token.nil?\n fail ArgumentError, \"Missing the required parameter 'mws_auth_token' when calling AuthorizationApi.get_authorization_code\"\n end\n # resource path\n local_var_path = '/authorization/v1/authorizationCode'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'sellingPartnerId'] = selling_partner_id\n query_params[:'developerId'] = developer_id\n query_params[:'mwsAuthToken'] = mws_auth_token\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', 'payload', 'errors'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'GetAuthorizationCodeResponse' \n\n auth_names = opts[: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 => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthorizationApi#get_authorization_code\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def oauth_complete(code)\n # Let's compile the API URL we're calling.\n url = PUTIO_BASE_URL + \"/oauth2/access_token?client_id=%i&client_secret=%s&grant_type=authorization_code&redirect_uri=%s&code=%s\" % [@client_id, @application_secret, @redirect_uri, code]\n \n # And call it.\n response = Curl::Easy.perform(url) do |req|\n req.headers['Accept'] = 'application/json'\n end\n\n # Use Crack to parse the JSON\n response = JSON.parse(response.body_str)\n\n # And use Hashie to present it.\n response = Hashie::Mash.new(response)\n\n # Save it locally.\n @access_token = response.access_token\n\n # Return it\n response\n end",
"def oauth2_token(code, redirect_uri)\n call('/oauth2/token', false, {\n 'client_id' => @client_id,\n 'client_secret' => @client_secret,\n 'redirect_uri' => redirect_uri,\n 'code' => code\n })\n end",
"def exchange(code, redirect_url=nil)\n params = {\n client_id: client_id,\n client_secret: client_secret,\n code: code,\n grant_type: \"authorization_code\",\n redirect_uri: redirect_url\n }\n begin\n response = RestClient.post token_url, params\n rescue => e\n logger.info \"Code exchange problem: \" + e.message\n return\n end\n return if response.code != 200\n\n logger.info \"Code exchange: \" + response.body\n return JSON.parse response.body\n end",
"def do_token(params, clientId, clientSecret)\n # Call Authlete's /auth/token API.\n response = call_token_api(params, clientId, clientSecret)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INVALID_CLIENT\"\n # 401 Unauthorized\n # Client authentication failed.\n return WebResponse.new(401, content).json\\\n .wwwAuthenticate(\"Basic realm=\\\"/token\\\"\").to_response\n\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # The token request from the client was wrong.\n return WebResponse.new(400, content).json.to_response\n\n when \"PASSWORD\"\n # Process the token request whose flow is\n # \"Resource Owner Password Credentials\".\n return handle_password(response)\n\n when \"OK\"\n # 200 OK\n # The token request from the client was valid. An access\n # token is issued to the client application.\n return WebResponse.new(200, content).json.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend",
"def get_fitbit_token(code)\n @fitbit_oauth_client.site = \"https://api.fitbit.com\" \n @fitbit_token = @fitbit_oauth_client.auth_code.get_token(code,:redirect_uri => ENV['FITBIT_REDIRECT_URL'] ,:headers =>{'Authorization' => \"Basic #{@base64_id_secret}\",'Body' => \"client_id=#{@fitbit_oauth_client.id}\"})\n end",
"def get_token(code)\n url = \"#{sk_url}/oauth/token?code=#{code}&client_id=#{@@conf['id']}&client_secret=#{@@conf['secret']}&redirect_uri=#{oauth_redirect_uri}\"\n c = Curl::Easy.perform(url)\n # grab token from response body, containing json string\n ActiveSupport::JSON.decode(c.body_str)\n end",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n # :authorize_url => \"/auth/office365/callback\")\n \n token = client.auth_code.get_token(auth_code,\n :redirect_uri => office365_callback_url,\n :scope => SCOPES.join(' '))\n end",
"def oauth2_access_token(code, options={})\n query = {\n :client_id => Config.client_id,\n :client_secret => Config.client_secret,\n :grant_type => 'authorization_code',\n :redirect_uri => Config.redirect_uri,\n :code => code\n }\n return send_request(:POST, PATH[:oauth2_access_token], query, false, options)\n end",
"def build_access_token\n verifier = request.params[\"code\"]\n client.auth_code.get_token(verifier, token_params.to_hash(:symbolize_keys => true), deep_symbolize(options.auth_token_params))\n end",
"def oauth_data(code:)\n res = uphold_conn.post do |req|\n req.url UPHOLD_AUTHENTICATION_PATH\n req.headers['Authorization'] = ActionController::HttpAuthentication::Basic.encode_credentials(client_id, client_secret)\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers['Content-Type'] = 'application/x-www-form-urlencoded'\n req.body = URI.encode_www_form({code: code, grant_type: 'authorization_code'})\n end\n JSON.parse(res.body, symbolize_names: true).tap do |body|\n @access_token = body[:access_token]\n end\n end",
"def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code]\n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step\n token = client.auth_code.get_token(code, :redirect_uri => REDIRECT_URI)\n \n #save token to xml file\n File.open(TOKEN_FILE, 'w') do |file| \n file.write(token.token)\n end\n end\n end",
"def get_access_token(code, options={})\n options[:grant_type] ||= \"authorization_code\"\n params = access_token_params.merge(options)\n response = post(\"https://www.douban.com/service/auth2/token\",\n params.merge(:code => code),\n raw=false)\n end",
"def oauth\n if params[:code]\n token_response = get_user_tokens(params[:code])\n signup_or_login(token_response)\n end\n\n render json: params\n end",
"def exchange_code(authorization_code)\n\t\tclient_secrets = Google::APIClient::ClientSecrets.load(CLIENT_SECRET_PATH)\n client = client_secrets.to_authorization \n client.update!(redirect_uri: 'postmessage')\n client.code = authorization_code\n \n\t begin\n\t # client.authorization.fetch_access_token!\n\t client.fetch_access_token!\n\t return client\n\t rescue Signet::AuthorizationError\n\t raise CodeExchangeError.new(nil)\n\t end\n\tend",
"def request_token\n TokenFactory.create_token(params[:code].to_s)\n # After the code has been received, redirects to projects.\n redirect_to :controller => 'projects', :action => 'index'\n end",
"def get_token(code)\n uri = URI.parse(\"https://api.dropboxapi.com/oauth2/token\")\n\n payload = URI.encode_www_form(\n client_id: DROPBOX_APP_KEY,\n client_secret: DROPBOX_APP_SECRET,\n code: code,\n grant_type: \"authorization_code\",\n redirect_uri: SHOTTY_CALLBACK_URL,\n )\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n\n response = http.post(uri.path, payload, {})\n\n body = JSON.parse(response.body)\n\n body[\"access_token\"]\nend",
"def oauth_url_token(code)\n # return \"#{$SETTINGS[:oauth_server_url_token]}?code=#{code}&grant_type=authorization_code&client_id=#{$SETTINGS[:oauth_client_id]}&client_secret=#{$SETTINGS[:oauth_client_secret]}&redirect_uri=#{oauth_redirect_uri}\" \n return \"#{$SETTINGS[:oauth_server_url_token]}?code=#{code}&client_id=#{$SETTINGS[:oauth_client_id]}&client_secret=#{$SETTINGS[:oauth_client_secret]}\" \n end",
"def request_token\n username = @credentials['username']\n password = @credentials['password']\n # app_name = @credentials['app_name']\n app_name = @credentials['app_name']\n vendor_name = @credentials['vendor_name']\n bus_num = @credentials['bus_num']\n scope = @credentials['scope']\n\n payload_hash = {\n 'grant_type' => 'password',\n 'username' => username,\n 'password' => password,\n 'scope' => scope\n }\n\n # The user name for inContact's API takes the form\n # app_api_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\" + \":\" + \"#{bus_num}\"\n api_app_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\"\n\n puts \"Authorizing... \\n\"\n\n # Specify token URL.\n url = URI('https://api.incontact.com/InContactAuthorizationServer/Token')\n # url = URI('https://api-c71.nice-incontact.com/InContactAuthorizationServer/Token')\n\n # Create connection object\n connection = Net::HTTP.new(url.host, url.port)\n # At *work*:\n # connection = Net::HTTP.new(url.host, url.port, 'asqproxy.vzbi.com', 80)\n # For *Fiddler*\n # connection = Net::HTTP.new(url.host, url.port, '127.0.0.1', 8888)\n\n connection.use_ssl = true\n # Uncomment the following line to tell Ruby to ignore invalid security certs.\n # connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Create post object\n post = Net::HTTP::Post.new(url)\n\n # OAuth 2 token requests are usually the 'user' + 'pass' base64 encoded\n post.basic_auth(api_app_name, bus_num)\n\n # get the POST post _fileheaders\n # post['Content-Type'] = 'audio/flac'\n post['Content-Type'] = 'application/json; charset=UTF-8'\n post['Accept'] = 'application/json'\n # \"Accept-Encoding\" => \"gzip, deflate, sdch, br\",\n post['Accept-Encoding'] = 'none'\n post['Connection'] = 'keep-alive'\n\n # Prepare the HTTP message body to be posted with the request.\n # Convert the payload_hash hash to a json string.\n payload = payload_hash.to_json\n # It will be the message body (payload) of the HTTP post.\n post.body = payload\n\n # Make the HTTP post request and store the response.\n # The 'begin' & 'rescue' is an aborted attempt to put\n # error/exception handling around the http post\n # *begin*\n # *rescue* StandardError\n # *end*\n response = connection.request(post)\n\n # http_status_code = response.code.to_i\n http_status_code = response.code.strip\n if http_status_code.chr != '2'\n # Show me http status code\n puts \"/n http_status_code: #{http_status_code}\"\n end\n\n if response.is_a?(Net::HTTPSuccess)\n puts \"response is a Net::HTTPSuccess object\"\n # if response is OK then parese it to a Ruby data structure\n access_token_hash = JSON.parse(response.body)\n # access_token = access_token_hash['access_token']\n end\n\n access_token_hash\n end",
"def request_access_token(code, params={})\n params[:redirect_uri] ||= \"http://localhost\"\n opts = {}\n opts[:mode] = :query\n opts[:param_name] = \"oauth2_access_token\"\n @access_token = oauth2_client.auth_code.get_token(code, params, opts)\n rescue OAuth2::Error => e\n raise LinkedIn::Errors::UnauthorizedError.new(e.code), e.description\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def data_acc_token(code, client_id, client_secret, grant_type=\"authorization_code\", redirect_uri=REDIRECT_URL)\n \"client_id=#{client_id}&client_secret=#{client_secret}&grant_type=#{grant_type}&code=#{code}&redirect_uri=#{redirect_uri}\"\n end",
"def set_code(code)\n credentials = AUTHORIZER.get_and_store_credentials_from_code(\n user_id: USER_ID, code: code, base_url: OOB_URI\n )\n credentials.refresh_token\nend",
"def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => REDIRECT_URI)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n puts response.body\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def fetch_token(code, redirect_uri)\n @access_token_obj = @auth_client.auth_code.get_token(code, {\n :redirect_uri => redirect_uri,\n :token_method => :post\n })\n end",
"def create\n super\n \n if @access_token.client.uses_account_sid\n # Never expire this token. It will be expired when the user explicitly\n # ends their session (by logging out), and possibly after a configurable\n # amount of time, if the provider is using expiration scheduling\n # (see the sessions:expire rake task).\n @access_token.expires_at = Time.mktime(2100, 12, 31)\n end\n \n authorization_code = Oauth2Providable::AuthorizationCode.find_by_token(params[:code])\n @access_token.account_sid = authorization_code.account_sid\n @access_token.client_sid = params[:client_sid]\n @access_token.save\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n token = client.auth_code.get_token(auth_code,\n :redirect_uri => authorize_url,\n :scope => SCOPES.join(' '))\n end",
"def exchange_code(authorization_code)\n client = Google::APIClient.new\n client.authorization = client_secrets\n client.authorization.code = authorization_code\n\n begin\n client.authorization.fetch_access_token!\n return client.authorization\n rescue Signet::AuthorizationError\n raise CodeExchangeError.new(nil)\n end\nend",
"def oauth2_callback\n # Swap Auth token for an access token\n token = oauth2_client.auth_code.get_token(params[:code])\n\n # Remember the access token\n session[:access_token] = token.token\n redirect_to repo_index_path\n end",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n token = client.auth_code.get_token(auth_code,\n :redirect_uri => authorize_url,\n :resource => 'https://outlook.office365.com')\n\n access_token = token\n end",
"def get_token (params)\n client = OAuth2::Client.new(params[:APP_ID], params[:APP_SECRET], :site => params[:OAUTH_URL])\n\n begin\n token = client.password.get_token(params[:USER_EMAIL], params[:USER_PASSWD], :scope => params[:SCOPE]).token\n rescue => e\n puts \"Error: Can't get oauth token, check credentials for '#{params[:NAME]}'\"\n puts \"#{e.message}\"\n abort \"Aborting script\"\n end\n return token\nend",
"def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => get_redirect_uri)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n session[:linkedin_token] = access_token.token\n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n #logger.debug \"test putting string #{response.body}\"\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end",
"def get_user_tokens(code)\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"authorization_code\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n 'code' => code\n },\n headers: {\n 'Api-Key' => ID\n })\n request.run\n end",
"def get_user_code\n data = {\n :client_id => @a_conf[:client_id],\n :scope => 'https://www.googleapis.com/auth/calendar',\n }\n #puts \"Data for get_user_code\"\n #pp data\n\n json = RestClient.post \"https://accounts.google.com/o/oauth2/device/code\", data\n response = JSON.parse(json)\n #puts response.inspect\n if response[\"device_code\"]\n puts \"__________ go to #{response[\"verification_url\"]} and use code #{response[\"user_code\"]} _________\"\n @conf[:oauth][:device_code] = response[\"device_code\"]\n @conf[:oauth][:user_code] = response[\"user_code\"]\n @conf[:oauth][:verification_url] = response[\"verification_url\"]\n @conf[:oauth][:verification_interval] = response[\"interval\"].to_i\n @conf[:oauth][:verification_expires_in] = response[\"expires_in\"].to_i\n @conf[:oauth][:verification_interval_start] = Time.now\n else\n # No Token\n end\n rescue RestClient::BadRequest => e\n puts \"Bad request for 'get_user_code'\"\n puts e.message\n #puts e.backtrace\n rescue => e\n puts 'Something else bad happened during get_user_code'\n puts e.message\n #puts e.backtrace\n end",
"def get_access_token_from_auth_code(auth_code, client_id, client_secret, redirect_uri, environment = nil)\n environment ||= \"mypurecloud.com\"\n\n tokenFormData = {\n \"grant_type\" => \"authorization_code\",\n \"code\" => auth_code,\n \"redirect_uri\" => redirect_uri\n }\n\n tokenResponse =JSON.parse RestClient.post \"https://#{client_id}:#{client_secret}@login.#{environment}/token\", tokenFormData\n\n return tokenResponse['access_token'];\n end",
"def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end",
"def get_token\n oauth = LinkedIn::OAuth2.new\n url = oauth.auth_code_url\n visit url\n\n form = find('form', class: 'grant-access')\n within form do\n fill_in('session_key-oauth2SAuthorizeForm', with: Rails.configuration.linkedin_email)\n fill_in('session_password-oauth2SAuthorizeForm', with: Rails.configuration.linkedin_password)\n end\n\n find(\"input[type=submit]\").hover\n find(\"input[type=submit]\").trigger(:click)\n\n print \"fetching code\"\n count = 0\n while !page.current_url.include?('code=')\n count += 1\n print \".\" if count & 50 == 0\n end\n\n puts\n url = page.current_url\n code = CGI.parse(URI.parse(url).query)['code'].first\n\n acess_token = oauth.get_access_token(code)\n puts acess_token\n end",
"def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end",
"def refresh_token(code=nil)\n body = {}\n body[:code] = code unless code.nil?\n\n @client.client_credentials.get_token(\n headers: { 'Authorization' => 'Basic' })\n end",
"def request_oauth_token\n request_token_hash = {\n \"oauth_consumer_key\" => \"#{@consumer_key}\",\n \"oauth_signature_method\" => \"HMAC-SHA1\",\n \"oauth_timestamp\" => timestamp,\n \"oauth_nonce\" => nonce,\n \"oauth_version\" => \"1.0\",\n \"oauth_callback\" => \"oob\",\n }\n\n # set signature\n request_token_hash[\"oauth_signature\"] = generate_oauth_signature(generate_signature_base_string(\"POST\", @request_token_url, request_token_hash))\n\n # post with auth header\n result = MyHttp.post(@request_token_url, nil, {\n \"Authorization\" => \"OAuth #{generate_auth_header(request_token_hash)}\",\n })\n\n auth_token_string = result.body.strip\n if result.is_a? Net::HTTPSuccess\n return string_param_to_hash(auth_token_string)\n else\n status = result.code\n return nil\n end\n end",
"def get_access_token(code)\n @code = code\n @access_token ||= client.web_server.get_access_token( @code, :redirect_uri => callback_url)\n end",
"def createToken(code)\n makeToken(:authorization_code, :code => code.to_s)\n end",
"def get_token(code, params={}, opts={})\n params = {:type => 'web_server', :code => code}.merge(client_params).merge(params)\n @client.get_token(params, opts)\n end",
"def get_token_code(relationship_hash)\n\n\n response = rest_post_call($INTRODUCTIONS_DOMAIN + '/relationship', nil, relationship_hash.to_json)\n\n #uri = URI.parse($INTRODUCTIONS_DOMAIN)\n #http = Net::HTTP.new(uri.host, uri.port)\n #request = Net::HTTP::Post.new('/relationship', initheader = {'Content-Type' =>'application/json'})\n #request.basic_auth $http_auth_name, $http_auth_password\n #request.body = relationship_hash.to_json\n #response = http.request(request)\n\n #response = rest_post_call($INTRODUCTIONS_DOMAIN + '/relationship', relationship_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed creating relationship: \" + response.body\n end\n\n return JSON.parse(response.body)['token']\n\nend",
"def get_token_from_code(auth_code)\n OUTLOOK_CLIENT.auth_code.get_token(auth_code,\n :redirect_uri => OUTLOOK_REDIRECT_URI,\n :scope => OUTLOOK_SCOPES.join(' '))\n end",
"def request_tokens(auth_code)\n @token = @oauth_client.auth_code.get_token auth_code, redirect_uri: @url\n tokens\n end",
"def request_token\n @token=current_client_application.create_request_token\n if @token\n render :text=>@token.to_query\n else\n render :nothing => true, :status => 401\n end\n end",
"def get_access_token(authz_code = nil)\n if @config.grant_type == 'client_credentials'\n $LOG.i \"getting access token\"\n\t @access_token = @oauth2_client.client_credentials.get_token\n $LOG.i \"got access token\", @access_token\n else\n $LOG.i \"getting access and refresh token pair\"\n\t @access_token = @oauth2_client.auth_code.get_token(authz_code, :redirect_uri => @config.redirect_uri)\n $LOG.i \"got access and refresh token pair\", @access_token\n end\n\n\trefresh_config_from_access_token\n\n\t@access_token\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n # Build our params hash\n params = {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\n end",
"def fetch_token(phone_number)\n client = Tinder::Client.new\n\n # Request a code\n client.request_code(phone_number)\n puts (\"Enter the confirmation code sent to #{phone_number}> \")\n confirmation_code = STDIN.gets.chomp.to_s\n\n # Validate the code and get our 2nd auth factor (refresh token)\n puts \"Validating...\"\n refresh_token = client.validate(phone_number, confirmation_code)\n puts \"Done!\\n\"\n puts \"Your refresh token is #{refresh_token}\\n\"\n\n # Login using the 2nd key\n puts \"Logging in...\"\n api_token = client.login(phone_number, refresh_token)\n puts \"Done!\\n\"\n puts \"Your tinder API token is #{api_token}\\n\"\n api_token\nend",
"def fetch_access_token(code)\n access_token = @oauth.auth_code.get_token(\n code,\n redirect_uri: @redirect_uri\n )\n { gocardless_access_token: access_token.token,\n gocardless_organisation_id: access_token['organisation_id'] }\n end",
"def authorize_code(authorization_code)\n client.authorization.code = authorization_code\n client.authorization.fetch_access_token!\n client.authorization.refresh_token ||= oauth_data[:refresh_token]\n oauth_data[:refresh_token] = client.authorization.refresh_token\n end",
"def create\n\t\tresp = Faraday.get(\"https://foursquare.com/oauth2/access_token\") do |req|\n\t\t\treq.params['client_id'] = ENV['DOHRFWJ4ADKXBXEPFGYU0VMZUWX0135GA3GG1EP0Z5JM0HVS']\n\t\t\treq.params['client_secret'] = ENV['UARMZQVBWT1EHSMRGR52U4TZLEYQISFC0SSBGHUYY3FQ0D1X']\n\t req.params['grant_type'] = 'authorization_code'\n\t req.params['redirect_uri'] = \"http://localhost:3000/auth\"\n req.params['code'] = params[:code]\n end\n\n body = JSON.parse(resp.body)\n session[:token] = body[\"access_token\"]\n redirect_to root_path\n end",
"def create_token\n ong=Ong.find(params[:ong_id])\n initiative=Initiative.find(params[:initiative_id])\n @api = AdwordAuth.create_adwords_api(ong)\n\n token_params=@api.authorize({\n :oauth2_callback => create_token_ong_adword_auths_url(ong)+ \"?initiative_id=#{initiative.id}\" ,\n :oauth2_verification_code => params[:code]\n })\n token_params.delete(:id_token)\n @adword_auth = AdwordAuth.new(token_params)\n @adword_auth.ong=ong\n respond_to do |format|\n if @adword_auth.save\n format.html { \n flash[:auth_adwords] = true\n redirect_to [ong, initiative], notice: 'Autorización Correcta' \n }\n \n else\n format.html { \n flash[:auth_adwords] = false\n redirect_to [ong, initiative], notice: 'Autorización Correcta' \n }\n \n end\n end\n end",
"def receiveAuth\n\t\t##### Get the authorization code that has been sent back from moves api\n\t\t@code = params[:code]\n\t\t\n\t\t##### make a post request to moves api using the authorization code #####\n\t\turi = URI.parse(\"https://api.moves-app.com\")\n\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n\t\trequest = Net::HTTP::Post.new(\"/oauth/v1/access_token?\" + \n\t\t\t\"grant_type=authorization_code&code=\" + @code + \"&client_id=rk4jNeuJ054WTTlYV9l4QF9dYsGdFwdl\" +\n\t\t\t\"&client_secret=gE8sVNO5MQNTX_tKLMoYtfBSu4QVeOco5x9FW_FSq38v0V14K_OKRTo69TSUpvhW\")\n\n\t\t@res = http.request(request)\n\t\t@res = @res.body\n\n\t\t##### extract the tokens from the returned value #####\n\t\t##### these tokens are saved as instance variables #####\n\t\t@access_token = JSON.parse(@res)[\"access_token\"]\n\t\t@refresh_token = JSON.parse(@res)[\"refresh_token\"]\n\t\t\n\t\trender 'patients/new'\n\tend",
"def get_access_token(code:, redirect_uri: nil)\n query = {\n code: code,\n client_id: @client_id,\n client_secret: @client_secret,\n redirect_uri: redirect_uri\n }.compact\n response = HTTParty.get(\"https://slack.com/api/oauth.v2.access\", query: query)\n JSON.parse(response.body, symbolize_names: true)\n end",
"def get_access_tokens(authorization_grant_code)\n # headers = { 'Content-Type': 'application/x-www-form-urlencoded' } # turns out didn't need this\n params = {\n 'grant_type': 'authorization_code',\n 'access_type': 'offline',\n 'code': authorization_grant_code,\n 'client_id': client_id,\n 'redirect_uri': redirect_uri\n }\n response = HTTParty.post(\n 'https://api.tdameritrade.com/v1/oauth2/token',\n body: params\n )\n\n if response.status == 200\n @access_token = response[\"access_token\"]\n @refresh_token = response[\"refresh_token\"]\n end\n\n response\n end",
"def get_token\n begin\n @response = RestClient.post(\n @consumer[:token_request_url],\n client_id: @consumer[:client_id],\n client_secret: @consumer[:client_secret],\n grant_type: @consumer[:grant_type],\n resource: @consumer[:resource]\n )\n\n @consumer[:token] = 'Bearer ' + JSON.parse(@response)['access_token']\n @consumer[:token_expiry] = JSON.parse(@response)['expires_on']\n rescue => error\n puts(\"ERROR - Token Request Failed - #{error}\")\n end\n @consumer[:token]\n end",
"def request_access_token\n # An `OAuth::Consumer` object can make requests to the service on\n # behalf of the client application.\n\n # Ask service for a URL to send the user to so that they may authorize\n # us.\n request_token = CONSUMER.get_request_token\n authorize_url = request_token.authorize_url\n\n # Launchy is a gem that opens a browser tab for us\n Launchy.open(authorize_url)\n\n # Because we don't use a redirect URL; user will receive a short PIN\n # (called a **verifier**) that they can input into the client\n # application. The client asks the service to give them a permanent\n # access token to use.\n puts \"Login, and type your verification code in\"\n oauth_verifier = gets.chomp\n access_token = request_token.get_access_token(\n :oauth_verifier => oauth_verifier\n )\nend",
"def callback\n access_token = client.web_server.get_access_token(params[:code], :redirect_uri => oauth_callback_url)\n \n current_user.update_attribute(:oauth2_token, access_token.token)\n flash[:notice] = \"Authorized successfully!\"\n \n redirect_to root_url\n end",
"def oauth2_token_client_credentials\n @token = Oauth2Token.create :client_application=>@client_application, :user=>@client_application.user, :scope=>params[:scope]\n render :json=>@token\n end",
"def oauth2_token_client_credentials\n @token = Oauth2Token.create :client_application=>@client_application, :user=>@client_application.user, :scope=>params[:scope]\n render :json=>@token\n end",
"def call_token_api(params, clientId, clientSecret)\n return call_api(\"/api/auth/token\", {\n \"parameters\" => URI.encode_www_form(params),\n \"clientId\" => clientId,\n \"clientSecret\" => clientSecret\n })\nend",
"def request_wiz_api_token(client_id, client_secret)\n # Retrieve an OAuth access token to be used against Wiz API\"\n headers = { \"content-type\" => \"application/x-www-form-urlencoded\" }\n payload = \"grant_type=client_credentials&client_id=#{client_id}&client_secret=#{client_secret}&audience=beyond-api\"\n auth_url = \"#{@auth_endpoint}.wiz.io/oauth/token\"\n access_code_call = http_post(auth_url, headers, payload)\n JSON.parse(access_code_call)[\"access_token\"]\n end",
"def token_params(code)\n { client_id: @id,\n grant_type: 'authorization_code',\n redirect_uri: CGI::escape(@redirect_url),\n code: code }\n end",
"def token_url(code)\n params = { :client_id => @id,\n :client_secret => @secret,\n :redirect_uri => @redirect_url,\n :code => code }\n \"#{sk_url}/oauth/token?#{to_url_params(params)}\"\n end",
"def get_access\n path = '/v3/oauth/authorize'\n data = \"consumer_key=#{Consumer_key}&code=#{Token}\"\n return pocket_api(path,data)\nend",
"def fetch_access_token(request_token, verification_code)\n access_token_req = PaypalService::DataTypes::Permissions.create_get_access_token(\n {\n request_token: params[:request_token],\n verification_code: params[:verification_code]\n }\n )\n access_token_res = paypal_permissions.do_request(access_token_req)\n end",
"def callback\n\n client = Signet::OAuth2::Client.new(client_options)\n client.code = params[:code]\n\n response = client.fetch_access_token!\n\n session[:authorization] = response\n redirect_to '/leagues/calendar/events/federicobucci504@gmail.com'\n end",
"def create\n\t\t# when you authorize Foursquare, it send back to /auth with the :code in the params \n\t\tresp = Faraday.get('https://foursquare.com/oauth2/access_token') do |req|\n\t\t\treq.params['client_id'] = ENV['FOURSQUARE_CLIENT_ID']\n\t\t req.params['client_secret'] = ENV['FOURSQUARE_SECRET']\n\t\t req.params['grant_type'] = 'authorization_code'\n\t\t req.params['redirect_uri'] = \"http://localhost:3000/auth\"\n\t\t req.params['code'] = params[:code]\n\t\tend\n\t\tbody = JSON.parse(resp.body)\n\t\tsession[:token] = body[\"access_token\"]\n\t\tredirect_to root_path\n\tend",
"def request(code:, redirect_uri: Keap::REST.redirect_uri)\n body = {\n client_id: Keap::REST.client_id,\n client_secret: Keap::REST.client_secret,\n code: code,\n grant_type: \"authorization_code\",\n redirect_uri: redirect_uri\n }\n\n response = connection.post do |req|\n req.body = body\n end\n\n new(response.body)\n end",
"def oauth2_token_client_credentials\n @token = Oauth2Token.create(:client_application => @client_application, :scope=>params[:scope])\n render :json => @token\n end",
"def build_code_url(params={})\n token.build_code_url(params)\n end",
"def authorize_code(authorization_code)\n api_client.authorization.code = authorization_code\n api_client.authorization.fetch_access_token!\n\n result = api_client.execute!(:api_method => settings.oauth2.userinfo.get)\n user = User.first_or_create(:email => result.data.email)\n api_client.authorization.refresh_token = (api_client.authorization.refresh_token || user.refresh_token)\n if user.refresh_token != api_client.authorization.refresh_token\n user.refresh_token = api_client.authorization.refresh_token\n user.save\n end\n session[:user_id] = user.id\nend",
"def get_with_authorization_code(auth_code, redirect_uri, resource = nil)\n logger.verbose('TokenRequest getting token with authorization code ' \\\n \"#{auth_code}, redirect_uri #{redirect_uri} and \" \\\n \"resource #{resource}.\")\n request(CODE => auth_code,\n GRANT_TYPE => GrantType::AUTHORIZATION_CODE,\n REDIRECT_URI => URI.parse(redirect_uri.to_s),\n RESOURCE => resource)\n end",
"def obtain_token(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/oauth2/token',\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 .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 build_token(access_token)\n return OAuth2::AccessToken.new CLIENT, access_token\n end",
"def get_new_access_token\n client, auth = google_api_client_auth\n print(\"1. Open this page:\\n%s\\n\\n\" % auth.authorization_uri)\n print(\"2. Enter the authorization code shown in the page: \")\n system( 'open \"'+auth.authorization_uri+'\"' )\n auth.code = $stdin.gets.chomp\n auth.fetch_access_token!\n auth.access_token\n end",
"def generate_token\n self.apply_code = \"#{SecureRandom.hex(4)}\"\n self.act_status_type_id = 2\n end",
"def oauth_request(params)\n logger.verbose('Resorting to OAuth to fulfill token request.')\n OAuthRequest.new(@authority.token_endpoint, params)\n end"
] |
[
"0.7482357",
"0.7470306",
"0.73334104",
"0.7279733",
"0.7279112",
"0.7184088",
"0.7152392",
"0.71414405",
"0.7128365",
"0.7109416",
"0.7034843",
"0.7016859",
"0.70067984",
"0.6990521",
"0.6941618",
"0.69037986",
"0.69030356",
"0.68375874",
"0.6817902",
"0.68138623",
"0.6812633",
"0.679778",
"0.6788243",
"0.6786185",
"0.67754215",
"0.6772771",
"0.6763361",
"0.6744931",
"0.67220926",
"0.67099375",
"0.6701872",
"0.6685539",
"0.66562986",
"0.66515684",
"0.6648648",
"0.66367817",
"0.6626363",
"0.6620883",
"0.66059774",
"0.65987676",
"0.659524",
"0.6584736",
"0.65481675",
"0.6546469",
"0.6540656",
"0.6539771",
"0.6539656",
"0.6530976",
"0.6524043",
"0.64844024",
"0.64692605",
"0.6464992",
"0.64636457",
"0.64634806",
"0.6462479",
"0.6449923",
"0.64358914",
"0.64319193",
"0.64099973",
"0.63978684",
"0.639119",
"0.6386905",
"0.63835335",
"0.6368807",
"0.6366388",
"0.6363189",
"0.63507926",
"0.63490975",
"0.6330745",
"0.6324407",
"0.63235235",
"0.631627",
"0.6310536",
"0.6307016",
"0.63030636",
"0.62965894",
"0.62932783",
"0.6278157",
"0.62728965",
"0.62528694",
"0.6238785",
"0.6238785",
"0.62301207",
"0.62297744",
"0.6227487",
"0.6217422",
"0.6212677",
"0.6196443",
"0.6194867",
"0.61909807",
"0.61834973",
"0.6182711",
"0.61750805",
"0.6167785",
"0.6158825",
"0.61565006",
"0.615242",
"0.6150532",
"0.6150268",
"0.6145397"
] |
0.74810106
|
1
|
makes an api call to WePay to check if current access token for farmer is still valid
|
def has_valid_wepay_access_token?
if self.wepay_access_token.nil?
return false
end
response = GemsUsage::Application::WEPAY.call("/user", self.wepay_access_token)
response && response["user_id"] ? true : false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n end\nend",
"def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n #create wepay account\n self.create_wepay_account\n end\nend",
"def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n\t#create WePay account\n self.create_wepay_account\n end\nend",
"def verify_authenticity_token(*args) \n if params[:api_key] && params[:format] == 'xml' \n key = params[:api_key]\n conditions = ['api_key = ? AND (api_key_expires_at < ? OR api_key_expires_at IS NULL)', key, Time.now]\n gateway = Gateway.first(:conditions => conditions) \n raise(ActionController::InvalidAuthenticityToken) unless gateway\n else\n original_verify_authenticity_token(*args) \n end \n end",
"def check_access_token\r\n\t\t\t\ttoken = request.headers[\"X-Access-Token\"] || nil\r\n\t\t\t\t\r\n\t\t\t\tif token\r\n\t\t\t\t\tfind_token = ApiKey.find_by_access_token(token)\r\n\r\n\t\t\t\t\tif find_token.nil?\r\n\t\t\t\t\t\tinvalid_access_token\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\t\tinvalid_access_token\r\n\t\t\t\tend\r\n\t\t\tend",
"def request_wepay_access_token(code, redirect_uri)\n response = GemsUsage::Application::WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n self.create_wepay_account\n end\n end",
"def has_valid_wepay_access_token?\n if self.wepay_access_token.nil?\n return false\n end\n response = WEPAY.call(\"/user\", self.wepay_access_token)\n response && response[\"user_id\"] ? true : false\nend",
"def has_valid_wepay_access_token?\n if self.wepay_access_token.nil?\n return false\n end\n response = WEPAY.call(\"/user\", self.wepay_access_token)\n response && response[\"user_id\"] ? true : false\nend",
"def restrict_access\n authenticate_or_request_with_http_token do | token , options |\n ApiKey.exists?(access_token: token)\n end\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\nend",
"def verify_token\n check_auth_token(request.headers['authtoken'],params[:profile_id])\n end",
"def verify_access_with_api_key\n api_key = request.headers[\"HTTP_API_KEY\"] || params[:api_key]\n andrew_id = request.headers[\"HTTP_ANDREW_ID\"] || params[:andrew_id]\n if (api_key.nil? || andrew_id.nil?)\n render json: {error: \"Error, bad request\"}, status: 400\n elsif !(key_matches?(api_key, andrew_id))\n render json: {error: \"Error, unauthorized user or API key\"}, status: 401\n # Inactive users are not allowed to use their keys for any reason.\n elsif !@cur_user.active\n render json: {error: \"Error, the account associated with this andrew ID has been suspended\"}, status: 401\n end\n end",
"def valid_wepay_access_token?\n return false if no_access_token?\n response = Wefarm::Application::WEPAY.call('/user', wepay_access_token)\n response && response['user_id'] ? true : false\n end",
"def validate_token_hash\n if @token_request_at and\n @token_hash and @token_hash['expires_in'] and\n (Time.now - @token_request_at) > @token_hash['expires_in'].to_i\n @token_hash = nil\n elsif @token_request_at and\n @token_hash and @token_hash['expires_in']\n @token_hash['access_token']\n else\n puts \"start get token ...\"\n end\n end",
"def require_api_token\n end",
"def restrict_access\n\t\tauthenticate_or_request_with_http_token do |token, options|\n\t\t\tapi_token = ApiToken.find_by_access_token(token)\n\t\t\tparam_account = self.get_account\n\t\t\t# Does the api token exist and if so,\n\t\t\t# does it have the same id as the requester supplied?\n\t\t\tapi_token && api_token.account_id == param_account.id\n\t\tend\n\tend",
"def valid_token\n return access_token if access_token && !expiring?\n return access_token if request_access_token\n raise 'No valid access token.'\n end",
"def check_access_token\n @access_token = session[:access_token]\n\n begin\n @client = Octokit::Client.new :access_token => @access_token\n @user = @client.find_user_installations\n rescue => e\n # The token has been revoked, so invalidate the token in the session.\n session[:access_token] = nil\n authenticate!\n end\nend",
"def valid_access_token\n self.access_token_expired? ? self.refresh_access_token! : self.access_token\n end",
"def current_token_still_valid?\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.about.get)\n rescue\n return false\n end\n \n if result.status == 200\n true\n else\n false\n end\n end",
"def authorize!\n api_key = ApiKey.find_by_access_token(params[:access_token])\n head :unauthorized unless api_key\n return false\n end",
"def check_access_token\n @access_token = session[:access_token]\n\n begin\n @client = Octokit::Client.new :access_token => @access_token\n @user = @client.user\n rescue => e\n # The token has been revoked, so invalidate the token in the session.\n session[:access_token] = nil\n authenticate!\n end\nend",
"def valid_access_token\n self.access_token_expired? ? self.refresh_access_token : self.access_token\n end",
"def verify_token!\n client.user\n active! if status == :revoked\n rescue Twitter::Error::Unauthorized\n inactive!\n end",
"def settle\n \n\n if params[\"code\"]\n auth_code = params[\"code\"]\n end \n url = \"https://api.venmo.com/v1/oauth/access_token\"\n @response = HTTParty.post(url, :query => {:client_id => '1916', :client_secret => 'eGcyNHaysfbFGZ6xkMffUw3gGrKFzksG', :code => auth_code})\n user = @response[\"user\"]\n @access_token = @response[\"access_token\"]\n @refresh_token = @response[\"refresh_token\"]\n @email = params[:email]\n @amount = params[:amount]\n \n url = \"https://api.venmo.com/v1/payments\"\n @amount = HTTParty.post(url, :query => { \"access_token\" => @access_token, :email => @email, :amount => @amount, :note => 'PayUp'})\n redirect_to bets_path\n end",
"def complete_buy_token\n status = \"\"\n reason = \"\"\n token = params[:email_token]\n if token\n buyRequests = BuyRequest.where(email_token: token).where(:status => [\"waiting-for-match\", \"completed\"])\n if buyRequests.length > 0\n buyRequests.update_all(status: \"completed\", updated_at: DateTime.now)\n status = \"ok\"\n else\n status = \"Bad request\"\n reason = \"Tampered token. We have alerted the authorities.\"\n response = { :status => status, :reason => reason}\n render json: response\n return\n end\n else\n status = \"Bad request\"\n reason = \"No authentication/token\"\n response = { :status => status, :reason => reason}\n render json: response\n return\n end\n # Old redirect version. We now give them an info page instead.\n #redirect_to \"/my-tix\"\n #return\n end",
"def verify_token\n associate = Associate.where(id: params[:associate_id])[0] if params[:associate_id]\n #checking signed_in user\n if user_signed_in?\n #checking token is nil or not.\n if params[:token].nil?\n #response in json format\n render :json=> { success: false, message: \"Token is required to proceed further.\" },:status=> 203\n return\n elsif associate && associate.associate_user == true\n return true\n #checking token with the current_user\n elsif current_user.authentication_token != params[:token]\n render :json=> { success: false, message: \"Problem with the authentication token.please check token.\" },:status=> 203\n return\n else\n end\n end\n end",
"def valid_token\n access_token = find_or_create_doorkeeper_access_token\n create_doorkeeper_access_token if access_token.expired? || access_token.revoked?\n access_token\n end",
"def update_token\n\trequire 'date'\n\ttil = Time.at(settings.exp) - Time.now\n\tleft = (til/60).to_i\n\tp left\n\tif left < 5\n\t\tres = RestClient.post( \"https://auth.exacttargetapis.com/v1/requestToken\",\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t:clientId => settings.clientId,\n\t\t\t\t\t\t\t\t:clientSecret => settings.clientSecret,\n\t\t\t\t\t\t\t\t:refreshToken => settings.refreshToken,\n\t\t\t\t\t\t\t\t:accessType => \"offline\"\n\t\t\t\t\t\t\t })\n\t\t@res = JSON.parse(res)\n\t\tsettings.oauthToken = @res[\"accessToken\"]\n\t\tsettings.exp = Time.now + @res[\"expiresIn\"]\n\t\tsettings.refreshToken = @res[\"refreshToken\"]\n\tend\t\nend",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end",
"def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end",
"def require_access_token\n # make sure the request has been signed correctly\n verify_signature\n \n # NOTE make sure you define Controller#find_token which\n # returns an object that responds to the access_token? message\n # access_token? should return true if the token object is an AccessToken\n # it should return false if the token object is a RequestToken\n if !current_token.access_token?\n throw :halt, render(invalid_access_token_message, :status => 401, :layout => false)\n end\n end",
"def token_verify\r\n\r\n #render json: {id: params[\"user\"][\"id\"], params: params}\r\n \r\n user_tmp = User.find(params[:id])\r\n if user_tmp.authentication_token == params[:authentication_token]\r\n $granted = true\r\n render json: false\r\n else\r\n \r\n render json: false\r\n end\r\n end",
"def validate_token\n return success if @token.blank?\n\n service_response = UserManagement::DoubleOptIn.new({client: @client, t: @token, user_id: @user_id}).perform\n #TODO: user_token_sale_state should be sent to web.\n return unauthorized_access_response('um_gbd_2') unless service_response.success?\n @user.reload\n\n @account_activated = true if (@user_token_sale_state != @user.get_token_sale_state_page_name &&\n @user_token_sale_state == GlobalConstant::User.get_token_sale_state_page_names(\"verification_page\"))\n\n @user_token_sale_state = @user.get_token_sale_state_page_name\n success\n end",
"def refresh_token\n authorize current_user\n original = current_user.api_token\n current_user.generate_token!\n @success = current_user.api_token != original\n end",
"def request_token\n @token=current_client_application.create_request_token\n if @token\n render :text=>@token.to_query\n else\n render :nothing => true, :status => 401\n end\n end",
"def has_valid_wepay_access_token?\n\t\tif self.wepay_access_token.nil?\n\t\t\treturn false\n\t\tend\n\t\tresponse = Wefarm::Application::WEPAY.call(\"/user\", self.wepay_access_token)\n\t\tresponse && response[\"user_id\"] ? true : false\n\tend",
"def valid_token\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['valid_token']) do\n if ![\"facebook\"].include?(params[:provider]) # using include? allows us to do this for twitter/tumblr in the future\n return render_error(404, \"this route only currently supports facebook as a provider.\")\n end\n\n if auth = current_user.first_provider(params[:provider]) and auth.is_a? Authentication\n @token_valid = GT::UserFacebookManager.verify_auth(auth.oauth_token)\n @status = 200\n else\n return render_error(404, \"This user does not have a #{params[:provider]} authentication to check on\")\n end\n end\n end",
"def verify_access_token\n Rails.logger.debug \"====== request.headers['Authorization'] = #{request.headers['Authorization']} ======\"\n\n server = AuthorizationServer.new(Application.authorization_server,\n Application.resource_server)\n\n result, @authorized_user = server.authorize_request(request)\n Rails.logger.debug \"------ authorized_user = #{@authorized_user.inspect} ------\"\n\n # If the result is OK, proceed with the operation\n head result unless result == :ok\n end",
"def check_token\n @usuario = Credentials.check_token(authorization: request.headers[\"Authorization\"])\n end",
"def validate_bearer_token(bearer_token)\n end",
"def valid_bitlyv2_tokens?(client_id, client_secret)\n client = Signet::OAuth2::Client.new({\n :token_credential_uri => 'https://api-ssl.bitly.com/oauth/access_token',\n :client_id => client_id,\n :client_secret => client_secret,\n :username => client_id, # bad\n :password => client_secret # bad\n })\n begin\n client.fetch_access_token!\n rescue Signet::AuthorizationError => ex\n case ex.response.body\n when \"INVALID_LOGIN\" then true\n when \"RATE_LIMIT_EXCEEDED\" then true\n when \"INVALID_CLIENT_ID\" then false\n when \"INVALID_CLIENT_SECRET\" then false\n else\n #Rails.logger.info ex.response.body\n #Rails.logger.info \" ^^ while processing #{client_id}, #{client_secret}\"\n false\n end\n end\nend",
"def restrict_access\n api_key = ApiKey.find_by_access_token(request.headers[\"token\"])\n head :unauthorized unless api_key \n end",
"def verify_access_token\n if bypass_auth?\n true\n else\n authenticate_or_request_with_http_token do |token, opts|\n current_user && token && current_user.access_token.token == token\n end\n end\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n ApiKey.exists?(access_token: token)\n end\n end",
"def verify_key\n\t\t\tunless (Happyfunrun::app_id==params[:app_id] and Happyfunrun::api_key==params[:api_key])\n\t\t\t\trender :json=>{:status=>'300', :error=>'Access Denied'}\n\t\t\t\treturn\n\t\t\tend\n\t\tend",
"def request_wepay_access_token(code, redirect_uri)\n\t response = WEPAY.oauth2_token(code, redirect_uri)\n\t if response['error']\n\t raise \"Error - \"+ response['error_description']\n\t elsif !response['access_token']\n\t raise \"Error requesting access from WePay\"\n\t else\n\t \tputs \"need to get access token\"\n\t \tputs response['access_token']\n\t # self.wepay_access_token = response['access_token']\n\t # self.save\n\t self.update_columns(wepay_access_token: response['access_token'])\n\n\t\t#create WePay account\n\t self.create_wepay_account\n\t end\n\tend",
"def check_auth_token\n token = decoded_auth_token\n render json: { error: 'Not Authorized' }, status: :unauthorized unless token\n end",
"def call\n api_key = ApiKey.find_by(access_token: @expired_token)\n\n if api_key.present?\n api_key.refresh\n api_key.save\n\n {\n token: api_key.access_token\n }\n else\n raise ExceptionService.new('Invalid Token.')\n end\n end",
"def valid_token?\n\t\tif self.moves_token.presence\n\t\t\tresponse = HTTParty.get('https://api.moves-app.com/oauth/v1/tokeninfo?access_token='+\n\t\t\t\tself.moves_token)\n\t\t\tputs \"response.code: #{response.code}\"\n\t\t\tresponse.code == 200\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def check_access_token(access_token)\n client = Octokit::Client.new(client_id: CLIENT_ID, client_secret: CLIENT_SECRET)\n begin\n client.check_application_authorization access_token\n true\n rescue\n false\n end\n end",
"def client_has_valid_token?\n request.headers[\"Authorization\"] == Rails.application.credentials.guessing_access_token\n end",
"def verify_bearer\n if expired?(@bearer_info[:expire_time])\n @bearer_info = new_bearer(@bearer_info)\n @bearer_token = @bearer_info[:token]\n end\n end",
"def request_wepay_access_token(code, redirect_uri)\n\t\t#response = Wefarm::Application::WEPAY.oauth2_token(code, OAUTH_REDIRECT_URI + self.id.to_s)\n\t\tresponse = Wefarm::Application::WEPAY.oauth2_token(code, redirect_uri)\n\t\tif response['error']\n\t\t\traise \"Error - \"+ response['error_description']\n\t\telsif !response['access_token']\n\t\t raise \"Error requesting access from WePay\"\n\t\telse\n\t\t\tself.wepay_access_token = response['access_token']\n\t\t\tself.save\n\t\t\t\n\t\t\t#create WePay account\n\t\t\tself.create_wepay_account\n\t\tend\n\tend",
"def valid_access_token\n\t\t\t\t# The token we have stored is expired - fetch a new one using the refresh token\n\t\t\t\tself.refresh_access_token if self.access_token_expired?\n\n\t\t\t\tself.access_token\n\t\t\tend",
"def oauth_required\n invalid_oauth_response and return false unless current_token\n end",
"def request_wepay_access_token(code, redirect_uri)\n response = Wefarm::Application::WEPAY.oauth2_token(code, redirect_uri)\n raise 'Error - ' + response['error_description'] if response['error']\n raise 'Error requesting access from WePay' unless response['access_token']\n self.wepay_access_token = response['access_token']\n save\n create_wepay_account\n end",
"def do_token(params, clientId, clientSecret)\n # Call Authlete's /auth/token API.\n response = call_token_api(params, clientId, clientSecret)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INVALID_CLIENT\"\n # 401 Unauthorized\n # Client authentication failed.\n return WebResponse.new(401, content).json\\\n .wwwAuthenticate(\"Basic realm=\\\"/token\\\"\").to_response\n\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # The token request from the client was wrong.\n return WebResponse.new(400, content).json.to_response\n\n when \"PASSWORD\"\n # Process the token request whose flow is\n # \"Resource Owner Password Credentials\".\n return handle_password(response)\n\n when \"OK\"\n # 200 OK\n # The token request from the client was valid. An access\n # token is issued to the client application.\n return WebResponse.new(200, content).json.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend",
"def check_app_token(client_id, client_secret, grant_type)\n e = false\n\n if Settings.multi_application == 'true'\n app = App.where(id: params[:client_id]).first\n if app.nil?\n e = true\n error = {\n error: 'server_error',\n error_description: 'App not found'\n }\n render json: error.to_json, status: 400\n else\n if grant_type == 'password' and !app.enable_password\n e = true\n error = {\n error: 'unauthorized_client',\n error_description: 'Password grant not allowed'\n }\n render json: error.to_json, status: 400\n elsif grant_type == 'refresh_token'\n if !app.enable_code and !app.enable_implicit\n e = true\n error = {\n error: 'unauthorized_client',\n error_description: 'Client grant not allowed'\n }\n render json: error.to_json, status: 400\n elsif !app.password_correct?(client_secret)\n e = true\n error = {\n error: 'server_error',\n error_description: 'wrong secret'\n }\n render json: error.to_json, status: 400\n end\n elsif grant_type == 'authorization_code' and !app.enable_code\n e = true\n error = {\n error: 'unauthorized_client',\n error_description: 'Client grant not allowed'\n }\n render json: error.to_json, status: 400\n elsif grant_type == 'authorization_code' and !app.password_correct?(client_secret)\n e = true\n error = {\n error: 'server_error',\n error_description: 'wrong secret'\n }\n render json: error.to_json, status: 400\n end\n end\n else\n if Settings.single_application_mode_id != client_id\n e = true\n error = {\n error: 'server_error',\n error_description: 'App not found'\n }\n render json: error.to_json, status: 400\n else\n if Settings.single_application_mode_enable_password == 'false' and grant_type == 'password'\n e = true\n error = {\n error: 'unauthorized_client',\n error_description: 'Password grant not allowed'\n }\n render json: error.to_json, status: 400\n elsif grant_type == 'refresh_token'\n if Settings.single_application_mode_enable_code == 'false' or Settings.single_application_mode_enable_implicit == 'false'\n e = true\n error = {\n error: 'unauthorized_client',\n error_description: 'Client grant not allowed'\n }\n render json: error.to_json, status: 400\n elsif Settings.single_application_mode_secret != client_secret\n e = true\n error = {\n error: 'server_error',\n error_description: 'wrong secret'\n }\n render json: error.to_json, status: 400\n end\n elsif grant_type == 'authorization_code'\n if Settings.single_application_mode_enable_code == 'false'\n e = true\n error = {\n error: 'unauthorized_client',\n error_description: 'Client grant not allowed'\n }\n render json: error.to_json, status: 400\n elsif Settings.single_application_mode_secret != client_secret\n e = true\n error = {\n error: 'server_error',\n error_description: 'wrong secret'\n }\n render json: error.to_json, status: 400\n end\n\n end\n\n end\n end\n destroy_session if e\n\n e\n\n end",
"def valid_to_proceed?\r\n decoded_auth_token.present? && decoded_auth_token[:user_id].present? && valid_token?\r\n end",
"def authorize_net_valid(options)\n transaction = AuthorizeNet::AIM::Transaction.new($api_login, $api_key, :gateway => $gateway.to_s.to_sym,\n :encapsulation_character => \"|\",\n :allow_split => true)\n\n # Find a state\n if params[:state].blank?\n state = \"--\"\n else\n state = State.find_by_state(options[:state]).state_abbr\n end \n\n # Add address to request\n address = AuthorizeNet::Address.new(:first_name => options[:first_name],\n :last_name => options[:last_name],\n :street_address => options[:address],\n :city => options[:city],\n :state => state,\n :zip => options[:zip],\n :country => options[:country])\n transaction.set_address(address)\n\n # Convert a date expired\n expired_date = params[:expires_date_months].[](0..1).strip.concat(params[:expires_date_years].[](2..3))\n if expired_date.length == 3\n expired_date = \"0\".concat(expired_date)\n end\n\n # Add credit card to request\n credit_card = AuthorizeNet::CreditCard.new(options[:cc_number], expired_date, :card_code => options[:cvv])\n # Execute a request\n response = transaction.authorize(0.0, credit_card)\n\n # Get a result of request\n @authorize_transaction_id = response.transaction_id\n #@authorize_gateway = transaction.gateway\n @authorize_gateway = response.raw.body\n @authorize_code = response.authorization_code\n @response_code = response.response_code\n @response_reason_code = response.response_reason_code\n\n # Generate user message\n if @response_code.to_i == 1 && @response_reason_code.to_i == 1\n user_message = \"Billing information changed\"\n else\n user_message = get_user_message(@response_code, @response_reason_code)\n end\n\n unless response.success?\n # Card is invalid(authorize.net)\n flash[:error_card] = 'Can\\'t authorize credit card'\n\n # Block in session\n block_ip_in_session\n\n # Add transaction\n add_transaction(:i_account => @account.i_account, \n :type => \"payment_refund\",\n :transaction_id => @authorize_transaction_id,\n :gw_string => @authorize_gateway,\n :user_message => user_message,\n :ip => request.remote_ip.to_s,\n :authorization_code => @authorize_code)\n \n false\n else\n true\n end\n end",
"def verify_access_token\n debugger\n @user = User.find_by(access_token: params[:session][:access_token])\n if @user\n render text: \"verified\", status: 200\n else\n render text: \"Token failed verification\", status: 422\n end\n end",
"def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end",
"def verify(token)\n request = verify_request(token)\n response = PaybywayConnector.check_payment_status(request).parsed_response\n response['result'] == 0\n end",
"def valid?\n core_client.api_valid?\n end",
"def check_token\n end",
"def restrict_access\n api_key = APIKey.find_by(access_token: params[:access_token])\n render plain: \"You aren't authorized, buster!\", status: 401 unless api_key\n end",
"def is_access_token_valid?\n response = @client.get(\"#{@base_url}/v1/users/self\", access_token: get_user_access_token )\n code_status = JSON.parse(response.body)[\"meta\"][\"code\"]\n code_status == 200 ? true : false\n end",
"def restrict_access\n\t\t# api_key = ApiKey.find_by_access_token(params[:access_token])\n\t\t# head :unauthorized unless api_key\n\n\t\tauthenticate_or_request_with_http_token do |token, options|\n\t\t\tApiKey.exists?(:access_token => token)\n\t\tend\n\tend",
"def is_authorized?\n !!token && !token.expired?\n end",
"def is_authorized?\n !!token && !token.expired?\n end",
"def verify_access_token\n \tuser = User.find_by(auth_token: params[:session][:auth_token])\n\n \tif user\n \t\trender text: \"verified\", status: 200\n \telse\n \t\trender text: \"Invalid token\", status: 422\n \tend\n end",
"def validate_authorize_token (auth_token, allow_visitor_changes = true, *scopes_required)\r\n\t\treturn {status: :bad_request} if(auth_token.blank? or auth_token[0]['vis'].blank?)\r\n\t\t\r\n\t\t$visitor = DT_Visitor.new(request.remote_ip) if($visitor.nil?)\r\n\t\t$visitor.browser = Browser.new(request.env['HTTP_USER_AGENT'])\r\n\t\t\r\n\t\tvis_mobi = (($visitor.browser_portable?) ? 1 : 0)\r\n\t\tvis_bver = $visitor.browser_version.to_i\r\n\t\ttoken_vis_bver = auth_token[0]['vis']['bver'].to_i\r\n\n\t\t# Truncated......\n\n\t\treturn {status: :ok, auth_token: auth_token}\r\n\tend",
"def verify_auth_token\n halt 401 unless valid_user?(extracted_token)\n end",
"def valid_token?(token)\n return false unless !token.nil? && token_looks_safe?(token)\n result = ApiToken.find_by(token: token)\n !result.nil? && result[:active]\n end",
"def verify_access_token\n user = User.find_by(access_token: params[:session][:access_token])\n if user\n render json: user, status: :ok\n else\n render json: 'Token failed verification', status: :unprocessable_entity\n end\n end",
"def check_response_and_refresh_token(response)\n if response.code == 200\n data = JSON.parse(response.body)\n set_auth_sessions(data)\n data[\"data\"]\n else\n { message: \"Some error occured please contact the administrator\" }\n end\n end",
"def api_response(redirect_uri)\n redirect_to_url = self.build_url(redirect_uri,\"token\") \n self.refresh_access_token if self.expired? \n return redirect_to_url\n end",
"def restrict_access\n # check if the request has an API key as part of it...\n end",
"def developer_key_authentication\n authenticate_or_request_with_http_token do |token|\n Api.exists?(key: token)\n end\n end",
"def check_token\n input_token = request.headers['X-Auth-Token'] || params[:token]\n return unless input_token\n\n token = AuthenticationToken.find_by(token: input_token)\n return unless token\n\n # Count token usage\n token.inc(number_of_use: 1)\n # Update the updated_at because inc doesn't do it\n token.set(updated_at: Time.now.getlocal)\n\n # Sign in\n sign_in token.user\n end",
"def first_attempt_request(&block)\n resp = block.call\n resp unless invalid_access_token_response?(resp)\n end",
"def call_token_api(params, clientId, clientSecret)\n return call_api(\"/api/auth/token\", {\n \"parameters\" => URI.encode_www_form(params),\n \"clientId\" => clientId,\n \"clientSecret\" => clientSecret\n })\nend",
"def valid_access_token?\n token_file = '/opt/gluu-server/etc/certs/api_token.json'\n return false unless File.exist? token_file\n\n token_config = JSON.parse(File.read(token_file))\n expired = token_config['exp'] < Time.now.to_i\n return false if expired\n\n return false unless token_config['token']\n\n true\n end",
"def verify\n incoming_token = ActiveSupport::JSON.decode(request.body.read)\n session = Session.where(nightcrew_token: incoming_token).first\n response = { valid: false }\n response[:valid] = true if session\n render :json => ActiveSupport::JSON.encode(response)\n end",
"def has_valid_wepay_access_token?\n\t if self.wepay_access_token.nil?\n\t return false\n\t end\n\t response = WEPAY.call(\"/user\", self.wepay_access_token)\n\t response && response[\"user_id\"] ? true : false\n\tend",
"def valid_token?\r\n token = ::AuthToken.where(user_id: decoded_auth_token[:user_id]).newer.first\r\n token&.token == auth_token && token.expire_at >= Time.now if token.present?\r\n end",
"def refresh_token_if_needed\n token_timestamp = decoded_jwt['exp']\n current_timestamp = DateTime.now.to_i\n return unless token_timestamp - current_timestamp <= 0\n\n refresh_token\n end",
"def check_token(token)\n params = \"token=#{token}&md5=#{Ivona::GetMd5.formula(token)}\"\n HTTParty.get(\"#{BASE_URL}/tokens?#{params}\")\n end",
"def restrict_access\n unless App.exists?(key: params[:access_token])\n render json: { error: \"API-key invalid. Access denied.\" }, status: :unauthorized\n end\n end",
"def get_access\n path = '/v3/oauth/authorize'\n data = \"consumer_key=#{Consumer_key}&code=#{Token}\"\n return pocket_api(path,data)\nend",
"def access_token_was_refreshed; end",
"def valid_app_access_token?\n app_access_token = request.headers['X-App-Access-Token']\n\n app_access_token.present? &&\n app_access_token == Rails.application.secrets.app_access_token\n end",
"def cannot_access_api?\n !request.env[\"REQUEST_METHOD\"].eql?(\"GET\") &&\n !request.headers['mw-token'].eql?(ENV[\"api_access_token\"])\n end",
"def validate_token\n\n @manager = CacheManagement::Manager.new([@manager_id]).fetch[@manager_id]\n @manager_s = CacheManagement::ManagerSecure.new([@manager_id]).fetch[@manager_id]\n\n return unauthorized_access_response('am_vc_5') unless @manager.present? &&\n (@manager[:status] == GlobalConstant::Manager.active_status)\n\n return unauthorized_access_response('am_vc_10') if token_s.blank?\n\n @manager_device = CacheManagement::ManagerDeviceById.new([@manager_device_id]).fetch[@manager_device_id]\n\n return unauthorized_access_response('am_vc_13') if @manager_device.nil?\n\n @fingerprint = @manager_device[:fingerprint]\n\n evaluated_token = Manager.get_cookie_token(\n manager_id: @manager_id,\n current_client_id: @manager[:current_client_id],\n token_s: token_s,\n browser_user_agent: @browser_user_agent,\n manager_device_id: @manager_device_id,\n fingerprint: @fingerprint,\n last_session_updated_at: @manager_s[:last_session_updated_at],\n cookie_creation_time: @created_ts,\n auth_level: auth_level\n )\n\n return unauthorized_access_response('am_vc_6') unless (evaluated_token == @token)\n\n success\n\n end",
"def check_api_key_auth\n User.current = User.find_by_api_key(params[:key])\n unless User.current\n render :text => \"Not Authorized\", :status => 403\n return\n end\n end",
"def access_token_expired?\n Time.zone.now >= self.expires_at\n end",
"def access_token_expired?\n Time.zone.now >= self.expires_at\n end",
"def has_token?\n api.has_token?\n end"
] |
[
"0.7140138",
"0.7067149",
"0.6779129",
"0.6745647",
"0.67225766",
"0.6720021",
"0.6677144",
"0.6677144",
"0.66480213",
"0.6634246",
"0.6632952",
"0.6610832",
"0.65765285",
"0.6564849",
"0.65591305",
"0.65376264",
"0.65329546",
"0.6513627",
"0.6455548",
"0.6454063",
"0.64416516",
"0.643236",
"0.64170134",
"0.6369513",
"0.6349131",
"0.6333522",
"0.6321735",
"0.63015616",
"0.62750167",
"0.6273128",
"0.6267017",
"0.6266755",
"0.6261354",
"0.625415",
"0.62481016",
"0.6226767",
"0.6221003",
"0.6219143",
"0.62108773",
"0.6208395",
"0.6201983",
"0.6201211",
"0.6197882",
"0.61977977",
"0.6188026",
"0.6188026",
"0.61823356",
"0.6180859",
"0.61697495",
"0.6159538",
"0.61557186",
"0.6152661",
"0.61507905",
"0.6116449",
"0.6100924",
"0.6100161",
"0.60886157",
"0.6086098",
"0.6071239",
"0.6069385",
"0.6067017",
"0.606657",
"0.60602605",
"0.6060147",
"0.6050443",
"0.60382783",
"0.602325",
"0.60160977",
"0.6015322",
"0.60130185",
"0.59956497",
"0.59956497",
"0.599344",
"0.59831554",
"0.59824795",
"0.5980165",
"0.59779346",
"0.5977042",
"0.59768176",
"0.59722555",
"0.5971951",
"0.5969698",
"0.59647423",
"0.596437",
"0.59633404",
"0.59552014",
"0.5954201",
"0.5953798",
"0.5951065",
"0.5943317",
"0.5943203",
"0.5938607",
"0.593687",
"0.59314036",
"0.59254724",
"0.59181553",
"0.5913084",
"0.59116733",
"0.59116733",
"0.59097695"
] |
0.6814433
|
2
|
creates a WePay account for this farmer with the farm's name
|
def create_wepay_account
if self.has_wepay_access_token? && !self.has_wepay_account?
params = { :name => self.name, :description => "Event - " + self.name }
response = GemsUsage::Application::WEPAY.call("/account/create", self.wepay_access_token, params)
if response["account_id"]
self.wepay_account_id = response["account_id"]
return self.save
else
raise "Error - " + response["error_description"]
end
end
raise "Error - cannot create WePay account"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_wepay_account\n raise 'Error - cannot create WePay account' unless wepay_access_token? && !wepay_account?\n params = { name: farm, description: 'Farm selling ' + produce }\n response = Wefarm::Application::WEPAY.call('/account/create', wepay_access_token, params)\n\n raise 'Error - ' + response['error_description'] unless response['account_id']\n self.wepay_account_id = response['account_id']\n save\n end",
"def create_wepay_account\n\t\tif self.has_wepay_access_token? && !self.has_wepay_account?\n\t\t\tparams = {:name => self.farm, :description => \"Farm selling \" + self.produce }\n\t\t\tresponse = Wefarm::Application::WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\t\t\t\n\t\t\tif response[\"account_id\"]\n\t\t\t\tself.wepay_account_id = response[\"account_id\"]\n\t\t\t\treturn self.save\n\t\t\telse\n\t\t\t raise \"Error - \" + response[\"error_description\"]\n\t\t\tend\n\t \n\t\tend\t\t\n\t\traise \"Error - cannot create WePay account\"\n\tend",
"def create_wepay_account\n\t if self.has_wepay_access_token? && !self.has_wepay_account?\n\t params = { :name => self.name, :description => \"Selling goods on Tradies \" }\t\t\t\n\t response = WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\n\t if response[\"account_id\"]\n\t \tputs \"need to get account_id\"\n\t \t\t# puts response['account_id']\n\t # self.wepay_account_id = response[\"account_id\"]\n\t return self.update_columns(wepay_account_id: response['account_id'])\n\t else\n\t raise \"Error - \" + response[\"error_description\"]\n\t end\n\n\t end\t\t\n\t raise \"Error - cannot create WePay account\"\n\tend",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def create_wepay_account\n # if we don't have an access_token for this user, then we cannot make this call\n if self.has_wepay_account? then return false end\n # make the /account/create call\n response = WEPAY.call(\"/account/create\", self.wepay_access_token, {\n name: self.campaign.name,\n description: self.campaign.description,\n type: self.campaign.account_type,\n country: self.country,\n currencies: [ self.currency ],\n })\n if response['error'].present?\n raise response['error_description']\n end\n self.wepay_account_id = response['account_id']\n self.save\n end",
"def create_wepay_account\n if self.has_wepay_access_token? && !self.has_wepay_account?\n params = { :name => self.name, :description => \" User donate \" + self.donate_amount.to_s } \n response = WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\n if response[\"account_id\"]\n self.wepay_account_id = response[\"account_id\"]\n return self.save\n else\n raise \"Error - \" + response[\"error_description\"]\n end\n\n end \n raise \"Error - cannot create WePay account\"\nend",
"def create_merchant email_address, merchant, bank_account_uri=nil, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :merchant => merchant,\n :bank_account_uri => bank_account_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end",
"def create_wepay_account\n if self.has_wepay_access_token? && !self.has_wepay_account?\n params = { :name => self.name, :description => self.description }\n response = WEPAY.call(\"/account/create\", self.wepay_access_token, params)\n\n if response[\"account_id\"]\n self.wepay_account_id = response[\"account_id\"]\n return self.save\n else\n raise \"Error - \" + response[\"error_description\"]\n end\n\n end\nraise \"Error - cannot create WePay account\"\nend",
"def new_account(name)\n account(name)\n end",
"def create_merchant email_address, merchant, bank_account_uri=nil, name=nil, meta={}\n account_attributes = {\n :uri => self.accounts_uri,\n :email_address => email_address,\n :bank_account_uri => bank_account_uri,\n :name => name,\n :meta => meta,\n }\n\n if merchant.respond_to? :keys\n account_attributes[:merchant] = merchant\n else\n account_attributes[:merchant_uri] = merchant\n end\n\n account = Account.new account_attributes\n account.save\n end",
"def create_buyer email_address, card_uri, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :card_uri => card_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end",
"def create_buyer email_address, card_uri, name=nil, meta={}\n account = Account.new(\n :uri => self.accounts_uri,\n :email_address => email_address,\n :card_uri => card_uri,\n :name => name,\n :meta => meta,\n )\n account.save\n end",
"def create_account\n\n end",
"def create_account(lead)\n Account.create({\n company_id: lead.company_id,\n user_id: lead.user_id\n })\n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def create_account(account_name)\r\n\t\taccount = Account.new\r\n\t\taccount.name = account_name\r\n\t\taccount.user = self\r\n\r\n\t\tif account.valid?\r\n\t\t\taccount.save\r\n\t\t\treload\r\n\t\tend\r\n\r\n\t\treturn account\r\n\tend",
"def create_account(name=nil)\n if(owned_accounts.empty?)\n if(default_identity)\n source = Source.find_or_create(:name => default_identity.provider)\n elsif(run_state.identity_provider)\n source = Source.find_or_create(:name => run_state.identity_provider)\n else\n source = Source.find_or_create(:name => 'internal')\n end\n add_owned_account(\n :name => name || username,\n :source_id => source.id\n )\n end\n end",
"def create_merchant(opts = {})\n name = opts[:name]\n return false unless name.is_a? String\n merchant_id = @merchants.insert(\n name: name,\n )\n return @merchants.where(id: merchant_id)\n end",
"def create_account_card\n tmp = Card.create! name: \"Company+scratch\"\n tmp.update! name: \"Company+*account\"\n end",
"def generate_account\n self.account = Account.create(:name => self.email) unless account\n end",
"def create(customer_id, wallet)\n\t\t\t\tJuspayCheckout::ExpressCheckout.request(\"/customers/#{customer_id}/wallets\", 'post', {command: \"authenticate\", gateway: wallet})\n\t\t\tend",
"def create_firm_and_address(firm)\n new_firm = Firm.create_with_addresses(firm)\nend",
"def create(body = {})\n @client.account.create(body)\n end",
"def create_tenant!\n Apartment::Tenant.create(tenant_name) unless tenant_name.blank?\n end",
"def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end",
"def create\n # if the user is signed in, just use that user\n if signed_in?\n @user = current_user\n @user.add_role(User::ROLE_MERCHANT)\n @user.save\n else # otherwise register a user from the information provided\n if !params[:accept_terms]\n error(\"You must accept WePay's terms of service.\")\n return redirect_to(\"/campaign/new\")\n end\n if params[:checkout] == \"Custom Checkout\"\n checkout_method = \"custom\"\n elsif params[:checkout] == \"iFrame Checkout\"\n checkout_method = \"iframe\"\n end\n @user = User.new({:name => params[:user_name], :email => params[:user_email], :checkout_method => checkout_method, :country => params[:country]})\n @user.add_role(User::ROLE_MERCHANT)\n @user.password = params[:user_password]\n if @user.valid? && @user.save\n sign_in(@user)\n else\n error(@user.errors.full_messages)\n return redirect_to(\"/campaign/new\")\n end\n end\n # create the campaign from the details provided\n @campaign = Campaign.new({\n user_id: @user.id,\n name: params[:campaign_name],\n description: params[:campaign_description],\n goal: params[:campaign_goal],\n account_type: params[:account_type]\n })\n if @campaign.valid? && @campaign.save\n # if the campaign is valid, register the user on WePay and create a WePay account for it\n @user.register_on_wepay(request.ip, request.env['HTTP_USER_AGENT'])\n @user.create_wepay_account\n @user.resend_confirmation_email\n message(\"Your campaign has been created successfully!\")\n if params[:enable_mfa]\n @user.wants_MFA_enabled = true\n @user.save\n redirect_to(\"/mfa/register/#{@user.id}\")\n\n else\n redirect_to(\"/campaign/details/#{@campaign.id}\")\n end\n\n else\n error(@campaign.errors.full_messages)\n return redirect_to(\"/campaign/new\")\n end\n end",
"def create_account\n if new_record? && !self.account_id\n account = Account.new\n account.name = \"Preecha o nome da sua empresa\"\n account.save\n self.account_id = account.id\n self.admin = true\n end\n end",
"def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n account.switch do\n create_defaults\n fillin_translations\n add_initial_users\n schedule_recurring_jobs\n true\n end\n end\n end",
"def create\n @user = User.find_by(id: payment_params[:user_id])\n # puts @user.name\n if (@user)\n #set user entered params\n @payment = Payment.new\n @payment.user_id = payment_params[:user_id]\n @payment.routing_number = payment_params[:routing_number]\n @payment.account_number = payment_params[:account_number]\n @payment.account_name = payment_params[:account_name]\n if (payment_params[:account_type] != \"checking\" && payment_params[:account_type] != \"savings\")\n @payment.account_type = \"checking\"\n else\n @payment.account_type = payment_params[:account_type]\n end\n\n #set dwolla generated params\n @payment.customer = Payment.create_dwolla_customer(@user)\n @payment.funding_source = Payment.link_funding_source(@payment)\n Payment.verify_customer(@payment.funding_source)\n\n if @payment.save\n render :show, status: :created, location: @payment\n else\n render json: @payment.errors, status: :unprocessable_entity\n end \n\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.zip = Account.random_zip\n @account.user_id = @current_user.id if @current_user\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_account\n account = Account.create(name: \"#{full_name}'s Portfolio\")\n account.collaborators << self\n end",
"def create_gen1_account(name) \n\n account_create = {\n \"location\"=> \"centralus\",\n \"tags\"=> {\n \"test_key\"=> \"test_value\"\n },\n \"identity\"=> {\n \"type\"=> \"SystemAssigned\"\n },\n \"properties\"=> {\n \"encryptionState\"=> \"Enabled\",\n \"encryptionConfig\"=> {\n \"type\"=> \"ServiceManaged\",\n },\n \"firewallState\"=> \"Disabled\",\n \"firewallRules\"=> [\n \n ],\n \"trustedIdProviderState\"=> \"Disabled\",\n \"trustedIdProviders\"=> [\n \n ],\n \n \"newTier\"=> \"Consumption\",\n \"firewallAllowAzureIps\"=> \"Enabled\"\n }\n }\n\n response = HTTParty.put(\"https://management.azure.com/subscriptions/#{subscriptionId}/resourceGroups/#{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/#{name}?api-version=2016-11-01\", {\n\n body: account_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Content-Type\" => 'application/json', \n \"Accept\" => '*/*',\n \"Cache-Control\" => 'no-cache',\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n \n verify: true,\n })\n\n return JSON.parse response.read_body\n end",
"def create_accounts\n end",
"def create_basic_account(http, account_name, identity_card)\n begin\n response = http.post 'Create a new account', \"#{SERVER}/accounts\", {\n 'lineId' => 1,\n 'username' => account_name,\n 'password' => account_name,\n 'email' => \"#{account_name}@lvs.co.uk\",\n 'countryCode' => 'IL',\n 'currencyCode' => 'ILS',\n 'online' => true,\n 'status' => 'open',\n 'identityCardNumber'=> identity_card\n }\n account_id = JSON.parse(response.body)['id']\n account_uri = response.headers[:location]\n \n response = http.post 'Create a new transaction', \"#{SERVER}/accounts/#{account_id}/transactions\", {\n 'transactionSubType' => 'CREDIT_CARD',\n 'transactionType' => 'PAYMENTRECEIPT',\n 'accountId' => account_id,\n 'credit' => '10000',\n 'description' => 'Payment via REST API',\n }\n return account_id, account_uri\n end\nend",
"def create(fighter, bomber)\n @fighter = fighter\n @bomber = bomber\n end",
"def create_provider_account\n provider_account = FactoryBot.create(:provider_with_billing)\n\n provider_account.gateway_setting.attributes = {\n gateway_type: :authorize_net,\n gateway_settings: { login: 'foo', password: 'bar' }\n } # to prevent ActiveRecord::RecordInvalid since the payment gateway has been deprecated\n provider_account.gateway_setting.save!(validate: false) # We cannot use update_columns with Oracle\n\n plan = FactoryBot.create(:application_plan, :issuer => provider_account.default_service)\n\n [provider_account, plan]\n end",
"def create_wallet\n\t\tid = self.uuid.generate\n\t\tself.wallets.add( id )\n\t\treturn id\n\tend",
"def create\n outcome = Merchants::Create.run(merchant_params)\n\n # Then check to see if it worked:\n if outcome.success?\n render_success_response({ merchant: outcome.result })\n else\n render_unprocessable_entity(outcome.errors.symbolic)\n end\n end",
"def setup_new_bank_account(bank_code, credentials, country = 'de', options = {})\n data = { \"bank_code\" => bank_code,\n \"country\" => country,\n \"credentials\" => credentials\n }\n data = data.merge(options)\n query_api \"/rest/accounts\", data, \"POST\"\n end",
"def create_account(account_number)\n begin\n #if account does not exist, a NotFound Error will be thrown\n accountNumber = account_number\n\n puts \"Creating new account with account number: #{accountNumber}\"\n\n account = Recurly::Account.create(\n :account_code => accountNumber,\n :email => 'verena@example.com',\n :first_name => 'Verena',\n :last_name => 'Example',\n :shipping_addresses => [\n {\n :nickname => 'Work',\n :first_name => 'Verena',\n :last_name => 'Example',\n :company => 'Recurly Inc',\n :phone => '555-222-1212',\n :email => 'verena@example.com',\n :address1 => '123 Main St.',\n :address2 => 'Suite 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n },\n {\n :nickname => 'Home',\n :first_name => 'Verena',\n :last_name => 'Example',\n :phone => '555-867-5309',\n :email => 'verena@example.com',\n :address1 => '123 Fourth St.',\n :address2 => 'Apt. 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n }\n ]\n )\n\n account = Recurly::Account.find(accountNumber)\n account.billing_info = {\n :first_name => 'Verena',\n :last_name => 'Example',\n :number => '4111-1111-1111-1111',\n :verification_value => '123',\n :month => 11,\n :year => 2019,\n :address1 => '1234 fake st',\n :city => 'Omaha',\n :state => 'NE',\n :zip => '68135',\n :country => 'US'\n\n }\n account.billing_info.save!\n\n #output account to make sure it saved with billing_info\n #account = Recurly::Account.find accountNumber\n #puts \"Account: #{account.inspect}\"\n\n rescue Recurly::Resource::NotFound => e\n puts e.message\n rescue Recurly::API::UnprocessableEntity => e\n puts e.message\n end\n\n end",
"def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end",
"def standalone\n connector = StripeStandalone.new(current_customer)\n account = connector.create_account!(params[:country])\n\n if account\n flash[:notice] = \"Standalone StripeAccount account created! <a target='_blank' rel='platform-account' href='https://dashboard.stripe.com/test/applications/users/#{account.id}'>View in dashboard »</a>\"\n else\n flash[:alert] = 'Unable to create StripeAccount account!'\n end\n redirect_to customer_path(current_customer)\n end",
"def create(params)\n put('v1/account', params)\n end",
"def createAPI\n \n idLoL = LOL_WRAPPER.get_summoner_id(params[:accname], params[:region])\n #Find the summoner with the corresponding id and region\n @summoner = LOL_WRAPPER.get_summoner_by_id(idLoL, params[:region])\n \n #Create or update the corresponding account in our database\n if Account.exists?(:idLoL => idLoL)\n @account = Account.find_by_idLoL(idLoL)\n @account.pseudoLoL = @summoner.name\n @account.save\n else\n @account = Account.new(idLoL: idLoL, region: params[:region], pseudoLoL: @summoner.name)\n @account.save\n end\n\n @trackgroup.accounts << @account\n redirect_to(:back)\n \n end",
"def create\n @system_platform_account = System::PlatformAccount.new(system_platform_account_params)\n if @system_platform_account.save\n record_activities('创建接入账号', @system_platform_account.account_name)\n flash[:success] = '创建接入账号成功'\n redirect_to system_platform_accounts_path\n else\n flash[:error] = \"创建失败: #{@system_platform_account.errors.full_message}\"\n render :new\n end\n end",
"def create_temp_account(name)\n # Create the new account\n acc = Account.new\n acc.name = name\n acc.expiration = 7;\n acc.is_permanent = false\n acc.save!\n \n # Create the default doc for the account\n newAcc = Account.find_by_name(name)\n doc = create_document(newAcc)\n \n return newAcc,doc\n end",
"def create\n @account = Account.new(account_params)\n\n if @account.save\n AccountMailer.welcome(@account).deliver_later\n\n if current_user && @account.owner == current_user\n # User is already signed in and owns the account\n redirect_to @account, notice: 'Welcome to your new account!'\n else\n # User is not signed in or specified another user as the account owner\n redirect_to account_created_path\n end\n else\n @plans = Plan.all\n render :new\n end\n end",
"def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n Hyrax::Workflow::WorkflowImporter.load_workflows\n end\n end",
"def create_new_imdb_account\n CommonHelper.wait_for_element_to_present(SIGN_IN_BTN, :xpath)\n page.find(:xpath,SIGN_IN_BTN).click\n CommonHelper.wait_for_element_to_present(CREATE_NEW_ACCOUNT_BTN, :xpath)\n page.find(:xpath,CREATE_NEW_ACCOUNT_BTN).click\n user_name = \"QA#{Time.now.to_i}\"\n CommonHelper.wait_for_element_to_present(YOUR_NAME_INPUT)\n page.find(YOUR_NAME_INPUT).set user_name\n page.find(EMAIL_INPUT).set \"#{user_name}@gmail.com\"\n page.find(PASSWORD_INPUT).set \"Pass_#{user_name}\"\n page.find(PASSWORD_RECHECK_INPUT).set \"Pass_#{user_name}\"\n page.find(CREATE_IMDB_ACCOUNT_BTN).click\n user_name\n end",
"def create\n\t\t@bank_account = BankAccount.new(bank_account_params)\n\t\t@bank_account.last4 = @bank_account.account_number.to_s.split(//).last(4).join(\"\").to_s\n\t\t#Check if the user has entered a correct US postal code\n\t\tcheck_us_postal_code_and_create_bank_account\n\trescue\n\t \tflash[:error] = t('errors.messages.not_saved')\n\t \tredirect_to(:back)\t\t\n\tend",
"def create\n @account = Account.new(params[:account])\n @account.member = current_member\n logger.info @account.inspect\n \n respond_to do |format|\n if @account.save\n flash[:notice] = 'Thanks for signing up!' \n format.html { \n redirect_back_or_default('/')\n }\n format.xml do\n headers[\"Location\"] = account_url(@account)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n flash[:notice] = 'There was a problem creating your account, but we can address that later. If you need to sell something right now, please contact support.'\n redirect_back_or_default('/')\n format.xml { render :xml => @account.errors.to_xml }\n end\n end\n end",
"def create_account_and_create_subscription account_name\n contact = {\n address1: '1051 E Hillsdale Blvd',\n city: 'Foster City',\n country: 'United States',\n firstName: 'John',\n lastName: 'Smith',\n zipCode: '94404',\n state: 'CA'\n }\n\taccount_number = create_account account_name, contact\n\tputs '### Account created in Zuora with number: '+ account_number\n #get the rate plans for the product\n\tproduct_rate_plan = get_product_rate_plans_for_product 'Medium Monthly Plan w Discount'\n #create the subscription\n\tsubscription_number = create_subscription(\n account_number,\n DateTime.now.strftime(\"%Y-%m-%d\"),\n product_rate_plan['id']\n )\n\tputs '### Subscription created in Zuora with number: ' + subscription_number\n return subscription_number\nend",
"def call\n if valid?\n stripe_account_details = Stripe::Account.create({\n business_name: marina_name,\n country: 'US',\n managed: true\n })\n StripeManagedAccount.create!(\n stripe_account_id: stripe_account_details[\"id\"],\n stripe_secret_key: stripe_account_details[\"keys\"][\"secret\"],\n stripe_publishable_key: stripe_account_details[\"keys\"][\"publishable\"],\n marina_name: marina_name,\n marina_external_id: marina_external_id\n )\n end\n end",
"def new_account(res)\n account = Account.new\n account.new(res)\n end",
"def create\n @wallet_transaction = TransactionCreate.perform(transaction_params: wallet_transaction_params,\n user: current_user)\n respond_to do |format|\n if @wallet_transaction.save\n format.html { redirect_to @wallet_transaction, notice: 'Wallet transaction was successfully created.' }\n format.json { render :show, status: :created, location: @wallet_transaction }\n else\n format.html { render :new }\n format.json { render json: @wallet_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sign_up(gym, cost)\n Membership.new(self, gym, cost)\n\n end",
"def create\n printf(\"create : %s/%s \\n\", params[\"name\"], params[\"password\"])\n @account = Account.new(:name => params[\"name\"], :email => params[\"email\"], :password => params[\"password\"])\n \n respond_to do |format|\n if @account.save\n printf(\"save OK\\n\")\n format.html { redirect_to(@account, :notice => 'Account was successfully created.') }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n printf(\"save FAIL\\n\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def setup_accounts\n self.accounts.create({:name => \"Checking\"})\n self.accounts.create({:name => \"Savings\"})\n end",
"def create(product_id, amount, currency, transaction_time, reference_number,\n store_number, terminal_number, base_transaction_id, message_reason_code)\n\n @request = setup_request \"#{@@resource_url}/createAccount\"\n hash = {\n productId: product_id, amount: amount, currency: currency,\n transactionTime: transaction_time, retrievalReferenceNumber: reference_number,\n storeNumber: store_number, terminalNumber: terminal_number,\n baseTransactionId: base_transaction_id, messageReasonCode: message_reason_code\n }\n @request.body = hash.to_json\n @request\n end",
"def create\n passenger = ::Passenger.create!(passenger_params)\n auth_token = Auth::AuthenticateUser.new(passenger.email,\n passenger.password,\n 'Passenger').call\n response = { message: Message.account_created,\n auth_token: auth_token }\n json_response(response, :created)\n end",
"def create\n\t\t@account = Account.new(:name => params[:name])\n\t\trespond_to do |format|\n\t\t\tif @account.save\n\t\t\t\tformat.json { render json: @account, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @account.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @wallet = Wallet.new(wallet_params)\n\n respond_to do |format|\n if @wallet.save\n format.html { redirect_to @wallet, notice: 'User wallet was successfully created.' }\n format.json { render :show, status: :created, location: @wallet }\n else\n format.html { render :new }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signup(gym, cost, lifter)\n membership = Membership.new(gym, cost)\n self.membership << gym\n end",
"def create\n @acct = EmployeeAcct.new(employee_acct_params)\n @acct.account = current_account\n\n respond_to do |format|\n if @acct.save\n format.html { redirect_to \"/\", notice: 'Employee Account was successfully created.' }\n format.json { redirect_to \"/\", status: :created, location: @acct }\n else\n format.html { render :new }\n format.json { render json: @acct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tw_account = TwAccount.new(tw_account_params)\n\n respond_to do |format|\n if @tw_account.save\n format.html { redirect_to @tw_account, notice: 'The Account was successfully created.' }\n format.json { render :show, status: :created, location: @tw_account }\n else\n format.html { render :new }\n format.json { render json: @tw_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sign_up(cost,gym)\n Membership.new(self,gym,cost)\n end",
"def create\n @rental = Rental.find(params[:rental_id])\n @tenant_family_member = TenantFamilyMember.new(tenant_family_member_params)\n @tenant_family_member.rental = @rental\n\n respond_to do |format|\n if @tenant_family_member.save\n format.html { redirect_to @rental, notice: 'Tenant family member was successfully created.' }\n format.json { render :show, status: :created, location: @tenant_family_member }\n else\n format.html { render :new }\n format.json { render json: @tenant_family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_admin_account\n account = Account.create!\n self.account = account\n self.account_owner = true\n end",
"def sign_up(gym, cost)\n Membership.new(self, gym, cost)\n end",
"def create_user_account\n User.create!(email: self.email, password: self.customer)\n # user = User.new do |u|\n # u.email = email\n # u.password = customer\n # u.save\n # end\n end",
"def create_for_merchant(merchant_auth_request)\n build_request(merchant_auth_request,\n Requests::AuthenticateMerchant).\n send_to_api(:post, endpoint_path(:v14))\n end",
"def create_account(customer)\n\tacct_type = choose_account_type\n\tbalance = (prompt \"Your initial deposit will be? $\").to_f\n\tacct_num = @accounts.length + 1\n\tnew_account = Account.new(customer, balance, acct_type, acct_num)\n\t@accounts.push(new_account)\n\n\tputs \"Account created succesfully! \\n#{new_account.customer.fullname} \\nAccount no. #{new_account.acct_num} (#{new_account.acct_type}) \\n$#{'%.2f' % new_account.balance}\"\n\n\treturn_to_main_menu(customer)\nend",
"def create_account(account_form)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts'\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.post query_url, headers: headers, parameters: account_form.to_json\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def create_dealership(identity, customer)\n customer_id = if customer.nil? then nil else customer.id end\n status = if Lynr.features.demo? then 'demo' else 'trialing' end\n dealership = Lynr::Model::Dealership.new({\n 'identity' => identity,\n 'customer_id' => customer_id,\n 'subscription' => Lynr::Model::Subscription.new(plan: stripe_config.plan, status: status),\n })\n dealer_dao.save(dealership)\n end",
"def create_child( name )\n account = build_child( name )\n attach_child( account )\n return account\n end",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.new( params ).save\n end",
"def create_passenger\n puts \"Welcome to Easy Airlines. If it were any easier it'd be Your Mom Airlines.\"\n puts \"We take motorboating your mom to new heights.\"\n puts \"... oh that's a little awkward...\"\n puts \"\"\n puts \"What is your first name?\"\n first_name = gets.chomp\n puts \"What is your last name?\"\n last_name = gets.chomp\n new_pass = Passenger.create(first_name: first_name, last_name: last_name)\n new_pass.add_flight(random_insult)\nend",
"def create_first_party(party_sym, current_user)\n\t\tparty = self.namespaced_class(party_sym).new()\n\t\tparty.contact = current_user.contacts[0]\n\t\tparty.contact_strategy = nil \n\t\tself.parties << party\t# implicit party.save()\n\t\tparty\n\tend",
"def create_initial_account_and_profile!\n account = accounts.create!(name: I18n.t('.default.account.name'))\n profiles.create!(name: I18n.t('.default.profile.name'), account_id: account.id)\n end",
"def create\n if params[:brutto] != nil\n # hh = 'create'\n # byebug\n make_payment\n\n else\n @employee = Employee.new(employee_params)\n @employee.users_id = current_user.id\n @employee.fio = @employee.firstname.chars.first.upcase + \".\" + @employee.lastname\n # byebug\n respond_to do |format|\n if @employee.save\n around_create\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def sign_up (gym, cost) \n Membership.new(cost, gym, self)\n end",
"def create_account(account_name, account_password, d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['AccountName'] = account_name\n\t\targs[:query]['AccountPassword'] = account_password\n\t\targs[:query]['Action'] = 'CreateAccount'\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :account_description\n\t\t\targs[:query]['AccountDescription'] = optional[:account_description]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def add_customer_account\n self.create_account! unless self.account\n end",
"def create\n @wallet = Wallet.build_secure_wallet(wallet_params)\n\n respond_to do |format|\n if @wallet.save\n format.html { redirect_to @wallet, notice: 'Wallet was successfully created.' }\n format.json { render :show, status: :created, location: @wallet }\n else\n format.html { render :new }\n format.json { render json: @wallet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_account(email: 'jdoe@emmoco.com', password: 'aba456',\n admin: false, first: 'John', last: 'Doe') # system admin, not lock admin\n # account is a devise model, must set properties at instance level and not in constructor\n Account.create!(:first_name => first,\n :last_name => last,\n :email => email,\n :password => password,\n :password_confirmation => password,\n :admin => admin,\n :confirmed_at => DateTime.now.utc.iso8601(9),\n :confirmation_sent_at => DateTime.now.utc.iso8601(9)\n )\n end",
"def create_account_for_user\n # # if age.exists?\n # balance = age >= 18 ? 350 : 250\n # create_account(balance: balance)\n # # end\n create_account(balance: 250)\n end",
"def create_account\n puts \"\\nWhat would you like your username to be?\"\n new_user = gets.chomp\n @user = User.create(name: new_user)\n\n puts \"\\nWelcome #{@user.name}! What's your favorite sport?\"\n sport = gets.chomp\n sport_found = Sport.find_by(name: sport)\n\n if sport_found != nil\n new_sub = Subscription.create(name: \"#{@user.name}'s #{sport_found.name} subscription\", sport_id: sport_found.id, user_id: @user.id)\n else\n puts \"\\nSorry, but we don't currently support subscriptions for #{sport}.\"\n end\n end",
"def make_fantasy_team\n puts \"What is your team name?\"\n name = gets.chomp\n puts \"What is your name?\"\n owner = gets.chomp\n your_team = FantasyTeam.create(name: name, owner: owner)\n your_team\n end",
"def create_account\n account = Account.new(:email => email, :subdomain => subdomain)\n account.save!\n end",
"def create\n @transaction = Transaction.new\n @transaction.amount = params[:amount]\n @transaction.from_account = Account.find_by(account_num: params[:account_num])\n @transaction.status = 'pending'\n @transaction.trans_type = 'deposit'\n @transaction.trans_from = User.find(session[:user_id])\n @transaction.save\n redirect_to accounts_path\n end",
"def create_withdrawal\n # body = {\n # cmd: \"create_withdrawal\"\n # }\n\n end",
"def create\n @fulfillment_bill = FulfillmentBill.new(fulfillment_bill_params)\n set_store_name\n \n respond_to do |format|\n if @fulfillment_bill.save\n format.html { redirect_to @fulfillment_bill, notice: 'Fulfillment bill was successfully created.' }\n format.json { render :show, status: :created, location: @fulfillment_bill }\n else\n format.html { render :new }\n format.json { render json: @fulfillment_bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @automated_transaction = AutomatedTransaction.new(automated_transaction_params)\n @automated_transaction.airport_id = current_airport.id\n if @automated_transaction.account\n @automated_transaction.registration = @automated_transaction.account.registration\n end\n respond_to do |format|\n if @automated_transaction.save\n format.html { redirect_to automated_transactions_path, notice: 'Automated transaction was successfully created.' }\n format.json { render :show, status: :created, location: automated_transactions_path }\n else\n format.html { render :new }\n format.json { render json: @automated_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_11_createaccount_while_donating()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 11 ----------------------\"\n\t\t#~ #---------------- Run HACK URL - Start ------------------------------------#\n\t\tlogin($globaladmin_emailId, $globaladmin_password)\n\t\trunHackURL(\"/admin/reindex\", \"/admin/reindex_all\", \"/admin/memcached_flush\", \"/admin/regenerate_statistics\")\n\t\tlogout()\n\t\t#~ #---------------- Run HACK URL - End ------------------------------------#\n\t\tsleep 120\n\t\tsearchOrg($new_orgname)\n\t\tgotoDonFormClickSignup($donation_amount)\n\t\tcreateRazooAccount($normal2_firstname, $normal2_lastname, $normal2_emailId, $normal2_password)\n\t\tdonateUsingNewCard($donation_amount, $normal2_nameoncard, $street, $state, \n\t\t\t\t\t $city, $pin_code, $mastercard_number, $mastercard_seccode, $normal2don_emailId)\n\t\tpostComments(\"Give and be Blessed!!\")\n\t\tcheckMydonation($donation_amount)\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 11 --------------------------\"\n\tend",
"def lease!\n Apartment::Tenant.create(leaser_name)\n end",
"def create\n # Build a new Tenant object and set the values based on user input\n tenant = Tenant.new do |t|\n p = params[:tenant]\n t.name = p[:name]\n t.payment_handle = p[:payment_handle]\n t.phone_num = p[:phone_num]\n t.email = p[:email]\n end\n\n # Attempt to save the tenant\n if tenant.save # success\n redirect_to back_address(\"\"), notice: return_message(record: tenant, action: \"create\")\n\n else # fail\n # Create 'failed_edits' hash which stores all the values from the records that failed to get saved\n failed_edits = Hash.new\n failed_edits['new'] = params[:tenant]\n failed_edits['new']['errors'] = tenant.errors.keys.map(&:to_s)\n\n redirect_to back_address(failed_edits.to_param), notice: return_message(record: tenant, action: \"create\")\n end\n end",
"def create_tenant\n Apartment::Tenant.create(params[:id])\n Apartment::Tenant.switch!(params[:id])\n\n\n redirect_to entreprise_path(enterprise_id: params[:entreprise])\n flash[:alert] = \"Tenant...#{Apartment::Tenant.current}\"\n end",
"def alicreate(fabrickey, aliname, *wwn)\n result = @zones.alicreate(fabrickey, aliname, *wwn)\n result[1]\n end",
"def create\n _user_not_anonymous\n @user = CwaIpaUser.new\n @project = Project.find(Redmine::Cwa.project_id)\n\n if !params[:saa] \n flash[:error] = \"Please indicate that you accept the system access agreement\"\n redirect_to :action => :index\n return\n end\n\n if !params[:tos]\n flash[:error] = \"Please indicate that you accept the terms of service\"\n redirect_to :action => :index\n return\n end\n\n # TODO \n # 1. Call REST to messaging service to notify about account creation\n # 2. Add user to research-computing project\n @user.passwd = params['netid_password']\n\n begin\n @user.create\n rescue Exception => e\n flash[:error] = \"Registration failed: \" + e.to_s\n else\n logger.info \"Account #{@user.uid.first} provisioned in FreeIPA\"\n\n # Add them to the project... allows notifications\n @project.members << Member.new(:user => User.current, :roles => [Role.find_by_name(\"Watcher\")])\n\n CwaMailer.activation(@user).deliver\n\n flash[:notice] = 'You are now successfully registered!'\n end\n redirect_to :action => :index\n end",
"def create(params, membership)\n # Send payload to blip\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n firstname: (params[5].nil? ? params[4][0] : params[5]),\n lastname: [params[6], params[7]].reject{|e| e.nil? or e.empty?}.join(' '),\n email: (params[3].nil? ? 'unknown@nieuwedelft.nl.invalid' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n blip = post('https://people.i.bolkhuis.nl/persons', data)\n\n # Grab uid\n unless blip == nil\n uid = blip['uid']\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\n end\nend"
] |
[
"0.84593177",
"0.8210238",
"0.6931161",
"0.66629356",
"0.6605075",
"0.6540837",
"0.6511814",
"0.64503384",
"0.6416121",
"0.63049054",
"0.61965",
"0.61965",
"0.61664593",
"0.6043625",
"0.5988993",
"0.596523",
"0.59083587",
"0.5901779",
"0.5834812",
"0.58004194",
"0.5794443",
"0.5769844",
"0.5736637",
"0.5736426",
"0.5726672",
"0.57135123",
"0.5684497",
"0.5668534",
"0.56267416",
"0.5595505",
"0.5589838",
"0.5573387",
"0.5561605",
"0.5561442",
"0.5550434",
"0.5549903",
"0.55398875",
"0.5534738",
"0.5529438",
"0.55163807",
"0.5508769",
"0.55037796",
"0.5498297",
"0.5495135",
"0.54926705",
"0.54773587",
"0.5471298",
"0.54681087",
"0.54635",
"0.5437055",
"0.5435756",
"0.54345375",
"0.5430024",
"0.5429338",
"0.5424248",
"0.542403",
"0.5418943",
"0.5413896",
"0.54103434",
"0.54087543",
"0.5404017",
"0.5403571",
"0.53971326",
"0.53943807",
"0.5392365",
"0.5389516",
"0.5389165",
"0.53872424",
"0.5386929",
"0.5386792",
"0.5386138",
"0.538525",
"0.53825897",
"0.5380537",
"0.53752667",
"0.5374595",
"0.5369864",
"0.5366851",
"0.5366405",
"0.5361193",
"0.5354533",
"0.5354478",
"0.53486705",
"0.5347799",
"0.5339912",
"0.5324243",
"0.53151673",
"0.5314877",
"0.5314268",
"0.53084993",
"0.5300314",
"0.5293024",
"0.5292651",
"0.52860856",
"0.5286082",
"0.5286067",
"0.5285856",
"0.52838904",
"0.52815926",
"0.5265463"
] |
0.663668
|
4
|
File staging and cleanup
|
def stage_unzipped(zipfile, stage_dir)
# Unzip file to a specified directory
Dir.mkdir stage_dir unless Dir.exist?(stage_dir)
Zip::File.open(zipfile) do |z|
z.each do |f|
extract_path = File.join(stage_dir, f.name)
z.extract(f, extract_path) unless File.exist?(extract_path)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cleanup\n File.delete(temp_file_path)\n end",
"def cleanup\n File.delete(@tmp_state) rescue nil\n end",
"def process(&blk)\n result = tempfile(&blk)\n\n # Should we add destroy to an ensure block? Im not sure if it makes sense\n # to delete failed files.\n file.destroy\n\n result\n end",
"def cleanup()\n @definition.temporary_files.each do |file|\n if File.exists?(file) && File.writable?(file)\n File.delete(file)\n end\n end\n if @environment.verbose\n puts \"========== END #{@definition.name} ============\"\n end\n end",
"def clean_environment\n `rm -rf /tmp/#{@upload_id}` # all sliced pages of the source file\n end",
"def cleanup\n cleanup_unpack_path\n cleanup_download_path\n end",
"def cleanup\n @agent_file_history.each { |af| FileUtils.rm_f(af) }\n @key_file_history.each { |kf| FileUtils.rm_f(kf) }\n end",
"def close_files\n [self.source, self.original, self.destination].each do |f|\n next unless f\n begin\n f.close\n File.unlink(f) if SystemInformation.env == 'production'\n rescue\n nil\n end\n end\n end",
"def cleanup\n begin\n File.delete(full_filename, full_filename + \".meta\")\n rescue\n logger.warn \"Unable to delete recordings files: #{full_filename}*\"\n end\n end",
"def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end",
"def cleanup\n @log.debug \"Deleting #{@out_file}.flv\"\n if File.exists?(\"#{@out_file}.flv\")\n File.delete(\"#{@out_file}.flv\")\n end\n end",
"def stage\n\n @tempdir = Dir.mktmpdir\n\n begin\n\n # Copy the assets into the temp dir.\n files = Dir.glob(\"#{File.dirname(@file_path)}/#{@file_base}.*\")\n FileUtils.cp(files, @tempdir)\n\n # Change into the temp dir.\n FileUtils.cd(@tempdir) do yield end\n\n ensure\n\n # Delete the copies.\n FileUtils.remove_entry @tempdir\n\n end\n\n end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup\n tmpdir = File.join(OBS_BUILD_DIR,OBS_LOCAL_TMP)\n if File.exists?(tmpdir)\n FileUtils.rm_rf(tmpdir)\n end\n end",
"def cleanup\n FileUtils.rm(@out_filename)\n\n # XXX: could be rm-rf, but be safe for now. Might have\n # problems if app creates files in $PWD\n FileUtils.rmdir(@opts[:tmpdir])\n end",
"def cleanup\n remove_files(TEST_INPUT_DIR)\n remove_files(TEST_OUTPUT_DIR)\nend",
"def clean_files\n ck_valid\n File.unlink(pid_file) if File.exists?(pid_file)\n File.unlink(prof_file) if File.exists?(prof_file)\n File.unlink(socket_file) if File.exists?(socket_file)\n end",
"def cleanup_files\n FileUtils.rm_rf(File.join(Rails.root, \"tmp\"))\n end",
"def clean_references\n s3_file_processor.clean_local_file if s3_file_processor.file_path\n end",
"def clean_staging\n staging_config_file = '_config.staging.yml'\n File.delete staging_config_file if File.exists? staging_config_file\nend",
"def cleanup\n FileUtils.rm_f(@path)\n delete\n end",
"def cleanIntermediateFiles()\n puts \"Deleting intermediate files\"\n deleteTempFilesCmd = \"rm *.sam *.sai\"\n `#{deleteTempFilesCmd}`\n\n # Be careful here, delete only _sorted.bam\n puts \"Deleting intermediate BAM file\"\n deleteTempBAMFileCmd = \"rm *_sorted.bam\"\n `#{deleteTempBAMFileCmd}`\n\n makeDirCmd = \"mkdir casava_fastq\"\n `#{makeDirCmd}`\n moveCmd = \"mv *.fastq.gz ./casava_fastq\"\n `#{moveCmd}`\n end",
"def cleanIntermediateFiles()\n puts \"Deleting intermediate files\"\n deleteTempFilesCmd = \"rm *.sam *.sai\"\n `#{deleteTempFilesCmd}`\n\n # Be careful here, delete only _sorted.bam\n puts \"Deleting intermediate BAM file\"\n deleteTempBAMFileCmd = \"rm *_sorted.bam\"\n `#{deleteTempBAMFileCmd}`\n\n makeDirCmd = \"mkdir casava_fastq\"\n `#{makeDirCmd}`\n moveCmd = \"mv *.fastq.gz ./casava_fastq\"\n `#{moveCmd}`\n end",
"def cleanup!; end",
"def cleanup!; end",
"def cleanup\n File.delete(@path) if @path.is_a?(String) && File.exist?(@path)\n end",
"def clean_up()\n File.delete(ZIP_FILE)\n end",
"def clean_local_file\n File.delete(@file_path) if File.exist? @file_path\n end",
"def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end",
"def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end",
"def reprocess!\n self.file = self.storage.retrieve(self.path)\n process\n end",
"def cleanup_files(resource)\n remove_public_dir(resource) # where the local manifest file is stored\n remove_s3_data_files(resource)\n rescue StandardError => e\n msg = \"An unexpected error occurred when cleaning up files for resource #{resource.id}: \"\n msg << e.full_message\n logger.warn(msg)\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\r\n end",
"def after_save\n super rescue nil\n unless (@tempfile_path.nil? || @tempfile_path.empty?)\n stash_path = file_root(true)\n D::mkdir(stash_path) unless F::exist?(stash_path)\n @tempfile_path.each do |k,v|\n url = file_path(k, nil, true)\n destroy_files_for(k, url) # Destroy previously saved files\n FU.move(v, url) # Save the new one\n FU.chmod(0777, url)\n after_stash(k)\n end\n # Reset in case we access two times the entry in the same session\n # Like setting an attachment and destroying it in a row\n # Dummy ex: Model.create(:img => file).update(:img => nil)\n @tempfile_path = nil\n end\n end",
"def cleanup\n end",
"def cleanup\n end",
"def process()\n @file_info = FileInfoFile.new(@file_info_file)\n @namespace = @file_info.default_namespace\n \n namespaces_file = NamespacesFile.new(@uploads_directory, @scan_only)\n namespaces_file.add_namespace(@namespace)\n namespaces_file.write()\n @prefix = namespaces_file.prefix(@namespace)\n \n create_image_files_where_needed()\n end",
"def post_process(file)\n if File.basename(file.to_s).match(/library/)\n oldfile = file\n file = file.to_s.sub(\"library\", @options[:lib_name_u])\n FileUtils.mv(oldfile, file)\n end\n if File.dirname(file.to_s).split(\"/\").last == \"library\"\n origdir = File.dirname(file.to_s)\n dirarr = origdir.split(\"/\")\n dirarr[dirarr.size-1] = @options[:lib_name_u]\n new_dir = File.join(dirarr)\n mkdir(new_dir)\n oldfile = file\n file = File.join(new_dir, File.basename(file))\n FileUtils.mv(oldfile, file)\n FileUtils.rmdir(origdir)\n end\n if file.to_s.match(/\\.seed$/)\n out_file = Pathname.new(file.to_s.sub(/\\.seed$/, ''))\n # Don't overwrite a file of the same name, unless they --force\n if copy_check(out_file)\n template = ::ERB.new(File.read(file))\n # This binding has access to any instance variables of\n # the ProjectCreator instance\n result = template.result(binding)\n File.open(file.to_s.sub(/\\.seed$/,''), 'w+') do |io|\n io.puts result\n end\n end\n # Remove the seed file whether we copied or not\n FileUtils.rm_f(file)\n end\n end",
"def clean_up\n FileUtils.rm_rf @temp_root\n end",
"def cleanup_open_files()\r\n if (self.active_files.length > MAX_NUM_FILES)\r\n _counter = 0\r\n \r\n self.active_files.each { |_file|\r\n _counter += 1\r\n \r\n if (_counter > MAX_NUM_FILES && _file.is_saved)\r\n _file.destroy()\r\n end\r\n }\r\n end\r\n end",
"def cleanUpWorkingFiles()\n system(\"rm -f #{@tripFile} #{routeFile} #{routeAltFile}\") ;\n end",
"def cleanup_old_files\n # make a local copy of to_delete while simultaneously clearing the original (atomicity)\n # local_to_delete = $to_delete.slice!(0..-1).to_a\n local_to_delete = []\n $to_delete.delete_if { |v| local_to_delete << v; true }\n\n $files.each_pair do |uuid, file|\n if file.nil?\n $files.delete uuid\n elsif local_to_delete.include?(uuid) || (Time.now - 60*60) > file.ctime\n file.close # Close it\n file.unlink if file.respond_to? :unlink # Unlink it if we can\n $files.delete uuid\n end\n end\n GC.start\nend",
"def teardown\n [\"file1\", \"file2\", \"file3\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/file*\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/*.tar.gz\"].each {|f| FileUtils.rm f}\n Dir.rmdir \"test/backup\" if File.exists? \"test/backup\"\n end",
"def cleanup!\n FileUtils.rm_rf(obsolete_files)\n FileUtils.rm_rf(metadata_file) unless @site.incremental?\n end",
"def cleanup_cached_images()\n\n # swap_dir = \"../public/swap\" # use when running locally from /lib/s3_bucket.rb\n swap_dir = \"./public/swap\" # use when running via app.rb\n swap_contents = \"#{swap_dir}/*\"\n gitkeep = \"#{swap_dir}/.gitkeep\"\n\n if File.directory?(swap_dir)\n FileUtils.rm_rf(Dir.glob(swap_contents)) # delete contents of /public/swap \n file = File.new(gitkeep, 'w') # recreate .gitkeep file\n file.close if file\n else\n puts \"sightings directory does not exist!\"\n end\n\nend",
"def cleanup\n case SubutaiConfig.provider\n when :hyper_v\n SubutaiDisk.hyperv_remove_disk\n end\n\n # cleanup virtual disks\n disks = SubutaiConfig.get(:_DISK_PATHES)\n unless disks.nil?\n disks.keys.each do |key|\n if File.exist?(disks[key])\n begin\n File.delete(disks[key])\n puts \"==> default: Deleted file: #{disks[key]}\"\n rescue Errno::EACCES\n puts \"==> default: (Permission denied) Failed delete file: #{disks[key]}\"\n end\n end\n end\n end\n\n # cleanup generated files\n if File.exist?(SubutaiConfig::GENERATED_FILE)\n begin\n File.delete SubutaiConfig::GENERATED_FILE\n puts \"==> default: Deleted file: #{SubutaiConfig::GENERATED_FILE}\"\n rescue Errno::EACCES\n puts \"==> default: (Permission denied) Failed delete file: #{SubutaiConfig::GENERATED_FILE}\"\n end\n end\n end",
"def cleanup_state\n delete_if_exists(state_file_path)\n delete_if_exists(chef_file_path)\n delete_if_exists(past_scripts_path)\n delete_if_exists(log_path)\n end",
"def clean_test_case\n if File.exists?(@local_file_download_destination)\n File.delete(@local_file_download_destination)\n end\n end",
"def cleanup\n close_file_appender\n archive_run_result if (defined? @results_archive) && @archive_results\n end",
"def cleanup\n\t\tfile_count = 0\n\t\tif File.directory?(@file_path)\n\t\t\tDir.foreach(@file_path) do |f|\n\t\t\t\tfile_count += 1\n\t\t\t fn = File.join(@file_path, f)\n\t\t\t File.delete(fn) if f != '.' && f != '..'\n\t\t\tend\n\t\t\tDir.delete(@file_path)\n\t\t\tmsg = \"Cleaned up #{file_count} files\"\n\t\telse\n\t\t\thalt 422, \"No directory\"\n\t\tend\n\t\t{ msg: msg }\n\tend",
"def keep_files; end",
"def cleanup_cached_images()\n\n # swap_dir = \"../public/swap\" # use when running locally from /lib/b2_bucket.rb\n swap_dir = \"./public/swap\" # use when running via app.rb\n swap_contents = \"#{swap_dir}/*\"\n gitkeep = \"#{swap_dir}/.gitkeep\"\n\n if File.directory?(swap_dir)\n FileUtils.rm_rf(Dir.glob(swap_contents)) # delete contents of /public/swap \n file = File.new(gitkeep, 'w') # recreate .gitkeep file\n file.close if file\n else\n puts \"Directory does not exist!\"\n end\n\nend",
"def cleanup!\r\n got = @ndev.rpc.request_system_storage_cleanup\r\n gone_h = {}\r\n got.xpath('file-list/file').each do |file|\r\n _cleanup_file_to_h( file, gone_h )\r\n end\r\n gone_h\r\n end",
"def destroy\n\t\tFile.delete @filepath\n\t\t@data_base = nil\n\t\t@data_base.freeze\n\t\tself.freeze\n\tend",
"def cleanup(uploaded_file, file_path)\n File.delete(file_path) if uploaded_file.is_file_upload\n\n # clean up old uploads\n cutoff = Time.now - 1.hour\n lst = UploadedFile.where(status: 'I').all\n lst.each do |u|\n u.update_attribute(:status, 'F') if u.updated_at < cutoff\n end\n end",
"def cleanup_file(file_name)\n f = File.expand_path(file_name)\n File.unlink(f) if File.exists?(f)\n yield\nensure\n File.unlink(f) if File.exists?(f)\nend",
"def prepareForFile(filename)\n end",
"def cleanup\n\tend",
"def cleanup\n\tend",
"def cleanup_swap_dir(file)\n\n image_path = \"./public/swap/#{file}\"\n\n if File.exist?(image_path)\n File.delete(image_path) # delete temp file from /public/swap\n else\n puts \"temp file does not exist!\"\n end\n\nend",
"def remove_virus_affected_file()\n @import.destroy\n end",
"def cleanup(name)\n override_data(name, File.size(name)) unless @is_pipe\n File.unlink name\n end",
"def clean_up\n FileUtils.rm_rf \"#{@path}\" unless create_in_current_directory?\n FileUtils.rm_rf \"#{@cache}\"\n end",
"def cleanup\n FileUtils.rm_rf(sfx_cache_path)\n end",
"def migrate_lots_of_ug_papers(path_to_fox, path_to_foxdone, content_server_url, collection_mapping_doc_path, user)\r\nputs \"doing a bulk migration from \" + path_to_fox\r\n\r\nfname = \"tally.txt\"\r\ntallyfile = File.open(fname, \"a\")\r\nDir.foreach(path_to_fox)do |item|\t\r\n\t# we dont want to try and act on the current and parent directories\r\n\tnext if item == '.' or item == '..'\r\n\t# trackingfile.puts(\"now working on \" + item)\r\n\tputs \"found\" + item.to_s\r\n\titempath = path_to_fox + \"/\" + item\r\n\tresult = 9 # so this wont do the actions required if it isnt reset\r\n\tbegin\r\n\t\tresult = migrate_undergraduate_paper(itempath, content_server_url, collection_mapping_doc_path, user)\r\n\trescue\r\n\t\tresult = 1\t\r\n\t\ttallyfile.puts(\"rescue says FAILED TO INGEST \"+ itempath) \r\n\tend\r\n\tif result == 0\r\n\t\ttallyfile.puts(\"ingested \" + itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\t\tFileUtils.mv(itempath, path_to_foxdone + \"/\" + item) # move files once migrated\r\n\telsif result == 1 # this may well not work, as it may stop part way through before it ever gets here. rescue block might help?\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 2 # apparently some records may not have an actual resource paper of any id!\r\n\t\ttallyfile.puts(\"ingested metadata but NO MAIN RESOURCE DOCUMENT IN \"+ itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 3 # couldnt identify parent collection in mappings\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \" + itempath + \" because couldnt identiy parent collection mapping\")\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 4 # this may well not work, as it may stop part way through before it ever gets here. \r\n\t\ttallyfile.puts(\"FAILED TO INGEST RESOURCE DOCUMENT IN\"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telse\r\n tallyfile.puts(\" didnt return expected value of 0 or 1 \")\t\r\n\tend\r\nend\r\ntallyfile.close\r\nputs \"all done\"\r\nend",
"def teardown\n FileUtils.rm_rf(data_path)\n end",
"def transfer_and_cleanup\n transfer_and_cleanup_with_block do |type|\n if type == :cover_concept\n self.update_column(:cover_concept_image_processed, true)\n end\n\n if type == :stock_cover_image\n self.update_column(:stock_cover_image_processed, true)\n end\n end\n end",
"def stage_clear\n stage_safe!\n Dir['*'].each do |path|\n #p path\n FileUtils.rm_r(path)\n end\n end",
"def tidy_up\n Dir[\"*nin\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nhr\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nsq\"].each do |file|\n File.delete(file)\n end\n Dir[\"*blast\"].each do |file|\n File.delete(file)\n end\n end",
"def cleanup!\n f = pids_file_for(Loader.current_type)\n FileUtils.rm_f(f) if (pids_from(f) - Process.pid).blank?\n end",
"def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end",
"def clean_file\n staged_root.join(\"clean.sh\")\n end",
"def migrate_files_to_external_storage!\n return if stored_externally? || !use_external_diff? || merge_request_diff_files.count == 0\n\n rows = build_merge_request_diff_files(merge_request_diff_files)\n\n transaction do\n MergeRequestDiffFile.where(merge_request_diff_id: id).delete_all\n create_merge_request_diff_files(rows)\n save!\n end\n\n merge_request_diff_files.reset\n end",
"def cleanup\n winrm.run_cmd( \"del #{base64_file_name} /F /Q\" )\n winrm.run_cmd( \"del #{command_file_name} /F /Q\" )\n end",
"def purge\n ::FileUtils.rm(@fname)\n end",
"def cleanup!\n input.drop\n output.drop\n end",
"def tempfile; end",
"def tempfile; end",
"def wipe_snapshots_data; end",
"def wipe_snapshots_data; end",
"def finished(inspected_files); end",
"def cleanup\n if !ENV.has_key?('SHAPEFILE_UPLOAD_DIR')\n Rails.logger.error \"No shapefile upload directory. Please set SHAPEFILE_UPLOAD_DIR in application.yml\"\n return nil\n end\n\n upload_dir = ENV['SHAPEFILE_UPLOAD_DIR'].dup\n if upload_dir.empty?\n Rails.logger.error \"Invalid upload directory. Please set SHAPEFILE_UPLOAD_DIR in application.yml\"\n return nil\n end\n\n if shapefile.file && shapefile.file.file\n dir = File.dirname(shapefile.file.file)\n\n if dir.match(/#{upload_dir}/)\n Rails.logger.info \"Cleaning up #{dir}\"\n FileUtils.rm_rf(dir)\n end\n else\n Rails.logger.error \"Couldn't find shapefile file: #{shapefile.inspect}\"\n end\n\n end",
"def rollback!\n files.each { |file, contents| rollback_file(file, contents) }\n @files = {}\n end",
"def teardown\n File.delete 'file.xml' if File.exists?('file.xml')\n File.delete '.file.xml.duxml' if File.exists?('.file.xml.duxml')\n end",
"def clean_up\n pathname.delete if pathname.exist?\n end",
"def reproc_true(file)\n full_path = file\n if (! File.exists?(full_path))\n # Rubymatica.save_status(dir_uuid, \"Can't reprocess, #{full_path} does not exist.\")\n print \"Can't reprocess, #{full_path} does not exist.\\n\";\n exit\n end\n extract_flag = false\n dir_uuid = File.basename(full_path)\n \n # When reprocessing, the meta_data/info.db already exists (or else\n # this will fail), therefore we can look in the db for info such\n # as the name of this ingest.\n \n my_ig = Ingest.new(dir_uuid)\n \n base_name = my_ig.read_meta(\"ingest_name\")\n tub = \"#{Dest}/#{dir_uuid}/#{Accession_dir}\"\n \n Rubymatica.save_status(dir_uuid, \"Reprocessing #{Accession_dir} uuid: #{dir_uuid}\")\n \n igl_dest = \"#{Dest}/#{dir_uuid}/#{Ig_logs}\"\n pv_dir = \"#{Dest}/#{dir_uuid}/#{Pv}\"\n md_dir = \"#{Dest}/#{dir_uuid}/#{Meta}\"\n ac_dir = \"#{Dest}/#{dir_uuid}/#{Accession_dir}\"\n \n # Delete any previously machine created files. Keeping files\n # would mean using previously created file uuid's and that\n # would be a mess. This codes doesn't have the architecture\n # for that.\n\n # Use an anonymous array because we can. Directories that we'll\n # clean up, followed by a list of files we will *not* delete.\n\n [igl_dest, pv_dir, md_dir].each { |path|\n Find.find(path) { |file|\n if (file.match(Dcx) or \n file.match(Db_name))\n next;\n end\n\n # Great line of code. OOP totally rocks. Not! Class,\n # method and variable all the same name, and you thought\n # programmers didn't have a sense of humor.\n \n if (File.file?(file))\n File.delete(file)\n end\n }\n }\n return base_name,dir_uuid, my_ig, tub, igl_dest, pv_dir, md_dir, ac_dir, extract_flag\n end",
"def fill\n files.each { |filename, data| close(filename) unless data[:safe] }\n end",
"def transfer_and_cleanup\n direct_upload_url_data = DIRECT_UPLOAD_URL_FORMAT.match(self.direct_upload_url)\n s3 = AWS::S3.new\n self.image = URI.parse(URI.escape(self.direct_upload_url))\n self.save\n s3.buckets[Rails.configuration.aws[:bucket]].objects[direct_upload_url_data[:path]].delete\n end",
"def cleanup\n return unless @dst\n\n @dst.unlink\n @dst = nil\n end",
"def remove(filename); end",
"def run()\n\n # Figure out which tags actually to reset.\n if @tags.nil? or @tags == 'all'\n @tags = @@default_tags\n elsif @tags.is_a?(String)\n @tags = @tags.split(',')\n end\n\n # Create the command to delete all the metatags\n command = 'exiftool'\n parameter = ' -overwrite_original'\n @tags.each do |current_tag|\n parameter << \" -#{current_tag}=\"\n end\n parameter << ' ' \n\n `#{command} #{parameter} #{@filename}`\n self.log('info', \"Cleaning tags '#{@tags.join(', ').to_s}' from file '#{@filename}'.\")\n end"
] |
[
"0.7183107",
"0.70705885",
"0.69252986",
"0.68893105",
"0.68152714",
"0.680847",
"0.67785966",
"0.673514",
"0.66969645",
"0.66234565",
"0.6603937",
"0.6484947",
"0.64607406",
"0.64607406",
"0.64607406",
"0.64607406",
"0.64599407",
"0.6440046",
"0.64189106",
"0.6407404",
"0.63738334",
"0.63610876",
"0.6357746",
"0.63517517",
"0.6330213",
"0.6330213",
"0.6329967",
"0.6329967",
"0.63266134",
"0.6316518",
"0.6307941",
"0.6284601",
"0.6284601",
"0.62787825",
"0.62743413",
"0.62683624",
"0.62683624",
"0.62683624",
"0.62550884",
"0.62550884",
"0.62550884",
"0.62550884",
"0.6254633",
"0.6222619",
"0.6221235",
"0.6221235",
"0.616698",
"0.6154592",
"0.6150095",
"0.61436677",
"0.61266977",
"0.61248404",
"0.6113055",
"0.6105481",
"0.6094501",
"0.60745776",
"0.60667944",
"0.60635906",
"0.6026737",
"0.6017504",
"0.6015511",
"0.6012599",
"0.59938824",
"0.5987744",
"0.598329",
"0.5963814",
"0.59216106",
"0.5919401",
"0.5919401",
"0.59116393",
"0.5909495",
"0.5908728",
"0.59011686",
"0.58932143",
"0.58821535",
"0.5878976",
"0.5874219",
"0.58722794",
"0.586179",
"0.58567286",
"0.58531475",
"0.5851638",
"0.5848023",
"0.58464986",
"0.5840005",
"0.5829323",
"0.581655",
"0.581655",
"0.58142847",
"0.58142847",
"0.57956934",
"0.5783456",
"0.5780857",
"0.5780357",
"0.5779756",
"0.5770514",
"0.5765668",
"0.5764329",
"0.576112",
"0.5757183",
"0.5755306"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_object
@profile = Klass.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 object_params
params.require(Klass.name.downcase).permit(:name)
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
|
o operador vai transformar todos os parametros em array
|
def varios_args(*args)
puts "Tamanho de args: #{args.size}"
args.each { |x| p x}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def params_array_from(raw_params); end",
"def rewrite_param_values(array_params); end",
"def array_converter(*args)\n \nend",
"def splat(*numeros)\n\tnumeros.max #devuelve el maximo de muchos parametros, los almacena en un arreglo\nend",
"def build_array(param1, param2, param3)\n\t[param1, param2, param3]\nend",
"def add_parameter array, params = MESSAGE\n a = []\n params.each do |param|\n a = a + array.collect {|element| element.clone + param}\n end\n a\n end",
"def converted_arrays; end",
"def argv_prepare(numbers) # zamiana elementów tablicy na liczby\n numbers.map do |e|\n e.to_i\n end\nend",
"def argv_prepare(numbers) # zamiana elementów tablicy na liczby\n numbers.map do |e|\n e.to_i\n end\nend",
"def argv_prepare(numbers) # zamiana elementów tablicy na liczby\n numbers.map do |e|\n e.to_i\n end\nend",
"def java_parameters\n\t\t\tif @args.nil? || @args.size < 1 then\n\t\t\t\treturn []\n\t\t\tend\n\t\t\t\n\t\t\toutput = []\n\t\t\t@args.each do |arg|\n\t\t\t\ttemp = @args.split OPERATOR_REGEX\n\t\t\t\tif !temp.nil? && temp.size > 1 then\n\t\t\t\t\toutput << temp[0]\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn output\n\t\tend",
"def parameters_as_array\n @parameters.to_s.split(' ')\n end",
"def param_to_request_array(param)\n case param\n when Array\n param.join(\",\").gsub(/\\s+/, \"\")\n when String, Symbol\n param.to_s.gsub(/\\s+/, \"\")\n else\n raise ArgumentError, \"Expected Array, got #{param.class.name}\"\n end\n end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def separateInArrays params \r\n\tvalidCoupons = Array.new\r\n\torders \t\t = Array.new\r\n\torderItems = Array.new\r\n\tproducts = Array.new\r\n\toutputFile = nil\r\n\r\n\tparams.each do |param|\r\n\t\tcase param\r\n\t\t\twhen 'coupons.csv'\r\n\t\t\t\tverifyIfValidDiscount param, validCoupons\r\n\t\t\twhen 'order_items.csv'\r\n\t\t\t\tpushToArray param, orderItems\r\n\t\t\twhen 'orders.csv'\r\n\t\t\t\tpushToArray param, orders\r\n\t\t\twhen 'products.csv'\r\n\t\t\t\tpushToArray param, products\r\n\t\t\twhen 'output.csv'\r\n\t\t\t\toutputFile = param\r\n\t\t\t\tpushToArray param, orderItems\r\n\t\t\telse\r\n\t\t\t\t# stop program if invalid file is passed\r\n\t\t\t\tputs 'arquivo \"' + param + '\" é inválido! passe arquivos válidos para o programa e tente novamente!'\r\n\t\t\t\tabort\r\n\t\tend\r\n\tend\r\n\t\r\n\treturn validCoupons, orders, orderItems, products, outputFile\r\nend",
"def rewrite_param_values(array_params)\n array_params.each { |param| (param[1] || \"\").gsub! %r/^\"|\"$/, '' }\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def transform_param_list(method, param_list)\n method = :\"params_for_#{method}\"\n param_list.map { |param|\n transform_param(nil, param, method)\n }.compact\n end",
"def getArray _args\n \"getArray _args;\" \n end",
"def mutliplied(array)\nend",
"def massage_param_elements!(params)\n elements = params[:elements]\n params.delete(:elements)\n elements.each{|element|\n params[element.to_sym] = element\n }\n end",
"def transform_params(params, inputs:, set: false)\n raise \"\\n\\nError: inputs should be or behave like an array - inputs.class: #{inputs.class}\\n\\n\" unless inputs.is_a? Array\n\n input_types = inputs.map{ |inp| inp[\"type\"] }\n value = encode input_types, params\n\n value = FRM.from_ascii value\n\n puts \"transform_params - transformed: #{value.inspect}\" if ETH_LOG\n\n value\n # return [] if value.empty?\n #\n # [value]\n end",
"def aumentar(array, aumento, desde, hasta)\n arr_filtro = array[desde..hasta] #rango de los datos filtrados\n arr_filtro.map!{|venta_mensual| venta_mensual * aumento}.sum #valor total por el porcentaje de aumento\nend",
"def param_array(keys)\n puts \"Entering param_array '#{@sy}'\" if DEBUG\n type = nil\n \n if @sy.type == TokenType::ARRAY_TOKEN\n next_token\n if @sy.type == TokenType::OF_TOKEN\n next_token\n type = param_type(keys | Array.follow)\n else\n error(\"Line #{@sy.line_number} expected 'of', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n else\n error(\"Line #{@sy.line_number} expected 'array', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n puts \"Leaving param_array '#{@sy}'\" if DEBUG\n \n TypeNode.new \"array of #{type.type}\"\n end",
"def rewrite_param_values(array_params)\n array_params.each { |param| (param[1] || \"\").gsub! %r/^\"|\"$/, '' }\n end",
"def rewrite_param_values(array_params)\n array_params.each { |param| param.last.gsub! %r/^\"|\"$/, '' }\n end",
"def processes_as_array(processes_parameter)\n return [] if processes_parameter.nil?\n\n return [processes_parameter] unless processes_parameter.is_a?(Array)\n\n processes_parameter\n end",
"def array(method = nil)\n -> (v) do\n if v\n v.split(',').map{|a| cast(a, method) }\n end\n end\n end",
"def array(method = nil)\n -> (v) do\n if v\n v.split(\",\").map{|a| cast(a, method) }\n end\n end\n end",
"def statusArgsToArray( *args )\n dataArray = Array.new\n #\n # If only one argument, then assume its already an array.\n #\n if( args.size == 1 )\n dataArray = args[0]\n #\n # Otherwise, take the individual arguments, create a hash and insert into an array.\n #\n elsif( args.size >= 2 )\n data = { :name => args[0], :value => args[1] }\n if( args.size >= 3 )\n data[:unit] = args[2]\n end\n dataArray.push( data )\n end\n #\n # Return the result.\n #\n return dataArray\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def paramstype\n \"Array\"\n end",
"def tricky_method!(a_string_param, an_array_param)\n a_string_param << \", rutabega\"\n an_array_param << \"rutabega\"\nend",
"def initialize(mesa, *recaudacion) #* toma varios argumentos y permite trabajar con ellos separados pero todos a la vez\n @mesa = mesa\n @recaudacion = recaudacion.map(&:to_i) # todos pasan a entero :& \n end",
"def get_input_field_values(operations)\n io_field_values = []\n operations.each do |op|\n io_field_values += op.input_array(INPUT_ARRAY)\n end\n io_field_values\n end",
"def prepare_data(data)\n i = -1\n buff = get_params(true)\n good_data = []\n data.each do |value|\n if i == -1 # the first value is an id and is not in the params_list\n good_data << value\n i += 1\n next\n end\n if buff[i][:type] == 'bool'\n if value.is_a?(TrueClass) || value == 'true' # translate string to boolean\n good_data << true\n elsif value.is_a?(FalseClass) || value == 'false' # translate string to boolean\n good_data << false\n else\n Utils_errors::critical_error(\"The param #{buff[i][:string].gsub('_', ' ')} had a value of '#{buff[i][:value]}' \\\n(#{buff[i][:value].class.to_s}), it should be 'true' or 'false' (boolean)\")\n end\n else\n good_data << value\n end\n i += 1\n end\n good_data\n end",
"def preprocessing_args(args)\n args.map do |v|\n if v.is_a?(Array) && v.length == 2\n Point.new(*v)\n elsif v.is_a?(Point)\n v\n else\n raise TypeError, \"Arguments should be arrays with coordinates or Points.\"\n end\n end\n end",
"def preprocessing_args(args)\n args.map do |v|\n if v.is_a?(Array) && v.length == 2\n Point.new(*v)\n elsif v.is_a?(Point)\n v\n else\n raise TypeError, \"Arguments should be arrays with coordinates or Points.\"\n end\n end\n end",
"def ordenar(*valores)\r\n valores.sort\r\nend",
"def add_rutabaga_to_array(an_array_param)\n an_array_param << \"rutabaga\"\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\n end",
"def format_arguments(data)\n data_array = []\n data.each_pair do |parameter, argument|\n if argument.is_a? Array\n argument.each do |single_argument|\n data_array << \"#{parameter}=#{single_argument}\"\n end\n else\n data_array << \"#{parameter}=#{argument}\"\n end\n end\n data = data_array.join(\"&\")\n return data\n end",
"def to_a\n self.class.operands.inject([]) do |result, (param_name, param_options)|\n result << instance_variable_get(\"@#{param_name}\")\n result\n end\n end",
"def to_params params\n Array(params).inject({}) do |memo,entry|\n key, value = entry\n if value.is_a?(Array)\n key = \"#{key}[]\"\n end\n memo[key] = value\n memo\n end\n end",
"def Array(p0) end",
"def array_translate(array)\n # Write your code here\nend",
"def preprocess_args(*a)\n a\n end",
"def compileparameterlist\n\n end",
"def args_from_params(query_params)\n [\n *criteria_args_from_params(query_params),\n *search_args_from_params(query_params),\n *pagination_args_from_params(query_params),\n *sorting_args_from_params(query_params),\n query_params[:aggregation_type_id].present? ? query_params[:aggregation_type_id] : 1\n ]\n end",
"def g *args # accept multiple arguments as an array\n\targs # returns an array\nend",
"def productify(array)\n\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += 'rutabaga'\n an_array_param += ['rutabaga']\n\n return a_string_param, an_array_param\nend",
"def sql_function_args(args)\n \"(#{Array(args).map{|a| Array(a).reverse.join(' ')}.join(', ')})\"\n end",
"def check_array_value(field, params)\n @properties[field] = params[field].present? ? params[field].split(\",\") : []\n end",
"def basic_clasificator origen,dpworld_data,stwd_data,hit_data\n origen.each do |params|\n\tputs \"FILA: #{params.to_s}\"\n $LOG.debug \" LIBERACION: #{params.to_s}\"\n case [ params['ptocreacion'] , params['solvenciaNotifId'] ]\n when ['DOCAU',1]\n dpworld_data << ReleaseCaucedo.new( params )\n when ['DOCAU',4]\n stwd_data << ReleaseSTWD.new( params )\n when ['DOHAI',2]\n\t hit_data << ReleaseHIT.new( params )\n end\n end\n [dpworld_data,stwd_data,hit_data]\nend",
"def compiled_params\n params_array = []\n params_array << \"l1=#{escape(@params[:from])}\" if @params[:from]\n params_array << \"l2=#{escape(@params[:to])}\" if @params[:to]\n params_array << \"d1=#{escape(@params[:depart])}\" if @params[:depart]\n params_array << \"d2=#{escape(@params[:return])}\" if @params[:return]\n params_array.join('&')\n end",
"def _pg_array(v)\n v.to_ary.map do |i|\n if i.respond_to?(:to_ary)\n _pg_array(i)\n elsif i\n if @conversion_proc.nil?\n @conversion_proc = @conversion_proc_method.call(i)\n end\n if @conversion_proc\n @conversion_proc.call(i)\n else\n i\n end\n else\n i\n end\n end\n end",
"def procesa_filtrosm(que1, tablas1, where1, que3, \n tablas3, where3)\n @estfiltrosm.each do |e, r|\n if (params[:filtro] && params[:filtro][r[:nomfiltro]] && \n params[:filtro][r[:nomfiltro]] != '') \n if r[:metodo_id] == :id\n ids = r[:coleccion].where(\n id: params[:filtro][r[:nomfiltro]].select{|x| x!= ''}.\n map(&:to_i)\n ).pluck(:id)\n else # e.g sexo\n ids = r[:coleccion].map(&:last).select {|id| \n id && id.to_s != '' && params[:filtro][r[:nomfiltro]].\n map(&:to_s).include?(id.to_s)\n }\n end\n if ids.count == 0\n where1 = ampliar_where_sinap(where1, 'TRUE', 'FALSE', '=')\n else\n where1 = procesa_un_filtrom(where1, r, ids)\n end\n end\n\n end\n\n return [que1, tablas1, where1, que3, tablas3, where3]\n end",
"def name_array(name1, name2)\n real_name_array = [name1, name2]\n real_name_array\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n \n return a_string_param, an_array_param\nend",
"def refactor_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def args_to_params(sexp)\n result = []\n sexp.each do |arg|\n if arg[0] == :lasgn\n ref = variable(arg[1])\n scope.add_arg ref\n result << ref\n elsif arg[0] == :array\n result << scope.next_temp\n else\n raise \"Bad js_block_arg: #{arg[0]}\"\n end\n end\n\n result\n end",
"def not_so_tricky_method(string_param, array_param)\n string_param += \"rutabaga\"\n array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def c_build_args(mne, tokens, field_format)\n args_a = []\n\n tokens.each{|t|\n\n if (field_format.include?(t))\n pc = field_format[t][1]\n field_args = pc ? \"pc,op\" : \"op\"\n args_a << \"get#{t}(#{field_args})\"\n end\n }\n\n return args_a\nend",
"def create\n @tablero = Tablero.new(tablero_params)\n m= params.require(:tablero).permit(:idusuario, :grupo, :descripcion, :e1, :e2, :e3, :puntaje)\n\n params[idusuario.each] do |i|\n miembros=[params[:idusuario[i]]:grupo[i], :descripcion[i], :e1[i], :e2[i], :e3[i], :puntaje[i]]\n end\n\n respond_to do |format|\n if @tablero.save\n format.html { redirect_to @tablero, notice: \"El tablero se creó correctamente\" }\n format.json { render :show, status: :created, location: @tablero }\n else\n format.html { render :new }\n format.json { render json: @tablero.errors, status: :unprocessable_entity }\n end\n end\n end",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += 'rutabaga'\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def getPriceFormArray(array, iva)\n return array.map { | item | getPrice(item, iva) }\nend",
"def cast_array_for_args\n <<-CODE\n next_int;\n c->args = _int;\n t1 = stack_pop();\n if(REFERENCE_P(t1) && object_kind_of_p(state, t1, global->tuple)) {\n t1 = array_from_tuple(state, t1);\n } else if(!REFERENCE_P(t1) || !object_kind_of_p(state, t1, global->array)) {\n t2 = array_new(state, 1);\n array_set(state, t2, 0, t1);\n t1 = t2;\n }\n stack_push(t1);\n c->args += N2I(array_get_total(t1));\n CODE\n end",
"def js_parms(params) params.map { |p| marshal p }.join(COMMA) end",
"def transform_values!; end",
"def compute_query_api_pattern_array_data(query_api_method_name, source, params_with_defaults, used_query_params)\n result = source.dup\n source.dup.each_with_index do |item, idx|\n value = compute_query_api_pattern_param(query_api_method_name, item, params_with_defaults, used_query_params)\n value == Utils::NONE ? result.delete_at(idx) : result[idx] = value\n end\n result\n end",
"def update\n\n if not params[:treino][:atividade_ids].present?\n params[:treino][:atividade_ids] = []\n end\n\n #Recuperar os valores do array de array.\n #Tratamento para evitar o erro na atualizacao do treinos.Estava excluindo as atividades do treino Muscular.\n @result = Atividadetreino.joins('JOIN atividades on atividadetreinos.atividade_id = atividades.id').where('atividades.tipo' => 'A')\n @result.each do |res|\n params[:treino][:atividade_ids].push(res.atividade_id)\n end\n\n #********************************************\n #Gravando as ordens para os Treinos Aerobicos\n #********************************************\n setOrdensTreinos(:aerobico)\n\n #********************************************\n #Gravando as ordens para os Treinos Neurologicos\n #********************************************\n setOrdensTreinos(:neuro)\n\n respond_to do |format|\n if @treino.update(treino_params)\n format.html { redirect_to @treino, notice: 'Treino atualizado!' }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def create_array(one, two, three)\n\treturn [one, two, three]\nend",
"def add_to_array(var1, *others)\n\tcurrent_arr = [var1, *others]\n\tcurrent_arr = current_arr.flatten\n\tp current_arr\nend",
"def build_collection_param(param, collection_format)\n case collection_format\n when :csv\n param.join(',')\n when :ssv\n param.join(' ')\n when :tsv\n param.join(\"\\t\")\n when :pipes\n param.join('|')\n when :multi\n # return the array directly as typhoeus will handle it as expected\n param\n else\n fail \"unknown collection format: #{collection_format.inspect}\"\n end\n end",
"def build_collection_param(param, collection_format)\n case collection_format\n when :csv\n param.join(',')\n when :ssv\n param.join(' ')\n when :tsv\n param.join(\"\\t\")\n when :pipes\n param.join('|')\n when :multi\n # return the array directly as typhoeus will handle it as expected\n param\n else\n fail \"unknown collection format: #{collection_format.inspect}\"\n end\n end",
"def build_collection_param(param, collection_format)\n case collection_format\n when :csv\n param.join(',')\n when :ssv\n param.join(' ')\n when :tsv\n param.join(\"\\t\")\n when :pipes\n param.join('|')\n when :multi\n # return the array directly as typhoeus will handle it as expected\n param\n else\n fail \"unknown collection format: #{collection_format.inspect}\"\n end\n end",
"def build_collection_param(param, collection_format)\n case collection_format\n when :csv\n param.join(',')\n when :ssv\n param.join(' ')\n when :tsv\n param.join(\"\\t\")\n when :pipes\n param.join('|')\n when :multi\n # return the array directly as typhoeus will handle it as expected\n param\n else\n fail \"unknown collection format: #{collection_format.inspect}\"\n end\n end",
"def build_collection_param(param, collection_format)\n case collection_format\n when :csv\n param.join(',')\n when :ssv\n param.join(' ')\n when :tsv\n param.join(\"\\t\")\n when :pipes\n param.join('|')\n when :multi\n # return the array directly as typhoeus will handle it as expected\n param\n else\n fail \"unknown collection format: #{collection_format.inspect}\"\n end\n end",
"def process_params(entity)\t\n\t\tparams=prepare_base_params()\n\t\tentity.each do |key,value|\t\t\t\t\t\n\t\t\tadd_params(params,key.to_s,value.to_s)\tif ! ( key.to_s.eql?(\"optional\") || key.to_s.eql?(\"multiple\"))\n\t\tend\t\t\n\t\treturn params\n\tend",
"def params(*); {}; end",
"def param_list\n if @call_seq then\n params = @call_seq.split(\"\\n\").last\n params = params.sub(/.*?\\((.*)\\)/, '\\1')\n params = params.sub(/(\\{|do)\\s*\\|([^|]*)\\|.*/, ',\\2')\n elsif @params then\n params = @params.sub(/\\((.*)\\)/, '\\1')\n\n params << \",#{@block_params}\" if @block_params\n elsif @block_params then\n params = @block_params\n else\n return []\n end\n\n if @block_params then\n # If this method has explicit block parameters, remove any explicit\n # &block\n params = params.sub(/,?\\s*&\\w+/, '')\n else\n params = params.sub(/\\&(\\w+)/, '\\1')\n end\n\n params = params.gsub(/\\s+/, '').split(',').reject(&:empty?)\n\n params.map { |param| param.sub(/=.*/, '') }\n end",
"def transform_Array(o, scope)\n o.map{|x| transform(x, scope) }\n end",
"def array_index (letras = 'f, g, h')\r\n\tputs letras\r\nend",
"def _array(obj)\n obj.map { |v| _renc(v) }\n end",
"def param_list(param)\n if params[param].blank?\n nil\n else\n params[param].split(',')\n end\n end",
"def not_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def multiple(sql, values = [])\n r = $db.exec_params(sql, values)\n return [] if r.ntuples == 0\n r.map { |row| convert_to_ruby_types(row) }\nend"
] |
[
"0.672856",
"0.6564216",
"0.6515357",
"0.6462002",
"0.6156554",
"0.61270934",
"0.6098941",
"0.60718465",
"0.60718465",
"0.60718465",
"0.6023961",
"0.6010657",
"0.59756786",
"0.5940247",
"0.5933365",
"0.5868176",
"0.5858322",
"0.5839578",
"0.58332247",
"0.5826651",
"0.58243734",
"0.5802113",
"0.5796769",
"0.57528406",
"0.5744856",
"0.57291913",
"0.56625885",
"0.56545806",
"0.56255865",
"0.56094587",
"0.560833",
"0.56051296",
"0.5578072",
"0.5516327",
"0.55125916",
"0.5491168",
"0.5490451",
"0.5481566",
"0.5481566",
"0.54792595",
"0.5465474",
"0.54424775",
"0.5440016",
"0.54377115",
"0.5435144",
"0.5424614",
"0.5399638",
"0.53951865",
"0.5394674",
"0.5390036",
"0.5385238",
"0.5366223",
"0.535627",
"0.5351337",
"0.5348843",
"0.53484535",
"0.53337234",
"0.532948",
"0.53217304",
"0.5320189",
"0.5312472",
"0.5310828",
"0.5303632",
"0.5300036",
"0.52995765",
"0.5294246",
"0.52921516",
"0.52919227",
"0.52891713",
"0.5274691",
"0.52721596",
"0.52719027",
"0.52658427",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.5258108",
"0.525395",
"0.5244775",
"0.5242299",
"0.5242299",
"0.5242299",
"0.5242299",
"0.5242299",
"0.5230104",
"0.5229937",
"0.5224487",
"0.52226055",
"0.5219763",
"0.52139",
"0.5213442",
"0.52126694",
"0.52061415"
] |
0.0
|
-1
|
searchable do text :title do NetworkKanjiFilter.to_hiragana(title) end text :title_en end
|
def first_release
self.releases.where(status: STATUS[:completed]).first
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def searchtitle\n end",
"def title_for_search\n (title || \"\").strip.sub(/\\Athe\\s+/i, \"\").sub(/\\Aan?\\s+/i, \"\")\n end",
"def to_search_string\n\t\tself.title\n\tend",
"def slogan\n search_by_text 'слоган'\n end",
"def title_en\n search_by_itemprop 'alternativeHeadline'\n end",
"def search\n # query_param = params[:query].downcase\n # @found_articles = Article.all.where(\"lower(title) LIKE :query\", query: query_param)\n # render \"search\"\n end",
"def index\n show_icons\n @search = params[:search] || \"\"\n\n if @search.present?\n @titles = Title.all.where(\"lower(name) like lower(?)\",\"%#{@search}%\").paginate(page: params[:page], per_page: 30).order('id desc')\n else\n @titles = Title.all.paginate(page: params[:page], per_page: 30).order('id asc')\n end\n\n end",
"def search_string\n [self.title].join(' ')\n end",
"def searchdescription\n end",
"def index\n gon.scripts = Script.all.map(&:title)\n @query = Script.search do\n fulltext params[:find]\n end\n @scripts = @query.results\n end",
"def search_search_text\n query\n .where(localized_search_text_in(:title), text: \"%#{search_text}%\")\n .or(query.where(localized_search_text_in(:description), text: \"%#{search_text}%\"))\n end",
"def search\n\t\t@articles = Article.where(\"text = ?\",params[:q])\n \n #Article.find_by_text(params[:q])\n \n #debug\n @articles.each do |article|\n puts article.title\n end\n \n \n\t\t#@articles = Article.where(:text => params[:q]) ' 1=1 -- '\n\n\t\t#@articles = Article.where(\"text = ?\", params[:q] )\n \n \n #TODO\n # add filter for other fields\n # Article.where(\"text = ? and title = ?\",params[:text],params[:title])\n \n # to add LIKE filter SQL : name like %aa%\n # \"name LIKE ? OR postal_code like ?\", \"%#{search}%\", \"%#{search}%\"\n \n end",
"def index\n @hoteles = Hotele.where([\"nombre LIKE ?\",\"%#{params[:search]}%\"])\n end",
"def auto_complete_for_journal_title\n # Don't search on blank query.\n query = params['rft.jtitle']\n search_type = params[\"umlaut.title_search_type\"] || \"contains\"\n unless ( query.blank? )\n (context_objects, total_count) = find_by_title\n @titles = context_objects.collect do |co|\n metadata = co.referent.metadata\n {:object_id => metadata[\"object_id\"], :title => (metadata[\"jtitle\"] || metadata[\"btitle\"] || metadata[\"title\"])}\n end\n end\n render :text => @titles.to_json, :content_type => \"application/json\"\n end",
"def index\n # @search = Shelter.search do\n # fulltext params[:search]\n # end\n # @shelters = @search.results\n @shelters = Shelter.all\nend",
"def index\n if params[:search]\n @tutorials = Tutorial.search(params[:search]).order(\"created_at DESC\")\n else\n @tutorials = Tutorial.all.order('created_at DESC')\n end\n=begin\n #for sunspot\n @search = Tutorial.search do\n fulltext params[:search]\n end\n @tutorials = @search.results\n=end\n end",
"def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end",
"def make_title_searchable\n address = create_title_addressbase_data(@title)\n create_elasticsearch_addressbase_data(address)\n sleep($ELASTICSEARCH_SLEEP.to_f) # elasticsearch changes take a moment\n create_lr_urpn_mapping_data(@title[:lr_uprns])\nend",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = LentColor.ransack(params[:q]) \n @query.name_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @lent_colors = @results \n end",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = LentType.ransack(params[:q]) \n @query.name_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @lent_types = @results \n end",
"def titles_search\n @query = params[:query]\n @titles = Title.search(@query)\n\t @titles = @titles.paginate(:page => params[:titles_page], :per_page => 5)\n\t # @cart = get_cart\n\t respond_to do |format|\n format.html { render :action => \"index\" }\n format.xml { render :xml => @titles }\n end\n end",
"def index\n @entities = Entity.any_of( { :title => /.*#{params[:search]}.*/i } )\n end",
"def search\n\n end",
"def index\n @titles = Title.search(params[:search], params[:page])\n end",
"def index\n unless params['body']['search'].blank?\n @countries = Country.where([\"name ILIKE ?\",\"%#{params['body']['search']}%\"])\n else\n @countries =Country.order('created_at ASC')\n end\n end",
"def index\n @kai2_ji7s = Kai2Ji7.where('\"無齊記號\" LIKE ?','%*%*%*%*%*%').order('LENGTH(REPLACE(\"無齊記號\",\\'\\n\\',\\'\\')) ASC').limit(100)\n end",
"def index\n filter = params[:searchString] || ''\n filter = filter.tr('^A-Za-zА-Яа-я0-9', '')\n if not filter.blank?\n @tags = Tag.where('lower(name) like ?', \"%#{filter.mb_chars.downcase.to_s}%\").order(:name)\n else\n @tags = Tag.all\n end\n end",
"def parse_search; end",
"def search\n \n coupones = Coupone.where(\"description LIKE ?\", \"%#{params[:description]}%\");\n\n if coupones.empty? \n head :not_found\n return\n end\n\n \n\n respond_with coupones, status: :ok \n \n end",
"def index\n @tvshows = Tvshow.all\n if params[:search].present?\n @tvshows = @tvshows.where(\"(lower(title) like ?)\",\"%#{params[:search].strip.downcase}%\")\n end\n end",
"def search_title_builder\n\t\tif search_params_present?\n\t\t\ttitle = \"Searching Flights\"\n\t\t\ttitle += \" Departing #{ @airport_options[params[:origin].to_i - 1][0] }\" if params[:origin].present?\n\t\t\tif params[:destination].present?\n\t\t\t\tif params[:origin].present?\n\t\t\t\t\ttitle += \" for \"\n\t\t\t\telse\n\t\t\t\t\ttitle += \" to \"\n\t\t\t\tend\n\t\t\t\ttitle += \"#{ @airport_options[params[:destination].to_i - 1][0] }\"\n\t\t\tend\n\t\t\ttitle += \" on #{ params[:departure] }\" if params[:departure].present?\n\t\t\ttitle += \" for #{ params[:passengers] }\" if params[:passengers].present?\n\t\t\treturn title\n\t\telse\n\t\t\ttitle = \"Search Flights\"\n\t\tend\n\tend",
"def search_text(query, text)\n text = pattern(text)\n query.where { title.ilike(text) | description.ilike(text) }\n end",
"def show\n @anns = Ann.search(@search.keywords)\n end",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = TypeClient.ransack(params[:q]) \n @query.name_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @type_clients = @results \n end",
"def autocomplete\n unless /\\A#.+/.match(params[:query])\n @mindlogs = Mindlog.search(params[:query], where:{workflow_state:\"published\"},fields: [:title,{title: :text_start}], limit: 10).as_json(only:[:id,:title]) \n end\n render json: @mindlogs\n end",
"def index\n\n @avisos = Aviso.order(\"fecha DESC\").page(params[:page]).per(15)\n if params[:term]\n palabra= \"%#{params[:term]}%\"\n @avisos = Aviso.where(\"nombre LIKE ?\",palabra).order(\"fecha DESC\").page(params[:page]).per(15)\n end\n\n end",
"def lookup_text\n\t\t$app.data_controller.search_matching_links_to @search_text\n\tend",
"def search\n\n end",
"def search\n @adverts = []\n query = (params[:search])\n query.split(' ').each do |keyword|\n @adverts += Advert.where(\"title ILIKE :search\", { search: \"%#{keyword}%\" })\n end\n render json: @adverts\n end",
"def search_ranked\n render json: Article.with_ranked_terms(params[:query]).map(&:title)\n end",
"def search \n\n end",
"def search\n if params[:term]\n @shops = Shop.where(\"title like '%\"+params[:term]+\"%'\")\n else\n @shops = Shop.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end",
"def index\n\n @title = t(\"h2.categories\")\n @search = Category.search(params[:search])\n\n p @search\n unless params[:keyword].blank?\n p 222222222222222222222\n name = split_keyword(params[:keyword])\n \n @search.name_like = params[:keyword]\n # @search.or_content_like = name\n # @search.or_email_like = name\n end\n\n# Article.where((:name =~ 'Hello%') | (:content =~ 'Goodbye%')).to_sql\n\n\n @categories = @search.paginate(:page => params[:page])\n\n # @categories = Category.where(:name => '123').paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 1)\n # @categories = Category.find(:all ,:conditions => [\"name like ? \" ,'%12%']).paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 1)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end",
"def data\n what = searched_for(@term)\n where = searched_in(@filter)\n {\n term: @term,\n title: (what + where).sub(/\\sin\\s|\\sfor\\s/, ''), # strip out opening ' in ' or ' for '\n cpvs: @cpvs,\n keywords: @term,\n countries: @filter.countries,\n what: what,\n where: where,\n }\n end",
"def extract_work_title_display\n \ttitle_display_array = {}\n self.find_by_terms(:vra_work,:titleSet,:titleSet_display).each do |title_display|\n ::Solrizer::Extractor.insert_solr_field_value(title_display_array, \"title_display_tesim\", title_display.text) \n end\n return title_display_array\n end",
"def search\r\nend",
"def search; end",
"def search\n if params[:titulo]\n\n @articles = Article.titulo(params[:titulo])\n\n else\n\n @articles = Article.all\n\n end\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search(query); end",
"def title(result)\n result.link(Selectors::FAST_SEARCH_MODAL[:result][:title]).text\n end",
"def search(word)\n \n end",
"def search\n end",
"def autocomplete_book_author\n# re = Regexp.new(\"^#{params[:user][:favorite_language]}\" , \"i\" )\n # @books= Book.find_all do |book|\n # book.title.match re\n # end\n # render :layout=>false\n end",
"def index\n @q = Hotel.ransack(search_params)\n\n search_params.each_pair { |key, value|\n @key = \"#{key}\"\n @value = \"#{value}\"\n break # 先頭の条件のみ\n }\n\n sql = @q.result.to_sql\n if params[:q][\"s\"] then\n sql = sql + \" order by \"+ params[:q][\"s\"]\n sql.gsub!(\"\\\"\",\"\")\n else\n sql = sql + \" order by updated_at desc limit 10\"\n end\n @hotels = Hotel.find_by_sql(sql)\n # if @hotels then\n # @message = \"お探しの民泊施設は見つかりませんでした\"\n # end\n # @hotels = Hotel.all\n @comment = Comment.new\n end",
"def search\nend",
"def search\n if params[:query]\n query = \"%#{params[:query].downcase}%\"\n @events = Event.where(\"lower(title) LIKE :query or lower(description) LIKE :query\", :query => query)\n end\n\n respond_to do |format|\n format.html\n format.json { render 'events/index' }\n end\n end",
"def extract_image_title_display\n \ttitle_display_array = {}\n self.find_by_terms(:vra_image,:titleSet,:titleSet_display).each do |title_display|\n ::Solrizer::Extractor.insert_solr_field_value(title_display_array, \"title_display_tesim\", title_display.text) \n end\n return title_display_array\n end",
"def show_title\n h2 { h @title.titles }\n text gs_title(@title)\n sources = []\n sources << a('Anime News Network Encyclopdia', :href => \"http://www.animenewsnetwork.com/encyclopedia/anime.php?id=#{@title.ann_id}\") unless @title.ann_id.nil?\n sources << a('AniDB', :href => \"http://anidb.net/perl-bin/animedb.pl?show=anime&aid=#{@title.anidb_id}\") unless @title.anidb_id.nil?\n \n unless sources.empty?\n p { \"View #{h @title.title} in #{sources.join(\", \")}.\" }\n end\n end",
"def to_param\n wiki_title(false)\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def italy\n end",
"def index\n @admin_terms = Admin::Term.search(params[:query]).order('lower(title) ASC').page(params[:page]).per(32)\n #@admin_terms = Admin::Term.all\n end",
"def index\n @categories = Category.where(\"lower(name) like :search\", {search: '%' + params[:search].to_s.downcase + '%'}).\n order(\"created_at desc\").page(params[:page]).per_page(50)\n respond_to do |format|\n format.html\n format.rss { render :layout => false }\n format.xml\n format.json { render json: @categories }\n end\n end",
"def index()\n @counter = 0\n searchword = params[:search]\n searchgenre = params[:selected_val]\n\n if searchword\n if searchgenre == \"内容\"\n @plans = Plan.where([\"content LIKE ?\", \"%#{searchword}%\"]) #コンテント用\n elsif searchgenre == \"ハッシュタグ\"\n @plans = Plan.where([\"content LIKE ?\", \"%##{searchword}%\"]) #ハッシュタグ用\n end\n render\n else\n @plans = Plan.all\n end\n end",
"def search\n @institutions = Institution.order(:nome).where(\"nome ilike ?\", \"%#{params[:term]}%\")\n render json: @institutions.map{|institution| {:label => institution.nome, :value => institution.id}}\n end",
"def search(word)\r\n \r\n end",
"def index\n # (This uses Squeel DSL syntax for where clauses)\n if params[:title_like]\n filter = \"%#{params[:title_like]}%\"\n @trainings = Training.where( [\"title LIKE ?\", filter] )\n .order( 'updated_at DESC', 'title' )\n else\n @trainings = Training.order( :title ).all\n end\n render status: 200, json: @trainings\n end",
"def search_title_scrape\n @doc.search('b')[2..6].each do |name|\n @names << name.text\n end\n search_description_scrape\n end",
"def show\n \n \n \n title = Title.find(params[:id])\n params[:query] = title.title\n \n breadcrumbs.add 'TITLES', titles_path(:queryTitleId=>params[:id])\n breadcrumbs.add params[:query].upcase\n \n shelf0 = []\n shelf0 << title\n @shelf_name= title.title\n \n newSearch = Sunspot.new_more_like_this(title, Title) do\n facet(:category_id, :publisher_id, :author_id)\n end\n \n newSearch.build do \n with(:category_id, params[:cat_id]) \n end if params[:cat_id].to_i > 0\n\n newSearch.build do \n with(:publisher_id, params[:facetPublisher]) \n end if params[:facetPublisher].to_i > 0\n\n newSearch.build do \n with(:author_id, params[:facetAuthor]) \n end if params[:facetAuthor].to_i > 0\n newSearch.build do \n with(:branch).any_of Title::BRANCH\n end\n searchResults = newSearch.execute\n searchResults.results.each do |sr|\n shelf0 << sr\n end\n @shelf0 = shelf0.paginate(:page => params[:page], :per_page => 9)\n# @searchResults = Sunspot.more_like_this(@title, Title) do\n# fields :title, :publisher, :author\n# paginate(:page => params[:page], :per_page => 15)\n# facet(:category_id, :publisher_id, :author_id)\n# end\n end",
"def index\n @search = MicrornaPatient.search do\n fulltext params[:query_microrna_patient]\n end\n \n @microrna_patients = @search.results\n \n \n respond_to do |format|\n format.html\n format.json { render :json => @microrna_patients.map(&:attributes) }\n end\nend",
"def search\n unless params[:search].blank?\n @search = Sunspot.search(KyuEntry) do\n fulltext params[:search]\n end\n @kyu = @search.results\n end\n end",
"def index\n unless params['body']['search'].blank?\n @cities = City.where([\"name ILIKE ?\",\"%#{params['body']['search']}%\"])\n else\n @cities = City.order('created_at ASC')\n end\n end",
"def japanese\n @restaurants = Restaurant.where(category: 'Japanese')\n end",
"def index\n @q = Idea.ransack(params[:q])\n @search_field = :title_cont\n if params[:q].present?\n @ideas = @q.result(distinct: true)\n else\n @ideas = Idea.all\n end\n # respond_with @ideas\n respond_to do |format|\n format.html\n format.json { render json: @ideas }\n end\n end",
"def index\n if (params[:search].nil? || params[:search].empty?)\n @audiovisuais = Audiovisuai.paginate :page => params[:page], :order => 'titulo ASC', :per_page => 15\n $var = 0\n else\n @audiovisuais = Audiovisuai.find(:all, :conditions => [\"titulo like ?\", \"%\" + params[:search].to_s + \"%\"], :order => 'titulo ASC')\n $var = 1\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @audiovisuais }\n end\n end",
"def index\n @page_title = \"Nos podcasts\"\n @page_description = \"Consulter les podcasts\"\n @page_keywords = \"Podcasts, enseignements, Parole de Dieu\"\n @search = Podcast.ransack(params[:q])\n @podcasts = @search.result(distinct: true) #result #Podcast.all\n end",
"def full_text_search\n @attributes[:full_text_search]\n end",
"def query(keyword)\n return unless keyword\n\n where(\"title ILIKE '%?%'\", keyword)\n end",
"def search(search_term)\n results = Content.where('status_id=2 and lower(sub_title) = lower(?)', search_term)\n to_ext_json(results)\n end",
"def getSearchURL itemName, itemType\n itemEncoded = URI.encode itemName\n if itemType == 'title'\n return ROOT_URL + 'find?q=' + itemEncoded + '&' + QPARAMS_TITLE_SEARCH\n end\nend",
"def query\n Riddle::Query.escape params[:search_txt]\n end",
"def set_to_param_with_title\n Category.class_eval do\n def to_param\n title.downcase\n end\n end\n end",
"def search_search_text\n query\n .where(\"decidim_opinions_opinions.title ILIKE ?\", \"%#{search_text}%\")\n .or(query.where(\"decidim_opinions_opinions.body ILIKE ?\", \"%#{search_text}%\"))\n end",
"def auto_complete_for_recipeSearch_description\n criteria = '%' + params[:recipeSearch][:description] + '%'\n @recipes = Recipe.find(:all, \n :conditions=>[\"title like ? OR description like ?\",criteria, criteria],\n :order=>'title desc', :limit=>10)\n render :partial=> \"recipes\" \n end",
"def prefix_search\n @tags = Tag.where(\"name LIKE :prefix\", prefix: \"#{params.permit(:s)[:s]}%\")\n render json: @tags.collect{|tag| tag.strip}\n end",
"def title=(text); end",
"def title=(text); end",
"def search\n begin\n words= params[:search][:qw].strip\n @query_info=words\n\n # search in the descriptions\n @videos=VMetadata.search(words, :page => params[:page], :per_page => @@per_page,\n :match_mode => :any, :rank_mode => :proximity_bm25)\n\n respond_to do |format|\n format.html { render 'query/show' }\n end\n rescue ActiveRecord::RecordNotFound\n render(:file => \"#{Rails.root}/public/404.html\",\n :status => \"404 Not Found\")\n end\n end",
"def search_params search\n search = Hash.new\n [:writing, :kana, :romaji, :def_de, :def_en, :def_fr].each do |field|\n search[field] = \"%#{params[:search]}%\"\n end\n search\n end",
"def index\n @natulangs = Natulang.all\n\n @text = History.last.content\n\n @msg = Moji.type(\"漢\")\n \n nlp = NLP.new()\n \n #@msg = nlp.cut_morph(@text)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @natulangs }\n end\n end",
"def search_wikipedia\n respond_to do |format|\n format.html do\n @wikipedia_search_text = params[:artist_name]\n meta = MetaGeneration.new(Setting.get_settings)\n @wikipedia_search = meta.search_text(@wikipedia_search_text, 10)\n render 'search_wikipedia.html', layout: false\n end\n end\n end"
] |
[
"0.70106524",
"0.6777615",
"0.6683918",
"0.6529928",
"0.6506478",
"0.6476711",
"0.64364284",
"0.6310106",
"0.6304922",
"0.62525785",
"0.6210233",
"0.6175444",
"0.61528605",
"0.6132699",
"0.6105639",
"0.6077407",
"0.6065755",
"0.6015742",
"0.6015142",
"0.60107875",
"0.59802616",
"0.59561217",
"0.5956021",
"0.59494156",
"0.59449214",
"0.59418964",
"0.5936367",
"0.5904858",
"0.59043",
"0.59006745",
"0.58975935",
"0.5889583",
"0.5886924",
"0.58824986",
"0.5879394",
"0.58780277",
"0.5836007",
"0.5822433",
"0.58221626",
"0.58211076",
"0.58199525",
"0.58137476",
"0.5809269",
"0.57979804",
"0.5794682",
"0.5785899",
"0.5777079",
"0.5772723",
"0.5772254",
"0.5772254",
"0.5772254",
"0.5772254",
"0.5772254",
"0.5772254",
"0.5772254",
"0.5772254",
"0.5772254",
"0.5772254",
"0.5770624",
"0.57595474",
"0.57459915",
"0.571697",
"0.5716695",
"0.5706079",
"0.57049954",
"0.56983936",
"0.56865954",
"0.56858814",
"0.5684179",
"0.56815016",
"0.5661867",
"0.56429577",
"0.56321794",
"0.5622137",
"0.56217676",
"0.56165695",
"0.56106454",
"0.5603447",
"0.55972236",
"0.5594086",
"0.5588444",
"0.55813026",
"0.55752575",
"0.55746263",
"0.55695176",
"0.55672",
"0.55662644",
"0.55609065",
"0.5556634",
"0.55550337",
"0.55550313",
"0.55497384",
"0.55469626",
"0.5544607",
"0.5538044",
"0.5536884",
"0.5536884",
"0.55336016",
"0.5527304",
"0.5526163",
"0.5523425"
] |
0.0
|
-1
|
Feel free to google "how to generate a random number in ruby" using the random
|
def roll
# code goes here
1 + rand(6)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_number\r\n return randomNumber = 1 + rand(100)\r\n end",
"def rand\n return extract_number / (2**32 -1).to_f\n end",
"def random\n 1 + (10 * rand(0))\n end",
"def gen_num\n rand(1..100)\nend",
"def random_number\n t = Time.now.to_f / (Time.now.to_f % Time.now.to_i)\n random_seed = t * 1103515245 + 12345;\n (random_seed / 65536) % 32768;\nend",
"def random_number\n rand(0..20)\n end",
"def srand(num=0) end",
"def random_num_generator\n return rand(1..100)\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def random_no\n rand(5000)\nend",
"def get_random_number()\n rand(0x7fffffff).to_s\nend",
"def randomizer\n number = rand(0..1)\n return number\nend",
"def generate_random_number\n rand(1..6) + 1\nend",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 1000\r\n return randomNo = 1 + rand(1000)\r\n \r\n end",
"def random_number\n rand(1..20)\nend",
"def random_number \n rand(6) + 1 \nend",
"def random_number\n rand 0..20\nend",
"def generate_random_number\n (1..10).to_a.sample\nend",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 100\r\n return randomNo = 1 + rand($maxChallengeRange)\r\n \r\n end",
"def generate_number\n \n #generate and return a random number from 1 to 100\n return randomNO = 1 + rand(1000)\n\n end",
"def get_random\n File.read(\"/dev/urandom\", 8).unpack(\"H*\")[0].hex\n rescue\n rand(9117854927)\n end",
"def generate_one_random_number()\r\n @l = @total_no_of_bits + 1\r\n bit_string = @total_sequence.join('')\r\n numerator = bit_string.to_i(2)\r\n random_number = numerator *1.0 / 2**@l\r\n\r\n return random_number\r\n end",
"def make_not_so_random!\n srand 1213\nend",
"def number_generator\n rand(1..20)\n end",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def randomNum()\r\n num = rand(1..10)\r\nend",
"def rand_digit #generate random digit\n\treturn rand(10)\nend",
"def random_int(max)\n rand(max)\nend",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def pick_random_number(digits=1)\n min = 10 ** (digits - 1)\n max = (10 ** digits ) - 1\n semirandom = min + rand(max-min)\n semirandom += 1 if semirandom == 666 #would be unpleasant to receive...\n return semirandom\n end",
"def nostalgia; return rand end",
"def generate_random()\n begin\n r = Kernel.rand()\n end while r == 0.0\n \n if use_flt?\n BigDecimal(r.to_s)\n else\n r\n end\n end",
"def get_random_number\n\t\trandom_num = rand(@deck.length)\n\tend",
"def get_random_number(max_value = 10)\n\trand(max_value)\nend",
"def random\n rand - rand\nend",
"def getRand()\n # With 32-bit MAX_INT to be able to have cool numbers\n return Random.rand() * 2147483647;\nend",
"def random_float\n rand * rand(10)\n end",
"def rand_nr\n return rand(1..2)\nend",
"def rand\n Kernel.rand(self)\n end",
"def random_num(min, max)\n rand(max - min + 1) + min\nend",
"def random(range)\n return rand(range + 1)\nend",
"def random_num(min, max)\n rand(max - min + 1) + min\nend",
"def make_rand\n Random.new_seed\n return Random.new\n end",
"def digit\n rand(10)\n end",
"def random_number(min, max)\n rand(max-min+1)+min\n end",
"def get_rand range\n\t\t@random_number = rand(range)\n\tend",
"def rand\n warn \"STUB: rand in distribution.rb\"\n end",
"def uniform_int(n)\n (rand()*n).to_i\nend",
"def get_new_random_number random_numbers\n random_number = 0\n begin\n random_number = rand @working_dataset.get_dataset_size\n end while (random_numbers.has_key?(random_number))\n random_numbers[random_number] = 1\n return random_number\n end",
"def any_number(*options)\n number = (rand(2 * MAX_RAND) - MAX_RAND).to_f/100.0\n if options.include? :positive\n number + MAX_RAND\n elsif options.include? :negative\n number - MAX_RAND\n else\n number\n end\n end",
"def test_random_number_generation\n rand = @game.get_random_number(0, 10)\n assert rand <= 10 && rand >= 0\n end",
"def get_random_number(gender)\n\t\tcount = total_count(gender)\n\t\tset_random_seed\n\t\treturn rand(1..count)\n\tend",
"def get_random\n @number_list[Random.new.rand(@number_list.length)]\n end",
"def rand(max=0) end",
"def n_generator\n number = rand(10..30)\n end",
"def get_random\n @num.sample.first\n end",
"def random20\n rand(20) + 1\n end",
"def rand_num(range)\n num = @rng.rand(range) + 1\n num\n end",
"def random_number(seed, range)\n seed = seed.to_i\n return nil if seed <= 0\n rng2 = Random.new(seed)\n num = rng2.rand(range) + 1\n num\n end",
"def number\n\t\"#{Time.now.to_i}-#{rand(1_000_000)}\"\n end",
"def get_rand\n rand = \"\";\n File.open(\"/dev/urandom\").read(20).each_byte{|x| rand << sprintf(\"%02x\",x)}\n rand\nend",
"def gen_rand b\n p = rand(2**b)+2**b-1\n while ! rand_test p\n# puts p\n p += 1\n end\n p\nend",
"def gen_random_int\n $lasti = ($lasti * IA + IC) % IM\nend",
"def generator_rand(max)\n return nil if max < 0\n\n result = rand(max + 1)\n result\n end",
"def generate_number\n if self.respond_to? :inv_cdf\n inv_cdf(rand)\n else\n generate_sample 1\n end\n end",
"def random_account_number\r\n acct_num = rand(10**11).to_s.rjust(11, '1')\r\n return acct_num\r\n end",
"def random\n new(one.random())\n end",
"def rand(max)\n max-1\nend",
"def get_random()\n \n end",
"def get_random()\n \n end",
"def random_number( bits )\n m = (1..bits-2).map{ rand() > 0.5 ? '1' : '0' }.join\n s = \"1\" + m + \"1\"\n s.to_i( 2 )\n end",
"def new_account_number\n return rand(99999999)\n end",
"def new_account_number\n return rand(99999999)\n end",
"def random_integer(limit)\n Rubinius.primitive :randomizer_rand_int\n raise PrimitiveFailure, \"Randomizer#rand_int primitive failed\"\n end",
"def random_integer(limit)\n Rubinius.primitive :randomizer_rand_int\n raise PrimitiveFailure, \"Randomizer#rand_int primitive failed\"\n end",
"def usw_random(max=-1, min=0)\n Sass::Script::Number.new( max.to_i < 0 ? rand() : rand(min.to_i .. max.to_i ))\n end",
"def random_account_number\n acct_num = rand(10**11).to_s.rjust(11, '1')\n return acct_num\n end",
"def ran_str_maker\r\n length = 10\r\n ran_str = rand(36**length).to_s(36)\r\n return ran_str\r\nend",
"def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend",
"def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend",
"def randomf(range)\n return rand * range\nend",
"def non_zero_digit\n rand(1..9)\n end",
"def rand(max = nil)\n bytes = source.random_bytes(8)\n num = bytes.unpack(\"F\").first.abs / Float::MAX\n if max then\n num = bytes.unpack(\"Q\").first % max.floor\n end\n return num\n end",
"def random_status_number_generator\n Random.rand(1..10)\n end",
"def get_random(min, max)\r\n rand(min..max)\r\n end",
"def gen_speed\n rand + 15.0\n end",
"def rand_digit\n ascii = Random.rand(10) + 48\n return ascii.chr\nend",
"def random low, high\n $lib_prng.range low, high\nend",
"def get_random()\n rand(@count).times { @cur = @cur.next }\n @cur.val\n end",
"def main\n\t\n\tsubtract_random_number\t\n\nend",
"def rand7\n rand * 7\nend",
"def rand_phone options={}\r\n\t\"210#{random(1111111, 9999999).to_s}\"\r\nend",
"def random_id\n rand(1000000) + 20000\nend",
"def initialize(num = rand(52))\n self.num = num\n end",
"def generate_number(store)\n store.number = loop do\n random_number = Digest::SHA1.hexdigest([Time.now, rand].join)[0..5].upcase\n break random_number unless Store.exists?(number: random_number)\n end\n end",
"def next_rand\n begin\n num = rand(0...possible_products.count)\n end while(@chosen_nums[num])\n @chosen_nums[num] = 1\n num\n end",
"def random_numeric(size)\n random_number = size.times.map{ 1 + Random.rand(9)}\n random_number = random_number.to_s\n random_number = random_number.gsub(' ','').gsub('[','').gsub(']','').gsub('\"','').gsub(',','')\n return random_number\n end"
] |
[
"0.8369675",
"0.8257068",
"0.82547355",
"0.81025475",
"0.8089324",
"0.8072731",
"0.79939806",
"0.79765075",
"0.79765075",
"0.7972613",
"0.7961023",
"0.7952416",
"0.7915623",
"0.7878636",
"0.78605103",
"0.7834599",
"0.7827221",
"0.780836",
"0.7801179",
"0.7745336",
"0.7735712",
"0.7731573",
"0.77183443",
"0.771336",
"0.76970214",
"0.7696414",
"0.7687157",
"0.76288104",
"0.76242656",
"0.7617259",
"0.7617259",
"0.7617259",
"0.7617259",
"0.76129746",
"0.76107997",
"0.7605039",
"0.7594457",
"0.75782335",
"0.7555529",
"0.7521935",
"0.7518433",
"0.7488684",
"0.7463065",
"0.7460554",
"0.7441329",
"0.74404705",
"0.7434387",
"0.7416617",
"0.7413615",
"0.74121714",
"0.74059004",
"0.7398047",
"0.7393006",
"0.73919266",
"0.73669076",
"0.7365928",
"0.73443276",
"0.7339189",
"0.727929",
"0.7278354",
"0.72769177",
"0.72714007",
"0.7269729",
"0.7258015",
"0.7253464",
"0.72406006",
"0.719415",
"0.71889615",
"0.7171183",
"0.7166212",
"0.71575993",
"0.71369904",
"0.71313405",
"0.71313405",
"0.7107238",
"0.7100878",
"0.7100878",
"0.7098683",
"0.7098683",
"0.7079339",
"0.7070406",
"0.70450395",
"0.7017561",
"0.7017561",
"0.7011393",
"0.7006735",
"0.7002976",
"0.6995426",
"0.699347",
"0.6993016",
"0.6991944",
"0.6991135",
"0.6987586",
"0.69845456",
"0.6981379",
"0.6979036",
"0.69784445",
"0.6967356",
"0.6960095",
"0.69527537",
"0.69397515"
] |
0.0
|
-1
|
Helper method for bottomup implementation
|
def knapsack_table(weights, values, capacity)
solution_table = []
(0..capacity).each do |i|
solution_table[i] = []
(0...weights.length).each do |j|
if i == 0
solution_table[i][j] = 0
elsif j == 0
solution_table[i][j] = weights[j] > i ? 0 : values[j]
else
option1 = solution_table[i][j - 1]
option2 = weights[j] > i ? 0 : solution_table[i - weights[j]][j - 1] + values[j]
optimum = [option1, option2].max
solution_table[i][j] = optimum
end
end
end
solution_table
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end",
"def insert_at_bottom\n assume_bottom_position\n end",
"def add_to_bottom\n self.position = bottom + 1\n end",
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def bottom; return self[1]+self[3]; end",
"def move_to_bottom\n last_sib = last_sibling\n move_to_right_of(last_sib) if last_sib && self != last_sib\n end",
"def move_to_bottom\n return true if at_bottom?\n move_below(last_sibling_in_list)\n end",
"def bottomleft; return self[0], self.bottom; end",
"def bottom=(b); self[1] = b - self[3]; return b; end",
"def move_to_bottom\n return if self == self_and_siblings(true).last\n move_to(self_and_siblings.last.position_in_list)\n end",
"def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"def bottom()\n return @top + @height\n end",
"def bottomright; return self.right, self.bottom; end",
"def assume_bottom_position\n update_attribute(:position, bottom_position_in_list(self).to_i + 1)\n end",
"def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end",
"def snap_to_bottom_of( sibling_view )\n new_y = sibling_view.frame.origin.y - self.height\n self.frame = CGRectMake(self.frame.origin.x, new_y, self.width, self.height)\n end",
"def bottom()\n @view__.bottom\n end",
"def at_bottom?\n lower_siblings.empty?\n end",
"def bottom\n return @bottom\n end",
"def move_to_bottom_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n decrement_queue_positions_on_lower_items\n assume_bottom_queue_position\n end\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom\n @ole.Bottom\n end",
"def assume_bottom_position\n update_attribute(position_column, bottom_position_in_list(self).to_i + 1)\n end",
"def bottom=(value)\n @bottom = value\n end",
"def move_to_bottom(tag, klass)\n remove(tag, klass)\n self.instance.add(tag, klass)\n end",
"def max_heapify_bottom_up(index)\n if parent_i(index) && self[parent_i(index)] < self[index] \n self.swap(parent_i(index), index)\n max_heapify_bottom_up(parent_i(index))\n end\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def goto_bottom\n if y < battlefield_height - 61\n accelerate 1\n else\n @at_bottom = true\n end\n end",
"def bubble_up()\n\t\ti = @elements.length - 1\n\t\twhile(i > 0)\n\t\t\t# compare with its parent. swap if parent is less than it\n\t\t\tif @elements[(i-1)/2][@orderBy] >= @elements[i][@orderBy]\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tswap((i-1)/2, i)\n\t\t\t\ti = (i-1)/2\n\t\t\tend\n\t\tend\n\tend",
"def pad_bottom(y)\n yield\n move_down(y)\n end",
"def move_up\n return if at_top?\n self.class.where(:position => self.position - 1).first.inc(:position, 1)\n inc(:position, -1)\n end",
"def bottom!\n self.ox = self.width/2\n self.oy = self.height\n end",
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def bubble_up(index)\n #YOUR WORK HERE\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def bottom(value)\n @ole.Bottom = value\n nil\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1\n set_my_position(pos)\n end",
"def fit_to_bottom_of( sibling_view )\n new_height = sibling_view.frame.origin.y - self.frame.origin.y\n self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.width, new_height)\n end",
"def bottoms_up_method\n\t\t# 1. take the nodes that went the farthest (i.e.: max tree level)\n\t\tmax_level = @tree.tree_bottom.collect(&:level).max\n\t\t# 2. Of those, use the one with the minimum sum value\n\t\twinner = @tree.tree_bottom.select{|t|t.level==max_level}.min_by(&:sum)\n\t\t# binding.pry \n\t\tbottoms_up_dir(winner).dir\n\tend",
"def assume_bottom_queue_position\n update_attribute(queue_position_column, bottom_queue_position_in_queue(self).to_i + 1)\n end",
"def move_to_bottom(klass)\n remove(klass)\n self.instance.add(klass)\n end",
"def bubble_up(i)\n while i > 0\n parent = (i+1) / 2 - 1\n if @contents[parent].key >= @contents[i].key then\n @contents[parent],@contents[i] = @contents[i],@contents[parent]\n i = parent\n else return\n end\n end\n end",
"def bottom_item\n @current = last\n\n items\n end",
"def bottom\n @widget.margins.bottom + @widget.borders.bottom\n end",
"def bottom_aligned?\n value == :bottom\n end",
"def inner_up\n # looking up at the bottom of the inner grid\n return 0 if inner.nil?\n # sum bottom edge\n (0..@size-1).map { |x| inner.get_loc(x, @size - 1) ? 1 : 0 }.sum\n end",
"def move_to_bottom_of(node)\n movement(node, :strict => true) do |to|\n self.left_sibling = to.target.record\n end\n end",
"def fallen_off_bottom?\n self.y > $window.height\n end",
"def border_bottom()\n return get_border(:bottom)\n end",
"def bottom_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col, cell.row+1)}\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.current_position : acts_as_list_top - 1\n end",
"def bottom\n self.ox = self.src_rect.width/2\n self.oy = self.src_rect.height\n end",
"def bottom\n row, col = @position\n return [row + 1, col] unless row + 1 > 7\n []\n end",
"def leads_up?(point, empty_test, height)\n inner = ->(pt, dir) { #inner searches either left or right\n if !empty_test.(pt)\n then false\n elsif point[1] == 0 #if it hits the top of the board\n then true\n elsif height == 0 #if it has risen enough\n then true\n elsif empty_test.(plus(pt, Up)) \n then leads_up?(plus(pt, Up), empty_test, height-1) #move up a level\n else\n inner.(plus(pt, dir), dir) #move sideways and keep looking\n end\n }\n inner.(point, Left) || inner.(point, Right)\n end",
"def bottom_left\n Point[x, y + height]\n end",
"def bottomToTopWraparound(grid, width, height)\n\n strings = bottomToTop(grid, width, height)\n\n for string in strings do\n\n string << string\n\n end\n\n return strings\n\nend",
"def move_to_bottom_on_unarchive\n if self.just_unarchived\n self.just_unarchived = false\n self.move_to_bottom if self.respond_to?(:move_to_bottom)\n end\n return true\n end",
"def all_below\n @bottom.empty? ? [self] : @bottom.flat_map { |r| r.all_below }.uniq\n end",
"def bubble_down(i)\n while true\n child1 = (i+1) * 2 - 1\n child2 = (i+1) * 2\n if child1 >= size then return\n elsif child2 >= size then\n if @contents[i].key >= @contents[child1].key then\n @contents[i],@contents[child1] = @contents[child1],@contents[i]\n return\n else return\n end\n else min = if @contents[child1].key <= @contents[child2].key\n then child1 else child2\n end\n if @contents[i].key > @contents[min].key\n @contents[i],@contents[min] = @contents[min],@contents[i]\n i = min\n else return\n end\n end\n end\n end",
"def bottom\n @x_max\n end",
"def from_up(cur)\n\t\tmove(cur, -1, 0)\n\tend",
"def bottom_item(except = nil)\n except ? siblings.reject{|page| page == self }.last : siblings.last\n end",
"def bottom_panel\n Panel.bottom_panel(pointer)\n end",
"def bottom_right\n @position + @dimensions\n end",
"def page_down_to_bottom_of_scroll_bar\n scroll_down_one_page while vertical_scroll_percent < 99.99\n end",
"def bottomToTop(grid, width, height)\n\n strings = topToBottom(grid, width, height)\n\n for string in strings do\n string.reverse!\n end\n\n return strings\n\nend",
"def top_up(gbp)\n fail 'Cannot exceed #{MAXIMUM_BALANCE}' if @balance + gbp > MAXIMUM_BALANCE\n @balance += gbp\n end",
"def bubble_down()\n\t\t# remove max and swap with last node\n\t\t@elements[0] = @elements.pop\n\t\ti = 0\n\t\twhile(i < @elements.length)\n\t\t\tmax_idx = i\n\t\t\t# find greater of left and right child\n\t\t\tif((2*i + 1) < @elements.length && @elements[2*i + 1][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 1\n\t\t\tend\n\t\t\tif((2*i + 2) < @elements.length && @elements[2*i + 2][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 2\n\t\t\tend\n\t\t\t# if left or right child is greater, swap and update i\n\t\t\tif(max_idx != i)\n\t\t\t\tswap(i, max_idx)\n\t\t\t\ti = max_idx\n\t\t\t# if not, we are done\n\t\t\telse\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend",
"def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end",
"def bubble_up(index, node)\n while (index!=0 && @ary[(index-1)/2].key > node.key) #while parent is bigger,\n @ary[index], @ary[(index-1)/2] = @ary[(index-1)/2], @ary[index] #swap\n index = (index-1)/2\n end\n end",
"def piece_up\n return unless @falling_piece\n\n @falling_piece.y -= @block_size\n @falling_piece.grid_position.y -= 1\n end",
"def bottom_gap?\n near_pages.first > 1\n end",
"def move_up\n unless @value.eql? 1\n @y -= 50\n @value -= 1\n end\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(:position) : 0\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(position_column) : 0\n end",
"def align_bottom\n @vertical_align = :bottom\n return self\n end",
"def test_directionBottom\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(200, 40, 40, 40), $data_actors[1])\n uc.direction = 0\n uc.draw()\n }\n return true\n end",
"def mm_upheap(j, upper)\n while true\n return if j <= 0\n i = (j-1) >> 1\n return if upper.call(i, j)\n swap(j, i)\n j = i\n end\n end",
"def bottom\n `#{clientRect}.bottom` + Window.scrollY\n end",
"def pbBottomRight(window)\n window.x=Graphics.width-window.width\n window.y=Graphics.height-window.height\nend",
"def find_bottom_path(cell)\n find_path(cell) { | cell | bottom_cell(cell) }\n end",
"def bottom=(bottom)\n @view__.bottom = bottom\n end",
"def is_bottom?\n return (is_constant? && @classified.first.is_bottom?)\n end",
"def frog_hops_bottom_up(n)\n cache = frog_cache_builder(n)\n cache[n]\n end",
"def height\n top - bottom\n end",
"def up\n @level -= 1\n add_newline\n end",
"def html_bottom_items\n @html_bottom_items ||= []\n end",
"def bottom n=1, &blk\n if block_given?\n sort(&blk)[0...n]\n else\n #bottom_by(n) {|x| x }\n sort[0...n]\n end\n end",
"def bottom_left\n row, col = @position\n return [row + 1, col - 1] unless row + 1 > 7 || col - 1 < 0\n []\n end",
"def frog_hops_bottom_up(n)\n frog_cache_builder(n)[n]\n end",
"def midbottom; return self.centerx, self.bottom; end",
"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 bottom_line\n border_options ? super : nil\n end",
"def bottom_queue_position_in_queue(except = nil)\n item = bottom_item_in_queue(except)\n item ? item.send(queue_position_column) : 0\n end",
"def topToBottomWraparound(grid, width, height)\n\n strings = topToBottom(grid, width, height)\n\n for string in strings do\n\n string << string\n\n end\n\n return strings\n\nend",
"def test_alignBottomRight\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(0, 48, @window.contents.width, 72), 1, 2, 255, 2)\n uc.draw()\n }\n return true\n end",
"def heap_up(index)\n parent = (index - 1) / 2\n bottom = @store[index]\n\n if index > 0 && @store[parent].key > bottom.key \n swap(index, parent)\n heap_up(parent)\n end \n end",
"def half_page_down() [\"moveDown:\"] * 6 * @number_prefix end"
] |
[
"0.70185775",
"0.6855966",
"0.6792547",
"0.66875625",
"0.66756815",
"0.6672704",
"0.66373646",
"0.663226",
"0.6596407",
"0.6587347",
"0.6516622",
"0.65097195",
"0.6507161",
"0.64792657",
"0.6440934",
"0.6431597",
"0.6431418",
"0.63186693",
"0.6293141",
"0.62752163",
"0.6264938",
"0.6222886",
"0.62204623",
"0.62166154",
"0.62166154",
"0.6170147",
"0.6160432",
"0.61445487",
"0.61273307",
"0.6102781",
"0.60977185",
"0.60975397",
"0.60843647",
"0.6084198",
"0.60790133",
"0.6075189",
"0.60726446",
"0.6070987",
"0.6070987",
"0.60655886",
"0.60563445",
"0.6023716",
"0.5936741",
"0.5911222",
"0.59111285",
"0.59086204",
"0.5832606",
"0.58321625",
"0.57856286",
"0.5740308",
"0.5739896",
"0.5719649",
"0.5707588",
"0.56762797",
"0.5668893",
"0.56502116",
"0.5631832",
"0.56285244",
"0.56250626",
"0.5624032",
"0.56152046",
"0.5612304",
"0.56089056",
"0.559725",
"0.5596831",
"0.5595164",
"0.55734843",
"0.55731136",
"0.5565637",
"0.5547969",
"0.553913",
"0.55333376",
"0.5532266",
"0.5527276",
"0.5514242",
"0.55108976",
"0.5509825",
"0.5495683",
"0.5494238",
"0.54934716",
"0.54902726",
"0.54844224",
"0.5481377",
"0.54801214",
"0.54774696",
"0.5467167",
"0.54551053",
"0.5450486",
"0.5430679",
"0.5426183",
"0.53992337",
"0.5397316",
"0.53841245",
"0.53475237",
"0.5343812",
"0.5342864",
"0.53409106",
"0.53287244",
"0.5320713",
"0.5313735",
"0.53020996"
] |
0.0
|
-1
|
Retrieves a single resource
|
def find(id, options = {})
response = client.get("#{base_path}/#{id}", options)
return parse(response) unless block_given?
yield response
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_resource\n execute(resource_path, method: :get)\n end",
"def find_resource\n get params[:resource_path]\n end",
"def resource\n klass, param = resource_class\n klass&.find(params[param.to_sym])\n end",
"def get_resource_to_use\n return @resources.first\n end",
"def get_resource(id, type)\n\t\t@client.method(type).call.get(id)\n\tend",
"def get(resource, id)\n Api.new.get(resource, id)\n end",
"def resource\n resource_model.find(params[:id])\n end",
"def get_resource(url, resource_class, params={})\n resource_class.from_hash(get(url, params), client: self)\n end",
"def get_resource(id)\n raise 'To be implemented in child classes'\n end",
"def find_resource\n @resource = resource_class.find(params[:id])\n end",
"def show\n @resource = Resource.find(params[:id])\n end",
"def resource(path, params={})\n r = Resource.process_detailed(self, *do_get(path, params))\n\n # note that process_detailed will make a best-effort to return an already\n # detailed resource or array of detailed resources but there may still be\n # legacy cases where #show is still needed. calling #show on an already\n # detailed resource is a no-op.\n r.respond_to?(:show) ? r.show : r\n end",
"def get\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.get do |req|\n req.url resource_uri\n resource_params.each { |key, value|\n req.params[key] = value\n }\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end",
"def ar_retrieve_resource(opts = {})\n @resource_relation ||= ar_model\n @resource_relation = ar_model.includes(ar_model.interfaces[:rest].eager_loading_hints(:view => ar_view)) if ar_model\n\n run_callbacks :ar_retrieve_resource do\n tid = opts[:id] || params[:id]\n opts.delete(:id)\n\n @resource = @resource_relation.find(tid)\n end\n\n #ar_authorize_action if !opts[:skip_authorization]\n\n @resource\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end",
"def read_resource(resource)\n resource\n end",
"def read_resource(resource)\n resource\n end",
"def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end",
"def get(id)\n Basuco::Resource.get(id)\n end",
"def get_resource resource_uuid\n return resource_uuid if resource_uuid.is_a?(Resource)\n \n tmp = @resources.find{|res|res.uuid == resource_uuid}\n \n raise \"unknown resource with uuid #{resource_uuid}\" unless tmp\n \n tmp\n end",
"def show\n @resource = find_resource\n end",
"def resource\n @resource\n end",
"def resource\n @resource\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end",
"def get(resource, **params)\n\n execute(Net::HTTP::Get, 'GET', resource, **params)\n\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def get(resource)\n puts construct_url(@mode, resource)\n @agent.get construct_url(@mode, resource)\n end",
"def resource\n self.class.resource\n end",
"def get_resource\n\t\t\t\tinstance_variable_get(\"@#{resource_name}\")\n\t\t\tend",
"def get(resource, options = nil)\n params = options\n url = \"/#{resource}\"\n get_response(url, params)\n end",
"def resource\n @resource\n end",
"def find_resource\n set_resource_ivar class_name.find(params[:id])\n end",
"def get(resource_path, headers: {}, prefix: API_PREFIX)\n request(method: :get, resource_path: resource_path, headers: headers, prefix: prefix)\n end",
"def show\n @resource = Resource.find(params[:id])\n render json: @resource, status: 200\n end",
"def show\n @resource = Resource.find(params[:id]) || not_found\n\n respond_to do |format|\n format.html{}\n end\n\n end",
"def resource\n @resource ||= resource_set.createResource(uri)\n end",
"def first\n resources.first\n end",
"def get(name)\n path = \"/projects/#{project.name}/resources/#{name}\"\n resp = client.get(path)\n build_resource(resp)\n end",
"def retrieve\n self.class.get( id )\n end",
"def resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def get_resource(name)\n resource = Resource.new\n resource.name = name\n resource.get_resource\n yield resource.resource if block_given?\n resource\n end",
"def fetch(resource,identifier,params={})\n uri = '/api/' + resource.to_s + '/' + identifier\n http_get(uri,params)\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end",
"def show\n @resource = @lode.resource\n end",
"def get(header = {})\n url = \"#{ApiClient.config.path}#{self.class.resource_path}/#{id}\"\n response = ApiClient::Dispatcher.get(url, header)\n attributes = ApiClient::Parser.response(response, url)\n update_attributes(attributes)\n end",
"def resource_get class_name, resource_name\n\t\t\tpath = \"#{class_to_basefile(class_name)}.#{resource_name}\"\n\t\t\tdata, readed = nil, false\n\t\t\tif File.exist? path\n\t\t\t\tdata = File.read path\n\t\t\t\treaded = true\n\t\t\telse\n\t\t\t\tpath = \"#{class_to_basefile(class_name)}.res/#{resource_name}\"\n\t\t\t\tif File.exist? path\n\t\t\t\t\tdata = File.read path\n\t\t\t\t\treaded = true\n\t\t\t\tend\n\t\t\tend\n\t\t\traise Resource::NotExist unless readed\t\t\t\t\t\n\t\t\treturn data\n\t\tend",
"def get(name,&block)\n build_resource(name, :get, &block)\n end",
"def resource\n @resource ||= begin\n resource_query\n .new(relation: resource_scope)\n .find_for_show(find_by_conditions: find_by_conditions)\n end\n end",
"def retrieve(id)\n instance = self.new(id)\n url = instance.url\n requestor = Requestor.new\n response = requestor.request(:get, url)\n instance.load_from(response)\n instance\n end",
"def get(resource_type, resource_value)\n # Check if resource if available from treasury\n if available?(resource_type, resource_value)\n # Resource is taken from treasury\n get_resource(resource_type).consume(resource_value)\n\n # Return asked resource\n Resource.new(resource_type, resource_value)\n else\n nil\n end\n end",
"def resource\n return @resource unless @resource.nil?\n\n @user_type = 'public'\n res = id.resources.submitted&.by_version_desc&.first\n return res if res.nil? # no submitted resources\n\n @resource = if admin?(resource: res)\n @user_type = 'privileged'\n id.resources.submitted.by_version_desc.first\n else # everyone else only gets to see published or embargoed metadata latest version\n id.latest_resource_with_public_metadata\n end\n end",
"def [](resource_id, options = {})\n response = client.get(\"#{base_uri}/#{resource_id}\", options)\n if response.success?\n object_class.new(response.body, client)\n else\n raise Kippt::APIError.new(\"Resource could not be loaded: #{response.body[\"message\"]}\")\n end\n end",
"def single_resource\n if get_id\n result = self.class.resource_class.find(get_id)\n result.assign_attributes(safe_params) if request.put? || request.patch?\n self.class.decorator_class ? result.decorate : result\n else\n # if try(:in_session_file_storage?) && (validated_model = try(:read_from_session_file_storage, self.class.resource_class))\n # validated_model\n # else\n self.class.resource_class.new(safe_params)\n # end\n end\n end",
"def get(resource, headers = {})\n prepare_request(:get, resource, nil, headers)\n end",
"def show\n render json: serialize(read_resource(resource), options), status: :ok\n end",
"def resource\n instance_variable_get(resource_name) || params[:id] && set_resource(controller_model.find(params[:id]))\n end",
"def resource\n get_resource_ivar || set_resource_ivar(end_of_association_chain.send(method_for_find, params[:id]))\n end",
"def find_resource(resource_id)\n query_service.find_by(id: Valkyrie::ID.new(resource_id))\n end",
"def get!(resource_type, name)\n result = get(resource_type, name)\n if !result\n raise \"#{identifier(resource_type, name)} not found!\"\n end\n result\n end",
"def find_resource\n if !params[:format].nil? && params[:format] == \"json\"\n begin\n p \"i came in\"\n p params[:id]\n Product.find_by_id(params[:id])\n rescue Exception => e\n error = error_response_method($e2)\n render :json => error\n end\n else\n Product.find_by_permalink!(params[:id])\n end\n end",
"def get_resource(identity)\n @subject.get(identity, TEST_ZONE)\n end",
"def get(resource)\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"GET request Url: #{url}\")\n @logger.debug(\"-- Headers: #{base_headers}\")\n\n HTTParty.get(url, headers: base_headers)\n end",
"def resource\n\n end",
"def read(resource_type, id)\n unless RESOURCES.include?(resource_type)\n raise Common::Exceptions::InvalidFieldValue.new('resource_type', resource_type)\n end\n\n perform(:get, \"#{resource_type}/#{id}\", nil)\n end",
"def resource\n return Object unless resource_type\n return resource_type.constantize unless resource_id\n return _resource\n end",
"def method_missing(id, *args, &block)\n # Figure out what kind of resource we're trying to get.\n klass = Scrumy::Models.const_get(id.to_s.capitalize.singularize)\n # Special case for handling id=:current - this really only applies to Sprint resources\n # but if other resources specified the `current` sub-resources then it should still work.\n if klass.current_url and args.first==:current\n @url = format(klass.current_url, :current)\n else\n # TODO\n # Figure out a better way of determining if the resource is singular or plural\n \n # The only argument that resources ever take is an ID, so pass the first arg as the ID.\n @url = format((id.to_s =~ /s$/ ? klass.list_url : klass.show_url), args.first)\n end\n\n # Here we request the resource using the singular of the resource name as the root\n # to extract from the returned JSON hash.\n response = get(@url, id.to_s.singularize)\n \n # Responses are of two types, either arrays of hashes or a single hash\n if response.kind_of? Array\n # If it's array collect a new array by constructing objects based on the resource\n # name capitalized and singularized.\n response.collect do |obj| \n klass.new(obj, self)\n end\n else\n # Otherwise create a single new object of the correct type.\n klass.new(response, self)\n end\n end",
"def show\n begin\n @resource = Entity.find params[:id]\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def show\n respond_with resource\n end",
"def find_resource(id)\n query_service.find_by(id: Valkyrie::ID.new(id.to_s))\n end",
"def get(request, response)\n @resource.get(request, response)\n end",
"def get(url, resource_name, options = {})\n build_response(resource_name) do\n connection.get do |req|\n req.url url\n req.params = options\n end\n end\n end",
"def find_one(id, query = nil)\n response = request(:get, \"/#{resource_name}/#{id}\", query)\n construct_record_from_singular(response)\n end",
"def resource\n @resource ||= begin\n resource_constant.new(attributes)\n end\n end",
"def get( id )\n resource = begin # this is just in case the developer has already escaped the name\n CouchDB.get( \"#{database.uri}/#{CGI.escape(id)}\" )\n rescue\n CouchDB.get( \"#{database.uri}/#{id}\" ) \n end\n new( resource ) \n end",
"def resource\n instance_variable_get(:\"@#{resource_name}\")\n end",
"def resource\n instance_variable_get(:\"@#{resource_name}\")\n end",
"def show\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def get\n url = prefix + \"get\" + id_param\n return response(url)\n end",
"def find_record\n self.class.resource_model.find(params[:id])\n end",
"def get_api_resource ( url )\n\n if @cache.exists( url )\n return @cache.get( url )\n end\n\n uri = URI( url )\n request = Net::HTTP::Get.new( uri )\n request['X-TBA-App-Id'] = \"#{@organization}:#{@app_identifier}:#{@version}\"\n\n resource = Net::HTTP.start( uri.hostname, uri.port,\n :use_ssl => uri.scheme == 'https' ) { |http|\n http.request( request )\n }\n\n case resource\n when Net::HTTPSuccess, Net::HTTPRedirection\n data = JSON.parse( resource.body )\n @cache.set( url, data )\n return data\n else\n resource.value\n end\n end",
"def resource\n @resource ||= Resource.new(self)\n end",
"def fetch(resource_type,identifier,params={})\n path = '/api/' + resource_type.to_s + '/' + slugify(identifier)\n hydrate(resource_type, http_get(path,params))\n end",
"def resource\n @resource ||= resource_klass.new object\n end",
"def get(path, request_options = {}, resource_options = {})\n response(:get, resource(resource_options)[path], request_options)\n end",
"def get_resource(resource_type)\n\n Occi::Log.debug(\"Instantiating #{resource_type} ...\")\n\n if @model.get_by_id resource_type\n # we got a resource type identifier\n Occi::Core::Resource.new resource_type\n elsif @model.kinds.select { |kind| kind.term == resource_type }.any?\n # we got a resource type name\n Occi::Core::Resource.new @model.kinds.select {\n |kind| kind.term == resource_type\n }.first.type_identifier\n else\n raise \"Unknown resource type! [#{resource_type}]\"\n end\n\n end",
"def crud_get(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n get '/'+resource_name+'/:'+primary_key_name do\n service = settings.send(service_name)\n\n sanitize_params(params)\n return 400 unless service.valid_query?(params)\n\n record = service.get_one_by_query(params)\n return 404 if record.nil?\n JSON.fast_generate record\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end"
] |
[
"0.85338926",
"0.77728117",
"0.7647298",
"0.76227075",
"0.75751865",
"0.7545986",
"0.7457722",
"0.7360439",
"0.7292875",
"0.7287937",
"0.7249435",
"0.72328496",
"0.71400493",
"0.71370107",
"0.71356344",
"0.71356344",
"0.71301067",
"0.7024544",
"0.7021953",
"0.70050436",
"0.699942",
"0.699942",
"0.6988656",
"0.6988656",
"0.6988656",
"0.6988652",
"0.6988652",
"0.69377273",
"0.69106543",
"0.690086",
"0.6899215",
"0.6899215",
"0.6899215",
"0.6899215",
"0.6899215",
"0.6899215",
"0.68857634",
"0.6846811",
"0.6837934",
"0.68337077",
"0.68268",
"0.68229824",
"0.68102694",
"0.6804355",
"0.68004805",
"0.6788687",
"0.67676914",
"0.6741344",
"0.67365557",
"0.6724519",
"0.67137027",
"0.6704249",
"0.67039394",
"0.67039394",
"0.67039394",
"0.67039394",
"0.6680507",
"0.66645384",
"0.6663498",
"0.6658625",
"0.66556185",
"0.6634288",
"0.6610718",
"0.6593843",
"0.658592",
"0.65822834",
"0.65802276",
"0.6576753",
"0.65763915",
"0.6572724",
"0.6571361",
"0.6558451",
"0.655416",
"0.6551698",
"0.6544249",
"0.6539439",
"0.65344846",
"0.65315497",
"0.65184057",
"0.6516824",
"0.6516191",
"0.6507833",
"0.6504356",
"0.6491337",
"0.6490779",
"0.6488743",
"0.6484177",
"0.64835256",
"0.64835256",
"0.647527",
"0.6462053",
"0.64594746",
"0.6457079",
"0.64369035",
"0.6436654",
"0.64310133",
"0.6429846",
"0.642981",
"0.64261764",
"0.64246464",
"0.64246464"
] |
0.0
|
-1
|
Retrieves a specific page of a collection
|
def page(pagenum = 1, options = {})
per = options[:per] || client.config[:pagination_page_size]
response = client.get(base_path, { page: pagenum, per: per }.merge(options))
return parse(response) unless block_given?
yield response
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def next_page\n collection.next_page\n end",
"def page_collection!\n return unless paginate\n\n page = params[:page].to_i\n page = 1 if page.zero?\n page_size = params[:page_size].to_i\n page_size = DEFAULT_PAGE_SIZE if page_size <= 0\n self.collection = collection.page(page).per(page_size)\n end",
"def api_get_collection(path, collection, page_number: 1, page_size: 100, **kwargs)\n Enumerator.new do |enum|\n loop do\n query = kwargs.fetch(:query, '')\n query += '&' unless query.empty?\n query += \"pageSize=#{page_size}&pageNumber=#{page_number}\"\n new_kwargs = kwargs.merge(query: query)\n\n res = api_get(path, **new_kwargs)\n raise TableauError, res if res.code.to_s != '200'\n\n # ensure the result is an array because it will not be an array if there is only one element\n [collection.split('.').reduce(res['tsResponse']) { |acc, elem| acc && acc[elem] }].flatten.compact.each do |obj|\n enum.yield obj\n end\n\n break if res['tsResponse']['pagination'].nil?\n break if page_number >= (res['tsResponse']['pagination']['totalAvailable'].to_i / page_size.to_f).ceil\n\n page_number += 1\n end\n end\n end",
"def next_page\n @collection.next_page\n end",
"def next_page\n @collection.next_page\n end",
"def current_page\n collection.current_page\n end",
"def paginate(collection, page_num, per_page=5)\n num_pages = (collection.count.to_f / per_page).ceil\n page_num = page_num.to_i\n\n # fix wonky client requests\n page_num = 1 if page_num.nil? || page_num <= 0\n page_num = num_pages if page_num > num_pages\n\n collection.slice((page_num - 1) * per_page, per_page)\nend",
"def next_page(path)\n result = http_get(path)\n collection_from(result.body)\n end",
"def find_collection\n @collection = Collection.find(params[:id])\n end",
"def fetch_page\n url = URI([API, @url].join) # *hiss* \"URI\" has been wrong for years!\n\n unless @args.empty?\n url.query = URI.encode_www_form(@args.merge({ page: @page }))\n end\n\n res = Net::HTTP.get_response(url)\n raise SRL::NetworkError, res unless res.is_a?(Net::HTTPSuccess)\n\n data = JSON.parse(res.body)\n @page += 1\n\n ResultSet.new(\n SRL::Utils.collection(data.fetch(@args[:pkey]), @klass),\n count: data.fetch('count', data.fetch(@args[:pkey]).size),\n page: (@page - 1),\n page_size: @args.fetch(:pageSize, 25)\n )\n end",
"def page\n @page ||= retrieve_page\n end",
"def page\n @page ||= retrieve_page\n end",
"def current_page\n @collection.current_page\n end",
"def current_page\n @collection.current_page\n end",
"def page\n @page ||= params[:page] || 1\n end",
"def paginate(*args)\n options = args.last.is_a?(::Hash) ? args.pop : {}\n page = options.delete(:page) || 1\n items_per_page = options.delete(:per_page) || self.per_page\n finder = (options.delete(:finder) || 'get').to_s\n page_options = {\n \"_pagination\" => 1,\n \"_limit\" => items_per_page,\n \"_page\" => page\n }\n options.merge!(page_options)\n args << options\n collection = send(finder,*args)\n end",
"def paginator_and_collection_for(collection_id, options) #:nodoc:\n klass = model\n # page = @params[options[:parameter]]\n page = streamlined_request_context.page\n count = count_collection_for_pagination(klass, options)\n paginator = ActionController::Pagination::Paginator.new(self, count, options[:per_page], page)\n collection = find_collection_for_pagination(klass, options, paginator)\n\n return paginator, collection \n end",
"def paginate_collection!\n set_collection get_collection.page(params[:page]).per(self.class.per_page)\n end",
"def page\n get_page\n nil\n end",
"def page\r\n @page || 1\r\n end",
"def page (page = 1)\n\t \tdiff = (page - 1) * 10\n\t \tall.offset(diff).limit(10)\n\t end",
"def paginate(collection)\n page_size = params.dig(:page, :size)&.to_i\n page_number = params.dig(:page, :number)&.to_i\n return collection unless page_size && page_number\n\n Jaf::Pagination.filter(collection, size: page_size, number: page_number)\n end",
"def next_page_collection\n next_page ? page(next_page, per_page) : nil\n end",
"def page_by_name(name)\n fetch(:page, name)\n end",
"def get_next_page(collection, page_size = nil)\n url = \"reports/#{collection.type}\"\n get_next_page_helper(collection, collection.reports, url, MODEL_CLASS, page_size)\n end",
"def show\n @collection = Collection.find(params[:id])\n end",
"def page\n Integer(params[:page] || 1)\n end",
"def page(req)\n req.params.fetch('page', default='1').to_i\n end",
"def pagy_get_items(collection, pagy)\n # this should work with ActiveRecord, Sequel, Mongoid...\n collection.offset(pagy.offset).limit(pagy.items)\n end",
"def page\n @request.params[:page] ? @request.params[:page].to_i : 1\n end",
"def fetch_single_page(page, resource, options = {})\n _options = options.dup\n _options[:query] ||= {}\n _options[:query][:page] = page.to_i + 1\n result, response = self.send(resource, _options)\n if result == false\n return\n end\n if !result.is_a?(Hash)\n raise \"Expected %s to be a hash\" % [result, response].inspect\n end\n return result\n end",
"def go_to_page(page)\n get_total_pages unless @total_pages\n return nil if page.to_i < 1 || page.to_i > @total_pages\n ISBNdb::ResultSet.new(\"#{@uri}&page_number=#{page}\", @collection, page)\n end",
"def fetch_page(name, options = {})\n fetch('/page/%s' % name, options)\n end",
"def fetch_page(page)\n @client ||= Grackle::Client.new(:api=>:search)\n @client.search.json?(:q=>@query, :since_id=>@last_twid || 0, :rpp=>RESULTS_PER_PAGE, :page=>page).results\n end",
"def get_page\n case page = params[:page].to_i\n when 0; 1\n when (1..POST_PAGES); page\n else POST_PAGES\n end\n end",
"def request_for_page page, pageinfo=nil\n (page.to_i > 1) ? self.class.new(identifier, page) : self\n end",
"def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end",
"def paginate(collection, partial)\n if params[:page].present?\n render partial: partial, collection: collection\n else\n render action_name\n end\n end",
"def pagination_from(collection)\n collection.offset_value + 1\n end",
"def pagy_get_items(collection, pagy)\n # handle arrays\n return collection[pagy.offset, pagy.items] if collection.is_a? Array\n # this should work with ActiveRecord, Sequel, Mongoid...\n collection.offset(pagy.offset).limit(pagy.items)\nend",
"def index\n @belongs = Belong.page(params[:page])\n end",
"def get_next_page(collection, page_size = nil)\n get_next_page_helper(collection, collection.insurances, 'insurances', MODEL_CLASS, page_size)\n end",
"def show \n @collection = Collection.find(params[:id])\n\n #@documents = Document.where(:collection_id => @collection.id).paginate(:per_page => 5, :page => params[:page])\n @documents_all = Document.where(:collection_id => @collection.id)\n\n @documents = []\n @documents_all.each do |doc|\n if doc_is_viewable(doc, current_user)\n @documents << doc\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection }\n end\n end",
"def page(key)\n end",
"def get_page(params)\n raw = params.delete('page')\n return 1 unless raw\n page = raw.to_i\n if page < 1\n error 400, convert(body_for(:errors, \"page must be >= 1\"))\n end\n page\n end",
"def page\n _page = params[:page].to_i\n return (_page == 0) ? 1 : _page\n end",
"def get_page(page = 1)\n add_actions \"GoToPage(#{page})\"\n end",
"def page\r\n\t\t\t\tparams[:page].to_i || 1\r\n\t\t\tend",
"def show\n @collection ||= Collection.shareds.find(params[:id])\n fail ActiveRecord::RecordNotFound if @collection.nil?\n end",
"def show\n @page = Page.find(params[:id])\n #this is how we find every page by its id\n end",
"def page_index(item_index) \n return -1 if !(item_index < item_count) || item_index < 0\n @collection[item_index]\n end",
"def next_page\n num = @collection.current_page < @collection.total_pages && @collection.current_page + 1\n previous_or_next_page(num, @options[:next_label], 'next')\n end",
"def find(id, collection)\n collection.find(id)\n end",
"def page(page)\n limit(owner.default_per_page).skip(owner.default_per_page * ([page.to_i, 1].max - 1))\n end",
"def page\n obj\n end",
"def page\n # extract :page from defaults? no need using default page?\n @params[:page].to_i > 0 ? @params[:page] : @cfg[:default][:page]\n end",
"def find(id)\n fail(ArgumentError, \"Missing id/slug\") unless id\n id = OAuth::Helper.escape(id)\n result = access_token.get(\"#{API_BASE}/collection/#{id}\")\n fail(ArgumentError, \"Bad request\") unless result.code == \"200\"\n\n Collection.new(result.body)\n end",
"def presentation_page n\n pages[n-1][:resource]\n end",
"def page_by_name(name)\n fetch(:page,\"#{name.gsub!(/\\s/, '_')}\")\n end",
"def page\n if !@page || @page < 1\n 1\n elsif @page > total_pages\n total_pages\n else\n @page\n end\n end",
"def fetch(options = {})\n validate_collection_options(options)\n\n collection_class.new(client.get(base_uri, options).body, client)\n end",
"def pages\n get(\"v1/account/#{@email}/pages\")\n end",
"def info_page(collection, style = nil)\n if collection.page(1).length > 0\n html = \"#{t('views.pagination.displaying')} #{collection.offset_value + 1} -\n #{collection.offset_value + collection.length}\"\n html << \" #{t('of')} #{collection.total_count}\"\n\n content_tag :div, html, class: 'pagination', style: style\n end\n end",
"def page\n raise 'page() requires a block' unless block_given?\n\n response = yield(1)\n num_records = response['size']\n\n if num_records.is_a?(Integer) && num_records > 25\n pages = (num_records / 25) + 1\n # start at 2 since first call returned first page\n for counter in 2..pages\n @logger.debug \"Retrieving page #{counter} of #{pages}\"\n results = yield(counter)['results']\n response['results'].concat(results) if results\n end\n end\n\n hash_response(response)\n end",
"def page num\n raise ArgumentError.new 'Survey pages are one-indexed' if num < 1\n pages[num - 1]\n end",
"def collection(slug, options)\n _get(\"v1/collections/\" + slug, options)\n end",
"def load_page(page_num)\n params = @query.merge(pagination_params(page_num))\n response = @client.api_request(:get, @path, :params => params)\n\n metadata = parse_metadata(response)\n @num_records, @num_pages = metadata['records'], metadata['pages']\n\n Page.new(@resource_class, response.parsed, metadata['links'])\n end",
"def page(num = 1)\n num = 1 if num < 1\n num = @pages if num > @pages\n\n @page_number = num\n\n # offset n is the n+1 record\n start = (@page_number - 1) * @page_size\n\n @paged_filtered_rset = @filtered_rset.offset(start).limit(@page_size)\n\n self\n end",
"def paginated(collection, options = {})\n respond_with_object_and_type collection, options, :paginated, false\n end",
"def per_page\n collection.limit_value\n end",
"def get_next_page(collection, page_size = nil)\n get_next_page_helper(collection, collection.addresses, 'addresses', MODEL_CLASS, page_size)\n end",
"def pages\n get(\"v1/event/#{@id}/pages\")\n end",
"def paginate_collection(collection, options = {})\n default_options = {:per_page => 10, :page => 1}\n options = default_options.merge options\n\n pages = Paginator.new self, collection.size, options[:per_page], options[:page]\n first = pages.current.offset\n last = [first + options[:per_page], collection.size].min\n slice = collection[first...last]\n return [pages, slice]\n end",
"def paginate_collection(collection, options = {})\n default_options = {:per_page => 10, :page => 1}\n options = default_options.merge options\n\n pages = Paginator.new self, collection.size, options[:per_page], options[:page]\n first = pages.current.offset\n last = [first + options[:per_page], collection.size].min\n slice = collection[first...last]\n return [pages, slice]\n end",
"def find(page)\n Page.find(page)\n end",
"def fetch_page_part(name, part, options = {})\n fetch('/page/%s/%s' % [name, part], options)\n end",
"def collection\n @collection ||= end_of_association_chain.paginate :conditions => 'visible = 1', :page => params[:page], :per_page => 21, :order => 'created_at DESC'\n \n @page_title = 'Shared Photos'\n @page_description = \"Click on a photo to see it's original resolution. Use the next and previous links to move through the list of photos.\"\n @feed_url = formatted_photos_url(:rss)\n \n return @collection\n end",
"def page(num)\n limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))\n end",
"def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end",
"def to_page\n page\n end",
"def get_page(page_number)\n # Find URI that we can work with, if we cannot get the first or the\n # last page URI then there is only one page.\n page_uri = first_page_uri || last_page_uri\n return nil unless page_uri\n\n perform_request(page_uri, page_number)\n end",
"def __page\n @_page || 1\n end",
"def getItemByPageName(name)\n request('getItemByPageName', {'name' => name})\n end",
"def test_page_start_for\n with_a_collection do\n assert_equal(1, @coll.page_start_for(1))\n assert_equal(11, @coll.page_start_for(2))\n end\n end",
"def show\n\n @collection = @current_user.collections.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection }\n end\n end",
"def first_page\n previous_page? ? updated_collection(from: from, page: { number: 1 }) : self\n end",
"def find_in_collection(id)\n collection.find_by_id(id)\n end",
"def perform_get_with_object_from_collection(path, options, klass, collection_name)\n perform_request_with_object_from_collection(:get, path, options, klass, collection_name)\n end",
"def page\n self.class.page\n end",
"def pages!(collection, opts = {})\n return unless collection && is_paginated?(collection)\n\n options_query_parameters, original_params, original_url = handle_url(opts)\n\n if opts.fetch(:no_count, false)\n pages_without_count(collection, options_query_parameters, original_params, original_url)\n elsif is_countable?(collection)\n pages_with_count(collection, options_query_parameters, original_params, original_url)\n else\n pages_without_count(collection, options_query_parameters, original_params, original_url)\n end\n end",
"def paginate(collection)\n will_paginate(collection, :inner_window => 2)\n end",
"def page\n Integer(parsed_body['Meta']['Parameters']['page'] || 1)\n end",
"def page(pg, per = self.per_page)\n new_collection = self.class.new(params.merge(:page => pg))\n new_collection.per_page = per\n new_collection\n end",
"def page_number\n query_params&.dig(:page)\n end",
"def page_number\n query_params&.dig(:page)\n end",
"def find(collection, *key)\n command(collection).get(key)\n end",
"def item_page\n @item_page ||= ApiBucket::Base::Element.get(@doc, \"//ItemPage\").to_i\n end",
"def index\n respond_to do |format|\n format.html\n format.json do\n collections = Collection.where.not(published_at: nil)\n .order(published_at: :desc)\n .page(params[:page])\n .per(Collection::COLLECTION_PER)\n is_more_load = collections.total_pages > params[:page].to_i\n render json: { collections: collections, is_more_load: is_more_load }\n end\n end\n end",
"def set_page_collection\n @page_collection = PageCollection.find_by(id: params[:id])\n @page_collection ||= PageCollection.find_by(id: params[:page_collection_id])\n\n unless @page_collection\n redirect_to root_path, notice: \"Collection not found!\"\n return\n end\n end",
"def index\n @pages = Page.all.order(\"id desc\").page(params[:page]).per_page(8)\n \n end"
] |
[
"0.69254494",
"0.68476516",
"0.68079156",
"0.6805436",
"0.6805436",
"0.66945153",
"0.6667308",
"0.6661761",
"0.66353804",
"0.66188407",
"0.6616022",
"0.6616022",
"0.65988135",
"0.65988135",
"0.6558365",
"0.65333027",
"0.65045583",
"0.6502502",
"0.64963126",
"0.6468567",
"0.6452906",
"0.64317596",
"0.6418376",
"0.64136547",
"0.6412159",
"0.64047956",
"0.6396262",
"0.637552",
"0.6373549",
"0.6348603",
"0.63184816",
"0.6278103",
"0.6276664",
"0.62751305",
"0.62636566",
"0.62623125",
"0.62403",
"0.6232734",
"0.62233514",
"0.6216969",
"0.62091506",
"0.6206615",
"0.6155589",
"0.61402315",
"0.6137249",
"0.6117311",
"0.611329",
"0.6092696",
"0.608641",
"0.60852396",
"0.6074922",
"0.6062119",
"0.6053265",
"0.6049622",
"0.6046247",
"0.6031706",
"0.6019527",
"0.6018102",
"0.6016468",
"0.59931135",
"0.5990438",
"0.59873784",
"0.5985475",
"0.5976363",
"0.59605813",
"0.59568626",
"0.5954758",
"0.5948241",
"0.59471774",
"0.5941252",
"0.59348416",
"0.59281135",
"0.5915452",
"0.5915452",
"0.5911775",
"0.5911397",
"0.59089243",
"0.5908589",
"0.5906992",
"0.5901569",
"0.5899757",
"0.5897976",
"0.58793056",
"0.5877635",
"0.5856378",
"0.585479",
"0.58504045",
"0.58481514",
"0.58420485",
"0.5839291",
"0.58352965",
"0.58350533",
"0.58308905",
"0.5830528",
"0.5830528",
"0.58263254",
"0.5819751",
"0.5816584",
"0.5816455",
"0.5810807"
] |
0.5911296
|
76
|
Retrieves a collection of resources
|
def all(options = {})
response = client.get(base_path, options)
return parse(response) unless block_given?
yield response
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def collection\n resource_class.all\n end",
"def resources\n self.collection.find({}, :sort => [:_id, :asc]).map do |hash|\n self.normalize hash\n end\n end",
"def collection(options={})\n response = client.get(api_path, options)\n\n if response.success?\n collection = []\n\n response.body.each do |json|\n collection << new(json)\n end\n\n collection\n else\n []\n end\n end",
"def resources\n nodeset = query_root_node(\"gdacs:resources/gdacs:resource\", @@NAMESPACES)\n @items = []\n if !nodeset.nil?\n nodeset.each do |item|\n item_obj = SemanticCrawler::Gdacs::Resource.new(item)\n @items << item_obj\n end\n end\n @items\n end",
"def resources(*args)\n run_context.resource_collection.find(*args)\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n return @resources\n end",
"def resources\n @resources\n end",
"def all\n setup_request \"#{@@resource_url}s\"\n end",
"def resource_list\n self.resources\n end",
"def resources\n @resources.values\n end",
"def all\n api_get(path)\n end",
"def all(params = {})\n query = params.map { |key, value| \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\" }.join(\"&\")\n query = \"?\" + query unless query.empty?\n code, data = @session.get(collection_path + '.json' + query)\n data.collect { |data|\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session => @session, :prefix => @prefix))\n }\n end",
"def resources\n @resources ||= []\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def all\n PaginatedResource.new(self)\n end",
"def resources\n typed_set(entities, Occi::Core::Resource)\n end",
"def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end",
"def resources options={}\n @resources ||= find_resources options\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def index\n @api_v1_resources = Api::V1::Resource.all\n end",
"def index\n @resources = Resource.all\n end",
"def get_resources(url, resource_class, params={})\n get(url, params).map do |result|\n resource_class.from_hash(result, client: self)\n end\n end",
"def list(options = {})\n url = build_url\n url << \"&$top=#{options[:top]}\" if options[:top]\n url << \"&$filter=#{options[:filter]}\" if options[:filter]\n\n response = rest_get(url)\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::ResourceGroup)\n end",
"def list_all(options = {})\n url = build_url(nil, options)\n response = rest_get(url)\n\n if options[:all]\n get_all_results(response)\n else\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)\n end\n end",
"def resources\n @resources ||= @response[@resource_field].to_a\n end",
"def available_collections\n api = API.new\n params = {:limit => 9999, :preserve_original => true}\n response = api.send_and_receive('collections', {:params => params})\n response.map {|n| [n['title'], n['identifier']]}\n end",
"def list(resource_group, options = {})\n url = build_url(resource_group, options)\n response = rest_get(url)\n\n if options[:all]\n get_all_results(response)\n else\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)\n end\n end",
"def collection\n return @client.api_helper.collection(\"items\")\n end",
"def index\n self.resources = resource_class.all.paginate(per_page: 15, page: (params[:page] || 1).to_i)\n end",
"def all(client, opts = {})\n request = Request.new(client, :get, RESOURCE_COLLECTION, params: opts)\n Cursor.new(self, request, init_with: [client])\n end",
"def get_resources()\n data, _status_code, _headers = get_resources_with_http_info()\n return data\n end",
"def get_resources(opts = {})\n data, _status_code, _headers = get_resources_with_http_info(opts)\n data\n end",
"def get_all_resources(klasses = nil)\n replies = get_all_replies(klasses)\n return nil unless replies\n resources = []\n replies.each do |reply|\n resources.push(reply.resource.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n end",
"def index\n @collections = Collection.all\n respond_with(@collections)\n end",
"def list\n call(:get, path)\n end",
"def resources(opts={})\n Tripod::ResourceCollection.new(\n self.resource_class._resources_from_sparql(self.as_query(opts)),\n # pass in the criteria that was used to generate this collection, as well as whether the user specified return graph\n :return_graph => (opts.has_key?(:return_graph) ? opts[:return_graph] : true),\n :criteria => self\n )\n end",
"def all\n describe(resource_uri)\n end",
"def all(options = {})\n response = get(options)\n xml = Nokogiri::XML(response).css(\"#{defaults[:collection_name]}\")\n \n collection = xml.inject([]) do |result, item|\n result << new(item)\n result\n end\n collection\n end",
"def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end",
"def show_resources\r\n @resources_pages = Paginator.new self, \r\n Resource.count, \r\n Resource.get(\"resources_paginator_count\").to_i, \r\n params[:page] \r\n @resources = Resource.find :all, :order => 'name',\r\n :limit => @resources_pages.items_per_page,\r\n :offset => @resources_pages.current.offset \r\n end",
"def resources\n collection = Miasma::Models::Orchestration::Stack::Resources.new(self)\n collection.define_singleton_method(:perform_population) do\n valid = stack.sparkleish_template.fetch(:resources, {}).keys\n stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|\n Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state\n end\n end\n collection\n end",
"def resources\n @resources = {\n :lumber => Lumber.new,\n :clay => Clay.new,\n :iron => Iron.new,\n :crop => Crop.new\n } if @resources.nil?\n return @resources\n end",
"def resources\n @data.keys\n end",
"def decorated_collection\n @collection.map do |element|\n Resource.new(element, @controller)\n end\n end",
"def get_all(klass = nil, search_params = {})\n replies = get_all_bundles(klass, search_params)\n return nil unless replies\n resources = []\n\t\treplies.each do |reply|\n resources.push(reply.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n\tend",
"def resource_collection\n client.run_status.run_context.resource_collection\n end",
"def resources\n @resources ||= Resources.new\n if block_given?\n yield(@resources)\n end\n @resources\n end",
"def ar_retrieve_resources\n run_callbacks :ar_retrieve_resources do\n if params[:_search]\n # Fulltext search\n\n @resources = ar_model.search(params[:_search])\n @resources_count = @resources.count\n else\n intf = ar_model.interfaces[:rest]\n\n @resources_relation ||= ar_model.all\n\n # Authorization\n if intf.authorization_required?\n @resources_relation = @resources_relation.with_capability(aaa_context)\n end\n\n @authorized_resources_relation = @resources_relation\n\n # Filters\n @resources_relation = apply_scopes_to_relation(@resources_relation)\n @resources_relation = apply_json_filter_to_relation(@resources_relation)\n @resources_relation = apply_simple_filter_to_relation(@resources_relation)\n\n # Display filters\n @resources_relation = apply_sorting_to_relation(@resources_relation)\n @paginated_resources_relation = apply_pagination_to_relation(@resources_relation)\n\n @resources = @paginated_resources_relation\n @resources_count = @resources_relation.count\n end\n end\n\n @resources\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end",
"def index\n @resources = resource_class.send(:all)\n render json: @resources\n end",
"def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end",
"def resources\n @resources ||= {}\n end",
"def all_resources\n @run_context && @run_context.resource_collection.all_resources\n end",
"def fetch_all\n klass_name = Starwars.const_get(name.split('::').last).const_get('RESOURCE_NAME')\n object = Starwars.const_get(\"#{klass_name.capitalize}\").new(url: \"#{Starwars::Base::BASE_URL}/#{klass_name}/\")\n Starwars::Request.new(resource: object, uri: object.url, params: {}).perform_request\n end",
"def all(page = 1, per_page = 10)\n params = {\n page: page,\n per_page: per_page\n }\n list = JSON.parse(connection.get(\"/collections/\", params).body)\n list.map { |data| Unsplash::Collection.new(data) }\n end",
"def get_resources\n routes_doc = get_routes_doc\n resources_names = routes_doc.get_resources_names - resources_black_list\n\n resources_names.map do |resource|\n puts \"Generating #{resource} documentation...\" if trace?\n ResourceDoc.new( resource, routes_doc.get_actions_route_info( resource ) )\n end\n end",
"def index\n respond_with Collection.all\n end",
"def index\n respond_with Collection.all\n end",
"def lists\n Resources::Lists.new(self)\n end",
"def get_nested_resource_objects\n end",
"def resource_collection\n @resource_collection ||= @run_context.resource_collection\n end",
"def index\n @collections = Collection.all\n end",
"def index\n @collections = Collection.all\n end",
"def resources(oneview_type = nil, oneview_name = nil)\n oneview_type = @options[:oneview_type] if oneview_type.nil?\n oneview_name = @options[:oneview_name] if oneview_name.nil?\n raise 'Oneview resource type must be specified.' if oneview_type.nil?\n\n # Determine the endpoint that needs to be called\n endpoint = format('/rest/%s', oneview_type)\n\n # Find the resources\n response = oneview_client.rest_get(endpoint)\n resources = oneview_client.response_handler(response)\n\n return resources if oneview_name.nil?\n\n # Filter the resources by the name if it has been specified\n resources['members'].select { |r| r['name'] == oneview_name }\n end",
"def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end",
"def all(options = {})\n #assert_kind_of 'options', options, Hash\n query = { :name => nil }.merge!(options).merge!(:id => nil)\n result = mqlread([ query ], :cursor => !options[:limit]) \n Basuco::Collection.new(result.map { |r| Basuco::Resource.new(r) })\n end",
"def index\n @users_collections = Users::Collection.all\n end",
"def fetch(options = {})\n validate_collection_options(options)\n\n collection_class.new(client.get(base_uri, options).body, client)\n end",
"def list\n get()\n end",
"def make_collection\n @resource.make_collection\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def find_all_resources options\n policy_scope(resource_class)\n end",
"def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end",
"def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"def index\n @admin_resources = AdminResource.page(params[:page])\n end",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def load_collection\n model_class.all(find_options)\n end",
"def all(params={})\n scoped_attributes = self.class.scopes.inject({}){|r,k| r.merge(k.to_s => send(k))}\n scoped_attributes.merge!(params)\n body = connection.send(collection_method, scoped_attributes).body\n\n collection = self.load(body[collection_root])\n collection.merge_attributes(Cistern::Hash.slice(body, \"count\", \"next_page\", \"previous_page\"))\n collection\n end",
"def all_resources(set = Set.new)\n set << self\n self.each_resource { |r| r.all_resources(set) }\n set\n end",
"def read_collections\n site.collections.each_value do |collection|\n next if collection.data?\n\n collection.read\n end\n end",
"def list\n url = prefix + \"list\"\n return response(url)\n end",
"def list(**options)\n raise ParameterMissing, 'required parameter :ids is missing' unless options[:ids]\n\n get_collection_by_ids(options.delete(:ids), options)\n end",
"def index\n @resource_groups = ResourceGroup.all\n end",
"def resourcegroups\n result = @http.get('/resourcegroups')\n result[1]\n end",
"def perform_get_with_objects_from_collection(path, options, klass, collection_name)\n perform_request_with_objects_from_collection(:get, path, options, klass, collection_name)\n end",
"def resources\n @resources ||= process_data(decoded_body[resources_key])\n end",
"def resources\n @resources ||= if options[:resources]\n options[:resources]\n elsif options[:search]\n if options[:search].is_a?(String)\n options[:search] = Rack::Utils.parse_nested_query(options[:search])\n end\n\n model.ransack(options[:search]).result\n else\n model.all\n end\n end",
"def resources\n body && [*body]\n end",
"def get_resources\n init_folder unless @init # have I been initialized?\n return @resources \n end",
"def catalogs\n path = \"#{api_root}/index/catalogs\"\n process_api_request(:get, path)\n end"
] |
[
"0.78975713",
"0.75651526",
"0.73177934",
"0.7306009",
"0.7232982",
"0.72016895",
"0.72016895",
"0.72016895",
"0.70865995",
"0.7059169",
"0.70431733",
"0.70049995",
"0.70029676",
"0.69989496",
"0.69456136",
"0.6924579",
"0.6924579",
"0.6924579",
"0.6924579",
"0.6924579",
"0.6924579",
"0.6924579",
"0.6924579",
"0.6924579",
"0.6924579",
"0.6910779",
"0.6904945",
"0.6850584",
"0.68030226",
"0.68030226",
"0.68030226",
"0.6798039",
"0.6787567",
"0.6787381",
"0.67635405",
"0.6759308",
"0.6751164",
"0.67018986",
"0.6679844",
"0.6679438",
"0.66670036",
"0.6658985",
"0.66295344",
"0.6610602",
"0.6601249",
"0.65972",
"0.6594361",
"0.65777487",
"0.6571624",
"0.6561183",
"0.6552603",
"0.65431637",
"0.6537968",
"0.65376836",
"0.6521532",
"0.6495292",
"0.6485705",
"0.6485368",
"0.64838344",
"0.6468795",
"0.64684516",
"0.646812",
"0.6455252",
"0.64546305",
"0.6453634",
"0.64508146",
"0.64477944",
"0.64475834",
"0.64475834",
"0.64463204",
"0.644473",
"0.6439232",
"0.6437366",
"0.6437366",
"0.643232",
"0.6432198",
"0.6426661",
"0.64259243",
"0.640117",
"0.6400534",
"0.6385947",
"0.63855666",
"0.63781685",
"0.63661635",
"0.6357029",
"0.63512295",
"0.63481337",
"0.63340694",
"0.6334011",
"0.63337207",
"0.63294387",
"0.63156545",
"0.63094455",
"0.62960845",
"0.6287892",
"0.6280331",
"0.62699467",
"0.626577",
"0.6262752",
"0.6261368",
"0.6258191"
] |
0.0
|
-1
|
accepts_nested_attributes_for :cuttings, allow_destroy: true calculates the days to recover a plant
|
def recovered?
date = self.arrival_date
rec_date = self.recovery_date
if rec_date == nil
"Not Recovered"
elsif date > rec_date
"Not Recovered"
else
a = Date.parse("#{date}")
b = Date.parse("#{rec_date }")
c = b.mjd - a.mjd
"#{rec_date.month}/#{rec_date.day}/#{rec_date.year} | #{c} day"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def planting_params\n params.require(:planting).permit(:date, :seed_treated, :soil_condition, :grow_id)\n end",
"def form_object_params\n params.require(:meal).permit(:consumption_time, ingredients_attributes: %i(name id commit _destroy))\n end",
"def planting_params\n params.require(:planting).permit(:plant_id, :planting_type, :planting_date_begin, :planting_date_end, :days_to_harvest_from, :days_to_harvest_to)\n end",
"def copydays_params\n params.require(:copy).permit(:from, :to, :num_days)\n end",
"def kondate_form_params\n params.require(:kondate).permit(:title, :description, :main_recipe_id, :side_recipe_ids)\n end",
"def resetDaysUsedIfNewProduct\n if self.condition == true\n self.days_used = \"\"\n end\n end",
"def update_most_recent_fields_in_planting\n p = self.planting\n p.set_most_recent_maintenance_fields\n p.save\n end",
"def field_datum_params\n params.require(:field_datum).permit(:date,:observer,:releve_number,:scale,:location,:latitude_degree,:latitude_minutes,:latitude_seconds,:longitude_degree,:longitude_minutes,:longitude_seconds,:habitat_description,:project_id,:community_id,observations_attributes:[:id,:notes,:species_id,:_destroy,growth_forms_attributes:[:id,:code,:order,:_destroy],plant_covers_attributes:[:id,:code,:_destroy],crown_diameters_attributes:[:id,:code,:_destroy]])\n end",
"def modificar_cruces_pendientes(cant)\n unless self.importacion.nil?\n pend = self.importacion.cruces_pendientes\n self.importacion.update_attributes(:cruces_pendientes => (pend + cant) )\n end\n end",
"def tank_fuelday_params\n params.require(:tank_fuelday).permit(:day, :data_asset_id, :user_id, :employee_id, :site_asset_id, asset_fueldays_attributes: AssetFuelday.attribute_names.map(&:to_sym).push(:_destroy))\n end",
"def dinner_params\n params.require(:dinner).permit(:id, :dinner_date, :user_id, dinner_recipes_attributes: [:id, :recipe_id, :_destroy], dinner_guests_attributes: [:id, :guest_id, :_destroy])\n end",
"def thermal_production_params\n params.require(:thermal_production).permit(:company_id, :note,\n thermal_production_items_attributes: [:id, :thermal_production_id, :caldo_freddo, :utenza, :nome_generatore, :matricola, :potenza, :dest_acs, :_destroy])\n end",
"def new_day_params\n params.require(:new_day).permit!\n end",
"def new\n person = Person.find(params[:id])\n # person.vizit.destroy if person.vizit #????????????????????????????\n @vizit = person.build_vizit\n @vizit.build_insurance\n @vizit.insurance.build_polis\n if person.foreigner\n logger.debug { \"===============>\" + person.foreigner.ig_doctype.length.to_s }\n if person.foreigner.ig_doctype.length > 20\n @vizit.insurance.polis.dstop = person.foreigner.ig_enddate\n end\n end\n # @vizit = Vizit.new\n end",
"def daily_intake_params\n params.require(:daily_intake).permit(:key, :value, :unit, :category)\n end",
"def day_params\n params.require(:day).permit(:gift, :thing, :daily, :effort, :improvement)\n end",
"def despatch_params\n params.require(:despatch).permit(:day, :product_id, :quantity, :unit, :client_id, :d_c_number)\n end",
"def trigger_setting_was_under_15_at_dx\n\t\tlogger.debug \"DEBUG: calling update_patient_was_under_15_at_dx from StudySubject:#{self.attributes['id']}\"\n\t\tlogger.debug \"DEBUG: DOB changed from:#{dob_was}:to:#{dob}\"\n\t\tupdate_patient_was_under_15_at_dx\n\tend",
"def create\n @plant = @project.plants.new(plant_params)\n @plant.foreman_start_date = @plant.contract_start_date\n @plant.foreman_end_date = @plant.contract_end_date\n @plant.client_company_id = @project.client_company_id\n if ((@project.start_date..@project.end_date).cover?(@plant.contract_start_date)) &&\n ((@project.start_date..@project.end_date).cover?(@plant.contract_end_date))\n\n respond_to do |format|\n if @plant.save\n format.html {redirect_to project_plants_path, notice: 'Plant was successfully created.'}\n format.json {render :show, status: :created, location: @plant}\n else\n format.html {render :new}\n format.json {render json: @plant.errors, status: :unprocessable_entity}\n end\n\n\n end\n else\n @plant.errors.add(:base, 'Date should be sub set of project start and end date.')\n render :action => 'new'\n end\n end",
"def deletedays_RETIRED\n ###################################################################\n # DO NOT USE\n # DOES NOT HANDLE CHAINS CORRECTLY\n ###################################################################\n\n #logger.debug \"entering deletedays\"\n #logger.debug \"deletedays_params: \" + deletedays_params.inspect\n #sf = 5 # signigicant figures\n mystartdeletedate = deletedays_params[\"from\"].to_date\n myenddeletedate = deletedays_params[\"from\"].to_date + deletedays_params[\"num_days\"].to_i\n @options = Hash.new\n @options[:startdate] = mystartdeletedate\n @options[:enddate] = myenddeletedate\n @cal = calendar_read_display1f(@options)\n if @cal.empty?\n # these days are empty - show error and return\n flash[:notice] = \"These days are empty - nothing to delete!!!\"\n redirect_to deletedaysedit_path(deletedays_params)\n end\n # get to here, we are set up to do deletes\n # @cal contains the info to be deleted.\n @results = Array.new\n# Each site has an array\n# @cal{sitename}[0][] -> [0] = {value = site name}\n# [1] = {value = date}\n# @cal{sitename}[1][] -> [0] = {value = session_time} e.g. \"03-3- PM\"\n# [1] = {slotid = nnnn\n# id_dom = \"CAL201804041530\"\n# values[] -> [0] = object #<Lesson>\n# [1] = object #<Lesson>\n# ....\n @cal.each do |site, sitevalue| \n # Now work through the slots for this site and day\n siteName = siteDate = \"\" # control scope\n sitevalue.each_with_index do |bankslots, bankslotindex|\n if bankslotindex == 0 \n siteName = bankslots[0]['value']\n siteDate = siteDateBankFrom = bankslots[1]['value']\n n = siteDate.match(/(\\d+.*)/)\n siteDate = n[1]\n if bankslots[2] == nil\n @results.push \"processing #{siteName} #{siteDateBankFrom}\"\n else\n siteDateBankTo = bankslots[2]['value']\n @results.push \"processing #{siteName} #{siteDateBankFrom} to #{siteDateBankTo}\"\n end\n else\n bankslots.each_with_index do |slot, slotindex|\n if slotindex == 0\n next # simply holds the slot time - will get from found slot\n end\n thisslotid = slot['slotid']\n # if not a valid slot, go to next iteration.\n if thisslotid == nil\n next\n end\n @results.push \"Slotid: #{thisslotid}\"\n thisslot = Slot.find(thisslotid)\n @results.push \"Check slot \" + thisslot.inspect \n # Now to look at each lession in each slot\n if slot['values'].respond_to?(:each) then\n slot['values'].each do |lesson|\n logger.debug \"lesson: \" + lesson.inspect\n @results.push \"Check lesson \" + lesson.inspect \n # Now find all the tutors in this lesson\n if lesson.tutors.respond_to?(:each) then\n lesson.tutors.sort_by {|obj| obj.pname }.each do |tutor|\n tutroles = tutor.tutroles.where(lesson_id: lesson.id)\n tutroles.each do |tutrole|\n if tutrole.destroy\n @results.push \"Removed tutrole #{tutor.pname} \" + \n tutrole.inspect \n else\n @results.push \"FAILED removing tutrole #{tutor.pname} \" +\n tutrole.inspect + \n \"ERROR: \" + tutrole.errors.messages.inspect\n end\n end\n end\n end\n \n # Now find all the students in this lesson\n if lesson.students.respond_to?(:each) then\n lesson.students.sort_by {|obj| obj.pname }.each do |student|\n roles = student.roles.where(lesson_id: lesson.id)\n roles.each do |role|\n if role.destroy\n @results.push \"Removed role #{student.pname} \" + role.inspect\n else\n @results.push \"FAILED removing role #{student.pname} \" +\n role.inspect + \n \"ERROR: \" + role.errors.messages.inspect\n end\n end\n end\n end\n # Now remove the lesson the tutors and students were in\n mylesson = Lesson.find(lesson.id)\n if mylesson.destroy\n @results.push \"Removed lesson \" + \n mylesson.inspect \n else\n @results.push \"FAILED removing lesson \" + mylesson.inspect + \n \"ERROR: \" + mylesson.errors.messages.inspect\n end\n end # looping lessons\n end\n # Now remove the slot the lessons were in.\n if thisslot.destroy\n @results.push \"Removed slot \" + thisslot.inspect \n else\n @results.push \"FAILED removing slot \" + thisslot.inspect + \n \"ERROR: \" + thisslot.errors.messages.inspect\n end\n end\n end\n end\n end\n end",
"def calculate_and_save_delta_ps\n\n fittings = PipeSizing.fitting1\n orifice_id = nil\n fittings.each {|item| orifice_id = item[:id] if item[:value] == 'Orifice' }\n\t orifice_dp = self.discharge_circuit_piping.sum(:delta_p, :conditions => ['fitting = ? ', orifice_id])\n\n #calculate flow elements sum\n flow_element_ids = []\n\n fittings.each do |item| \n if item[:value].include?(\"Flow\")\n flow_element_ids << item[:id] \n end\n end\n\n flow_elements_dp_sum = 0.0\n self.discharge_circuit_piping.where({:fitting => flow_element_ids}).each do |f|\n flow_elements_dp_sum = flow_elements_dp_sum + f.delta_p\n end\n\n #add flow elements dp sum to orifice dp\n orifice_dp = orifice_dp + flow_elements_dp_sum\n\n equipment_id = nil\n fittings.each {|item| equipment_id = item[:id] if item[:value] == 'Equipment' }\n\t equipment_dp = self.discharge_circuit_piping.sum(:delta_p, :conditions => ['fitting = ? ', equipment_id])\n\n control_valve_id = nil\n fittings.each {|item| control_valve_id = item[:id] if item[:value] == 'Control Valve' }\n\t control_valve_dp = self.discharge_circuit_piping.sum(:delta_p, :conditions => ['fitting = ? ', control_valve_id])\n\n\ttotal_system_dp = discharge_circuit_piping.sum(:delta_p)\n fitting_dp = total_system_dp - (equipment_dp + control_valve_dp + orifice_dp)\n\n\tunit_decimals = self.pump_sizing.project.project_units\n\n\tpressure_at_discharge_nozzle = destination_pressure + total_system_dp\n\n \tupdate_attributes(\n :fitting_dp => fitting_dp.round(unit_decimals[\"Pressure\"][\"Differential\"][:decimal_places].to_i),\n\t\t:equipment_dp => equipment_dp.round(unit_decimals[\"Pressure\"][\"Differential\"][:decimal_places].to_i),\n\t\t:control_valve_dp => control_valve_dp.round(unit_decimals[\"Pressure\"][\"Differential\"][:decimal_places].to_i),\n\t\t:orifice_dp => orifice_dp.round(unit_decimals[\"Pressure\"][\"Differential\"][:decimal_places].to_i),\n\t\t:total_system_dp => total_system_dp.round(unit_decimals[\"Pressure\"][\"General\"][:decimal_places].to_i),\n\t\t:pressure_at_discharge_nozzle_dp => pressure_at_discharge_nozzle.round(unit_decimals[\"Pressure\"][\"General\"][:decimal_places].to_i)\n\t)\n end",
"def calorie_params\n params.require(:calorie).permit(:date, :meal, :calories_consumed)\n end",
"def caloric_intake_params\n params.require(:caloric_intake).permit(:consumed_calories, :calories_date)\n end",
"def recipe_params\n \n params.require(:recipe).permit(:name, :description, :image, :image_cache, :remove_image, \n :cook_time, :complexity_id, :cooking_time_id, :is_draft, :is_checked, {category_ids: []},\n recipes_categories_attributes: [:id, :category_id, :_destroy],\n categories_attributes: [:id, :title, :_destroy], \n recipe_parts_attributes: [:id, :image, :remove_image, :image_cache, :description, :_destroy], \n ingredient_lists_attributes: [:id, :name, :_destroy, \n ingredient_items_attributes:[:id, :qty, :measure_id, :ingredient_id, :_destroy, \n ingredient_attributes:[:id, :name]]])\n end",
"def create\n\n @recipe = current_user.recipes.build(recipe_params)\n\n if params[:recipe][:measurements_attributes]\n # try to save ingredient unique, check if name exists in db\n params[:recipe][:measurements_attributes].keys.each_with_index do |k, i|\n ing_name = params[:recipe][:measurements_attributes][k][:ingredient_attributes][:name]\n if Ingredient.find_by(name: ing_name, concentrate_recipe_id: nil)\n ingredient = Ingredient.find_by(name: ing_name, concentrate_recipe_id: nil)\n @recipe.measurements[i].ingredient = ingredient\n\n elsif Ingredient.find_by(name: ing_name)\n ingredient = Ingredient.find_by(name: ing_name)\n @recipe.measurements[i].ingredient = ingredient\n end\n end\n end\n\n params[:recipe][:allergy].each do |key,value|\n if value[\"name\"] == \"1\"\n allergy = Allergy.find(key)\n @recipe.allergies << allergy\n end\n end\n\n if params[:recipe][:concentrate] == '1' || params[:recipe][:recipe_category_id] == RecipeCategory.find_by(name: \"Concentrates\").id\n @recipe.concentrate = true\n else\n @recipe.concentrate = false\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n @allergies = Allergy.all\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # if ((@plant.start_date..@project.end_date).cover?(params[:plant][:foreman_start_date]))\n respond_to do |format|\n # if @plant.foreman_id.eql?(params[:plant][:foreman_id])\n if @plant.update(plant_params)\n\n format.html {redirect_to \"/projects/#{@project.id}/plants\", notice: 'Plant was successfully updated.'}\n format.json {render :show, status: :ok, location: @plant}\n else\n format.html {render :edit}\n format.json {render json: @plant.errors, status: :unprocessable_entity}\n end\n\n end\n\n end",
"def cocktail_params\n # params.require(:cocktail).permit(:name)\n params.require(:cocktail).permit(:name, doses_attributes: [:id, :description, :ingredient_id, :_destroy])\n end",
"def days_validation\n @start_cycle = @vote_setting.start_cycle.to_date \n @end_cycle = @vote_setting.end_cycle.to_date\n @days_count = (@end_cycle - @start_cycle).round\n end",
"def trigger_setting_was_under_15_at_dx\n\t\tlogger.debug \"DEBUG: calling update_patient_was_under_15_at_dx from \"<<\n\t\t\t\"StudySubject:#{self.attributes['id']}\"\n\t\tlogger.debug \"DEBUG: DOB changed from:#{dob_was}:to:#{dob}\"\n\t\tupdate_patient_was_under_15_at_dx\n\tend",
"def dow_params\n params.require(:dow).permit(:specialid, :day)\n end",
"def set_creation_defaults\n if self.max_days == 0\n self.max_days = nil\n self.end_date = nil\n else\n self.end_date = self.start_date + self.max_days\n end\n self.percent = 0\n end",
"def plant_params\n params.require(:plant).permit(:garden_id, :plant_image, :family, :variety, :seed_source, :quantity, :notes, :plant_date)\n end",
"def budget_params\n params.require(:budget).permit(:id,:reservation_request_id,:comfort_id,:check_in, :check_out,:comentario, :descuento, :total,:budget_room_details_attributes => [:id, :cantidad, :type_of_room_id, :subtotal, :_destroy], :budget_service_details_attributes => [:id, :cantidad, :service_id, :subtotal, :_destroy])\n end",
"def treatment_params\n params.require(:treatment).permit(:name, :id_treatment, :type, :dosis, :total, :secondary_effects, :days)\n end",
"def daily_timesheet_params\n params.require(:daily_timesheet).permit(\n :facility_id,\n :employee_id,\n :date,\n :start_time,\n :end_time,\n :no_work,\n :salary_period_id,\n :rework,\n :penalty_id,\n :quality_penalty_id,\n :penalty_description,\n :probation_period,\n :payment_type_id,\n :ratio,\n :salary,\n :overtime,\n :description,\n :total_amount,\n :daily_timesheet_status_id,\n :additional_payment_value,\n :additional_payment_reason,\n daily_timesheet_work_types_attributes: [:id, :work_type_id, :amount, :_destroy],\n daily_timesheet_penalties_attributes: [:id, :penalty_id, :employee_id, :_destroy]\n )\n end",
"def create\n \n \n @orden_product = OrdenProduct.new(orden_product_params)\n \n @orden_product.orden_id = @orden.id \n \n @orden_product.avisodetail_id = 131\n @orden_product.price = (@orden_product.tarifa / 30 * @orden.tiempo )\n @company = Company.find(1)\n sum_dias = (@orden_product.d01 + @orden_product.d02 + @orden_product.d03 + @orden_product.d04+ \n @orden_product.d05 + @orden_product.d06 + @orden_product.d07 + @orden_product.d08+\n @orden_product.d09 + @orden_product.d10 + @orden_product.d11 + @orden_product.d12+\n @orden_product.d13 + @orden_product.d14 + @orden_product.d15 + @orden_product.d16+\n @orden_product.d17 + @orden_product.d18 + @orden_product.d19 + @orden_product.d20+\n @orden_product.d21 + @orden_product.d22 + @orden_product.d23 + @orden_product.d24+\n @orden_product.d25 + @orden_product.d26 + @orden_product.d27 + @orden_product.d28+\n @orden_product.d29 + @orden_product.d30 + @orden_product.d31)\n @orden_product.quantity = sum_dias \n @orden_product.total = @orden_product.price * sum_dias\n\n \n \n respond_to do |format|\n if @orden_product.save\n \n @orden[:subtotal] = @orden.get_subtotal(\"subtotal\")\n @orden[:tax] = @orden.get_subtotal(\"tax\")\n @orden[:total] = @orden[:subtotal] + @orden[:tax]\n \n @orden.update_attributes(:subtotal=> @orden[:subtotal])\n \n \n \n \n format.html { redirect_to @orden, notice: 'Orden product was successfully created.' }\n format.json { render :show, status: :created, location: @orden }\n \n else\n format.html { render :new }\n format.json { render json: @orden.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trial_days_left\n @attributes[:trial_days_left]\n end",
"def save_days_off\n if params[:company]\n days_off = DayOff.where(\"company = ?\", true)\n redirect = holidays_path(:company => true)\n day_hours = DayHour.first\n day_hours.hours = params[:day_hours]\n day_hours.save!\n else\n days_off = DayOff.where(\"project_id = ?\", session[:actual_project])\n redirect = holidays_path\n ap = actual_project\n ap.hours_day = params[:day_hours]\n ap.save!(:validate => false) #por las dudas le pongo que skip validations, no vaya a ser que de un error\n end\n days_off.each do |day|\n day.off = true\n case day.wday\n when 0: day.off = false unless params[:wday_domingo]\n when 1: day.off = false unless params[:wday_lunes]\n when 2: day.off = false unless params[:wday_martes]\n when 3: day.off = false unless params[:wday_miercoles]\n when 4: day.off = false unless params[:wday_jueves]\n when 5: day.off = false unless params[:wday_viernes]\n when 6: day.off = false unless params[:wday_sabado]\n end\n day.save!\n end\n redirect_to(redirect, :notice => t(\"screens.notice.successfully_created\"))\n end\n\nend",
"def copytermdays_RETIRED\n logger.debug \"entering copytermdays\"\n #logger.debug \"copytermdays_params: \" + copytermdays_params.inspect\n #sf = 5 # signigicant figures\n mystartcopyfromdate = copytermdays_params[\"from\"].to_date\n myendcopyfromdate = copytermdays_params[\"from\"].to_date + copytermdays_params[\"num_days\"].to_i\n mystartcopytodate = copytermdays_params[\"to\"].to_date\n myendcopytodate = copytermdays_params[\"to\"].to_date + copytermdays_params[\"num_days\"].to_i\n #@cal = calendar_read_display2(sf, mystartcopytodate, myendcopytodate)\n #@cal = calendar_read_display1f(sf, mystartcopytodate, myendcopytodate, {})\n @options = Hash.new\n @options[:startdate] = mystartcopytodate\n @options[:enddate] = myendcopytodate\n #@cal = calendar_read_display1f(sf, @options)\n @cal = calendar_read_display1f(@options)\n unless @cal.empty?\n # destination is not empty - show error and return\n flash[:notice] = \"Destination days are not empty - will not copy!!!\"\n redirect_to copytermdaysedit_path(copytermdays_params)\n end\n @options[:startdate] = mystartcopyfromdate\n @options[:enddate] = myendcopyfromdate\n @cal = calendar_read_display1f(@options)\n if @cal.empty?\n # source is empty - show error and return\n flash[:notice] = \"Source days are empty - nothing to copy!!!\"\n redirect_to copytermdaysedit_path(copytermdays_params)\n end\n # get to here, we are set up to do a copy\n # @cal contains the info to be copied.\n # First get the number of dayes to advance by ( + or - is valid)\n adddays = mystartcopytodate - mystartcopyfromdate\n logger.debug \"adddays: \" + adddays.inspect\n @results = Array.new\n# Each site has an array\n# @cal{sitename}[0][] -> [0] = {value = site name}\n# [1] = {value = date}\n# @cal{sitename}[1][] -> [0] = {value = session_time} e.g. \"03-3- PM\"\n# [1] = {slotid = nnnn\n# id_dom = \"CAL201804041530\"\n# values[] -> [0] = object #<Lesson>\n# [1] = object #<Lesson>\n# ....\n# }\n @cal.each do |site, sitevalue| \n # Now work through the slots for this site and day\n siteName = siteDate = \"\" # control scope\n sitevalue.each_with_index do |bankslots, bankslotindex|\n if bankslotindex == 0 \n siteName = bankslots[0]['value']\n siteDate = siteDateBankFrom = bankslots[1]['value']\n n = siteDate.match(/(\\d+.*)/)\n siteDate = n[1]\n if bankslots[2] == nil\n @results.push \"processing #{siteName} #{siteDateBankFrom}\"\n else\n siteDateBankTo = bankslots[2]['value']\n @results.push \"processing #{siteName} #{siteDateBankFrom} to #{siteDateBankTo}\"\n end\n else\n bankslots.each_with_index do |slot, slotindex|\n if slotindex == 0\n next # simply holds the slot time - will get from found slot\n end\n thisslotid = slot['slotid']\n # if not a valid slot, go to next iteration.\n if thisslotid == nil\n next\n end\n @results.push \"Slotid: #{thisslotid}\"\n thisslot = Slot.find(thisslotid)\n mytimeslotTo = thisslot.timeslot + adddays.to_i * 86400\n myslotTo = Slot.new(timeslot: mytimeslotTo, location: thisslot.location)\n if myslotTo.save\n @results.push \"created slot \" + myslotTo.inspect\n else\n @results.push \"FAILED creating slot \" + myslotTo.inspect + \n \"ERROR: \" + myslotTo.errors.messages.inspect\n end\n #-------------------------------------------------------------------\n # For copying term info,\n # 1. Slots are always copied.\n # 2. Determine what tutors and students need to be copied.\n # Logic is:\n # Lesson status | copy lesson | copy tutors | copy students\n # routine | yes | yes if | yes if\n # (=standard) | | - rostered | - rostered\n # | | - away | - away\n # | | - absent | - absent\n # | | | - bye\n # | | no if | no if\n # | | - deal | - deal\n # | | - kind=called| \n # flexible | yes | yes if | no always\n # | | - rostered | \n # | | - away | \n # | | - absent | \n # | | no if | \n # | | - deal | \n # | | - kind=called| \n # on_BFL | yes | yes if | no always\n # | | - rostered | \n # | | - away | \n # | | - absent | \n # | | no if | \n # | | - deal | \n # | | - kind=called| \n # onSetup | yes | yes if | no always\n # | | - rostered | \n # | | - away | \n # | | - absent | \n # | | no if | \n # | | - deal | \n # | | - kind=called| \n # onCall | yes | yes if | no always\n # | | - rostered | \n # | | - away | \n # free | yes | no always | no always\n # global | no | | \n # allocate | no | | \n # park | no | |\n #-------------------------------------------------------------------\n # Now to look at each lesson in each slot\n if slot['values'].respond_to?(:each) then\n slot['values'].each do |lesson|\n logger.debug \"lesson: \" + lesson.inspect\n # is this a valid lesson to copy\n next if ['global', 'allocate', 'park'].include?(lesson.status) \n mylesson = Lesson.new(slot_id: myslotTo.id, status: lesson.status)\n if mylesson.save\n @results.push \"created lesson \" + mylesson.inspect\n else\n @results.push \"FAILED creating lesson \" + mylesson.inspect + \n \"ERROR: \" + mylesson.errors.messages.inspect\n end\n # for free lesson, do not copy any tutors or students\n next if lesson.status == 'free'\n # At this point, decision to copy tutors or students depends\n # on their kind and status.\n # Now find all the tutors in this lesson\n if lesson.tutors.respond_to?(:each) then\n lesson.tutors.sort_by {|obj| obj.pname }.each do |tutor|\n thistutrole = tutor.tutroles.where(lesson_id: lesson.id).first\n # Check if this tutor-lesson should be copied\n flagtutorcopy = false\n flagtutorcopy = true if ['scheduled', 'confirmed', 'notified',\n 'attended', 'away', 'absent'].include?(thistutrole.status)\n flagtutorcopy = false if thistutrole.kind == 'called'\n next unless flagtutorcopy\n mytutrole = Tutrole.new(lesson_id: mylesson.id,\n tutor_id: tutor.id, \n status: 'scheduled',\n kind: thistutrole.kind)\n if mytutrole.save\n @results.push \"created tutrole #{tutor.pname} \" + mytutrole.inspect \n else\n @results.push \"FAILED creating tutrole \" + mytutrole.inspect + \n \"ERROR: \" + mytutrole.errors.messages.inspect\n end\n end\n end\n \n # Now find all the students in this lesson\n if lesson.students.respond_to?(:each) then\n lesson.students.sort_by {|obj| obj.pname }.each do |student|\n thisrole = student.roles.where(lesson_id: lesson.id).first\n # check if this student should be copied.\n # for some lesson types, students are never copied\n next if ['flexible', 'on_BFL', 'onSetup', 'onCall',\n 'free'].include?(lesson.status)\n # others depend on their student-lesson status/\n flagstudentcopy = false\n flagstudentcopy = true if ['scheduled', 'attended', 'away',\n 'absent', 'bye'].include?(thisrole.status)\n next unless flagstudentcopy\n # if so, copy this student-lesson\n myrole = Role.new(lesson_id: mylesson.id,\n student_id: student.id, \n status: 'scheduled',\n kind: thisrole.kind)\n if myrole.save\n @results.push \"created role #{student.pname} \" + myrole.inspect\n else\n @results.push \"FAILED creating role \" + myrole.inspect + \n \"ERROR: \" + myrole.errors.messages.inspect\n end\n end\n end\n end\n end\n end\n end \n end\n end\n end",
"def build_form\n super\n # Set up the multiple parameters for the date coverage attribute in the form\n cov_date = Date.edtf(@form.date_coverage)\n cov_params = Dataset::DateCoverageService.interval_to_params cov_date\n @form.merge_date_coverage_attributes! cov_params\n end",
"def build_form\n super\n # Set up the multiple parameters for the date coverage attribute in the form\n cov_date = Date.edtf(@form.date_coverage)\n cov_params = Dataset::DateCoverageService.interval_to_params cov_date\n @form.merge_date_coverage_attributes! cov_params\n end",
"def set_day_if_discarded; end",
"def create\n\n @prop = Prop.new(params[:prop])\n sc = params[:prop][:start_cycle].to_s.to_date\n ec = params[:prop][:end_cycle].to_s.to_date\n sp = params[:prop][:start_point].to_s\n ep = params[:prop][:end_point].to_s\n reminder1_days = params[:prop][:reminder1_days].to_i\n reminder2_days = params[:prop][:reminder2_days].to_i \n reminder3_days = params[:prop][:reminder3_days].to_i\n if (reminder1_days < 0) || (reminder2_days < 0) || (reminder3_days < 0)\n redirect_to :back ,:notice => \"Settings not saved. Reminder days entry can not be less than 0.\"\n else\n\n if params[:prop][:reset_point] == \"2\" || params[:prop][:reset_point] == \"1\" #Monthly or Never reset points\n if sc.present? && ec.present?\n if sc > ec \n redirect_to :back ,:notice => \"Settings not saved. The cycle start date is after the cycle end date.\"\n elsif (reminder1_days > 29) || (reminder2_days > 29) || (reminder3_days > 29)\n # Reminder is not on nth day, it's start date + n days. See scheduler.rake\n redirect_to :back, :notice => \"Settings not saved. You have selected a monthly cycle but the reminder days entry is more than 29 days.\" \n elsif\n diff = (ec - sc + 1).round\n if diff < 28 || diff > 31\n redirect_to :back, :notice => \"Settings not saved. You have selected a monthly cycle but the cycle timeframe does not seem to be a month long.\"\n elsif sp > ep\n redirect_to :back ,:notice => \"Settings not saved. 'A user must dole out at least' has to be smaller than the number in 'but no more than'.\"\n else\n respond_to do |format|\n if @prop.save\n format.html { redirect_to edit_prop_path(@prop), notice: 'Settings for props were successfully created.' }\n format.json { render json: @prop, status: :created, location: @prop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prop.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n else\n redirect_to :back, :notice=> \"Settings not saved. Looks like you missed filling out some settings.\"\n end \n elsif params[:prop][:reset_point] == \"3\" #Quarterly\n if sc.present? && ec.present?\n if sc > ec \n redirect_to :back ,:notice => \"Settings not saved. The cycle start date is after the cycle end date.\"\n elsif (reminder1_days > 89) || (reminder2_days > 89) || (reminder3_days > 89)\n # Reminder is not on nth day, it's start date + n days. See scheduler.rake\n redirect_to :back, :notice => \"Settings not saved. You have selected a quarterly cycle but the reminder days entry is more than 89 days.\" \n elsif\n diff = (ec - sc + 1).round\n if diff < 89 || diff > 92\n redirect_to :back, :notice => \"Settings not saved. You have selected a quarterly cycle but the cycle timeframe does not seem to be a quarter long.\"\n elsif sp > ep\n redirect_to :back ,:notice => \"Settings not saved. A user must dole out at least has to be smaller than the number in but no more than.\"\n else\n respond_to do |format|\n if @prop.save\n format.html { redirect_to edit_prop_path(@prop), notice: 'Settings for props were successfully created.' }\n format.json { render json: @prop, status: :created, location: @prop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prop.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n else\n redirect_to :back, :notice=> \"Settings not saved. Looks like you missed filling out some settings.\"\n end \n=begin\n# The cycle for \"Never reset points\" is a monthly cycle. Merging this block with the block for \"2\" above\n elsif params[:prop][:reset_point] == \"1\"\n if sc.present? && ec.present?\n if sc > ec \n redirect_to :back ,:notice => \"Start cycle cannot be greater.\"\n elsif (reminder1_days > 31) || (reminder2_days > 31) || (reminder3_days > 31)\n redirect_to :back, :notice => \"Please select reminder days less than 7 days.\" \n \n elsif\n diff = (ec - sc + 1).round\n if diff < 28 || diff > 31\n redirect_to :back, :notice => \"Please select proper date.\"\n elsif sp > ep\n\n redirect_to :back ,:notice => \"'A user must dole out at least' has to be smaller than the number in 'but no more than'.\"\n\n else\n respond_to do |format|\n if @prop.save\n format.html { redirect_to edit_prop_path(@prop), notice: 'Settings for props were successfully created.' }\n format.json { render json: @prop, status: :created, location: @prop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prop.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n else\n redirect_to :back, :notice=> \"Settings not saved. Looks like you missed filling out some settings.\"\n end \n=end\n end\n end\n end",
"def create\n \n if @diagnostic.nil?\n @ticket = Ticket.new(ticket_params)\n #@expected_date = @ticket.due_date + 3.days\n \n else\n \n @diagnostic = @ticket.diagnostics.build(diagnostic_params)\n @ticket = Ticket.new(ticket_params)\n @ticket = @client.tickets.build(ticket_params)\n @ticket = @computer.tickets.build(ticket_params)\n \nend\n\n respond_to do |format|\n if @ticket.save\n \n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def permitted_attributes_for_update\n return permitted_attributes if record.user_id == user.id\n permitted_attributes.reject do |attr|\n [:start_date, :due_date, :estimated_time].include? attr\n end\n end",
"def calorie_consumption_params\n params.require(:calorie_consumption).permit(:consumed_on, :food, :calorie_intake)\n end",
"def trigger_setting_was_under_15_at_dx\n\t\tlogger.debug \"DEBUG: calling update_patient_was_under_15_at_dx from \"<<\n\t\t\t\"StudySubject:#{self.id}\"\n\t\tlogger.debug \"DEBUG: DOB changed from:#{dob_was}:to:#{dob}\"\n\t\tupdate_patient_was_under_15_at_dx\n\tend",
"def entry_params\n params.require(:entry).permit(:food_group_id, :user_id, :date, :portion, :description)\n end",
"def chicken_run_params\n params.require(:chicken_run).permit(:date, :time)\n end",
"def update\n\n preprocess_template_capacity_params\n \n if @site.update_attributes(params[:site])\n\n @site.diary_days.each do |diary_day|\n if diary_day.bookings.count == 0\n diary_day.destroy\n end\n end\n @site.construct_days!\n\n flash[ :notice ] = \"#{params[:id].camelize} reconfigured\"\n respond_to { |format| format.html { redirect_to edit_site_path(@site) }}\n else\n order_template_capacities\n respond_to {|format| format.html { render :edit } }\n end\n end",
"def build_form\n super\n # Set up the multiple parameters for the date coverage attribute in the form\n cov_date = Date.edtf(@form.date_coverage.first)\n cov_params = Umrdr::DateCoverageService.interval_to_params cov_date\n @form.merge_date_coverage_attributes! cov_params\n end",
"def plantation_params\n params.require(:plantation).permit(:farm_id, :generation_id, :quantity, :year)\n end",
"def plantio_params\n params.require(:plantio).permit(:dt_inicial, :dt_final, :area_id, :fazenda_id, :cultivo_id, :status_plantio_id)\n end",
"def create_water_event(plant_id)\n @last_event = WaterEvent.where(plant_id: plant_id).order(water_date: :desc).limit(1).first\n @last_event.watered = true\n @last_event.save\n\n plant_hash = { plant_id: plant_id}\n event = WaterEvent.new(plant_hash)\n\n @plant = Plant.find(plant_id)\n # @plant.updated_at = Time.current\n @plant.save\n\n # Should be today plus water freq\n event.water_date = @plant.water_freq.days.from_now\n event\n end",
"def build_form\n super\n\n # Set up the multiple parameters for the date coverage attribute in the form\n cov_date = Date.edtf(@form.date_coverage.first)\n cov_params = Umrdr::DateCoverageService.interval_to_params cov_date\n @form.merge_date_coverage_attributes! cov_params\n end",
"def budget_params\n params.require(:budget).permit(:client_id, :contract_id, :date, :description, :state, :total_amount, :name,\n budget_details_attributes: [:id, :rubro_id, :cost, :measurement_unit, :price, :quantity, :subtotal, :utility, :_destroy])\n end",
"def create\n @machine_historic = MachineHistoric.new(params[:machine_historic])\n @machine_historic.status = \"aberto\"\n \n @machine_initial = VehicleDaily.select(\"\n SUM(vehicle_dailies.km) as km_sum,\n ifnull(SUM(vehicle_dailies.hour), 0) as hour_sum,\n cmod_oil.km,\n cmod_oil.hour\n \").joins(\"\n INNER JOIN\n vehicles veh ON veh.id = vehicle_dailies.vehicle_id\n INNER JOIN\n carmodels cmod ON cmod.id = veh.carmodel_id \n INNER JOIN\n machine_historics mhis ON mhis.vehicle_id = veh.id \n INNER JOIN\n oils oil ON oil.id = mhis.oil_id\n INNER JOIN\n carmodel_oils cmod_oil ON cmod_oil.carmodel_id = cmod.id AND cmod_oil.oil_id = oil.id\n \").where(\"\n vehicle_dailies.vehicle_id = '#{@machine_historic.vehicle_id}'\n \").group(\"\n mhis.id, mhis.oil_id\n \").find(:first)\n \n if @machine_initial.blank?\n @machine_historic.hour_initial = \"0\"\n elsif @machine_initial.km.blank?\n @machine_historic.hour_initial = @machine_initial.hour_sum\n else\n @machine_item = CarmodelOil.find(:first, :conditions => [\"carmodel_id = '#{@machine_historic.vehicle.carmodel_id}' AND oil_id = '#{@machine_historic.oil_id}'\"])\n @machine_historic.hour_initial = @machine_initial.km_sum.to_f * @machine_item.hour.to_f / @machine_item.km.to_f + @machine_initial.hour_sum.to_f\n end\n \n respond_to do |format|\n if @machine_historic.save\n format.html { redirect_to(@machine_historic, :notice => 'Vehicle historic was successfully created.') }\n format.xml { render :xml => @machine_historic, :status => :created, :location => @machine_historic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @machine_historic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def period_milk_production_params\n params.require(:period_milk_production).permit(:date_first_milking, :livestock_id)\n end",
"def clinic_params\n params.require(:clinic).permit(:name, not_opening_days:[])\n end",
"def destroy\n #if self.employee_deposited_at\n if self.deposited_at\n errors.add(:deposited_at, \"Error - cannot delete deposited benefit.\")\n false\n else\n super\n end\n end",
"def prep_for_save\n # what about when doing the set deposited flag ????\n # if @allow_edit\n # @employee_benefit[\"deposit\"] = round_money(@employee_benefit[\"monthly_benefit\"] - tot_current_benefit)\n # end\n # Deposit to make calculation\n self.deposit =\n self.monthly_benefit.to_f - # Required Total Benefit\n self.tot_current_benefit.to_f - # Current Benefit without DBP (Employee Hourly Benefit (rate) * Total Hours (of Benefit record)\n self.tot_deposits_made.to_f # Previous Deposits (sum of all Employee Benefits for this month that have already been deposited)\n if self && !self.reg_hours\n self.reg_hours = 0.0\n end\n if self && !self.ot_hours\n self.ot_hours = 0.0\n end\n end",
"def event_params\n \t\tparams.require(:event).permit(:logo, :name, :description, :category_id, :status, :group_ids => [], :location_attributes =>\n[:id, :name, :_destroy])\n \t#_destory is related to all_destroy in accepts_nested_attributes_for in event.rb \n\tend",
"def destroy\n @cajas = Caja.all \n\n\n a = Cout.find(@viaticotbk_detail.cout_id)\n\n a.parent = nil\n\n a.save \n\n \n if @viaticotbk_detail.destroy\n\n\n begin\n @viaticotbk[:inicial] = @viaticotbk.get_total_inicial\n rescue\n @viaticotbk[:inicial] = 0\n end \n \n begin\n @viaticotbk[:total_ing] = @viaticotbk.get_total_ing\n rescue \n @viaticotbk[:total_ing] = 0\n end \n begin \n @viaticotbk[:total_egreso]= @viaticotbk.get_total_sal\n rescue \n @viaticotbk[:total_egreso]= 0 \n end \n @viaticotbk[:saldo] = @viaticotbk[:inicial] + @viaticotbk[:total_ing] - @viaticotbk[:total_egreso]\n\n\n @viaticotbk.save\n \n if @viaticotbk.caja_id == 1 \n a = @cajas.find(1)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 2\n a = @cajas.find(2)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 3 \n a = @cajas.find(3)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n if @viaticotbk.caja_id == 4 \n a = @cajas.find(4)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n if @viaticotbk.caja_id == 5\n a = @cajas.find(5)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n if @viaticotbk.caja_id == 6\n a = @cajas.find(6)\n a.inicial = @viaticotbk[:saldo]\n a.save\n end \n\n \n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @viaticotbk\n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n \n end",
"def calculate_totals\n self.build_food unless self.food\n self.food.protein = self.meals.inject(0){|sum, m| sum += m.protein}\n self.food.carbohydrate = self.meals.inject(0){|sum, m| sum += m.carbohydrate}\n self.food.fat = self.meals.inject(0) {|sum, m| sum += m.fat}\n self.food.energy = self.meals.inject(0) {|sum, m| sum += m.energy}\n self.size = self.meals.inject(0) {|sum, m| sum += m.size}\n self.save\n end",
"def daily_step_params\n params.require(:daily_step).permit(:amount, :date)\n end",
"def perform_backup_params\n params.require(:perform_backup).permit(:days, :time)\n end",
"def recipe_params\n params.require(:recipe).permit(:id, :title, :procedure, :preparationTime, :cookingTime, :serves,\n recipe_ingredients_attributes: [:id,:recipe_id, :ingredient_id, :amout, :_destroy , ingredients_attributes: [:id, :description, measurement_units_attributes: [:id, :unit]]],\n #recipe_ingredients_attributes: [:id,:recipe_id, :ingredient_id, :amout, :_destroy ,measurement_units_attributes: [:id, :unit]],\n recipe_nutrients_attributes: [:id,:recipe_id,:nutrient_id,:valor], recipe_procedures_attributes: [:id, :recipe_id,:procedure_number, :title, :procedure, :_destroy])\n end",
"def receipe_params\n params.require(:receipe).permit(:user_id, :receipe_category_id, :title, :introduction, :image_path, \n ingredients_attributes: [:id, :receipe_id, :name, :quantity, {:allergen_ids =>[]},:_destroy, \n replaced_ingredient_attributes: [:id, :ingredient_id, :name, :quantity, {:allergen_ids =>[]}, :_destroy]],\n cooking_steps_attributes: [:id, :receipe_id, :number, :description, :image_path, :_destroy],\n receipe_evaluations_attributes: [:id, :receipe_id, :user_id, :rating, :_destroy]\n )\n end",
"def create\n @drive_fixed = DriveFixed.new(params[:drive_fixed])\n if params[:sem_data_final]\n @drive_fixed.date_limit = nil\n end\n respond_to do |format|\n if @drive_fixed.save\n flash[:notice] = 'DriveFixed was successfully created.'\n format.html { redirect_to(@drive_fixed) }\n format.xml { render :xml => @drive_fixed, :status => :created, :location => @drive_fixed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @drive_fixed.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fine_params\n params.require(:fine).permit(:date, :description, :status, :amount, :offender_id, :proposer_id)\n end",
"def child_development_period_params\n params.require(:child_development_period).permit(:date_contol, :weight, :size, :head_circunference, :child_id, :child_development_id, :medical_center_id, :doctor_id)\n end",
"def create\n @vehicle_historic = VehicleHistoric.new(params[:vehicle_historic])\n @vehicle_historic.status = \"aberto\"\n \n @km_initial = VehicleDaily.select(\"\n CASE\n WHEN SUM(vehicle_dailies.km) is null THEN '0'\n WHEN SUM(vehicle_dailies.km) is not null THEN SUM(vehicle_dailies.km) \n END as km_atual,\n vehicle_dailies.id\n \").find(:first, :conditions => [\"\n vehicle_dailies.vehicle_id = '#{@vehicle_historic.vehicle_id}'\n \"])\n\n @vehicle_historic.km_initial = @km_initial.km_atual \n \n respond_to do |format|\n if @vehicle_historic.save\n format.html { redirect_to(@vehicle_historic, :notice => 'Vehicle historic was successfully created.') }\n format.xml { render :xml => @vehicle_historic, :status => :created, :location => @vehicle_historic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle_historic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def exercise_modification_params\n params.require(:exercise_modification).permit(:exercise_template_id, :date, :coach_id, :price, :note, :timetable_modification_id, :removal)\n end",
"def eaten_params\n params.require(:eaten).permit(:food_id, :portion_factor, :date)\n end",
"def add_days_remaining\n return unless self.absence_type_id == AbsenceTypeConstants::ABSENCE_TYPE_HOLIDAY\n holiday_allowance = self.user.get_holiday_allowance_for_dates self.date_from, self.date_to\n holiday_allowance.days_remaining += self.working_days_used\n holiday_allowance.save\n end",
"def create\n @cookbook = Cookbook.find(week_params[:cookbook_id])\n presenter_cookbook = CookbookPresenter.new( @cookbook )\n\n # Create monday\n @monday = Day.new\n # Create tuesday\n @tuesday = Day.new\n # Create wednesday\n @wednesday = Day.new\n # Create thursday\n @thursday = Day.new\n # Create friday\n @friday = Day.new\n # Create saturday\n @saturday = Day.new\n # Create sunday\n @sunday = Day.new\n \n if presenter_cookbook.starters.count > 0\n @monday.starter_id = presenter_cookbook.starter_random_id\n @tuesday.starter_id = presenter_cookbook.starter_random_id\n @wednesday.starter_id = presenter_cookbook.starter_random_id\n @thursday.starter_id = presenter_cookbook.starter_random_id\n @friday.starter_id = presenter_cookbook.starter_random_id\n @saturday.starter_id = presenter_cookbook.starter_random_id\n @sunday.starter_id = presenter_cookbook.starter_random_id\n end\n \n if presenter_cookbook.mains.count > 0\n @monday.main_id = presenter_cookbook.main_random_id\n @tuesday.main_id = presenter_cookbook.main_random_id\n @wednesday.main_id = presenter_cookbook.main_random_id\n @thursday.main_id = presenter_cookbook.main_random_id\n @friday.main_id = presenter_cookbook.main_random_id\n @saturday.main_id = presenter_cookbook.main_random_id\n @sunday.main_id = presenter_cookbook.main_random_id\n end\n\n if presenter_cookbook.desserts.count > 0\n @monday.dessert_id = presenter_cookbook.dessert_random_id\n @tuesday.dessert_id = presenter_cookbook.dessert_random_id\n @wednesday.dessert_id = presenter_cookbook.dessert_random_id\n @thursday.dessert_id = presenter_cookbook.dessert_random_id\n @friday.dessert_id = presenter_cookbook.dessert_random_id\n @saturday.dessert_id = presenter_cookbook.dessert_random_id\n @sunday.dessert_id = presenter_cookbook.dessert_random_id\n end\n\n @monday.save\n puts @monday.errors.to_json\n @tuesday.save\n @wednesday.save\n @thursday.save\n @friday.save\n @saturday.save\n @sunday.save\n\n @week = Week.new\n @week.cookbook_id = @cookbook.id\n @week.user = @current_user\n\n @week.monday = @monday\n @week.tuesday = @tuesday\n @week.wednesday = @wednesday\n @week.thursday = @thursday\n @week.friday = @friday\n @week.saturday = @saturday\n @week.sunday = @sunday\n\n respond_to do |format|\n if @week.save\n\n @current_user.week_id = @week.id\n @current_user.save\n\n @cookbook.count_time = @cookbook.count_time\n @cookbook.count_time += 1\n @cookbook.save\n\n format.html { redirect_to week_path(@week, anchor: 'all'), notice: 'Week was successfully created.' }\n format.json { render json: @week }\n else\n format.html { render :new }\n format.json { render json: @week.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etat_depense = EtatDepense.new(etat_depense_params)\n @etat_depense.date = @etat_depense.date.change(month: 1, day: 1)\n respond_to do |format|\n if @etat_depense.save\n format.html { redirect_to etat_depenses_path, notice: 'Etat depense was successfully created.' }\n format.json { render :show, status: :created, location: @etat_depense }\n else\n format.html { render :new }\n format.json { render json: @etat_depense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_cut_off_time\n if params[:cut_off_time].present?\n #Home.all.each {|r| r.destroy}\n Home.create(:cut_off_time => params[:cut_off_time])\n redirect_to admin_action_by_admin_path, :flash => {:notice => \"Shipment cut off time updated succesfully\"}\n else\n flash.now[:notice] = 'please enter vaild time to procced.'\n end\n end",
"def restaurant_params\n params.require(:restaurant).permit(:name, :food_type,\n description_attributes: [:id, :content, :_destroy],\n address_attributes: [:id, :address_one, :address_two, :city, :state, :postal, :_destroy],\n schedule_attributes: [\n :id, :monday_opens_at, :monday_closes_at, :tuesday_opens_at, :tuesday_closes_at,\n :wednesday_opens_at, :wednesday_closes_at, :thursday_opens_at,\n :thursday_closes_at, :friday_opens_at, :friday_closes_at, :saturday_opens_at,\n :saturday_closes_at, :sunday_opens_at, :sunday_closes_at, :_destroy\n ]\n )\n end",
"def pro_concrete_params\n params.require(:pro_concrete).permit(:province_pro_asset_id, :day, :pro_concrete_hours, :pro_concrete_machines_num, pro_concrete_subs_attributes: ProConcreteSub.attribute_names.map(&:to_sym).push(:_destroy))\n end",
"def closement_params\n params.require(:closement).permit(:close_day)\n end",
"def calendar_day_params\n params.require(:calendar_day).permit(:starts, :description, :image_path, :opened)\n end",
"def food_product_params\n params.require(:food_product).permit(:group_id, :name, :first_day_num, :second_day_num, :is_cooking, :start)\n end",
"def update\n @group_meal = GroupMeal.find(params[:id])\n respond_to do |format|\n if @group_meal.update_attributes(params[:group_meal])\n @meal= Meal.find(@group_meal.meal)\n \n if params[:group_meal][\"proposed_start_time(2i)\"] !=nil\n \tstartDay= params[:group_meal][\"proposed_start_time(3i)\"].to_i\n \tstartHour= params[:group_meal][\"proposed_start_time(4i)\"].to_i + 4\n \t\n \tif startHour > 24\n \t startHour=startHour % 24\n \t startDay+=1\n end\n \t \n \t \tendDay= params[:group_meal][\"proposed_end_time(3i)\"].to_i\n \tendHour= params[:group_meal][\"proposed_end_time(4i)\"].to_i + 4\n \t\n \tif endHour>24\n \t endHour=@endHour % 24\n endDay+=1\n \tend\n \t\n \t@meal.start_time= DateTime.new(params[:group_meal][\"proposed_start_time(1i)\"].to_i, \n params[:group_meal][\"proposed_start_time(2i)\"].to_i,\n startDay,\n startHour,\n params[:group_meal][\"proposed_start_time(5i)\"].to_i)\n @meal.end_time= DateTime.new(params[:group_meal][\"proposed_end_time(1i)\"].to_i, \n params[:group_meal][\"proposed_end_time(2i)\"].to_i,\n endDay,\n endHour,\n params[:group_meal][\"proposed_end_time(5i)\"].to_i)\n \t@meal.save\n end\n \n if params[:group_meal][\"set_start_time(2i)\"] !=nil\n \n \tstartDay= params[:group_meal][\"set_start_time(3i)\"].to_i\n \tstartHour= params[:group_meal][\"set_start_time(4i)\"].to_i + 4\n \t\n \tif startHour > 24\n \t startHour=startHour % 24\n \t startDay+=1\n end\n \t \n \t \tendDay= params[:group_meal][\"set_end_time(3i)\"].to_i\n \tendHour= params[:group_meal][\"set_end_time(4i)\"].to_i + 4\n \t\n \tif endHour>24\n \t endHour=endHour % 24\n endDay+=1\n \tend\n \t@meal.start_time= DateTime.new(params[:group_meal][\"set_start_time(1i)\"].to_i, \n params[:group_meal][\"set_start_time(2i)\"].to_i,\n startDay,\n startHour,\n params[:group_meal][\"set_start_time(5i)\"].to_i)\n @meal.end_time= DateTime.new(params[:group_meal][\"set_end_time(1i)\"].to_i, \n params[:group_meal][\"set_end_time(2i)\"].to_i,\n endDay,\n endHour,\n params[:group_meal][\"set_end_time(5i)\"].to_i)\n \t@meal.save\n end\n \n query = \"SELECT user_id FROM group_meals_participants where group_meal_id = \" + @group_meal.id.to_s\n \n \tGroupMealsParticipant.connection.select_values(query).each do |u|\n \tif(u!=current_user.id)\n \t\tu=User.find(u)\n \t\tu.alert=true\n \t\tu.alert_location=@group_meal.id\n \t\tu.save\n \tend\n end\n \n \n format.html { redirect_to @group_meal, notice: 'Group meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group_meal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete!\n update_attribute(:dateSuppression, Time.now)\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n\n\n ################################################\n ## Preferences\n ################################################\n #get items from input and add to an array\n @prefs = Array.new\n unless params[:prefs].nil?\n params[:prefs].each do |p|\n @prefs << Preference.find(p)\n end\n end\n\n #if event item is NOT in array, remove it from event\n @restaurant.preferences.each do |p|\n unless @prefs.include? (p)\n PreferencesRestaurants.where(restaurant_id: @restaurant, preference_id: p).first.destroy\n end\n end\n\n #if item is NOT in event array, add it to event\n @prefs.each do |p|\n unless @restaurant.preferences.exists? (p)\n @restaurant.preferences << Preference.find(p)\n end\n end\n ################################################\n\n\n ################################################\n ## Restrictions\n ################################################\n #get items from input and add to an array\n @restrics = Array.new\n unless params[:restrics].nil?\n params[:restrics].each do |r|\n @restrics << Restriction.find(r)\n end\n end\n\n #if event item is NOT in array, remove it from event\n @restaurant.restrictions.each do |r|\n unless @restrics.include? (r)\n RestaurantsRestrictions.where(restaurant_id: @restaurant, restriction_id: r).first.destroy\n end\n end\n\n #if item is NOT in event array, add it to event\n unless @restrics.nil?\n @restrics.each do |p|\n unless @restaurant.restrictions.exists? (p)\n @restaurant.restrictions << Restriction.find(p)\n end\n end\n end\n ################################################\n\n\n \n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant }\n else\n format.html { render :new }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def food_product_params\n params.permit(:group_id, :name, :is_cooking, :first_day_num, :second_day_num)\n end",
"def update\n @karteikarte \t= Karteikarte.find(params[:id])\n\n @person \t= Person.find(@karteikarte.person_id)\n @person.update_attributes(params[:karteikarte][:person])\n @person.save\n\n @tier \t\t= Tier.find(@karteikarte.tier_id)\n @tier.update_attributes(params[:karteikarte][:tier])\n if params[:neue_behandlung] == \"true\"\n @tier.behandlungen << Behandlung.new\n end\n @tier.save\n\n @karteikarte.save\n\n\n\n=begin\n\t\t@behandlung = @tier.behandlungen.last # order( 'behandlungsdatum desc' )\n\t\tunless !@behandlung.nil? && @behandlung.diagnose.blank? && @behandlung.laborwerte1.blank? && @behandlung.laborwerte2.blank? &&\n\t\t\t\t\t @behandlung.arzneien.blank? && @behandlung.arzneimittel.blank? && @behandlung.impfungswert_ids.blank? && @behandlung.gewicht_kg.blank?\n\t\t\t@tier.behandlungen << Behandlung.new\n\t\tend\n=end\n render(:action => :edit)\n end",
"def stockroom_removal_params\n params.require(:stockroom_movimentation).permit(:user_id, :justificativa, stockroom_removal_items_attributes: [:id, :stockroom_item_id, :quantidade, :_destroy])\n end",
"def update\n @facility = TreatmentFacility.find(params[:id])\n \n total_before = @facility.machines.count + @facility.technicians.count\n if @facility.update_attributes(params[:treatment_facility])\n # Set roles for new users\n @facility.users.each do |user|\n if user.role.nil?\n user.role = Role.find_by_name(Role::TECHNICIAN)\n user.save!\n end\n end\n # Create timers for new treatment areas\n @facility.treatment_areas.each do |area|\n if area.process_timer.nil?\n area.build_process_timer(:duration_seconds => area.duration_minutes * 60)\n area.save!\n end\n end\n \n total_after = @facility.machines.count + @facility.technicians.count\n if (total_after == total_before) or (0 == @facility.machines.count) or (0 == @facility.technicians.count)\n redirect_to @facility, :notice => I18n.t('facility_updated')\n else\n redirect_to edit_assignments_treatment_facility_path(@facility)\n end\n else\n render 'edit'\n end\n end",
"def deleted(build)\n end",
"def entry_params\n params.require(:resourceentry).permit(:date, :value)\n end",
"def update\n @venue = Venue.find(params[:id])\n\n if(params[:venue][:events_attributes])\n params[:venue][:events_attributes].each do |params_event|\n if params_event[1][\"recurring\"]\n # puts \"recurring\"\n params_event[1][\"occurrences_attributes\"].shift\n if params_event[1][\"occurrences_attributes\"].length == 0\n params_event[1].delete(\"occurrences_attributes\")\n end\n else\n # puts \"not recurring\"\n params_event[1][\"recurrences_attributes\"].shift\n if params_event[1][\"recurrences_attributes\"].length == 0\n params_event[1].delete(\"recurrences_attributes\")\n end\n end\n\n if params_event[1][\"occurrences_attributes\"]\n params_event[1][\"occurrences_attributes\"].each_with_index do |params_occurrence, index|\n # puts \"start(4i): \" + params_occurrence[1][\"start(4i)\"]\n if params_occurrence[1][\"start(4i)\"] == \"\" || params_occurrence[1][\"start(5i)\"] == \"\"\n # puts \"deleting occurrence:\"\n # puts index\n # puts params_event[1][\"occurrences_attributes\"][index.to_s]\n params_event[1][\"occurrences_attributes\"].delete(index.to_s)\n elsif params_occurrence[1][\"end(4i)\"] == \"\" || params_occurrence[1][\"end(5i)\"] == \"\"\n params_occurrence[1][\"end(1i)\"] = params_occurrence[1][\"end(2i)\"] = params_occurrence[1][\"end(3i)\"] = params_occurrence[1][\"end(4i)\"] = params_occurrence[1][\"end(5i)\"] = \"\"\n end\n end\n end\n\n if params_event[1][\"recurrences_attributes\"]\n params_event[1][\"recurrences_attributes\"].each do |params_recurrence|\n # puts \"start(4i): \" + params_recurrence[1][\"start(4i)\"]\n if params_recurrence[1][\"start(4i)\"] == \"\" || params_recurrence[1][\"start(5i)\"] == \"\" \n # puts \"deleting recurrence\"\n params_recurrence.shift(2)\n elsif params_recurrence[1][\"end(4i)\"] == \"\" || params_recurrence[1][\"end(5i)\"] == \"\"\n params_recurrence[1][\"end(1i)\"] = params_recurrence[1][\"end(2i)\"] = params_recurrence[1][\"end(3i)\"] = params_recurrence[1][\"end(4i)\"] = params_recurrence[1][\"end(5i)\"] = \"\"\n end\n end\n end\n\n if params_event[1][\"id\"].nil?\n params_event[1][\"user_id\"] = current_user.id\n end\n \n params_event[1].delete(\"recurring\")\n end\n end\n\n pp params[:venue]\n\n respond_to do |format|\n if @venue.update_attributes!(params[:venue])\n format.html { redirect_to :action => :edit, :id => @venue.id, :notice => 'yay' }\n format.json { head :ok }\n else\n format.html { redirect_to :action => :edit, :id => @venue.id, :notice => 'boo' }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def schedule_part_params\n params.require(:schedule_part).permit(:schedule_id, :food_type_id, :required)\n end",
"def cleaning_room_params\n params.require(:cleaning_room).permit(:room_id, :employee_id,:title,:cleanings_attributes => [:room_id,:employee_id,:start,:end,:title,:color,:textColor,:_destroy])\n end",
"def substract_due\n \t\t# if !self.company.plan.custom\n \t\t# \tcompany = self.company\n \t\t# \tday_number = DateTime.now.day\n # \t\tmonth_number = DateTime.now.month\n # \t\tmonth_days = DateTime.now.days_in_month\n \t\t# \tcompany.due_amount -= (((month_days - day_number + 1).to_f / month_days.to_f) * company.company_plan_setting.base_price * (company.computed_multiplier + company.company_plan_setting.locations_multiplier)).round(2)\n \t\t# \tcompany.save\n \t\t# end\n \tend",
"def maintenance_params\n params.require(:maintenance).permit(:date, :distance_traveled, :tipo, :vehicle_id)\n end",
"def aggregate\r\n calc_id = Calculation.find(params[:id]).id\r\n # loeschen alter Werte\r\n Demand0.where(calculation_id: calc_id).delete_all\r\n Demand1.where(calculation_id: calc_id).delete_all\r\n Demand2.where(calculation_id: calc_id).delete_all\r\n @specialty = Specialty.all\r\n\r\n #if Demand0.where(calculation_id: calc_id).empty?\r\n \r\n dem_mon = 0\r\n dem_tue = 0\r\n dem_wed = 0\r\n dem_thu = 0\r\n dem_fri = 0\r\n\r\n# Fuer alle Specialties summiere die OP Zeiten der Patienten Typ 0 \r\n @specialty.each do |n|\r\n dem_mon = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'0').sum(:op_time)\r\n dem_tue = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'0').sum(:op_time)\r\n dem_wed = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'0').sum(:op_time)\r\n dem_thu = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'0').sum(:op_time)\r\n dem_fri = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'0').sum(:op_time)\r\n Demand0.create!(calculation_id: calc_id, specialty_id: Specialty.find(n).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri)\r\n end\r\n\r\n @specialty.each do |m|\r\n dem_mon = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'1').sum(:op_time)\r\n dem_tue = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'1').sum(:op_time)\r\n dem_wed = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'1').sum(:op_time)\r\n dem_thu = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'1').sum(:op_time)\r\n dem_fri = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'1').sum(:op_time)\r\n Demand1.create!(calculation_id: calc_id, specialty_id: Specialty.find(m).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri)\r\n end\r\n\r\n @specialty.each do |o|\r\n dem_mon = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'2').sum(:op_time)\r\n dem_tue = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'2').sum(:op_time)\r\n dem_wed = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'2').sum(:op_time)\r\n dem_thu = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'2').sum(:op_time)\r\n dem_fri = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'2').sum(:op_time)\r\n Demand2.create!(calculation_id: calc_id, specialty_id: Specialty.find(o).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri)\r\n end\r\n\r\n flash[:started] = \"Demands calculated!\"\r\n redirect_to calculations_path\r\n # else\r\n # flash[:not_available] = \"Demands already aggregated!\"\r\n # redirect_to calculations_path\r\n # end\r\n end",
"def construction_datum_params\n params.require(:construction_datum).permit(:construction_code, :construction_name, :alias_name, :reception_date, :customer_id, :personnel, :site_id, :construction_start_date, \n :construction_end_date, :construction_period_start, :construction_period_end, :post, :address, :house_number, :address2, :latitude, :longitude, :construction_detail, :attention_matter, \n :working_safety_matter_id, :working_safety_matter_name, :estimated_amount, :final_amount, :billing_due_date, :deposit_due_date, :deposit_date, :quotation_header_id, :delivery_slip_header_id, :billed_flag, :calculated_flag, :order_flag)\n end",
"def create\n \n inv_trip_params = invoiced_trip_params.merge(:total_amount => (invoiced_trip_params[\"amount\"].to_d/\n Conversion.find_by_sql([\"SELECT * FROM conversions where conversions.currency_id = ? and \n conversions.date <= ? order by conversions.date asc\", invoiced_trip_params[\"currency_id\"], \n Date.new(invoiced_trip_params[\"date(1i)\"].to_i,invoiced_trip_params[\"date(2i)\"].to_i,\n invoiced_trip_params[\"date(3i)\"].to_i)])[0][\"conversion_rate\"]).round(2))\n\n @invoiced_trip = InvoicedTrip.new(inv_trip_params)\n \n if @invoiced_trip.brand != nil #_params.fetch(:brand).to_s.size\n @invoiced_trip.StartDate = Invoice.find_by(id: @invoiced_trip.invoice_id).date\n @invoiced_trip.typeT = true\n @invoiced_trip.save\n end\n\n @pricing = Pricing.find_by_sql([\"SELECT * FROM pricings where pricings.client_id = ? \n and pricings.DATETIME <= ? order by pricings.DATETIME desc\", @invoiced_trip.client_id, @invoiced_trip.StartDate ])\n \n if @invoiced_trip.typeT == 0\n @invoiced_trip.surcharge = @pricing[0].surcharge\n @invoiced_trip.price_per_km = @pricing[0].price_per_km\n else\n @invoiced_trip.surcharge = 0\n @invoiced_trip.price_per_km = 0\n end\n\n\n if @invoiced_trip.images.count>0\n @invoiced_trip.images.attach(params[:invoiced_trip][:images])\n end\n\n if @invoiced_trip.bill_of_lading.count>0\n @invoiced_trip.bill_of_lading.attach(params[:invoiced_trip][:images])\n end\n\n if @invoiced_trip.export_document.count>0\n @invoiced_trip.export_document.attach(params[:invoiced_trip][:images])\n end\n \n respond_to do |format|\n if @invoiced_trip.save\n format.html { redirect_to @invoiced_trip, notice: 'Invoiced trip was successfully created.' }\n format.json { render :show, status: :created, location: @invoiced_trip }\n else\n format.html { render :new }\n format.json { render json: @invoiced_trip.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def plant_leaf_color_params\n params.require(:plant_leaf_color).permit(:plant_id, :leaf_color_id)\n end"
] |
[
"0.53947544",
"0.5384133",
"0.52744126",
"0.5182724",
"0.5168537",
"0.5125227",
"0.5067677",
"0.5035993",
"0.49974865",
"0.49877486",
"0.49656504",
"0.49314135",
"0.49262202",
"0.49210846",
"0.48812333",
"0.4849214",
"0.48455626",
"0.48437196",
"0.48405296",
"0.4825629",
"0.4813663",
"0.4811616",
"0.48028758",
"0.4782201",
"0.4770407",
"0.47651482",
"0.4763196",
"0.47537774",
"0.47512484",
"0.4749885",
"0.4747813",
"0.47344974",
"0.47308445",
"0.47301203",
"0.4725477",
"0.47247466",
"0.47207355",
"0.4708552",
"0.4700037",
"0.46952024",
"0.46952024",
"0.4693355",
"0.46926868",
"0.46908647",
"0.4688821",
"0.46877295",
"0.46855623",
"0.4666371",
"0.4659285",
"0.46520436",
"0.46518555",
"0.46513996",
"0.46507484",
"0.46468347",
"0.46437803",
"0.4640505",
"0.46404487",
"0.4636765",
"0.46366483",
"0.46361735",
"0.46360868",
"0.46262652",
"0.46164668",
"0.4609782",
"0.460912",
"0.4603516",
"0.45999515",
"0.45957676",
"0.4591046",
"0.45883796",
"0.45854387",
"0.45847267",
"0.45796657",
"0.4577641",
"0.45773798",
"0.45748198",
"0.45748144",
"0.45739812",
"0.45660806",
"0.45643032",
"0.45640928",
"0.45637318",
"0.4562999",
"0.45627812",
"0.45610416",
"0.45592842",
"0.45561403",
"0.45533252",
"0.45515114",
"0.45481443",
"0.45385027",
"0.4537325",
"0.45350313",
"0.45340282",
"0.45330986",
"0.4531933",
"0.45299107",
"0.45289707",
"0.45246115",
"0.4517706",
"0.45172504"
] |
0.0
|
-1
|
Retrieve all template information. Build an array of template ids here over which to iterate
|
def retrieve_all_template_info
puts "Retrieving all template ids and names for #{@primary_username} ..."
puts
uri = URI(@config['endpoint'])
# Retrieve templates
http = Net::HTTP.new( uri.host,uri.port )
http.use_ssl = true
request = Net::HTTP::Get.new( uri.request_uri )
request.basic_auth(@primary_username, @primary_password)
response = http.request( request )
templates = JSON.parse( response.body )
# Create template_id array
@template_array = Array.new
# Create a template hash w/ name and id for each template found
templates['templates'].each do |t|
@template_array.push({:id => t['id'], :name => t['name']})
end
# Return constructed temmplate array
return template_array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def select_template\n templatelist = []\n templatelist\n end",
"def get_ids_by_host(data)\n result = []\n @client.api_request(:method => \"template.get\", :params => data).each do |tmpl|\n result << tmpl['templateid']\n end\n result\n end",
"def get_ids_by_host(data)\n result = []\n @client.api_request(:method => \"template.get\", :params => data).each do |tmpl|\n result << tmpl['templateid']\n end\n result\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def index\n @template = Template.find(params[:template_id])\n @template_parameters = TemplateParameter.where(template_id: params[:template_id])\n end",
"def index\n @templates = Template.includes(:template_elements).all\n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end",
"def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def index\n @templates = Template.all\n\n \n\n\n @templates.each do |template|\n\n if template.templateVersion.nil?\n\n logger.info \"NIL VERSION: \" + template.id.to_s\n else\n logger.info \"VERSION: \" + template.templateVersion.to_s\n end\n\n template.fields = template.getFieldsNames.join(\",\");\n\n\n end\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def index\n @templates = Spree::Template.all\n end",
"def index\n @templates = ::Template.all\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def index\n @request_templates = RequestTemplate.all\n end",
"def templates\n @conn.templates\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n authorize Template\n templates = Template.latest_version.where(customization_of: nil)\n published = templates.count { |t| t.published? || t.draft? }\n\n @orgs = Org.includes(identifiers: :identifier_scheme).managed\n @title = _('All Templates')\n @templates = templates.includes(:org).page(1)\n @query_params = { sort_field: 'templates.title', sort_direction: 'asc' }\n @all_count = templates.length\n @published_count = (published.presence || 0)\n @unpublished_count = if published.present?\n (templates.length - published)\n else\n templates.length\n end\n render :index\n end",
"def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end",
"def get_templates(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 r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end",
"def index\n @my_templates = MyTemplate.all\n end",
"def index\n @templates = Template.order(:name).page params[:page]\n end",
"def index\n @templates = EmailTemplate.all\n end",
"def host_templates\n @host_templates ||= ZerigoDNS::HostTemplate.all(zone_template_id: id)\n end",
"def each_template\n if @processed.nil?\n @processed, @rest = templates.keys.partition { |k| k.to_s.include? \".\" }\n end\n\n @processed.each do |k|\n yield k, templates[k]\n end\n\n @rest.each do |k|\n yield k, templates[k]\n end\n end",
"def selecttemplate\n\t@templates = JobTemplate.all\n end",
"def index\n @product_templates = ProductTemplate.all\n end",
"def index\n @item_templates = ItemTemplate.all\n end",
"def get_all_course_templates\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/6606/descendants/?ouTypeId=2\"\n _get(path)\n # return: JSON array of course template data objects\nend",
"def read_all template = not_meta\n matcher = Matcher.new(worker.make_template(template), self, :all => true)\n worker << matcher\n a = []\n while tuple = matcher.wait ## inefficient to wait one at a time?\n yield tuple if block_given?\n a << tuple\n end\n a\n end",
"def index\n @induction_templates = InductionTemplate.all\n end",
"def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end",
"def index\n @post_templates = PostTemplate.all\n end",
"def templates\n @instruments_templates ||= lambda do\n args = ['xctrace', 'list', 'templates']\n\n hash = xcrun.run_command_in_context(args, log_cmd: true)\n hash[:out].chomp.split(\"\\n\").map do |elm|\n stripped = elm.strip.tr('\"', '')\n if stripped == '' || stripped == 'Known Templates:'\n nil\n else\n stripped\n end\n end.compact\n end.call\n end",
"def get_templates(limit = 100, offset = 0)\n params = { :limit => limit, :offset => offset }\n\n request :get, \"/v3/templates.json\", params\n end",
"def templates\n @templates ||= TemplateFinder.new(path, types)\n end",
"def index\n redirect_to root_path unless ViewTemplate.new(current_merchant_user, current_admin).check\n @templates = Template.all\n end",
"def read_all template = Object\n matcher = Matcher.new(worker.make_template(template), self, :all => true)\n worker << matcher\n a = []\n while tuple = matcher.wait ## inefficient?\n yield tuple if block_given?\n a << tuple\n end\n a\n end",
"def find_templates(name, prefix, partial, details)\n conditions = {\n path: normalize_path(name, prefix),\n locale: normalize_array(details[:locale]).first,\n format: normalize_array(details[:formats]).first,\n handler: normalize_array(details[:handlers]),\n partial: partial || false\n }\n\n ::Page.visible(user_sign_in_status).where(conditions).map do |record|\n initialize_template(record)\n end\n end",
"def templates\n @templates ||= (\n list = []\n list.concat templates_from_project\n list.concat templates_from_remotes\n list.concat templates_from_plugins\n list.sort_by{ |t| t.name }\n )\n end",
"def index\n @timetable_templates = TimetableTemplate.all\n end",
"def template_keys\n template_value_sniffer = Facebase::EmailTemplate::TemplateValuesSniffer.new\n Facebase::CoreMailer.template(\n {\n :headers => {},\n :template_values => template_value_sniffer,\n :to => \"to@someemail.com\",\n :from => \"from@someemail.com\",\n :reply_to => \"reply_to@someemail.com\",\n :subject => \"test_subject\",\n :composite_id => \"testCompositeId\",\n :text_erb => Facebase::Email.load_template(self.campaign.name, self.stream.name, self.name, \"text.erb\", true),\n :html_erb => Facebase::Email.load_template(self.campaign.name, self.stream.name, self.name, \"html.erb\", true),\n :email_service_provider => Facebase::EmailTemplate::MockEmailServiceProvider.new\n }\n )\n template_value_sniffer.template_keys\n end",
"def index\n @event_templates = EventTemplate.all\n end",
"def take_all template\n messages = []\n\n tsync do\n indexes = []\n\n @takable.each_with_index do |m, i|\n if m =~ template\n indexes << i\n messages << m\n end\n end\n\n indexes.each do |i|\n @takable[i] = nil\n end\n\n @takable.compact! if indexes.any?\n end\n\n messages\n end",
"def form_templates\n FormTemplate.where(lecturer_id: @id)\n end",
"def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\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 = 'template'\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, \"Policy Templates:\", :style => :table)\n end",
"def all(filterflag = 'a')\n filterflag = connection.filterflag_to_i(filterflag)\n data = connection.list_templates(filterflag)\n load(data)\n end",
"def index\n @template_data = TemplateDatum.all\n end",
"def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end",
"def index\n @form_templates = FormTemplate.all\n end",
"def index\n @question_templates = QuestionTemplate.all\n end",
"def find_templates(path)\n templates = []\n Find.find(path) do |path|\n templates << path if template?(path)\n end\n templates\n end",
"def gem_list template_id=@@oauth_info[:template_id]\n check_validity\n to_return = {}\n\n response = api_get \"my\"\n #TODO: implement proper expection raising on following line\n if response == nil then return to_return end\n gems = response[\"gems\"]\n\n if gems == nil then return to_return end\n gems.delete_if { |gem| gem[\"gem_template_id\"] != template_id }\n gems.each { |gem| to_return[gem[\"gem_instance_id\"]] = {\n :title => gem[\"gem_instance_name\"],\n :gem_instance_id => gem[\"gem_instance_id\"],\n :remote_timestamp => gem[\"updated_timestamp\"],\n :last_saved => Time.at(gem[\"updated_timestamp\"].to_f/1000)\n }}\n return to_return\n end",
"def index\n @emailtemplates = Spree::EmailTemplate.all\n end",
"def get_template_entries\n \n if @template\n Zip::File.open(@template)\n else\n Zip::File.open_buffer(@io.force_encoding(\"ASCII-8BIT\"))\n end\n end",
"def collect_roots\n\n\t\t# Array to return\n\t\troots = Array.new\n\t\t# For each template\n\t\ttemplates.each do |key, val|\n\t\t\t# Push to array if root\n\t\t\troots << val if template_root? key\n\t\tend\n\t\t\n\t\t# Return results\n\t\troots\n\n\tend",
"def resource_templates_by_name\n @resource_templates_by_name ||= resource_templates.all_by_name\n end",
"def templates_from_project\n list = []\n dirs = Dir.glob(File.join(output, LOCAL_DIRECTORY, '*/'))\n dirs = dirs.uniq.map{ |d| d.chomp('/') }\n dirs.each do |dir|\n name = dir.sub(File.join(output, LOCAL_DIRECTORY)+'/', '')\n list << Template.new(name, dir, :type=>:project)\n end\n list\n end",
"def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end",
"def index\n @custom_templates = CustomTemplate.page params[:page]\n end",
"def index\n @invitation_templates = InvitationTemplate.all\n end",
"def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end",
"def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end",
"def index\n @inspection_templates = InspectionTemplate.all\n end",
"def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end",
"def index\n @attr_templates = AttrTemplate.all\n end",
"def tbu_list\n @client.make_request :get, templates_path('tbu')\n end",
"def index\n @track_templates = TrackTemplate.all\n end",
"def templates\n # Some cheap memoiziation\n @templates ||= begin\n files = Dir.glob(template_glob)\n # Check to see what mode we are in, that'll define how we parse the file names\n if Gluttonberg.localized? or Gluttonberg.translated?\n # Figure out what regex we need\n matcher, mode = if Gluttonberg.localized?\n [/\\/#{filename}.(\\w+).([a-z-]+).(\\w+).(erb|mab|haml)/, :localized]\n elsif Gluttonberg.translated?\n [/\\/#{filename}.([a-z-]+).(\\w+).(erb|mab|haml)/, :translated]\n end\n files.inject({}) do |memo, file|\n match = file.match(matcher)\n extract_template_details(memo, mode, match) if match\n memo\n end\n else\n # For the non-localized/dialect mode, just collect the various formats\n files.inject([]) do |memo, file|\n match = file.match(/#{filename}.(\\w+).(erb|mab|haml)/)\n memo << match[1] if match\n memo\n end\n end\n end\n end",
"def get_templates_in_page(title, limit = @query_limit_default)\n params = {\n prop: 'templates',\n titles: title,\n tllimit: get_limited(limit)\n }\n\n query(params) do |return_val, query|\n pageid = query['pages'].keys.find { |id| id != '-1' }\n return unless pageid\n templates = query['pages'][pageid].fetch('templates', [])\n return_val.concat(templates.collect { |template| template['title'] })\n end\n end",
"def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end",
"def index\n @doc_templates = DocTemplate.all\n end",
"def index\n @survey_item_templates = SurveyItemTemplate.all\n end",
"def index_template\n authorize RegisteredElement\n @elements = RegisteredElement.where(template: true).order(:name)\n end",
"def templates\n @templates ||= EbanqApi::Templates.new(self)\n end",
"def get_templates(type)\n Dir[get_template_location << type << '/*']\n end",
"def index\n @templates = Template.all\n @curr_template = session[:template]\n @is_admin = is_admin\n end",
"def import_templates\n # Use destination account ID\n @api.account_id = @options[:dst]\n\n puts \"\\n\"\n # Import each ServerTemplate and store the new location\n @server_templates.keys.each do |server_template|\n # Grab ID number from /api/server_templates/:id\n id = @server_templates[server_template]['publication_url'].split('/').last\n response = @api.publications(:id => id).import\n\n puts \"Importing: \\\"#{response.show.name}\\\" to account: #{@options[:dst]}\"\n\n @server_templates[server_template]['new_st_url'] = response.show.href\n end\nend",
"def init_template_statements\n @templates.map do |template|\n Loader.template_policy(template[\"template\"], template[\"vars\"])\n end.flatten\n end",
"def index\n @_templates = @site.templates.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @_templates }\n end\n end",
"def index\n @review_templates = ReviewTemplate.all\n end",
"def index\n @header_templates = HeaderTemplate.page params[:page]\n end",
"def templates() = templates_path.glob('**/*.erb')",
"def index\n @call_templates = CallTemplate.all\n end",
"def index\n @policy_templates = PolicyTemplate.all\n end",
"def index\n @q = policy_scope(ServiceTemplate).ransack params[:q]\n @service_templates = @q.result.order(\"updated_at DESC\").page params[:page]\n end",
"def test_all_templates\n assert_instance_of(Array, @db.all_templates)\n end",
"def template_files\r\n \t[].concat(@templates)\r\n end",
"def template_details(template_id)\n @api.get(\"#{@api.path}/List/#{@id}/Templates/#{template_id}\")\n end",
"def all_by_name(h = {})\n inject(h) do |hash, resource_template|\n hash[resource_template.name] = resource_template if resource_template.name\n resource_template.resource_templates.all_by_name(hash)\n hash\n end\n h\n end",
"def scan_templates\r\n @templates = Dir.glob(File.join(path, \"*\")).inject([]) do |list, file_path|\r\n log.debug \"Checking if #{file_path} is a recognised template file.\"\r\n if File.file?(file_path)\r\n file_name = File.basename(file_path)\r\n log.debug \"#{file_path} is a template file.\" if !(Tilt[file_name]).nil?\r\n list << file_path if !(Tilt[file_name]).nil?\r\n end\r\n list\r\n end\r\n end",
"def index\n @email_templates = EmailTemplate.paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @item_templates = ItemTemplate.all.paginate(page: params[:page]).order('name ASC')\n end",
"def index\n authorize! :manage, :all\n @question_templates = QuestionTemplate.all\n end",
"def template_object_sets\n\t\t\toutput = []\n\t\t\tset = xpath '//template_object_set'\n\t\t\tset.each do |node|\n\t\t\t\toutput << node\n\t\t\tend\n\t\t\n\t\t\treturn output\n\t\tend"
] |
[
"0.6812131",
"0.66967785",
"0.66958106",
"0.6672116",
"0.6672116",
"0.6652211",
"0.6617218",
"0.6595698",
"0.6591689",
"0.6560652",
"0.6559263",
"0.6516133",
"0.6483969",
"0.6438744",
"0.6349718",
"0.63436997",
"0.6337578",
"0.6334029",
"0.6328988",
"0.63022083",
"0.63022083",
"0.63022083",
"0.6287683",
"0.6247718",
"0.6225118",
"0.621857",
"0.6177766",
"0.6148589",
"0.61332965",
"0.61163646",
"0.60807925",
"0.6066104",
"0.60416245",
"0.6035999",
"0.6031106",
"0.601726",
"0.60165817",
"0.59916085",
"0.59641385",
"0.59570056",
"0.59541327",
"0.5948732",
"0.5947598",
"0.59441024",
"0.59202695",
"0.59198475",
"0.5913905",
"0.59109265",
"0.5909937",
"0.59050053",
"0.5880245",
"0.58693796",
"0.585496",
"0.5853185",
"0.5849948",
"0.5845091",
"0.58331984",
"0.58290863",
"0.58103037",
"0.5807565",
"0.58047867",
"0.580016",
"0.5798682",
"0.57972366",
"0.57911295",
"0.5789709",
"0.5786371",
"0.57840335",
"0.57813376",
"0.5780684",
"0.57796454",
"0.57721823",
"0.5765431",
"0.5762491",
"0.57616687",
"0.57579726",
"0.57484585",
"0.57470137",
"0.57352227",
"0.5728914",
"0.57207376",
"0.5696931",
"0.56907654",
"0.5683193",
"0.5681419",
"0.56787705",
"0.56723636",
"0.5667605",
"0.5661526",
"0.5659823",
"0.56554985",
"0.5641264",
"0.5636656",
"0.5634661",
"0.56264174",
"0.5604918",
"0.56037825",
"0.5593627",
"0.5589196",
"0.55778074"
] |
0.82086986
|
0
|
Retrieve single template. This method will be iterative over the result of retrieve_all_template_info
|
def retrieve_single_template( template_id )
puts "Retrieving template id #{template_id}."
uri = URI(@config['endpoint'] + '/' + template_id)
# Retrieve templates
http = Net::HTTP.new( uri.host,uri.port )
http.use_ssl = true
request = Net::HTTP::Get.new( uri.request_uri )
request.basic_auth(@primary_username, @primary_password)
response = http.request( request )
template = JSON.parse( response.body )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def get_template(template_name)\n self.api_get(:template, {:template => template_name})\n end",
"def get(template_id)\n id = connection.rname_to_id(template_id, :template)\n all.select { |template| template.id == String(id) }.first\n end",
"def template_details(template_id)\n @api.get(\"#{@api.path}/List/#{@id}/Templates/#{template_id}\")\n end",
"def template(name)\n @conn.templates.get(name)\n end",
"def get_template\n if self.template\n return self.template\n end\n Template.find_by(default: true)\n end",
"def get_template(template)\n xapi.VM.get_by_name_label(template).first\n end",
"def get_template(template)\n xapi.VM.get_by_name_label(template).first\n end",
"def show\n @template = Template.find(params[:template_id])\n end",
"def get_template(template); end",
"def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end",
"def show\n @template = Template.find(params[:id])\n end",
"def find(name)\n Template.find(name)\n end",
"def get_template\n @template\n end",
"def get(tmpl_id, opts = {})\n data, _status_code, _headers = template_retrieve_with_http_info(tmpl_id, opts)\n data\n end",
"def get_template(item)\n return InstanceManager.get_template(item)\n end",
"def details\n data = Storm::Base::SODServer.remote_call '/Storm/Template/details',\n :id => @id\n self.from_hash data\n end",
"def get_content_template(id)\n @client.raw('get', \"/content/templates/#{id}\")\n end",
"def get_template(name)\n response = request('Action' => 'GetTemplate', 'StackName' => name)\n rid = response.xpath('//aws:GetTemplateResponse/aws:ResponseMetadata/aws:RequestId', NS).text\n template_body = response.xpath('//aws:GetTemplateResponse/aws:GetTemplateResult/aws:TemplateBody', NS).text\n return {:request_id => rid, :body => JSON.parse(template_body)}\n end",
"def fetch_template\n template_body = fetch_template_from_local_cache\n template_body ||= fetch_template_from_redis\n template_body ||= fetch_remote_template_and_store\n template_body ||= store_template_to_local_cache( self.default_template,\n self.local_cache_negative_ttl )\n\n return template_body \n end",
"def search_document_with_template_get(type, id, template, opts = {})\n data, _status_code, _headers = search_document_with_template_get_with_http_info(type, id, template, opts)\n return data\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def template_get(id)\n check_id_or_raise id\n\n response = http_request :get, \"#{@base_url}/templates/#{id}.xml\", 200,\n { :params => { :provider_key => @provider_key } }\n\n doc = Nokogiri::XML(response.body)\n draft_node = doc.xpath('//draft')[0]\n published_node = doc.xpath('//published')[0]\n draft = draft_node ? draft_node.text : nil\n published = published_node ? published_node.text : nil\n if draft && !draft.empty?\n draft\n else\n published\n end\n end",
"def find_template(template=XAPI_TEMP_REGEX)\n # if we got a string then try to find that template exact \n # if no exact template matches, search\n if template.is_a?(String)\n found = get_template(template)\n return found if found\n end\n\n # make sure our nil template gets set to default\n if template.nil?\n template = XAPI_TEMP_REGEX\n end \n\n Chef::Log.debug \"Name: #{template.class}\"\n # quick and dirty string to regex\n unless template.is_a?(Regexp)\n template = /#{template}/ \n end\n\n # loop over all vm's and find the template \n # Wish there was a better API method for this, and there might be\n # but i couldn't find it\n Chef::Log.debug \"Using regex: #{template}\"\n xapi.VM.get_all_records().each_value do |vm|\n if vm[\"is_a_template\"] and vm[\"name_label\"] =~ template\n Chef::Log.debug \"Matched: #{h.color(vm[\"name_label\"], :yellow )}\"\n found = vm # we're gonna go with the last found \n end\n end\n\n # ensure return values\n if found\n puts \"Using Template: #{h.color(found[\"name_label\"], :cyan)}\"\n return get_template(found[\"name_label\"]) # get the ref to this one\n end\n return nil\n end",
"def show\n @_template = @site.templates.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @_template }\n end\n end",
"def template\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n @template\n end",
"def template\n @template ||= File.read(template_full_path)\n end",
"def retrieve(id, draft = nil)\n path = \"templates/#{id}\"\n query_params = draft.nil? ? {} : { draft: draft }\n @client.call(method: :get, path: path, query_values: query_params)\n end",
"def show\n\t\t@template = Template.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @template }\n\t\tend\n\tend",
"def get_template\r\n template.nil? ? self.template_body : template.body\r\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def get_template(params)\n if params[:file_path]\n return get_template_from_file(params[:file_path])\n elsif params[:template]\n return params[:template]\n else\n raise 'A valid template file path or template text is required.'\n end\n end",
"def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end",
"def details(type, template_uuid)\n response = @client.get(\"editor/#{type}/templates/#{template_uuid}\")\n verify response,\n forbidden: 'You do not have permission to open the template',\n not_found: 'Template does not exist',\n internal_server_error: 'Internal server error occurred.'\n end",
"def find_template(template)\n template = locate_config_value(:template_regex) if template.nil?\n # if we got a string then try to find that template exact\n # if no exact template matches, search\n if template.is_a?(String)\n found = get_template(template)\n return found if found\n end\n\n # make sure our nil template gets set to default\n if template.nil?\n template = locate_config_value(:template_regex)\n end\n\n Chef::Log.debug \"Name: #{template.class}\"\n # quick and dirty string to regex\n unless template.is_a?(Regexp)\n template = /#{template}/\n end\n\n # loop over all vm's and find the template\n # Wish there was a better API method for this, and there might be\n # but i couldn't find it\n Chef::Log.debug \"Using regex: #{template}\"\n xapi.VM.get_all_records.each_value do |vm|\n if vm['is_a_template'] && vm['name_label'] =~ template\n Chef::Log.debug \"Matched: #{h.color(vm['name_label'], :yellow)}\"\n found = vm # we're gonna go with the last found\n end\n end\n\n # ensure return values\n if found\n ui.msg \"Using Template: #{h.color(found['name_label'], :cyan)}\"\n return get_template(found['name_label']) # get the ref to this one\n end\n nil\n end",
"def template_content(name)\n templates.select { |t| t[:name] = name || 'index' }.first[:template]\n end",
"def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def template_retrieve_with_http_info(tmpl_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TemplatesApi.template_retrieve ...'\n end\n # verify the required parameter 'tmpl_id' is set\n if @api_client.config.client_side_validation && tmpl_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tmpl_id' when calling TemplatesApi.template_retrieve\"\n end\n pattern = Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n if @api_client.config.client_side_validation && tmpl_id !~ pattern\n fail ArgumentError, \"invalid value for 'tmpl_id' when calling TemplatesApi.template_retrieve, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/templates/{tmpl_id}'.sub('{' + 'tmpl_id' + '}', CGI.escape(tmpl_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] || 'Template'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"TemplatesApi.template_retrieve\",\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: TemplatesApi#template_retrieve\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n begin\n @template = current_user.templates.find(params[:id])\n rescue Exception => e\n flash[:notice] = \"You are not authorized to access that Template\"\n Services::Slog.exception e\n redirect_to :root\n end\n end",
"def get_template(id, opts = {})\n data, _status_code, _headers = get_template_with_http_info(id, opts)\n data\n end",
"def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end",
"def fetch_template(template_name = nil)\n # Due to security reason, it cannot use templates outside until it will be fixed\n # if GitlabHook::Project::config['template']\n # return GitlabHook::Project::config['template']\n # end\n\n if template_name.nil?\n template_name = @default_template_name\n else\n validate_template_name template_name\n end\n\n File.read(\n File.expand_path(\n configatron.app.path.templates + '/slack/message/' +\n template_name + '.erb')\n )\n end",
"def template\n @template.content\n end",
"def show\n @project_template = ProjectTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_template }\n end\n end",
"def get_query_template( type, templates = [] ) \n\ttype = type.gsub(/[^a-z0-9-]+/, '')\n\n\ttemplates = [type] if templates.blank?\n\n\t# Filters the list of template filenames that are searched for when retrieving a template to use.\n\t#\n\t# The last element in the array should always be the fallback template for this query type.\n\t#\n\t# Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',\n\t# 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.\n\t#\n\t# @param array $templates A list of template candidates, in descending order of priority.\n\ttemplates = apply_filters( \"#{type}_template_hierarchy\", templates )\n\n\tif true # TS_INFO: It returns here all the templates, because the check will be done in the controller\n\t\treturn templates\n\tend\n\n\ttemplate = locate_template( templates )\n\n\t# Filters the path of the queried template by type.\n\t#\n\t# The dynamic portion of the hook name, `$type`, refers to the filename -- minus the file\n\t# extension and any non-alphanumeric characters delimiting words -- of the file to load.\n\t# This hook also applies to various types of files loaded as part of the Template Hierarchy.\n\t#\n\t# Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',\n\t# 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.\n\t#\n\t# @param string $template Path to the template. See locate_template().\n\t# @param string $type Sanitized filename without extension.\n\t# @param array $templates A list of template candidates, in descending order of priority.\n\tapply_filters( \"#{type}_template\", template, type, templates )\nend",
"def read_template(template)\n File.open(File.join(templates_path, template), 'r').read\n end",
"def template\n possible_templates.find {|t| File.exists? \"#{t}.html\"}\n end",
"def find_template(state)\n view.find_template expanded_view_templates_for(state)\n end",
"def template\n @mail_template = MailTasks::Template.find_or_new( params[:id] )\n\n # For GET\n (render && return) if request.get?\n \n # For Preview\n if params[:commit].downcase == \"preview\"\n @mail_template.attributes = params[:mail_template]\n render :text => @mail_template.content_for_preview( mail_layout_options )\n return\n end\n \n # For Create / Update\n @mail_template.attributes = params[:mail_template]\n @mail_template.variables = params[:variables]\n if @mail_template.save\n flash[:notice] = \"Template \\\"#{@mail_template.name}\\\" has been saved successfully!\"\n redirect_to :back\n else\n flash.now[:notice] = @mail_template.errors.full_messages.join(\"<br />\")\n render\n end\n end",
"def fetch_template(endpoint)\n url = URI.parse(endpoint)\n region = url.host.split('.').first.split('-', 2).last\n if(region == 's3')\n region = 'us-east-1'\n end\n bucket, path = url.path.sub('/', '').split('/', 2)\n MultiJson.load(\n storage_api(region).buckets.get(\n bucket.sub('/', '')\n ).files.get(path).body.read\n )\n end",
"def template\n return nil unless is_template_profile\n\n @template ||= ProvisioningProfileTemplate.factory(profile_details['template'])\n end",
"def show\n @survey_template = SurveyTemplate.find(params[:id])\n end",
"def fetch_template_from_redis\n result = self.redis_connector.get( redis_key )\n store_template_to_local_cache( result ) if result\n\n return result\n end",
"def the_template(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.template\n else\n \"<strong>Error:</strong> No template information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end",
"def template\n @template\n end",
"def show\n template = Template.find(params[:id])\n authorize template\n # Load the info needed for the overview section if the authorization check passes!\n phases = template.phases\n .includes(sections: { questions: :question_options })\n .order('phases.number', 'sections.number', 'questions.number',\n 'question_options.number')\n .select('phases.title', 'phases.description', 'phases.modifiable',\n 'sections.title', 'questions.text', 'question_options.text')\n unless template.latest?\n # rubocop:disable Layout/LineLength\n flash.now[:notice] = _('You are viewing a historical version of this template. You will not be able to make changes.')\n # rubocop:enable Layout/LineLength\n end\n render 'container', locals: {\n partial_path: 'show',\n template: template,\n phases: phases,\n referrer: get_referrer(template, request.referer)\n }\n end",
"def search_index_with_template_get(type, template, opts = {})\n data, _status_code, _headers = search_index_with_template_get_with_http_info(type, template, opts)\n return data\n end",
"def lookup_template(name)\n @templates.fetch(name.to_s) { |k| @parent ? @parent.lookup_template(k) : nil }\n end",
"def find_template_sub(t)\n for path in [File.join(juli_repo, Juli::REPO), Juli::TEMPLATE_PATH] do\n template = File.join(path, t)\n return template if File.exist?(template)\n end\n raise Errno::ENOENT, \"no #{t} found\"\n end",
"def index\n @template = Template.find(params[:template_id])\n @template_parameters = TemplateParameter.where(template_id: params[:template_id])\n end",
"def index\n if params[:name]\n @template = Template.find_by_name(params[:name])\n if @template\n respond_ok \"template\", @template\n else\n respond_err \"template\", Template.new, \"i18> No template found\"\n end\n else\n @templates = Template.all\n if !@templates.empty?\n respond_ok \"template\", @templates\n else\n respond_err \"template\", @templates, \"i18> No template found\"\n end\n end\n end",
"def show_template\n self.template\n end",
"def show_template\n self.template\n end",
"def perform_template_load\n memoize(:template) do\n self.data[:template] = api.stack_template_load(self)\n true\n end\n end",
"def search_explain_with_template_get(type, id, template, opts = {})\n data, _status_code, _headers = search_explain_with_template_get_with_http_info(type, id, template, opts)\n return data\n end",
"def fetch_template_from_url\n layout_url = lookup_template_url\n return nil if layout_url == nil\n\n Rails.logger.info \"Fetching remote template from #{layout_url.inspect}\"\n\n response = Curl.get( layout_url ) do |curl| \n curl.timeout = self.http_timeout\n end\n response_body = response.body_str\n\n Rails.logger.info \"Got remote template response code #{response.response_code} with body #{response_body.inspect}\"\n\n return nil if response.response_code == 404\n \n response_body = postprocess_template( response_body ) if respond_to?( :postprocess_template, true )\n\n return response_body\n \n rescue SocketError, Curl::Err::TimeoutError, Errno::ECONNREFUSED, TemplateRejectedError => e\n Rails.logger.error e.message\n return nil\n end",
"def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @template }\n end\n end",
"def select_template\n templatelist = []\n templatelist\n end",
"def get_template_file\n @config['template']\n end",
"def read_template(template)\n File.read(template_path(template))\n end",
"def set_template_detail\n @template_detail = TemplateDetail.find(params[:id])\n end",
"def template\n @template || nil\n end",
"def resource_and_found_template(template_path, options = {})\n resource, template = template_path.split('/')\n\n raw_template_path = find_template_path(resource, template, options)\n found_template = raw_template_path.split('/').last if raw_template_path\n\n [resource, found_template]\n end",
"def show\n @template = CustomTemplate.find(params[:id])\n\t@baseline_characteristic_fields = BaselineCharacteristicField.where(:template_id => @template.id).all\n\t@quality_dimension_fields = QualityDimensionField.where(:template_id => @template.id).all\n\t@template_categorical_columns = OutcomeColumn.where(:template_id => @template.id, :outcome_type => \"Categorical\").all\n\t@template_continuous_columns = OutcomeColumn.where(:template_id => @template.id, :outcome_type => \"Continuous\").all\t\t\n \trender :layout => \"templates\"\t\n end",
"def template\n if object.respond_to?(:template)\n object.template\n else\n @template\n end\n end",
"def set_template\n @template = Template.find(params[:id])\n\n rescue ActiveRecord::RecordNotFound\n head 404\n end",
"def get_template(filename)\n File.read(filename)\nend",
"def template\n return @template if @template\n\n # If they sent any instance-level options use that instead of the class's.\n if @template_path || @template_extension || @template_name || @template_file\n @template = templateify(File.read(template_file))\n else\n @template = self.class.template\n end\n end",
"def show\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def get_templates(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 r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end",
"def template\n return @template\n end",
"def load_template(name)\n filename = locate_template(name)\n File.read(filename)\n end",
"def template(template_name)\n\t\t@templates ||= {}\n\n\t\tif !@templates.has_key?(template_name)\n\t\t\ttemplate_file = template_name + \".erb\"\n\t\t\ttemplate_path = File.join(__dir__, \"templates\", template_file)\n\t\t\traise(ArgumentError, \"Attempting to find template #{template_file}, which does not exist.\") unless File.exists?(template_path)\n\n\t\t\t@templates[template_name] = File.read(template_path)\n\t\tend\n\t\t@templates[template_name]\n\tend",
"def show\n @question_template = QuestionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_template }\n end\n end",
"def _template\n @template\n end",
"def get_template(name)\n if File.exists?(\"#{repository.path}/#{name}.mustache\")\n IO.read(\"#{repository.path}/#{name}.mustache\")\n else\n IO.read(File.join(File.dirname(__FILE__), \"templates/#{name}.mustache\"))\n end\n end",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def try_picking_template_for_path(template_path)\n self.view_paths.find_template(template_path, template_format)\n end",
"def try_picking_template_for_path(template_path)\n self.view_paths.find_template(template_path, template_format)\n end",
"def set_template\n @template = ::Template.find(params[:id])\n end",
"def search_document_with_template_get_with_http_info(type, id, template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SearchApi.search_document_with_template_get ...\"\n end\n # verify the required parameter 'type' is set\n if @api_client.config.client_side_validation && type.nil?\n fail ArgumentError, \"Missing the required parameter 'type' when calling SearchApi.search_document_with_template_get\"\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 SearchApi.search_document_with_template_get\"\n end\n # verify the required parameter 'template' is set\n if @api_client.config.client_side_validation && template.nil?\n fail ArgumentError, \"Missing the required parameter 'template' when calling SearchApi.search_document_with_template_get\"\n end\n # resource path\n local_var_path = \"/search/documents/{type}/{template}/{id}\".sub('{' + 'type' + '}', type.to_s).sub('{' + 'id' + '}', id.to_s).sub('{' + 'template' + '}', template.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 = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SearchApi#search_document_with_template_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def template\n Liquid::Template.parse(template_content(template_name))\n end",
"def find_template(opts={})\n if template = opts[:template]\n path = _template_root / template\n elsif action = opts[:action]\n segment = self.class.name.snake_case.split('::').join('/')\n path = _template_root / segment / action\n elsif _layout = opts[:layout]\n path = _template_root / 'layout' / _layout\n else\n raise \"called find_template without an :action or :layout\" \n end \n glob_template(path, opts)\n end",
"def search_mappings_with_template_get(type, template, opts = {})\n data, _status_code, _headers = search_mappings_with_template_get_with_http_info(type, template, opts)\n return data\n end",
"def find_template_by_language(language_code=Utility.language_code)\n find(:first, :conditions => [\"kases.template = ? AND kases.language_code = ?\", true, language_code])\n end",
"def get_item_template_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreApi.get_item_template ...\"\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 StoreApi.get_item_template\"\n end\n # resource path\n local_var_path = \"/store/items/templates/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'StoreItemTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreApi#get_item_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end"
] |
[
"0.7586648",
"0.74029773",
"0.7339263",
"0.7268522",
"0.7008067",
"0.68500745",
"0.68413126",
"0.68368345",
"0.68368345",
"0.6663513",
"0.6575016",
"0.6574777",
"0.6563132",
"0.64946645",
"0.64781356",
"0.64725524",
"0.64099216",
"0.6406067",
"0.63910824",
"0.63813275",
"0.63771975",
"0.6345716",
"0.63289124",
"0.631235",
"0.6273593",
"0.62684256",
"0.6224583",
"0.6212202",
"0.61963093",
"0.6182758",
"0.6107918",
"0.61035407",
"0.60954356",
"0.6075629",
"0.6055763",
"0.6055387",
"0.6035041",
"0.5991786",
"0.59685934",
"0.59681904",
"0.5959981",
"0.5951869",
"0.59247494",
"0.5909459",
"0.5888689",
"0.5881309",
"0.5864645",
"0.58611",
"0.58540535",
"0.5853216",
"0.5850985",
"0.58470213",
"0.5835244",
"0.58338916",
"0.58180344",
"0.5799179",
"0.5794981",
"0.5776133",
"0.5771941",
"0.57703775",
"0.57649064",
"0.57565314",
"0.5753353",
"0.5743899",
"0.5743899",
"0.57332635",
"0.5727061",
"0.5723195",
"0.5723015",
"0.5720776",
"0.57175875",
"0.57137614",
"0.5705088",
"0.5702608",
"0.57002234",
"0.5697161",
"0.5696631",
"0.5681154",
"0.5678816",
"0.5676476",
"0.5664474",
"0.5655632",
"0.564511",
"0.56367135",
"0.56189257",
"0.5616342",
"0.5606731",
"0.5604853",
"0.5604763",
"0.5604763",
"0.5598355",
"0.5598355",
"0.5596088",
"0.55941993",
"0.5591346",
"0.5587248",
"0.5573097",
"0.5571252",
"0.55674833",
"0.55586225"
] |
0.7499402
|
1
|
Save each template content here. This method will be iterative over the result of retrieve_single_template
|
def backup_template( template )
filename = "./templates/#{template['id']}.json"
file = File.new(filename, "w")
puts "Backing up #{filename} ..."
file.write( template )
file.close
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each_template\n if @processed.nil?\n @processed, @rest = templates.keys.partition { |k| k.to_s.include? \".\" }\n end\n\n @processed.each do |k|\n yield k, templates[k]\n end\n\n @rest.each do |k|\n yield k, templates[k]\n end\n end",
"def each_template(markup)\n @templates.each do |dest,file|\n if (formatted_like?(dest,markup) || !formatted?(dest))\n yield dest, file\n end\n end\n end",
"def store_resource_template\n add_pod_disruption_budget\n counter = Hash.new(-1)\n self.resource_template = raw_template.map do |resource|\n index = (counter[resource.fetch(:kind)] += 1)\n TemplateFiller.new(self, resource, index: index).to_hash\n end\n end",
"def template_content\n if respond_to? :contents and contents\n contents.elements.map do |item|\n if item.content.respond_to? :template\n item.content.template.renderable.template.render\n else\n ::Alongslide::render item.text_value, plain: true\n end\n end\n end\n end",
"def save_to_template\n return if authorise_for_web('runs', 'production_run_setup') == false\n\n run = session[:current_production_run]\n commodity = run.production_schedule.rmt_setup.commodity_code\n variety = run.production_schedule.rmt_setup.variety_code\n farm_group = run.production_schedule.farm_group_code\n line_config = run.line.line_config.line_config_code\n\n\n @sizer_templates = SizerTemplate.find_all_by_commodity_code_and_line_config_code(commodity, line_config)\n #remove incomplete templates\n incomplete = nil\n incomplete_templates = \"<strong>Some templates matched, but are incomplete and cannot be used. They are :</strong>\"\n @sizer_templates.each do |template|\n if template.pack_group_templates.length == 0\n incomplete = true\n incomplete_templates += \"<br> => '\" + template.template_name + \"'\"\n @sizer_templates.delete(template)\n end\n end\n\n if @sizer_templates.length == 0\n msg = \"<strong>No sizer template have been defined that match the active run context.</strong> The relevant fields are: <br>\"\n msg += \"<font color = 'green><strong> Commodity: </strong>\" + commodity + \"<br>\"\n msg += \"<font color = 'green><strong> Variety: </strong>\" + variety + \"<br>\"\n msg += \"<font color = 'green><strong> Farm Group: </strong>\" + farm_group + \"<br>\"\n msg += \"<font color = 'green><strong> Line Config: </strong>\" + line_config\n\n @freeze_flash = true\n flash[:notice] = msg\n active_run\n return\n end\n\n if incomplete\n flash[:notice]= incomplete_templates\n @freeze_flash = true\n end\n\n\n render :inline => %{\n <% grid = build_sizer_template_grid(@sizer_templates,false,false,false,true) %>\n <% grid.caption = 'list of all <strong>applicable </strong> sizer_templates that can be saved to' %>\n <% @header_content = grid.build_grid_data %>\n\n <%= grid.render_html %>\n <%= grid.render_grid %>\n }, :layout => 'content'\n\n end",
"def save\n Tempfile.open([file_name, FILE_EXTENSION], type: 'application/zip') do |output_file|\n Zip::File.open(@template_path) do |template_zip|\n Zip::OutputStream.open(output_file.path) do |out|\n template_zip.each do |entry|\n out.put_next_entry entry.name\n if @replaceable_files[entry.name]\n out.write(@replaceable_files[entry.name])\n else\n out.write(template_zip.read(entry.name))\n end\n end\n end\n end\n output_file\n end\n end",
"def create\n @templates = @firm.templates\n @template = Template.new(template_params)\n @template.user = @user\n @template.firm = @firm\n if File.extname(@template.file.file.filename) == '.docx'\n content = ''\n if @template.valid_zip?\n doc = Docx::Document.open(@template.file.path)\n doc.paragraphs.each do |p|\n if p.node.xpath('w:r//w:lastRenderedPageBreak').present?\n content = content + %q(<div class=\"-page-break\"></div>) + p.to_html\n else\n content = content + p.to_html\n end\n\n end\n @template.html_content = content\n respond_to do |format|\n if @template.save\n format.html { redirect_to template_path(@template), notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n else\n @template.errors.add(:file, 'is corrupted')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def generate(save = false)\n # Code to export into the manifest cache\n export = \"Sereth::TemplateManager::Manifest.register(:raw)\"\n\n Dir.glob(\"app/template/raw/**\") do |file| \n template = Parser.read(file)\n template.raw = file\n\n if save\n # Store the parsed template to server throuch a controller\n template.cache = \"app/template/cache/#{template.name}\"\n File.open(template.cache) do |cached_template|\n cached_template.print(template.code)\n end\n\n # Store the template metadata for serving cached data in production\n File.open(\"app/template/manifest.rb\", \"w\") do |manifest| \n manifest.puts(export % {raw: template.metadata})\n end\n end\n end\n end",
"def import_templates\n # Use destination account ID\n @api.account_id = @options[:dst]\n\n puts \"\\n\"\n # Import each ServerTemplate and store the new location\n @server_templates.keys.each do |server_template|\n # Grab ID number from /api/server_templates/:id\n id = @server_templates[server_template]['publication_url'].split('/').last\n response = @api.publications(:id => id).import\n\n puts \"Importing: \\\"#{response.show.name}\\\" to account: #{@options[:dst]}\"\n\n @server_templates[server_template]['new_st_url'] = response.show.href\n end\nend",
"def procesar_template(template, datos)\n template = template\n @procesadores.each do |procesador|\n template = procesador.procesar(template, datos)\n end\n template\n end",
"def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end",
"def postprocess(root)\n @root = root\n value = @template.render!(template_data, strict_variables: true)\n @path.open(\"wb\") { |f| f.write(value) }\n end",
"def update_files(&block)\n \n get_template_entries.each do |entry|\n \n next if entry.directory?\n \n entry.get_input_stream do |is|\n \n data = is.sysread\n \n if CONTENT_FILES.include?(entry.name)\n process_entry(data, &block)\n end\n \n @output_stream.put_next_entry(entry.name)\n @output_stream.write data\n \n end\n end\n end",
"def generate(page_setup = {})\n Zip::File.open(@template_path) do |template_zip|\n buffer = Zip::OutputStream.write_buffer do |out|\n template_zip.each do |entry|\n out.put_next_entry entry.name\n if @replaceable_files[entry.name] && entry.name == Document.doc_xml_file\n source = entry.get_input_stream.read\n # the source has only 1 sectPr and we change the doc dimensions based on the page setup\n source = replace_dimensions(source, page_setup)\n # Change only the body of document. TODO: Improve this...\n source = source.sub(/(<w:body>)((.|\\n)*?)(<w:sectPr)/, \"\\\\1#{@replaceable_files[entry.name]}\\\\4\")\n out.write(source)\n elsif @replaceable_files[entry.name] && entry.name == Document.header_xml_file\n source = entry.get_input_stream.read\n # Change only the body of document. TODO: Improve this...\n\n Rails.logger.info(\"header before:#{source}\")\n source = source.sub(/<w:tbl>.*<\\/w:tbl>/, \"#{@replaceable_files[entry.name]}\")\n Rails.logger.info(\"header after:#{source}\")\n\n out.write(source)\n # elsif @replaceable_files[entry.name] && entry.name == Document.footer_xml_file\n # source = entry.get_input_stream.read\n # Change only the body of document. TODO: Improve this...\n # Rails.logger.info(\"footer before:#{source}\")\n # source = source.sub(/<w:tbl>.*<\\/w:tbl>/, \"#{@replaceable_files[entry.name]}\")\n # Rails.logger.info(\"footer after:#{source}\")\n # out.write(source)\n\n elsif @replaceable_files[entry.name]\n out.write(@replaceable_files[entry.name])\n Rails.logger.info(\"footer: #{entry.get_input_stream.read}\") if entry.name == Document.footer_xml_file\n elsif entry.name == Document.content_types_xml_file\n raw_file = entry.get_input_stream.read\n content_types = @image_files.empty? ? raw_file : inject_image_content_types(raw_file)\n\n out.write(content_types)\n else\n out.write(template_zip.read(entry.name))\n end\n end\n unless @image_files.empty?\n #stream the image files into the media folder using open-uri\n @image_files.each do |hash|\n out.put_next_entry(\"word/media/#{hash[:filename]}\")\n URI.open(hash[:url], 'rb') do |f|\n out.write(f.read)\n end\n end\n end\n # add the header rels as its not already in the template docx\n out.put_next_entry(Document.header_relations_xml_file)\n out.write(@replaceable_files[Document.header_relations_xml_file])\n # add the footer rels as its not already in the template docx\n out.put_next_entry(Document.footer_relations_xml_file)\n out.write(@replaceable_files[Document.footer_relations_xml_file])\n\n # test creating for the blank header and footer to see if it fixes the error on open\n #\n # out.put_next_entry('word/_rels/header2.xml.rels')\n # out.write(@replaceable_files[Document.header_relations_xml_file])\n # add the footer rels as its not already in the template docx\n # out.put_next_entry('word/_rels/footer2.xml.rels')\n # out.write(@replaceable_files[Document.footer_relations_xml_file])\n\n end\n buffer.string\n end\n end",
"def save(nsc)\n root = REXML::XPath.first(@xml, 'ScanTemplate')\n if root.attributes['id'] == '#NewScanTemplate#'\n response = JSON.parse(AJAX.post(nsc, '/data/scan/templates', xml))\n root.attributes['id'] = response['value']\n else\n response = JSON.parse(AJAX.put(nsc, \"/data/scan/templates/#{URI.encode(id)}\", xml))\n end\n response['value']\n end",
"def select_template\n templatelist = []\n templatelist\n end",
"def get_template_entries\n \n if @template\n Zip::File.open(@template)\n else\n Zip::File.open_buffer(@io.force_encoding(\"ASCII-8BIT\"))\n end\n end",
"def save_questions_from_template(template)\n return true if template.questions.empty?\n\n template.questions.each do |question|\n existing = stage.stage_questions.where(:template_question_id => question.id).limit(1).first\n\n if existing\n existing.update_attributes(:category => question.category, :question => question.question, :answer => question.answer, :points => question.points)\n else\n stage.stage_questions.create(:template_question_id => question.id, :category => question.category, :question => question.question, :answer => question.answer, :points => question.points)\n end\n end\n end",
"def serializable_data\n template = self.class.find(self.id,:include=>[:param_values,:page_layout=>:full_set_nodes])\n hash ={:template=>template, :param_values=>template.param_values, :page_layouts=>template.page_layout.full_set_nodes,\n :template_files=>template.template_files,:template_releases=>template.template_releases\n } \n hash \n end",
"def template\n @template.content\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def perform_template_load\n memoize(:template) do\n self.data[:template] = api.stack_template_load(self)\n true\n end\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def write_meta_files\r\n @files.each do |file|\r\n template = ERB.new(\r\n File.new(File.join(@dirs[:templates],file[:template])).read,\r\n nil, \"%\")\r\n output_file = File.new(file[:path], \"w+\")\r\n output_file.write(template.result(binding))\r\n output_file.close\r\n end\r\n end",
"def template(template_name)\n @attributes.store(template_name)\n end",
"def publish\n original = Newsly::Template.find(self.parent_id)\n original.subject= self.subject\n original.body= self.body\n original.save\n original\n end",
"def create\n @template = Template.new(template_params)\n current_user.templates << @template\n\n respond_to do |format|\n if current_user.save\n Field.all.each do |field|\n t_field = TemplateField.new(val: \"\")\n t_field.field = field\n t_field.template = @template \n t_field.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_added') }\n else\n format.html { redirect_to dashboard_path, notice: @template.errors.full_messages[0]}\n end\n end\n end",
"def convert\n erb = ERB.new(File.readlines(template_file).join)\n File.open(File.basename(content_file, File.extname(content_file)) + '.html', 'w') do |f|\n f << erb.result(get_binding)\n end\n end",
"def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end",
"def templates(&block)\n instance_eval(&block)\n end",
"def generate\n Zip::File.open(@template_path) do |template_zip|\n buffer = Zip::OutputStream.write_buffer do |out|\n template_zip.each do |entry|\n out.put_next_entry entry.name\n if @replaceable_files[entry.name]\n source = entry.get_input_stream.read.sub(/(<w:body>)(.*?)(<w:sectPr)/, \"\\\\1#{@replaceable_files[entry.name]}\\\\3\")\n out.write(source)\n else\n out.write(template_zip.read(entry.name))\n end\n end\n end\n buffer.string\n end\n end",
"def build_docs\n object_map.each do |index, objects|\n objects.each do |object|\n template_context = {\n #:meta => Site\n index => object\n }\n content = converter.render(template_map[index], template_context)\n filename = converter.filename_for(object)\n write_output_file(filename, content)\n end\n end\n end",
"def sync(source_template)\n [ :template_name, :template_type, :template_outfile, :template_rebuild_me, :template_text,\n :template_linked_file, :template_linked_file_mtime, :template_linked_file_size,\n :template_created_on, :template_modified_on, :template_created_by, :template_modified_by,\n :template_build_dynamic ].each do |attribute|\n self[attribute] = source_template[attribute]\n end\n \n # Linked files must be placed in the filesystem appropriately.\n unless self.linked_file.blank?\n blog_root_regex = Regexp.new('(/var/domain/.*/(beta|www))')\n source_blog_root = blog_root_regex.match(source_template.blog.blog_site_path)[1]\n target_blog_root = blog_root_regex.match(self.blog.blog_site_path)[1]\n self[:template_linked_file].gsub!(source_blog_root, target_blog_root)\n end\n \n # Copy templatemaps ONLY if this template has been previously saved.\n unless self.new_record?\n # Delete existing templatemaps.\n self.templatemaps.destroy_all\n \n # Copy templatemaps.\n source_template.templatemaps.each do |source_templatemap|\n self.templatemaps << MovableType::AR::Templatemap.create(self, source_templatemap)\n end\n end\n end",
"def set_content_variables(template)\n content = template.content\n tags = template.tags(content)\n tags.each do |tag|\n if @template.questions.where(tag: tag).count > 0\n replacement = @template.questions.where(tag: tag).first.answer\n content.gsub! tag, replacement\n end\n end\n return content\n end",
"def process\n read_posts\n read_layouts\n write_posts\n write_pages\n end",
"def process_template( design_template, file_name )\n file = sample_file( file_name )\n design_template.original_file = file\n design_template.original_file.\\\n instance_write(:content_type, 'application/postscript')\n build_test_template( design_template, file )\n\n if design_template.save!\n Rails.logger.info 'design_template_test_helper - process_template() - successful save'\n process_original( design_template )\n else\n Rails.logger.info 'design_template_test_helper - process_template() - FAILED to save.'\n assert( false, 'DesignTemplate save failed.' )\n end\n end",
"def build_template_file_records(template_files)\n template_files.to_a.map do |(filename, content)|\n Course::Assessment::Question::ProgrammingTemplateFile.new(filename: filename.to_s,\n content: content)\n end\n end",
"def templates_for(file); end",
"def store\n @files.each do |file, lines|\n text = \"\"\n dirty = false\n lines.each do |l|\n if l.is_a?(Section)\n dirty ||= l.dirty?\n text << l.format\n l.mark_clean\n else\n text << l\n end\n end\n if dirty\n Puppet::Util::FileType.filetype(:flat).new(file).write(text)\n return file\n end\n end\n end",
"def add_template_pages; end",
"def copy_template_files_to(answer)\n template_files.each do |template_file|\n template_file.copy_template_to(answer)\n end\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def execute!\n config[:print_only] = true\n file = load_template_file\n\n output_content = parameter_scrub!(template_content(file))\n if config[:yaml]\n require \"yaml\"\n output_content = YAML.dump(output_content)\n else\n output_content = format_json(output_content)\n end\n\n if config[:write_to_file]\n unless File.directory?(File.dirname(config[:write_to_file]))\n run_action \"Creating parent directory\" do\n FileUtils.mkdir_p(File.dirname(config[:write_to_file]))\n nil\n end\n end\n run_action \"Writing template to file - #{config[:write_to_file]}\" do\n File.write(config[:write_to_file], output_content)\n nil\n end\n else\n ui.puts output_content\n end\n end",
"def seed_page_content_translations!\n I18n.available_locales.each do |locale|\n seed_content_for_locale locale.to_s\n end\n end",
"def process_pages\n bindings = {\n :name => @definition.get_name,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:view)\n @definition.resources.each do |methods|\n methods[1].each do |resource|\n bindings.merge!(:resource => resource)\n filename = \"#{resource.slug}.html\"\n page.save_template(filename, bindings)\n end\n end\n end",
"def preprocess_template(template)\n self._head_assets = head_assets\n self._body_assets = body_assets\n content_areas.each do |content_area|\n # only render assets once for each type\n unless _head_assets.include?(content_area.render_head)\n self._head_assets += content_area.render_head\n end\n unless _body_assets.include?(content_area.render_body)\n self._body_assets += content_area.render_body\n end\n template.template.gsub!(/\\{\\{([\\w ]*):( *)#{content_area.name} \\}\\}/, content_area.render)\n end\n template\n end",
"def store_template_to_redis( template_body )\n return self.redis_connector.set( redis_key, template_body )\n end",
"def template\n @mail_template = MailTasks::Template.find_or_new( params[:id] )\n\n # For GET\n (render && return) if request.get?\n \n # For Preview\n if params[:commit].downcase == \"preview\"\n @mail_template.attributes = params[:mail_template]\n render :text => @mail_template.content_for_preview( mail_layout_options )\n return\n end\n \n # For Create / Update\n @mail_template.attributes = params[:mail_template]\n @mail_template.variables = params[:variables]\n if @mail_template.save\n flash[:notice] = \"Template \\\"#{@mail_template.name}\\\" has been saved successfully!\"\n redirect_to :back\n else\n flash.now[:notice] = @mail_template.errors.full_messages.join(\"<br />\")\n render\n end\n end",
"def set_content_template\n @content_template = ContentTemplate.find(params[:id])\n end",
"def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end",
"def fetch_remote_template_and_store\n template_body = fetch_template_from_url\n\n if template_body\n store_template_to_local_cache( template_body )\n store_template_to_redis( template_body )\n end\n\n return template_body\n end",
"def write_posts\n posts.each do |p|\n # TODO allow user to specify which layouts a post should use \n p.render(layouts)\n p.write(File.join(destination_path, \"posts\"))\n end\n end",
"def each\r\n\t\t\t@contents.each do |item|\r\n\t\t\t\tyield item\r\n\t\t\tend\r\n\t\tend",
"def execute\n Services::Slog.debug({:message => \"File write for #{@template[:identifier]}\", :module => \"FileTemplate\", :task => \"execute\", :extra => {:template => @template[:identifier], :payload => @template[:payload]}})\n case @template[:payload][:method]\n when 'create'\n begin\n\n @template.users.each do |user|\n File.open(\"data/users/#{user.id}/#{@template[:payload][:uri]}\", \"w+\") { |file| file.write(\"\\n\") }\n response = { :status => \"200\", :message => \"File created.\", :id => @template[:payload][:uri]}\n\n unless @template[:payload][:content].nil? then\n File.open(\"data/users/#{user.id}/#{@template[:payload][:uri]}\", \"w+\") { |file| file.write(@template[:payload][:content]) }\n end\n end\n rescue Exception => e\n Services::Slog.exception e\n response = { :status => \"400\", :message => \"Method not is unsupported, #{e}\" }\n end\n when 'append'\n begin\n @template.users.each do |user|\n unless @template[:payload][:content].nil? then\n File.open(Dir.pwd + \"/data/users/#{user.id}/#{@template[:payload][:uri]}\", \"a+\") { |file| file.write(@template[:payload][:content]) }\n end\n end\n response = { :status => \"200\", :message => \"Content appended to file\", :id => @template[:payload][:uri]}\n rescue Exception => e\n response = { :status => \"403\", :message => \"Error processing file, #{e}\" }\n Services::Slog.exception e\n end\n end\n\n response\n end",
"def save\n generate_archive(generate_content_types, generate_rels, generate_document)\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def process\n self.read_layouts\n self.transform_pages\n self.write_posts\n end",
"def template_upload(*paths)\n remote_path = paths.pop\n templates = []\n paths.collect! do |path| \n if StringIO === path\n path.rewind\n template = Rye::Tpl.new(path.read, \"inline-template\")\n elsif String === path\n raise \"No such file: #{Dir.pwd}/#{path}\" unless File.exists?(path)\n template = Rye::Tpl.new(File.read(path), File.basename(path))\n end\n template.result!(binding)\n templates << template\n template.path\n end\n paths << remote_path\n ret = self.file_upload *paths\n templates.each { |template| \n tmp_path = File.join(remote_path, File.basename(template.path))\n if file_exists?(tmp_path)\n mv tmp_path, File.join(remote_path, template.basename)\n end\n template.delete \n }\n ret\n end",
"def index\n @my_templates = MyTemplate.all\n end",
"def substitute_template results\n content = File.read(File.join('test/report_template.html'))\n\n # Round time to seconds + 2 decimal places\n results[:time] = results[:time].round(2)\n\n results.each_key do |k|\n content.sub!(\"{{#{k.to_s}}}\", results[k].to_s)\n end\n content\n end",
"def persistUserContentToFile(dataDir)\n threadForEachUser do |account|\n #account.contentMap.keys.each do |tag|\n #userFile = @dataDir+\"other/#{account.user}.yml\"\n # if tag.match(/programming/)\n # userFile = @dataDir+\"programming/#{account.user}.yml\"\n # elsif tag.match(/travel/)\n # userFile = @dataDir+\"travel/#{account.user}.yml\"\n # end\n userFile = dataDir+\"/#{account.user}.yml\"\n # Remove user file if already present.\n File.delete(userFile) if File.exists?(userFile)\n File.open(userFile,\"a\") do |outputFile|\n puts \"Persisting content for '#{account.user}'\"\n #outputFile.puts account.contentMap[tag].to_yaml \n outputFile.puts account.contentArr.to_yaml\n end\n #end\n end\n end",
"def each_content\n @content.each do |content|\n yield content if content\n end\n end",
"def create_contents\n return if definition.fetch(:ingredients, []).any?\n\n definition.fetch(\"contents\", []).each do |attributes|\n Content.create(attributes.merge(element: self))\n end\n end",
"def templates; end",
"def templates\n GitWiki.template_cache ||= Dir[\"#{ settings.views[0] }/*.liquid\"].map do |f|\n name = File.basename(f, '.liquid')\n {\n \"name\" => name,\n \"examples\" => Page.get_template(name).examples\n }\n end\n end",
"def process\n self.read_layouts\n self.transform_pages\n if options['also_copy']\n self.transform_pages('', options['also_copy'])\n end\n self.write_posts\n end",
"def store_template_to_local_cache( template_body, ttl = self.local_cache_ttl )\n @@cache ||= {}\n \n expiration = Time.now.to_i + ttl\n Rails.logger.debug( \"Caching template locally for #{ttl.inspect} seconds; will expire at #{expiration}\" )\n @@cache[@template_name] = { :template => template_body,\n :expiration => expiration }\n\n return template_body\n end",
"def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end",
"def create\n @layout_template = LayoutTemplate.new(params[:layout_template])\n\n render :update do |page|\n if @layout_template.save\n page.insert_html :bottom, \"layout_templates\", :partial => \"layout_templates/row_form\",\n :locals =>{ :layout_template => @layout_template, :counter => (LayoutTemplate.count + 1) }\n# page.replace \"\"\n end\n end\n end",
"def set_template\n end",
"def generate template, file\n if file.kind_of? String then # one file\n write_template(file, ERB.new(load_template(template)).result(binding))\n else # multiple files\n file.each do |f|\n write_template(f, ERB.new(load_template(template)).result(binding))\n end\n end\n end",
"def get_template(template); end",
"def save_locally(dir)\n FileUtils.mkdir_p(dir) unless File.exists? dir\n \n # remove HTML BASE tag if it exists\n @contents.xpath('//base').each { |t| t.remove }\n # remove head tag\n @contents.xpath('//head').each { |t| t.remove }\n # remove link tags\n @contents.xpath('//link').each { |t| t.remove }\n # remove script tags\n @contents.xpath('//script').each { |t| t.remove }\n # remove comments\n @contents.xpath('//comment()').each { |t| t.remove }\n # remove mediawiki meta tag\n @contents.xpath('//meta').each { |t| t.remove if t['name'] == \"generator\" }\n # remove sitesub h3 tag\n @contents.xpath('//h3').each { |t| t.remove if t['id'] == \"siteSub\" }\n\n # get lastmod/viewcount values\n @contents.xpath('//li').each do |t|\n if t['id'] == \"lastmod\"\n @lastmod = t.text.strip\n end\n if t['id'] == \"viewcount\"\n @viewcount = t.text.strip\n end\n end\n\n # remove unneeded divs\n @contents.xpath('//div').each do |t|\n t.remove if t['id'] == \"column-one\"\n t.remove if t['id'] == \"footer\"\n t.remove if t['id'] == \"catlinks\"\n t.remove if t['id'] == \"contentSub\"\n t.remove if t['id'] == \"jump-to-nav\"\n t.remove if t['class'] == \"printfooter\"\n t.remove if t['class'] == \"visualClear\"\n end\n\n if @main_page == true\n save_path = File.join(dir, \"index\")\n title = 'Dublin Core Metadata Initiative Media-Wiki Archive'\n else\n save_path = File.join(dir, File.basename(uri.to_s))\n title = File.basename(uri.to_s).gsub(\"_\", \" \")\n end\n save_path += '.html' if save_path !~ /\\.((html?)|(txt))$/\n File.open(save_path, 'w') { |f| f.write(\"<!DOCTYPE html>\\n<html>\\n<head>\\n<meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=UTF-8\\\">\\n<meta http-equiv=\\\"Content-Language\\\" content=\\\"en-us\\\">\\n<title>#{title}</title>\\n</head>\\n<body>\\n<p><b>This is an archived MediaWiki page.</b><br />#{@lastmod}<br />#{@viewcount}</p>\\n#{@contents.xpath('//div[@id=\"bodyContent\"]').to_html}\\n</body>\\n</html>\") }\n # File.open(save_path, 'w') { |f| f.write(\"---\\nlayout: page\\ntitle: #{title}\\n---\\n\\n#{@contents.xpath('//div[@id=\"bodyContent\"]').to_html}\") }\n end",
"def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end",
"def set_template\n @template = Spree::Template.find(params[:id])\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # put\n end",
"def read_all template = not_meta\n matcher = Matcher.new(worker.make_template(template), self, :all => true)\n worker << matcher\n a = []\n while tuple = matcher.wait ## inefficient to wait one at a time?\n yield tuple if block_given?\n a << tuple\n end\n a\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def generate(site)\n site.data['pages'].each do |page|\n if !page['external']\n require 'cgi'\n\n page['name'] = CGI.escapeHTML(page['name']) if page['name']\n site.pages << SitePage.new(site, site.source, page)\n\n zones = {}\n keys = %w[content preferences]\n\n if page['block_instances'].length\n # create zone buckets\n page['block_instances'].each do |i|\n # go through all content\n if site.config.event?\n keys.each do |key|\n i[key].each do |k, v|\n if v.is_a?(String) && v.match(/\\{\\{/)\n # maintain the {{ t.foo }} variables\n v.gsub!(/(\\{\\{\\s*t\\.[a-z_.]+\\s*\\}\\})/, '{% raw %}\\1{% endraw %}')\n i[key][k] = Liquid::Template.parse(v).render('event' => site.data['event'], 'mappable' => site.data['mappable'])\n end\n end\n end\n end\n zones[i['zone']] = [] if zones[i['zone']].nil?\n zones[i['zone']] << i\n end\n\n # sort each bucket by widget weight\n zones.each do |k, zone|\n zone.sort! { |x, y| x['weight'] <=> y['weight'] }\n end\n\n page_source_path = File.join(site.source, page['slug'])\n FileUtils.mkdir_p(page_source_path) unless File.exists?(page_source_path)\n\n json_filename = site.config.attendease['private_site'] ? 'index-private.json' : 'index.json'\n\n File.open(File.join(page_source_path, json_filename), 'w') do |f|\n f.write zones.to_json\n f.close\n end\n\n site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']), json_filename)\n end\n end\n end\n end",
"def retrieve_placeholders\n @template = LoadTemplate.new(directory: @dir, template: 'Bond Style')\n @template.process \n @template = @template.result\n end",
"def create_template\n\n add_breadcrumb \"Download Template\"\n\n # Figure out which approach was used to access this method\n file_content_type = nil\n # From the form. This is managed via a TemplateProxy class\n if params[:template_proxy].present?\n # Inflate the proxy\n template_proxy = TemplateProxy.new(params[:template_proxy])\n Rails.logger.debug template_proxy.inspect\n\n # See if an org was set, use the default otherwise\n if template_proxy.organization_id.blank?\n org = nil\n else\n o = Organization.find(template_proxy.organization_id)\n org = Organization.get_typed_organization(o)\n end\n\n # The form defines the FileContentType which identifies the builder to use\n file_content_type = FileContentType.find(template_proxy.file_content_type_id)\n # asset_types are an array of asset types\n\n elsif params[:targets].present?\n # The request came from the audit results page. We have a list of asset\n # object keys\n file_content_type = FileContentType.find(params[:file_content_type_id])\n assets = Rails.application.config.asset_base_class_name.constantize.operational.where(:object_key => params[:targets].split(','))\n org = nil\n end\n\n is_component = params[:is_component]\n fta_asset_class_id = params[:fta_asset_class_id]\n\n # Find out which builder is used to construct the template and create an instance\n builder = file_content_type.builder_name.constantize.new(:organization => org, :asset_class_name => template_proxy.try(:asset_class_name), :asset_seed_class_id => template_proxy.try(:asset_seed_class_id), :organization_list => @organization_list, :is_component => is_component, :fta_asset_class_id => fta_asset_class_id)\n\n # Generate the spreadsheet. This returns a StringIO that has been rewound\n if params[:targets].present?\n builder.assets = assets\n end\n stream = builder.build\n\n # Save the template to a temporary file and render a success/download view\n file = Tempfile.new ['template', '.tmp'], \"#{Rails.root}/tmp\"\n ObjectSpace.undefine_finalizer(file)\n #You can uncomment this line when debugging locally to prevent Tempfile from disappearing before download.\n @filepath = file.path\n @filename = \"#{org.present? ? org.short_name.downcase : 'MultiOrg'}_#{file_content_type.class_name.underscore}_#{Date.today}.xlsx\"\n begin\n file << stream.string\n rescue => ex\n Rails.logger.warn ex\n ensure\n file.close\n end\n # Ensure you're cleaning up appropriately...something wonky happened with\n # Tempfiles not disappearing during testing\n respond_to do |format|\n format.js\n format.html\n end\n\n end",
"def hook_add_templates\n @flavor.class.after_add_templates do |templates, resource_action|\n templates.each do |template|\n actions_taken << \"#{resource_action} template #{template}\"\n end\n end\n end",
"def template_files\r\n \t[].concat(@templates)\r\n end",
"def index\n @templates = Template.all\n\n \n\n\n @templates.each do |template|\n\n if template.templateVersion.nil?\n\n logger.info \"NIL VERSION: \" + template.id.to_s\n else\n logger.info \"VERSION: \" + template.templateVersion.to_s\n end\n\n template.fields = template.getFieldsNames.join(\",\");\n\n\n end\n end",
"def load\n template_data = response_data['template']\n\n @data = response_data['data']\n @template = Template.new(\n template_data['src'], template_data['type'], template_data['key']\n )\n\n super\n end",
"def process\n self.read_layouts\n self.read_posts\n self.write_posts\n self.transform_pages\n end",
"def load\n @all = [] #contains all template objects\n\n template_dir = Gem.datadir('moo') + '/templates/'\n\n template_files = Dir.entries(template_dir).reject do |t|\n t == '.' || t == '..'\n end\n\n template_files.each do |f|\n path = template_dir + f\n @all << Template.new(path)\n end\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def each_test\n # Dup assigns because will make some changes to them\n assigns = Database.tables.dup\n\n @tests.each do |test_hash|\n # Compute page_template outside of profiler run, uninteresting to profiler\n page_template = File.basename(test_hash[:template_name], File.extname(test_hash[:template_name]))\n yield(test_hash[:liquid], test_hash[:layout], assigns, page_template, test_hash[:template_name])\n end\n end",
"def duplicate_content_template(id)\n @client.raw('post', \"/content/templates/#{id}/duplicate/\")\n end",
"def create_page\n segments = self.slug.split('/').find_all { |segment| segment != '' }\n max_segments = segments.size\n\n while segment = segments.pop do\n _options = self.page_options(slug: segment, translated: false)\n file_path = File.join(pages_path, segments, segment)\n\n # the content type option is never deleted for the first segment (the requested template)\n _options.delete(:content_type) unless segments.size == (max_segments - 1)\n\n template 'template.liquid.tt', \"#{file_path}.liquid\", _options\n\n self.other_locales.each do |locale|\n _options[:translated] = true\n template 'template.liquid.tt', \"#{file_path}.#{locale}.liquid\", _options\n end\n end\n end",
"def save_preferences\n template = Template.find(params[:id])\n authorize Template\n\n args = preference_params\n args[:customize_output_types] = params[:customize_output_types_sel] != '0'\n args[:customize_licenses] = params[:customize_licenses_sel] != '0'\n\n # Template.transaction do\n # Get the current template or a new version if applicable\n @template = get_modifiable(template)\n @template.update(template_output_types: [], licenses: [], repositories: [], metadata_standards: [])\n\n if preference_params[:customize_repositories] != '0'\n # Create custom repositories if applicable and add them to selected repos\n args[:repositories_attributes] = create_custom_repositories(\n existing: args[:repositories_attributes], custom: custom_repo_params\n )\n end\n if preference_params[:customize_metadata_standards] != '0'\n # Create custom metadata standards if applicable and add them to selected standards\n args[:metadata_standards_attributes] = create_custom_standards(\n existing: args[:metadata_standards_attributes], custom: custom_standard_params\n )\n end\n\n if @template.update(args)\n flash.now[:notice] = \"#{success_message(@template, _('saved'))} Don't forget to publish your changes.\"\n else\n flash.now[:alert] = failure_message(@template, _('save'))\n end\n\n render 'preferences', locals: {\n partial_path: 'edit',\n template: @template,\n output_types: ResearchOutput.output_types,\n preferred_licenses: License.preferred.map { |license| [license.identifier, license.id] },\n licenses: License.selectable.map { |license| [license.identifier, license.id] },\n referrer: referrer\n }\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def current_template=(t)\n @ran_templates ||= []\n @ran_templates << t unless t.nil?\n @current_template = t\n end",
"def template_content(name)\n templates.select { |t| t[:name] = name || 'index' }.first[:template]\n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end",
"def store_content(world, scenario)\n # Make sure the content directory exists.\n basedir = File.join(Dir.pwd, 'content')\n FileUtils.mkdir_p(basedir)\n\n # Store content. Note that not all drivers may support this.\n filename = File.join(basedir, base_filename(scenario))\n filename += '.txt'\n\n File.open(filename, 'w') do |file|\n file.write(world.driver.page_source)\n end\n end"
] |
[
"0.5983914",
"0.594096",
"0.58217496",
"0.5722226",
"0.56351703",
"0.56322646",
"0.56096065",
"0.5551468",
"0.5501448",
"0.547453",
"0.5463591",
"0.5455485",
"0.5446203",
"0.54287803",
"0.5423405",
"0.5396925",
"0.5387826",
"0.5386698",
"0.5323596",
"0.5321989",
"0.53176475",
"0.5317332",
"0.5284692",
"0.52706325",
"0.52688277",
"0.5258926",
"0.5244764",
"0.5243155",
"0.52408624",
"0.523339",
"0.5218605",
"0.5207726",
"0.5205791",
"0.52050793",
"0.5188141",
"0.51861566",
"0.5183941",
"0.51769185",
"0.5170489",
"0.51621413",
"0.5151649",
"0.51505566",
"0.5148812",
"0.5145874",
"0.51414925",
"0.5138775",
"0.513514",
"0.512266",
"0.511798",
"0.5115268",
"0.51126134",
"0.51098096",
"0.50966334",
"0.5088228",
"0.50840443",
"0.5082055",
"0.5080148",
"0.5077078",
"0.50622404",
"0.5056632",
"0.50531024",
"0.50490546",
"0.504405",
"0.5042949",
"0.50410014",
"0.5040196",
"0.5038804",
"0.50353926",
"0.5033829",
"0.5018017",
"0.500644",
"0.5002284",
"0.4993797",
"0.4992677",
"0.49889302",
"0.4976452",
"0.49734887",
"0.49734887",
"0.49734887",
"0.49734887",
"0.49734887",
"0.49722248",
"0.4972176",
"0.49701825",
"0.49695754",
"0.49663064",
"0.49593318",
"0.49509767",
"0.49505448",
"0.4950404",
"0.4949694",
"0.49480516",
"0.49394536",
"0.49380654",
"0.49335894",
"0.49166632",
"0.49138153",
"0.4912855",
"0.49108663",
"0.4906826"
] |
0.5115024
|
50
|
Create a single template (in new location/account). This method will be iterative over the result of save_templates. The templates created here will be blank.
|
def create_template( template_name )
puts "Creating new template #{template_name} at #{@secondary_username}..."
uri = URI(@config['endpoint'])
# Retrieve templates
http = Net::HTTP.new( uri.host,uri.port )
http.use_ssl = true
request = Net::HTTP::Post.new( uri.request_uri, initheader = {'Content-Type:' => 'application/json'} )
request.basic_auth(@secondary_username, @secondary_password)
payload = {:name => "#{template_name}"}.to_json
request.body = payload
response = http.request( request )
new_template_info = JSON.parse( response.body )
new_template_id = new_template_info['id']
return new_template_id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n authorize Template\n args = template_params\n # Swap in the appropriate visibility enum value for the checkbox value\n args[:visibility] = parse_visibility(args, current_user.org)\n\n # creates a new template with version 0 and new family_id\n @template = Template.new(args)\n @template.org_id = current_user.org.id\n @template.locale = current_org.language.abbreviation\n @template.links = if params['template-links'].present?\n ActiveSupport::JSON.decode(params['template-links'])\n else\n { funder: [], sample_plan: [] }\n end\n if @template.save\n redirect_to edit_org_admin_template_path(@template),\n notice: success_message(@template, _('created'))\n else\n flash.now[:alert] = flash.now[:alert] = failure_message(@template, _('create'))\n render :new\n end\n end",
"def create\n @template.user = current_user\n if @template.save\n handle_save_success @template, :created, t('templates.create_success')\n else\n handle_save_error @template.errors, :new\n end\n end",
"def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end",
"def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end",
"def create\n @_template = @site.templates.new(params[:template])\n @_template.created_by = @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.save\n flash[:notice] = \"Template was successfully created.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { render :xml => @_template, :status => :created, :location => @_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def create\n @template = Template.new(template_params)\n current_user.templates << @template\n\n respond_to do |format|\n if current_user.save\n Field.all.each do |field|\n t_field = TemplateField.new(val: \"\")\n t_field.field = field\n t_field.template = @template \n t_field.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_added') }\n else\n format.html { redirect_to dashboard_path, notice: @template.errors.full_messages[0]}\n end\n end\n end",
"def create\n template = Admin::Api::CMS::TemplateService::Create.call(current_account, params, cms_template_params)\n respond_with(template)\n rescue Admin::Api::CMS::TemplateService::TemplateServiceError => exception\n render_error exception.message, status: :unprocessable_entity\n end",
"def create\n @template = Template.new(template_params)\n if @template.save\n respond_ok \"template\", @template\n else\n respond_err \"template\", @template, @template.errors\n end\n end",
"def create(data)\n result = @client.api_request(:method => \"template.create\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end",
"def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render json: @template, status: :created, location: @template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_create(path, section_name, section_id, system_name, title, layout_name, type, filename, liquid)\n check_path_or_raise path\n check_section_name_or_raise section_name\n check_id_or_raise section_id\n check_title_or_raise title\n check_layout_name_or_raise layout_name\n check_template_type_or_raise type\n check_filename_or_raise filename\n\n params = { :provider_key => @provider_key,\n :type => type,\n :title => title,\n :section_name => section_name,\n :section_id => section_id,\n :layout_name => layout_name,\n :path => path,\n :liquid_enabled => liquid,\n :draft => File.read(filename),\n :multipart => true }\n\n unless type == 'page'\n check_system_name_or_raise system_name\n params[:system_name] = system_name\n end\n\n response = http_request_multipart :post, @base_url + '/templates.xml', 201, params\n\n parse_response response, type\n end",
"def create\n @user_template = UserTemplate.new(params[:user_template])\n respond_to do |format|\n if @user_template.save\n flash[:notice] = \"Template '#{@user_template.title}' was successfully created.\"\n format.html { redirect_to(user_templates_url) }\n format.xml { render :xml => @user_template, :status => :created, :location => @user_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_template.errors, :status => :unprocessable_entity }\n end\n end\n add_audit_trail(:details => \"Created a template with alias: #{@user_template.alias}\")\n end",
"def create\n @template = Template.new(template_params)\n\n if @template.save\n render :show, status: :created, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html {\n redirect_to @template,\n notice: \"Template #{@template.template_name} was successfully created.\"\n }\n format.json {\n render :show, status: :created, location: @template\n }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n restricted\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_default_templates\n UseCaseTemplate.create_default self\n end",
"def create\n authorize! :manage, :all\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: @question_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_template(name, template_class = nil, &block)\n name = name.to_s\n if @templates.key?(name)\n raise ToolDefinitionError,\n \"A template named #{name.inspect} has already been defined in tool\" \\\n \" #{display_name.inspect}.\"\n end\n @templates[name] = template_class || Template.create(&block)\n self\n end",
"def create\n begin\n @cf_template.validate_template\n rescue StandardError => ex\n flash[:alert] = ex.message\n render action: 'new' and return\n end\n\n respond_to do |format|\n if @cf_template.save\n format.html { redirect_to cf_templates_path, notice: I18n.t('cf_templates.msg.created') }\n format.json { render action: 'show', status: :created, location: @client }\n else\n format.html do\n flash.now[:alert] = @cf_template.errors[:json] if @cf_template.errors[:json]\n render action: 'new'\n end\n format.json { render json: @cf_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @templates = @firm.templates\n @template = Template.new(template_params)\n @template.user = @user\n @template.firm = @firm\n if File.extname(@template.file.file.filename) == '.docx'\n content = ''\n if @template.valid_zip?\n doc = Docx::Document.open(@template.file.path)\n doc.paragraphs.each do |p|\n if p.node.xpath('w:r//w:lastRenderedPageBreak').present?\n content = content + %q(<div class=\"-page-break\"></div>) + p.to_html\n else\n content = content + p.to_html\n end\n\n end\n @template.html_content = content\n respond_to do |format|\n if @template.save\n format.html { redirect_to template_path(@template), notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n else\n @template.errors.add(:file, 'is corrupted')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n\n @template = Template.find(params[:template_id])\n @template_parameter = @template.template_parameters.create(template_parameter_params)\n redirect_to template_path(@template)\n #@template_parameter = TemplateParameter.new(template_parameter_params)\n end",
"def create\n @template = ::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_template = MyTemplate.new(my_template_params)\n\n respond_to do |format|\n if @my_template.save\n format.html { redirect_to @my_template, notice: 'My template was successfully created.' }\n format.json { render :show, status: :created, location: @my_template }\n else\n format.html { render :new }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n Account.copy_templates(1, @account.id)\n format.html { redirect_to new_account_template_path(@account), notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n flash[:error] = @account.errors.empty? ? \"Error\" : @account.errors.full_messages.to_sentence\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_item_template(opts = {})\n data, _status_code, _headers = create_item_template_with_http_info(opts)\n return data\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @custom_template = CustomTemplate.new custom_template_params\n\n if @custom_template.save\n redirect_to @custom_template\n else\n render 'new'\n end\n end",
"def create(template_writable, opts = {})\n data, _status_code, _headers = create_template_with_http_info(template_writable, opts)\n data\n end",
"def create_default_page_template\n PageTemplate.create(:name => 'default')\n end",
"def create_question_template\n if @question_template.save\n flash[:success] = success_message(@question_template, :create)\n redirect_to survey_template_path(@survey_template)\n else\n flash[:error] = error_message(@question_template, :create)\n render :new\n end\n end",
"def create\n @request_template = RequestTemplate.new(request_template_params)\n\n respond_to do |format|\n if @request_template.save\n respond format, 'Request template was successfully created.'\n else\n format.html { render :new }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_template = ProjectTemplate.new(params[:project_template])\n\n respond_to do |format|\n if @project_template.save\n format.html { redirect_to @project_template, notice: 'Project template was successfully created.' }\n format.json { render json: @project_template, status: :created, location: @project_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @owner = owner_from_request || current_user\n @service_template = @owner.service_templates.new(service_template_params)\n\n\n if !ServiceTemplatePolicy.new(current_user, @service_template, @owner).create?\n raise Pundit::NotAuthorizedError, \"not allowed to create? this #{@service_template.inspect}\"\n end\n\n respond_to do |format|\n if @service_template.save\n audit(@service_template, \"create\", @service_template.name)\n current_user.access_resource(@service_template, :admin)\n audit(@service_template, \"grant\", @service_template.name + \" to user #{current_user.display} admin permission\")\n\n if @owner.is_a?(Group)\n @owner.access_resource(@service_template, :admin)\n audit(@service_template, \"grant\", @owner.name + \" to user #{@owenr.display} admin permission\")\n end\n\n format.html { redirect_to service_templates_path, notice: 'Service template was successfully created.' }\n format.json { render :edit, status: :created, location: @service_template }\n else\n format.html { render :new }\n format.json { render json: @service_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = EmailTemplate.new(template_params)\n respond_to do |format|\n if @template.save\n format.html { redirect_to email_templates_path, notice: 'template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_template_with_http_info(template_writable, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TemplatesApi.create_template ...'\n end\n # verify the required parameter 'template_writable' is set\n if @api_client.config.client_side_validation && template_writable.nil?\n fail ArgumentError, \"Missing the required parameter 'template_writable' when calling TemplatesApi.create_template\"\n end\n # resource path\n local_var_path = '/templates'\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 content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\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(template_writable)\n\n # return_type\n return_type = opts[:debug_return_type] || 'Template'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"TemplatesApi.create_template\",\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: TemplatesApi#create_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @timetable_template = TimetableTemplate.new(timetable_template_params)\n\n respond_to do |format|\n if @timetable_template.save\n format.html { redirect_to @timetable_template, notice: 'Timetable template was successfully created.' }\n format.json { render :show, status: :created, location: @timetable_template }\n else\n format.html { render :new }\n format.json { render json: @timetable_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(params[:template])\n\n respond_to do |format|\n if @template.save\n flash[:notice] = 'Template was successfully created.'\n format.html { redirect_to(@template) }\n format.xml { render :xml => @template, :status => :created, :location => @template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_template(create_template_input_object, opts = {})\n data, _status_code, _headers = create_template_with_http_info(create_template_input_object, opts)\n data\n end",
"def new\n authorize Template\n @template = current_org.templates.new\n # If the Org is a funder set the visibility to Public otherwise set to Organizational\n # for Orgs that are both, the admin will see controls on the page to let them choose.\n # The default is already 'organisationally_visible' so change it if this is a funder\n @template.visibility = Template.visibilities[:publicly_visible] if current_org.funder?\n end",
"def create\n @template = CustomTemplate.new(params[:custom_template])\n\t\n respond_to do |format|\n if @template.save\n\t \tCustomTemplate.create_default_outcome_columns(@template.id)\n\t\tCustomTemplate.create_default_outcome_comparison_columns(@template.id)\n\t\tCustomTemplate.create_default_design_details(@template.id)\n\t\tCustomTemplate.create_default_adverse_event_columns(@template.id)\n\t\tformat.html { redirect_to(\"/custom_templates/\" + @template.id.to_s + \"/edit\", :notice => 'CustomTemplate was successfully created.') }\n #format.xml { render :xml => @template, :status => :created, :location => @template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @page_template = PageTemplate.new(params[:page_template])\n\n respond_to do |format|\n if @page_template.save\n format.html { redirect_to @page_template, notice: 'Page template was successfully created.' }\n format.json { render json: @page_template, status: :created, location: @page_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv_template = CvTemplate.new(cv_template_params)\n respond_to do |format|\n if @cv_template.save\n current_user.cv_templates << @cv_template\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @cv_template }\n else\n format.html { render :new }\n format.json { render json: @cv_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @header_template = HeaderTemplate.new(\n header_template_params.merge account: current_tenant\n )\n\n if @header_template.save\n redirect_to @header_template\n else\n render 'new'\n end\n end",
"def create\n @post_template = PostTemplate.new(post_template_params)\n\n respond_to do |format|\n if @post_template.save\n format.html { redirect_to @post_template, notice: 'Post template was successfully created.' }\n format.json { render :show, status: :created, location: @post_template }\n else\n format.html { render :new }\n format.json { render json: @post_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @templates = EmailTemplate.find(:all) \n @email_template = EmailTemplate.new(params[:email_template])\n @page_title = t('email_templates.new.title', :email_template_name => @email_template.name) \n respond_to do |format|\n if @email_template.save\n flash[:notice] = t('email_templates.new.success', :email_template_name => @email_template.name)\n format.html { redirect_to(edit_email_template_url(@email_template)) }\n format.xml { render :xml => @email_template, :status => :created, :location => @email_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @email_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def template\n return @template if @template\n\n template = Template.new\n each_event do |event_name, event_model|\n event = TemplateEventGenerator.new(\n event_model.controlable?, event_model, plan: template\n )\n template.add(event)\n template.events_by_name[event_name] = event\n end\n\n instantiate_event_relations(template)\n @template = template\n end",
"def create\n @survey_template = @organization.survey_templates.build(survey_template_params)\n authorize @survey_template\n\n respond_to do |format|\n if @survey_template.save\n format.html { redirect_to @survey_template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @survey_template }\n else\n @record = [@organization, @survey_template]\n format.html { render :new }\n format.json { render json: @survey_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_template(*args)\n templates.add_template(*args)\n end",
"def create\n @datatemplate = @template.datatemplates.new(datatemplate_params)\n respond_to do |format|\n if @template.save\n format.html { redirect_to :back, notice: 'Data template was successfully added.' }\n else\n format.html { redirect_to :back, notice: 'Data was ocurrer an error.' }\n end\n end\n end",
"def duplicate_content_template(id)\n @client.raw('post', \"/content/templates/#{id}/duplicate/\")\n end",
"def create_course_template(course_template_data)\n # TODO: make a bridge function that allows this to be done with 4 arguments, rather than\n # just a JSON.\n # Path- root path to use for this course offering’s course content\n # if your back-end service has path enforcement set on for\n # new org units, leave this property as an empty string\n # Define a valid, empty payload and merge! with the user_data. Print it.\n payload = {\n 'Name' => '', # String\n 'Code' => 'off_SEMESTERCODE_STARNUM', # String\n 'Path' => '', # String\n 'ParentOrgUnitIds' => [99_989], # number: D2L_ID\n }.merge!(course_template_data)\n check_course_template_data_validity(payload)\n puts 'Creating Course Template:'\n ap payload\n # Define a path referencing the courses path\n # requires: CreateCourseTemplate JSON block\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/\"\n _post(path, payload)\n puts '[+] Course template creation completed successfully'.green\n # returns: CourseTemplate JSON block containing the new data.\nend",
"def create\n\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html { redirect_to @question_template, notice: 'Question template was successfully created.' }\n format.json { render :show, status: :created, location: @question_template }\n else\n format.html { render :new }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params) \n respond_to do |format|\n if @template.save \n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add\n @object = JSON.parse(File.read(\"data/templates/#{params[:identifier]}.js\"))\n @object['identifier'] = \"#{@object['identifier']}_#{current_user.id}\"\n @template = Template.create! @object\n @template.identifier = \"#{@template.id}_#{@template.identifier}\"\n @template.status = 100\n @template.count = 0\n\n current_user.templates.push @template\n respond_to do |format|\n format.html { redirect_to @template }\n end if @template.save\n end",
"def create_item_template_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreApi.create_item_template ...\"\n end\n # resource path\n local_var_path = \"/store/items/templates\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'item_template_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'StoreItemTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreApi#create_item_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item template was successfully created.' }\n format.json { render :show, status: :created, location: @item_template }\n else\n format.html { render :new }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template(*args)\n Template.new(*args)\n end",
"def create\n @form_template = FormTemplate.new(form_template_params)\n\n respond_to do |format|\n if @form_template.save\n format.html { redirect_to @form_template, notice: 'Formularvorlage wurde erfolgreich angelegt' }\n format.json { render :show, status: :created, location: @form_template }\n else\n format.html { render :new }\n format.json { render json: @form_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_template(name, *args)\n if args.size == 1 and Template===args[0]\n @templates[name] = args[0]\n else\n @templates[name] = template(*args)\n end\n end",
"def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise_template\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"def create\n @template = Template.new(template_params)\n @template.user = current_user\n\n if(@template.is_active?)\n Template.clear_all_active_flg\n end\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def scaffold_template\r\n template = Template.new(title: 'Test template',\r\n description: 'My test template', \r\n links: {\"funder\":[],\"sample_plan\":[]},\r\n org: Org.first, migrated: false, dmptemplate_id: \"0000009999\")\r\n\r\n template.phases << Phase.new(title: 'Test phase',\r\n description: 'My test phase',\r\n number: 1, template: template)\r\n\r\n template.phases.first.sections << Section.new(title: 'Test section',\r\n description: 'My test section',\r\n number: 99, phase: template.phases.first)\r\n\r\n section = template.phases.first.sections.first\r\n i = 1\r\n # Add each type of Question to the new section\r\n QuestionFormat.all.each do |frmt|\r\n question = Question.new(text: \"Test question - #{frmt.title}\", number: i,\r\n question_format: frmt, section: section)\r\n\r\n if frmt.option_based?\r\n 3.times do |j|\r\n question.question_options << QuestionOption.new(text: \"Option #{j}\", number: j, question: question)\r\n end\r\n end\r\n\r\n section.questions << question\r\n i += 1\r\n end\r\n\r\n template.save!\r\n assert template.valid?, \"unable to create new Template: #{template.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}\"\r\n @template = template.reload\r\n end",
"def create_template # rubocop:disable AbcSize\n converge_by(\"Create #{new_resource}\") do\n Chef::Log.info \"Create #{new_resource}\"\n load_balancer.client['LocalLB.Monitor'].create_template(monitor_template, common_attributes)\n\n # Reload monitor info from F5\n load_balancer.ltm.monitors.refresh_all\n\n # Reload state of current_resource\n load_current_resource\n\n new_resource.updated_by_last_action(true)\n end\n end",
"def template(template_name)\n @attributes.store(template_name)\n end",
"def create\n @template = Template.new(template_params)\n @template.templateVersion = 1\n\n\n\n if ! @template.parent.nil?\n\n # TODO: this was in case of tree now versions are linear\n @parent = Template.find(@template.parent)\n if @parent.childtemplates.nil?\n @parent.childtemplates = 1\n else\n @parent.childtemplates = @parent.childtemplates+1\n end\n @parent.save\n\n if ! @parent.templateVersion.nil?\n\n @template.templateVersion = @parent.templateVersion+1\n\n end\n\n\n end\n\n @template.creator = current_user.id\n\n logger.info \"CREATING VERSION: \" + @template.templateVersion.to_s\n\n # @template = Template.new()\n # @template.templateVersion=50\n # @template.title=\"dssdf\"\n # @template.desc=\"sdfdsf\"\n # @template.defaultemail=\"asdads\"\n # @template.fields=\"sdfsdfsdf\"\n \n \n \n\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template_task = TemplateTask.new(permitted_params_for_template_task)\n\n respond_to do |format|\n if @template_task.save\n format.html { redirect_to template_tasks_path, notice: 'TemplateTask was successfully created.' }\n format.json { render json: @template_task, status: :created, location: @template_task }\n else\n format.html { render action: 'new' }\n format.json { render json: @template_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def scaffold_template\n template = Template.new(title: 'Test template',\n description: 'My test template', \n links: {\"funder\":[],\"sample_plan\":[]},\n org: Org.first, archived: false, family_id: \"0000009999\")\n\n template.phases << Phase.new(title: 'Test phase',\n description: 'My test phase',\n number: 1, template: template)\n\n template.phases.first.sections << Section.new(title: 'Test section',\n description: 'My test section',\n number: 99, phase: template.phases.first)\n\n section = template.phases.first.sections.first\n i = 1\n # Add each type of Question to the new section\n QuestionFormat.all.each do |frmt|\n question = Question.new(text: \"Test question - #{frmt.title}\", number: i,\n question_format: frmt, section: section)\n\n if frmt.option_based?\n 3.times do |j|\n question.question_options << QuestionOption.new(text: \"Option #{j}\", number: j, question: question)\n end\n end\n\n section.questions << question\n i += 1\n end\n\n template.save!\n assert template.valid?, \"unable to create new Template: #{template.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}\"\n @template = template.reload\n end",
"def create name, template_group\n raise ArgumentError, \"Fleet #{name} already exists\" if @resource.fleet(name).exists?\n raise ArgumentError, \"Group is already in a fleet\" if template_group.fleet\n\n template_group.set_fleet(name, \"template\")\n @resource.fleet(name)\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @email_template = EmailTemplate.new(params[:email_template])\n\n respond_to do |format|\n if @email_template.save\n format.html { redirect_to email_templates_path, notice: 'Email template was successfully created.' }\n format.json { render json: @email_template, status: :created, location: @email_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bulk_message_template = BulkMessageTemplate.new(params[:bulk_message_template])\n\n respond_to do |format|\n if @bulk_message_template.save\n format.html { redirect_to @bulk_message_template, notice: 'Bulk message template was successfully created.' }\n format.json { render json: @bulk_message_template, status: :created, location: @bulk_message_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bulk_message_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey_item_template = SurveyItemTemplate.new(survey_item_template_params)\n\n respond_to do |format|\n if @survey_item_template.save\n format.html { redirect_to @survey_item_template.survey_item_category_template.survey_template, notice: 'Survey item template was successfully created.' }\n format.json { render :show, status: :created, location: @survey_item_template }\n else\n format.html { render :new }\n format.json { render json: @survey_item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_and_send\n @cf_template.user_id = current_user.id\n\n res = send_cloudformation_template(@cf_template, params[:cf_template][:cfparams])\n\n if res[:status]\n render plain: res[:message] and return\n end\n render plain: res[:message], status: :internal_server_error\n end",
"def create\n @track_template = TrackTemplate.new(track_template_params)\n\n respond_to do |format|\n if @track_template.save\n format.html { redirect_to @track_template, notice: 'Track template was successfully created.' }\n format.json { render :show, status: :created, location: @track_template }\n else\n format.html { render :new }\n format.json { render json: @track_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_template\n\n add_breadcrumb \"Download Template\"\n\n # Figure out which approach was used to access this method\n file_content_type = nil\n # From the form. This is managed via a TemplateProxy class\n if params[:template_proxy].present?\n # Inflate the proxy\n template_proxy = TemplateProxy.new(params[:template_proxy])\n Rails.logger.debug template_proxy.inspect\n\n # See if an org was set, use the default otherwise\n if template_proxy.organization_id.blank?\n org = nil\n else\n o = Organization.find(template_proxy.organization_id)\n org = Organization.get_typed_organization(o)\n end\n\n # The form defines the FileContentType which identifies the builder to use\n file_content_type = FileContentType.find(template_proxy.file_content_type_id)\n # asset_types are an array of asset types\n\n elsif params[:targets].present?\n # The request came from the audit results page. We have a list of asset\n # object keys\n file_content_type = FileContentType.find(params[:file_content_type_id])\n assets = Rails.application.config.asset_base_class_name.constantize.operational.where(:object_key => params[:targets].split(','))\n org = nil\n end\n\n is_component = params[:is_component]\n fta_asset_class_id = params[:fta_asset_class_id]\n\n # Find out which builder is used to construct the template and create an instance\n builder = file_content_type.builder_name.constantize.new(:organization => org, :asset_class_name => template_proxy.try(:asset_class_name), :asset_seed_class_id => template_proxy.try(:asset_seed_class_id), :organization_list => @organization_list, :is_component => is_component, :fta_asset_class_id => fta_asset_class_id)\n\n # Generate the spreadsheet. This returns a StringIO that has been rewound\n if params[:targets].present?\n builder.assets = assets\n end\n stream = builder.build\n\n # Save the template to a temporary file and render a success/download view\n file = Tempfile.new ['template', '.tmp'], \"#{Rails.root}/tmp\"\n ObjectSpace.undefine_finalizer(file)\n #You can uncomment this line when debugging locally to prevent Tempfile from disappearing before download.\n @filepath = file.path\n @filename = \"#{org.present? ? org.short_name.downcase : 'MultiOrg'}_#{file_content_type.class_name.underscore}_#{Date.today}.xlsx\"\n begin\n file << stream.string\n rescue => ex\n Rails.logger.warn ex\n ensure\n file.close\n end\n # Ensure you're cleaning up appropriately...something wonky happened with\n # Tempfiles not disappearing during testing\n respond_to do |format|\n format.js\n format.html\n end\n\n end",
"def create\n @invoice_template = InvoiceTemplate.new(params[:invoice_template])\n\n respond_to do |format|\n if @invoice_template.save\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully created.' }\n format.json { render json: @invoice_template, status: :created, location: @invoice_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @user = current_user\n if params[:order_id]\n order = Order.find(params[:order_id])\n order.line_items.each do |item|\n product = Product.find(item.product_id)\n #@template = @user.templates.build(:product => product)\n @template = @user.add_product(product.id)\n if !@template.save\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n elsif params[:product_id]\n product = Product.find(params[:product_id])\n @template = @user.templates.build(:product => product)\n #@user.add_product(product.id)#Template.new(params[:template])\n if !@template.save\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n respond_to do |format|\n #if @template.save\n format.html { redirect_to(:back, :notice => 'Шаблоны добавлены') }#redirect_to(@template\n format.xml { render :xml => @template, :status => :created, :location => @template }\n #else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n #end\n end\n end",
"def get_template(name, options)\n t_hash = nil\n if !options[:template_name].nil? || !options[:template_id].nil?\n t_hash = template_from_one(options)\n elsif !options[:template_file].nil?\n t_hash = template_from_file(options)\n elsif !options[:template].nil?\n t_hash = template_from_hash(options)\n else\n fail \"To create a VM you must specify one of ':template', \" \\\n \"':template_id', or ':template_name' option \" \\\n \"in ':bootstrap_options'\"\n end\n fail \"Inavlid VM template : #{t_hash}\" if t_hash.nil? || t_hash.empty?\n tpl_updates = options[:template_options] || {}\n if options[:user_variables]\n Chef::Log.warn(\"':user_variables' will be deprecated in next \" \\\n \"version in favour of ':template_options'\")\n recursive_merge(tpl_updates, options[:user_variables])\n end\n recursive_merge(t_hash, tpl_updates) unless tpl_updates.empty?\n if options[:enforce_chef_fqdn]\n Chef::Log.warn(':enforce_chef_fqdn has been deprecated. VM name ' \\\n 'will be set to the machine resource name.')\n end\n # FQDN is the machine resource name, unless overridden by e.g. cloud-init\n t_hash['NAME'] = name\n unless t_hash['CONTEXT']['SSH_PUBLIC_KEY']\n t_hash['CONTEXT']['SSH_PUBLIC_KEY'] = \"$USER[SSH_PUBLIC_KEY]\"\n end\n tpl = create_template(t_hash)\n Chef::Log.debug(tpl)\n tpl\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def create\n issue_template = IssueTemplate.new(issue_template_params)\n\n respond_to do |format|\n if issue_template.save\n format.html { redirect_to issue_templates_path, notice: 'Issue template was successfully created.' }\n else\n format.html { redirect_to issue_templates_path, alert: issue_template.errors }\n end\n end\n end",
"def purchase_template(template_id)\n return false unless can_purchase_templates?\n\n # Copy data from Template\n template = GspTemplate.find(template_id)\n OrganizationTemplate.create :agency => template.agency, :description => template.description,\n :display_name => template.display_name, :frequency => template.frequency,\n :full_name => template.full_name, :objectives => template.objectives,\n :regulatory_review_name => template.regulatory_review_name,\n :purchased_by => self, :organization => self.organization,\n :tasks => template.tasks\n end",
"def create\n @layout_template = LayoutTemplate.new(params[:layout_template])\n\n render :update do |page|\n if @layout_template.save\n page.insert_html :bottom, \"layout_templates\", :partial => \"layout_templates/row_form\",\n :locals =>{ :layout_template => @layout_template, :counter => (LayoutTemplate.count + 1) }\n# page.replace \"\"\n end\n end\n end",
"def create_host_template attrs={}\n ZerigoDNS::HostTemplate.create(attrs.merge(zone_template_id: id))\n end",
"def set_template\n tid = Integer(params[:id]) rescue nil\n if tid\n @template = Template.find_by_id(tid)\n else\n @template = Template.find_by_name(params[:id])\n end\n respond_err \"template\", @templates, \"i18> Template #{params[:id]} not found\" unless @template\n end",
"def create\n @questionnaire_template = QuestionnaireTemplate.new(questionnaire_template_params)\n\n respond_to do |format|\n if @questionnaire_template.save\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire_template }\n else\n format.html { render :new }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_permission_template!(source_id:)\n Hyrax::PermissionTemplate.create!(source_id: source_id)\n end",
"def create_template(erb, dest)\n template(erb, File.join(target_dir, dest), config)\n end",
"def template(template_name)\n\t\t@templates ||= {}\n\n\t\tif !@templates.has_key?(template_name)\n\t\t\ttemplate_file = template_name + \".erb\"\n\t\t\ttemplate_path = File.join(__dir__, \"templates\", template_file)\n\t\t\traise(ArgumentError, \"Attempting to find template #{template_file}, which does not exist.\") unless File.exists?(template_path)\n\n\t\t\t@templates[template_name] = File.read(template_path)\n\t\tend\n\t\t@templates[template_name]\n\tend",
"def create\n @event_template = EventTemplate.new(event_template_params)\n\n respond_to do |format|\n if @event_template.save\n format.html { redirect_to @event_template, notice: \"Event template was successfully created.\" }\n format.json { render :show, status: :created, location: @event_template }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @region = RegionTemplate.new(params[:region_template])\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to(@region, :notice => 'Region was successfully created.') }\n format.xml { render :xml => @region, :status => :created, :location => @region }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @region.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @correspondence_template = CorrespondenceTemplate.new(params[:correspondence_template])\n\n @correspondence_template.department_id = current_user.department_id\n\n respond_to do |format|\n if @correspondence_template.save\n flash[:notice] = 'Correspondence Template was successfully created.'\n format.html { redirect_to(@correspondence_template) }\n format.xml { render :xml => @correspondence_template, :status => :created, :location => @correspondence_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @correspondence_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end",
"def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end",
"def create\n @view_template = ViewTemplate.new(params[:view_template])\n\n respond_to do |format|\n if @view_template.save\n format.html { redirect_to(@view_template, :notice => 'View template was successfully created.') }\n format.xml { render :xml => @view_template, :status => :created, :location => @view_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @view_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def template_resource\n @template_resource ||= template new_resource.path do\n source new_resource.source\n cookbook new_resource.cookbook\n owner 'root'\n group 'root'\n mode 00644\n variables name: new_resource.name,\n priority: new_resource.priority,\n extensions: new_resource.extensions,\n directives: new_resource.directives\n action :nothing\n end\n end",
"def create_campaign_template(opts = {})\n data, _status_code, _headers = create_campaign_template_with_http_info(opts)\n return data\n end"
] |
[
"0.73595446",
"0.7247145",
"0.71185",
"0.69296783",
"0.68861276",
"0.6782731",
"0.6688092",
"0.6598686",
"0.65560687",
"0.64464146",
"0.64348936",
"0.64022124",
"0.63150847",
"0.62699467",
"0.6267875",
"0.6226521",
"0.61884165",
"0.61726815",
"0.6120168",
"0.6080297",
"0.60764545",
"0.6072904",
"0.60725397",
"0.60338336",
"0.60228556",
"0.60107976",
"0.59918046",
"0.5983591",
"0.5968479",
"0.5962674",
"0.59358287",
"0.5935741",
"0.5935213",
"0.59164786",
"0.5907409",
"0.5894001",
"0.58871835",
"0.58825934",
"0.58754957",
"0.5875439",
"0.5849447",
"0.5841454",
"0.58142525",
"0.5779524",
"0.5771852",
"0.576671",
"0.5760587",
"0.5758057",
"0.5751681",
"0.5734085",
"0.57131445",
"0.57019097",
"0.5701578",
"0.56943923",
"0.56918454",
"0.56907064",
"0.56840295",
"0.5674232",
"0.56739676",
"0.5664625",
"0.5646864",
"0.5645089",
"0.562672",
"0.56162894",
"0.56054467",
"0.56017566",
"0.55980694",
"0.5595566",
"0.55939305",
"0.558737",
"0.558615",
"0.5585789",
"0.5584376",
"0.5554859",
"0.55502474",
"0.552676",
"0.55254865",
"0.5522872",
"0.5522517",
"0.5509787",
"0.55088353",
"0.5505913",
"0.5502291",
"0.54965204",
"0.54812855",
"0.54670316",
"0.54656374",
"0.54648334",
"0.5461179",
"0.5458407",
"0.5450934",
"0.54486984",
"0.54444736",
"0.5439484",
"0.54376394",
"0.54363406",
"0.54363406",
"0.5432197",
"0.54298526",
"0.5426596"
] |
0.67197317
|
6
|
Popuate the newy created templates with the content received from save_templates. Each file will be read in iteratively, and content matched to correct template.
|
def populate_template( template_id, imported_template )
puts "Populating new tempalte id: #{template_id}..."
uri = URI(@config['endpoint']+"/#{template_id}/versions")
# Retrieve templates
http = Net::HTTP.new( uri.host,uri.port )
http.use_ssl = true
request = Net::HTTP::Post.new( uri.request_uri, initheader = {'Content-Type:' => 'application/json'} )
request.basic_auth(@secondary_username, @secondary_password)
# If versions exist, transfer each to new template
imported_template['versions'].each do |version|
version.delete("id")
version.delete("user_id")
version.delete("template_id")
version.delete("updated_at")
puts " Adding template version #{version['name']}..."
payload = version.to_json
request.body = payload
response = http.request( request )
response_message = JSON.parse( response.body )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def templates_for(file); end",
"def generate(page_setup = {})\n Zip::File.open(@template_path) do |template_zip|\n buffer = Zip::OutputStream.write_buffer do |out|\n template_zip.each do |entry|\n out.put_next_entry entry.name\n if @replaceable_files[entry.name] && entry.name == Document.doc_xml_file\n source = entry.get_input_stream.read\n # the source has only 1 sectPr and we change the doc dimensions based on the page setup\n source = replace_dimensions(source, page_setup)\n # Change only the body of document. TODO: Improve this...\n source = source.sub(/(<w:body>)((.|\\n)*?)(<w:sectPr)/, \"\\\\1#{@replaceable_files[entry.name]}\\\\4\")\n out.write(source)\n elsif @replaceable_files[entry.name] && entry.name == Document.header_xml_file\n source = entry.get_input_stream.read\n # Change only the body of document. TODO: Improve this...\n\n Rails.logger.info(\"header before:#{source}\")\n source = source.sub(/<w:tbl>.*<\\/w:tbl>/, \"#{@replaceable_files[entry.name]}\")\n Rails.logger.info(\"header after:#{source}\")\n\n out.write(source)\n # elsif @replaceable_files[entry.name] && entry.name == Document.footer_xml_file\n # source = entry.get_input_stream.read\n # Change only the body of document. TODO: Improve this...\n # Rails.logger.info(\"footer before:#{source}\")\n # source = source.sub(/<w:tbl>.*<\\/w:tbl>/, \"#{@replaceable_files[entry.name]}\")\n # Rails.logger.info(\"footer after:#{source}\")\n # out.write(source)\n\n elsif @replaceable_files[entry.name]\n out.write(@replaceable_files[entry.name])\n Rails.logger.info(\"footer: #{entry.get_input_stream.read}\") if entry.name == Document.footer_xml_file\n elsif entry.name == Document.content_types_xml_file\n raw_file = entry.get_input_stream.read\n content_types = @image_files.empty? ? raw_file : inject_image_content_types(raw_file)\n\n out.write(content_types)\n else\n out.write(template_zip.read(entry.name))\n end\n end\n unless @image_files.empty?\n #stream the image files into the media folder using open-uri\n @image_files.each do |hash|\n out.put_next_entry(\"word/media/#{hash[:filename]}\")\n URI.open(hash[:url], 'rb') do |f|\n out.write(f.read)\n end\n end\n end\n # add the header rels as its not already in the template docx\n out.put_next_entry(Document.header_relations_xml_file)\n out.write(@replaceable_files[Document.header_relations_xml_file])\n # add the footer rels as its not already in the template docx\n out.put_next_entry(Document.footer_relations_xml_file)\n out.write(@replaceable_files[Document.footer_relations_xml_file])\n\n # test creating for the blank header and footer to see if it fixes the error on open\n #\n # out.put_next_entry('word/_rels/header2.xml.rels')\n # out.write(@replaceable_files[Document.header_relations_xml_file])\n # add the footer rels as its not already in the template docx\n # out.put_next_entry('word/_rels/footer2.xml.rels')\n # out.write(@replaceable_files[Document.footer_relations_xml_file])\n\n end\n buffer.string\n end\n end",
"def generate\n Zip::File.open(@template_path) do |template_zip|\n buffer = Zip::OutputStream.write_buffer do |out|\n template_zip.each do |entry|\n out.put_next_entry entry.name\n if @replaceable_files[entry.name]\n source = entry.get_input_stream.read.sub(/(<w:body>)(.*?)(<w:sectPr)/, \"\\\\1#{@replaceable_files[entry.name]}\\\\3\")\n out.write(source)\n else\n out.write(template_zip.read(entry.name))\n end\n end\n end\n buffer.string\n end\n end",
"def expand_template_files\n rails_host = config['bind-address'] || `hostname`.chomp\n rails_port = config['port-number'].to_s\n rails_url = \"http://#{rails_host}:#{rails_port}\"\n Dir[File.join(install_directory,'installer','*.template')].each do |template_file|\n output_file = template_file.gsub(/\\.template/,'')\n next if File.exists?(output_file) # don't overwrite files\n\n message \"expanding #{File.basename(output_file)} template\"\n \n text = File.read(template_file).gsub(/\\$RAILS_URL/,rails_url).gsub(/\\$RAILS_HOST/,rails_host).gsub(/\\$RAILS_PORT/,rails_port)\n \n File.open(output_file,'w') do |f|\n f.write text\n end\n end\n end",
"def parse_template_files(file_paths)\n require \"tempfile\"\n\n file_paths.each do |file_path|\n remote_path = File.join(latest_release, file_path)\n\n remote_template_paths = []\n\n # If a file was given, see if a template file exists.\n begin\n remote_template_paths += capture(\"ls -1 #{remote_path}.erb\").to_s.split\n rescue Capistrano::CommandError\n end\n\n # If a path was given, see recursively check for any templates.\n begin\n remote_template_paths += capture(\"find #{remote_path} -name '*.erb'\").to_s.split\n rescue Capistrano::CommandError\n end\n\n remote_template_paths.each do |remote_template_path|\n # Download the template path from the server. We want to grab the copy from\n # the server, and not the local copy, since they may differ (If I'm doing\n # a deploy and I haven't done an svn update or I'm deploying a specific\n # branch while sitting in another branch locally).\n Tempfile.open(\"capistrano-template\") do |temp_file|\n get(remote_template_path, temp_file.path)\n\n # Parse the template file as a Ruby file so we can evaluate\n # variables.\n content = File.read(temp_file.path)\n parsed_content = Erubis::Eruby.new(content).result(binding)\n\n logger.info(\"Parsed template file:\\n\\n\")\n puts parsed_content\n logger.info(\"\\n\")\n\n install_remote_path = remote_template_path.gsub(/\\.erb$/, \"\")\n\n # Write the evaluated configuration file to the server as the real\n # configuration file.\n put(parsed_content, install_remote_path)\n end\n end\n end\nend",
"def each_template(markup)\n @templates.each do |dest,file|\n if (formatted_like?(dest,markup) || !formatted?(dest))\n yield dest, file\n end\n end\n end",
"def update_files(&block)\n \n get_template_entries.each do |entry|\n \n next if entry.directory?\n \n entry.get_input_stream do |is|\n \n data = is.sysread\n \n if CONTENT_FILES.include?(entry.name)\n process_entry(data, &block)\n end\n \n @output_stream.put_next_entry(entry.name)\n @output_stream.write data\n \n end\n end\n end",
"def templates() = templates_path.glob('**/*.erb')",
"def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end",
"def load_templates\n templates = {}\n file = __FILE__\n\n begin\n io = ::IO.respond_to?(:binread) ? ::IO.binread(file) : ::IO.read(file)\n app, data = io.gsub(\"\\r\\n\", \"\\n\").split(/^__END__$/, 2)\n rescue Errno::ENOENT\n app, data = nil\n end\n\n if data\n lines = app.count(\"\\n\") + 1\n template = nil\n data.each_line do |line|\n lines += 1\n if line =~ /^@@\\s*(.*\\S)\\s*$/\n template = ''\n templates[$1.to_sym] = template\n elsif template\n template << line\n end\n end\n end\n\n templates\nend",
"def save\n Tempfile.open([file_name, FILE_EXTENSION], type: 'application/zip') do |output_file|\n Zip::File.open(@template_path) do |template_zip|\n Zip::OutputStream.open(output_file.path) do |out|\n template_zip.each do |entry|\n out.put_next_entry entry.name\n if @replaceable_files[entry.name]\n out.write(@replaceable_files[entry.name])\n else\n out.write(template_zip.read(entry.name))\n end\n end\n end\n end\n output_file\n end\n end",
"def load\n @all = [] #contains all template objects\n\n template_dir = Gem.datadir('moo') + '/templates/'\n\n template_files = Dir.entries(template_dir).reject do |t|\n t == '.' || t == '..'\n end\n\n template_files.each do |f|\n path = template_dir + f\n @all << Template.new(path)\n end\n end",
"def templates\n # Some cheap memoiziation\n @templates ||= begin\n files = Dir.glob(template_glob)\n # Check to see what mode we are in, that'll define how we parse the file names\n if Gluttonberg.localized? or Gluttonberg.translated?\n # Figure out what regex we need\n matcher, mode = if Gluttonberg.localized?\n [/\\/#{filename}.(\\w+).([a-z-]+).(\\w+).(erb|mab|haml)/, :localized]\n elsif Gluttonberg.translated?\n [/\\/#{filename}.([a-z-]+).(\\w+).(erb|mab|haml)/, :translated]\n end\n files.inject({}) do |memo, file|\n match = file.match(matcher)\n extract_template_details(memo, mode, match) if match\n memo\n end\n else\n # For the non-localized/dialect mode, just collect the various formats\n files.inject([]) do |memo, file|\n match = file.match(/#{filename}.(\\w+).(erb|mab|haml)/)\n memo << match[1] if match\n memo\n end\n end\n end\n end",
"def template_upload(*paths)\n remote_path = paths.pop\n templates = []\n paths.collect! do |path| \n if StringIO === path\n path.rewind\n template = Rye::Tpl.new(path.read, \"inline-template\")\n elsif String === path\n raise \"No such file: #{Dir.pwd}/#{path}\" unless File.exists?(path)\n template = Rye::Tpl.new(File.read(path), File.basename(path))\n end\n template.result!(binding)\n templates << template\n template.path\n end\n paths << remote_path\n ret = self.file_upload *paths\n templates.each { |template| \n tmp_path = File.join(remote_path, File.basename(template.path))\n if file_exists?(tmp_path)\n mv tmp_path, File.join(remote_path, template.basename)\n end\n template.delete \n }\n ret\n end",
"def build_template_file_records(template_files)\n template_files.to_a.map do |(filename, content)|\n Course::Assessment::Question::ProgrammingTemplateFile.new(filename: filename.to_s,\n content: content)\n end\n end",
"def scan_user_templates\n if @@user_template_dir\n @@template_names = {greedy: [], nongreedy: [], independent: []}\n Dir.glob(File.join @@user_template_dir, \"*.haml\") do |filename|\n name = File.basename filename, \".haml\"\n params, template = load name, true\n greediness = params[\"greedy\"] ? :greedy : :nongreedy\n @@template_names[greediness] << name\n @@template_names[:independent] << name if params[\"independent\"]\n end\n end\n end",
"def scan_templates\r\n @templates = Dir.glob(File.join(path, \"*\")).inject([]) do |list, file_path|\r\n log.debug \"Checking if #{file_path} is a recognised template file.\"\r\n if File.file?(file_path)\r\n file_name = File.basename(file_path)\r\n log.debug \"#{file_path} is a template file.\" if !(Tilt[file_name]).nil?\r\n list << file_path if !(Tilt[file_name]).nil?\r\n end\r\n list\r\n end\r\n end",
"def write_meta_files\r\n @files.each do |file|\r\n template = ERB.new(\r\n File.new(File.join(@dirs[:templates],file[:template])).read,\r\n nil, \"%\")\r\n output_file = File.new(file[:path], \"w+\")\r\n output_file.write(template.result(binding))\r\n output_file.close\r\n end\r\n end",
"def template_for(file); end",
"def template_files\r\n \t[].concat(@templates)\r\n end",
"def templates\n @templates ||= TemplateFinder.new(path, types)\n end",
"def each_template\n if @processed.nil?\n @processed, @rest = templates.keys.partition { |k| k.to_s.include? \".\" }\n end\n\n @processed.each do |k|\n yield k, templates[k]\n end\n\n @rest.each do |k|\n yield k, templates[k]\n end\n end",
"def restore_templates\n FileUtils.rm_rf @current_templates if File.exist? @current_templates\n\n if File.exist? @old_templates\n FileUtils.mv(\n @old_templates,\n @current_templates\n )\n end\n end",
"def load_template(filename)\n\t\t\t@filename = filename\n\t\t\t@contents = []\n\t\t\t#@valid_keys = []\n\t\t\t#@dirty_mappings = {}\n\t\t\t#@replacements = {}\n\t\t\ti=0\n\t\t\n\t\t\t#If the file name is invalid, exit prematurely\n\t\t\tif filename == nil || filename == \"\" then\n\t\t\t\tputs \"Invalid filename provided.\"\n\t\t\t\treturn 0\n\t\t\tend\n\t\t\n\t\t\tbegin\n\t\t\t\tif File.exists? filename then\n\t\t\t\t\tputs \"Loading Template: \" + filename\n\t\t\t\t\tfile = File.open(filename, \"r\").each_line do |line|\n\t\t\t\t\t\t@contents.push line\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t@section_tree = SectionTree.new @contents\n\t\t\t\n\t\t\t\t#size = line_count\n\t\t\t\n\t\t\t\t#Iterates over each line, remembering the line number\n\t\t\t\t#for i in 0..size-1\n\t\t\t\t\t#Extracts the keys from each line\n\t\t\t\t\t#matchdata = get_line_matchdata i\n\t\t\t\t\t#if !matchdata.nil? then\n\t\t\t\t\t\t#Accounts for all keys found in the template file\n\t\t\t\t\t\n\t\t\t\t\t\t#keys = matchdata.captures\n\t\t\t\t\t\t#if !keys.nil? && keys.size > 0 then\n\t\t\t\t\t\t\t#keys.each do |key|\n\t\t\t\t\t\t\t\t#@valid_keys.push(key.strip)\n\t\t\t\t\t\t\t\t#@dirty_mappings[matchdata.to_s] = key.strip\n\t\t\t\t\t\t\t\t#@replacements[key.strip] = matchdata.to_s\n\t\t\t\t\t\t\t#end\n\t\t\t\t\t\t#end\n\t\t\t\t\t#end\n\t\t\t\t#end\n\t\t\tensure\n\t\t\t\tputs \"Closing Template File: \" + filename\n\t\t\t\tfile.close unless file.nil?\n\t\t\tend\n\t\t\n\t\t\tputs ''\n\t\tend",
"def process\n return @template if @template\n\n out = StringIO.new\n err = StringIO.new\n\n files = Dir.glob(File.join(@path, '*.{yml,yaml}'))\n cfoo = Cfoo::Factory.new(out, err).cfoo\n\n Dir.chdir('/') do\n cfoo.process(*files)\n end\n\n raise(TemplateYamlParseError, err.string) unless err.string.empty?\n\n @template = out.string\n @template\n end",
"def generate template, file\n if file.kind_of? String then # one file\n write_template(file, ERB.new(load_template(template)).result(binding))\n else # multiple files\n file.each do |f|\n write_template(f, ERB.new(load_template(template)).result(binding))\n end\n end\n end",
"def copy_template_files_to(answer)\n template_files.each do |template_file|\n template_file.copy_template_to(answer)\n end\n end",
"def load_template!\n feed = self\n eval(File.read(@file))\n end",
"def generate(save = false)\n # Code to export into the manifest cache\n export = \"Sereth::TemplateManager::Manifest.register(:raw)\"\n\n Dir.glob(\"app/template/raw/**\") do |file| \n template = Parser.read(file)\n template.raw = file\n\n if save\n # Store the parsed template to server throuch a controller\n template.cache = \"app/template/cache/#{template.name}\"\n File.open(template.cache) do |cached_template|\n cached_template.print(template.code)\n end\n\n # Store the template metadata for serving cached data in production\n File.open(\"app/template/manifest.rb\", \"w\") do |manifest| \n manifest.puts(export % {raw: template.metadata})\n end\n end\n end\n end",
"def template_files\n generator_job_templates_path = File.join(self.class.source_root, \"jobs/%job_name%_#{purpose}\")\n directory \"jobs/%job_name%_#{purpose}\", \"jobs/#{job_name}\"\n\n # build a hash of { 'bin/webapp_ctl.erb' => 'bin/webapp_ctl', ...} used in spec\n @template_files = {}\n FileUtils.chdir(File.join(generator_job_templates_path, \"templates\")) do\n `ls */*`.split(\"\\n\").each do |template_file|\n # clean up thor name convention\n template_file.gsub!(\"%job_name%\", job_name)\n template_file.gsub!(\".tt\", \"\")\n # strip erb from target file\n target_template_file = template_file.gsub(/.erb/, '')\n\n @template_files[template_file] = target_template_file\n end\n end\n end",
"def render_and_write_templates\n clean_build_dir()\n\n yard_file_hash = {}\n\n Dir.glob(\"#{Dir.pwd}/projects/*\").select { |f| File.directory? f }.each do|project_dir|\n yard_file = \"#{project_dir}/yard.yaml\"\n\n unless yard_file.empty?\n yard = YAML::load_file(yard_file)\n next if yard['disabled']\n\n apps = yard['apps']\n project_name = yard['project']['name']\n project_pipelines = yard['pipelines']\n\n Dir.mkdir \"#{BUILD_DIR}/#{project_name}\"\n puts project_name\n\n apps.each do |app_name, app_config|\n Dir.mkdir(\"#{BUILD_DIR}/#{project_name}/#{app_name}/\")\n app_pipelines = Hash.new({})\n\n project_pipelines.each do |pipeline|\n app_pipelines[pipeline['name']] = app_pipelines[pipeline['name']].merge(pipeline)\n end\n\n unless app_config.nil? || app_config['pipelines'].nil?\n app_config['pipelines'].each do |pipeline|\n app_pipelines[pipeline['name']] = app_pipelines[pipeline['name']].merge(pipeline)\n end\n end\n\n # puts app_pipelines\n\n base_files = Dir[\"#{Dir.pwd}/base/*\"]\n project_base_files = Dir[\"#{project_dir}/base/*\"]\n app_files = Dir[\"#{project_dir}/#{app_name}/*\"]\n\n app_pipelines.each do|pipeline_name, pipeline_config|\n template_name = pipeline_config['templateName'] ? pipeline_config['templateName'] : \"#{pipeline_name}.json\"\n\n app_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n project_base_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n\n base_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n end\n end\n end\n end\n end",
"def compile_templates\n dir = File.join(Frank.root, Frank.dynamic_folder)\n\n Dir[File.join(dir, '**{,/*/**}/*')].each do |path|\n if File.file?(path) && !File.basename(path).match(/^(\\.|_)/)\n path = path[ (dir.size + 1)..-1 ]\n ext = File.extname(path)\n new_ext = ext_from_handler(ext)\n name = File.basename(path, ext)\n\n # No suitable handler found\n if not new_ext.is_a? String\n next\n end\n\n if Frank.production? && \"#{name}.#{new_ext}\" != 'index.html' && new_ext == 'html'\n new_file = File.join(Frank.export.path, path.sub(/(\\/?[\\w-]+)\\.[\\w-]+$/, \"\\\\1/index.#{new_ext}\"))\n else\n new_file = File.join(Frank.export.path, path.sub(/\\.[\\w-]+$/, \".#{new_ext}\"))\n end\n\n create_dirs(new_file)\n File.open(new_file, 'w') {|f| f.write render(path) }\n puts \" - \\033[32mCreating\\033[0m '#{new_file}'\" unless Frank.silent_export?\n end\n end\n end",
"def generate_ansible_files\n \n # Helper to decide whether or not to generate/update a given file\n update = Proc.new do |fn, mtime|\n !(File.exists?(fn) && File.stat(fn).mtime >= mtime)\n true\n end\n\n Dir.glob('./templates/ansible.*').each do |template|\n\n # Get a template's last modified date\n source_mtime = File.stat(template).mtime \n\n # Get a destination's potential file name & path \n target_file = File.basename(template).split('.').slice(1...-1).join('.') \n target_paths = target_file.start_with?('inventory') ? ['inventory/'] : ['', 'plays/*/']\n\n # Walk destination path(s)\n target_paths.each do |target_path|\n \n Dir.glob(\"./ansible/#{target_path}\").each do |path|\n\n # Build a potential real path\n fn = File.join(File.expand_path(path), target_file) \n\n # Yield source (template file) & target if the target needs to be generated/updated\n yield template, fn if update.call(fn, source_mtime) && block_given?\n end\n end\n end\nend",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def non_autograded_template_files=(template_files)\n self.template_files.clear\n self.template_files = template_files\n test_cases.clear\n end",
"def templates\n GitWiki.template_cache ||= Dir[\"#{ settings.views[0] }/*.liquid\"].map do |f|\n name = File.basename(f, '.liquid')\n {\n \"name\" => name,\n \"examples\" => Page.get_template(name).examples\n }\n end\n end",
"def process_template(template_path)\n if @processed_templates[template_path]\n return @processed_templates[template_path]\n end\n\n unprocessed_template = read_template(template_path)\n @processed_templates[template_path] = unprocessed_template.gsub(/{{[^{}()\\[\\]]+}}/) do |to_replace|\n replacement_path = to_replace.gsub(/[{}]/, '')\n process_template(replacement_path)\n end.strip\n end",
"def render_yaml_templates(templates_yaml)\n log(\"Rendering YAML Templates\")\n templates = Dir[templates_yaml]\n # Render each yaml template out to a yaml file\n templates.each do | template |\n log(\"Rendering YAML template: #{template}\")\n file_name = template.split('/').last.split('.erb')[0]\n\n template \"#{node['jmxtrans']['config_dir']}/yaml/#{file_name}\" do\n source template\n owner node['jmxtrans']['user']\n group node['jmxtrans']['user']\n mode \"0755\"\n local true\n variables({\n :graphite_host => node['jmxtrans']['graphite']['host'],\n :graphite_port => node['jmxtrans']['graphite']['port'] \n })\n action :nothing\n end.run_action(:create)\n end\nend",
"def generate_pages\n Dir.foreach(@site_path) do |file|\n if file =~ /(\\w+)\\.page/\n path = File.join(@site_path, file)\n\n File.open(File.join(@site_path, \"#{$1}.html\"), 'w') do |f|\n f << generate_page(parse_page(path))\n end\n\n @log.debug(\" generated a page from #{path}\")\n end\n end\n end",
"def transform_files!(files, type) \n files.each do |file|\n @file = file\n @type = type\n parsed = \"\"\n @dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory\n \n namespaces = LANGUAGES.collect do |lang|\n if type == 'views'\n namespace = [lang] + @dirnames\n else\n namespace = [lang, type] + @dirnames\n end\n \n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n Namespace.new(namespace,lang)\n end\n\n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, namespaces, type)\n \n # write the app/type/file with new i18n format instead of gettext\n File.open(file, 'w') { |file| file.write(parsed)}\n \n namespaces.each do |ns|\n new_file_handler(ns)\n end\n end\n end",
"def run_on_change(paths)\n UI.info \"Templates have changed, copying over\"\n ::Forge::Guard.builder.clean_templates\n ::Forge::Guard.builder.copy_templates\n end",
"def reset\n\t\t\t#@index = 0\n\t\t\tload_template @filename\n\t\tend",
"def install_template(file_parts, dest, subs = {})\n content = String.new\n file_parts.each do |file_part|\n full_path = File.join(File.dirname(__FILE__), file_part)\n begin\n content += File.open(full_path).read\n rescue\n end\n end\n subs.keys.each do |k|\n content.gsub!(/#{k}/, subs[k])\n end\n File.open(dest, 'w') {|file| file.write(content)}\n end",
"def read_all template = not_meta\n matcher = Matcher.new(worker.make_template(template), self, :all => true)\n worker << matcher\n a = []\n while tuple = matcher.wait ## inefficient to wait one at a time?\n yield tuple if block_given?\n a << tuple\n end\n a\n end",
"def hook_add_templates\n @flavor.class.before_add_templates do |templates, resource_action|\n if :create == resource_action && fail_on_clobber\n templates.each do |template|\n if File.exist?(destination_path(template))\n fail \"tried to overwrite file #{template}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end",
"def generate_all(template_file, output_dir, override=false)\n parse_messages(template_file).each do |message|\n target_file = File.join(output_dir, \"#{message.name}.xml\")\n if !File.exist?(target_file) or override\n File.open(target_file, \"w\") do |file|\n file.write(generate_message_xml(message))\n end\n end\n end\nend",
"def templates\n file_list '{templates,puppet}/**/*.{erb,epp}'\n end",
"def get_template_entries\n \n if @template\n Zip::File.open(@template)\n else\n Zip::File.open_buffer(@io.force_encoding(\"ASCII-8BIT\"))\n end\n end",
"def create_templates\n files = %w(_filter _form index admin edit show new)\n files.each do |file|\n template \"assets/templates/#{file}.html.haml.erb\", \"app/assets/templates/#{class_name.tableize}/#{file}.html.haml\"\n end\n end",
"def create\n @templates = @firm.templates\n @template = Template.new(template_params)\n @template.user = @user\n @template.firm = @firm\n if File.extname(@template.file.file.filename) == '.docx'\n content = ''\n if @template.valid_zip?\n doc = Docx::Document.open(@template.file.path)\n doc.paragraphs.each do |p|\n if p.node.xpath('w:r//w:lastRenderedPageBreak').present?\n content = content + %q(<div class=\"-page-break\"></div>) + p.to_html\n else\n content = content + p.to_html\n end\n\n end\n @template.html_content = content\n respond_to do |format|\n if @template.save\n format.html { redirect_to template_path(@template), notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n else\n @template.errors.add(:file, 'is corrupted')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def all_template_files\n files = super\n files + Dir.glob(\"#{JenkinsJob.flavor_dir}/templates/**.xml.erb\")\n end",
"def all_template_files\n files = super\n files + Dir.glob(\"#{JenkinsJob.flavor_dir}/templates/**.xml.erb\")\n end",
"def store\n @files.each do |file, lines|\n text = \"\"\n dirty = false\n lines.each do |l|\n if l.is_a?(Section)\n dirty ||= l.dirty?\n text << l.format\n l.mark_clean\n else\n text << l\n end\n end\n if dirty\n Puppet::Util::FileType.filetype(:flat).new(file).write(text)\n return file\n end\n end\n end",
"def generate_file_files\n template_file = @template_dir + 'file-page.html.erb'\n debug_msg \"Generating file documentation\"\n @all_files.each do |file|\n debug_msg \" file #{file.path}\"\n outfile = @output_dir + file.path\n @file = file\n self.render_template(template_file, binding(), outfile)\n end\n end",
"def expand_templates\n @templates.map! do |tempfile|\n if tempfile.is_a?(String)\n # Expand possible globs to all matching entries\n Dir.glob(File.join(Pkg::Config::project_root, tempfile))\n elsif tempfile.is_a?(Hash)\n tempfile\n end\n end\n @templates.flatten!\n\n # Reject matches that are templates from packaging itself. These will contain the packaging root.\n # These tend to come from the current tar.rake implementation.\n @templates.reject! { |temp| temp.is_a?(String) && temp.match(/#{Pkg::Config::packaging_root}/) }\n end",
"def compile_templates(production)\n dir = File.join(@proj_dir, @dynamic_folder)\n \n Dir[File.join(dir, '**/*')].each do |path|\n if File.file?(path) && !File.basename(path).match(/^(\\.|_)/)\n path = path[ (dir.size + 1)..-1 ]\n ext = File.extname(path)\n new_ext = ext_from_handler(ext) \n name = File.basename(path, ext)\n \n if production == true && \"#{name}.#{new_ext}\" != 'index.html' && new_ext == 'html'\n new_file = File.join(@output_folder, path.sub(/(\\/?[\\w-]+)\\.[\\w-]+$/, \"\\\\1/index.#{new_ext}\"))\n else\n new_file = File.join(@output_folder, path.sub(/\\.[\\w-]+$/, \".#{new_ext}\")) \n end\n \n create_dirs(new_file)\n File.open(new_file, 'w') {|f| f.write render(path) }\n puts \" - \\033[32mCreating\\033[0m '#{new_file}'\"\n end\n end\n end",
"def read patterns\n Dir[*patterns].uniq.map do |f|\n filename = File.join(Dir.pwd, f)\n\n @files ||= []; @files << filename\n STDERR.puts filename\n\n case File.extname(filename)\n when '.erb'\n Dir.chdir File.dirname(filename) do\n ERB.new(File.read(File.basename(filename))).result(binding)\n end\n else\n File.read filename\n end\n end.join(\"\\n\")\nend",
"def emit data\n target_output = template_map.map do |template,target|\n begin\n logger.info \"Expanding template #{template}\"\n input = File.read(template)\n erb = Erubis::Eruby.new(input)\n output = erb.result({ :data => data })\n [target,output]\n rescue => e\n logger.error \"Error expanding template #{template}: #{e.message}\"\n raise e\n end\n end\n target_output = Hash[target_output]\n\n static_output = static_map.map do |input,target|\n begin\n logger.info \"Reading static file #{input}\"\n output = File.read(input)\n [target,output]\n rescue => e\n logger.error \"Error reading static file #{input}: #{e.message}\"\n raise e\n end\n end\n target_output = target_output.merge(Hash[static_output])\n # target_output is a map of relative paths to new contents\n\n changes_detected = target_output.any? do |target,output|\n _contents_changed(Pathname.new(target).expand_path(destination), output)\n end\n\n if !changes_detected\n logger.info \"No changes detected; skipping check and commit\"\n return false\n end\n\n # write targets and statics to tmp, run check, and possibly rollback\n tmp = Dir.mktmpdir(\".merlin-#{@name}-\",@custom_tmp)\n logger.debug \"Created tmp directory #{tmp}\"\n begin\n target_output.each {|target,output| _write_to(target,tmp,output) }\n success = run_command(:check, {\n :dest => tmp,\n :files => target_output.keys.map {|p| File.join(tmp,p)},\n })\n unless success\n # rollback! just nuke the tmp directory :)\n logger.warn \"Cleaning up #{tmp} after failed check\"\n FileUtils.remove_entry_secure(tmp)\n else\n # perform commit\n if @atomic\n logger.info \"Performing atomic deploy of #{tmp} to #{destination}\"\n # copy tmp to destination.$(date +%s)\n timestamped_destination = File.join(File.dirname(destination),File.basename(destination) + \".\" + Time.now.to_i.to_s)\n if File.directory? timestamped_destination\n # TODO maybe just tack on some suffix until it doesnt exist instead of erroring?\n logger.error \"Unable to copy #{tmp} to #{timestamped_destination}; already exists\"\n raise Errno::EISDIR, timestamped_directory\n end\n logger.debug \"Copying #{tmp} to #{timestamped_destination}\"\n FileUtils.cp_r(tmp,timestamped_destination)\n logger.debug \"Atomically linking #{destination} -> #{timestamped_destination}\"\n Pathname.new(destination).atomic_ln_sfn(timestamped_destination)\n #TODO we should probably clean up directories (some # of changes? timewindow?)\n else\n logger.info \"Moving outputs from #{tmp} to #{destination}\"\n target_output.keys.each do |rel_target|\n _move_to(Pathname.new(tmp).join(rel_target), Pathname.new(destination).join(rel_target))\n end\n end\n success = run_command(:commit, {\n :dest => destination,\n :files => target_output.keys.map {|p| File.join(destination,p)},\n })\n end\n success\n ensure\n if Dir.exists? tmp\n logger.debug \"Cleaning up #{tmp}\"\n FileUtils.remove_entry_secure(tmp)\n end\n end\n end",
"def process_template( design_template, file_name )\n file = sample_file( file_name )\n design_template.original_file = file\n design_template.original_file.\\\n instance_write(:content_type, 'application/postscript')\n build_test_template( design_template, file )\n\n if design_template.save!\n Rails.logger.info 'design_template_test_helper - process_template() - successful save'\n process_original( design_template )\n else\n Rails.logger.info 'design_template_test_helper - process_template() - FAILED to save.'\n assert( false, 'DesignTemplate save failed.' )\n end\n end",
"def process_template name, src, type, called_from = nil, file_name = nil\n case type\n when :erb\n result = ErbTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :haml\n result = HamlTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :erubis\n result = ErubisTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :slim\n result = SlimTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n else\n abort \"Unknown template type: #{type} (#{name})\"\n end\n\n # Each template which is rendered is stored separately\n # with a new name.\n if called_from\n name = (\"#{name}.#{called_from}\").to_sym\n end\n\n @tracker.templates[name].src = result\n @tracker.templates[name].type = type\n end",
"def convert\n erb = ERB.new(File.readlines(template_file).join)\n File.open(File.basename(content_file, File.extname(content_file)) + '.html', 'w') do |f|\n f << erb.result(get_binding)\n end\n end",
"def generate_file_files\n setup\n\n page_file = @template_dir + 'page.rhtml'\n fileinfo_file = @template_dir + 'fileinfo.rhtml'\n\n # for legacy templates\n filepage_file = @template_dir + 'filepage.rhtml' unless\n page_file.exist? or fileinfo_file.exist?\n\n return unless\n page_file.exist? or fileinfo_file.exist? or filepage_file.exist?\n\n debug_msg \"Generating file documentation in #{@outputdir}\"\n\n out_file = nil\n current = nil\n\n @files.each do |file|\n current = file\n\n if file.text? and page_file.exist? then\n generate_page file\n next\n end\n\n template_file = nil\n out_file = @outputdir + file.path\n debug_msg \" working on %s (%s)\" % [file.full_name, out_file]\n rel_prefix = @outputdir.relative_path_from out_file.dirname\n search_index_rel_prefix = rel_prefix\n search_index_rel_prefix += @asset_rel_path if @file_output\n\n asset_rel_prefix = rel_prefix + @asset_rel_path\n\n unless filepage_file then\n if file.text? then\n next unless page_file.exist?\n template_file = page_file\n @title = file.page_name\n else\n next unless fileinfo_file.exist?\n template_file = fileinfo_file\n @title = \"File: #{file.base_name}\"\n end\n end\n\n @title += \" - #{@options.title}\"\n template_file ||= filepage_file\n\n render_template template_file, out_file do |io|\n here = binding\n # suppress 1.9.3 warning\n here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)\n here.local_variable_set(:current, current)\n here\n end\n end\n rescue => e\n error =\n RDoc::Error.new \"error generating #{out_file}: #{e.message} (#{e.class})\"\n error.set_backtrace e.backtrace\n\n raise error\n end",
"def backup_templates\n FileUtils.rm_rf @old_templates if File.exist? @old_templates\n\n if File.exist? @current_templates\n FileUtils.mv(\n @current_templates,\n @old_templates\n )\n end\n end",
"def import_translations(path, page)\n old_translations = page.translations.pluck(:locale)\n new_translations = []\n\n Dir[\"#{path}content.*.html\"].each do |file_path|\n locale = File.basename(file_path).match(%r{content\\.(\\w+)\\.html})[1]\n new_translations << locale\n\n translation = page.translations.where(locale: locale).first_or_initialize\n\n next unless fresh_seed?(translation, file_path)\n\n # reading file content in, resulting in a hash\n fragments_hash = parse_file_content(file_path)\n\n # parsing attributes section\n attributes_yaml = fragments_hash.delete(\"attributes\")\n attrs = YAML.safe_load(attributes_yaml)\n\n # applying attributes\n layout = site.layouts.find_by(identifier: attrs.delete(\"layout\")) || page.try(:layout)\n translation.attributes = attrs.merge(\n layout: layout\n )\n\n # applying fragments\n old_frag_identifiers = translation.fragments.pluck(:identifier)\n\n new_frag_identifiers, fragments_attributes =\n construct_fragments_attributes(fragments_hash, translation, path)\n translation.fragments_attributes = fragments_attributes\n\n if translation.save\n message = \"[CMS SEEDS] Imported Translation \\t #{locale}\"\n ComfortableMexicanSofa.logger.info(message)\n\n # cleaning up old fragments\n frags_to_remove = old_frag_identifiers - new_frag_identifiers\n translation.fragments.where(identifier: frags_to_remove).destroy_all\n\n else\n message = \"[CMS SEEDS] Failed to import Translation \\n#{locale}\"\n ComfortableMexicanSofa.logger.warn(message)\n end\n end\n\n # Cleaning up removed translations\n translations_to_remove = old_translations - new_translations\n page.translations.where(locale: translations_to_remove).destroy_all\n end",
"def update_template_files(name, cookbook_path, description)\n files = Dir.glob(\"#{cookbook_path}/**/*\").select{ |e| File.file? e }\n user = get_username || \"Your Name\"\n email = get_useremail || \"Your Email\"\n company = \"Schuberg Philis\"\n year = Time.now.year\n date = Time.now\n files.each do |file|\n contents = \"\"\n File.foreach(file) do |line|\n line.gsub!(/DESCRIPTION/, description)\n line.gsub!(/COOKBOOK/, name)\n line.gsub!(/COMPANY/, company)\n line.gsub!(/NAME/, user)\n line.gsub!(/EMAIL/, email)\n line.gsub!(/YEAR/, year.to_s)\n line.gsub!(/DATE/, date.to_s)\n contents += line\n end\n File.open(file, 'w') {|f| f.write(contents) }\n end\n return nil\n end",
"def verification_templates(main_only: false)\n templates = raw_template\n templates = [templates.detect { |t| Kubernetes::RoleConfigFile.primary?(t) } || templates.first] if main_only\n templates.each_with_index.map { |c, i| Kubernetes::TemplateFiller.new(self, c, index: i) }\n end",
"def transform_files!(files, type) \n files.each do |file|\n parsed = \"\"\n namespace = [DEFAULT_LANGUAGE, 'txt', type] + Base.get_namespace(file, type)\n puts \"Converting: \" + file + \" into namespace: \"\n puts namespace.map {|x| \"[\\\"#{x}\\\"]\"}.join(\"\")\n \n n = Namespace.new(namespace)\n \n contents = Base.get_file_as_string(file)\n parsed << GettextI18nConvertor.string_to_i18n(contents, n)\n \n #puts parsed\n # write the file\n \n File.open(file, 'w') { |file| file.write(parsed)}\n \n \n \n n.merge(@translations)\n end\n end",
"def replace_supplement(template_dir,old_template_dir)\n\n # remove old_template\n if File.exist?(Rails.root.to_s+'/app/assets/templates/'+old_template_dir+'/template.json')\n data_json = File.read(Rails.root.to_s+'/app/assets/templates/'+old_template_dir+'/template.json')\n datax = JSON.parse(data_json)\n\n if defined?(datax[\"supplements\"].each)\n datax[\"supplements\"].each do |supp|\n # remove file\n if(supp[\"copy_type\"] == \"file\") \n the_file = Rails.root.join(supp[\"copy_to\"]+'/'+supp[\"name\"]).to_s\n if File.exists?(the_file)\n FileUtils.rm(the_file)\n end\n end\n\n # remove folder\n if(supp[\"copy_type\"] == \"folder\")\n the_folder = Rails.root.join(supp[\"copy_to\"]+'/'+supp[\"name\"]).to_s\n if Dir.exists?(the_folder)\n FileUtils.remove_dir(the_folder)\n end\n end\n end\n end \n end # end of remove old_template\n\n # apply new template\n if File.exist?(Rails.root.to_s+'/app/assets/templates/'+template_dir+'/template.json')\n data_json = File.read(Rails.root.to_s+'/app/assets/templates/'+template_dir+'/template.json')\n datax = JSON.parse(data_json)\n if defined?(datax[\"supplements\"].each)\n datax[\"supplements\"].each do |supp| \n # co-pas file\n if(supp[\"copy_type\"] == \"file\") \n the_file_temp = Rails.root.to_s+'/app/assets/templates/'+template_dir+'/supplements/'+supp[\"name\"]\n the_file_copy_to = Rails.root.to_s+'/'+supp[\"copy_to\"]+'/'+supp[\"name\"]\n if File.exists?(the_file_temp)\n\n # create directory if doesn't exist\n unless File.directory?(Rails.root.to_s+'/'+supp[\"copy_to\"])\n FileUtils.mkdir_p(Rails.root.to_s+'/'+supp[\"copy_to\"])\n end\n\n # copy the file into directory\n FileUtils.cp(the_file_temp, the_file_copy_to) \n end\n end\n\n # co-pas folder\n if(supp[\"copy_type\"] == \"folder\")\n the_folder_temp = Rails.root.to_s+'/app/assets/templates/'+template_dir+'/supplements/'+supp[\"name\"]\n the_folder_copy_to = Rails.root.to_s+'/'+supp[\"copy_to\"]+'/'+supp[\"name\"] \n\n # remove destination folder as mention in http://ruby-doc.org/stdlib-2.0.0/libdoc/fileutils/rdoc/FileUtils.html#method-c-copy_entry\n if Dir.exists?(the_folder_copy_to)\n FileUtils.remove_dir(the_folder_copy_to)\n end\n\n # copy\n if Dir.exists?(the_folder_temp)\n FileUtils.copy_entry(the_folder_temp,the_folder_copy_to)\n end\n end\n end\n end\n end\n end",
"def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def perform_template_load\n memoize(:template) do\n self.data[:template] = api.stack_template_load(self)\n true\n end\n end",
"def init_template_statements\n @templates.map do |template|\n Loader.template_policy(template[\"template\"], template[\"vars\"])\n end.flatten\n end",
"def read_all template = Object\n matcher = Matcher.new(worker.make_template(template), self, :all => true)\n worker << matcher\n a = []\n while tuple = matcher.wait ## inefficient?\n yield tuple if block_given?\n a << tuple\n end\n a\n end",
"def template_for file, page = true, klass = ERB\n template = @template_cache[file]\n\n return template if template\n\n if page then\n template = assemble_template file\n erbout = 'io'\n else\n template = file.read\n template = template.encode @options.encoding\n\n file_var = File.basename(file).sub(/\\..*/, '')\n\n erbout = \"_erbout_#{file_var}\"\n end\n\n if RUBY_VERSION >= '2.6'\n template = klass.new template, trim_mode: '-', eoutvar: erbout\n else\n template = klass.new template, nil, '-', erbout\n end\n @template_cache[file] = template\n template\n end",
"def fill_template\n @log.debug(\"Reading erb template from file: '#{@template}'.\")\n erb = ERB.new(File.read(@template), nil, '-')\n erb.filename = @template\n erb.result(binding)\n end",
"def templates_from_project\n list = []\n dirs = Dir.glob(File.join(output, LOCAL_DIRECTORY, '*/'))\n dirs = dirs.uniq.map{ |d| d.chomp('/') }\n dirs.each do |dir|\n name = dir.sub(File.join(output, LOCAL_DIRECTORY)+'/', '')\n list << Template.new(name, dir, :type=>:project)\n end\n list\n end",
"def find_templates(name, details, prefix, partial)\n raise NotImplementedError\n end",
"def make_pages\n Dir.glob(concepts_glob).each do |concept_file_path|\n Jekyll.logger.debug(\"Geolexica:\",\n \"processing concept data #{concept_file_path}\")\n concept_hash = read_concept_file(concept_file_path)\n preprocess_concept_hash(concept_hash)\n add_page ConceptPage::HTML.new(site, concept_hash)\n add_page ConceptPage::JSON.new(site, concept_hash)\n add_page ConceptPage::JSONLD.new(site, concept_hash)\n add_page ConceptPage::Turtle.new(site, concept_hash)\n end\n end",
"def process_template(template_name,map)\r\n template = File.dirname(__FILE__) + \"/../templates/#{template_name}.st\"\r\n map['timestamp']=Time.now.httpdate\r\n File.open(template,'r') do | f | \r\n # detect words inside dollar sign pairs\r\n replaced = f.read.gsub(/(\\$\\w*\\$)/) do | match |\r\n key = match[1..match.size-2]\r\n (map.has_key? key) ? map[key] : 'MISSING:'+key\r\n end \r\n return replaced\r\n end # file\r\n end",
"def refresh\n Dir.glob('haml/**/*.haml').each do |file|\n if file !~ /\\/_/\n file.gsub!(/^haml\\//, '')\n compile(file) unless File.exist?(output_file(file))\n end\n end\n end",
"def template_for(filename, opts = {})\n # A bunch of potential matches in order of preference.\n candidates = if Gluttonberg.localized?\n # Locale and dialect\n # Locale only\n # Default\n [\n \"#{filename}.#{opts[:locale].slug}.#{opts[:dialect].code}\",\n \"#{filename}.#{opts[:locale].slug}\",\n \"#{filename}\"\n ]\n elsif Gluttonberg.translated?\n # Dialect\n # Default\n [\n \"#{filename}.#{opts[:dialect].code}\",\n \"#{filename}\"\n ]\n else\n [\"#{filename}.*\"]\n end\n # Loop through them and return the first match\n for candidate in candidates \n path = template_dir / candidate + \".*\"\n matches = Dir.glob(path)\n return candidate unless matches.empty?\n end\n # This nil has to be here, otherwise the last evaluated object is \n # returned, in this case the candidates hash.\n nil\n end",
"def generate_all\n copy_template_dir('layouts', 'layouts')\n copy_template_dir('content/bootstrap', 'content/bootstrap')\n copy_template_dir('content/content', 'content/content')\n delete_target_file('lib/default.rb')\n copy_template_dir('lib', 'lib')\n delete_target_file('Rules')\n copy_template_file('Rules', 'Rules')\n copy_template_file('.gitignore', '.gitignore')\n copy_template_file('cg_config.rb', 'cg_config.rb')\n copy_template_file('cg_config.rb_sample', 'cg_config.rb_sample')\n delete_target_file('content/stylesheet.css')\n delete_target_file('content/index.html')\n delete_target_file('layouts/default.html')\n create_empty_dir('content/images')\n end",
"def generate_files\n ip = local_ip\n version = Farmstead::VERSION\n scaffold_path = \"#{File.dirname __FILE__}/scaffold\"\n scaffold = Dir.glob(\"#{scaffold_path}/**/*.erb\", File::FNM_DOTMATCH)\n scaffold.each do |file|\n basename = File.basename(file)\n folderstruct = file.match(\"#{scaffold_path}/(.*)\")[1]\n if basename != folderstruct\n foldername = File.dirname(folderstruct)\n create_recursive(\"#{@name}/#{foldername}\")\n end\n projectpath = \"#{@name}/#{folderstruct}\".chomp(\".erb\")\n template = File.read(file)\n results = ERB.new(template).result(binding)\n copy_to_directory(results, projectpath)\n end\n end",
"def fetch\n position, last_dirname = nil, nil\n\n Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|\n next unless File.directory?(filepath) || filepath =~ /\\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/\n\n if last_dirname != File.dirname(filepath)\n position, last_dirname = 100, File.dirname(filepath)\n end\n\n page = self.add(filepath, position: position)\n\n next if File.directory?(filepath) || page.nil?\n\n if locale = self.filepath_locale(filepath)\n Locomotive::Mounter.with_locale(locale) do\n self.set_attributes_from_header(page, filepath)\n end\n else\n Locomotive::Mounter.logger.warn \"Unknown locale in the '#{File.basename(filepath)}' file.\"\n end\n\n position += 1\n end\n end",
"def templates\n @templates ||= (\n list = []\n list.concat templates_from_project\n list.concat templates_from_remotes\n list.concat templates_from_plugins\n list.sort_by{ |t| t.name }\n )\n end",
"def create_view_templates\n unless @check_migration\n template 'views/images.html.erb', File.join(file_path, \"_images.html.erb\")\n template 'views/image.html.erb', File.join(file_path, \"_image.html.erb\")\n template 'views/images_field.html.erb', File.join(file_path, \"_images_field_#{@chunk}.html.erb\")\n else\n unless File.exists?(\"#{file_path}/_images_field_#{@chunk}.html.erb\")\n template 'views/images_field.html.erb', File.join(file_path, \"_images_field_#{@chunk}.html.erb\")\n end\n end\n end",
"def before_build\n file_patterns = options[:files] || '*.mustache'\n files = Dir[*[file_patterns].flatten]\n vars = {\n :env => pusher.env,\n :config => pusher.config\n }.merge(options[:vars] || {})\n Couchino.logger.debug \"Mustache vars: #{vars.inspect}\"\n files.each do |file|\n Couchino.logger.debug \"Running #{file} through mustache.\"\n basename = File.basename(file)\n dir = File.dirname(file)\n parts = basename.split(/\\./)\n new_file = parts.length > 2 ? parts[0..-2].join('.') : parts[0] + \".html\"\n File.open(File.join(dir, new_file), 'w') do |f|\n f << ::Mustache.render(File.read(file), vars)\n end\n Couchino.logger.debug \"Wrote to #{new_file}\"\n end\n end",
"def hook_add_templates\n @flavor.class.after_add_templates do |templates, resource_action|\n templates.each do |template|\n actions_taken << \"#{resource_action} template #{template}\"\n end\n end\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def all_templates\n @templates = super.merge(TEMPLATES)\n end",
"def generate force_build = false\n blog_template = Template::Blog.new self\n\n skipped_files = []\n new_files = []\n updated_files = []\n old_files = Dir.glob('public/**/*.html')\n\n blog_template.modes.each {\n |mode|\n\n blog_template.mode = mode\n\n (1..blog_template.pages).each { |page|\n blog_template.page = page\n path = blog_template.local_path\n pretty_path = Pathname.new(path).relative_path_from(Pathname.new(@spec.blog_root)).to_s\n\n if old_files.include? pretty_path\n old_files.delete pretty_path\n end\n\n mtime = File.exists?(path) ? File.mtime(path) : nil\n needs_update = force_build || mtime.nil?\n\n if ! needs_update\n needs_update = blog_template.posts.any? {\n |post|\n mtime < File.mtime(post.post_data.source_path)\n }\n\n if ! needs_update\n skipped_files << path\n next\n end\n end\n\n dir = File.dirname(path)\n FileUtils.mkdir_p dir unless File.directory? dir\n\n if File.exists? path\n updated_files << pretty_path\n else\n new_files << pretty_path\n end\n\n r = nil\n File.open(path, 'w') {\n |io|\n io.write blog_template.render\n }\n }\n }\n\n updated_files.each { |path| puts \"* #{path}\" }\n\n new_files.each { |path| puts \"+ #{path}\"}\n\n old_files.each {\n |path|\n puts \"- #{path}\"\n File.unlink path\n dir = File.dirname path\n if Dir.entries(dir) == @@EMPTY_DIR_ENTRIES\n Dir.unlink dir\n end\n }\n end",
"def create_default_template_file\n unless self.description.redirection_required?\n self.localizations.each do |page_localization|\n file_path = File.join(Rails.root, \"app\", \"views\" , \"pages\" , \"#{self.view}.#{page_localization.locale.slug}.html.haml\" )\n unless File.exists?(file_path)\n file = File.new(file_path, \"w\")\n\n page_localization.contents.each do |content|\n file.puts(\"= @page.easy_contents(:#{content.section_name})\")\n end\n file.close\n end\n end\n end\n end",
"def update_tokens(template_file)\n template = \"\"\n open(template_file) {|f|\n template = f.to_a.join\n }\n updated = ERB.new(template, 0, \"%<>\").result\n\n return updated\nend",
"def process_all_primary_files\n # NOTE: I investigated concurrent processing of files\n # to speed up this process, however I didn't pursue it\n # further: This process is highly CPU intensive, so the\n # only way to get a significant speedup is to use\n # multiple CPUs/Cores. In MRI this is only possible\n # with multiple processes. I didn't want to go through\n # the trouble of IPC to collect all files' operations.\n # It would be easier if we could use threads, however\n # that would require jruby or rbx. So I'm sticking with\n # sequential processing for now.\n Dir.glob(\n File.join(@repository.base_dir, '**/content/**/*.at')\n ).map { |absolute_file_path|\n next nil if !@file_list.any? { |e| absolute_file_path.index(e) }\n # Skip non content_at files\n unless absolute_file_path =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here\"\n end\n\n # Note: @any_content_type may be the wrong one, however finding\n # corresponding STM CSV file will still work as it doesn't rely\n # on config but das regex replacements on file path only.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n File.read(absolute_file_path),\n @language,\n absolute_file_path,\n @any_content_type\n )\n\n @logger.info(\" - process #{ content_at_file_to.repo_relative_path(true) }\")\n\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n ).compute\n\n if soff.operations.any?\n @prev_last_operation_id = soff.last_operation_id\n soff\n else\n # Return nil if no subtitle operations exist for this file\n nil\n end\n }.compact\n end",
"def replace_in(files=[])\n files.each do |f|\n content = File.read f\n @map.each do |original, busted|\n content = content.gsub(/#{ original }/, busted)\n end\n File.write f, content\n end\n end",
"def templates; end",
"def init\n File.open(TEMPLATABLE_FILE, 'w') { |f|f.puts TEMPLATABLE_TEMPLATE }\n end",
"def get_template(file) #this is our template, defined as a single string\n s = \"\"\n File.open(file) do |f|\n f.each_line do |line|\n s.concat(line)\n end\n end\n s\nend"
] |
[
"0.6779656",
"0.6523972",
"0.6401049",
"0.6318663",
"0.6313441",
"0.62529856",
"0.62517434",
"0.6200578",
"0.61539805",
"0.61352575",
"0.6117156",
"0.6111401",
"0.6107214",
"0.60853106",
"0.6067784",
"0.60462075",
"0.6042569",
"0.60304505",
"0.6016003",
"0.59777576",
"0.5944095",
"0.59288836",
"0.5928316",
"0.59155124",
"0.5907923",
"0.5907699",
"0.58955836",
"0.5858208",
"0.5855576",
"0.5844711",
"0.58203",
"0.5794959",
"0.5769532",
"0.57489526",
"0.57489526",
"0.57293683",
"0.568218",
"0.5662561",
"0.56162816",
"0.5613599",
"0.56135285",
"0.5613204",
"0.56090856",
"0.5605901",
"0.5596034",
"0.55872256",
"0.55819315",
"0.5579425",
"0.55312175",
"0.55195075",
"0.55061376",
"0.55027896",
"0.55027896",
"0.5502463",
"0.5491775",
"0.54761016",
"0.5472866",
"0.54719096",
"0.54560995",
"0.5452953",
"0.5451401",
"0.54321134",
"0.5418256",
"0.5412292",
"0.54109716",
"0.539658",
"0.5376524",
"0.5361927",
"0.53613466",
"0.53548133",
"0.53546673",
"0.53532255",
"0.5350457",
"0.53433317",
"0.53418976",
"0.533877",
"0.5330184",
"0.53173906",
"0.5316093",
"0.5309884",
"0.530841",
"0.5308397",
"0.53000075",
"0.52963614",
"0.52599406",
"0.52541345",
"0.5252061",
"0.5250963",
"0.52492523",
"0.52492523",
"0.52492523",
"0.52492523",
"0.52492523",
"0.5246572",
"0.5242813",
"0.5238036",
"0.5234528",
"0.52323645",
"0.5229897",
"0.5229418",
"0.52158165"
] |
0.0
|
-1
|
Creates and initializes a new instance of the SnapshotOperations class.
|
def initialize(client)
@client = client
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(configuration, options = {})\n super(configuration, 'snapshots', 'Microsoft.Compute', options)\n end",
"def create_snapshot(metadata={})\n Azure::Blobs.create_snapshot(self, metadata)\n end",
"def initialize(operation)\n @operation = operation\n @database = operation.database\n end",
"def build_snapshot\n Sherlock::Models::Snapshot.new(\n :node_id => snapshot_json[:node_id],\n :timestamp => Time.now\n )\n end",
"def create_from_snapshot(snapshot_name, properties, volume_template = nil, is_permanent = true)\n snapshot = get_snapshot(snapshot_name)\n raise IncompleteResource, 'Snapshot not found!' unless snapshot\n storage_pool_uri = nil\n volume_template_uri = if volume_template.nil?\n storage_pool_uri = @data['storagePoolUri']\n get_volume_template_uri(isRoot: true, family: 'StoreServ')\n else\n raise IncompleteResource, 'Volume Template not found!' unless volume_template.retrieve!\n storage_pool_uri = volume_template['storagePoolUri']\n volume_template['uri']\n end\n\n data = {\n 'properties' => properties.merge('storagePool' => storage_pool_uri, 'snapshotPool' => storage_pool_uri),\n 'snapshotUri' => snapshot['uri'],\n 'templateUri' => volume_template_uri,\n 'isPermanent' => is_permanent\n }\n\n response = @client.rest_post(\"#{BASE_URI}/from-snapshot\", { 'body' => data }, @api_version)\n self.class.new(@client, client.response_handler(response))\n end",
"def snapshots\n ContentTypeSnapshotMethodsFactory.new(self)\n end",
"def create_snapshot(options)\n snapshot = ec2.snapshots.new\n snapshot.volume_id = options['volume_id']\n snapshot.description = options['description']\n\n attempts = 0\n\n begin\n snapshot.save\n snapshot.reload\n rescue Fog::Compute::AWS::Error\n sleep 5\n attempts += 1\n if attempts == 5\n log \"Error communicating with API; Unable to save volume `#{options['volume_id']}` (Desc: #{options['description']})\"\n end\n return unless attempts == 5\n end\n\n options['tags'].each do |k,v|\n begin\n ec2.tags.create({resource_id: snapshot.id, key: k, value: v})\n rescue Errno::EINPROGRESS , Errno::EISCONN\n log \"API Connection Error\"\n sleep 1\n retry\n rescue Fog::Compute::AWS::Error\n log \"Failed attaching tag `'#{k}' => #{v}` to #{options['snapshot_type']} snapshot #{snapshot.id}\"\n sleep 1\n retry\n end\n end\n\n end",
"def initialize(*arguments)\n @arguments = arguments\n @operations = []\n end",
"def snapshot\r\n date = self.class.service_instance.snapshot_blob(self.path)\r\n properties = self.class.service_instance.get_blob_properties(self.path)\r\n return BlobObject.new(:name => self.name, \r\n :url => self.class.service_instance.generate_request_uri(self.path) + \"?snapshot=#{date}\",\r\n :content_type => properties[:content_type],\r\n :snapshot_date => date)\r\n end",
"def initialize(checksum=nil, couchdb=nil)\n @create_time = Time.now.iso8601\n @checksum = checksum\n @original_committed_file_location = nil\n @storage = Storage::Filesystem.new(Chef::Config.checksum_path, checksum)\n end",
"def build_snapshot\n raise \"build_snapshot not implemented in #{self}\"\n end",
"def initialize(credentials = nil, base_url = nil, options = nil)\n super(credentials, options)\n @base_url = base_url || 'https://management.azure.com'\n\n fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?\n @credentials = credentials\n\n @operations = Operations.new(self)\n @accounts = Accounts.new(self)\n @pools = Pools.new(self)\n @volumes = Volumes.new(self)\n @mount_targets = MountTargets.new(self)\n @snapshots = Snapshots.new(self)\n @api_version = '2019-06-01'\n @accept_language = 'en-US'\n @long_running_operation_retry_timeout = 30\n @generate_client_request_id = true\n add_telemetry\n end",
"def initialize(operation, concern)\n @operation = operation\n @database = operation.database\n @concern = concern\n end",
"def create_snapshot\n @current_snapshot = @bitmap.to_json if @bitmap\n end",
"def operation\n @op_notifier = Notifier.new\n Operation.new(self)\n end",
"def _snapshot\n raise NotImplementedError\n end",
"def create_snapshot(name)\n Fission::Action::Snapshot::Creator.new(self).create_snapshot(name)\n end",
"def set_snapshot\n @snapshot = Snapshot.find(params[:id])\n end",
"def initialize(collection, operations, options)\n @collection = collection\n @operations = operations\n @options = options\n end",
"def _snapshot_details\n @_snapshot_details ||= SnapshotDetails.new(simulator: self, **@configuration[:snapshot_details_options])\n end",
"def create_snapshot request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/disks/#{request_pb.disk}/createSnapshot\"\n body = request_pb.snapshot_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end",
"def new_snapshot!(time = Time.now)\n snapshot_path = time.strftime(dir.path + '/%Y-%m-%dT%H:%M%z')\n Snapshot.new(self, snapshot_path).create!(current.path)\n end",
"def create_snapshot(snapshot, description = nil)\n ensure_uri && ensure_client\n if snapshot.is_a?(OneviewSDK::Resource) || snapshot.is_a?(Hash)\n name = snapshot[:name] || snapshot['name']\n description ||= snapshot[:description] || snapshot['description']\n else\n name = snapshot\n end\n data = generate_snapshot_data(name, description)\n response = @client.rest_post(\"#{@data['uri']}/snapshots\", { 'body' => data }, @api_version)\n @client.response_handler(response)\n true\n end",
"def create(body = {}, params = {})\n response = client.put \"/_snapshot/{repository}/{snapshot}\", update_params(params, body: body, action: \"snapshot.create\", rest_api: \"snapshot.create\")\n response.body\n end",
"def _snapshot\n hash = Snapshot.new\n field_names.each do |name|\n ss = find_obj_for_name(name).snapshot\n hash[name] = ss unless ss.nil?\n end\n hash\n end",
"def fetch_snapshots\n @snapshots = ::Refinery::Snapshots::Snapshot.all\n end",
"def create_snapshot subscription, snapshot_name, labels: nil\n subscriber.create_snapshot name: snapshot_path(snapshot_name),\n subscription: subscription_path(subscription),\n labels: labels\n end",
"def initialize(operation, client)\n @operation = operation\n @roomorama_client = client\n end",
"def create_snapshot\n @attributes[:create_snapshot]\n end",
"def op(*args, &block)\n Operation.new(*args, &block)\n end",
"def initialize(repository, range = repository.current_branch)\n @range = range\n @repository = repository\n @commits = repository.commits range\n\n init\n end",
"def define_instance_operation(operation, *options)\n options = options.extract_options!\n params = prepare_params(options)\n\n instance_operation_module.module_eval <<-RUBY_EVAL, __FILE__, __LINE__+1\n def #{operation.to_s.snakecase}(#{params.join(',')})\n self.class.#{operation.to_s.snakecase} #{params.join(',').chomp(' = {}')}\n end\n RUBY_EVAL\n end",
"def create!\n set_id = generate_set_id\n\n @volume_ids.each do |id|\n snapshot = @fog.snapshots.new\n\n snapshot.description = \"#{@hostname.split(\".\")[0]} #{@mount} (#{self.needed_types.join(\", \")}) (#{set_id})\"\n snapshot.volume_id = id\n\n # Actually do the snapshot\n snapshot.save\n\n # Reload to get snapshot.id so we can add tags\n snapshot.reload\n\n @fog.tags.create(:resource_id => snapshot.id, :key => \"Host\", :value => @hostname)\n @fog.tags.create(:resource_id => snapshot.id, :key => \"Mount\", :value => @mount)\n @fog.tags.create(:resource_id => snapshot.id, :key => \"SetID\", :value => set_id)\n @fog.tags.create(:resource_id => snapshot.id, :key => \"Type\", :value => self.needed_types.join(\",\"))\n end\n end",
"def take_a_snapshot\n raise NotImplementedError\n end",
"def initialize(*params, &blk)\n super(*params)\n @artifacts = Templates::Utils::ArtifactStorage.new\n create_components\n instance_exec(&blk) if blk\n end",
"def initialize(op_data = {})\n @@log.debug {\"Node Element Initialized with: #{op_data.inspect}\"} if @@log.debug?\n \n #set the module with the operation definition and include them\n @ops_set_module = op_data[:op_sets_mod] ||DefaultOpSets\n self.class.__send__(:include, @ops_set_module) #why is this private? am I doing something wrong?\n \n #set the mapping between fields and the type of operations supported by those fields\n @field_op_set_sym = DefaultFieldOpSet.merge(op_data[:field_op_set] || {})\n @@log.info {\"Field Operations Set: #{@field_op_set_sym.inspect}\"} if @@log.info?\n @field_op_defs = get_field_op_procs(@field_op_set_sym)\n \n #set the key fields that will work as node/record identifiers or other key fields\n @key_fields = op_data[:key_fields]||DefaultKeyFields\n raise \"key_fields are required\" unless @key_fields\n\n #we are no longer differentiating between keys required for insantiation and persistence\n #this can be added in the future easily though.\n @required_instance_keys = @key_fields[:required_keys]\n @required_save_keys = @key_fields[:required_keys]\n @node_key = @key_fields[:primary_key]\n @views = default_views(@field_op_set_sym) #TODO: Allow custom views in the future\n end",
"def initialize(_container, _entity=nil)\n _container = _container.is_a?(Proc) ? _container.call : _container\n App.logger.debug \"RW repo #{self} initializing with rom-container: #{_container}, entity: #{_entity}\"\n super(_container)\n @entity = _entity\n self\n end",
"def begin\n raise \"Nested transactions are not allowed\" if @state != :INITIALIZED\n begin\n case @isolation\n when Hash\n if @isolation[:timestamp]\n @grpc_transaction = @connection.session.create_snapshot timestamp: @isolation[:timestamp]\n elsif @isolation[:staleness]\n @grpc_transaction = @connection.session.create_snapshot staleness: @isolation[:staleness]\n elsif @isolation[:strong]\n @grpc_transaction = @connection.session.create_snapshot strong: true\n else\n raise \"Invalid snapshot argument: #{@isolation}\"\n end\n when :read_only\n @grpc_transaction = @connection.session.create_snapshot strong: true\n when :pdml\n @grpc_transaction = @connection.session.create_pdml\n else\n @begin_transaction_selector = Google::Cloud::Spanner::V1::TransactionSelector.new \\\n begin: Google::Cloud::Spanner::V1::TransactionOptions.new(\n read_write: Google::Cloud::Spanner::V1::TransactionOptions::ReadWrite.new\n )\n\n end\n @state = :STARTED\n rescue Google::Cloud::NotFoundError => e\n if @connection.session_not_found? e\n @connection.reset!\n retry\n end\n @state = :FAILED\n raise\n rescue StandardError\n @state = :FAILED\n raise\n end\n end",
"def volume_client_create\n options = {\n :provider => :openstack,\n :openstack_api_key => @options[:openstack_api_key],\n :openstack_username => @options[:openstack_username],\n :openstack_auth_url => @options[:openstack_auth_url],\n :openstack_tenant => @options[:openstack_tenant],\n :openstack_region => @options[:openstack_region],\n }\n @volume_client ||= Fog::Volume.new(options)\n unless @volume_client\n raise \"Unable to create OpenStack Volume instance\"\\\n \" (api_key: #{@options[:openstack_api_key]},\"\\\n \" username: #{@options[:openstack_username]},\"\\\n \" auth_url: #{@options[:openstack_auth_url]},\"\\\n \" tenant: #{@options[:openstack_tenant]})\"\n end\n end",
"def operation\n @operation ||= operation_class.new(current_user, params_for_action)\n end",
"def snapshot()\n puts \"TODO\"\n end",
"def create_snapshot(snap_id, snap_name)\n memory_dumps = true\n memory_dumps = CONFIG[:memory_dumps] \\\n unless CONFIG[:memory_dumps].nil?\n\n snapshot_hash = {\n :name => snap_id,\n :description => \"OpenNebula Snapshot: #{snap_name}\",\n :memory => memory_dumps,\n :quiesce => true\n }\n\n begin\n @item.CreateSnapshot_Task(snapshot_hash).wait_for_completion\n rescue StandardError => e\n error = \"Cannot create snapshot for VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n\n snap_id\n end",
"def create_snapshots(isCopy)\n ec2 = AWS::EC2.new.client\n\n #get all volumes tagged as \"backup\"\n volumes = ec2.describe_volumes(:filters => [:name => 'tag-key', :values => ['backup']])\n snapshots = []\n\n #loop thru and create snapshots for all these volumes\n if volumes \n volumes.data[:volume_set].each do |v|\n name = get_tagvalue(v, \"Name\")\n snap = ec2.create_snapshot(:volume_id => v[:volume_id], :description => \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n if snap\n snapshots << snap.data\n #add name tag\n ec2.create_tags(:resources => [snap.data[:snapshot_id]], :tags => [{:key => \"Name\", :value => name + \" backup\"}])\n\n #now copy snapshots to another region\n if isCopy\n copy_snapshot(snap.data[:snapshot_id], AWSCONFIG[:default_region], AWSCONFIG[:backup_region], \n name + \" backup\", \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n end\n end\n end\n end\n\n return snapshots\n end",
"def repository\n OpenStruct.new.tap do |r|\n r.count_all = 57\n r.count_filtered = 32\n r.paginated_data = [OpenStruct.new(name: 'foo', age: 21),\n OpenStruct.new(name: 'bar', age: 12)]\n end\n end",
"def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[documentChanges resourceOperations failureHandling]\n end",
"def initialize(attributes)\n @attributes = attributes\n @photos = PhotoSet.new\n end",
"def create_snapshot request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_snapshot_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def operations\n operation_classes.each_with_object({}) do |operation, hash|\n hash[operation.key] = operation.new\n end\n end",
"def initialize(repo, range, commit)\n super repo, range\n\n @additions = commit.stats.additions\n @authored_date = commit.authored_date\n @committed_date = commit.committed_date\n @deletions = commit.stats.deletions\n @id = commit.id\n @message = commit.message\n\n authors = repo.authors range\n @author = authors[Actor.id_for commit.author]\n @author = Actor.new repo, commit.author if author.nil?\n @author.add_commit self\n\n committers = repo.committers range\n @committer = committers[Actor.id_for commit.committer]\n @committer = Actor.new repo, commit.committer if @committer.nil?\n @committer.add_commit self\n\n @added_files = []\n @modified_files = []\n @deleted_files = []\n commit.diffs.each do |diff|\n if diff.new_file\n @added_files << diff.b_path\n elsif diff.deleted_file\n @deleted_files << diff.b_path\n elsif diff.renamed_file\n @added_files << diff.b_path\n @deleted_files << diff.a_path\n else\n @modified_files << diff.b_path\n end\n end\n end",
"def initialize\n @configuration = RepositoryConfiguration.new\n end",
"def create_operations_processor\n JSONAPI::ActiveRecordOperationsProcessor.new\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def storage_instance=(_arg0); end",
"def define_operations\n # Starting point of potential difference (end of last match, or start\n # of string)\n @position_in_old = @position_in_new = 0\n @operations = []\n\n @matching_blocks.each do |match|\n create_operation_from(match)\n end\n end",
"def initialize(op, lhs, rhs)\n @args = [lhs, rhs]\n @op = op\n end",
"def create_snapshot(snapshot_name)\n execute(:create_snapshot, VmId: vm_id, SnapName: snapshot_name)\n end",
"def initialize(options = {}, &block)\n service_options = options.clone\n client_config = service_options[:client] ||= Azure::Storage::Common::Client::create(service_options, &block)\n @user_agent_prefix = service_options[:user_agent_prefix] if service_options[:user_agent_prefix]\n @api_version = service_options[:api_version] || Azure::Storage::Table::Default::STG_VERSION\n signer = service_options[:signer] || client_config.signer || Auth::SharedKey.new(client_config.storage_account_name, client_config.storage_access_key)\n signer.api_ver = @api_version if signer.is_a? Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner\n super(signer, client_config.storage_account_name, service_options, &block)\n @storage_service_host[:primary] = client.storage_table_host\n @storage_service_host[:secondary] = client.storage_table_host true\n end",
"def create_snap # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function\n uri = URI.parse(url)\n #account = '/Compute-' + @id_domain + '/' + @user\n account = '/Compute-' + id_domain + '/cloud_storage'\n create_data = Hash.new\n create_data = { 'account' => account, 'instance' => container }\n create_data['machineimage'] = @machine_image if !@machine_image.nil?\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field 'Cookie', authcookie\n request.add_field 'Content-type', 'application/oracle-compute-v3+json'\n http.request(request, create_data.to_json)\n end",
"def initialize\n create_new_rep\n end",
"def initialize(location)\n # variables\n @users = {} # hash of users (key) with corresponding permissions (value)\n @current_revision = MemoryRevision.new(1) # the latest revision (we start from 1)\n @revision_history = [] # a list (array) of old revisions (i.e. < @current_revision)\n @repository_location = location\n @closed = false\n @@repositories[location] = self # push new MemoryRepository onto repository list\n end",
"def initialize(blob, commit, path)\n @blob, @commit, @path = blob, commit, path\n end",
"def initialize opts={}\n @refresh = opts[:refresh]\n @path = opts[:path]\n @clone = opts[:clone]\n @master = opts.fetch :master, false\n\n if @refresh\n refresh\n else\n update_branches\n update_tags\n end\n end",
"def initialize\n @commands = Hash.new\n @commands = {\n :add_repository => nil,\n :info => nil,\n :install => nil,\n :search => nil,\n :update => nil,\n :upgrade => nil\n }\n\n set_commands\n end",
"def create_snapshot(volume_id, options = {})\n action = 'CreateSnapshot'\n params = {\n 'Action' => action,\n 'VolumeId' => volume_id\n }\n params['Description'] = options[:description] unless options[:description].blank?\n\n response = send_query_request(params)\n parser = Awsum::Ec2::SnapshotParser.new(self)\n snapshot = parser.parse(response.body)[0]\n if options[:tags] && options[:tags].size > 0\n create_tags snapshot.id, options[:tags]\n end\n snapshot\n end",
"def create_snapshot(droplet) # rubocop:disable MethodLength,Metrics/AbcSize\n fail_if_shutdown(droplet)\n\n logger.info \"Start creating snapshot for droplet id: #{droplet.id} name: #{droplet.name}.\"\n\n today = DateTime.now\n name = \"#{droplet.name}_#{today.strftime('%Y_%m_%d')}\"\n # noinspection RubyResolve\n snapshot_size = api.snapshots(droplet).size\n\n logger.debug 'Wait until snapshot will be created.'\n\n api.create_snapshot droplet.id, name\n\n snapshot_size += 1\n\n logger.info \"Snapshot name: #{name} created successfully.\"\n logger.info \"Droplet id: #{droplet.id} name: #{droplet.name} snapshots: #{snapshot_size}.\"\n\n # Cleanup snapshots.\n cleanup_snapshots droplet, snapshot_size if clean\n rescue => e\n case e.class.to_s\n when 'DoSnapshot::SnapshotCleanupError'\n raise e.class, e.message, e.backtrace\n when 'DoSnapshot::DropletPowerError'\n return\n else\n raise SnapshotCreateError.new(droplet.id), e.message, e.backtrace\n end\n end",
"def initialize()\n @metadata = Hash.new()\n return self\n end",
"def clone\n return self.class.new(RAtlas::clone(@storage))\n end",
"def initialize(aki, sak, region, prefix, instance_id = open(\"http://169.254.169.254/latest/meta-data/instance-id\").read)\n\n @instance_id = instance_id\n @prefix = prefix\n\n @compute = Fog::Compute.new({:provider => 'AWS', :aws_access_key_id => aki, :aws_secret_access_key => sak, :region => region })\n end",
"def create_blob_snapshot(container, blob, options={})\n query = { 'comp' => 'snapshot'}\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n unless options.empty?\n add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n\n headers['If-Modified-Since'] = options[:if_modified_since] if options[:if_modified_since]\n headers['If-Unmodified-Since'] = options[:if_unmodified_since] if options[:if_unmodified_since]\n headers['If-Match'] = options[:if_match] if options[:if_match]\n headers['If-None-Match'] = options[:if_none_match] if options[:if_none_match]\n end\n\n response = call(:put, uri, nil, headers)\n\n response.headers['x-ms-snapshot']\n end",
"def get_snapshots\n ensure_uri && ensure_client\n uri = \"#{@data['uri']}/snapshots\"\n self.class.find_with_pagination(@client, uri)\n end",
"def create_snapshot(device, options = {})\n # TODO - add in new param commit=explicit once the API is availible\n params = {:device => device, \n :suffix => options[:suffix], \n :description => options[:description], \n :tag => options[:tag],\n :max_snaps => options[:max_snaps],\n :prefix_override => options[:prefix_override],\n :commit => \"explicit\",\n :api_version => 1.0}\n # Perform API call to snapshot the volume attached to the device on the instance\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n #STDERR.puts \"HERE IS THE URL: #{@api_url}/create_ebs_snapshot.js (PARAMS: #{params.inspect})\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_snapshot.js\",params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAP: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_snapshot(#{device}, #{options.inspect})\")\n end",
"def snapshots\n Fission::Action::Snapshot::Lister.new(self).snapshots\n end",
"def initialize(location, op=nil, time=nil)\n @location = location\n @op = op\n @time = (time || Time.now).utc\n end",
"def apply_snapshot(snapshot)\n raise \"apply_snapshot not implemented in #{self}\"\n end",
"def operations\n @operations.dup\n end",
"def operations\n @operations.dup\n end",
"def initialize(context)\n super()\n @context = Hashie::Mash.new(context)\n @repository_info = @context.repository\n release_request_info = @context.release\n @event_created_at = @context.released_at\n @event_user_info = release_request_info.try(:author)\n @release_tag = release_request_info.try(:tag_name)\n @release_application_id = release_request_info.try(:id)\n @commit_info = release_request_info.try(:commits)\n @created_commits = Commit.none\n @release = Release.new\n end",
"def initialize(model, storage_id = nil, &block)\n super(model, storage_id)\n\n @path ||= 'backups'\n\n instance_eval(&block) if block_given?\n end",
"def setup_snapshots(snapshots)\n snapshots && snapshots.each do |s|\n PeriodicTask.new(s[1]) { take_snapshot(s[0]) }\n end\n end",
"def createNewSnapshot\n snap_id = @deploy.getResourceName(@config[\"name\"]) + Time.new.strftime(\"%M%S\").to_s\n\n attempts = 0\n begin\n MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_snapshot(\n cache_cluster_id: @config[\"identifier\"],\n snapshot_name: snap_id\n )\n rescue Aws::ElastiCache::Errors::InvalidCacheClusterState => e\n if attempts < 10\n MU.log \"Tried to create snapshot for #{@config[\"identifier\"]} but cache cluster is busy, retrying a few times\"\n attempts += 1\n sleep 30\n retry\n else\n raise MuError, \"Failed to create snpashot for cache cluster #{@config[\"identifier\"]}: #{e.inspect}\"\n end\n end\n \n attempts = 0\n loop do\n MU.log \"Waiting for snapshot of cache cluster #{@config[\"identifier\"]} to be ready...\", MU::NOTICE if attempts % 20 == 0\n MU.log \"Waiting for snapshot of cache cluster #{@config[\"identifier\"]} to be ready...\", MU::DEBUG\n\n snapshot_resp = MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).describe_snapshots(snapshot_name: snap_id)\n attempts += 1\n break unless snapshot_resp.snapshots.first.snapshot_status != \"available\"\n sleep 15\n end\n\n return snap_id\n end",
"def initialize\n @rwlock = ReadWriteLock.new\n \n @rwlock.write {\n @connection = nil\n @specification = nil\n @taskbox = TaskStack.new\n }\n end",
"def initialize source:, example_mode:, example_num:, ig_name:\n @source = source\n @failures, @successes = [], []\n @example_num = example_num\n @ig_name = ig_name\n\n if File.exist? @source\n @json_data = JSON.parse(File.read(@source))\n else\n puts \"FILE NOT FOUND #{@source}\"\n return\n end\n snapshot = @json_data.dig(\"snapshot\", \"element\").dup\n @resource_name = @json_data[\"type\"]\n @resource_id = @json_data[\"id\"]\n\n # Look for complex data types to add into the snapshot.\n snapshot_with_types = clean_snapshot snapshot\n\n @example = FieldSet.new(name: @resource_name, \n full_name: @resource_name, \n snapshot: snapshot_with_types, \n example_mode: example_mode,\n parent: self\n )\n end",
"def createRDSSnapshot(client=nil,db_instance=nil,snapshot_name=nil,tags=[])\n return false if db_instance.nil? || client.nil?\n if snapshot_name.nil?\n snapshot_name=\"#{db_instance}-#{Time.now.to_i}\"\n end\n unless tags.instance_of? Array\n puts \"\\e[31mtags must be an Array\\e[0m\"\n return false\n end\n begin\n puts \"\\e[32mTaking snapshot of db instance #{db_instance}. Snapshot will be named #{snapshot_name}\\e[0m\"\n resp = client.create_db_snapshot({\n db_snapshot_identifier: snapshot_name,\n db_instance_identifier: db_instance,\n tags: tags\n })\n rescue Exception => e\n puts \"\\e[31m#{e.message}\\e[0m\"\n return false\n end\n return resp\nend",
"def volume_create_from_snap(source, name, snapshot_id)\n retries = 3\n begin \n @log.info \"Creating volume #{name} from snapshot id #{snapshot_id}...\"\n ret = @cloud_stack.create_volume(name, ZONE, nil, snapshot_id)\n id = ret[\"createvolumeresponse\"][\"jobid\"]\n wait_for_job id\n rescue Exception => e\n retries -= 1\n if retries > 0\n @log.error \"Failed. #{e.message}. Retrying...\"\n retry\n end\n raise e\n end\n vol_id = ret[\"createvolumeresponse\"][\"id\"]\n @log.info \"Created volume id: #{vol_id}\"\n vol_id\n end",
"def initialize(options)\n @options = normalize_options(options)\n\n validate_options\n initialize_registry\n\n @logger = Bosh::Clouds::Config.logger\n\n @agent_properties = @options.fetch('agent', {})\n openstack_properties = @options['openstack']\n @default_key_name = openstack_properties['default_key_name']\n @default_security_groups = openstack_properties['default_security_groups']\n @default_volume_type = openstack_properties['default_volume_type']\n @stemcell_public_visibility = openstack_properties['stemcell_public_visibility']\n @boot_from_volume = openstack_properties['boot_from_volume']\n @use_dhcp = openstack_properties['use_dhcp']\n @human_readable_vm_names = openstack_properties['human_readable_vm_names']\n @enable_auto_anti_affinity = openstack_properties['enable_auto_anti_affinity']\n @use_config_drive = !!openstack_properties.fetch('config_drive', false)\n @config_drive = openstack_properties['config_drive']\n\n @openstack = Bosh::OpenStackCloud::Openstack.new(@options['openstack'])\n\n @az_provider = Bosh::OpenStackCloud::AvailabilityZoneProvider.new(\n @openstack,\n openstack_properties['ignore_server_availability_zone'],\n )\n\n @metadata_lock = Mutex.new\n\n @instance_type_mapper = Bosh::OpenStackCloud::InstanceTypeMapper.new\n end",
"def initialize(options={})\n WorkSnaps.keys.each do |key|\n instance_variable_set(:\"@#{key}\", options[key] || WorkSnaps.instance_variable_get(:\"@#{key}\"))\n end\n end",
"def initialize(host, operation, client)\n @host = host\n @operation = operation\n @roomorama_client = client\n end",
"def initialize(host, operation, client)\n @host = host\n @operation = operation\n @roomorama_client = client\n end",
"def initialize(document)\n @document, @parent = document, document._parent\n @insert_modifier, @delete_modifier =\"$push\", \"$pull\"\n end",
"def current_snapshot\n Filewatcher::Snapshot.new(\n expand_directories(@unexpanded_filenames) -\n expand_directories(@unexpanded_excluded_filenames)\n )\n end",
"def operation(name, opts = {}, &block)\n raise DuplicateOperationException if @operations[name]\n @operations[name] = Operation.new(self, name, opts, &block)\n end",
"def initialize(opts = {})\n super(qualified_key: opts[:qualified_key], type: opts[:type], service_instance: opts[:service_instance])\n @impacted_files = opts[:impacted_files]\n\n # The object attributes are\n # @added - array, possibly empty, of Diff::Element::Add objects\n # @deleted - array, possibly empty, of Diff::Element::Delete objects\n # @modified - array, possibly empty, of Diff objects\n if diff_set = opts[:diff_set]\n @added = diff_set.added\n @deleted = diff_set.deleted\n @modified = diff_set.modified\n else\n triplet = opts[:triplet] || [[], [], []]\n @added = triplet[0] || []\n @deleted = triplet[1] || []\n @modified = triplet[2] || []\n end\n\n end",
"def initialize\n super\n @actions = [].freeze\n @prepared = false\n @context = Context.new(stack: self)\n @hooks = Hooks.new(stack: self)\n @started = false\n @parallel = false\n end",
"def create\n @snapshot = current_account.snapshots.new(params[:snapshot])\n\n respond_to do |format|\n if @snapshot.save\n flash[:notice] = 'Snapshot was successfully created.'\n format.html { redirect_to(@snapshot) }\n format.xml { render :xml => @snapshot, :status => :created, :location => @snapshot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def initialize(name, options={})\n @name = name\n @log_name = \"#{@name}.log\"\n @tar_name = \"#{@name}.tar\"\n @idx_name = \"#{@name}.idx\"\n @jlog_name = \"#{@name}.jlog\"\n @lock_name = \"#{@name}.lock\"\n\n @commit_lock = Mutex.new\n @state_lock = Mutex.new\n @panic = false\n @shutdown = false\n\n @cnum_lock = Mutex.new\n @saved_change_number = nil\n\n init_options(options)\n\n init_completed = false\n read_only = @read_only && @read_only != :standby\n begin\n @flock = FileLock.new(@lock_name, read_only)\n if (read_only) then\n @flock.read_lock\n else\n @flock.write_lock\n end\n\n @logger = @Logger.call(@log_name)\n @logger.info(\"storage open start...\")\n if (read_only) then\n @logger.info(\"get file lock for read\")\n else\n @logger.info(\"get file lock for write\")\n end\n\n @logger.info format('block format version: 0x%04X', Block::FMT_VERSION)\n @logger.info(\"journal log hash type: #{@jlog_hash_type}\")\n @logger.info(\"index format version: #{Index::MAJOR_VERSION}.#{Index::MINOR_VERSION}\")\n @logger.info(\"storage data hash type: #{@data_hash_type}\")\n @logger.info(\"storage properties cksum type: #{PROPERTIES_CKSUM_TYPE}\")\n\n @logger.info(\"properties cache type: #{@properties_cache.class}\")\n @properties_cache = SharedWorkCache.new(@properties_cache) {|key|\n value = read_record_body(key, :p) and decode_properties(key, value)\n }\n\n unless (read_only) then\n begin\n w_io = File.open(@tar_name, File::WRONLY | File::CREAT | File::EXCL, 0660)\n @logger.info(\"create and open I/O handle for write: #{@tar_name}\")\n rescue Errno::EEXIST\n @logger.info(\"open I/O handle for write: #{@tar_name}\")\n w_io = File.open(@tar_name, File::WRONLY, 0660)\n end\n w_io.binmode\n w_io.set_encoding(Encoding::ASCII_8BIT)\n @w_tar = Tar::ArchiveWriter.new(w_io)\n end\n\n @logger.info(\"build I/O handle pool for read.\")\n @r_tar_pool = Pool.new(@number_of_read_io) {\n r_io = Tar::RawIO.open(@tar_name, File::RDONLY)\n @logger.info(\"open I/O handle for read: #{@tar_name}\")\n Tar::ArchiveReader.new(r_io)\n }\n\n @index = Index.new\n if (File.exist? @idx_name) then\n @logger.info(\"load index: #{@idx_name}\")\n @index.load(@idx_name)\n unless (@index.storage_id) then # for migration to new index format of version 0.2 from old version\n @index.storage_id = create_storage_id\n @logger.info(\"save storage id: #{@index.storage_id}\")\n @index.save(@idx_name)\n end\n else\n @index.storage_id = create_storage_id\n @logger.info(\"save storage id: #{@index.storage_id}\")\n @index.save(@idx_name)\n end\n if (JournalLogger.need_for_recovery? @jlog_name) then\n recover\n end\n unless (read_only) then\n @logger.info(\"journal log sync mode: #{@jlog_sync}\")\n @logger.info(\"open journal log for write: #{@jlog_name}\")\n @jlog = JournalLogger.open(@jlog_name, @jlog_sync, @jlog_hash_type)\n end\n\n init_completed = true\n ensure\n if (init_completed) then\n @logger.info(\"completed storage open.\")\n else\n @panic = true\n\n if ($! && @logger) then\n begin\n @logger.error($!)\n rescue\n # ignore error\n end\n end\n\n if (@jlog_rotate_service) then\n begin\n @jlog_rotate_service.stop_service\n rescue\n # ignore error\n end\n end\n\n unless (read_only) then\n if (@jlog) then\n begin\n @jlog.close(false)\n rescue\n # ignore error\n end\n end\n end\n\n if (@r_tar_pool) then\n @r_tar_pool.shutdown{|r_tar|\n begin\n r_tar.close\n rescue\n # ignore errno\n end\n }\n end\n\n unless (read_only) then\n if (@w_tar) then\n begin\n @w_tar.close(false)\n rescue\n # ignore error\n end\n end\n end\n\n if (@logger) then\n begin\n @logger.fatal(\"abrot storage open.\")\n @logger.close\n rescue\n # ignore error\n end\n end\n\n if (@flock) then\n begin\n @flock.close\n rescue\n # ignore error\n end\n end\n end\n end\n end",
"def build_operation(options = {})\n double(:operation, {\n execute: true,\n metadata: {},\n trailing_metadata: {},\n deadline: Time.now.to_i + 600,\n cancelled?: false,\n execution_time: rand(1_000..10_000)\n }.merge(options))\n end",
"def build_operation(options = {})\n double(:operation, {\n execute: true,\n metadata: {},\n trailing_metadata: {},\n deadline: Time.now.to_i + 600,\n cancelled?: false,\n execution_time: rand(1_000..10_000)\n }.merge(options))\n end",
"def initialize(options = {}, &block)\n service_options = options.clone\n client_config = service_options[:client] ||= Azure::Storage::Common::Client::create(service_options, &block)\n @user_agent_prefix = service_options[:user_agent_prefix] if service_options[:user_agent_prefix]\n @api_version = service_options[:api_version] || Azure::Storage::File::Default::STG_VERSION\n signer = service_options[:signer] || client_config.signer || Azure::Storage::Common::Core::Auth::SharedKey.new(client_config.storage_account_name, client_config.storage_access_key)\n signer.api_ver = @api_version if signer.is_a? Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner\n super(signer, client_config.storage_account_name, service_options, &block)\n @storage_service_host[:primary] = client.storage_file_host\n @storage_service_host[:secondary] = client.storage_file_host true\n end",
"def initialize(model, &block)\n super(model)\n\n @only_collections ||= Array.new\n @additional_options ||= Array.new\n @ipv6 ||= false\n @lock ||= false\n\n instance_eval(&block) if block_given?\n\n @mongodump_utility ||= utility(:mongodump)\n @mongo_utility ||= utility(:mongo)\n end",
"def initialize( config, template_factory, uri )\n\t\t@config\t\t\t\t= config\n\t\t@template_factory\t= template_factory\n\t\t@uri\t\t\t\t= uri\n\n\t\t@signature\t\t\t= self.class.signature.dup\n\t\t@run_count\t\t\t= 0\n\t\t@total_utime\t\t= 0\n\t\t@total_stime\t\t= 0\n\n\t\t# Make a regexp out of all public <something>_action methods\n\t\t@actions = self.public_methods( true ).\n\t\t\tselect {|meth| /^(\\w+)_action$/ =~ meth }.\n\t\t\tcollect {|meth| meth.gsub(/_action/, '') }\n\t\t@actions_regexp\t= Regexp.new( \"^(\" + actions.join( '|' ) + \")$\" )\n\tend",
"def init\n return unless GalleryConfig.storage.track_revisions && !GalleryConfig.storage.database_notebooks\n Rails.logger.debug('Initializing git repo')\n gitify_all_notebooks\n commit_id = GitRepo.init\n Notebook.find_in_batches(batch_size: 100) do |batch|\n revisions = batch.map {|nb| Revision.from_notebook(nb, 'initial', commit_id)}\n Revision.import(revisions, validate: false)\n end\n Rails.logger.debug('Initializing git repo complete')\n end"
] |
[
"0.60971373",
"0.6010111",
"0.58373743",
"0.57937086",
"0.56721276",
"0.5568523",
"0.54883784",
"0.547017",
"0.5396341",
"0.536269",
"0.53358746",
"0.5322654",
"0.5315434",
"0.5293061",
"0.5268752",
"0.5233057",
"0.5207205",
"0.5199257",
"0.5197871",
"0.51711124",
"0.51641476",
"0.5147045",
"0.5130006",
"0.51219416",
"0.5113033",
"0.511139",
"0.50999635",
"0.5096173",
"0.5090834",
"0.50851375",
"0.5031447",
"0.50305074",
"0.5029717",
"0.5025196",
"0.5025129",
"0.50134194",
"0.50093067",
"0.4979347",
"0.49747217",
"0.49687207",
"0.49605626",
"0.49402645",
"0.49156725",
"0.4913717",
"0.4912251",
"0.4911915",
"0.49113885",
"0.4902658",
"0.48959604",
"0.48890036",
"0.48799038",
"0.48791516",
"0.48744586",
"0.48662335",
"0.4858871",
"0.48517612",
"0.4843027",
"0.4840059",
"0.48353845",
"0.48317277",
"0.4827795",
"0.48269272",
"0.48187283",
"0.48170117",
"0.47958437",
"0.47874352",
"0.47725365",
"0.4772428",
"0.4770326",
"0.47700602",
"0.47660077",
"0.47644788",
"0.4758251",
"0.47537982",
"0.47482497",
"0.47482497",
"0.47479054",
"0.47438377",
"0.474258",
"0.4737273",
"0.4735287",
"0.47324413",
"0.4731639",
"0.4715171",
"0.47139254",
"0.47129184",
"0.4709569",
"0.4709569",
"0.47078186",
"0.47057596",
"0.47057346",
"0.47021025",
"0.46991134",
"0.46941847",
"0.46848089",
"0.4668678",
"0.4668678",
"0.4658806",
"0.46551847",
"0.4651393",
"0.46494856"
] |
0.0
|
-1
|
Given a string or an IO object, this will attempt a parse of its contents and return a result. If the parse fails, a Parslet::ParseFailed exception will be thrown.
|
def parse(io)
if io.respond_to? :to_str
io = StringIO.new(io)
end
result = apply(io)
# If we haven't consumed the input, then the pattern doesn't match. Try
# to provide a good error message (even asking down below)
unless io.eof?
# Do we know why we stopped matching input? If yes, that's a good
# error to fail with. Otherwise just report that we cannot consume the
# input.
if cause
raise Parslet::ParseFailed, "Unconsumed input, maybe because of this: #{cause}"
else
error(io, "Don't know what to do with #{io.string[io.pos,100]}")
end
end
return flatten(result)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse(io)\n source = Parslet::Source.new(io)\n context = Parslet::Atoms::Context.new\n \n result = nil\n value = apply(source, context)\n \n # If we didn't succeed the parse, raise an exception for the user. \n # Stack trace will be off, but the error tree should explain the reason\n # it failed.\n if value.error?\n parse_failed(value.message)\n end\n \n # assert: value is a success answer\n \n # If we haven't consumed the input, then the pattern doesn't match. Try\n # to provide a good error message (even asking down below)\n unless source.eof?\n # Do we know why we stopped matching input? If yes, that's a good\n # error to fail with. Otherwise just report that we cannot consume the\n # input.\n if cause \n # We're not using #parse_failed here, since it assigns to @last_cause.\n # Still: We'll raise this differently, since the real cause is different.\n raise Parslet::UnconsumedInput, \n \"Unconsumed input, maybe because of this: #{cause}\"\n else\n old_pos = source.pos\n parse_failed(\n format_cause(source, \n \"Don't know what to do with #{source.read(100)}\", old_pos), \n Parslet::UnconsumedInput)\n end\n end\n \n return flatten(value.result)\n end",
"def parse(string_or_io, options = T.unsafe(nil)); end",
"def parse(string_or_io, options = T.unsafe(nil)); end",
"def parse string_or_io, url = nil, encoding = nil, options = 2145, &block\n\n options = Nokogiri::XML::ParseOptions.new(options) if Fixnum === options\n # Give the options to the user\n yield options if block_given?\n\n if string_or_io.respond_to?(:read)\n url ||= string_or_io.respond_to?(:path) ? string_or_io.path : nil\n return Document.read_io(string_or_io, url, encoding, options.to_i)\n end\n\n # read_memory pukes on empty docs\n return Document.new if string_or_io.nil? or string_or_io.empty?\n\n Document.read_memory(string_or_io, url, encoding, options.to_i)\n end",
"def get_parse(s);end",
"def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(io_or_str)\n reader = wrap_io_or_string(io_or_str)\n # Use multiple_expressions = true so that the top-level parsed script\n # is always an array of expressions\n parse_expr(reader, stop_char = nil, stack_depth = 0, multiple_expressions = true)\n end",
"def parse(str); end",
"def parse(string, options = {}, &block)\n file = StringIO.new(string)\n _read file, options, &block\n end",
"def pr str='', &blk\n err=nil\n begin\n if block_given?\n result = yield\n else\n result = interpret str\n end\n rescue Parslet::ParseFailed => err\n end\n [result, err]\nend",
"def parse(string = nil)\n if self.file =~ /\\.rb$/\n main = parse_ruby_file\n else\n self.string = string if string\n begin\n @yydebug = false\n main = yyparse(@lexer,:scan)\n rescue Racc::ParseError => except\n error = Puppet::ParseError.new(except)\n error.line = @lexer.line\n error.file = @lexer.file\n error.set_backtrace except.backtrace\n raise error\n rescue Puppet::ParseError => except\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue Puppet::Error => except\n # and this is a framework error\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue Puppet::DevError => except\n except.line ||= @lexer.line\n except.file ||= @lexer.file\n raise except\n rescue => except\n error = Puppet::DevError.new(except.message)\n error.line = @lexer.line\n error.file = @lexer.file\n error.set_backtrace except.backtrace\n raise error\n end\n end\n # Store the results as the top-level class.\n return Puppet::Parser::AST::Hostclass.new('', :code => main)\n ensure\n @lexer.clear\n end",
"def parse_string(content, ptype = T.unsafe(nil)); end",
"def parse(str)\n mini = MiniP.new\n transf = MiniT.new\n\n transf.apply(\n mini.parse(str)\n )\nrescue Parslet::ParseFailed => failure\n puts failure.parse_failure_cause.ascii_tree\nend",
"def parse(options = {})\n options[:file] || options[:string] || (raise ParsleyError.new(\"must specify what to parse\"))\n \n options[:sgwrap] = !!options[:sgwrap]\n options[:is_file] = !!options[:file]\n options[:has_base] = !!options[:base]\n \n options[:base] = options[:base].to_s\n options[:file] = options[:file].to_s\n options[:string] = options[:string].to_s\n \n options[:input] ||= :html\n options[:output] ||= :ruby\n \n options[:collate] = true unless options.has_key?(:collate)\n options[:prune] = true unless options.has_key?(:prune)\n options[:allow_net] = true unless options.has_key?(:allow_net)\n options[:allow_local] = true unless options.has_key?(:allow_local)\n \n options[:collate] = !!options[:collate]\n options[:prune] = !!options[:prune]\n options[:allow_net] = !!options[:allow_net]\n options[:allow_local] = !!options[:allow_local]\n \n @parsley.parse(options)\n end",
"def parse text\n raise \"No parser defined for #{self.class}\"\n end",
"def parse(arg = nil, puts_enabled: false)\n result = ''\n reader_initializer = reader_initializer_class.new(arg)\n errors = error_validator_class.new(arg, reader_initializer).validate\n\n on_success(errors) do\n result = prepare_result(reader_initializer)\n end\n\n on_failure(errors) do\n result = prepare_errors(errors)\n end\n\n puts result if puts_enabled\n result\n end",
"def call(string)\n match = syntax_parser.call(string)\n front_matter, content =\n if match\n [loader.call(match[:front_matter]), match[:content]]\n else\n [{}, string]\n end\n Parsed.new(front_matter: front_matter, content: content)\n end",
"def parse\n fail StandardError.new('parse has not been implemented.')\n end",
"def parse(io, options = T.unsafe(nil)); end",
"def parse str\n self.ss = scanner_class.new str\n self.state ||= nil\n\n do_parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.state ||= nil\n\n do_parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.state ||= nil\n\n do_parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.state ||= nil\n\n do_parse\n end",
"def parse(str, offset=0)\n raise NotImplementedError\n end",
"def parse(text); end",
"def parse(string_or_io, options = nil)\n ##\n # When the current node is unparented and not an element node, use the\n # document as the parsing context instead. Otherwise, the in-context\n # parser cannot find an element or a document node.\n # Document Fragments are also not usable by the in-context parser.\n if !element? && !document? && (!parent || parent.fragment?)\n return document.parse(string_or_io, options)\n end\n\n options ||= (document.html? ? ParseOptions::DEFAULT_HTML : ParseOptions::DEFAULT_XML)\n if Integer === options\n options = Nokogiri::XML::ParseOptions.new(options)\n end\n # Give the options to the user\n yield options if block_given?\n\n contents = string_or_io.respond_to?(:read) ?\n string_or_io.read :\n string_or_io\n\n return Nokogiri::XML::NodeSet.new(document) if contents.empty?\n\n # libxml2 does not obey the `recover` option after encountering errors during `in_context`\n # parsing, and so this horrible hack is here to try to emulate recovery behavior.\n #\n # Unfortunately, this means we're no longer parsing \"in context\" and so namespaces that\n # would have been inherited from the context node won't be handled correctly. This hack was\n # written in 2010, and I regret it, because it's silently degrading functionality in a way\n # that's not easily prevented (or even detected).\n #\n # I think preferable behavior would be to either:\n #\n # a. add an error noting that we \"fell back\" and pointing the user to turning off the `recover` option\n # b. don't recover, but raise a sensible exception\n #\n # For context and background: https://github.com/sparklemotion/nokogiri/issues/313\n # FIXME bug report: https://github.com/sparklemotion/nokogiri/issues/2092\n error_count = document.errors.length\n node_set = in_context(contents, options.to_i)\n if (node_set.empty? && (document.errors.length > error_count))\n if options.recover?\n fragment = Nokogiri::HTML4::DocumentFragment.parse contents\n node_set = fragment.children\n else\n raise document.errors[error_count]\n end\n end\n node_set\n end",
"def parse_string (pdef)\n\n pdef = pdef.strip\n\n return parse_xml(pdef) if pdef.match(X_START)\n return YAML.load(pdef) if pdef.match(Y_START)\n\n #(json = (OpenWFE::Json.from_json(pdef) rescue nil)) and return json\n return OpenWFE::Json.from_json(pdef) if pdef.match(J_ARRAY)\n\n #\n # else it's some ruby code to eval\n\n get_tree_checker.check(pdef)\n\n # no exception, green for eval...\n\n ProcessDefinition.eval_ruby_process_definition(pdef)\n end",
"def parse(str)\n RubyParser.new.parse(str.deep_clone)\n end",
"def parse\n return parse_text unless @text.nil?\n return parse_file unless @file.nil? && @file_name.nil?\n return false\n end",
"def parse(str)\n DEFAULT_PARSER_CHAIN.parse(str)\n end",
"def parse(string, usage)\n companion.parse(string, usage)\n end",
"def parse(io_or_string)\n io = io_or_string\n if io.is_a?(String)\n io = ProtocolBuffers.bin_sio(io)\n end\n Decoder.decode(io, self)\n return self\n end",
"def wrap_io_or_string(io_or_str)\n return io_or_str if io_or_str.respond_to?(:read_one_char) # Bychar or R\n return R.new(io_or_str) if io_or_str.respond_to?(:read)\n R.new(StringIO.new(io_or_str))\n end",
"def parse!(str)\n scanner = StringScanner.new(str)\n begin\n while (!scanner.eos?)\n start_pos = scanner.pos\n send(:\"parse_#{@state}\", scanner)\n if (scanner.pos == start_pos)\n # if we didn't move forward, we've run out of useful string so throw it back.\n return str\n end\n end\n ensure\n # clear out whatever we managed to scan.\n str[0, scanner.pos] = \"\"\n end\n end",
"def parse str\n self.ss = scanner_class.new str\n self.lineno = 1\n self.start_of_current_line_pos = 0\n self.state ||= nil\n\n do_parse\n end",
"def parse str\n self.ss = scanner_class.new str\n self.lineno = 1\n self.start_of_current_line_pos = 0\n self.state ||= nil\n\n do_parse\n end",
"def parse(string)\n @string = string\n ast = parse_string string\n show_syntax_error unless ast\n ast\n end",
"def safe_parse\r\n handle_exception { parse }\r\n end",
"def read(str_or_io)\n io = to_io(str_or_io)\n return self if io.eof?\n\n self[:type].read io.read(4)\n self[:block_len].read io.read(4)\n self[:body].read io.read(self[:block_len].to_i - MIN_SIZE)\n read_blocklen2_and_check(io)\n\n self\n end",
"def subparse( str )\n parse( str )\n end",
"def maybe_parse(document)\n\n case document\n when String ; return YAML.load(document) # don't worry, if this raises we'll assume you've already parsed it\n else ; return document\n end\n\n rescue JSON::ParserError, Psych::SyntaxError\n return document\n end",
"def initialize(io_or_string)\n parser = GiftParser.new()\n case io_or_string\n when String\n # Add blank line to make sure we can parse.\n @root = parser.parse(io_or_string + \"\\n\\n\")\n when IO\n @root = parser.parse(io_or_string.read + \"\\n\\n\")\n end\n \n raise ArgumentError, \"Cannot parse GIFT input.\\nReason:\\n#{parser.failure_reason.inspect}\" if @root.nil?\n end",
"def parse(text, options = T.unsafe(nil)); end",
"def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(str)\n read_items(tokenize(str))\n end",
"def make_string raw_string\n ParsedString.new raw_string\n end",
"def parse_content(content); end",
"def try(text)\n type.coerce(text) if match?(text)\n end",
"def parse( name, str, serializer = _serializer(name) )\n# puts \"parse: _serializer(#{name}): #{serializer.inspect}\"\n serializer.to_val( str )\n rescue StandardError => e\n debug { \"parse: #{name} #{str} #{serializer}: error #{e.inspect}\" }\n nil\n end",
"def parse(thingy)\n parser.parse(thingy)\n end",
"def file_or_content(str)\n return str if str.nil?\n return str unless file_param? str\n\n content = File.read(str[1..-1])\n content\n end",
"def parse!(string)\n root, queue = build_tree string\n result = Lint.tree root\n FailedLint.new(result).validate!\n root\n end",
"def do_parse(string)\n raise 'This method should implement a string to hash parser'\n end",
"def parse_item(text)\n txt = %x{echo \\'#{text}\\' | ./parser}\n rc = $?.exitstatus\n [rc, txt]\nend",
"def parse_text(text)\n\n end",
"def parse(io)\n yy_parse(io)\n end",
"def parse(io, buffer_size = DEFAULT_BUFFER_SIZE)\n return enum_for(:parse, io, buffer_size) unless block_given?\n loop do\n buffer = read(io, buffer_size)\n break unless buffer\n buffer.each_char do |char|\n command = COMMAND_MAPPINGS[char]\n yield command if command\n end\n end\n end",
"def parse\n case (token = next_token)\n when '(' then parse_until_peek(')')\n when '{' then Any.new(parse_until_peek('}'))\n when '[' then All.new(parse_until_peek(']'))\n when /^\"/ then FindString.new(token[1..-2])\n when /^#\\w/ then MethodCall.new(token[1..-1])\n when /^\\.\\w[\\w\\d_]+\\?/ then InstanceMethodCall.new(token[1..-1])\n when '$' then Capture.new(parse)\n when '!' then (@tokens.any? ? Not.new(parse) : Find.new(token))\n when '?' then Maybe.new(parse)\n when '^' then Parent.new(parse)\n when '\\\\' then FindWithCapture.new(parse)\n when /^%\\d/ then FindFromArgument.new(token[1..-1])\n else Find.new(token)\n end\n end",
"def parse(io_or_str, &nuke_node_callback)\n raise LocalJumpError, \"NodeProcesssor#parse totally requires a block\" unless block_given?\n @node_handler = nuke_node_callback\n @parser.parse(io_or_str)\n end",
"def read_string; end",
"def eval_string(s)\n forms = __apply(:\"read-from-string\", [s])\n result = nil\n forms.each { |f| result = __apply(:eval, [f]) }\n result\n end",
"def parse_str(io, stop_quote)\n buf = ''\n loop do\n c = io.read_one_char\n if c.nil?\n raise Error, \"The IO ran out before the end of a literal string\"\n elsif buf.length > 0 && buf[-1..-1] == ESC # If this char was escaped\n # Trim the escape character at the end of the buffer\n buf = buf[0..-2] \n buf << c\n elsif c == stop_quote\n return buf\n else\n buf << c\n end\n end\n end",
"def parse\n raise NotImplementedError.new\n end",
"def parse(yarpl_problem)\n out, err = StringIO.new, StringIO.new\n previous_stderr, $stderr = $stderr, err\n previous_stdout, $stdout = $stdout, out\n\n tree = process_problem(yarpl_problem)\n error?(err)\n tree\n ensure\n $stderr = previous_stderr\n $stdout = previous_stdout\n end",
"def read_string\n\t\t\n\t\t# TODO: Add the ability to have escape characters.\n\t\tstart_char \t= @chars.next # Don't add quotation marks to the string value\n\t\tline_num \t= @chars.get_cur_line\n\t\tcol_num \t= @chars.get_cur_col\n\t\ttok_val \t= ''\n\n\t\twhile true\n\t\t\tbegin\n\t\t\t\tchar = @chars.peak\n\t\t\trescue EOFError\n\t\t\t\traise \"LEXER ERROR: At line: #{line_num}, col: #{col_num} >> String does not end.\"\n\t\t \t\treturn nil\n\t\t \tend\n\n\t\t \tif char == start_char\n\t\t \t\treturn Token.new(\"String\", tok_val, line_num, col_num)\n\t\t \tend\n\t\t \ttok_val += char\n\t\t \t@chars.next\n\t\tend\n\tend",
"def parse str = nil, type = nil\n if str and !str.empty? \n str.split( get_separator( type ) )\n elsif @items and !@items.empty?\n @items\n else\n raise ArgumentError.new \"Bad parameter passed to method!\"\n end\n end",
"def load(source, proc = nil, options = {})\n if source.respond_to? :to_str\n source = source.to_str\n elsif source.respond_to? :to_io\n source = source.to_io.read\n elsif source.respond_to?(:read)\n source = source.read\n end\n result = parse(source, options)\n recurse_proc(result, &proc) if proc\n result\n end",
"def parse\n raise NotImplementedError\n end",
"def parse(source); end",
"def convert(string)\n self.input= string\n retval = nil\n self.error = nil\n error_msgs = \"\"\n self.output = \"\"\n begin\n Open3.popen3(self.converter_call) do |stdin, stdout, stderr, wait_thr|\n stdin.puts(string)\n stdin.close\n if stderr.stat.size > 0\n stderr.each_line { |line| error_msgs << line }\n else\n stdout.each_line { |line| self.output << line }\n end\n retval = wait_thr.value\n self.output.chomp!\n end\n if (!retval.success?)\n Rails.logger.warn(error_msgs)\n if error_msgs.match(/^Error:/)\n error_msgs = error_msgs.scan(/^Error:(.*)$/).flatten.join(\" \")\n else\n error_msgs = \"Unknown converter error\"\n end\n error_msgs.strip! # remove surrounding whitespace\n # add a terminating period to the error message.\n error_msgs << \".\" unless error_msgs.split(\"\").last == \".\"\n raise ConvertError.new(error_msgs)\n end\n rescue Exception => e\n add_error(e)\n end\n return self\n end",
"def parse(source)\n call(source)\n rescue ::Slim::Parser::SyntaxError => e\n # Convert to our own exception type to isolate from upstream changes\n error = SlimLint::Exceptions::ParseError.new(e.error,\n e.file,\n e.line,\n e.lineno,\n e.column)\n raise error\n end",
"def read_string\n raise NotImplementedError\n end",
"def process_string(str)\r\n process(StringSource.new(str))\r\n end",
"def parse_expr str\n parse(str, @parser)\n end",
"def read(str)\n force_binary(str)\n return self if str.nil?\n self[:icmp_type].read(str[0,1])\n self[:icmp_code].read(str[1,1])\n self[:icmp_sum].read(str[2,2])\n self[:body].read(str[4,str.size])\n self\n end",
"def parse_input(params, resource); end",
"def parse(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def parse(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def parse\n case node.name\n when 'document'\n Plex::Parser.new(parent, node.root).parse\n when 'MediaContainer'\n parse_media_container\n when 'Video'\n parse_video\n when 'Directory'\n parse_directory\n when 'text'\n nil\n else\n end\n end",
"def read_from_string(buf)\n @lexer.stream_stash([FileIO.new(StringIO.new(buf), \"-\")])\n parse.each do |toplevel_ast|\n @gen.emit_toplevel(toplevel_ast)\n end\n @lexer.stream_unstash\n end",
"def test(string, options={})\n parse(string, options).length\n rescue ParseError\n nil\n end",
"def process(input = nil)\n if input.nil?\n input = STDIN\n end\n\n input.each_line do |line|\n detect_filename_in line\n parse line if @filename\n end\n\n if input.is_a? IO\n puts result_as(Suspiciouss::Result::PlainText)\n else\n result_as(Suspiciouss::Result::Markdown)\n end\n end",
"def parse(text)\n count = 1\n lines(text).collect do |line|\n count += 1\n if val = parse_line(line)\n val\n else\n error = Puppet::Error.new(\"Could not parse line #{line.inspect}\")\n error.line = count\n raise error\n end\n end\n end",
"def parse(thing, &block); end",
"def parse(thing, &block); end",
"def parse_string(code_string, source_file = nil)\n unless code_string.is_a?(String)\n raise ArgumentError, _(\"The argument 'code_string' must be a String, got %{type}\") % { type: code_string.class }\n end\n internal_evaluator.parse_string(code_string, source_file)\n end",
"def read_content(resource)\n case resource\n when '-'\n method(:read_stdin)\n when /\\A#{URI::DEFAULT_PARSER.make_regexp}\\z/\n method(:read_url)\n else\n method(:read_file)\n end.call(resource)\n end",
"def read(str)\n\t\t\tforce_binary(str)\n\t\t\treturn self if str.nil?\n\t\t\tself[:icmp_type].read(str[0,1])\n\t\t\tself[:icmp_code].read(str[1,1])\n\t\t\tself[:icmp_sum].read(str[2,2])\n\t\t\tself[:body].read(str[4,str.size])\n\t\t\tself\n\t\tend",
"def parse(str)\n parse!(str.dup)\n end",
"def parse(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def parse(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def read(opaque)\n if reader\n return reader.call(opaque)\n end\n\n if opaque.is_a?(String)\n return opaque\n end\n raise \"can't turn #{opaque.inspect} into string\"\n end",
"def gparse &blk\n begin\n yield\n rescue Parslet::ParseFailed => failure\n puts failure.parse_failure_cause.ascii_tree\n end\nend",
"def execute(value)\n unless value.kind_of?(String)\n raise ParseError.new(\"#{name}: #{value.inspect} must be kind of String\")\n end\n Executor.new(self, value).result\n end",
"def parse str = nil\n if str and !str.empty? \n str.split( _separator )\n elsif @items and !@items.empty?\n @items\n else\n raise ArgumentError.new \"Bad parameter passed to method!\"\n end\n end",
"def error(io, str, pos=nil)\n pre = io.string[0..(pos||io.pos)]\n lines = Array(pre.lines)\n \n if lines.empty?\n formatted_cause = str\n else\n pos = lines.last.length\n formatted_cause = \"#{str} at line #{lines.count} char #{pos}.\"\n end\n\n @last_cause = formatted_cause\n \n raise Parslet::ParseFailed, formatted_cause, nil\n end"
] |
[
"0.72174203",
"0.6852277",
"0.6852277",
"0.6703048",
"0.631334",
"0.6219154",
"0.6219154",
"0.6219154",
"0.6219154",
"0.61336005",
"0.61092764",
"0.6071023",
"0.6033791",
"0.5999352",
"0.5886984",
"0.5871687",
"0.5851328",
"0.5810459",
"0.5778697",
"0.569109",
"0.56814206",
"0.56671464",
"0.5650243",
"0.5650243",
"0.5650243",
"0.5650243",
"0.5649018",
"0.5636896",
"0.559192",
"0.55640835",
"0.5562786",
"0.5535044",
"0.5520612",
"0.55163527",
"0.5515995",
"0.5515037",
"0.54826146",
"0.5477981",
"0.5477981",
"0.5469319",
"0.5466003",
"0.5459569",
"0.5451252",
"0.53980714",
"0.53841937",
"0.5369767",
"0.53438056",
"0.53438056",
"0.53233725",
"0.5295191",
"0.52689147",
"0.5243869",
"0.5201861",
"0.51850265",
"0.5162356",
"0.5157998",
"0.515231",
"0.5151841",
"0.5136517",
"0.5126281",
"0.5123232",
"0.5122978",
"0.51200926",
"0.5114876",
"0.5113818",
"0.5112891",
"0.5091841",
"0.50883555",
"0.5084586",
"0.50721467",
"0.50612473",
"0.5053357",
"0.5048777",
"0.5026529",
"0.5017127",
"0.49981204",
"0.49895883",
"0.49848026",
"0.49774006",
"0.49645352",
"0.4958283",
"0.4958283",
"0.49575362",
"0.493641",
"0.49265188",
"0.4925706",
"0.49185622",
"0.49143606",
"0.49143606",
"0.4909088",
"0.4908214",
"0.49071273",
"0.48881176",
"0.488681",
"0.488681",
"0.48854288",
"0.48828357",
"0.4880615",
"0.48795864",
"0.4876033"
] |
0.69466734
|
1
|
Construct a new atom that repeats the current atom min times at least and at most max times. max can be nil to indicate that no maximum is present. Example: match any number of 'a's str('a').repeat match between 1 and 3 'a's str('a').repeat(1,3)
|
def repeat(min=0, max=nil)
Parslet::Atoms::Repetition.new(self, min, max)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def repeat(min = T.unsafe(nil), max = T.unsafe(nil)); end",
"def rep(rule, min=1, max=Infinity, &block)\n ext(Repeat.new(rule, min, max), block)\n end",
"def rep(rule, min=1, max=Infinity, &block)\n ext(Repeat.new(min, max, rule), block)\n end",
"def repeat min = nil, max = nil\n ParsletRepetition.new self.to_parseable, min, max\n end",
"def str_once(min, max, default = nil)\n [default, (min..max), false,\n ->(a) { a[0] },\n ->(v) { v == default ? [] : Array(v) }\n ]\n end",
"def get_multiples(max)\n\tmot = (1..max_limit(max, 3)).map { |a| a*3 }\n\tmo5 = (1..max_limit(max, 5)).map { |a| a*5 }\n\t(mot + mo5).uniq.inject(0, :+)\nend",
"def opaq_once(min, max, default = nil)\n [default, (min..max), false,\n ->(a) { a[0] },\n ->(v) { v == default ? [] : Array(v) }\n ]\n end",
"def opaq_once(min, max, default = nil)\n [default, (min..max), false,\n ->(a) { a[0] },\n ->(v) { v == default ? [] : Array(v) }\n ]\n end",
"def template(max, pad); end",
"def repeated_sub_pattern(str)\n smallest_str = smallest_str(str)\n multiplied = str.length / smallest_str\n str[0...smallest_str] * multiplied == str\nend",
"def rand(max=0) end",
"def reduce_exactly(_production, _range, _tokens, theChildren)\n count = theChildren[1].token.lexeme.to_i\n multiplicity(count, count)\n end",
"def substrings (n, m, prefix, max)\n if n . length == 0 then\n return prefix > -1 &&\n prefix < max &&\n prefix % m == 0 ? 1 : 0\n end\n\n fc = n[0] . to_i\n tail = n[1 .. -1]\n if prefix == -1 then\n n_prefix = fc\n else\n n_prefix = 10 * prefix + fc\n end\n\n return substrings(tail, m, n_prefix, max) +\n substrings(tail, m, prefix, max)\nend",
"def range(min, max)\n return max if max < min\n range(min, max) << max\nend",
"def ltrunc(max)\n if length > max\n sub(/^.*?(.{#{max - 3}})$/, '...\\1')\n else\n self\n end\n end",
"def uint_once(min, max, default = nil)\n [default, (min..max), false,\n ->(a) { vlb_decode(a[0]) },\n ->(v) { v == default ? [] : [vlb_encode(v)] }\n ]\n end",
"def max_matches\n @max_matches || 1000\n end",
"def pattern_repeat(n)\n last = [1, 1]\n counter = 0\n loop do\n last = [last.last, (last.first + last.last) % 10]\n break p \"#{counter}\" if last == [1, 1]\n counter += 1\n end\nend",
"def str_once(min, max, default = nil)\n [default, (min..max), false,\n ->(a) { a[0].force_encoding('utf-8') }, # XXX needed?\n ->(v) { v == default ? [] : Array(v) }\n ]\n end",
"def expand!(minimum_number_of_digits)\n if @repeat\n while @digits.size < minimum_number_of_digits\n @digits.push @digits[@repeat] || 0\n @repeat += 1\n end\n else\n @digits.push 0 while @digits.size < minimum_number_of_digits\n end\n self\n end",
"def generator_rand(max)\n return nil if max < 0\n\n result = rand(max + 1)\n result\n end",
"def max_concurrent_group_searches(max)\n @hash[:max_concurrent_group_searches] = max\n self\n end",
"def bounded(n)\n RepeatCount.bounded(n)\n end",
"def o256_once(min, max, default = nil)\n [default, (min..max), false,\n ->(a) { o256_decode(a[0]) },\n ->(v) { v == default ? [] : [o256_encode(v)] }\n ]\n end",
"def max(_); '1000'; end",
"def reduce_match_string(_production, _range, _tokens, theChildren)\n MatchTest.new(theChildren.last)\n end",
"def repeat_str n, s\n s * n\nend",
"def non_repeat_substring(str)\n distinct_chars = {}\n start_index = 0\n max_length = 0\n\n for end_index in 0..(str.length - 1)\n right_char = str[end_index]\n\n if distinct_chars.include?(right_char)\n start_index = [start_index, distinct_chars[right_char] + 1].max\n end\n distinct_chars[right_char] = end_index\n max_length = [max_length, end_index - start_index + 1].max\n end\n\n return max_length\nend",
"def reduce_assertable(_production, _range, _tokens, theChildren)\n (term, quantifier) = theChildren.flatten\n quantifier ? repetition(term, quantifier) : term\n end",
"def uint_once(min, max, default = nil)\n [default, (min..max), false,\n ->(a) { CoAP.vlb_decode(a[0]) },\n ->(v) { v == default ? [] : [CoAP.vlb_encode(v)] }\n ]\n end",
"def repeat_str (n, s)\n s * n\nend",
"def repeat_str (n, s)\n s * n\nend",
"def random_string_upto_length(max_length)\r\n length = random_integer(max_length)\r\n random_string_of_length(length)\r\n end",
"def long_range (min, max)\n long = rand(0..(max - min)) + min\n long\nend",
"def truncate(max)\n length = Math.min(max, length)\n self\n end",
"def nth_perm(str, max)\n n = str.length - 1\n return str if n == 0\n i = 0\n fac = fact(n)\n i += 1 while ((i+1)*fac) < max && i < n\n str[i] + nth_perm(str.tr(str[i], ''), max - (i*fac))\nend",
"def repeat_string (string1, limit)\r\n\t\t1.upto(limit).each do |i|\r\n\t\t\tputs string1\r\n\t\tend\r\n\tend",
"def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end",
"def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end",
"def usw_random(max=-1, min=0)\n Sass::Script::Number.new( max.to_i < 0 ? rand() : rand(min.to_i .. max.to_i ))\n end",
"def pop(i, max)\n { 'id' => frac2uuid((i*1.0)/max),\n 'a' => i,\n 'b' => i % 2,\n 'c' => \"a\"*(i.even? ? 10 : 1000) + (\"%020d\" % i),\n 'd' => \"a\" * 1000,\n 'm' => [i, i, i.to_s, i % 2] }\nend",
"def test_maxseq\n is 0, maxseq(0)\n is 3, maxseq(0,1,2)\n is 0, maxseq(-1), \"we choose [] if we have only negative values\"\n is 6, maxseq(1,2,3)\n is 3, maxseq(1,-2,3)\n is 3, maxseq(1,2,-3)\n is 3, maxseq(1,2,-3)\n is 5, maxseq(-1,2,3)\n is 0, maxseq(-1,-2)\n is 8, maxseq(1,-2,3,4,-5,6,-7)\n is 6, maxseq(1,-2,-3,6)\n is 11,maxseq(0,1,-2,-3,5,6)\n end",
"def lteq(max)\n Rule.new error: [:not_lteq, max], predicate: -> { _1 <= max }\n end",
"def range(min, max)\n minMax = []\n i = min\n while i <= max\n minMax << i\n i += 1\n end\n return minMax\n end",
"def truncate(max, omission = '...')\n (length > max ? self[0...max] + omission : self)\n end",
"def repeat_matcher *pattern\n submatcher = MatchWrapper.new(pattern_matcher(*pattern), SplatExpression)\n\n lambda do |string, index = 0, counts:|\n result = []\n\n while nonempty_match?(found = submatcher.call(string, index, counts: counts))\n index += found.size\n result.push(*found)\n end\n\n result unless result.empty?\n end\n end",
"def limit(maximum)\n mag_squared = magnitude ** 2\n return copy if mag_squared <= maximum**2\n return (unit! * maximum)\n end",
"def multiples(n, max)\n i = 1\n add = []\n loop do\n add << i * n\n i += 1\n add.last >= max && add.pop && break\n end\n p add\nend",
"def optimum_epl max = 1700, tolerance = 0.1\n last_epl = false\n epl = nil\n 10.times do |i|\n epl = generate_epl(tolerance)\n \n # Exit loop \n # 28 == basic string length from generate_epl\n if epl.length > max || (epl.length == last_epl.length if last_epl && epl.length != 29)\n return last_epl \n else \n last_epl = epl\n tolerance = tolerance / 10.0 #DECREASE SIMPLIFICATION BY FACTOR OF TEN\n end \n end\n epl\n end",
"def optimum_epl max = 1700, tolerance = 0.1\n last_epl = false\n epl = nil\n 10.times do |i|\n epl = generate_epl(tolerance)\n \n # Exit loop \n # 28 == basic string length from generate_epl\n if epl.length > max || (epl.length == last_epl.length if last_epl && epl.length != 29)\n return last_epl \n else \n last_epl = epl\n tolerance = tolerance / 10.0 #DECREASE SIMPLIFICATION BY FACTOR OF TEN\n end \n end\n epl\n end",
"def repeat_str(n, s)\n return s * n\nend",
"def expand\n @max = Short::MAX_VALUE\n end",
"def repeat_str (n, s)\n s*n\nend",
"def bound(n,options={})\n min=(options[:min]||1).to_i\n max=(options[:max]||5).to_i\n default=(options[:default]||min).to_i\n [[(n||default).to_i,min].max,max].min\n end",
"def repeat_it(string,n)\n string.is_a?(String) ? string*n : \"Not a string\"\nend",
"def digit_replacement_cycle(n)\n return 0 unless prime?(n)\n s = n.to_s\n s.chars.uniq.map do |d|\n digit_replacement_cycle_length(s.gsub(d, \"*\"))\n end.max\n end",
"def repeat_str (n, s)\r\n return s * n\r\nend",
"def make_valid\n pattern = Array.new(size){|i| i+1}.shuffle\n size.times do |y|\n size.times do |x|\n set x, y, pattern[x]\n end\n base.times{|i| pattern.push pattern.shift}\n pattern.push pattern.shift if base - (y%base) == 1\n end\n self\n end",
"def make_valid\n pattern = Array.new(size){|i| i+1}.shuffle\n size.times do |y|\n size.times do |x|\n set x, y, pattern[x]\n end\n base.times{|i| pattern.push pattern.shift}\n pattern.push pattern.shift if base - (y%base) == 1\n end\n self\n end",
"def random_number_max(msg, maximum)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n number = rand(maximum.to_i)\n @last_numbers = [] if @last_numbers.nil?\n number = rand(maximum.to_i) while @last_numbers.include?(number)\n @last_numbers.prepend_capped(number, 5)\n number.to_s.separate if number > 999\n msg.reply(number)\n end",
"def maximize(range = 1..1_000_000)\n (range).lazy_map { |x| [yield(x), x] }.max[1]\nend",
"def amplify(prg_ary, range = 0..4)\n partial = method(:run_one).curry.call(prg_ary)\n outputs = range.to_a.permutation.map(&partial)\n puts outputs.max\n end",
"def range(min, max)\n return [] if max < min\n range(min, max - 1) << max\nend",
"def max_permutation n\n min_permutation(n).to_s.reverse.ljust(4, '0').to_i\nend",
"def repeatedString(s, n)\n count = s.count(\"a\")\n rep = (n / s.length)\n if n % s.length != 0\n short_s = s.slice(0, n % s.length)\n return (count * rep) + short_s.count(\"a\")\n else\n return (count * rep)\n end\n \nend",
"def initialize(initial_value, max_value, reverse = false)\n @max_value = max_value\n @reverse = reverse\n @value = bump_value(initial_value)\n end",
"def max=(value)\r\n @max = value\r\n shift while @store.length > @max\r\n end",
"def range(min, max)\n return [] if max <= min\n range(min, max - 1) << max - 1\n\n end",
"def wrap(num, max)\n if num < 0\n max - 1\n elsif num >= max\n 0\n else\n num\n end\n end",
"def single\n min if min == max\n end",
"def next_num(num, max=9, min=0)\r\n arr = num\r\n done = false\r\n for i in 0...arr.length\r\n index = arr.length - i - 1\r\n \tif arr[index] == max\r\n \t arr[index] = min\r\n \t next\r\n \tend\r\n\t arr[index] += 1\r\n done = true\r\n\t break\r\n end\r\n arr = [min] + arr if not done\r\n arr.join_to_i\r\nend",
"def any_string(options = {})\n if options[:min] && options[:max]\n raise \":min must be less than :max\" if options[:min] > options[:max]\n end\n if options[:min]\n raise \":min must be positive\" if options[:min] < 1\n end\n\n min_size = options[:min]\n max_size = options[:max]\n\n if min_size.nil? && max_size.nil?\n min_size = rand(80) + 1\n max_size = min_size + rand(80)\n elsif min_size.nil?\n min_size = max_size - rand(max_size)\n min_size = 1 if min_size < 1\n else\n max_size = min_size + rand(min_size) + 1\n end\n\n string = Faker::Lorem.words(1).join(' ')\n while string.length < min_size\n string += Faker::Lorem.words(1).join(' ') \n end\n\n string[0..(max_size-1)]\n end",
"def pick_random_coprime(max)\n range_boundary = max / 4;\n lower_range = range_boundary;\n upper_range = max - range_boundary;\n candidate = rand(lower_range..upper_range);\n\n (0..10).each do |_|\n if max.gcd(candidate) == 1\n return candidate;\n else\n candidate = rand(lower_range..upper_range);\n end\n end\n\n max - 1\n end",
"def pick_random_coprime(max)\n range_boundary = max / 4;\n lower_range = range_boundary;\n upper_range = max - range_boundary;\n candidate = rand(lower_range..upper_range);\n\n (0..10).each do |_|\n if max.gcd(candidate) == 1\n return candidate;\n else\n candidate = rand(lower_range..upper_range);\n end\n end\n\n max - 1\n end",
"def reduce_at_least(_production, _range, _tokens, theChildren)\n count = theChildren[2].token.lexeme.to_i\n multiplicity(count, :more)\n end",
"def int(max_int)\n NumGen.new max_int\n end",
"def generate(max_length = EasyPasswords::DEFAULT_MAX_LENGTH)\n fail \"Password minimal length is #{EasyPasswords::MIN_WORD_LENGTH}\" if max_length < EasyPasswords::MIN_WORD_LENGTH\n output = ''\n while output.size < (max_length - (EasyPasswords::MIN_WORD_LENGTH - 1))\n add_part(output, max_length)\n end\n output\n end",
"def rampant_repeats(str, hash)\n str.chars.map { |c| hash.key?(c) ? c * hash[c] : c }.join\nend",
"def test_maxseq\n is 0, maxseq(0)\n is 3, maxseq(0,1,2)\n is 0, maxseq(-1), \"we choose 0 if we have only negative values\"\n end",
"def repeat_letters\n puts \"Type in as many words as you want to find the word with most repeats\"\n user_input = gets.chomp\n word = word.max_by {|string| string.chars.count - string.char.uniq.count}\n puts word\nend",
"def repeat something, *rest\n if rest.length == 0\n return something + \" \" + something\n\n elsif not rest[0].to_i == 0\n number = rest[0].to_i\n repetitions = \"\"\n number.times do \n repetitions += something + \" \"\n end\n end\n repetitions.chop # remove last space \n # something + \" \" + something \nend",
"def repeat_copy(str, n = 1)\n return str * n\nend",
"def repeatedString(s, n)\n s.count('a') * (n / s.size) + s[0, n % s.size].count('a')\nend",
"def range1(min, max)\n # Base Case / Inductive Step\n return [] if max <= min\n\n range1(min, max - 1) << max - 1\nend",
"def o256_once(min, max, default = nil)\n [default, (min..max), false,\n ->(a) { CoAP.o256_decode(a[0]) },\n ->(v) { v == default ? [] : [CoAP.o256_encode(v)] }\n ]\n end",
"def reduce_once_or_more(_production, _range, _tokens, _children)\n multiplicity(1, :more)\n end",
"def solution(n, a)\n counter = [0] * n\n counter_max, max = 0, 0\n\n a.each do |c|\n i = c-1\n\n if c == n + 1\n counter_max = max\n else\n # should ensure start number after max_counter applied\n counter[i] = counter_max if counter[i] < counter_max\n counter[i] += 1\n\n max = [max, counter[i]].max\n end\n end\n\n # should ensure start number after max_counter applied\n counter.map { |c| [c, counter_max].max }\nend",
"def multiples_of_3_or_5(max)\n multiples = []\n for i in 3...max #two dots are inclusive, three dots are not\n if i % 3 == 0 || i % 5 == 0 then multiples << i end\n end\n multiples\nend",
"def repeatedString(s, n)\n length = s.length\n\n repeat_count = n / length\n\n remainder = n % length\n\n count_a(s) * repeat_count + count_a(s[0...remainder])\nend",
"def longest_prefix(strings)\n min = strings.min \n max = strings.max\n string_pre = min.size.times do |i| \n break i if min[i] != max[i]\n end\n min[0...string_pre]\nend",
"def generate_name(subject, memo = [])\n until memo.count >= get_const(subject, :limit)\n memo << rand_from_range(subject)\n end\n memo.join\n end",
"def repeatedString(s, n)\n s.count('a') * n.div(s.size) + s.slice(0,n.remainder(s.size)).count('a')\nend",
"def limit(num, *rg)\n [[rg.min, num].max, rg.max].min\n end",
"def solution(digits)\n digits.chars.each_cons(5).max_by(&:itself).join.to_i\nend",
"def times(min_times, max_times)\n if max_times.nil?\n if min_times.zero?\n '*'\n elsif min_times == 1\n '+'\n else\n \"{#{min_times},}\"\n end\n elsif min_times == max_times\n if min_times == 1\n '?'\n else\n \"{#{min_times}}\"\n end\n else\n \"{#{min_times},#{max_times}}\"\n end\n end",
"def max(_); '100'; end",
"def max(_); '100'; end",
"def repeat(input, n=2)\n ([input] * n).join ' '\nend",
"def amicable_numbers(max)\n (1...max).select do |num|\n divisors(num) && num == divisors(divisors(num)) && num != divisors(num)\n end\nend",
"def mkpool(digits, stops)\n ((\"0\"*digits)..(\"9\"*digits)).inject([]) do |ary,e|\n ary << PoolStr.new(\"#{e}#{stops[rand(stops.length)] if stops}\", nil)\n end\nend"
] |
[
"0.64874667",
"0.64760303",
"0.6467832",
"0.6409728",
"0.5549661",
"0.51496565",
"0.51174235",
"0.511173",
"0.49808976",
"0.49430907",
"0.49255964",
"0.49134278",
"0.48976672",
"0.48437476",
"0.48371568",
"0.48275897",
"0.47970575",
"0.47713268",
"0.47107324",
"0.47024688",
"0.46442208",
"0.4619523",
"0.46146163",
"0.46095404",
"0.458655",
"0.45846498",
"0.45800316",
"0.45762488",
"0.45754832",
"0.45654058",
"0.45645395",
"0.45645395",
"0.45637777",
"0.45520476",
"0.45494136",
"0.4548647",
"0.45481297",
"0.45413342",
"0.45413342",
"0.4521352",
"0.45125663",
"0.44894713",
"0.44889185",
"0.44875118",
"0.4486626",
"0.44819683",
"0.4476076",
"0.44699138",
"0.44649315",
"0.44648767",
"0.44585818",
"0.44521734",
"0.4449669",
"0.44472212",
"0.44451874",
"0.44442877",
"0.44431928",
"0.44410852",
"0.44410852",
"0.4440069",
"0.4437123",
"0.44362187",
"0.44235992",
"0.44187158",
"0.44078594",
"0.4404977",
"0.43972737",
"0.43969405",
"0.43959373",
"0.43947288",
"0.43855366",
"0.4385384",
"0.4382552",
"0.4382552",
"0.4380605",
"0.4377634",
"0.43697584",
"0.4356758",
"0.43386397",
"0.43382433",
"0.4337913",
"0.43371582",
"0.43353567",
"0.4333645",
"0.4331194",
"0.43299177",
"0.43277913",
"0.43164822",
"0.43155175",
"0.43072784",
"0.43070233",
"0.43062693",
"0.43050286",
"0.4304438",
"0.4297314",
"0.42967856",
"0.42967856",
"0.42954892",
"0.42949402",
"0.42917135"
] |
0.70429593
|
0
|
Returns a new parslet atom that is only maybe present in the input. This is synonymous to calling repeat(0,1). Generated tree value will be either nil (if atom is not present in the input) or the matched subtree. Example: str('foo').maybe
|
def maybe
Parslet::Atoms::Repetition.new(self, 0, 1, :maybe)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_if_nil(word, value)\n current = @root\n current_prefix = word\n\n while current_prefix != \"\"\n current, current_prefix = find_canididate_insertion_node(current, current_prefix)\n end\n\n current[:value] ||= value\n return current[:value]\n end",
"def maybe(*args, **opts, &block)\n extract_type_spec(*args, nullable: true) do |*predicates, type_spec:, type_rule:|\n append_macro(Macros::Maybe) do |macro|\n macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &block)\n end\n end\n end",
"def maybe! so, maybe: -> { self }\n maybe.call\n end",
"def naked_single\n each_empty_cell do |cell|\n vals = legal_values(*cell.pos)\n if vals.length == 1\n cell.val = vals.first\n return cell\n end\n end\n return nil\n end",
"def maybe(value)\n append \"(?:#{sanitize value})?\"\n end",
"def maybe so, maybe: self\n maybe\n end",
"def maybe\n self\n end",
"def maybe; end",
"def maybe! so, maybe: -> {}\n so.call\n end",
"def find_empty_position(item, position)\n\n if [:arm, :leg, :wield, :wrist, :foot, :ankle, :ring_finger, :ear, :hand].include? position\n return find_empty_position(item, \"left_#{position}\".to_sym) || find_empty_position(item, \"right_#{position}\".to_sym)\n end\n\n if @equipment[position] and @equipment[position][item.layer]\n nil\n else\n position\n end\n end",
"def get_item_for_placeholder_if_exists_or_create_it _ph\n # Controllo che non mi stiano passando nil come argomento\n raise InvalidNameForPlaceholder.new(\"\") if _ph.blank?\n i = item_for _ph\n return i unless i.nil?\n new_item = Item.new(_ph, '')\n add_item new_item\n new_item\n end",
"def reduce_optional(_production, _range, _tokens, _children)\n multiplicity(0, 1)\n end",
"def create_optional( element )\n return Util::ExpressionForms::Optional.new( element )\n end",
"def find_concatenated(word)\n [].tap { |a| probe_words(0, word, a) }\n end",
"def maybe so, maybe: self\n so\n end",
"def get_or_create(char)\n @children[char] ||= Node.new\n end",
"def make_return_value\n @return_values.compact!\n @return_values.uniq!\n\n if @return_values.empty?\n Sexp.new(:nil)\n elsif @return_values.length == 1\n @return_values.first\n else\n @return_values.reduce do |value, sexp|\n make_or value, sexp\n end\n end\n end",
"def first_none_npc_participant\n participants.each do |p|\n return p if !p.army.nil? && !p.army.empty? && !p.army.owned_by_npc?\n end\n return nil\n end",
"def root\n a = zero_or_more { or_clause }\n space\n\n if a.empty?\n AST.all\n elsif a.size == 1\n a.first\n else\n AST.new(:and, a)\n end\n end",
"def visit_optional(binding_type)\n if input.nil?\n self.result = binding_type.definition.new_value()\n else\n visit(binding_type.element_type)\n self.result = binding_type.definition.new_value(result)\n end\n end",
"def first_non_empty(*args)\n while !args.empty?\n ret = args.shift\n return ret unless ret.to_s.empty?\n end\n return ''\n end",
"def to_maybe\n self\n end",
"def to_maybe\n self\n end",
"def pure(value = Undefined, &block)\n Some.new(Undefined.default(value, block))\n end",
"def nullp\n self.parse_null.singleton?\n end",
"def create_default_boomerang_if_missing(entry)\n return Success(entry) if BoomerangLeaderbit.where(leaderbit: entry.leaderbit, user: entry.user).exists?\n\n BoomerangLeaderbit.create!(leaderbit: entry.leaderbit,\n user: entry.user,\n type: BoomerangLeaderbit::Types::DEFAULT)\n\n # it's important to return entry on the last step\n Success(entry)\n end",
"def construct_if_found(results)\n unless results.blank?\n new(results)\n else\n nil\n end\n end",
"def find_empty_position(filled_positions, desired_play_symbol)\n actionable_cells = @board.representation.select {|k,_| filled_positions.include?(k)}\n\n if actionable_cells.values.select {|p| p == desired_play_symbol}.size == 2 &&\n actionable_cells.values.select {|p| p == nil}.size == 1\n # This only works because we already know there is only one element in the hash having a nil value.\n # Invert on a hash 'eats' non-unique values. Could use some refactoring.\n return actionable_cells.invert[nil]\n end\n\n nil\n end",
"def first_none(conditions={}, &block)\n all.detect { |item| match_none(item, conditions, &block) }\n end",
"def some &blk\r\n build_piece AtLeastOne, blk\r\n end",
"def any\n Atoms::Re.new('.')\n end",
"def test_empty_str\n assert_equal(\"\", @target.find_first_non_repeating(\"\"))\n end",
"def optional(f = nil, &block)\n raise InvalidParserError, 'Invalid \"optional\" element; please supply a block' unless block_given?\n\n subroot = Parser.new(&block).root\n @stack.push(Optional.new(subroot, return_result: true, f: f))\n end",
"def has_one(line, opt = {})\n arg = opt.clone\n arg[:at_most] = nil\n arg[:at_least] = nil\n has(line, arg)\n end",
"def any(f = nil, &block)\n subroot = ParserAnyBlock.new(Choice, return_result: true, f: f, &block).root\n @stack.push(subroot)\n end",
"def first(name=nil)\n name.nil? ? matches.first : find(name, false).first\n end",
"def find_or_add_node(id, word)\n node = find_node(id: id)\n if node\n node.words << word unless node.words.include?(word)\n node\n else\n nodes << Node.new(id: id, words: [word])\n nodes.last\n end\n end",
"def absnt?\n Parslet::Atoms::Lookahead.new(self, false)\n end",
"def try_capture(atom)\n return nil unless self.capturing?\n if self.match?(atom)\n atom.value\n end\n end",
"def solution\n\n return self if solved?\n\n while [hidden_singles, naked_singles].any?\n end\n\n return self if solved?\n\n\n # Brute force\n i = each_empty_cell.sort_by { |cell, n| legal_values(n).size }.first.try :last\n\n legal_values(i).map do |value|\n fill(i, value).solution\n end.compact.select { |n| n.solved? }.first\n end",
"def unrepeat\n searched = ''\n unsearched = dup\n dupe = match(/(.+)\\1+/)\n # Dupe[0] = pattern found, [1] group found\n\n until unsearched.empty?\n return searched + unsearched unless dupe\n\n location = unsearched.index(dupe[0])\n searched += unsearched[0..location - 1] if location > 0\n searched += if dupe[0].squeeze.length > 1 && dupe[0].has_letters? # &&\n # ([' ', ',', '.'].include?(dupe[0][0]) || dupe[1].length > 8)\n dupe[1]\n else\n dupe[0]\n end\n unsearched = unsearched[location + dupe[0].length..]\n dupe = unsearched.match(/(.+)\\1+/)\n end\n searched\n end",
"def parse_null_expression\n return ScopedSearch::QueryLanguage::AST::OperatorNode.new(next_token, [parse_value])\n end",
"def most_likely_duplicate\n possible_matching_people.first\n end",
"def _nil\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"nil\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = apply(:_utfw)\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_nil unless _tmp\n return _tmp\n end",
"def otherwise(value = nil)\n @prefixes += \"(?:\"\n @suffixes = \")\" + @suffixes\n append(\")|(?:\")\n find(value) if value\n end",
"def first_or_initialize(attrs = {})\n fetch.first || build(attrs)\n end",
"def first_or_create\n first.then do |item|\n if item\n item\n else\n create\n end\n end\n end",
"def replace_first(input, string, replacement = T.unsafe(nil)); end",
"def structure_single\n structure_repeat.first || []\n end",
"def non_empty(answer)\n answer = nil unless answer != \"\"\n [answer, \"I need an answer. Please?\"]\nend",
"def get_basket(variety)\n basket_with_space = find_basket_with_space()\n basket_with_same_variety = basket_with_space.find { |b| b.apples.first.variety == variety && b.apples.size > 0 }\n if basket_with_same_variety.nil?\n # return some other completely empty basket\n basket_with_space.find { |b| b.apples.size == 0 }\n else\n # return basket with same variety of apples\n basket_with_same_variety\n end\nend",
"def tree_successor(x)\n\tif x.right != nil\n\t\treturn tree_minimum(x.right)\n\tend\n\ty = x.p\n\t\n\twhile y != nil && x == y.right\n\t\tx = y\n\t\ty = y.p\n\tend\n\t\n\treturn y\nend",
"def _reduce_none(val, _values, _result)\n val[0]\n end",
"def make_null_relative_uri_out_of_blank_node\n anno_stmts = @graph.query([nil, RDF.type, RDF::Vocab::OA.Annotation])\n anno_rdf_obj = anno_stmts.first.subject\n if anno_rdf_obj.is_a?(RDF::Node)\n # use null relative URI representation of blank node\n anno_subject = RDF::URI.new\n else # it's already a URI\n anno_subject = anno_rdf_obj\n end\n OA::Graph.subject_statements(anno_rdf_obj, @graph).each { |s|\n if s.subject == anno_rdf_obj && anno_subject != anno_rdf_obj\n @graph << RDF::Statement(subject: anno_subject,\n predicate: s.predicate,\n object: s.object)\n @graph.delete s\n else\n next\n end\n }\n end",
"def maybe(f)\n ->(value) { value.nil? ? nil : f.call(value) }\n end",
"def Maybe object, null_object_signature=nil\n object.nil? ? NullObject.new( null_object_signature ) : object\n end",
"def one_of(*args)\n args.each {|x|\n return to_joined_str(x) if x\n }\n\n \"\"\nend",
"def generate_first_set_based_on_production(production, variable)\n elements = production.clone\n element = elements.shift\n return if element == variable\n if terminal? element\n first_set_add variable, element\n else\n loop do\n set = generate_first_set element\n if elements.empty?\n first_set_add variable, set\n break\n end\n if set.include? epsilon\n set = set.reject { |x| x == epsilon }\n first_set_add variable, set\n element = elements.shift\n else\n first_set_add variable, set\n break\n end\n end\n end\n end",
"def extract_blanks(str)\n Types.check( binding, { :str => ComposedString } )\n\n str.gsub(/(__(?:.*?)__)/) do |fragment|\n create_blank(fragment[2..-3])\n end \n end",
"def find_question_node(reqs)\n reqs.each do |r|\n if r.is_group?\n children = r.children.order(:position)\n return find_question_node(children) unless children.nil? || children.length < 1\n else\n return r\n end\n end\n nil\n end",
"def first construct\n\treturn [Grammar.has_key? construct && first(Grammar[construct]) ||\n\t\tconstruct].flatten\nend",
"def first_one(conditions={}, &block)\n all.detect { |item| match_one(item, conditions, &block) }\n end",
"def or_nil\n get_or_else(nil)\n end",
"def stray (n)\n n.count(n[0]) == 1 ? n[0] : n.uniq[1]\nend",
"def zero_or_one(rule, &block)\n rep(rule, 0, 1, &block)\n end",
"def zero_or_one(rule, &block)\n rep(rule, 0, 1, &block)\n end",
"def find_curious\n z = generate.zip simplify_all\n z.reject! {|x| x.last == nil }\n z.select { |tuple| simplest_form(tuple.first) == simplest_form(tuple.last) && !trivial(tuple.first) }\nend",
"def maybe(_, f)\n f[]\n end",
"def find(ifnone = nil)\n each { |o| return o if yield(o) }\n ifnone.call if ifnone\n end",
"def match_lit_nolt?(l, hint = nil)\n lit = peek_lit_nolt(hint)\n if lit == l\n fwd_after_peek\n lit\n else\n nil\n end\n end",
"def maybe_matcher *pattern\n submatcher = pattern_matcher(*pattern)\n\n lambda do |string, index = 0, counts:|\n found = submatcher.call(string, index, counts: counts)\n\n if match? found\n found\n else\n []\n end\n end\n end",
"def no_with(input)\n if input\n if input == 'ND' or input == 'none'\n ''\n else\n ' (with '+input+')'\n end\n else\n ''\n end\n end",
"def naked_singles\n each_empty_cell.any? do |cell, n|\n vals = legal_values(n)\n if vals.length == 1\n @pz[n] = vals.first\n true\n end\n end\n end",
"def empty?\n first.nil?\n end",
"def single(name)\n els = @root.xpath(\"meta/#{name}[@meta='yes']\")\n els.length <= 1 or puts(\"Warning: multiple #{name.inspect} elements found.\")\n return els[0] ? els[0].content : nil\n end",
"def map(&block)\n return zero if nothing?\n return Maybe.new block.call(value) if just?\n end",
"def process_dummy(exp)\n result = @expected.new(:dummy) rescue @expected.new\n\n until exp.empty? do\n result << self.process(exp.shift)\n end\n\n result\n end",
"def none?\n @value.to_s.empty? or /\\Anone\\z/io.match(@value.to_s)\n end",
"def create_root?(str)\n !str.empty? && self[str[0]] ||= {}\n end",
"def getIncompleteName(firstAtom = [])\n name = \"\"\n parent = findParentString(firstAtom)\n name = getHydroPfix(parent.length)\n prefix = getPrefix(parent)\n name = prefix + name unless prefix == nil\n name\n end",
"def isempty(thing)\n thing.respond_to?(:empty?) && thing.empty?\n end",
"def first!\n fail_not_found_if_nil(first)\n end",
"def process_dummy exp\n result = @expected.new(:dummy) rescue @expected.new\n result << self.process(exp.shift) until exp.empty?\n result\n end",
"def delempty(thing)\n if thing.respond_to?(:delete_if)\n if thing.kind_of? Hash\n thing.delete_if{|k,v| v.nil? || isempty(delempty(v)) || isempty(v)}\n else # assume single element iterable\n thing.delete_if{|elem| elem.nil? || isempty(delempty(elem)) || isempty(elem)}\n end\n end\n thing\n end",
"def find_by_uri_or_empty(uri)\n find_by_uri(uri) or Page.new(uri, '')\n end",
"def peek_first_item\n stack = []\n node, stack = *first_below(@root, stack)\n return nil unless node\n return node, stack\n end",
"def dup\n atom = Atom.new(id, element, x, y, z)\n atom.label = label\n atom.partial_charge = partial_charge\n atom.ignored1 = ignored1\n atom.ignored2 = ignored2\n return atom\n end",
"def parse\n @input.reverse!\n loop do\n if @input.empty?\n break\n end\n t = @input.pop\n t.freeze\n remainder = @conf.consume?(t)\n if remainder.nil? \n log \"+ #{t} not consumed\"\n return @conf.matchingCandidates(t)\n elsif remainder.strip.length > 0\n @input.push remainder\n end\n end\n return @conf.matchingCandidates(nil)\n end",
"def singular\n return word if word.to_s.empty?\n\n find_match(Inflection.configuration.singulars[:noun]) ||\n (uncountable? && word) || find_match(Nouns.singulars) || word\n end",
"def only default: nil\n if count == 1\n first\n else\n default\n end\n end",
"def name_or_none\n name || \"\"\n end",
"def simplify\n repeat_until_unchanged do |ast|\n ast.trim_once.simplify_once\n end\n end",
"def prsnt?\n Parslet::Atoms::Lookahead.new(self, true)\n end",
"def first!(spec)\n first(spec) || raise(CouchPotato::NotFound)\n end",
"def reduce_any_of(_production, _range, _tokens, theChildren)\n first_alternative = theChildren[3].first\n result = nil\n\n # Ugly: in SRL, comma is a dummy separator except in any of construct...\n if theChildren[3].size == 1 && first_alternative.kind_of?(Regex::Concatenation)\n result = Regex::Alternation.new(*first_alternative.children)\n else\n result = Regex::Alternation.new(*theChildren[3])\n end\n\n result\n end",
"def empty?\n @parts.empty? or (@parts.length == 1 and merged? and @parts.first.empty?)\n end",
"def buddy(start, nd)\r\n start.upto(nd) do |n|\r\n potential_match = sum_divisors(n)\r\n next if potential_match < n\r\n return \"(#{n} #{potential_match})\" if sum_divisors(potential_match) == n\r\n end\r\n 'Nothing'\r\nend",
"def beer_search_first(arg)\n beer_search(arg).find {|beer|beer}\nend",
"def optionalize\n without_values(nil)\n end",
"def deep_find_first sexp=nil, &block\n if sexp.nil?\n return deep_find_first_node(&block)\n end\n deep_enhance! unless deep_enhanced?\n found = nil\n each do |node|\n if node == sexp\n found = node\n break\n else\n if node.kind_of?(Sexp)\n found = node.deep_find_first(sexp)\n break if found\n end\n end\n end\n found\n end"
] |
[
"0.51193595",
"0.48774472",
"0.48455667",
"0.47992495",
"0.47945142",
"0.4708897",
"0.46568134",
"0.46323395",
"0.4578652",
"0.45517424",
"0.4451846",
"0.44018352",
"0.43995935",
"0.43551353",
"0.43493292",
"0.43220568",
"0.4316036",
"0.43117633",
"0.42866147",
"0.42510933",
"0.42496055",
"0.41991943",
"0.41991943",
"0.4181796",
"0.41732532",
"0.41592988",
"0.41589656",
"0.41464454",
"0.41355133",
"0.41271257",
"0.41255537",
"0.41163686",
"0.4109269",
"0.4107005",
"0.40962318",
"0.40935916",
"0.40892962",
"0.40592933",
"0.40567884",
"0.40509713",
"0.40482336",
"0.40447858",
"0.40246212",
"0.40150115",
"0.4011166",
"0.40041754",
"0.39921537",
"0.39868233",
"0.39858595",
"0.39792335",
"0.39772454",
"0.39753804",
"0.39655963",
"0.39645272",
"0.39624044",
"0.39554197",
"0.39475778",
"0.39390272",
"0.39335117",
"0.39326814",
"0.39269114",
"0.39268845",
"0.3926707",
"0.39192268",
"0.39148974",
"0.39148974",
"0.3914868",
"0.39056918",
"0.39026386",
"0.39018172",
"0.3901597",
"0.38984805",
"0.38848907",
"0.38808322",
"0.3877641",
"0.3876439",
"0.38676304",
"0.3866863",
"0.38663566",
"0.38663128",
"0.38628635",
"0.38588348",
"0.38585743",
"0.3855899",
"0.38541278",
"0.38519612",
"0.38493755",
"0.3847201",
"0.38448733",
"0.3837278",
"0.38367507",
"0.38362032",
"0.3834443",
"0.38315746",
"0.38308826",
"0.38260773",
"0.3822529",
"0.3822288",
"0.38219818",
"0.38219696"
] |
0.6656186
|
0
|
Chains two parslet atoms together as a sequence. Example: str('a') >> str('b')
|
def >>(parslet)
Parslet::Atoms::Sequence.new(self, parslet)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def chain( s )\n @pipe[-1] << \".#{s}\"\n end",
"def makeMove mv\n @pipe1.puts mv \n @pipe1.flush\n\n input = \"\"\n begin\n line = @pipe2.gets\n input += line\n end while !line.include? \">\\n\"\n\n moves = input.split(\"<\").last.delete(\">\")\nend",
"def shovel\n ->(m1, m2) {\n bind.(m1, ->(_) { m2 }).add_prop.(:to_s, ->() { m1.to_s + ' >> ' + m2.to_s })\n }\n end",
"def coerce(oth)\n case oth\n when String\n oth = parser.parse(oth)\n else\n super\n end\n\n return oth, self\n end",
"def chain(str, *commands)\n str = require_string! str\n\n commands.reduce(str) { |memo, command| send(command, memo) }\n end",
"def test_combine_inserts\n g = Grammar.new(\"lexer grammar t;\\n\" + \"A : 'a';\\n\" + \"B : 'b';\\n\" + \"C : 'c';\\n\")\n input = ANTLRStringStream.new(\"abc\")\n lex_engine = Interpreter.new(g, input)\n tokens = TokenRewriteStream.new(lex_engine)\n tokens._lt(1) # fill buffer\n tokens.insert_before(0, \"x\")\n tokens.insert_before(0, \"y\")\n result = tokens.to_s\n expecting = \"yxabc\"\n assert_equals(expecting, result)\n end",
"def |(next_parslet)\n append next_parslet\n end",
"def seq()\n node1 = symbol()\n\n if @look.kind.eql?(Token::CHARACTER) then\n node2 = seq()\n node = Concat.new(node1, node2)\n\n return node\n else\n return node1\n end\n end",
"def union(arg1, *arg2)\n first = arg1\n rest = []\n arg2.each do |char|\n char.each do |subchar|\n rest << subchar\n end\n end\n return first + rest\n \nend",
"def join(*rest) end",
"def test_with_multiple_composites\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n result = pipeline.process([])\n assert_equal(['a', 'b'], result)\n end",
"def *(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\" \r\n \r\n if first.ok?\r\n matched += first.matched\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched += second.matched\r\n ParserResult.ok(second.output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n else\r\n first\r\n end\r\n end\r\n end",
"def combinator(a, b)\n a.product(b).map{ |c| c.join('') }\nend",
"def combine(str1, str2)\n # Create an array which we will read the final outputs from\n output = []\n\n # Run processor for word 1 and push result to output\n output.push(processor(str1, 1))\n\n # Run processor for word 2 and push result to output\n output.push(processor(str2, 2))\n\n # Join the partial words together to form the wombinations\n wombination1 = (output[0][0] + output [1][0])\n wombination2 = (output[0][1] + output [1][1])\n\n # If the words are the same, then just return one of them...\n if wombination1 == wombination2\n puts wombination1\n\n # otherwise return both as an array\n else\n puts [wombination1, wombination2]\n\n end\nend",
"def pipe(other)\n Pipeline.new(@pipes + [other])\n end",
"def test_can_do_really_long_chains\n result = interpret '55 | dup() | dup() | dup() | dup()'\n assert_eq result, 55\n end",
"def >>(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\" \r\n output = []\r\n if first.ok?\r\n matched = matched + first.matched\r\n output += first.output\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched = matched + second.matched\r\n output = [*output, second.output]\r\n ParserResult.ok(output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n else\r\n first\r\n end\r\n end\r\n end",
"def |(parslet); end",
"def |(parslet); end",
"def mix_up(str1, str2)\n str1_initial = str1[0,2]\n str1_end = str1[2, str1.length - 1]\n str2_initial = str2[0,2]\n str2_end = str2[2, str2.length - 1]\n puts \"#{str2_initial + str1_end} #{str1_initial + str2_end}\"\nend",
"def concat_head(other)\n if other.to_s.empty?\n self\n elsif other.to_s.match(/[\\W&&[:ascii:]]\\Z/)\n DecorationWrapper.new(other.to_s + to_s)\n else\n DecorationWrapper.new(\"#{other} #{to_s}\")\n end\n end",
"def prepare_chain\n chain = []\n chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@primary_output)\n chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@secondary_output)\n\n chain << reassignment_processor(@secondary_output)\n\n chain <<\n if @primary_output.new_name_status == 'A'\n linked_names = @secondary_output ? [@secondary_output] : []\n NomenclatureChange::StatusUpgradeProcessor.new(@primary_output, linked_names)\n else\n accepted_names = @secondary_output ? [@secondary_output] : []\n NomenclatureChange::StatusDowngradeProcessor.new(@primary_output, accepted_names)\n end\n chain.compact\n end",
"def emit\n # emit LHS, RHS, opcode\n @first.emit << @second.emit << OPCODES[@op]\n end",
"def chain string\n rx_word = /([a-zA-Z0-9_]+)/\n rx_state = /^#{rx_word}$/\n rx_event = /^(?:-|>)#{rx_word}-?>$/\n previous = nil\n string.split.each do |chunk|\n case chunk\n when rx_state\n current = state $1\n if previous.is_a? Event\n previous.to current\n end\n when rx_event\n current = event $1\n if previous.is_a? State\n current.from previous\n end\n else\n raise ArgumentError, \"'#{chunk}' is not a valid token\"\n end\n previous = current\n end\n end",
"def merge_initial_ops(seq1, seq2)\n ops1, ops2 = [], []\n ops1 << seq1.shift while seq1.first.is_a?(String)\n ops2 << seq2.shift while seq2.first.is_a?(String)\n\n newline = false\n newline ||= !!ops1.shift if ops1.first == \"\\n\"\n newline ||= !!ops2.shift if ops2.first == \"\\n\"\n\n # If neither sequence is a subsequence of the other, they cannot be\n # merged successfully\n lcs = Sass::Util.lcs(ops1, ops2)\n return unless lcs == ops1 || lcs == ops2\n (newline ? [\"\\n\"] : []) + (ops1.size > ops2.size ? ops1 : ops2)\n end",
"def concat_head(other)\n StringWrapper.new(other.to_s + to_s)\n end",
"def mixed_pairs\nend",
"def <<(string); end",
"def <<(string); end",
"def >>(next_parslet)\n ParsletMerge.new self.to_parseable, next_parslet.to_parseable\n end",
"def on_pipe(ast_node, context)\n left, right = *ast_node\n\n return process(left, context) + process(right, context)\n end",
"def combine_info\n @combine_info = pipe_names + space_names + comma_names \nend",
"def either(left, right)\n \"#{quotify left} OR #{quotify right}\"\n end",
"def sequence_separator=(_arg0); end",
"def sequence_separator=(_arg0); end",
"def |( other )\n\t\treturn Regexp.new( \"(?:%s|%s)\" % [self.to_s, other.to_s] )\n\tend",
"def >> (other)\n other << self\n end",
"def concat(p0) end",
"def concat(p0) end",
"def |(other)\n a = first_param\n b = other.first_param\n\n case\n when a.is_a?(RequiredPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(RequiredPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.nil?\n self.drop_first&.with_first_param(OptionalPositional.new(a.type))\n when a.is_a?(OptionalPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.nil?\n (self.drop_first | other)&.with_first_param(a)\n when a.is_a?(RestPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(RestPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.nil?\n (self.drop_first | other)&.with_first_param(a)\n when a.nil? && b.is_a?(RequiredPositional)\n other.drop_first&.with_first_param(OptionalPositional.new(b.type))\n when a.nil? && b.is_a?(OptionalPositional)\n (self | other.drop_first)&.with_first_param(b)\n when a.nil? && b.is_a?(RestPositional)\n (self | other.drop_first)&.with_first_param(b)\n when a.nil? && b.nil?\n required_keywords = {}\n optional_keywords = {}\n\n (Set.new(self.required_keywords.keys) & Set.new(other.required_keywords.keys)).each do |keyword|\n required_keywords[keyword] = AST::Types::Union.build(\n types: [\n self.required_keywords[keyword],\n other.required_keywords[keyword]\n ]\n )\n end\n\n self.optional_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = other.required_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when s = other.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = other.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n other.optional_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = self.required_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when s = self.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = self.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n self.required_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = other.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = other.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n other.required_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = self.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = self.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n\n rest = case\n when self.rest_keywords && other.rest_keywords\n AST::Types::Union.build(types: [self.rest_keywords, other.rest_keywords])\n when self.rest_keywords\n if required_keywords.empty? && optional_keywords.empty?\n self.rest_keywords\n end\n when other.rest_keywords\n if required_keywords.empty? && optional_keywords.empty?\n other.rest_keywords\n end\n else\n nil\n end\n\n Params.new(\n required: [],\n optional: [],\n rest: nil,\n required_keywords: required_keywords,\n optional_keywords: optional_keywords,\n rest_keywords: rest)\n end\n end",
"def concat(word, another)\n word << another\nend",
"def then(*args, exactly: nil, range: nil)\n @str += parse(args, exactly: exactly, range: range)\n self\n end",
"def concat parts\n self.parts.concat parts\n end",
"def concat(string); end",
"def test_two_books\n text = 'Ruth; Markus'\n t1, t2 = text.split(semi)\n assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, b2: :Ruth), semi, pass(text: t2, b1: :Mark, b2: :Mark)]\n end",
"def |(other)\n other.inject(clone) do |copy, e|\n copy << e\n end\n end",
"def concatenate(strings)\n\nend",
"def chain\n [self]\n end",
"def test_two_books\n text = 'Ruth; Markus'\n t1, t2 = text.split(semi)\n assert_parsed_ast_for_text [pass(text: t1, b1: :Ruth, b2: :Ruth), semi, pass(text: t2, b1: :Mark, b2: :Mark)], text\n end",
"def |(arity)\n\t\tConcatenative::RubyMessage.new self, arity\n\tend",
"def combine(one, two)\n\n tuples = []\n\n one.each do |o|\n two.each do |t|\n pair = [o, t]\n tuples << pair\n yield o, t if block_given?\n end\n end\n\n tuples\nend",
"def wrap(other)\n Pipeline.new(@pipes + [->(_) { other }])\n end",
"def many1\n ->string, position {\n ret = parse(string, position)\n return ret unless ret.pass?\n rest = many.parse string, ret.position\n Pass.new [ret.matched, *rest.matched], rest.position\n }.extend Parsable\n end",
"def union itemA, itemB\n\tend",
"def joinstrings(str1, str2)\n newstring = str1 << \", \" << str2\n return newstring\nend",
"def test_with_multiple_compositions\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n pipeline.use @append_c\n result = pipeline.process([])\n assert_equal(['a', 'b', 'c'], result)\n end",
"def together(string, string2, string3)\n return \"#{string} #{string2} #{string3}\" \nend",
"def one_of(*args)\n args.each {|x|\n return to_joined_str(x) if x\n }\n\n \"\"\nend",
"def >(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\"\r\n output = []\r\n if first.ok?\r\n matched = first.matched\r\n output += first.output\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched = matched + second.matched\r\n output = [*output, second.output]\r\n ParserResult.ok(output, matched: matched, remaining: second.remaining)\r\n else\r\n first\r\n end\r\n else\r\n ParserResult.fail(input)\r\n end\r\n end\r\n end",
"def join_strings(first_string, second_string)\n\n joint_string = first_string + ' ' + second_string\n\n return(joint_string)\n\nend",
"def chain(*elements)\n elements = elements.reverse\n elements[1..-1].inject(elements.first) do |c, elm|\n elm.pipe(c, environment)\n elm\n end\n end",
"def test_split_join_record_line\n check = proc do |start, record, final|\n # Check parsing first\n result = @parser.parse_line(start)\n [:one, :two].each do |param|\n\n assert_equal(\n record[param], result[param],\n\n \"Did not correctly parse #{start.inspect}\")\n end\n\n # And generating\n assert_equal(final, @parser.to_line(result), \"Did not correctly generate #{final.inspect} from #{record.inspect}\")\n end\n\n # First try it with symmetric characters\n @parser.record_line :symmetric, :fields => %w{one two},\n :separator => \" \"\n\n check.call \"a b\", {:one => \"a\", :two => \"b\"}, \"a b\"\n @parser.clear_records\n\n # Now assymetric but both strings\n @parser.record_line :asymmetric, :fields => %w{one two},\n :separator => \"\\t\", :joiner => \" \"\n\n check.call \"a\\tb\", {:one => \"a\", :two => \"b\"}, \"a b\"\n @parser.clear_records\n\n # And assymmetric with a regex\n @parser.record_line :asymmetric2, :fields => %w{one two},\n :separator => /\\s+/, :joiner => \" \"\n\n check.call \"a\\tb\", {:one => \"a\", :two => \"b\"}, \"a b\"\n check.call \"a b\", {:one => \"a\", :two => \"b\"}, \"a b\"\n end",
"def union(a,b)\n print a | b # union([1,2,3],[2,3,4]) => [1, 2, 3, 4] \nend",
"def |(other)\n self.class.new(values: (to_a | other.to_a))\n end",
"def <<(other)\n if other.respond_to?(:to_int)\n return self << ('' << other)\n end\n \n @chain << SubString.new(@size, other)\n @size += other.size\n end",
"def set_command_objects\n puts \"@input before set_command_object: #{@input}\"\n command_objects = []\n \n @input.each do |name|\n if command_objects.length < 1 || @command_word == \"combine\" && command_objects.length < 2\n if name_is_valid_object_name?(name)\n command_objects << $game.get_object_by_name(name)\n \n end\n end\n end \n\n \n @command_object_1, @command_object_2 = command_objects\n puts \"@input after set_command_object: #{@input}\"\n puts \"@object_1 and @object_2: #{@command_object_1.to_s + \", \" + @command_object_2.to_s}.\"\n end",
"def from_to(l1, c1, l2, c2); end",
"def concat(a, b)\n a = a.deep_clone\n b = b.deep_clone\n \n # add an epsilon transition from each final state of machine a to the start state of maachine b.\n # then mark each of a's final states as not final\n a.final_states.each do |final_state|\n a.add_transition(:epsilon, final_state, b.start_state)\n final_state.final = false\n end\n \n # add all of machine b's transitions to machine a\n b.transitions.each {|t| a.add_transition(t.token, t.from, t.to) }\n a.final_states = b.final_states\n a.alphabet = a.alphabet | b.alphabet\n \n a\n end",
"def tr_s(p0, p1) end",
"def <<(p)\n Parsby.new \"(#{label} << #{p.label})\" do |c|\n x = parse c\n y = p.parse c\n # like x << y, but without modifying x.\n x + [y]\n end\n end",
"def blah(a)\n b = \"\"\n # it's the last bit that does the reverse\n # if you pass the block 'one + two' you get the same string\n # nifty!\n b << a.each_char.inject(\"\") { |one,two| two + one }\n b\nend",
"def concat(arg)\n super(arg)\n end",
"def concat(*other)\n Observable.concat(self, *other)\n end",
"def concat(*args)\n args.flatten\nend",
"def tr_s!(p0, p1) end",
"def zip(first, second)\n first.zip(second)\nend",
"def oxfordize(parts)\n case parts.size\n when 0..1\n parts.first\n when 2\n parts.join(' and ')\n else\n \"#{parts.slice(0..-2).join(', ')}, and #{parts.slice(-1)}\"\n end\nend",
"def concat(str1, str2)\n str1 + str2\nend",
"def |(other)\n return self.class.new(super.|(other)) \n end",
"def concatentation_method(lover1, lover2)\n puts \"#{lover1} loves #{lover2}\"\nend",
"def command_join_string!\n (@mode == :pipe) ? \" | \" : \" && \"\n end",
"def to_s\n [left, right].uniq.join(\" #{messages[:or]} \")\n end",
"def connect_mutually(v1, v2, len=1)\n\t\tconnect(v1, v2, len)\n\t\tconnect(v2, v1, len)\n\tend",
"def concat(nodes); end",
"def join(input, glue = T.unsafe(nil)); end",
"def +(other)\n self if other.length == 0\n union = Grammar.new(to_hash)\n other.each do |r|\n union.push(r)\n end\n\n union\n end",
"def on_call_concat(context, first, second, *rest)\n args = [first, second] + rest\n retval = ''\n\n args.each do |arg|\n retval << on_call_string(context, arg)\n end\n\n return retval\n end",
"def |(other)\r\n Choice[(children + [other])]\r\n end",
"def to_s\n\t\ti = @head\n\t\tcadena = \"\"\n\t\twhile i!=nil && i!=@tail do\n\t\t\tcadena += \"#{i.value} <-> \"\n\t\t\ti = i.next\n\t\tend\n\t\tcadena += \"#{i.value}\"\n\t\tcadena\n\tend",
"def join\n commands = []\n\n @history.each do |command|\n program = command[0]\n arguments = command[1..-1].map { |word| shellescape(word.to_s) }\n\n commands << [program, *arguments].join(' ')\n end\n\n return commands.join(' && ')\n end",
"def method4(first, second)\n first = first << second\nend",
"def both(left, right)\n \"#{quotify left} AND #{quotify right}\"\n end",
"def +(other)\n Rope.new(concatenate(other))\n end",
"def translit\n return unless schema\n\n string.split(/\\b/).map { |chunk| translit_chunk(chunk) }.join\n end",
"def union(other)\n self.class.from_a(to_a | other.to_a)\n end",
"def parse_either(source); end",
"def coerce(other)\n [other, @sec]\n end",
"def car(string1, string2)\r\n string1 + string2 \r\n end",
"def <(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\"\r\n output = []\r\n remaining = input\r\n\r\n if first.ok?\r\n matched = first.matched\r\n output += first.output\r\n remaining = first.remaining\r\n end\r\n\r\n second = other.run(remaining)\r\n if second.ok?\r\n matched = matched + second.matched\r\n output = [*output, second.output]\r\n ParserResult.ok(output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n end\r\n end",
"def do_comma s; a = mega_pop(s); String == a.class ? s[:output] << \"#{a}\" : s[:output] << \"#{a.chr}\" end"
] |
[
"0.5985303",
"0.57310134",
"0.5723036",
"0.56342447",
"0.5550799",
"0.53289574",
"0.53173035",
"0.52855676",
"0.526712",
"0.52621454",
"0.5261136",
"0.52579725",
"0.52575976",
"0.5187974",
"0.5152323",
"0.5149229",
"0.51439124",
"0.51308405",
"0.51308405",
"0.51217604",
"0.51001966",
"0.5084333",
"0.5068366",
"0.5067482",
"0.50419515",
"0.5040848",
"0.50402194",
"0.5031534",
"0.5031534",
"0.50122786",
"0.50108224",
"0.50103736",
"0.50044674",
"0.49870223",
"0.49870223",
"0.49574974",
"0.49479136",
"0.49404532",
"0.49404532",
"0.49344963",
"0.49328345",
"0.4918872",
"0.4910363",
"0.48926136",
"0.4876386",
"0.48760745",
"0.4864956",
"0.4842292",
"0.4841394",
"0.48337287",
"0.48296842",
"0.4821783",
"0.4821126",
"0.4811776",
"0.48013237",
"0.47828266",
"0.4770615",
"0.47704598",
"0.47652522",
"0.4763254",
"0.4760394",
"0.47544524",
"0.47474808",
"0.4721396",
"0.47119525",
"0.47107032",
"0.4706961",
"0.4692546",
"0.46897215",
"0.4688035",
"0.46852422",
"0.46827927",
"0.4671373",
"0.4669997",
"0.46670458",
"0.46662176",
"0.46475154",
"0.46404865",
"0.46397766",
"0.46393564",
"0.4636144",
"0.4632136",
"0.46261105",
"0.46236485",
"0.46225467",
"0.46196887",
"0.46194622",
"0.46171543",
"0.4616244",
"0.46134475",
"0.46033227",
"0.4600656",
"0.4599682",
"0.45978588",
"0.4597603",
"0.4591474",
"0.4581185",
"0.45807263",
"0.4579331",
"0.45745397"
] |
0.55887026
|
4
|
Chains two parslet atoms together to express alternation. A match will always be attempted with the parslet on the left side first. If it doesn't match, the right side will be tried. Example: matches either 'a' OR 'b' str('a') | str('b')
|
def |(parslet)
Parslet::Atoms::Alternative.new(self, parslet)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def |( other )\n\t\treturn Regexp.new( \"(?:%s|%s)\" % [self.to_s, other.to_s] )\n\tend",
"def or(argument1, argument2)\n argument1 || argument2\n end",
"def either(left, right)\n \"#{quotify left} OR #{quotify right}\"\n end",
"def or(e1, e2)\n eval_ex(e1) | eval_ex(e2)\n end",
"def process_or(exp)\n lhs = process exp.shift\n rhs = process exp.shift\n\n return \"#{lhs} || #{rhs}\"\n end",
"def or( *args ); { $or => args } end",
"def compose_or(first_condition, second_condition)\n validate_condition(first_condition)\n validate_condition(second_condition)\n first_condition.or(second_condition)\n end",
"def combine_or(left, right)\n OrQuery.new(left, right)\n end",
"def rewrite_or(expression)\n first = expression[1]\n second = expression[2]\n\n VirtualKeywords.call_operator_replacement(:call_or, first, second)\n end",
"def match_and_both?(expected)\n match?(expected) ? [@lookahead.type, @lookahead.value] : nil\n end",
"def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] == '1'\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend",
"def or other_result\n result = dup\n result.matched = hash_union(matched, other_result.matched)\n result.not_matched = hash_union(not_matched, other_result.not_matched)\n result\n end",
"def process_or(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? #{tmp} : (#{process(b)}))\"\n end\n end\n end\n\n return resultify(res)\n end",
"def *(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\" \r\n \r\n if first.ok?\r\n matched += first.matched\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched += second.matched\r\n ParserResult.ok(second.output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n else\r\n first\r\n end\r\n end\r\n end",
"def get_and_or_not_of str\n # @param str is a string (not normalized!)\n # ie. ['big','OR','middle','OR','large','sandwich','NOT','cheese']\n # @returns and_phrases -- list of normalized words\n # @returns or_phrases -- list of lists of normalized words\n # @returns not_phrases -- list of normalized words\n # actually and_phrases is the same to or_phrases but in and_phrases\n # single words have replaced or-sublists\n \n r = str.split\n \n # returns or-words and indexes of already analyzed words\n def getOr_ r\n or_= []; del_ = []; cur = []\n status = :start\n x = 0\n while x < r.length do\n if r[x] == OR_OPERATOR\n if status == :start\n cur = [r[x-1]]\n status = :cont\n del_.push x-1\n end\n cur.push r[x+1]\n del_ += [x, x+1]\n x += 2\n else\n if status == :cont\n status = :start\n or_.push cur\n cur = []\n end\n x += 1\n end\n end\n if not cur.empty?\n or_.push cur\n end\n return or_, del_\n end\n \n def getAndNot_ r, skip\n and_ = []; not_ = []\n r.length.times do |x|\n if not skip.include?(x)\n # if previous or last (if x = 0) in array is NOT\n if r[x-1] == NOT_OPERATOR\n not_ |= [r[x]]\n elsif r[x] != NOT_OPERATOR\n and_ |= [r[x]]\n end\n end\n end\n return and_, not_\n end\n \n or_phrases, skip = getOr_ r\n and_phrases, not_phrases = getAndNot_ r, skip\n \n return normalize_list(and_phrases), normalize_list(or_phrases), normalize_list(not_phrases)\n end",
"def |(arg)\n Anagram::Matching::TypeMatcher.new(self)|arg\n end",
"def |(other)\n RLSM::RegExp.new \"#@string|#{other.string}\"\n end",
"def get_and_or_not_exact_of(phrase)\n two_word_phrases = [] # exact phrases from two words and up\n and_phrases, or_phrases, not_phrases = [], [], []\n \n # Divide phrase by double brackets to split\n # exact phrase search and regular seach.\n phrase.split(BRACKET).each_with_index do |p, i|\n if i.odd? and p.index(\" \")\n # First priority.\n # Exact phrase search - search inside brackets.\n # It doen't matter if bracket closed.\n # Also it makes sense if there are at least\n # two words in a phrase.\n two_word_phrases.push(normalize p)\n else\n # Second priority is OR operator\n # to make sure that search query is commutating.\n # For example if it not commutating then \"A OR B C\" equals \"A & C\" OR \"B & C\"\n # but \"C A OR B\" equals \"C & A\" OR \"B\".\n # Actually it should be \"C & A\" OR \"C & B\" where OR and &\n # are symmetric.\n and_, or_, not_ = get_and_or_not_of p\n # append to found in previous iterations\n and_phrases |= and_; or_phrases |= or_; not_phrases |= not_\n end\n end\n return and_phrases, or_phrases, not_phrases, two_word_phrases\n end",
"def |( other_filter )\n\t\treturn other_filter if self.promiscuous?\n\t\treturn self.dup if other_filter.promiscuous?\n\n\t\t# Collapse nested ORs into a single one with an additional alternation\n\t\t# if possible.\n\t\tif self.component.respond_to?( :add_alternation )\n\t\t\tself.log.debug \"collapsing nested ORs...\"\n\t\t\tnewcomp = self.component.dup\n\t\t\tnewcomp.add_alternation( other_filter )\n\t\t\treturn self.class.new( newcomp )\n\t\telse\n\t\t\treturn self.class.new( :or, [self, other_filter] )\n\t\tend\n\tend",
"def |(expr2)\n Operator.new(S_OR, self, expr2)\n end",
"def or_matcher(*args)\n OrMatcher.new(args)\n end",
"def ABCheck(str)\n\n return \"true\" if str=~(/a...b/) or str=~(/b...a/)\n return \"false\"\n \nend",
"def or a, b\n a.prove { yield }\n b.prove { yield }\n end",
"def /(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\" \r\n if first.ok?\r\n matched = matched + first.matched\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched = matched + second.matched\r\n ParserResult.ok(first.output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n else\r\n first\r\n end\r\n end\r\n end",
"def ABCheck(str)\n str =~ /a...b/ || str =~ /b...a/ ? true : false\nend",
"def logical_or\n expr = logical_and\n\n while match?(:or)\n operator = previous\n right = logical_and\n expr = Ringo::Logical.new(expr, operator, right)\n end\n\n expr\n end",
"def or(*exps)\n joined_exps = exps.join(' and ')\n @query[:filters] += \" or #{joined_exps}\"\n self\n end",
"def or(other)\n other\n end",
"def |(matcher)\n OrMatcher.new([self,matcher])\n end",
"def process_op_asgn_or(exp)\n ref = exp.shift\n asgn = exp.shift\n asgn[2] = [:or, ref, asgn[2]]\n process(asgn)\n end",
"def or(*others)\n self.class.or(self, *others)\n end",
"def bitwise_exclusive(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif (val == '1' && b[index] == '0') || (val == '0' && b[index] == '1')\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend",
"def define_match_any_of\n klass.send(:define_method, :match_any_of) do |tags|\n if tags.empty?\n str(\"\")\n else\n tags.map { |tag| str(tag) }.inject do |tag_chain, tag|\n tag_chain.send :|, tag\n end\n end\n end\n end",
"def taxamatch(str1, str2, return_boolean = true)\n preparsed_1 = @parser.parse(str1)\n preparsed_2 = @parser.parse(str2)\n match = taxamatch_preparsed(preparsed_1, preparsed_2) rescue nil\n return_boolean ? (!!match && match['match']) : match\n end",
"def |(other)\n Or.new(self, other)\n end",
"def or!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 60 )\n\n type = OR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 388:6: '||'\n match( \"||\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 60 )\n\n end",
"def or!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 72 )\n\n type = OR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 193:6: '||'\n match( \"||\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 72 )\n\n end",
"def or_expr\n expr = and_expr()\n\n while match(:or)\n operator = previous()\n right = and_expr()\n expr = Expr::Logical.new expr, operator, right\n end\n\n expr\n end",
"def | other\n call_enum \"boolean\", other, :or\n end",
"def or_clause\n a = and_clause\n\n space\n if accept(/or +/i)\n b = or_clause\n AST.new(:or, [a, b])\n else\n a\n end\n end",
"def or_exp(expression)\n @use_disjunction = true\n @disjunction = @builder.and(@disjunction,expression)\n\n self\n end",
"def logical_or\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n return_value = LogicalOrReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal229 = nil\n logical_and228 = nil\n logical_and230 = nil\n\n tree_for_string_literal229 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 581:5: logical_and ( '||' logical_and )*\n @state.following.push( TOKENS_FOLLOWING_logical_and_IN_logical_or_3844 )\n logical_and228 = logical_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_and228.tree )\n end\n # at line 581:17: ( '||' logical_and )*\n while true # decision 52\n alt_52 = 2\n look_52_0 = @input.peek( 1 )\n\n if ( look_52_0 == OR )\n alt_52 = 1\n\n end\n case alt_52\n when 1\n # at line 581:20: '||' logical_and\n string_literal229 = match( OR, TOKENS_FOLLOWING_OR_IN_logical_or_3849 )\n if @state.backtracking == 0\n\n tree_for_string_literal229 = @adaptor.create_with_payload( string_literal229 )\n root_0 = @adaptor.become_root( tree_for_string_literal229, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_logical_and_IN_logical_or_3853 )\n logical_and230 = logical_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_and230.tree )\n end\n\n else\n break # out of loop for decision 52\n end\n end # loop for decision 52\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 49 )\n\n end\n \n return return_value\n end",
"def either_matcher *pattern\n lambda do |string, index = 0, counts:|\n original_counts = counts.dup\n\n pattern.each do |matcher|\n found = matcher.call(string, index, counts: counts)\n\n if match? found\n return found\n else\n counts.replace(original_counts)\n end\n end\n\n nil\n end\n end",
"def on_or(ast_node, context)\n left, right = *ast_node\n\n return on_call_boolean(context, left) || on_call_boolean(context, right)\n end",
"def or_b\n end",
"def match(other)\n String.new(self).match other\n end",
"def =~(left, right)\n raise if right.is_a? Regexp\n \"#{left}#{quotify right}\"\n end",
"def either(_left, right); end",
"def test_or_implies(stmt)\n l = eval_side(stmt.left)\n r = eval_side(stmt.right)\n if !l.nil? && !l\n set_truth(stmt.right.left) if stmt.right.type == :terminal\n elsif !r.nil? && !r\n set_truth(stmt.left.left) if stmt.left.type == :terminal\n end\n end",
"def match!( other )\n return false unless prefers?( other ) && !matched?( other )\n matches << other\n other.matches << self\n end",
"def |(other)\n `return other.$r ? Qtrue : Qfalse;`\n end",
"def both(left, right)\n \"#{quotify left} AND #{quotify right}\"\n end",
"def matches?(str1, str2)\n str1.start_with?(str2) || str2.start_with?(str1)\n end",
"def either(left, _right); end",
"def |(other)\n a = first_param\n b = other.first_param\n\n case\n when a.is_a?(RequiredPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(RequiredPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.nil?\n self.drop_first&.with_first_param(OptionalPositional.new(a.type))\n when a.is_a?(OptionalPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.nil?\n (self.drop_first | other)&.with_first_param(a)\n when a.is_a?(RestPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(RestPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.nil?\n (self.drop_first | other)&.with_first_param(a)\n when a.nil? && b.is_a?(RequiredPositional)\n other.drop_first&.with_first_param(OptionalPositional.new(b.type))\n when a.nil? && b.is_a?(OptionalPositional)\n (self | other.drop_first)&.with_first_param(b)\n when a.nil? && b.is_a?(RestPositional)\n (self | other.drop_first)&.with_first_param(b)\n when a.nil? && b.nil?\n required_keywords = {}\n optional_keywords = {}\n\n (Set.new(self.required_keywords.keys) & Set.new(other.required_keywords.keys)).each do |keyword|\n required_keywords[keyword] = AST::Types::Union.build(\n types: [\n self.required_keywords[keyword],\n other.required_keywords[keyword]\n ]\n )\n end\n\n self.optional_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = other.required_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when s = other.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = other.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n other.optional_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = self.required_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when s = self.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = self.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n self.required_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = other.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = other.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n other.required_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = self.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = self.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n\n rest = case\n when self.rest_keywords && other.rest_keywords\n AST::Types::Union.build(types: [self.rest_keywords, other.rest_keywords])\n when self.rest_keywords\n if required_keywords.empty? && optional_keywords.empty?\n self.rest_keywords\n end\n when other.rest_keywords\n if required_keywords.empty? && optional_keywords.empty?\n other.rest_keywords\n end\n else\n nil\n end\n\n Params.new(\n required: [],\n optional: [],\n rest: nil,\n required_keywords: required_keywords,\n optional_keywords: optional_keywords,\n rest_keywords: rest)\n end\n end",
"def otherwise(value = nil)\n @prefixes += \"(?:\"\n @suffixes = \")\" + @suffixes\n append(\")|(?:\")\n find(value) if value\n end",
"def union(arg1, *arg2)\n first = arg1\n rest = []\n arg2.each do |char|\n char.each do |subchar|\n rest << subchar\n end\n end\n return first + rest\n \nend",
"def |(alternative_parslet)\n ParsletChoice.new self.to_parseable,\n alternative_parslet.to_parseable\n end",
"def separated_by?(string, a, b, separator)\n string.include?(a+separator+b) or string.include?(b+separator+a)\nend",
"def not_regexp(left, right)\n # could be DRYer, but this is more readable than: \"NOT #{self.=~(left,right)}\"\n raise if right.is_a? Regexp\n \"NOT #{left}#{quotify right}\"\n end",
"def virtual_or(&block)\n virtualize_keyword(:or, @or_rewriter, block)\n end",
"def disjunction_expressions(left_expression, left_expression_joins, right_expression,\n right_expression_joins)\n if left_expression == ALWAYS_TRUE || right_expression == ALWAYS_TRUE\n [ALWAYS_TRUE, []]\n elsif left_expression == ALWAYS_FALSE\n [right_expression, right_expression_joins]\n elsif right_expression == ALWAYS_FALSE\n [left_expression, left_expression_joins]\n else\n [left_expression | right_expression, left_expression_joins + right_expression_joins]\n end\n end",
"def or(other)\n to_unbound_task_predicate\n .or(other.to_unbound_task_predicate)\n end",
"def ABCheck(str)\n str.match?(/a.{3}b/) || str.match?(/b.{3}a/)\nend",
"def or!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n\n\n type = OR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 29:5: '||'\n match( \"||\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n\n end",
"def unite_words\n _, a_rest, a_word = %r{^(.* )?(\\w+)$}.match(a.text).to_a # a ends with word character\n _, b_word, b_rest = %r{^(\\w+\\s*)(.* )?$}.match(b.text).to_a # b starts with word character\n\n if a_word && b_word\n if a_word.length > b_word.length\n shift_backward(b_word)\n else\n shift_forward(a_word)\n end\n end\n end",
"def or_asgn!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 74 )\n\n type = OR_ASGN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 195:11: '||='\n match( \"||=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 74 )\n\n end",
"def exclusive_or (p,q)\n p ^ q\nend",
"def |(ce)\n BooleanExpression.new(:OR, self, ce)\n end",
"def choose(one, two, prioritize)\n return nil if one.nil? && two.nil?\n\n case\n when one == two\n one\n when one.nil?\n two\n when two.nil?\n one\n when ACCEPTED.any? { |word| one.end_with?(word) }\n ACCEPTED.each do |word|\n one.sub!(word, '')\n end\n one\n when ACCEPTED.any? { |word| two.end_with?(word) }\n ACCEPTED.each do |word|\n two.sub!(word, '')\n end\n two\n when REJECTED.any? { |word| two.end_with?(word) }\n one\n when REJECTED.any? { |word| one.end_with?(word) }\n two\n else\n other = one == prioritize ? two : one\n puts \" #{prioritize} (#{other})\" if Viva::DEBUG\n prioritize\n end\n end",
"def test_or\n assert_false F | F, 'F | F'\n assert_maybe F | M, 'F | M'\n assert_true F | T, 'F | T'\n\n assert_maybe M | F, 'M | F'\n assert_maybe M | M, 'M | M'\n assert_true M | T, 'M | T'\n\n assert_true T | F, 'T | F'\n assert_true T | M, 'T | M'\n assert_true T | T, 'T | T'\n end",
"def new_simplification_rules_for_conjunction\n end",
"def match_mixed(test)\n case test\n when 'hello'\n 'hello'\n in [a, b]\n \"a: #{a}, b: #{b}\"\n end\nend",
"def pair_not_overlapping?\n !(self.match(/([a-z][a-z]).*\\1/)).nil?\n end",
"def combine exp, line = nil\n combined = Sexp.new(:or, self, exp).line(line || -2)\n\n combined.or_depth = [self.or_depth, exp.or_depth].compact.reduce(0, :+) + 1\n\n combined\n end",
"def google_parse_one_clause(str, goods, bads)\n if str.sub!(/^-\"([^\"]+)\"( |$)/, \"\") ||\n str.sub!(/^-(\\S+)( |$)/, \"\")\n bads << Regexp.last_match(1)\n elsif str.sub!(/^((\"[^\"]+\"|\\S+)( OR (\"[^\"]+\"|\\S+))*)( |$)/, \"\")\n str2 = Regexp.last_match(1)\n or_strs = []\n while str2.sub!(/^\"([^\"]+)\"( OR |$)/, \"\") ||\n str2.sub!(/^(\\S+)( OR |$)/, \"\")\n or_strs << Regexp.last_match(1)\n end\n goods << or_strs\n else\n raise(\"Invalid search string syntax at: '#{str}'\") if str != \"\"\n\n return true\n end\n false\n end",
"def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end",
"def m_ar_or_chain_1\n Rows.where(:x || :y)\n end",
"def all_or(*args)\n Term.get OrTerm, *args\n end",
"def test_a_vertical_pipe_means_or\n grays = /(James|Dana|Summer) Gray/\n assert_equal 'James Gray', \"James Gray\"[grays]\n assert_equal 'Summer', \"Summer Gray\"[grays, 1]\n assert_equal nil, \"Jim Gray\"[grays, 1]\n end",
"def match?(args)\n if @matchers.empty?\n @logger.log_if_debug('[CombiningMatcher] Matchers Empty')\n return false\n end\n\n case @combiner\n when Combiners::AND\n matches = eval_and(args)\n @logger.log_if_debug(\"[CombiningMatcher] Combiner AND result -> #{matches}\")\n return matches\n else\n @logger.log_if_debug(\"[CombiningMatcher] Invalid Combiner Type - Combiner -> #{@combiner}\")\n @logger.error('Invalid combiner type')\n end\n\n false\n end",
"def or\n x, y = stack.pop(2)\n push x | y\n end",
"def match_a_b?(string)\n if /b/.match(string)\n puts \"we have a match\"\n else \n puts \"no match at all\"\n end\nend",
"def parse_expression\r\n parse_term\r\n while(@cur_token.kind == :OR)\r\n accept_it\r\n parse_term\r\n end\r\n end",
"def |(other)\n pp = PositionalParams.merge_for_union(positional_params, other.positional_params) rescue return\n kp = keyword_params | other.keyword_params or return\n Params.new(positional_params: pp, keyword_params: kp)\n end",
"def >(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\"\r\n output = []\r\n if first.ok?\r\n matched = first.matched\r\n output += first.output\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched = matched + second.matched\r\n output = [*output, second.output]\r\n ParserResult.ok(output, matched: matched, remaining: second.remaining)\r\n else\r\n first\r\n end\r\n else\r\n ParserResult.fail(input)\r\n end\r\n end\r\n end",
"def second_anagram?(str1, str2)\n str1.chars.each do |el|\n if str2.include?(el)\n str1 = str1.sub(el, \"\")\n str2 = str2.sub(el, \"\")\n end\n end\n\n str1.empty? && str2.empty?\nend",
"def or_else(*args, &block)\n Utils.assert_arg_or_block!(\"or_else\", *args, &block)\n super.tap do |result|\n Utils.assert_type!(result, left_class, right_class)\n end\n end",
"def valid_string_and_reg_ex?(char_string, reg_exp)\n str_flag = is_string?(char_string)\n regex_flag = is_reg_exp?(reg_exp) \n puts \"First argument should be a String.\" unless(str_flag)\n puts \"Second argument should be a Regular Expression.\" unless(regex_flag)\n str_flag && regex_flag\nend",
"def or(*array_matchers, **keyword_matchers)\n create_matcher('or', array_matchers, keyword_matchers)\n end",
"def or(*array_matchers, **keyword_matchers)\n create_matcher('or', array_matchers, keyword_matchers)\n end",
"def adjacent_either(a, b)\n (adjacent_undirected(a) + adjacent_undirected(b)).uniq\n end",
"def or(other)\n if self && !self.nil?\n self\n else\n other\n end\n end",
"def OrExpr(path, parsed); end",
"def process_match2(exp)\n left = exp.shift\n right = exp.shift\n return process(s(:call, left, :=~, s(:array, right)))\n end",
"def test_unique_predicate_or\n g = Grammar.new(\"parser grammar v;\\n\" + \"\\n\" + \"a : {a}? b\\n\" + \" | {b}? b\\n\" + \" ;\\n\" + \"\\n\" + \"b : {c}? (X)+ ;\\n\" + \"\\n\" + \"c : a\\n\" + \" | b\\n\" + \" ;\\n\")\n expecting = \".s0-X->.s1\\n\" + \".s1-{((b&&c)||(a&&c))}?->:s2=>1\\n\" + \".s1-{c}?->:s3=>2\\n\"\n unreachable_alts = nil\n non_det_alts = nil\n ambig_input = nil\n insufficient_pred_alts = nil\n dangling_alts = nil\n num_warnings = 0\n check_decision(g, 3, expecting, unreachable_alts, non_det_alts, ambig_input, insufficient_pred_alts, dangling_alts, num_warnings, false)\n end",
"def cf_or ( a, b )\r\n# Combine for 'A or B'\r\n if a>0 and b>0\r\n a + b - a*b\r\n elsif a<0 and b<0\r\n a + b + a*b\r\n else\r\n (a + b) / ( 1 - [a.abs, b.abs].min )\r\n end\r\nend",
"def exclusive_or(num1, num2)\r\n\t# your code here\r\nend",
"def parse_either(source); end",
"def >>(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\" \r\n output = []\r\n if first.ok?\r\n matched = matched + first.matched\r\n output += first.output\r\n second = other.run(first.remaining)\r\n if second.ok?\r\n matched = matched + second.matched\r\n output = [*output, second.output]\r\n ParserResult.ok(output, matched: matched, remaining: second.remaining)\r\n else\r\n ParserResult.fail(input)\r\n end\r\n else\r\n first\r\n end\r\n end\r\n end",
"def second_anagram?(str1, str2)\n letters1 = str1.chars\n letters2 = str2.chars\n\n str1.chars.each do |c|\n match1 = letters1.index(c)\n match2 = letters2.index(c)\n\n return false unless match1 && match2\n\n letters1.delete_at(match1)\n letters2.delete_at(match2)\n end\n\n letters1.empty? && letters2.empty?\nend"
] |
[
"0.6599361",
"0.6116721",
"0.60981584",
"0.6083554",
"0.60451037",
"0.6035708",
"0.6023002",
"0.5913581",
"0.58657324",
"0.5855425",
"0.5779021",
"0.5775417",
"0.5757424",
"0.57457024",
"0.57374763",
"0.5737463",
"0.57156444",
"0.56731385",
"0.5655394",
"0.56277335",
"0.56174076",
"0.5608363",
"0.55771965",
"0.5539204",
"0.55093765",
"0.55089754",
"0.54461855",
"0.54380774",
"0.5437771",
"0.54165125",
"0.53766733",
"0.5374233",
"0.5342108",
"0.5337768",
"0.5314219",
"0.5310173",
"0.529103",
"0.52849776",
"0.52726454",
"0.5271451",
"0.5256776",
"0.5255113",
"0.525028",
"0.52315986",
"0.52062654",
"0.519659",
"0.5189214",
"0.5159452",
"0.51470715",
"0.51353014",
"0.5121719",
"0.5119712",
"0.5109389",
"0.5094292",
"0.509391",
"0.509335",
"0.50864536",
"0.50856066",
"0.5085152",
"0.50780946",
"0.5076048",
"0.50702",
"0.50648975",
"0.50646394",
"0.5062099",
"0.50608784",
"0.5053436",
"0.5039872",
"0.5032295",
"0.50250614",
"0.5024154",
"0.50204384",
"0.5017668",
"0.5014838",
"0.501153",
"0.5005733",
"0.5002359",
"0.5001894",
"0.4999853",
"0.4995465",
"0.4993811",
"0.49874562",
"0.49871355",
"0.49656695",
"0.49633193",
"0.49462718",
"0.49458867",
"0.4940815",
"0.49350575",
"0.49348968",
"0.49348968",
"0.49218717",
"0.49163297",
"0.49157184",
"0.48952645",
"0.48890737",
"0.48884335",
"0.4887505",
"0.48866108",
"0.4884993",
"0.48846617"
] |
0.0
|
-1
|
Tests for absence of a parslet atom in the input stream without consuming it. Example: Only proceed the parse if 'a' is absent. str('a').absnt?
|
def absnt?
Parslet::Atoms::Lookahead.new(self, false)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def liberal_parsing?() @liberal_parsing end",
"def none?\n @value.to_s.empty? or /\\Anone\\z/io.match(@value.to_s)\n end",
"def atom_safe?( str )\n not ATOM_UNSAFE === str\n end",
"def is_missing?(value)\n value.nil? or (String===value and value.strip.empty?)\n end",
"def blocks_parse(input)\n return nil\nend",
"def check_string(string)\n string.empty? ? nil : string\n end",
"def nullp\n self.parse_null.singleton?\n end",
"def parse_blank_line; end",
"def ignore?(buf); end",
"def test_parser_handles_empty_simple_content\n simple_content_assert nil, nil\n simple_content_assert nil, ''\n end",
"def empty?\n warn \"StringScanner#empty? is obsolete; use #eos? instead?\" if $VERBOSE\n eos?\n end",
"def unknown?\n\t\treturn name.to_s == \"\"\n\tend",
"def absent?; end",
"def present?(string)\n return !blank?(string)\n end",
"def interpret(value)\n value == \"\" ? nil : value\n end",
"def success?\n unparser.success? && missing.empty? && unexpected.empty?\n end",
"def missing?(obj)\n obj.to_s.strip.empty?\n end",
"def not_keyword(string)\n\t\t(str(string) >> identifier_match.absent?).absent?\n\tend",
"def unquoted?(value)\n !quoted?(value)\n end",
"def missing(obj)\n obj.to_s.strip.empty?\n end",
"def expect_no_output(output)\n if output.respond_to?(:~)\n assert_matching_output('^((?!#{output}).)*$', all_output)\n else\n assert_no_partial_output(output, all_output)\n end\n end",
"def prad_valid? str\n return false unless str\n !!parse(str)\n end",
"def empty_nil_blank?(str, raize=false)\n result = (str !~ /[^[:space:]]/ || str.nil? || str.empty?)\n raise ShellTastic::CommandException.new(\"Command is emtpy or nil\") if result and raize\n result\n end",
"def test_empty_stmt\n assert_parses(\n nil,\n %q{})\n end",
"def peek_no_space; end",
"def none(input)\n if input == 'none'\n ''\n else\n input\n end\n end",
"def parse_bool() false end",
"def parse_bool() false end",
"def blank?\n !!processed_content.match(/\\A(^\\s+$)*\\z/)\n end",
"def parse(m)\n false\n end",
"def empty(input)\n string = input.to_s\n if string.length != 0\n return false\n else\n return true\n end\nend",
"def non_empty_input\n input = gets.chomp while input == '' or input == nil\n input\nend",
"def noop\n @parse_success = false\n @valid = false\n end",
"def is_non_terminal?(s)\n (s[0] == \"<\" and s[s.length-1] == \">\")\n\nend",
"def is_non_terminal?(s)\r\n # TODO: your implementation here\r\n # puts s[0] == \"<\" && s[-1] == \">\"\r\n # puts s[-1]\r\n return s[0] == \"<\" && s[-1] == \">\"\r\nend",
"def skip\n ParsletOmission.new self.to_parseable\n end",
"def isok(input)\n # make sure that the input does not contain system ''\n ! input.downcase.include? 'system'\n end",
"def blank?\n strip.empty?\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n fail ArgumentError, \"#{name} must be given\"\n end\n end",
"def string?\n !@arg[:textValue].nil?\n end",
"def expect_no_output(output)\n if output.respond_to?(:~)\n @review.wont_match(output)\n else\n @review.wont_include(output)\n end\n end",
"def consume_string(ending = T.unsafe(nil)); end",
"def test_string_literal_empty\n check(C::StringLiteral, <<-EOS)\n |\"\"\n EOS\n end",
"def parse_not_found\n if @input.match?(/% Object \"(.*)\" not found in database\\n/)\n while @input.scan(/%(.*)\\n/) # strip junk\n end\n @ast[\"NotFound\"] = true\n end\n end",
"def blank?\n strip.size == 0\n end",
"def should_parse?\n parsed? == false && headers['x-amp'] != 'skip'\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n raise ArgumentError, \"#{name} must be given\"\n end\n end",
"def token_data_blank?(data); !data or (data.respond_to?(:empty?) and data.empty?) end",
"def is_command_line_arg_empty(arg)\n arg.nil? or arg.empty?\nend",
"def test_missing_milestone_is_empty_string\n assert_equal( '', @incomplete[ :milestone ] )\n end",
"def empty?(input)\n input == \"\" ? true : false\n end",
"def blank?\n self.strip.length === 0\n end",
"def stop_here?(param)\n # No param Explicit HTML attribute Implicit HTML attribute\n param.nil? || param.match?(/^--\\S*/) || param.match?(/^\\w*=\"/)\n end",
"def blank?( string )\n string.respond_to?(:empty?) ? !!string.empty? : !string\n end",
"def not!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 61 )\n\n type = NOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 389:7: '!'\n match( 0x21 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 61 )\n\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n raise ArgumentError, \"#{name} must be given\"\n end\n end",
"def blank?\n self.strip.size == 0\n end",
"def ignore?\n input.to_s[0] == '_'\n end",
"def empty?\n @stream.eof and @tokens.empty?\n end",
"def scrub_input(instring)\n unless instring =~ /\\A[a-zA-Z0-9\\.\\-_]*\\z/\n puts \"#{instring} is an invalid attribute\"\n exit 1\n end\nend",
"def remove_reluctant(strio)\r\n return if strio.eof?\r\n if (ch=strio.getc) == ??\r\n #Do nothing\r\n else\r\n strio.ungetc(ch)\r\n end\r\nend",
"def not!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 64 )\n\n type = NOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 185:7: '!'\n match( 0x21 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 64 )\n\n end",
"def DISABLED_test_empty_string\n assert_tokenises_as ''\n end",
"def is_empty(str)\n if str[0] == nil\n return true\n else\n return false\n end\nend",
"def no_empty_inputs(text, err=nil)\n input_text = prompt_user(text)\n err ||= text\n input_text = prompt_user(err) while input_text.empty?\n input_text\nend",
"def test_parse_invalid\r\n array = @g.parse('abc:123', '>')\r\n assert_equal 1, array.size\r\n assert_equal \"abc:123\", array[0]\r\n end",
"def potential_false_positive?\n content.strip =~ CC_FALSE_POSITIVE_REGEX\n end",
"def is_empty(s)\n return true if s.nil?\n return true if s.length == 0\n return false\n end",
"def readAfterSkip()\n r = nil ;\n while(r = @strm.gets())\n break if (!(r =~ /errors/ || r =~ /warnings/)) ;\n end\n return r ;\n end",
"def none?; end",
"def none?; end",
"def none?; end",
"def provided?\n !@str.nil?\n end",
"def can_show? str\n \treturn not(str.nil? || str === \"\")\n end",
"def absent\n Rule.new error: :present, predicate: -> { _1.nil? }\n end",
"def is_non_terminal?(s)\n # TODO: your implementation here\n /<[\\w-]+>/.match(s)\n #------------------------------------------------------------------------\n #\\w regular expression = Any word character(letter, number, underscore)\n #The brackets accept the range of the matching\n #The plus sign expands multiple words where the - allows hyphenations\n #like that of the Bond-movie file\n #------------------------------------------------------------------------\nend",
"def hyphen_absent?\r\n aba_routing_no_frm_db_with_hyphen = @micr_line_info.aba_routing_number.match(/[\\-]/)\r\n payer_account_no_frm_db_with_hyphen = @micr_line_info.payer_account_number.match(/[\\-]/)\r\n hyphen_absent = aba_routing_no_frm_db_with_hyphen == nil &&\r\n payer_account_no_frm_db_with_hyphen == nil\r\n end",
"def is_undefined!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 87 )\n\n type = IS_UNDEFINED\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 208:16: 'undefined?'\n match( \"undefined?\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 87 )\n\n end",
"def should_parse?(line)\n stripped = line.strip\n (!stripped.empty?) && (!stripped.start_with?('#'))\n end",
"def response_incomplete?\n content_for_scanner.strip == \"\"\n end",
"def commit_msg_empty?(msg)\n msg.lines.grep(/^(?!#).*\\S.*^/).empty?\nend",
"def parse_not_found\n if @input.match?(/Nincs (.*?) \\/ No match\\n/)\n p(\"whois.nic.hu: parse_not_found\") if 1 == 2 || $DEBUG\n @input.scan(/Nincs (.*?) \\/ No match\\n/)\n return @ast['NotFound'] = true\n end\n @ast['NotFound'] = false\n end",
"def is_empty(str)\n i = 0\n output = true\n\n while i <= str.length\n if str[i] != nil\n output = false\n end\n i += 1\n end\n return output\nend",
"def test_non_url_value_gives_empty_string\n assert_equal( '', @incomplete[ :url ] )\n end",
"def is_useful_non_terminal?(symbol)\n [ :program, :statement ].include?(symbol)\n end",
"def valid_user_input?(input)\n input.length > 0\n end",
"def empty_parser?\n delegated_parser.empty_parser?\n end",
"def test_parser_handles_nil_or_empty\n assert_equal expected_response, ApiParser.parse_email\n end",
"def empty?() end",
"def empty?() end",
"def empty?() end",
"def test_absent_fields\n record = nil\n assert_nothing_raised do\n record = @parser.record_line :record, :fields => %w{one two three},\n :optional => %w{two three}\n end\n assert_equal(\"\", record.absent, \"Did not set a default absent string\")\n\n result = nil\n assert_nothing_raised do\n\n result = @parser.to_line(\n :record_type => :record,\n\n :one => \"a\", :two => :absent, :three => \"b\")\n end\n\n assert_equal(\"a b\", result, \"Absent was not correctly replaced\")\n\n # Now try using a different replacement character\n record.absent = \"*\" # Because cron is a pain in my ass\n assert_nothing_raised do\n result = @parser.to_line(:record_type => :record, :one => \"a\", :two => :absent, :three => \"b\")\n end\n\n assert_equal(\"a * b\", result, \"Absent was not correctly replaced\")\n\n # Make sure we deal correctly with the string 'absent'\n assert_nothing_raised do\n\n result = @parser.to_line(\n :record_type => :record,\n\n :one => \"a\", :two => \"b\", :three => 'absent')\n end\n\n assert_equal(\"a b absent\", result, \"Replaced string 'absent'\")\n\n # And, of course, make sure we can swap things around.\n assert_nothing_raised do\n\n result = @parser.to_line(\n :record_type => :record,\n\n :one => \"a\", :two => \"b\", :three => :absent)\n end\n\n assert_equal(\"a b *\", result, \"Absent was not correctly replaced\")\n end",
"def parsed?\n @raw.nil?\n end",
"def location_empty?( attr )\n attr[ 'uri' ].blank? &&\n attr[ 'file_name' ].blank? &&\n attr[ 'doc_code' ].blank? &&\n attr[ 'doc_version' ].blank?\n end",
"def blank?(str)\n str.nil? || str.to_s.strip == ''\nend",
"def empty?()\n read_content_from_tar.nil?\n end",
"def eof?\n peek_lit(nil).nil?\n end",
"def test_decode_nil()\n input = [131, 106]\n expected = nil\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end",
"def is_empty(str)\n return str.empty?\nend",
"def extract_nonblanks(str)\n Types.check( binding, { :str => ComposedString } )\n\n str.gsub(/(.*)/) do |text|\n NonBlank.new(text)\n end\n end"
] |
[
"0.5951514",
"0.57234496",
"0.563946",
"0.5633084",
"0.5585235",
"0.5575473",
"0.5559646",
"0.5534272",
"0.55145633",
"0.5508625",
"0.5506903",
"0.549662",
"0.5493121",
"0.54790026",
"0.54713666",
"0.5426929",
"0.5417753",
"0.54136544",
"0.54093033",
"0.54036856",
"0.5374929",
"0.53643334",
"0.5347931",
"0.533585",
"0.53259075",
"0.52957684",
"0.52896565",
"0.52896565",
"0.5288927",
"0.5283614",
"0.5282385",
"0.5282093",
"0.52732754",
"0.5258662",
"0.5249589",
"0.52478755",
"0.5229524",
"0.52260274",
"0.5225626",
"0.5205545",
"0.5199249",
"0.51808494",
"0.517439",
"0.517312",
"0.517019",
"0.5170154",
"0.51629835",
"0.5146628",
"0.51452434",
"0.51385194",
"0.5133397",
"0.5127104",
"0.5119275",
"0.51181763",
"0.5116622",
"0.5109275",
"0.51083595",
"0.5103623",
"0.51007557",
"0.5091506",
"0.50904703",
"0.5090269",
"0.50900006",
"0.50863963",
"0.50854886",
"0.5081255",
"0.50789624",
"0.5078094",
"0.50606465",
"0.5059494",
"0.5059494",
"0.5059494",
"0.5054967",
"0.5051671",
"0.50512964",
"0.5047509",
"0.50439864",
"0.50425917",
"0.5041136",
"0.5033713",
"0.5007227",
"0.5001556",
"0.5000258",
"0.49990407",
"0.4993242",
"0.4990264",
"0.49888673",
"0.4986012",
"0.49608228",
"0.49608228",
"0.49608228",
"0.49578413",
"0.4957137",
"0.4953777",
"0.49490732",
"0.49444118",
"0.49418637",
"0.4939555",
"0.49380085",
"0.4935165"
] |
0.5851146
|
1
|
Tests for presence of a parslet atom in the input stream without consuming it. Example: Only proceed the parse if 'a' is present. str('a').prsnt?
|
def prsnt?
Parslet::Atoms::Lookahead.new(self, true)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def liberal_parsing?() @liberal_parsing end",
"def can_parse?(str)\n str.match(/^#{tag}\\=[^\\x01]*\\x01/)\n end",
"def prad_valid? str\n return false unless str\n !!parse(str)\n end",
"def should_parse?\n parsed? == false && headers['x-amp'] != 'skip'\n end",
"def should_parse?(line)\n stripped = line.strip\n (!stripped.empty?) && (!stripped.start_with?('#'))\n end",
"def nullp\n self.parse_null.singleton?\n end",
"def atom_safe?( str )\n not ATOM_UNSAFE === str\n end",
"def success?\n unparser.success? && missing.empty? && unexpected.empty?\n end",
"def parsed?\n @raw.nil?\n end",
"def present?(string)\n return !blank?(string)\n end",
"def parseElement?(string)\n return string.start_with?(\"~\") ? false : true\n end",
"def can_parse?(str)\n str =~ /^#{counter_tag}\\=[^\\x01]+\\x01/\n end",
"def isok(input)\n # make sure that the input does not contain system ''\n ! input.downcase.include? 'system'\n end",
"def parse_required\n @parse_required = true\n end",
"def string?\n !@arg[:textValue].nil?\n end",
"def eof?\n peek_lit(nil).nil?\n end",
"def token_data_blank?(data); !data or (data.respond_to?(:empty?) and data.empty?) end",
"def parse(m)\n false\n end",
"def is_missing?(value)\n value.nil? or (String===value and value.strip.empty?)\n end",
"def structure?\n\t\trawString.start_with? 's'\n\tend",
"def is_useful_non_terminal?(symbol)\n [ :program, :statement ].include?(symbol)\n end",
"def commit_body? str\n not str.start_with? '*'\nend",
"def empty?\n @stream.eof and @tokens.empty?\n end",
"def empty?\n warn \"StringScanner#empty? is obsolete; use #eos? instead?\" if $VERBOSE\n eos?\n end",
"def atom?\n true\n end",
"def quickie_parsable?\n @quickie.present? && @parsed_quickie.present?\n end",
"def can_parse?(options = {})\n false\n end",
"def blocks_parse(input)\n return nil\nend",
"def present?\n @raw.present?\n end",
"def fp(x, p)\n if p.call(\"3\") == \"0\"\n false\n else\n \"str\"\n end\n end",
"def has?(param)\n \tparam and param.length > 0\n end",
"def parse_bool() false end",
"def parse_bool() false end",
"def parseable? text\n verbose, $VERBOSE = $VERBOSE, nil\n eval(\"BEGIN {return true}\\n#{text}\")\n rescue SyntaxError\n false\n ensure\n $VERBOSE = verbose\n end",
"def parse_bool() true end",
"def assert_has_stream(stream); end",
"def has_any?\n peek_console_input.size > 0\n end",
"def provided?\n !@str.nil?\n end",
"def should_spit_text?\n @tags_chain.size > 0 && \n #(not @text.empty?) &&\n [\"body\", \"p\", \"br\", \"b\", HTMLConvertor.ping_tag].include?(@tags_chain.last[:name])\n end",
"def property_is_literal_parse_type?(element, parent, &block)\n att = element.attribute_with_ns('parseType', RDF.to_uri.to_s)\n object = att.nil? ? nil : (att.value == 'Literal' ? true : nil)\n return nil if object.nil?\n block.call([parent, element.ns_name, element.to_s])\n true\n end",
"def parse\n @input.reverse!\n loop do\n if @input.empty?\n break\n end\n t = @input.pop\n t.freeze\n remainder = @conf.consume?(t)\n if remainder.nil? \n log \"+ #{t} not consumed\"\n return @conf.matchingCandidates(t)\n elsif remainder.strip.length > 0\n @input.push remainder\n end\n end\n return @conf.matchingCandidates(nil)\n end",
"def is_non_terminal?(s)\n (s[0] == \"<\" and s[s.length-1] == \">\")\n\nend",
"def is_useful_terminal?(symbol)\n symbol.is_a?(Bolverk::ASM::Token) and !([ :eof, :comma ].include?(symbol.type))\n end",
"def has_stream?(name)\n !!stream(name)\n rescue ArgumentError\n end",
"def valid?\n begin\n self.class.from_line( to_s )\n rescue ArgumentError, RuntimeError\n false\n else\n true\n end\n\n end",
"def spotify?; spotify.to_s != \"\" end",
"def none?\n @value.to_s.empty? or /\\Anone\\z/io.match(@value.to_s)\n end",
"def starts_with_p?(word)\n word.start_with?(\"<p>\")\n end",
"def buffer_valid?\r\n @buffer.is_a?(String)\r\n end",
"def empty_parser?\n delegated_parser.empty_parser?\n end",
"def present?(obj)\n case obj\n when String\n !obj.strip.empty?\n when Symbol\n !obj.to_s.strip.empty?\n when Array\n !obj.compact.empty?\n when Hash\n !obj.empty?\n when TrueClass, FalseClass\n obj\n when NilClass\n false\n when Object\n true\n end\n end",
"def ignore?(buf); end",
"def has_parser?(name); end",
"def test_5_text_before_first_john\n sample_text = \"This is some text about 1 Jn. 1:1.\"\n pericopes = Pericope.parse(sample_text)\n assert pericopes.any?, \"No pericope found.\"\n end",
"def is_non_terminal?(s)\r\n # TODO: your implementation here\r\n # puts s[0] == \"<\" && s[-1] == \">\"\r\n # puts s[-1]\r\n return s[0] == \"<\" && s[-1] == \">\"\r\nend",
"def is_non_terminal?(s)\n # TODO: your implementation here\n /<[\\w-]+>/.match(s)\n #------------------------------------------------------------------------\n #\\w regular expression = Any word character(letter, number, underscore)\n #The brackets accept the range of the matching\n #The plus sign expands multiple words where the - allows hyphenations\n #like that of the Bond-movie file\n #------------------------------------------------------------------------\nend",
"def taken?(input)\n position(input) != \"\" && position(input) != \" \"\n end",
"def plain_string?\n (type == :string || type == :text) && # String typed\n !value.nil? &&\n !value.empty? &&\n !is_text_run? && # No inline styles\n !is_formula? &&\n !is_array_formula?\n end",
"def has_preppend_input_text?\n has_preppend_input_text.present?\n end",
"def is_parser_for?(ical)\n ical =~ BINARY.to_whole_line\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n fail ArgumentError, \"#{name} must be given\"\n end\n end",
"def prim_eof?\n false\n end",
"def custom?(type)\n !primitive?(type) &&\n !structure?(type) &&\n !multiple?(type) &&\n type.respond_to?(:parse) &&\n type.method(:parse).arity == 1\n end",
"def leading_quote?\n value&.start_with?('\"')\n end",
"def emitted_by_psych?(string)\n (string =~ /\\A---\\n/) || (string =~ /\\n[.]{3}\\n\\z/)\n end",
"def consume_string(ending = T.unsafe(nil)); end",
"def complete_expression?(str); end",
"def parse_pair\n parse_string &&\n spaces &&\n must_see(\":\") &&\n spaces &&\n # We may have to fill in a rhs *null*.\n (parse_value || append('null'))\n end",
"def response_incomplete?\n content_for_scanner.strip == \"\"\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n raise ArgumentError, \"#{name} must be given\"\n end\n end",
"def parse(io)\n source = Parslet::Source.new(io)\n context = Parslet::Atoms::Context.new\n \n result = nil\n value = apply(source, context)\n \n # If we didn't succeed the parse, raise an exception for the user. \n # Stack trace will be off, but the error tree should explain the reason\n # it failed.\n if value.error?\n parse_failed(value.message)\n end\n \n # assert: value is a success answer\n \n # If we haven't consumed the input, then the pattern doesn't match. Try\n # to provide a good error message (even asking down below)\n unless source.eof?\n # Do we know why we stopped matching input? If yes, that's a good\n # error to fail with. Otherwise just report that we cannot consume the\n # input.\n if cause \n # We're not using #parse_failed here, since it assigns to @last_cause.\n # Still: We'll raise this differently, since the real cause is different.\n raise Parslet::UnconsumedInput, \n \"Unconsumed input, maybe because of this: #{cause}\"\n else\n old_pos = source.pos\n parse_failed(\n format_cause(source, \n \"Don't know what to do with #{source.read(100)}\", old_pos), \n Parslet::UnconsumedInput)\n end\n end\n \n return flatten(value.result)\n end",
"def encoding_error?(parser = T.unsafe(nil)); end",
"def is_a?(p0) end",
"def is_parser_for?(ical)\n lax? || ical =~ Text::ESCAPED_TEXT.to_whole_line\n end",
"def accept?(s, current = @start)\n false\n end",
"def skip_leader\n if @header then\n data = ''\n while s = @stream.gets(@header)\n data << s\n if data.split(/[\\r\\n]+/)[-1] == @header then\n @stream.ungets(@header)\n return true\n end\n end\n # @header was not found. For safety,\n # pushes back data with removing white spaces in the head.\n data.sub(/\\A\\s+/, '')\n @stream.ungets(data)\n return nil\n else\n @stream.skip_spaces\n return nil\n end\n end",
"def parse_quantifier\n current = current_token()\n first = (current == \"ALL\" or current == \"THE\" or current == \"MY\")\n current = advance() if first\n \n integer = parse_integer()\n \n return false unless (first or integer)\n \n if current == \"OF\"\n current = advance()\n end\n if (current == \"THE\" or current == \"MY\")\n advance()\n end\n return true\n end",
"def ping?\n @raw.start_with? 'PING'\n end",
"def isNiktoScan(payload)\n if payload.scan(/Nikto/i).length > 0\n return true\n elsif payload.scan(/\\x4E\\x69\\x6B\\x74\\x6F/).length > 0\n return true\n else\n return false\n end\nend",
"def values_present?(to_fetch, url)\n puts \"Checking presence of #{to_fetch} in #{url}\".yellow\n parsed = parse_value(to_fetch, to_fetch.split('=')[0], url)\n puts \"With result #{parsed!=nil}\".yellow\n parsed != nil\n end",
"def check_presence!(obj, name)\n if obj.nil? || (obj.is_a?(String) && obj.empty?)\n raise ArgumentError, \"#{name} must be given\"\n end\n end",
"def peek_no_space; end",
"def parse_blank_line; end",
"def parse_available\n if @input.match?(/Nincs (.*?) \\/ No match\\n/)\n @input.scan(/Nincs (.*?) \\/ No match\\n/)\n @ast[\"status:available\"] = true\n end\n end",
"def blank?\n !!processed_content.match(/\\A(^\\s+$)*\\z/)\n end",
"def valid_user_input?(input)\n input.length > 0\n end",
"def response?(value)\n STDIN.gets.chomp == value ? true : false\nend",
"def response?(value)\n STDIN.gets.chomp == value ? true : false\nend",
"def response?(value)\n STDIN.gets.chomp == value ? true : false\nend",
"def response?(value)\n STDIN.gets.chomp == value ? true : false\nend",
"def is? str\n !!match(str)\n end",
"def absnt?\n Parslet::Atoms::Lookahead.new(self, false)\n end",
"def check_string(str)\n str = str.strip\n\n return false if str =~ /<>{}/\n return false if str.length == 0\n\n return true\n end",
"def taken?(input)\n !(position(input) == \" \" || position(input) == \"\")\n end",
"def check_string(string)\n string.empty? ? nil : string\n end",
"def has_metadata?(data)\n return data.start_with?(\"\\1\\n\")\n end",
"def has_notes?\n notes&.match(/\\S/)\n end",
"def parsed?\n self.parsed == 1\n end",
"def ExOh(str)\n str.scan('x').count == str.scan('o').count ? p(\"true\") : p(\"false\")\nend",
"def is_eos?\n return !!@name.match(/^eos-.*$/)\n end"
] |
[
"0.6248207",
"0.5958705",
"0.5909923",
"0.5788839",
"0.5725381",
"0.5696414",
"0.56573516",
"0.5643221",
"0.5618856",
"0.5614513",
"0.55949306",
"0.55343765",
"0.5502125",
"0.5455556",
"0.54213727",
"0.5390533",
"0.5375019",
"0.5373965",
"0.53689283",
"0.5319413",
"0.5296652",
"0.52864116",
"0.5277157",
"0.52752376",
"0.5275101",
"0.5272215",
"0.5261127",
"0.5255299",
"0.5252934",
"0.5250072",
"0.5228645",
"0.5219519",
"0.5219519",
"0.52000475",
"0.51935196",
"0.5186156",
"0.5180494",
"0.51671743",
"0.51533026",
"0.51516545",
"0.5143639",
"0.51416224",
"0.512697",
"0.51153463",
"0.51111764",
"0.51089007",
"0.5104514",
"0.51017743",
"0.51013374",
"0.50949204",
"0.50890225",
"0.508573",
"0.5073726",
"0.50724417",
"0.50549394",
"0.5054211",
"0.50514966",
"0.50504327",
"0.50487363",
"0.50425535",
"0.5033187",
"0.5027558",
"0.50168955",
"0.5013731",
"0.5012811",
"0.500481",
"0.5004318",
"0.50002867",
"0.4999237",
"0.49920943",
"0.4985067",
"0.49842444",
"0.49835798",
"0.4983565",
"0.49801895",
"0.49745268",
"0.49744242",
"0.49734348",
"0.49716768",
"0.4967922",
"0.49664116",
"0.4955123",
"0.49420008",
"0.4938242",
"0.49378297",
"0.49359477",
"0.49333602",
"0.49333602",
"0.49333602",
"0.49333602",
"0.49329245",
"0.4930472",
"0.49303937",
"0.49297258",
"0.49254924",
"0.49232718",
"0.49219388",
"0.49186638",
"0.49174938",
"0.49096116"
] |
0.589633
|
3
|
Cause should return the current best approximation of this parslet of what went wrong with the parse. Not relevant if the parse succeeds, but needed for clever error reports.
|
def cause # :nodoc:
@last_cause
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_failure_cause; end",
"def cause_message\n root_cause.best_message\n end",
"def cause # :nodoc:\n @last_cause && @last_cause.to_s || nil\n end",
"def cause\n data.cause\n end",
"def parse_failed(cause, exception_klass=Parslet::ParseFailed)\n @last_cause = cause\n raise exception_klass,\n @last_cause.to_s\n end",
"def error(io, str, pos=nil)\n pre = io.string[0..(pos||io.pos)]\n lines = Array(pre.lines)\n \n if lines.empty?\n formatted_cause = str\n else\n pos = lines.last.length\n formatted_cause = \"#{str} at line #{lines.count} char #{pos}.\"\n end\n\n @last_cause = formatted_cause\n \n raise Parslet::ParseFailed, formatted_cause, nil\n end",
"def failure_reason(source, rend=nil)\n return \"Nothing parsed.\" unless @terminal_parse_failures\n reason, index = \"Expected one of \", @terminal_parse_failures[0]\n @terminal_parse_failures.uniq.each_with_index do |fail,i|\n next if i==0\n reason << ', ' unless i==1\n reason << \"'#{fail}'\"\n end\n reason << \" at #{index}, \" << source.line_of(index).to_s << \"::\" << source.column_of(index).to_s\n if rend\n reason << \"\\ntrailing source were\\n'\"\n reason << source[rend.stop_index..-1].to_s\n reason << \"'\"\n end\n end",
"def deepest_cause; end",
"def problems\n\t\t\treturn nil\n\t\tend",
"def format_cause(e)\n rv = curr = {}\n prev = nil\n\n cause_depth.times do\n break unless e.respond_to?(:cause) && e.cause\n\n cause = e.cause\n curr[:class] = cause.class.name\n curr[:message] = cause.message\n curr[:backtrace] = format_cause_backtrace(e, cause) if backtrace? && cause.backtrace\n\n prev[:cause] = curr unless prev.nil?\n prev, curr = curr, {}\n\n e = cause\n end\n\n if e.respond_to?(:cause) && e.cause\n prev[:cause] = {message: \"Further #cause backtraces were omitted\"}\n end\n\n rv\n end",
"def cause; end",
"def cause; end",
"def apply(source, context) # :nodoc:\n old_pos = source.pos\n \n result = context.cache(self, source) {\n try(source, context)\n }\n \n # This has just succeeded, so last_cause must be empty\n unless result.error?\n @last_cause = nil \n return result\n end\n \n # We only reach this point if the parse has failed. Rewind the input.\n source.pos = old_pos\n return result # is instance of Fail\n end",
"def error(source, str, pos=nil)\n @last_cause = format_cause(source, str, pos)\n Fail.new(@last_cause)\n end",
"def format_cause(source, str, pos=nil)\n real_pos = (pos||source.pos)\n Cause.new(str, source, real_pos)\n end",
"def message\n @cause.nil? ? super : \"#{super} (cause: #{@cause.message})\"\n end",
"def exception_cause(ex)\n if ex.respond_to?(:cause)\n ex.cause\n elsif ex.respond_to?(:parent)\n ex.parent\n else\n nil\n end\n end",
"def summary\n if error?\n error.message\n elsif actual.is_a?(::Exception)\n actual.message\n elsif actual == expected\n [\"expected\", negation, \"to\", definition].compact.join(SPACE)\n else\n [\"expected\", actual.inspect, negation, \"to\", definition].compact.join(SPACE)\n end\n end",
"def find_shortest_failure(str, &block)\n unless call_fails(str, &block)\n raise \"hey, the input didn't fail!\"\n else\n # Chop off stuff from the beginning and then the end\n # until it stops failing\n bad = str\n 0.upto(bad.length) {|index|\n bad.length.downto(1) {|length|\n begin\n loop {\n s = bad.dup\n s[index,length] = ''\n break if bad == s\n break unless call_fails(s, &block)\n bad = s\n }\n rescue IndexError\n break\n end\n }\n }\n raise \"shortest failure is #{bad.inspect}\"\n end\n end",
"def parse(io)\n source = Parslet::Source.new(io)\n context = Parslet::Atoms::Context.new\n \n result = nil\n value = apply(source, context)\n \n # If we didn't succeed the parse, raise an exception for the user. \n # Stack trace will be off, but the error tree should explain the reason\n # it failed.\n if value.error?\n parse_failed(value.message)\n end\n \n # assert: value is a success answer\n \n # If we haven't consumed the input, then the pattern doesn't match. Try\n # to provide a good error message (even asking down below)\n unless source.eof?\n # Do we know why we stopped matching input? If yes, that's a good\n # error to fail with. Otherwise just report that we cannot consume the\n # input.\n if cause \n # We're not using #parse_failed here, since it assigns to @last_cause.\n # Still: We'll raise this differently, since the real cause is different.\n raise Parslet::UnconsumedInput, \n \"Unconsumed input, maybe because of this: #{cause}\"\n else\n old_pos = source.pos\n parse_failed(\n format_cause(source, \n \"Don't know what to do with #{source.read(100)}\", old_pos), \n Parslet::UnconsumedInput)\n end\n end\n \n return flatten(value.result)\n end",
"def error job, exception\n if tracetop = exception.backtrace&.first\n # Extract the file and line # from the stack top\n tracetop = \" at<br>\" + tracetop.match(/(.*:[\\d]*)/).to_s.if_present || tracetop\n tracetop.sub! Rails.root.to_s+'/', ''\n end\n errors.add :base, exception.to_s+tracetop\n self.status = :bad if processing? # ...thus allowing others to set the status\n end",
"def parse( estream = nil, recovery_time_limit = 3 )\n allow_shortcutting = true\n \n start_position = StartPosition.new(@parser_plan.state_table[0], @source)\n hard_correction_limit = 1000000000\n soft_correction_limit = 1000000000\n error_queue = [] \n complete_solutions = []\n position = nil\n \n @in_recovery = false\n error_positions = {}\n recovery_start_time = nil\n start_time = Time.now\n until @in_recovery and ((@recovery_queue.empty? and error_queue.empty?) or (recovery_time_limit == 0 or Time.now - recovery_start_time > recovery_time_limit))\n\n if @in_recovery then\n\n #\n # If the @recovery_queue is empty, pick the best options from the error_queue and generate new\n # recovery positions. The best options are those with a correction cost lower than the any \n # complete solutions we've already found, and lower than any of the other errors in the queue.\n\n if @recovery_queue.empty? then\n if estream then\n estream.blank_lines(5)\n estream.puts \"================================================================================\"\n estream.puts \"RESETTING FOR NEXT ERROR\"\n end\n \n soft_correction_limit = hard_correction_limit\n discard_threshold = error_queue.inject(hard_correction_limit) {|current, position| min(current, position.corrections_cost) }\n \n error_queue.each do |error_position|\n if error_position.corrections_cost <= discard_threshold then\n generate_recovery_positions( error_position, soft_correction_limit, estream )\n end\n end\n \n error_queue.clear\n end\n\n #\n # Pick up the next recovery position for processing. Don't bother if, since it was created,\n # it has become a bad option (by correction_cost).\n\n position = @recovery_queue.shift\n next if position.nil? or (allow_shortcutting and position.corrections_cost > soft_correction_limit)\n\n if estream then\n estream.blank_lines( 5 )\n estream.puts \"================================================================================\"\n estream.puts \"TRYING RECOVERY with cost = #{position.corrections_cost}\"\n estream.puts \n end\n\n else\n position = start_position\n end\n\n\n #\n # Run the position and handle any errors.\n\n pass_start_time = Time.now()\n begin\n solution = position = parse_until_error( position, estream )\n complete_solutions << solution\n hard_correction_limit = min( hard_correction_limit, solution.corrections_cost )\n soft_correction_limit = min( hard_correction_limit, soft_correction_limit )\n \n solution.node.commit()\n \n rescue ParseError => e\n position = e.position\n position.state.provide_context do \n if position.next_token.tainted? then\n # we're done -- it's already been corrected and the correction failed\n elsif position.recovered? then\n estream.puts \"POSITION IS RECOVERED; QUEUEING NEW ERROR PROCESSING: #{position.description(true)};\" if estream\n soft_correction_limit = min( soft_correction_limit, position.corrections_cost )\n \n signature = position.signature()\n if error_positions.member?(signature) then\n error_positions[signature].join_position( position )\n else\n error_positions[signature] = position\n error_queue << position\n end\n elsif position.corrections_cost < soft_correction_limit then\n if position.tainted? then\n generate_recovery_positions( position, soft_correction_limit, estream )\n else\n error_queue << position\n soft_correction_limit = min( soft_correction_limit, position.corrections_cost ) if @in_recovery\n if estream then\n estream.puts \"QUEUEING ERROR FOR FURTHER PROCESSING: #{position.description(true)};\"\n estream.indent do \n estream.puts \"CORRECTION LIMIT FOR THIS ERROR IS NOW #{soft_correction_limit}\"\n end\n end\n end\n else\n estream.puts \"TOO MANY ERRORS: DISCARDING POSITION #{position.description(true)}\" if estream\n end\n end\n \n rescue PositionSeen => e\n position = e.position\n if estream then\n position.state.provide_context do \n estream.puts \"DISCARDING LOOPED RECOVERY: #{position.description(true)}\" \n end\n end\n end\n \n estream.puts \"PASS TOOK: #{Time.now-pass_start_time}s\" if estream\n\n\n #\n # The first time through only, switch to error recovery mode.\n\n if !@in_recovery then\n @in_recovery = true\n recovery_start_time = Time.now\n end\n end\n\n\n #\n # Generate a list of partial recoveries for reporting.\n \n partial_solutions = []\n discard_threshold = error_queue.inject(hard_correction_limit) {|current, position| min(current, position.corrections_cost) }\n error_queue.each do |error_position|\n if error_position.corrections_cost <= discard_threshold then\n partial_solutions << error_position\n end\n end\n \n complete_solutions = complete_solutions.select{|e| e.corrections_cost <= hard_correction_limit}\n \n #\n # Report errors and corrections.\n \n $stderr.puts \"PARSING/ERROR RECOVERY COMPLETED in #{Time.now - start_time}s\"\n $stderr.indent do \n $stderr.puts \"complete solutions: #{complete_solutions.length}\"\n $stderr.puts \"partial solutions: #{partial_solutions.length}\"\n $stderr.puts \"outputting solutions with #{hard_correction_limit} correction cost or better\"\n end\n \n return Solution.new( complete_solutions, partial_solutions, nil ) # @parser_plan.exemplars )\n end",
"def failure_reason\n return nil unless (tf = terminal_failures) && tf.size > 0\n\t\"Expected \" +\n\t (tf.size == 1 ?\n\t tf[0].expected_string :\n \"one of #{tf.map{|f| f.expected_string}.uniq*', '}\"\n\t ) +\n \" at line #{failure_line}, column #{failure_column} (byte #{failure_index+1})\" +\n \" after #{input[index...failure_index]}\"\n end",
"def wrapped_causes; end",
"def interpret_error(error_in_result, components)\n ret = error_in_result\n\n # if ends in 'on node NODEADDR' such as 'on node ip-10-28-77-115.ec2.internal'\n # strip it off because context is not needed and when summarize in node group can use simple test\n # to remove duplicate errors\"\n\n if ret[:message] && ret[:message] =~ /(^.+) on node [^ ]+$/\n ret[:message] = Regexp.last_match(1)\n end\n\n source = error_in_result['source']\n # working under assumption that stage assignment same as order in components\n if source =~ Regexp.new('^/Stage\\\\[([0-9]+)\\\\]')\n index = (Regexp.last_match(1).to_i) - 1\n if cmp_with_error = components[index]\n ret = error_in_result.inject({}) do |h, (k, v)|\n ['source', 'tags', 'time'].include?(k) ? h : h.merge(k => v)\n end\n if cmp_name = cmp_with_error[:display_name]\n ret.merge!('component' => cmp_name)\n end\n end\n end\n ret\n end",
"def error_message\n parsed_body.strip\n end",
"def parse_until_error( position, estream )\n solution = nil\n while solution.nil?\n position.state.provide_context do |state|\n\n action = nil\n determinant = nil\n\n if estream then\n estream.blank_lines(5)\n estream.puts \"POSITION #{position.sequence_number}\"\n estream.puts \"BRANCH #{position.branch_id(\"MAIN\")}\"\n estream << \"IN \" \n estream.indent(\"| \") do\n estream.with( :state_complete => true ) do\n position.state.display(estream)\n end\n estream.puts \"#{state.lookahead_explanations}\"\n estream.puts \n end\n end\n \n\n #\n # Pick an action and process it. If there is no action, we have an error: move to the next branch\n # or fail.\n \n determinant = position.determinant unless state.context_free?\n action = state.action_for( determinant )\n\n if action.exists? then\n if estream then\n position.display( estream ) \n estream.indent( \"| \" ) do\n estream.puts\n \n if action.has_explanations? then\n if state.context_free? then\n estream.puts \"State is context free; using default action without looking ahead\"\n else\n estream.puts \"Action analysis for lookahead #{determinant.description}\"\n end\n \n action.explanations.each do |explanation|\n estream.indent do\n estream.puts explanation\n end\n end\n end\n end\n end\n \n if action.is_a?(Plan::Actions::Accept) then\n solution = position\n else\n position = perform_action( position, action, estream )\n end\n else\n if position.branch_info.exists? then\n position = launch_next_branch( position, nil, estream )\n else\n if estream then\n estream.puts \"===> ERROR DETECTED: cannot use #{determinant.description}\"\n # BUG: how do we handle this with the ContextStream: explain_indent += \" \"\n end\n\n raise ParseError.new( position )\n end\n end\n end\n end\n \n return solution\n end",
"def status_cause\n\n m = node_status['m']\n\n (@message['cause'] || []).find { |c| c['m'] == m }\n end",
"def oops exception\n error \"Unexpected error while checking for issue's parent newspaper object #{exception}\"\n error exception.backtrace\n return nil\n end",
"def handle_error(aParsing)\n # Retrieve the first empty state set\n pos = aParsing.chart.state_sets.find_index(&:empty?)\n lexeme_at_pos = aParsing.tokens[pos - 1].lexeme\n \n terminals = aParsing.chart.state_sets[pos - 1].expected_terminals\n term_names = terminals.map(&:name)\n err_msg = \"Syntax error at or near token #{pos}\"\n err_msg << \">>>#{lexeme_at_pos}<<<:\\nExpected \"\n err_msg << if terminals.size > 1\n \"one of: ['#{term_names.join(\"', '\")}'],\"\n else\n \": #{term_names[0]},\"\n end\n err_msg << \" found a '#{aParsing.tokens[pos - 1].terminal.name}'\"\n raise StandardError, err_msg + ' instead.'\n end",
"def cause(depth = @depth)\n if depth > @depth\n warn \"WARNING: Depth (#{depth}) greater than depth of cause stack (#{@depth}) requested\"\n nil\n else\n fetch_cause(@ne, depth)\n end\n end",
"def message\n if self[:child].null?\n best_message\n else\n \"#{best_message}: #{cause_message}\"\n end\n end",
"def format_compile_error(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def art obj\n case obj\n when Array\n puts obj.last.parse_failure_cause.ascii_tree\n else\n puts obj.message\n end\nend",
"def vm_fails(parser, input)\n orig_parser = parser.dup\n exception = catch_exception {\n orig_parser.parse(input)\n }\n\n vm_exception = catch_exception {\n vm_parse(parser, input)\n }\n \n vm_exception.should_not be_nil\n vm_exception.message.should == exception.message\n vm_exception.class.should == exception.class\n \n vm_exception.cause.ascii_tree.should == orig_parser.error_tree.to_s\n end",
"def parse!\n begin\n parse\n rescue Exception => e\n raise e if @options[:tron] || e.is_a?(SystemExit) || true\n\n $stderr.print \"#{e.class}: \" unless e.class == RuntimeError\n $stderr.puts \"#{e.message}\"\n $stderr.puts \" Use --tron for stacktrace.\"\n exit 1\n end\n exit 0\n end",
"def that_fails(p)\n Parsby.new \"#{label}.that_fails(#{p.label})\" do |c|\n orig_pos = c.bio.pos\n begin\n r = p.parse c.bio\n rescue Error\n c.bio.restore_to orig_pos\n parse c.bio\n else\n raise ExpectationFailed.new c\n end\n end\n end",
"def wrong_parser!(ical, parent, message = nil) #:doc:\n message ||= \"#{self} is not the right parser for #{ical}\"\n error!(ical, parent, message)\n end",
"def gparse &blk\n begin\n yield\n rescue Parslet::ParseFailed => failure\n puts failure.parse_failure_cause.ascii_tree\n end\nend",
"def message_cause\n\n (@message['cause'] || [])\n .find { |c| c['nid'] == nid }\n end",
"def parse_legacy_error(body)\n message = \"\"\n if body['Errors']\n errors = body['Errors'].map do |error|\n \"Error #{error['Code']}: #{error['Message']}\"\n end\n message += errors.join(', ')\n end\n message\n end",
"def errmsg e\n m, c, b = e.message, e.class, (e.backtrace||[])\n \"#{ m } (#{ c })\\n#{ b }\"\n end",
"def error\n params[\"ErrDesc\"]\n end",
"def cause\n raise NotImplementedError\n end",
"def error\n raise StandardError, 'Error parsing input'\n end",
"def parse_error(body)\n message = \"\"\n if body['reasons']\n reasons = body['reasons'].map do |reason|\n \"Error #{reason['code']}: #{reason['message']}\"\n end\n message += reasons.join(', ')\n end\n message\n end",
"def deepest(cause); end",
"def parse_errors\n args_def.errors\n end",
"def error_reason\n @request['error']['reason']\n end",
"def parse_error!; raise ParseError, \"Error while parsing %s:\\n %s\" % [self.class.to_s, html]; end",
"def print_error\n parts = @curr_blk.text.split('|')\n out = \"Line #{@curr_line}:\"\n\n case @curr_blk.validity\n when 1\n out += \" Could not parse line '#{@curr_blk.text}.\"\n when 2\n out += \" Invalid block number #{@curr_blk.number}, should be #{@curr_line}.\"\n when 3\n out += \" Could not parse transactions list '#{@curr_blk.text.split('|')[2]}'.\"\n when 4\n out += \" Invalid block, address #{@curr_wallet.address} has #{@curr_wallet.balance} billcoins!\"\n when 5\n out += \" Could not parse timestamp '#{@curr_blk.text.split('|')[3]}'.\"\n when 6\n out += \" Previous timestamp #{@p_s}.#{@p_ns} >= new timestamp #{@curr_blk.seconds}.#{@curr_blk.nseconds}.\"\n when 7\n h_string = @curr_blk.text.chomp('|' + parts[4])\n out += \" String '#{h_string}' hash set to #{parts[4]}, should be #{@curr_hash}.\"\n when 8\n out += \"Previous hash was #{parts[1]}, should be #{@p_h}.\"\n when 9\n out += \" Previous hash was #{parts[1]}, should be 4 characters or less.\" if parts[1].length > 4\n out += \" Block hash was #{parts[4]}, should be 4 characters or less.\" if parts[4].length > 4\n end\n\n puts out\n\n @curr_blk.validity\n end",
"def results_errno()\n r = attr_get(\"status\")\n if(r.eql?(\"passed\"))\n 0\n end\n r = attr_get(\"errno\")\n unless r\n r = -1\n end\n r\n end",
"def parse_error(err)\n if err[:errors]\n err[:errors].values.flatten.map { |nested_err| parse_error(nested_err) }\n elsif err[:failed_attribute] == 'Required'\n parse_error_for_required_attr(err)\n else\n parse_error_default(err)\n end\n end",
"def negative_failure_message\n return '' if found.nil? || found == []\n\n found_count = found.length\n found_string = found.map {|job| strategy.pretty_print_job(job) }.join(\"\\n\")\n if expected_count?\n job_count = expected_count\n job_word = expected_count == 1 ? 'job' : 'jobs'\n else\n job_count = 'any'\n job_word = 'jobs'\n end\n return [\n \"did not expect #{job_count} #{job_word} matching #{expected.to_s},\",\n \"found #{found_count}:\",\n found_string,\n ].join(' ')\n end",
"def resolve_long_description(target)\n if can_see?(target)\n return target.long_description\n else\n return target.indefinite_long_description\n end\n end",
"def standard_error\n \"Oops! Either that search expired, or you're trying to go somewhere you don't belong. Either way, try a new search to find your dream getaway.\"\n end",
"def error\n errors.full_messages.first\n end",
"def res_opterr(oe)\n if oe.nil?\n ret(nil)\n else\n fail(oe)\n end\n end",
"def error_details\n msg = ''\n @runner.failures.each do |checker|\n # msg << error(\"------- #{checker.name} -------\") << \"\\n\"\n # msg << error(\"#{checker.hint}\") << \"\\n\"\n checker.errors.details.each do |type, content|\n case type\n when :source\n content.each_line.with_index do |l, i|\n msg << yellow((i + 1).to_s.rjust(3)) << '|' << l\n end\n when Integer\n msg << info('Line: ') << yellow(type) << '|' << info(content)\n when Array\n msg << info('Pos: ') << yellow(type.join(',')) << '|' << info(content)\n when nil\n msg << info(content)\n end\n msg << \"\\n\"\n end\n end\n msg\n end",
"def parse(str)\n mini = MiniP.new\n transf = MiniT.new\n\n transf.apply(\n mini.parse(str)\n )\nrescue Parslet::ParseFailed => failure\n puts failure.parse_failure_cause.ascii_tree\nend",
"def lookup_on_error\n\n if h.on_error\n\n self\n\n elsif h.parent_id\n\n par = parent\n # :( get_parent would probably be a better name for #parent\n\n unless par\n puts \"~~\"\n puts \"parent gone for\"\n p h.fei\n p h.parent_id\n p tree\n puts \"~~\"\n end\n\n par ? par.lookup_on_error : nil\n\n else\n\n nil\n end\n end",
"def resolve!\n rule = grammar.super_rule(rule_name)\n\n unless rule\n raise Error,\n \"No rule named \\\"#{rule_name}\\\" in hierarchy of grammar #{grammar}\"\n end\n\n rule\n end",
"def safe_parse\r\n handle_exception { parse }\r\n end",
"def full_backtrace(ex)\n backtrace = String.new\n backtrace_for(ex, backtrace)\n\n # Avoid circular causes\n causes = {}\n causes[ex] = true\n\n cause = ex\n while (cause = cause.cause) && !causes.key?(cause)\n backtrace_for(cause, backtrace)\n causes[cause] = true\n end\n\n backtrace\n end",
"def failure_message\n actual = prettify_args(@actual)\n\n if @description\n \"'#{actual}' should #{@description}\"\n else\n \"'#{actual}' should satisfy the requirements\"\n end\n end",
"def humanize_exception(e)\n case e\n when SystemExit\n raise # make sure exit passes through.\n when Net::HTTPServerException, Net::HTTPFatalError\n humanize_http_exception(e)\n when Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError\n text.error \"Network Error: #{e.message}\"\n text.info \"Check your meg configuration and network settings\"\n when NameError, NoMethodError\n text.error \"meg encountered an unexpected error\"\n text.info \"This may be a bug in the '#{self.class.common_name}' meg command or plugin\"\n text.info \"Please collect the output of this command with the `-VV` option before filing a bug report.\"\n text.info \"Exception: #{e.class.name}: #{e.message}\"\n when Meggy::Exceptions::PrivateKeyMissing\n text.error \"Your private key could not be loaded from #{api_key}\"\n text.info \"Check your configuration file and ensure that your private key is readable\"\n else\n text.error \"#{e.class.name}: #{e.message}\"\n end\n end",
"def intercept_parse_error\n yield\nrescue Enolib::ParseError => e\n e\nend",
"def error; state == 'failed' ? @doc['error'] : nil; end",
"def test_unknown_cause\n assert_equal \"unknown cause (this is probably a bug in Mocktail)\",\n @subject.recreate(Signature.new(\n positional_params: Params.new(all: [:a], required: [:a]),\n positional_args: [1],\n keyword_params: Params.new(all: []),\n keyword_args: {}\n ))\n end",
"def describe_error\n message = \"\"\n if self.account_number == nil\n message = message + I18n.t(:wrong_or_missing_account_number, :scope => [:model, :index]) + \" \"\n end\n if self.account_bank_number == nil\n message = message + I18n.t(:wrong_or_missing_account_bank_number, :scope => [:model, :index]) + \" \"\n end\n if self.student.uic == nil\n message = message + I18n.t(:missing_uic, :scope => [:model, :index]) + \" \"\n end\n if self.sident == -666\n message = message + I18n.t(:missing_sident_666, :scope => [:model, :index]) + \" \"\n end\n if self.sident == nil\n message = message + I18n.t(:missing_sident, :scope => [:model, :index]) + \" \"\n end\n return message\n\n end",
"def calculate\n candidates = []\n\n generalized_cause = NLU::Generalization.new(symbols: @symbols).generalize(@cause)\n\n #ap \"sentence: #{cause_sentence}\"\n #ap \"learned: #{@learned.inspect}\"\n\n # We go through everything that was learned before\n @learned.each do |function_name, criteria|\n criteria[:generalizations].each do |generalization|\n\n # We generate a pre-candidate for this generalization. It starts\n # with score zero because we don't know yet whether this criteria\n # fits the sentence or not.\n local_candidate = {\n fn: function_name,\n attrs: { },\n score: 0.0\n }\n\n #ap \"generalized_cause #{generalized_cause}\"\n\n # We then generalize the cause sentence and go through it.\n # We will match *each* learned generalization against the cause\n # generalization.\n generalized_cause.each_with_index do |cause_rule, cause_index|\n\n\n # Wildcard\n #\n # Matches these:\n #\n # > i want a [type:wildcard:some_name_for_this_wildcard]\n # > i want a ford\n #\n wildcard = \"[#{NLU::Generalization::RESERVED_TYPES[:wildcard]}]\"\n #ap \"wildcard: #{wildcard}\"\n wildcard_regex = Regexp.escape(wildcard)\n if generalization =~ /wildcard/i\n wildcard_generalization = generalization\n .gsub(/\\[(type:wildcard)(.+)\\]/i, '[\\1]')\n end\n #ap \"wildcard_generalization(#{wildcard_generalization}) =~ cause_rule(#{wildcard_regex})\"\n if wildcard_generalization.to_s =~ Regexp.new(wildcard_regex, Regexp::IGNORECASE)\n #ap \"true -> #{wildcard_generalization} =~ /#{Regexp.new(wildcard_regex, Regexp::IGNORECASE)}/i\"\n\n rule = wildcard_generalization.gsub(\"#{wildcard}\", \"(.+)\")\n #ap \"rule #{rule}\"\n #binding.pry\n if value = cause_sentence.join(\" \").match(Regexp.new(rule, Regexp::IGNORECASE))\n value = value[-1]\n prop = attr_name_from_type_param(generalization)\n\n local_candidate = local_candidate.merge({\n attrs: {\n prop => value\n },\n score: 0.75\n })\n end\n\n # If we find a learned generalization that matches the generalized\n # sentence, we will save it.\n elsif generalization == cause_rule\n cause_rule.split(\" \").each_with_index do |typed_string, index|\n\n # If the learned generalization has a type anywhere, we will\n # check what is the corresponding word in the cause sentence.\n #\n # For example, consider the following sentence:\n #\n # [type:subject] want a [type:make]\n #\n # and the sentence\n #\n # I want a ford\n #\n # Finding `[type:make]` at position 3 of the array, we will\n # get `ford` at the position 3 of the cause sentence. With\n # that we can come up with `{make: 'ford'}`.\n #\n if typed_string =~ /\\[type/i\n local_candidate[:score] += 1\n type = attr_name_from_type_param(typed_string)\n prop = type_properties(type)\n type_token_length = prop[:token_length]\n\n # In `i want a car`, this will get the `i`. If the type\n # says instead that it's formed by two symbols (e.g\n # `i want`), then it will take `i want`.\n #\n # The -1 in the brackets is because otherwise it would be\n # translated to the following if the type had 1 symbol\n #\n # cause_sentence[1..1+1]\n #\n # That would take 2 words (`[1..2]`). We want one word, so\n #\n # cause_sentence[1..1+1-1]\n #\n word_for_type = cause_sentence[index..index+(type_token_length-1)]\n #ap \"> type: #{type} - #{index} #{cause_sentence[index..index+type_token_length]}\"\n\n local_candidate[:attrs][type] = word_for_type.join(\" \")\n\n # When it's just the same sentence as one seen before, no\n # generalizations\n else\n local_candidate[:score] = 1\n end\n end\n\n end\n end\n\n if local_candidate[:score] > 0\n candidates << local_candidate\n end\n end\n end\n\n # TODO - normalization is taking out some elements that are good.\n #candidates = normalize_scores(candidates)\n candidates = pick_candidates(candidates)\n candidates = merge_attributes(candidates)\n\n candidates\n end",
"def parse\n raise \"absctract method called\"\n end",
"def safeevaluate(scope)\n # We duplicate code here, rather than using exceptwrap, because this\n # is called so many times during parsing.\n begin\n return self.evaluate(scope)\n rescue Puppet::Pops::Evaluator::PuppetStopIteration => detail\n raise detail\n# # Only deals with StopIteration from the break() function as a general\n# # StopIteration is a general runtime problem\n# raise Puppet::ParseError.new(detail.message, detail.file, detail.line, detail)\n rescue Puppet::Error => detail\n raise adderrorcontext(detail)\n rescue => detail\n error = Puppet::ParseError.new(detail.to_s, nil, nil, detail)\n # We can't use self.fail here because it always expects strings,\n # not exceptions.\n raise adderrorcontext(error, detail)\n end\n end",
"def recover_from(_error); end",
"def wlang_backtrace\n parser_state ? parser_state.backtrace : [\"no backtrace information, sorry\"]\n end",
"def error\n @error ||= @response['reject_reason']\n end",
"def faulty(aReason)\n @failure_reason = aReason\n end",
"def mapped_summary\n specification.summary[0..139]\n rescue Pod::Informative, StandardError, SyntaxError\n ''\n end",
"def resolve!\n rule = grammar.super_rule(rule_name)\n raise RuntimeError, 'No rule named \"%s\" in hierarchy of grammar %s' %\n [rule_name, grammar.name] unless rule\n rule\n end",
"def failure_message\n if found.nil?\n found_count = 'none'\n found_string = nil\n else\n materialized_found = found.to_a\n found_count = \"#{materialized_found.length}:\"\n found_string = materialized_found.map {|job| strategy.pretty_print_job(job) }.join(\"\\n\")\n end\n [\n \"expected #{expected_count || 'any number of'} jobs matching #{expected.to_s},\",\n \"found #{found_count}\",\n found_string,\n ].compact.join(' ')\n end",
"def fix_suggestion\n backup_error_obj.fix_hint rescue 'Please help us debug this error by forwarding this email to backup-errors@eternos.com'\n end",
"def best_solution\n # Sort existing solutions by expected makespan.\n @solutions.sort_by!(&:expected_makespan)\n # First solution is the best one.\n @solutions.first\n end",
"def errors\n @errors ||= failed.select { |rule| rule.severity == \"Severe\" }\n end",
"def parsing_error(data, exception)\n $stderr.puts \"parsing error:\\n#{exception.message}\"\n end",
"def error_message(e)\n fail e\n end",
"def fetch_errors\n return '' unless authorized?\n xml = REXML::Document.new(load_content)\n\n return 'no-results' if xml.elements.to_a(\"groups/group\").size.zero?\n\n contents = ''\n xml.elements.each(\"groups/group\") do |group|\n message = group.elements[\"error-message\"].text.to_s.gsub(/</, '<').gsub(/>/, '>')\n most_recent = Time.parse(group.elements[\"most-recent-notice-at\"].text)\n rails_env = group.elements[\"rails-env\"].text\n project_id = group.elements[\"project-id\"].text\n project = projects[project_id]\n id = group.elements[\"id\"].text.to_i\n\n contents << %(\n <p onclick=\"widget.openURL('#{link_to_error(id)}');\" title=\"Go to Airbrake\" id=\"exception-#{id}\" class=\"exception\">\n <strong>#{project} [#{rails_env}]</strong>\n <span class=\"timeago\">\n <abbr title=\"#{most_recent.utc.strftime(\"%FT%T%z\")}\">#{most_recent.strftime(\"%%Y-%m-%d ~ %I:%M%p\")}</abbr>\n </span>\n <a>#{message}</a>\n </p>\n )\n end\n\n contents\n end",
"def error_string\n # This method should be overridden\n end",
"def error_description\n end",
"def display_resource(cause)\n cause.name\n end",
"def contents_with_errors\n contents.select(&:essence_validation_failed?)\n end",
"def cause(index=nil)\n if index.class == Fixnum && !block_given?\n return ::Vertx::Util::Utils.from_throwable(@j_del.java_method(:cause, [Java::int.java_class]).call(index))\n end\n raise ArgumentError, \"Invalid arguments when calling cause(index)\"\n end",
"def resolve!\n rule = grammar.rule(rule_name)\n\n unless rule\n raise Error, \"No rule named \\\"#{rule_name}\\\" in grammar #{grammar}\"\n end\n\n rule\n end",
"def original_error; end",
"def original_error; end",
"def error_poslook_crash error, error_location; end",
"def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend",
"def error\n return if success? unless parse_error?\n @data['error'] || @data['message']\n end",
"def find_violations\n find_candidates.select { |it| it.depth > max_allowed_nesting }\n end",
"def parse!\n begin\n parse\n rescue Exception => e\n raise e if @options[:trace] || e.is_a?(SystemExit)\n\n $stderr.print \"#{e.class}: \" unless e.class == RuntimeError\n $stderr.puts \"#{e.message}\"\n exit 1\n end \n exit 0\n end",
"def error_message\n @response.reason_phrase\n end"
] |
[
"0.65493697",
"0.6492258",
"0.63392115",
"0.62310016",
"0.6196395",
"0.58563733",
"0.55567557",
"0.5497331",
"0.5495598",
"0.54370177",
"0.5403716",
"0.5403716",
"0.529751",
"0.52580476",
"0.5218009",
"0.5160588",
"0.5141969",
"0.50906146",
"0.50320584",
"0.498276",
"0.4932531",
"0.4915189",
"0.4908728",
"0.48984757",
"0.4895001",
"0.4893732",
"0.48860022",
"0.4867648",
"0.486609",
"0.4856728",
"0.4825694",
"0.48091245",
"0.47640038",
"0.47590983",
"0.47553238",
"0.47520822",
"0.47281092",
"0.4726695",
"0.4721477",
"0.47178474",
"0.4712765",
"0.47119212",
"0.4692656",
"0.46692997",
"0.46680388",
"0.46461678",
"0.46412978",
"0.4632109",
"0.4621851",
"0.46197176",
"0.46124706",
"0.45978102",
"0.45736265",
"0.45484993",
"0.45347765",
"0.45312554",
"0.45301998",
"0.4521925",
"0.45196232",
"0.44947708",
"0.44940284",
"0.4485441",
"0.44852847",
"0.4484096",
"0.44741023",
"0.44715357",
"0.44713053",
"0.44451156",
"0.44413412",
"0.44379035",
"0.4437697",
"0.443769",
"0.4418359",
"0.44157532",
"0.44110897",
"0.44015855",
"0.4400303",
"0.4398138",
"0.43965483",
"0.43947542",
"0.43879282",
"0.43877545",
"0.4386763",
"0.4386561",
"0.43819463",
"0.43801174",
"0.43791863",
"0.43722552",
"0.43711323",
"0.43677518",
"0.4363295",
"0.43575972",
"0.43558526",
"0.43558526",
"0.43523225",
"0.4350692",
"0.4348153",
"0.43478897",
"0.43463457",
"0.43423456"
] |
0.61801594
|
5
|
Report/raise a parse error with the given message, printing the current position as well. Appends 'at line X char Y.' to the message you give. If +pos+ is given, it is used as the real position the error happened, correcting the io's current position.
|
def error(io, str, pos=nil)
pre = io.string[0..(pos||io.pos)]
lines = Array(pre.lines)
if lines.empty?
formatted_cause = str
else
pos = lines.last.length
formatted_cause = "#{str} at line #{lines.count} char #{pos}."
end
@last_cause = formatted_cause
raise Parslet::ParseFailed, formatted_cause, nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def error(error_message, current_scope = nil, current_exp = nil)\n if current_exp.respond_to?(:position) && current_exp.position && current_exp.position.lineno\n pos = current_exp.position\n location = \" @ #{pos.inspect}\"\n elsif @lastpos\n location = \" near (after) #{@lastpos}\"\n else\n location = \"\"\n end\n raise \"Compiler error: #{error_message}#{location}\\n\n current scope: #{current_scope.inspect}\\n\n current expression: #{current_exp.inspect}\\n\"\n end",
"def error(error_message, current_scope = nil, current_exp = nil)\n if current_exp.respond_to?(:position) && current_exp.position && current_exp.position.lineno\n pos = current_exp.position\n location = \" @ #{pos.inspect}\"\n elsif @lastpos\n location = \" near (after) #{@lastpos}\"\n else\n location = \"\"\n end\n raise \"Compiler error: #{error_message}#{location}\\n\n current scope: #{current_scope.inspect}\\n\n current expression: #{current_exp.inspect}\\n\"\n end",
"def error(message, options = {})\n if brace = @lexer.expected\n message += \"; expected '%s'\"\n end\n except = Puppet::ParseError.new(message)\n except.line = options[:line] || @lexer.line\n except.file = options[:file] || @lexer.file\n\n raise except\n end",
"def error(message, line, column)\n puts \"*-*-* error at #{line}:#{column}: #{message}\"\n end",
"def parse_error(message)\n raise ParseError, \"Parse error on line #{@line_count}: #{message}\"\n end",
"def syntax_error!(message, args = {})\n args[:orig_line] ||= @orig_line\n args[:line] ||= @line\n args[:lineno] ||= @lineno\n args[:column] ||= args[:orig_line] && args[:line] ? args[:orig_line].size - args[:line].size : 0\n raise SyntaxError.new(message, options[:file], args[:orig_line], args[:lineno], args[:column])\n end",
"def raise_error(message, line, col = 0, length = 0)\n line, col, length = line.line_num, line.column, line.length if line.is_a? Token\n\n header = \"#{@file}##{line}: \"\n str = \"Error: #{message}\\n\".red\n str << \"#{@file}##{line - 1}: #{@source.lines[line - 2].chomp}\\n\".light_black if line > 1\n str << \"#{header}#{(@source.lines[line - 1] || \"\").chomp}\\n\"\n str << (' ' * (col + header.length - 1))\n str << '^' << ('~' * (length - 1)) << \"\\n\"\n str << \"#{@file}##{line + 1}: #{@source.lines[line].chomp}\\n\".light_black if @source.lines[line]\n raise str\n end",
"def error(source, str, pos=nil)\n @last_cause = format_cause(source, str, pos)\n Fail.new(@last_cause)\n end",
"def positioned_message msg\n result = [msg]\n result << \"in file #{file}\" if file\n result << \"at line #{line}:#{pos}\" if line\n result.join(\" \")\n end",
"def pos_out_of_range(position)\n Error \"Position out of range! (#{position}) given, \" \\\n \"but the minefield is #{@num_cells} long.\"\n end",
"def error(msg:, item: nil)\n @badline = true\n if item.nil?\n puts \"#{@filename}:#{@line_no + 1} #{msg}\"\n else\n puts \"#{@filename}:#{@line_no + 1}:#{item} #{msg}\"\n end\n end",
"def pos=(pos)\n if self.pos > pos\n @previous_line_number = @start_line_number\n @previous_pos = 0\n end\n super\n end",
"def error(str)\n\tloc = @io.tell() - 1\n\traise \"#{self.class.name} error at byte #{loc} (0x#{'%02x' % loc}): #{str}\"\n end",
"def syntax_error(expected, found)\r\n expected = expected.join(', ') if expected.class == Array\r\n @errors.push(\"SYNTAX ERROR on line #{@line_num}: Expected #{expected}, found #{found}\")\r\n next_line\r\n end",
"def location(line, pos)\n raise NotImplementedError\n end",
"def throw_error(msg, cur_tok)\n\t\tif cur_tok == nil\n\t\t\traise \"PARSING ERROR WITH NIL TOKEN (SHOULD NOT HAPPEN) >> \" + msg\n\t\tend\n\t\traise \"PARSING ERROR: At line: #{cur_tok.line}, col: #{cur_tok.col}, token: #{cur_tok} >> \" + msg\n\tend",
"def raise_parser_error(msg = 'Unknown')\n print_token_stack\n\n err = \"\nParser Exception!\n-----------------\nState: #{@state}\nCommand State: #{@state_arg || 'None'}\n-----------------\n\nWhile attempting to parse tokenized input, we encountered the following error:\n** #{msg} **\"\n raise ParserError, err\n end",
"def load_error!(msg, path, node)\n line = node.start_line + 1\n column = node.start_column\n raise \"#{path}:#{line}:#{column}: error: #{msg}\"\n end",
"def error message; write ERROR, message, caller[0] unless level > @level end",
"def format_compile_error(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def raise_error(code, error, position = nil)\n position ||= @marker.position\n @error = {\n :code => code,\n :description => error,\n :position => position.dup()\n }\n raise \"#{position} (#{code}) #{error}\"\n end",
"def abort(msg)\n # Assume we've already read the problem character\n # TODO Test this code\n i = @cursor - 1 - @char_buffer.length\n s = ''\n if i > 4\n s += '...'\n end\n s += @script[i-3...i] || \"\"\n s += ' !!! '\n s += @script[i...i+3] || \"\"\n if i + 3 < @script.size\n s += '...'\n end\n raise ParseException.build(msg + \": \" + s, @orig_line_number, @orig_script)\n end",
"def parse_error(msg)\n say :error, msg\n raise MacroError\n end",
"def error_poslook_crash error, error_location; end",
"def format_cause(source, str, pos=nil)\n real_pos = (pos||source.pos)\n Cause.new(str, source, real_pos)\n end",
"def parse_position(arg, old_mod=nil, allow_offset = false)\n colon = arg.rindex(':') \n if colon\n # First handle part before the colon\n arg1 = arg[0...colon].rstrip\n lineno_str = arg[colon+1..-1].lstrip\n mf, container, lineno = parse_position_one_arg(arg1, old_mod, false, allow_offset)\n return nil, nil, nil unless container\n filename = canonic_file(arg1) \n # Next handle part after the colon\n val = get_an_int(lineno_str)\n lineno = val if val\n else\n mf, container, lineno = parse_position_one_arg(arg, old_mod, true, allow_offset)\n end\n \n return mf, container, lineno\n end",
"def error_line(comment, line_number, item, line, exception = nil)\n puts \"#{comment}::#{line_number}::#{exception.class}::#{item}::::#{line}\"\n end",
"def print_error_message text=$error_message\n r = $error_message_row || Ncurses.LINES-1\n c = $error_message_col || (Ncurses.COLS-text.length)/2 \n\n $log.debug \"got ERROR MESSAGE #{text} row #{r} \"\n clear_error r, $datacolor\n printstring r, c, text, color = $promptcolor\n $error_message_clear_pending = true\n end",
"def throw_unexpected_token(symbol, line, column)\n line_source = @string.split('\\n')[line - 1]\n\n pad = ' ' * column;\n line_data = \"\\n\\n\" + line_source + \"\\n\" + pad + \"^\\n\"\n\n raise (\n line_data + 'Unexpected token: \"' + symbol.to_s + '\" at ' +\n line.to_s + ':' + column.to_s + '.'\n )\n end",
"def error(msg, exc: nil)\n must \"message\", msg, be: String\n\n tell(colorize(\"☠ \", :magenta) + colorize(msg, :red))\n\n if exc\n raise exc.new(msg)\n else\n exit(-1)\n end\n end",
"def error(message)\n print(1, message)\n end",
"def errmsg(message)\n error.print(\"*** #{message}\\n\")\n end",
"def print_error(message, file)\n @output.puts \"\\u{274c} #{file} - #{message}\"\n end",
"def print_error(message, file)\n @output.puts \"\\u{274c} #{file} - #{message}\"\n end",
"def off_board_error\n pos = [10, 10]\n until valid_move?(*pos)\n puts \"Please select valid location on the board.\"\n print \"New row: \" \n row = gets.chomp.to_i\n print \"New column: \"\n column = gets.chomp.to_i\n pos = [row, column]\n end\n pos\n end",
"def errmsg(*args)\n if Debugger.annotate.to_i > 2\n aprint 'error-begin'\n print(*args)\n aprint ''\n else\n print '*** '\n print(*args)\n end\n end",
"def line_offset(pos=pos)\n p = 0\n string.each_line do |line|\n len = line.length\n return (pos - p) if p + len >= pos\n p += len\n end\n 0\n end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def raiseError(msg)\n\t\tputs msg\n\t\t@src = []\n\t\t@expected_indent = 0\n\tend",
"def place_mark(*pos, mark)\n if !valid_move?(*pos)\n pos = off_board_error\n self[*pos] = mark\n elsif !empty?(*pos)\n pos = pos_error\n self[*pos] = mark\n else\n self[*pos] = mark\n end\n end",
"def print_error(msg)\n tag = '[ ERROR ]'\n print_formatted(tag,msg)\n end",
"def error(msg)\n puts red(bold(\"[!] #{msg}\"))\n end",
"def process_error(code, params= {})\n error = 'Error occured: line '+lex_analysis.line.uniq.length.to_s+': '\n case code\n when 'expecting'\n puts 'Spracovanie chyby: terminal na vrchu zasobnika, nezodpovedajuci vstup' if self.output\n error += 'expecting \"'+params[:stack_top]+'\", found \"'+input+'\"'\n position = lex_analysis.position\n puts 'Prechadzam vstup' if self.output\n while not (input.nil? or params[:stack_top] == input)\n puts 'Na vstupe '+self.input if self.output\n self.input = lex_analysis.get_lexical_unit()\n end\n if self.input.nil?\n self.input = params[:stack_top]\n lex_analysis.rewind(position)\n end\n\n self.stack.unshift(params[:stack_top])\n\n when 'unexpected'\n puts 'Spracovanie chyby: neterminal na vrchu zasobnika, neexistujuci prechod k danemu vstupu' if self.output\n error += 'Unexpected symbol \"' + input + '\".'\n puts 'Vyprazdnujem zasobnik:' if self.output\n while self.stack.length> 0 and not table.has_key? self.stack[0]\n sym = self.stack.shift\n puts 'Vybrany symbol '+sym if self.output\n end\n else\n error += code\n end\n\n # vlozenie chyby do zoznamu\n self.errors.push error\n end",
"def errmsg(message)\n print(\"*** #{message}\\n\")\n end",
"def line_offset(pos=pos())\n p = 0\n string.each_line do |line|\n len = line.length\n return (pos - p) if p + len >= pos\n p += len\n end\n 0\n end",
"def error(text = nil)\n estream.puts text\n end",
"def syntax_error(state, event, legal_events, line)\n end",
"def print_error\n parts = @curr_blk.text.split('|')\n out = \"Line #{@curr_line}:\"\n\n case @curr_blk.validity\n when 1\n out += \" Could not parse line '#{@curr_blk.text}.\"\n when 2\n out += \" Invalid block number #{@curr_blk.number}, should be #{@curr_line}.\"\n when 3\n out += \" Could not parse transactions list '#{@curr_blk.text.split('|')[2]}'.\"\n when 4\n out += \" Invalid block, address #{@curr_wallet.address} has #{@curr_wallet.balance} billcoins!\"\n when 5\n out += \" Could not parse timestamp '#{@curr_blk.text.split('|')[3]}'.\"\n when 6\n out += \" Previous timestamp #{@p_s}.#{@p_ns} >= new timestamp #{@curr_blk.seconds}.#{@curr_blk.nseconds}.\"\n when 7\n h_string = @curr_blk.text.chomp('|' + parts[4])\n out += \" String '#{h_string}' hash set to #{parts[4]}, should be #{@curr_hash}.\"\n when 8\n out += \"Previous hash was #{parts[1]}, should be #{@p_h}.\"\n when 9\n out += \" Previous hash was #{parts[1]}, should be 4 characters or less.\" if parts[1].length > 4\n out += \" Block hash was #{parts[4]}, should be 4 characters or less.\" if parts[4].length > 4\n end\n\n puts out\n\n @curr_blk.validity\n end",
"def text_pos(pos = @pos)\t\n\t\treturn to_text(pos[0]) + (pos[1] + 1).to_s\n\tend",
"def error(msg)\n puts \"\\n#{@red}[Error] #{msg}!#{@ncl}\\n\"\n end",
"def clang_error\n loc = @error_node.loc\n expr = loc.expression\n line = loc.line\n column = loc.column + 1\n prefix = \"#{expr.source_buffer.name}:#{line}:\"\n out = \"#{prefix}#{column}: error: #{@error}\\n\"\n out << \"#{prefix} #{expr.source_line}\\n\"\n out << \"#{prefix} \"\n out << ' ' * (column - 1)\n out << \"^\\n\"\n end",
"def token_err(line, column)\n abort(\"Error in line #{line}, column #{column}!\")\n end",
"def error(subject = nil, message)\n $stderr.puts \"#{name}: #{message}\"\n saved = $stdout\n begin\n $stdout = $stderr\n Formatter.usage(grammar)\n exit 1\n ensure\n $stdout = saved\n end\n end",
"def print_error(msg)\n puts \" #{color(\"!\", 33)} #{color(msg, 31)}\"\n end",
"def seek(pos, rio = nil)\n if pos.kind_of?(DataHeader)\n unless io_index = @io.index(pos.io)\n raise \"#{pos} does not come from this log fileset\"\n end\n @rio = io_index\n @next_block_pos = pos.block_pos\n else\n\t\traise ArgumentError, \"need rio argument, if pos is not a DataHeader\" unless rio\n\t\t@rio = rio\n @next_block_pos = pos\n end\n nil\n end",
"def error_ln(message)\n write_message message, 'error', true\n end",
"def error(mesg, keys)\n ParserError.log mesg\n \n while not keys.include? @sy.text\n next_token\n end\n end",
"def text_position=(pos)\n end",
"def build_position(target = :lexeme)\n\t\toffset = (target == :lexeme)? @token_pos : scanner.pos()\n begin\n\t\tlinepos = offset - @line_offset # Position relative to start of line\n rescue NoMethodError => exc\n STDERR.puts \"@token_pos = #{@token_pos}\"\n STDERR.puts \"scanner.pos = #{scanner.pos}\"\n STDERR.puts \"@line_offset = #{@line_offset}\"\n raise exc\n end\n\t\tposition = LexemePosition.new(offset, @lineno, linepos)\n\t\treturn position\n\tend",
"def add_error(line)\n add_value(line, \"error\")\n end",
"def err(dir, msg)\n msglen = msg.length + 6\n warn(format(\"%-#{TW - msglen}<dir>s %<msg>s\", dir: dir, msg: msg))\n end",
"def error msg, e\n # XXX - this sort of sucks\n if msg.query?\n msg.connection.raw \"NOTICE #{msg.nick} :Error: #{e}\"\n else\n msg.connection.raw \"PRIVMSG #{msg.destination} :#{msg.nick}: Error: #{e}\"\n end\n\n $log.error('Command.run') { e }\n $log.error('Command.run') { e.backtrace }\n end",
"def obvious_error(message, e)\n \"#{stars}\\n#{message}\\n#{stars}\\n#{e.message}#{stars}\"\n end",
"def advance_position\n matched_fragment = @str[@pos...@s.pos]\n new_lines = matched_fragment.count(\"\\n\")\n if new_lines > 0\n characters_after_last_newline = matched_fragment.size - matched_fragment.rindex(\"\\n\") - 1\n [@line + new_lines, 1 + characters_after_last_newline]\n else\n [@line, @char + matched_fragment.size]\n end\n end",
"def pos_error\n check = true\n while check\n puts \"Spot occupied already, please select a new one.\"\n print \"New row: \" \n row = gets.chomp.to_i\n print \"New column: \"\n column = gets.chomp.to_i\n pos = [row, column]\n check = false \n return pos if empty?(*pos)\n end\n end",
"def get_line_pos(pos)\n lpos = @line_ends.bsearch_index { |x, _| x >= pos }\n return lpos\n end",
"def error(message)\n logger.error(PROG_NAME) { message }\n end",
"def error(msg)\n raise RDocError.new(msg)\n end",
"def xprint(text)\n self.error_messages += text\n end",
"def add_error(string)\n write_message(:error, string)\n end",
"def error_message(msg)\n STDERR.puts msg\n end",
"def line_number(pos=pos())\n line_index(pos) + 1\n end",
"def error message, exit_on_print = true\n\t\traise \"Error message only takes 'String' or 'Array'\" if !message.is_a?(Array) && !message.is_a?(String)\n\n\t\tsay \"\\n-----------------------------------------------------------------\".red\n\t\tsay \" Error:\\n\".red\n\t\tsay \" \" + message if message.is_a?(String)\n\t\tmessage.each {|line| say \" \" + line if line.is_a?(String) } if message.is_a?(Array)\n\t\tsay \"-----------------------------------------------------------------\\n\".red\n\t\texit if exit_on_print\nend",
"def parsing_error(data, exception)\n $stderr.puts \"parsing error:\\n#{exception.message}\"\n end",
"def error(message)\n output[:errors] << message\n end",
"def print_error_message(msg)\n print \"<< ERROR: #{msg.to_s} !!\\n\"\n end",
"def error(message)\n\t\t# Display error message, guess again, noting that there was an error so don't show board\n\t\tputs\n\t\tputs message\n\t\tguess_again(\"err\")\n\tend",
"def line_number(pos=pos)\n line_index(pos) + 1\n end",
"def error(string); end",
"def error(string); end",
"def set_position at\n @position = at\n @codes.each do |code|\n begin\n code.set_position( at)\n rescue => e\n puts \"BLOCK #{self.to_s[0..5000]}\"\n raise e\n end\n raise code.inspect unless code.byte_length\n at += code.byte_length\n end\n end",
"def parse_until_error( position, estream )\n solution = nil\n while solution.nil?\n position.state.provide_context do |state|\n\n action = nil\n determinant = nil\n\n if estream then\n estream.blank_lines(5)\n estream.puts \"POSITION #{position.sequence_number}\"\n estream.puts \"BRANCH #{position.branch_id(\"MAIN\")}\"\n estream << \"IN \" \n estream.indent(\"| \") do\n estream.with( :state_complete => true ) do\n position.state.display(estream)\n end\n estream.puts \"#{state.lookahead_explanations}\"\n estream.puts \n end\n end\n \n\n #\n # Pick an action and process it. If there is no action, we have an error: move to the next branch\n # or fail.\n \n determinant = position.determinant unless state.context_free?\n action = state.action_for( determinant )\n\n if action.exists? then\n if estream then\n position.display( estream ) \n estream.indent( \"| \" ) do\n estream.puts\n \n if action.has_explanations? then\n if state.context_free? then\n estream.puts \"State is context free; using default action without looking ahead\"\n else\n estream.puts \"Action analysis for lookahead #{determinant.description}\"\n end\n \n action.explanations.each do |explanation|\n estream.indent do\n estream.puts explanation\n end\n end\n end\n end\n end\n \n if action.is_a?(Plan::Actions::Accept) then\n solution = position\n else\n position = perform_action( position, action, estream )\n end\n else\n if position.branch_info.exists? then\n position = launch_next_branch( position, nil, estream )\n else\n if estream then\n estream.puts \"===> ERROR DETECTED: cannot use #{determinant.description}\"\n # BUG: how do we handle this with the ContextStream: explain_indent += \" \"\n end\n\n raise ParseError.new( position )\n end\n end\n end\n end\n \n return solution\n end",
"def format_location diagnostic\n file = diagnostic.file\n line = diagnostic.source_pos.line\n pos = diagnostic.source_pos.pos\n if file && line && pos\n \" at #{file}:#{line}:#{pos}\"\n elsif file and line\n \" at #{file}:#{line}\"\n elsif line && pos\n \" at line #{line}:#{pos}\"\n elsif line\n \" at line #{line}\"\n elsif file\n \" in #{file}\"\n else\n \"\"\n end\n end",
"def pos\n @io.pos\n rescue Errno::ESPIPE\n backup.pos\n end",
"def lex_error=(_arg0); end",
"def lex_error=(_arg0); end",
"def lex_error=(_arg0); end",
"def lex_error=(_arg0); end",
"def on_error error_token_id, error_value, value_stack\n after = value_stack.compact.last\n raise SyntaxError.new(\"unexpected '#{error_value}' after '#{after}'\")\n end",
"def initialize(name, pos)\n @name = name\n @pos = pos\n\n if pos.length > 2 || !valid_position?(*self.position)\n raise 'Invalid position'\n end\n end",
"def error(message)\n STDERR.puts red(message)\n end",
"def line(pos=pos())\n lines[line_index(pos)]\n end",
"def error(msg = '')\n\t\toutput.print_error(msg)\n\tend",
"def error(message)\n write_message message, 'error'\n end",
"def expect_error(xml, regex, line = nil, col = nil, pos = nil)\n\tbegin\n\t toker = NQXML::Tokenizer.new(xml)\n\t toker.each { | tok | }\n\t assert_fail(\"expected exception '#{regex.source}'\")\n\trescue NQXML::ParserError => ex\n\t assert_match($!, regex)\n\t assert_equal(line, ex.line()) if line\n\t assert_equal(col, ex.column()) if col\n\t assert_equal(pos, ex.pos()) if pos\n\tend\n end",
"def error(message)\n output[:errors] << message\n end",
"def pos=(pos)\n @pos = pos\n end",
"def parse_warn(msg); say :warn, msg; end"
] |
[
"0.6947295",
"0.6947295",
"0.6276376",
"0.614279",
"0.60134834",
"0.59056336",
"0.5842644",
"0.5829156",
"0.58288133",
"0.5718064",
"0.5662606",
"0.56615263",
"0.56347984",
"0.56316334",
"0.56172544",
"0.5604067",
"0.55866724",
"0.55265605",
"0.54059964",
"0.53876317",
"0.5354265",
"0.53443116",
"0.53272355",
"0.53154486",
"0.5213654",
"0.5208009",
"0.52043384",
"0.5196518",
"0.5179166",
"0.5140804",
"0.5128762",
"0.50926596",
"0.5070042",
"0.5070042",
"0.5057811",
"0.5056183",
"0.50551045",
"0.50487113",
"0.50487113",
"0.50487113",
"0.502785",
"0.50271195",
"0.5025441",
"0.5013042",
"0.50095725",
"0.500777",
"0.5005054",
"0.49882483",
"0.49869484",
"0.4964464",
"0.4952553",
"0.49405876",
"0.49368382",
"0.49245358",
"0.49202642",
"0.4916276",
"0.4916076",
"0.49114978",
"0.4910637",
"0.49096084",
"0.4905146",
"0.49048594",
"0.49047264",
"0.4897835",
"0.48965606",
"0.4887353",
"0.4882232",
"0.48795864",
"0.48755905",
"0.48727122",
"0.4871239",
"0.48676848",
"0.486386",
"0.48583817",
"0.48579848",
"0.4857853",
"0.48564276",
"0.48512155",
"0.48502967",
"0.48471",
"0.48373345",
"0.48373345",
"0.4836709",
"0.48364627",
"0.48363373",
"0.4828876",
"0.48276624",
"0.48276624",
"0.48276624",
"0.48276624",
"0.48246264",
"0.4820686",
"0.48168704",
"0.48152557",
"0.48151088",
"0.48090822",
"0.48054153",
"0.4801641",
"0.47998995",
"0.4792004"
] |
0.72440624
|
0
|
Sets the password reset attributes.
|
def create_reset_digest
self.reset_token = ApplicationController.new_token
update_attribute(:reset_digest, ApplicationController.digest(reset_token))
update_attribute(:reset_sent_at, Time.zone.now)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_reset_password_instructions(attributes={})\n send_instructions_for(:reset_password, attributes)\n end",
"def set_password_reset\n\t\tself.code = SecureRandom.urlsafe_base64\n\t\tself.expires_at = 4.hours.from_now\n\t\tself.save!\n\tend",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n p[:password_unset] = 0 \n update_attributes(p)\n end",
"def password_set(password)\n self.password.set password\n self.passwordconfirm.set password\n end",
"def attempt_set_password(params)\n\t p = {}\n\t p[:password] = params[:password]\n\t p[:password_confirmation] = params[:password_confirmation]\n\t update_attributes(p)\n end",
"def set_password_reset\n self.make_password_reset_code\n end",
"def attempt_set_password(params)\n update_attributes(password: params[:password], password_confirmation: params[:password_confirmation])\n end",
"def attempt_set_password(params)\n p={}\n p[:password]=params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes p\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end",
"def reset_password(password)\n self.termpassword = password\n save\n end",
"def reset_password\n friendly_token = Authlogic::Random.friendly_token\n self.password = friendly_token\n self.password_confirmation = friendly_token if self.class.require_password_confirmation\n end",
"def reset_password\n update_attribute(:password_reset_code, nil)\n @reset_password = true\n end",
"def reset_password() \n self.password_confirmation = self.password = self.login\n \n self.save\n end",
"def send_reset_password_instructions\n end",
"def set_initial_password_reset!\n raw, enc = Devise.token_generator.generate(self.class, :reset_password_token)\n\n self.reset_password_token = enc\n self.reset_password_sent_at = Time.now.utc\n save(validate: false)\n raw\n end",
"def reset_password\n\t\tself.password_reset_token = User.new_token\n\t\tupdate_columns(password_reset_digest: User.digest(self.password_reset_token), password_reset_sent_at: Time.zone.now)\n\tend",
"def reset_password\n friendly_token = Authlogic::Random.friendly_token\n self.password = friendly_token\n self.password_confirmation = friendly_token\n end",
"def send_reset_password_instructions(attributes = T.unsafe(nil)); end",
"def reset_password!\n reset_password\n save_without_session_maintenance(validate: false)\n end",
"def set_password_reset_request\n @password_reset_request = PasswordResetRequest.find(params[:id])\n end",
"def reset_password!\n password = PasswordGenerator.random_pronouncable_password(3)\n self.password = password\n self.password_confirmation = password\n save\n UserMailer.deliver_reset_password(self)\n end",
"def set_password\n @password = Password.last\n @new_password = Password.new\n end",
"def send_password_resets\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n self.save!\n NotificationsMailer.password_reset_mail(self).deliver\n end",
"def reset_password\n temporary_password = ActiveSupport::SecureRandom.base64(6)\n self.password = temporary_password\n self.password_confirmation = temporary_password\n temporary_password\n end",
"def password_reset\n applicant = Applicant.first\n applicant.reset_token = Applicant.new_token\n ApplicantMailer.applicant_password_reset(applicant)\n end",
"def password_reset\n\t\tshepherd = Shepherd.first\n\t\tshepherd.reset_token = Shepherd.new_token\n ShepherdMailer.password_reset(shepherd)\n end",
"def reset_password!(user)\n self.class.ignore_blank_passwords = false\n self.password = user[:password]\n self.password_confirmation = user[:password_confirmation]\n save\n end",
"def password_reset\n account = Account.first\n account.reset_token = Account.new_token\n AccountMailer.password_reset(account)\n end",
"def reset_password!\n reset_password\n save_without_session_maintenance(false)\n end",
"def send_reset_password_instructions(attributes = {})\n recoverable = find_or_initialize_with_errors(reset_password_keys, attributes, :not_found)\n recoverable.send_reset_password_instructions if recoverable.persisted?\n recoverable\n end",
"def reset_password!(user)\n self.password = user[:password]\n self.password_confirmation = user[:password_confirmation]\n save\n end",
"def reset_password\n @user = User.last\n @user.password_reset_token = \"12345\"\n @user.password_reset_sent_at = Time.zone.now\n mail = UserMailer.reset_password(@user)\n end",
"def password_reset\n tester = Tester.first\n tester.reset_token = Tester.new_token\n TesterMailer.password_reset(tester)\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password_reset\n employee = Employee.first\n employee.reset_token = Employee.new_token\n EmployeeMailer.password_reset(employee)\n end",
"def create_reset_digest\n totp = ROTP::TOTP.new(\"base32secret3232\")\n self.reset_token = totp.now\n update_attribute(:reset_password_token, self.reset_token)\n update_attribute(:reset_password_sent_at, Time.zone.now)\n end",
"def reset!\n self.password_cost = 9\n end",
"def password_reset\n user = User.first\n user.reset_token = SecureRandom.uuid\n user.e_token = User.digest(user.email)\n UserMailer.password_reset(user)\n end",
"def set_password\n @password = Password.find(params[:id])\n end",
"def send_reset_password_instructions; end",
"def password_reset\n doctor = Doctor.first\n doctor.reset_token = Doctor.new_token\n DoctorMailer.password_reset(doctor)\n end",
"def reset_params\n params.permit(:reset_password_token, :password, :password_confirmation)\n end",
"def reset_password!\n verifications.password_reset.create(recipient: address)\n end",
"def password_reset\n participant = Participant.first\n participant.reset_token = Participant.new_token\n ParticipantMailer.password_reset(participant)\n end",
"def update_attributes_and_password(attrs)\n self.assign_attributes(attrs)\n self.valid?\n if self.password.present? && confirm_passwords\n self.password_hash = Digest::SHA256.hexdigest(self.password + Rails.application.secrets.salt)\n end\n if self.errors.empty?\n self.save\n end\n end",
"def reset_password!\n new_password = Digest::MD5.hexdigest(Time.now.to_s.split(//).sort_by {rand}.join)[0, 10]\n self.password = new_password\n self.password_confirmation = new_password\n save!\n end",
"def password_reset\n user = SbUser.first\n user.reset_token = SbUser.new_token\n SbuserMailer.password_reset(user)\n\n end",
"def update_password\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.reset_token_account(reset_password_token)\n account.encrypted_password = enc_password\n account.reset_password_token, account.reset_password_expires_at = nil, nil\n account.save!\n {'success' => true}\n end",
"def password_reset\n owner = Owner.first\n owner.reset_token = Owner.new_token\n Owner::UserMailer.password_reset(owner)\n end",
"def password_reset\n user = Customer.last\n user.reset_token = Customer.new_token\n CustomerMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def reset_password\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.now\n save!\n UserMailer.delay.password_reset(self)\n end",
"def reset_password(new_password, new_password_confirmation); end",
"def disable_password_reset\n @attributes[:disable_password_reset]\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n player = Player.first\n player.reset_token = Player.new_token\n PlayerMailer.password_reset(player)\n end",
"def set_password_setting\n @password_setting = PasswordSetting.find(params[:id])\n end",
"def reset_password_digest\n self.update_columns(password_digest: nil)\n end",
"def password_reset\n \tuser = User.first\n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n update_attributes!(password_reset_sent_at: Time.zone.now)\n UserMailer.password_reset(self).deliver\n end",
"def password_reset\n user = User.first\n user.reset_token = User.new_token #присваивается значение токена сброса пароля\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n user = User.first \n user.reset_token = User.new_token\n UserMailer.password_reset(user)\n end",
"def password_reset\n member = Member.first\n member.reset_token = Member.new_token\n MemberMailer.password_reset(member)\n end",
"def reset_password\n new_password = SecureRandom.hex(5)\n update_attributes!(:password => new_password )\n return new_password\n end",
"def send_password_reset\n self.password_reset_sent_at = Time.now\n update_attribute(:password_reset_token, genrate_tokn(:password_reset_token) )\n UserMailer.password_reset(self).deliver\n end",
"def reset_password(plain)\n self.password = hash_crypt(plain)\n end",
"def send_password_reset\r\n # Generate password reset token\r\n self.password_reset_token = SecureRandom.urlsafe_base64\r\n # Set timestamp of when password reset was sent\r\n self.password_reset_sent_at = Time.zone.now\r\n # Do not run data validation upon saving the user\r\n save!(validate: false)\r\n # Notify the user that password reset instructions have been sent to their email\r\n UserMailer.password_reset(self).deliver\r\n end",
"def reset_password!(*args)\n self.legacy_password_hash = nil\n super\n end",
"def password_reset\n user = Volunteer.first\n user.reset_token = Volunteer.new_token\n VolunteerMailer.password_reset(user)\n end",
"def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end",
"def reset_password(*args)\n self.legacy_password = false\n super\n end",
"def reset_user_password\n temp_password = generate_password(20)\n User.update_all(\"activation_code = '#{temp_password}', recently_reset = 1, updated_at = '#{Time.now}'\", \"id = #{self.id}\")\n UserMailer.reset_password(self.id, temp_password).deliver\n end",
"def set_password_digest()\n\t\tself.password_digest = Password.create(self.password)\n\tend",
"def reset\n self.reset_token = User.new_token\n self.update_attributes(reset_digest: User.digest(reset_token),\n reset_sent_at: Time.zone.now)\n end",
"def set_password=(new_password)\n self.password = Password.create(new_password)\n self.save\n end"
] |
[
"0.7047396",
"0.69583577",
"0.6818595",
"0.6749292",
"0.6737656",
"0.670031",
"0.6676551",
"0.66730624",
"0.66577595",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66062486",
"0.6472609",
"0.6450829",
"0.6436771",
"0.6398542",
"0.6395729",
"0.6394966",
"0.6387875",
"0.6361992",
"0.6333956",
"0.63040346",
"0.6263868",
"0.6248261",
"0.62462145",
"0.6244206",
"0.6237038",
"0.62206525",
"0.6216528",
"0.6209173",
"0.62026423",
"0.6167075",
"0.6148819",
"0.61370957",
"0.61262757",
"0.612521",
"0.612521",
"0.612521",
"0.61206967",
"0.610895",
"0.60907835",
"0.60302496",
"0.6020839",
"0.60178",
"0.6017594",
"0.60139984",
"0.60058177",
"0.6003872",
"0.6003809",
"0.59939784",
"0.5991267",
"0.59896576",
"0.5989354",
"0.59803075",
"0.5967755",
"0.5967606",
"0.5958503",
"0.5956676",
"0.59336716",
"0.59336716",
"0.59336716",
"0.59336716",
"0.59336716",
"0.59336716",
"0.59336716",
"0.59318346",
"0.5930653",
"0.5929595",
"0.5927456",
"0.592535",
"0.590447",
"0.5900347",
"0.5900347",
"0.58816856",
"0.58780354",
"0.5873009",
"0.5864715",
"0.5857497",
"0.5856446",
"0.5855534",
"0.58538",
"0.58428276",
"0.5839193",
"0.5836297",
"0.58357185",
"0.58289844"
] |
0.0
|
-1
|
Sends password reset email.
|
def send_password_reset_email
UserMailer.password_reset(self.class.name.to_s.downcase.pluralize, self).deliver_now
logger.info "email: admin password reset sent to #{email}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_password_reset_email\n\t\tUserMailer.password_reset(id, self.reset_token).deliver_later\n \tend",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_passwordreset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver!\r\n end",
"def send_password_reset_email\n AgentMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n PasswordResetMailer.password_reset_email(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_reset_email\n\t\tUserMailer.reset_password(self).deliver_now\n\tend",
"def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend",
"def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend",
"def send_password_reset_email\n \tUserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n create_password_reset_digest\n update_attribute(:sent_reset_at, Time.zone.now)\n UserMailer.password_reset(self).deliver_later\n end",
"def send_password_reset_email\n\t\tMemberMailer.password_reset(self).deliver_now\n\tend",
"def send_password_reset_email\n GolferMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n #UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end",
"def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end"
] |
[
"0.8790497",
"0.86796135",
"0.86796135",
"0.8663904",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86587805",
"0.8652506",
"0.8650495",
"0.8648778",
"0.8633209",
"0.8633209",
"0.8633209",
"0.8633209",
"0.8633209",
"0.8633209",
"0.8628305",
"0.86190605",
"0.8583583",
"0.85463566",
"0.85428846",
"0.8541629",
"0.85391986",
"0.85309553",
"0.8519162",
"0.8517919",
"0.8499816",
"0.84819937",
"0.84819937",
"0.84819937",
"0.84819937",
"0.84819937",
"0.84819937",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846",
"0.8473846"
] |
0.0
|
-1
|
Returns true if a password reset has expired.
|
def password_reset_expired?
reset_sent_at < 2.hours.ago
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def password_reset_expired?\n reset_sent_at < Settings.timeout_reset_password.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago # password reset sent earlier than two hours ago.\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago # reads as password reset sent earlier than 2 hours ago\n end",
"def password_reset_expired?\n reset_password_sent_at < 1.hours.ago\n end",
"def password_reset_expired?\r\n reset_sent_at < 2.hours.ago\r\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago rescue true\n end",
"def password_reset_expired?\n reset_sent_at && (reset_sent_at < 2.hours.ago)\n end",
"def password_reset_expired?\n reset_sent_at.nil? || reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n\t\tself.reset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n # Is password reset sent EARLIER than two ours ago?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n \n # “Password reset sent earlier than two hours ago.” \n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n # Read as 'password reset sent earlier than two hours ago'.\n end",
"def password_reset_expired?\n reset_sent_at < 24.hours.ago\n end",
"def password_reset_expired?\n # read this as \"password reset sent earlier than 2 hours ago\"\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n # TODO: the '2' hour expiration should be defined in an app constant\n self.password_reset_sent_at < 2.hours.ago\n end",
"def is_password_reset_expired?\n password_reset_sent_at < 6.hours.ago\n end",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago # date helpers\n\tend"
] |
[
"0.8866848",
"0.87405956",
"0.869067",
"0.86877984",
"0.86600757",
"0.86578995",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.86572534",
"0.8651915",
"0.8649047",
"0.86207587",
"0.8620148",
"0.86081725",
"0.86076194",
"0.86076194",
"0.86076194",
"0.86076194",
"0.86076194",
"0.86076194",
"0.86076194",
"0.86076194",
"0.86076194",
"0.85921174",
"0.85636353",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.8554209",
"0.85509175",
"0.8548381",
"0.8532137",
"0.85205406",
"0.85158783",
"0.84688014"
] |
0.8742425
|
1
|
GET /fnf_items GET /fnf_items.json
|
def index
@fnf_items = FnfItem.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end",
"def show\n require 'net/http'\n require 'json'\n\n response = Net::HTTP.get_response( URI.parse( \"http://freeshit.firebaseio.com/items/%s.json\" % [ params[:id] ] ) );\n\n begin\n @fb_item = JSON.parse(response.body)\n rescue\n render :status => 404, :text => 'Item not found.'\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fb_item }\n end\n end",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def show\n json_response(@food_item)\n end",
"def index\n @foil_items = FoilItem.all\n end",
"def show\n @fridge = Fridge.find(params[:id])\n @items = @fridge.fridge_items # for _item_list.html.erb\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fridge }\n end\n end",
"def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n json_response(current_restaurant.restaurant_food_items)\n end",
"def items\n response[\"items\"]\n end",
"def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end",
"def items\n @items ||= items_from_response\n end",
"def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end",
"def get_items\n @items\n end",
"def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend",
"def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end",
"def index\n @food_items = FoodItem.all\n end",
"def show\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fooditem }\n end\n end",
"def item_from_fridge_id\n @items = Item.where(:fridge_id => params[:fridge_id])\n render :json => @items.to_json(:include => :product)\n end",
"def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end",
"def show\n item = Item.find(params[:id])\n render json: item\n end",
"def index\n @items = Item.valid_items.search(params[:search],params[:action]).order(sort_column('Item', 'name') + ' ' + sort_direction).paginate(:page => params[:page], :per_page => 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def path\n \"/{databaseId}/items/list/\"\n end",
"def fox_item\n @item\n end",
"def get_items(response, item_page)\n items = []\n response = response.to_h\n if response.key?('ItemSearchResponse') &&\n response['ItemSearchResponse'].key?('Items') &&\n response['ItemSearchResponse']['Items'].key?('Item')\n response['ItemSearchResponse']['Items']['Item'].each_with_index do |item, pos|\n items << { position: (item_page - 1) * ITEMS_PER_PAGE + pos + 1, data: item }\n end\n end\n items\n end",
"def item\n # Url generated from Js script function => getitem() of _form.html.erb file under Views of different controllers\n @item = Report.where(\"user_id = ?\" , current_user.id).pluck(:item_name )\n # send item_names' in form of json\n render json: @item\n end",
"def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end",
"def index\n render json: RequestItem.all\n end",
"def show\n render json: Item.find(params[:id])\n end",
"def list_items( args={} )\n @session.base_url = \"http://my.cl.ly\"\n \n url = \"/items\"\n args.each do |k, v|\n # probably a nicer way to do this\n if url == \"/items\"\n url << \"?#{k.to_s}=#{v.to_s}\"\n else\n url << \"&#{k.to_s}=#{v.to_s}\"\n end\n end\n resp = @session.get( url )\n \n raise AuthorizationError if resp.status == 401\n Crack::JSON.parse(resp.body)\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end",
"def index\n @flower_items = FlowerItem.all\n end",
"def show\n render json: @list_item\n end",
"def create\n @fnf_item = FnfItem.new(fnf_item_params)\n\n respond_to do |format|\n if @fnf_item.save\n format.html { redirect_to @fnf_item, notice: 'Fnf item was successfully created.' }\n format.json { render :show, status: :created, location: @fnf_item }\n else\n format.html { render :new }\n format.json { render json: @fnf_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @items = Item.includes(:user).order(created_at: :desc).all\n render json: @items\n end",
"def get_list\n \t@items\n end",
"def items(); @items || CrateAPI::Items.new(); end",
"def show\n render json: Item.find(params[\"id\"])\n end",
"def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n \n render status: 200, :json => @item\n\n end",
"def show\n @items = Item.all\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render :json => Item.all}\n end\n\n end",
"def show\n @feed_item = Item.find(params[:id])\n\n render json: @feed_item\n end",
"def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end",
"def index\n @active_items = Item.select(&:active?).sort_by(&:name)\n @inactive_items = Item.select(&:inactive?).sort_by(&:name)\n\n @item = Item.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n render json: @item\n end",
"def new\n @fb_item = FbItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fb_item }\n end\n end",
"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 @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def index\n @items = Item.all\n\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end"
] |
[
"0.68880343",
"0.6700884",
"0.66582596",
"0.6637868",
"0.6602145",
"0.6580473",
"0.65746987",
"0.6528283",
"0.6508454",
"0.6503422",
"0.64814156",
"0.6465555",
"0.64136887",
"0.64136887",
"0.64136887",
"0.64136887",
"0.6407439",
"0.6405341",
"0.63968736",
"0.63893515",
"0.63801134",
"0.63553333",
"0.6345932",
"0.6311531",
"0.63044477",
"0.6299848",
"0.6296458",
"0.6267546",
"0.6264956",
"0.6257396",
"0.62561417",
"0.6255199",
"0.6254813",
"0.6240928",
"0.62385505",
"0.6228472",
"0.6213959",
"0.6190081",
"0.61758333",
"0.61675006",
"0.61673343",
"0.6129952",
"0.61091435",
"0.61075366",
"0.61062884",
"0.610301",
"0.61007565",
"0.609594",
"0.60887253",
"0.6088106",
"0.60766566",
"0.6070313",
"0.6069896",
"0.60566753",
"0.6054817",
"0.6053923",
"0.6052246",
"0.60432714",
"0.603741",
"0.6028257",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.60149735",
"0.6013913",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476",
"0.60129476"
] |
0.75232977
|
0
|
GET /fnf_items/1 GET /fnf_items/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @fnf_items = FnfItem.all\n end",
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def show\n require 'net/http'\n require 'json'\n\n response = Net::HTTP.get_response( URI.parse( \"http://freeshit.firebaseio.com/items/%s.json\" % [ params[:id] ] ) );\n\n begin\n @fb_item = JSON.parse(response.body)\n rescue\n render :status => 404, :text => 'Item not found.'\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fb_item }\n end\n end",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def show\n item = Item.find(params[:id])\n render json: item\n end",
"def show\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fooditem }\n end\n end",
"def show\n json_response(@food_item)\n end",
"def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end",
"def show\n render json: Item.find(params[:id])\n end",
"def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end",
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end",
"def show\n render json: Item.find(params[\"id\"])\n end",
"def show\n @fridge = Fridge.find(params[:id])\n @items = @fridge.fridge_items # for _item_list.html.erb\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fridge }\n end\n end",
"def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end",
"def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @feed_item = Item.find(params[:id])\n\n render json: @feed_item\n end",
"def show\n \n render status: 200, :json => @item\n\n end",
"def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end",
"def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end",
"def item_from_fridge_id\n @items = Item.where(:fridge_id => params[:fridge_id])\n render :json => @items.to_json(:include => :product)\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end",
"def index\n json_response(current_restaurant.restaurant_food_items)\n end",
"def item\n # Url generated from Js script function => getitem() of _form.html.erb file under Views of different controllers\n @item = Report.where(\"user_id = ?\" , current_user.id).pluck(:item_name )\n # send item_names' in form of json\n render json: @item\n end",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def show\n render json: @item\n end",
"def new\n @fb_item = FbItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fb_item }\n end\n end",
"def index\n @foil_items = FoilItem.all\n end",
"def show\n @itemstable = Itemstable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstable }\n end\n end",
"def index\n render json: RequestItem.all\n end",
"def fox_item\n @item\n end",
"def show\n render json: @list_item\n end",
"def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n render json: @request_item\n end",
"def path\n \"/{databaseId}/items/list/\"\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end",
"def show\n @item_info = ItemInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_info }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end",
"def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end",
"def item\n @item = Item.find(params[:id])\n end",
"def index\n @food_items = FoodItem.all\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render :json => Item.all}\n end\n\n end",
"def show\n @page_title = @item.display_title\n logger.info \" Item price: #{@item.price}\"\n record_item_view!(@item)\n status_list = [::Item::Status::OPEN]\n sort_order = 'id desc'\n if auth_user && auth_user.parent_of?(@item.user)\n status_list << ::Item::Status::PENDING\n sort_order = 'status desc, id asc'\n end\n @other_items = Item.owned_by(@item.user).where([\"id != #{@item.id} AND status IN (?)\", status_list] ).order(sort_order).limit(40) if not @item.manageable_by_user?(auth_user)\n @favorite_item_ids = ::Items::FavoriteItem.where(user_id: auth_user.id, item_id: (@other_items.to_a.collect(&:id) + [@item.id]) ).collect(&:item_id) if auth_user\n @is_in_favorite_items = @favorite_item_ids.to_a.include?(@item.id)\n logger.info \"| favs (in? #{@is_in_favorite_items}): #{@favorite_item_ids.inspect}\"\n logger.info \"| permission to user #{auth_user.try(:user_name)}: #{@item.permission_to_user(auth_user)}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n render json: @item.detailed_json({:is_follower_user_id => auth_user.try(:id)}, auth_user.try(:id) ).\n merge(:permission => @item.permission_to_user(auth_user), :comment_threads => make_buyer_based_item_comments_threads(@item),:other_items => @other_items, :favorite_item_ids => @favorite_item_ids.to_a, :is_in_favorite_items => @is_in_favorite_items )\n end\n end\n end",
"def show\n @item = TodoItem.find(params[:id])\n \n respond_to do |format|\n format.html\n format.json {render json: {\n success:true, \n data: [@item],\n message: \"TodoItem found.\"\n }}\n end\n end",
"def show\n render json: @item, status: :ok\n end",
"def show\n @item_feature = ItemFeature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_feature }\n end\n end",
"def show\n #@item = Item.find(params[:id])\n #@item = Item.find(params[:id]) if Item.find(params[:id]).list.user == current_user\n if params[:id].blank?\n @item\n else\n @item ||= current_user.lists.find(Item.find(params[:id]).list.id).items.find(params[:id])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end",
"def index\n @items = Item.valid_items.search(params[:search],params[:action]).order(sort_column('Item', 'name') + ' ' + sort_direction).paginate(:page => params[:page], :per_page => 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def set_fnf_item\n @fnf_item = FnfItem.find(params[:id])\n end",
"def create\n @fnf_item = FnfItem.new(fnf_item_params)\n\n respond_to do |format|\n if @fnf_item.save\n format.html { redirect_to @fnf_item, notice: 'Fnf item was successfully created.' }\n format.json { render :show, status: :created, location: @fnf_item }\n else\n format.html { render :new }\n format.json { render json: @fnf_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, item: @list } }\n end\n end",
"def index\n @items = Item.order('created_at DESC').where(activated: true)\n respond_to do |format|\n format.html\n format.json {render html: '<strong>404 Not Found</strong>'.html_safe}\n end\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def show\n @item_datum = ItemData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_datum }\n end\n end",
"def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end",
"def index\n @items = Item.includes(:user).order(created_at: :desc).all\n render json: @items\n end",
"def new\n @fooditem = Fooditem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fooditem }\n end\n end",
"def show\n @itemstatus = Itemstatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstatus }\n end\n end",
"def get_single_item(item_id, payload = {})\n payload = payload.merge('ItemID' => item_id)\n request('GetSingleItem', payload)\n end",
"def show\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_item }\n end\n end",
"def findItem\n item = Item.find(params[:id])\n if item\n return item\n else\n return render json: {data: \"Failure, could not find this item.\"}, status: :not_found\n end\n end",
"def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend",
"def get(item)\n run(\"show #{ item }\")\n end",
"def show\n @weather_item = WeatherItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather_item }\n end\n end",
"def show\n @gitem = Gitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gitem }\n end\n end",
"def get_items\n @items\n end",
"def show\n @item = Item.find(params[:id])\n @user = @item.user_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n end"
] |
[
"0.7148471",
"0.7062004",
"0.6954867",
"0.6825546",
"0.67909724",
"0.66906935",
"0.66899335",
"0.66705793",
"0.6653222",
"0.66157293",
"0.6610018",
"0.6580018",
"0.6576504",
"0.6542761",
"0.65418804",
"0.65412927",
"0.6505877",
"0.6498046",
"0.64964974",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6484782",
"0.6476131",
"0.6462197",
"0.64566714",
"0.6456262",
"0.6448972",
"0.6442788",
"0.6442788",
"0.6442788",
"0.6442788",
"0.6431073",
"0.64292365",
"0.642343",
"0.63957435",
"0.6394664",
"0.638421",
"0.63734025",
"0.6348697",
"0.6347033",
"0.63437945",
"0.63276136",
"0.6316274",
"0.63090783",
"0.63079196",
"0.6301539",
"0.6300565",
"0.62846315",
"0.62749517",
"0.62407225",
"0.6230068",
"0.62171507",
"0.62110144",
"0.62095475",
"0.62045944",
"0.6173644",
"0.6170171",
"0.61558646",
"0.6154825",
"0.61534023",
"0.6151405",
"0.614495",
"0.61416477",
"0.6141185",
"0.6140762",
"0.61280847",
"0.6115428",
"0.610033",
"0.6098094",
"0.60967714",
"0.607069",
"0.60703",
"0.6067274",
"0.606336",
"0.6055484",
"0.6052697",
"0.6048977",
"0.6046841",
"0.6040782",
"0.6040079",
"0.60337937",
"0.5983528",
"0.59804",
"0.59791744",
"0.59780926"
] |
0.0
|
-1
|
POST /fnf_items POST /fnf_items.json
|
def create
@fnf_item = FnfItem.new(fnf_item_params)
respond_to do |format|
if @fnf_item.save
format.html { redirect_to @fnf_item, notice: 'Fnf item was successfully created.' }
format.json { render :show, status: :created, location: @fnf_item }
else
format.html { render :new }
format.json { render json: @fnf_item.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end",
"def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end",
"def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end",
"def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end",
"def add_multiple_food_items(items)\n items.each do |item|\n item['_id'] = FoodItem.create_id item[:api_key], item[:item_id]\n FoodItem.new_item item\n end\n items\n end",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end",
"def create\n @fb_item = FbItem.new(params[:fb_item])\n\n respond_to do |format|\n if @fb_item.save\n format.html { redirect_to @fb_item, notice: 'Fb item was successfully created.' }\n format.json { render json: @fb_item, status: :created, location: @fb_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fb_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fnf_item_params\n params.require(:fnf_item).permit(:no_of_fnf, :pulse, :fnf_on_net_tariff, :fnf_off_net_tariff, :fnf_atw, :fnf_priority)\n end",
"def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend",
"def create\n @foil_item = FoilItem.new(foil_item_params)\n\n respond_to do |format|\n if @foil_item.save\n format.html { redirect_to @foil_item, notice: 'Foil item was successfully created.' }\n format.json { render :show, status: :created, location: @foil_item }\n else\n format.html { render :new }\n format.json { render json: @foil_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n item = Item.new(item_params)\n item.user = current_user\n if item.save\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @item = @list.items.create(item_params)\n redirect_to @list\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to lists_path, :notice => 'Item was successfully created.' }\n format.json { render :json => lists_path, :status => :created, :location => lists_path }\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 @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\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 @fooditem = Fooditem.new(params[:fooditem])\n\n respond_to do |format|\n if @fooditem.save\n format.html { redirect_to @fooditem, :notice => 'Fooditem was successfully created.' }\n format.json { render :json => @fooditem, :status => :created, :location => @fooditem }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fooditem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_item = Admin::Item.new(params[:admin_item])\n @admin_item.agency_id = @current_agency.id\n fields = params[:item][:field]\n\n respond_to do |format|\n if @admin_item.save\n \n fields.each do |key, value|\n Admin::FieldValue.create(:item_id => @admin_item.id, :field_id => key, :value => value)\n end\n \n format.html { redirect_to edit_admin_item_path(@admin_item), notice: 'Item was successfully created.' }\n format.json { render json: @admin_item, status: :created, location: @admin_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @fnf_items = FnfItem.all\n end",
"def create\n ListItem.transaction do\n item = Item.new(item_params)\n item.save\n\n @list_item = ListItem.new(list_item_params)\n @list_item.item_id = item.id\n @list_item.list_id = params[:list_id]\n\n\n if @list_item.save\n render json: @list_item, status: :created\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_url, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, item: @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 @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end",
"def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend",
"def create\n list = List.find(params[:list_id])\n @list_item = list.list_items.new(list_items_params)\n @list_item.save ? json_response(@list_item) : json_response(@list_item.errors, status = :not_acceptable)\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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 @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, 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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', 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 fd_item_params\n params.require(:fd_item).permit(:desc_item, :data_exclusao, :fd_empresa_id)\n end",
"def save_items_data\n @parsed[\"order_items\"].each do |i| \n external_code = i['item']['id']\n item = Item.find_or_create_by(external_code: external_code)\n item.order_id = @order.id\n item.external_code = i['item']['id']\n item.name = i['item']['title']\n item.price = i['unit_price']\n item.quantity = i['quantity']\n item.total = i['full_unit_price']\n @subItems = []\n item.save\n end\n end",
"def create\n @api_v1_item = Item.new(api_v1_item_params)\n\n if @api_v1_item.save\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(item_attrs = {})\n body = { value: item_attrs }\n Iterable.request(conf, base_path).put(body)\n end",
"def create\n @food_item_add_on = FoodItemAddOn.new(food_item_add_on_params)\n\n\n\n#Todo: can select multiple items for a sinfle addons\n respond_to do |format|\n if @food_item_add_on.save\n format.html { redirect_to :controller => 'home', :action => 'dashboard' }\n format.json { render :show, status: :created, location: @food_item_add_on }\n else\n format.html { render :new }\n format.json { render json: @food_item_add_on.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n else\n render json: @itemtipo.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 format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end",
"def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def item_params\n params.require(:item).permit(:item, :body)\n end",
"def create\n @item = @list.items.build(item_params)\n @item.user = current_user\n\n if @item.save\n return success_item_create\n else\n return error_item_save\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to :items, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @slot }\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 @item = Item.new(item_params)\n \n respond_to do |format|\n if @item.save \n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(current_user.id)\n @item = @user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _test_launch_process_with_json_launchitem\n\n li = LI_WITH_DEFINITION.to_h.dup\n\n #puts \"===\"\n #p li.to_json\n #puts \"===\"\n\n li['attributes']['food'] = 'tamales'\n\n post(\n '/processes.json',\n li.to_json,\n { 'CONTENT_TYPE' => 'application/json' })\n\n sleep 0.350\n\n puts @response.body\n\n assert_equal 'application/json', @response.headers['Content-type']\n\n fei = json_parse(@response.body)\n assert_equal 'ruote_rest', fei['engine_id']\n\n assert_equal 1, OpenWFE::Extras::ArWorkitem.find(:all).size\n wi = OpenWFE::Extras::ArWorkitem.find(:first)\n\n assert_equal 'tamales', wi.as_owfe_workitem.fields['food']\n end",
"def create_items\n @items.each do |item|\n create_item(item) unless Item.where(name: item['name']).first\n end\n end",
"def create\n #api_key = \"cb8d3966-e1c6-4429-a8cf-b615523481c4\"\n\n @item = Item.new(item_params)\n\n @swift_api_key = SwiftApiKey.first\n\n api_key = @swift_api_key.key\n\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": api_key,\n \"booking\":{\n \"items\": [{\n \"quantity\": @item.quantity,\n \"sku\": @item.sku,\n \"description\": @item.description,\n \"price\": @item.price\n }],\n \"pickupDetail\": {\n \"name\": \"Marko\",\n \"phone\": \"604 356 8259\",\n \"address\": \"301 Maude Road, Port Moody, V3H5B1\"\n },\n \"dropoffDetail\": {\n \"name\": @item.name,\n \"phone\": @item.phone,\n \"address\": @item.address\n }\n }\n }.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @facility_item = FacilityItem.new(facility_item_params)\n\n respond_to do |format|\n if @facility_item.save\n format.html { redirect_to @facility_item, notice: 'Facility item was successfully created.' }\n format.json { render :show, status: :created, location: @facility_item }\n else\n format.html { render :new }\n format.json { render json: @facility_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\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 @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\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 set_fnf_item\n @fnf_item = FnfItem.find(params[:id])\n end",
"def create\n @item = Item.new(item_save_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n category_field_values = []\n params[:item_field].each do |key, value|\n category_field_values << { item_id: @item.id, category_field_id: key, value: value }\n end\n CategoryFieldValue.create(category_field_values)\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.create(item_params)\n @items = List.find(item_params[:list_id]).items.order(\"id ASC\")\n @list_id = item_params[:list_id]\n end",
"def post(payload, request_opts={})\n if payload.is_a?(Hash)\n payload = self.class.item_class.new(payload) # apply data type conversion\n end\n qs = payload.query_string_params\n payload = payload.as_hash\n response = http(request_opts).post(resolved_path + qs, payload)\n new_item = self.class.item_class.new\n new_item.store_result(response)\n new_item\n end",
"def create \n #whitelist params and save them to a variable \n item_params = params.require(:item).permit(:name, :category, :image, :price)\n #create a new item from 'item_params'\n @item = Item.new(item_params)\n #if item saves, render the new item in JSON\n if @item.save \n render json: @item\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = @deal.items.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to deal_items_url(@deal), notice: 'Item was successfully created.' }\n format.json { render json: @item, 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\n @list_item = @list.list_items.create!(list_item_params)\n #@list_item = @list.list_items.create!(params[:list_item])\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_index_path, notice: 'O item foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :item_new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response\nend",
"def create\n @baintodo_item = @baintodo_list.baintodo_items.create(baintodo_item_params)\n redirect_to @baintodo_list\n end",
"def create\n params[:file_item][:parent_id] = nil if params[:file_item][:parent_id].blank?\n @file_item = FileItem.cs(self.current_scope).new(params[:file_item])\n\n respond_to do |format|\n if @file_item.save\n format.html { redirect_to @file_item, :notice => 'File item was successfully created.' }\n format.json { render :json => @file_item, :status => :created, :location => @file_item }\n else\n format.html { render :action => \"new_#{@file_item.item_type}\" }\n format.json { render :json => @file_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @form_item = @template.form_items.build(form_item_params)\n\n respond_to do |format|\n if @form_item.save\n format.html { redirect_to template_path(@template, anchor: :additem), notice: 'Form item was successfully created.' }\n format.json { render :show, status: :created, location: @form_item }\n else\n format.html { render :new }\n format.json { render json: @form_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_item = Task::Item.new(task_item_params)\n\n respond_to do |format|\n if @task_item.save\n format.html { redirect_to task_list_path(@task_item.list), notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @task_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.js { render :new, status: :unprocessable_entity }\n format.json { render json: @task_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_item = TipoItem.new(params[:tipo_item])\n\n respond_to do |format|\n if @tipo_item.save\n format.html { redirect_to @tipo_item, notice: 'Tipo item was successfully created.' }\n format.json { render json: @tipo_item, status: :created, location: @tipo_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createItemOfList\n results1 = checkUser(params[:target_account]) #userid user to give the money\n if results1.code == 200\n parameters={user_id: (@current_user[\"id\"]).to_i, description: (params[:description]), date_pay: params[:date_pay], cost: params[:cost], target_account: params[:target_account], state_pay:params[:state_pay]}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4055/lists\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n elsif results1.code == 404\n renderError(\"Not Found\", 404, \"The resource does not exist\")\n end\n end",
"def create_item_with_http_info(item_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ItemsApi.create_item ...'\n end\n # verify the required parameter 'item_request_body' is set\n if @api_client.config.client_side_validation && item_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'item_request_body' when calling ItemsApi.create_item\"\n end\n # resource path\n local_var_path = '/items'\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[:debug_body] || @api_client.object_to_http_body(item_request_body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SingleItem'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth', 'oAuth2ClientCredentials']\n\n new_options = opts.merge(\n :operation => :\"ItemsApi.create_item\",\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: ItemsApi#create_item\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_todo_item(name, list_id)\n data = {\n item: {\n name: name\n }\n }\n rest(\"post\", \"lists/#{list_id}/items\", data)\n end",
"def create\n @item = Item.new(item_params)\n # @item.build_note\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n respond_with(@items)\n end\n end\n end",
"def create\n puts params\n item_data = {\n :title => params[:title],\n :description => params[:description]\n }\n @item = current_user.items.build(item_data)\n if params[:attachments]\n params[:attachments].each do |att_id|\n @att = Attachment.find(att_id)\n @item.attachments.push(@att)\n if @att.att_type == 'photo'\n @item.photos.build(\n photo_url: @att.url\n )\n end\n end\n end\n if @item.save\n respond_to do |format|\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create item\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created }\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 @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_path, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.72207713",
"0.67484325",
"0.67477804",
"0.66641617",
"0.6635152",
"0.6523007",
"0.64696527",
"0.6447944",
"0.6436264",
"0.6428302",
"0.63975084",
"0.6395761",
"0.63598627",
"0.6294305",
"0.6270345",
"0.626063",
"0.6258671",
"0.625775",
"0.6232487",
"0.6231857",
"0.6193738",
"0.61896217",
"0.61665416",
"0.6148244",
"0.6119302",
"0.6116367",
"0.6114939",
"0.6114939",
"0.6114939",
"0.6114939",
"0.6114939",
"0.6114939",
"0.6114939",
"0.611441",
"0.61134666",
"0.61001706",
"0.6084851",
"0.60781264",
"0.60771143",
"0.60734814",
"0.6056814",
"0.60541725",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.6048242",
"0.60467607",
"0.60458875",
"0.6039608",
"0.60362834",
"0.60302395",
"0.60146177",
"0.599128",
"0.59885037",
"0.59883595",
"0.59813255",
"0.5978764",
"0.59774673",
"0.5970966",
"0.59677196",
"0.59677196",
"0.59677196",
"0.59677196",
"0.59677196",
"0.5964685",
"0.59574574",
"0.59373915",
"0.5936968",
"0.59355414",
"0.59347624",
"0.59232557",
"0.59212226",
"0.5920746",
"0.59185857",
"0.59165365",
"0.5915624",
"0.59122896",
"0.5911798",
"0.5910796",
"0.5908625",
"0.5904695",
"0.59020174",
"0.5901403",
"0.5883523",
"0.5880709",
"0.58778787",
"0.5877251",
"0.5871956"
] |
0.7313476
|
0
|
PATCH/PUT /fnf_items/1 PATCH/PUT /fnf_items/1.json
|
def update
respond_to do |format|
if @fnf_item.update(fnf_item_params)
format.html { redirect_to @fnf_item, notice: 'Fnf item was successfully updated.' }
format.json { render :show, status: :ok, location: @fnf_item }
else
format.html { render :edit }
format.json { render json: @fnf_item.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end",
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end",
"def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end",
"def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\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 @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end",
"def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end",
"def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @fb_item = FbItem.find(params[:id])\n\n respond_to do |format|\n if @fb_item.update_attributes(params[:fb_item])\n format.html { redirect_to @fb_item, notice: 'Fb item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fb_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @foil_item.update(foil_item_params)\n format.html { redirect_to @foil_item, notice: 'Foil item was successfully updated.' }\n format.json { render :show, status: :ok, location: @foil_item }\n else\n format.html { render :edit }\n format.json { render json: @foil_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n if @fooditem.update_attributes(params[:fooditem])\n format.html { redirect_to @fooditem, :notice => 'Fooditem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @fooditem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end",
"def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', 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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, 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 @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\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_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend",
"def update\n respond_to do |format|\n if @item.update(item_params)\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 respond_to do |format|\n if @item.update(item_params)\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 respond_to do |format|\n if @item.update(item_params)\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 respond_to do |format|\n if @item.update(item_params)\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 respond_to do |format|\n if @item.update(item_params)\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 respond_to do |format|\n if @item.update(item_params)\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 respond_to do |format|\n if @item.update(item_params)\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 respond_to do |format|\n if @item.update(item_params)\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 respond_to do |format|\n if @item.update(item_params)\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\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(item_attrs = {})\n body = { update: item_attrs }\n Iterable.request(conf, base_path).patch(body)\n end",
"def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\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 @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\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 @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = @collection.items.get(params[:id])\n @collection.schema.each do |field|\n if params[:item][field.to_s].blank? && !field.is_file\n @item[field.name]=nil\n elsif field.is_file\n #do nothing\n unless params[:item][field.to_s].nil?\n new_file = @file_collection.items.new()\n new_file.file =params[:item][field.to_s]\n new_file.save\n @item[field.name]='{\"project\":{\"id\": \"'+@project.id+'\"}, \"collection\":{\"id\": \"'+@file_collection.id+'\"},\"item\":{\"id\": \"'+new_file.id.to_s+'\", \"display\": \"'+new_file.original_filename+'\"}}'\n end\n else\n @item[field.name] = params[:item][field.to_s]\n end\n end\n if @item.save\n update_associated_fields(@item, @collection, @project)\n respond_to do |format|\n format.html do\n flash[:notice] = \"Item Updated Successfully!\"\n end\n #format.json { render json: @item.to_json, status: :updated}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item updated. Close window and refresh your page.</h2>\").attr(\"class\",\"message notice\"); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n else\n respond_to do |format|\n format.html do\n flash[:error] = [\"Item failed to save! Errors:\", @item.errors.full_messages].flatten.join(' ')\n end\n format.json { render json: @item.to_json, status: :error}\n format.js { render :js => '$(\"#message\").html(\"<h2>Item failed update.</h2>\").attr(\"class\",\"message error\").scrollTop(0); $(\"html, body\").animate({scrollTop: \"0px\"})' }\n end\n end\n redirect_to :back\n end",
"def update\n #@food_item automatically set to FoodItem.find(params[:id])\n\n respond_to do |format|\n if @food_item.update_attributes(params[:food_item])\n if request.xhr?\n format.html { render partial: 'row', locals: {food_item: @food_item, index: 0}}\n else\n format.html { redirect_to @food_item, notice: 'Food item was successfully updated.' }\n end\n format.json { head :no_content }\n else\n if request.xhr?\n format.html { render partial: 'row_form', locals: {food_item: @food_item}, status: :unprocessable_entity }\n else\n format.html { render action: \"edit\" }\n end\n format.json { render json: @food_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\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 respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item was updated successfully' }\n format.json { render :show, status: :ok, location: items_path }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item ' + @item.name + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n task\n if @item.update(item_params)\n render json: @list.as_json, status: :ok\n else\n render json: {list: @item.errors, status: :unprocessable_entity}\n end\n end",
"def update\n @item.update!(item_params)\n end",
"def update\n respond_to do |format|\n if @fertigation_item.update(fertigation_item_params)\n update_fertigation_and_costs\n format.html { redirect_to @fertigation_item, notice: 'Fertigation item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fertigation_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_url, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_item_params)\n head :no_content\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = TodoItem.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:todo_item])\n format.html { redirect_to @item, notice: 'TodoItem was successfully updated.' }\n format.json {render json: {\n success: true,\n data: [],\n message: \"TodoItem was successfully updated.\"\n }}\n else\n format.html { render action: \"edit\" }\n format.json { render json: {\n success: false,\n data: [],\n message: @item.errors\n }}\n end\n end\n end",
"def change_multiple_items\n @items = params[:items]\n\n @items.each do |item|\n @current_item = Item.find(item[:id])\n @current_item.update(quantity: item[:quantity])\n end\n\n render :json => @items.to_json\n end",
"def update\n @item_feature = ItemFeature.find(params[:id])\n\n respond_to do |format|\n if @item_feature.update_attributes(params[:item_feature])\n format.html { redirect_to @item_feature, notice: 'Item feature was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to root_path, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to item_show_path(@item), notice: 'O item foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7083626",
"0.7041379",
"0.68925995",
"0.67435515",
"0.6677418",
"0.6621005",
"0.66181964",
"0.6582088",
"0.6561441",
"0.65573895",
"0.6556058",
"0.6530383",
"0.6519308",
"0.65159804",
"0.6510725",
"0.64919347",
"0.64915043",
"0.64876",
"0.6476257",
"0.645653",
"0.6449354",
"0.64461184",
"0.64461184",
"0.64461184",
"0.64461184",
"0.64461184",
"0.64461184",
"0.64461184",
"0.64461184",
"0.64461184",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64360493",
"0.64137316",
"0.6410944",
"0.6407557",
"0.6407557",
"0.6399746",
"0.63844997",
"0.637827",
"0.637438",
"0.63725483",
"0.6363914",
"0.6350948",
"0.6345526",
"0.6345526",
"0.6345014",
"0.6335229",
"0.63347524",
"0.6334012",
"0.63276184",
"0.6326786",
"0.6326187",
"0.6321807",
"0.63188416",
"0.631197",
"0.63055027",
"0.6305502",
"0.6293031",
"0.62902814",
"0.6289009",
"0.6288438",
"0.62881327",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62876815",
"0.62871635",
"0.62871635",
"0.62871635",
"0.62871635",
"0.6260743"
] |
0.72149175
|
0
|
DELETE /fnf_items/1 DELETE /fnf_items/1.json
|
def destroy
@fnf_item.destroy
respond_to do |format|
format.html { redirect_to fnf_items_url, notice: 'Fnf item was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @fb_item = FbItem.find(params[:id])\n @fb_item.destroy\n\n respond_to do |format|\n format.html { redirect_to fb_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @fooditem = Fooditem.find(params[:id])\n @fooditem.destroy\n\n respond_to do |format|\n format.html { redirect_to fooditems_url }\n format.json { head :no_content }\n end\n end",
"def delete_item(item)\n @get_items.delete(item)\n end",
"def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end",
"def delete_fs_item\n d \"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\"\n d \"Delete a file or folder\"\n d \"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\"\n \n err_str = ''\n begin # a one time loop to allow break\n \n generic_ty = Integer(params[:sel_kind]) rescue generic_ty = FSTYPE_INVALID\n elem_id = Integer(params[:sel_id]) rescue elem_id = -1\n if ( elem_id <= 0 )\n err_str = 'Invalid index'\n break\n end\n \n if ( generic_ty == FSTYPE_FILE )\n to_upd = Dfile.find_by_id( elem_id )\n if ( to_upd )\n kindname = to_upd.fileType()\n parent_id = to_upd.directory_id\n our_name = to_upd.name\n if to_upd.destroy\n reponse = { action_id: params[:action_id],\n new_id: elem_id,\n new_name: our_name,\n parent_id: parent_id,\n kind_name: kindname\n }\n render :json => reponse, :layout => false, :status => 200 and return\n else\n err_str = 'Failed to delete file'\n break\n end\n else\n err_str = 'File does not exist'\n break\n end\n elsif ( generic_ty == FSTYPE_DIR )\n to_upd = Directory.find_by_id( elem_id )\n if ( to_upd )\n parent_id = to_upd.parent_id\n our_name = to_upd.name\n if to_upd.destroy\n reponse = { action_id: params[:action_id],\n new_id: elem_id,\n new_name: our_name,\n parent_id: parent_id,\n kind_name: 'directory'\n }\n render :json => reponse, :layout => false, :status => 200 and return\n else\n err_str = 'Failed to delete directory'\n break\n end\n else\n err_str = 'Directory does not exist'\n break\n end\n else\n err_str = 'Invalid entry type'\n break\n end\n \n end until true # a one time loop to allow break\n render json: err_str, status: :unprocessable_entity and return\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end",
"def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def delete_item\n\nend",
"def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foil_item.destroy\n respond_to do |format|\n format.html { redirect_to foil_items_url, notice: 'Foil item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tif Rails.env.production?\n\t\t\tRestClient.patch(\"https://lensshift-drive.firebaseio.com/resources_deleted/#{@resource_item.google_doc_id}.json\", @resource_item.to_json)\n\t\t\tRestClient.delete(\"https://lensshift-drive.firebaseio.com/resources/#{@resource_item.google_doc_id}.json\")\n\t\tend\n\t\t@resource_item.destroy\n\t respond_to do |format|\n\t format.html { redirect_to fellow_resource_items_url, notice: 'Resource item was successfully destroyed.' }\n\t format.json { head :no_content }\n\t end\n\tend",
"def deleted(item)\n end",
"def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @file_item = FileItem.cs(self.current_scope).find_by_path(params[:id])\n @file_item.destroy\n\n respond_to do |format|\n format.html { redirect_to file_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @test_item.destroy\n respond_to do |format|\n format.html { redirect_to test_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: '削除に成功しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @defected_item.destroy\n respond_to do |format|\n format.html { redirect_to defected_items_url, notice: 'Defected item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\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 @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 @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 destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @item.destroy\n head :no_content\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = current_user.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def 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 @resource_item.destroy\n respond_to do |format|\n format.html { redirect_to resource_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_item.destroy\n respond_to do |format|\n format.html { redirect_to food_items_url, notice: \"Food item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n\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 @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rfx_item.destroy\n respond_to do |format|\n format.html { redirect_to rfx_rfx_items_url(@rfx), notice: 'Rfx item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_path, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_item.destroy!\n head :no_content\n end",
"def destroy\n\t\tif food = FoodItem.find(params[:id])\n\t\t\tfood.destroy\n\t\t\thead :no_content\n\t\tend\n\tend",
"def 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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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 @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"
] |
[
"0.73617923",
"0.7226795",
"0.70814204",
"0.7033399",
"0.70078087",
"0.6970182",
"0.6960349",
"0.695755",
"0.6948101",
"0.69021577",
"0.6897318",
"0.68926764",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.6892373",
"0.68825537",
"0.6873408",
"0.6856146",
"0.6856146",
"0.6856146",
"0.6856146",
"0.6856146",
"0.6856146",
"0.6856146",
"0.6856146",
"0.6856146",
"0.6856146",
"0.685245",
"0.683782",
"0.68294114",
"0.68207234",
"0.6804269",
"0.67971206",
"0.679282",
"0.6787821",
"0.678341",
"0.676732",
"0.6758949",
"0.6735265",
"0.67351115",
"0.67327595",
"0.6721932",
"0.6707304",
"0.66899884",
"0.66870403",
"0.66848326",
"0.66753626",
"0.66675645",
"0.66653395",
"0.665889",
"0.6657464",
"0.66563946",
"0.6651236",
"0.6650551",
"0.66432816",
"0.66386247",
"0.66337997",
"0.66205823",
"0.66205823",
"0.66197705",
"0.6618322",
"0.6617703",
"0.66145974",
"0.6611924",
"0.6607732",
"0.6607468",
"0.6605533",
"0.66008866",
"0.6597896",
"0.6596654",
"0.659579",
"0.6595477",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299",
"0.6589299"
] |
0.73346955
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_fnf_item
@fnf_item = FnfItem.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 fnf_item_params
params.require(:fnf_item).permit(:no_of_fnf, :pulse, :fnf_on_net_tariff, :fnf_off_net_tariff, :fnf_atw, :fnf_priority)
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
|
with K <= x <= K, and add x to A[i]. After this process, we have some array B. Return the smallest possible difference between the maximum value of B and the minimum value of B.
|
def smallest_range_i(a, k)
result = a.max - a.min - 2 * k
result >= 0 ? result : 0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def largest_sum_after_k_negations_a(a, k)\n while k > 0\n min = a.index(a.min)\n a[min] = -a[min]\n k -= 1\n end\n a.sum\nend",
"def maxMin(k, arr)\n # 1) sort the array in asceding order\n arr.sort!\n\n min = nil\n # 2) iterate array from 0 to array length - k\n for i in 0..(arr.length - k)\n if min.nil? || min > arr[k + i - 1] - arr[i]\n # 3) calculate min\n min = arr[k + i - 1] - arr[i]\n end\n end\n\n return min\nend",
"def find_k_biggest_number(array, k)\n numbers = []\n\n array.each do |element|\n numbers << element if numbers.size < k\n if element > numbers.min\n numbers.delete(numbers.min)\n numbers.push(element)\n end\n end\n\n numbers\nend",
"def k_concatenation_max_sum(arr, k)\r\n return arr.sum * k if arr.all?(&:positive?)\r\n return 0 if arr.all?(&:negative?)\r\n total = arr.inject(0) {|sum, x| sum + x} * k\r\n try = total\r\n arr.each do |num|\r\n try -= num\r\n total = try if try > total\r\n end\r\n try = total\r\n arr.reverse.each do |num|\r\n try -= num\r\n total = try if try > total\r\n end\r\n total\r\nend",
"def solution(a)\n left_sum = a.first\n right_sum = a.drop(1).reduce(:+)\n min_diff = (left_sum - right_sum).abs\n\n a.take(a.length - 1).drop(1).each do |element|\n left_sum += element\n right_sum -= element\n\n current_diff = (left_sum - right_sum).abs\n\n if current_diff < min_diff\n min_diff = current_diff\n end\n end\n min_diff\nend",
"def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend",
"def solution(a)\n (0..a.size - 2).map { |i| ( a[0..i].inject(:+) - a[i+1..a.size].inject(:+) ).abs }.min\nend",
"def k_largest_elements2(array, k) \n result = BinaryMinHeap.new\n k.times do\n result.push(array.pop)\n end\n until array.empty?\n result.push(array.pop)\n result.extract\n end\n result.store\nend",
"def solution(a, b, k)\n return (b / k) - ((a - 1) / k)\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 twoArrays(n, k, a, b)\n a_sorted = a.sort\n b_sorted = b.sort.reverse\n sum_ele = []\n n.times do |i|\n sum_ele << a_sorted[i] + b_sorted[i]\n end\n if sum_ele.min >= k\n return 'YES'\n else\n return 'NO'\n end\nend",
"def min_unfairness (candy, n, k)\n # First, sorting the array\n candy.sort!\n\n # puts candy.inspect\n\n # Initialize with the first and k element \n min = candy[k-1] - candy[0]\n\n # For each subsequential k elements, we have to find the min. unfairness\n for i in 1..(n-k) \n # puts \"i=#{i} n[i+k]=#{candy[i+k-1]} n[i]=#{candy[i]} : #{candy[i+k-1] - candy[i]} | min=#{min}\"\n min = candy[i+k-1] - candy[i] if candy[i+k-1] - candy[i] < min\n end\n\n return min\nend",
"def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend",
"def getMinimumCost(k, c)\n c.sort.reverse.map.with_index do |cost, i|\n cost * (1 + i / k)\n end.sum\nend",
"def k_largest(a,k)\n\treturn if a == nil || a.size == 0\t\n\tmin_heap = MinHeap.new() # Initialize a min heap.\n\tcount = 0\n\tresult = [] # REsult array to store output.\n\tfor i in 0..a.size-1 do\n\t\t# Insert element in min heap and increment count.\n\t\tmin_heap.insert(a[i])\n\t\tcount = count + 1\n\t\t# If count is greater than k, then pop element from heap and decrement count.\n\t\t# Note: to implement heap, we have taken first element in heap as nil.\n\t\tif count == k+1\n\t\t\tmin_heap.pop\n\t\t\tcount = count -1\n\t\tend\n\tend\n\t# When whole array is traversed, pop every element from heap and insert in result array.\n\twhile !min_heap.empty? do\n\t\tpoppped_item = min_heap.pop\n\t\tresult << poppped_item\n\tend\n\treturn result.reverse # Return by reversing result array as elements are in ascending order.\nend",
"def smallest_k(ranges, k)\nend",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def nearestGreater(a)\n \n result = []\n stack = []\n \n a.each_with_index do |el, i|\n \n while !stack.empty? && a[stack[-1]] < el\n num = stack.pop\n if result[num] == -1 || (i - num < num - result[num])\n result[num] = i\n end\n end\n \n if stack.empty?\n result[i] = -1 \n else\n if el != a[stack[-1]]\n result[i] = stack[-1]\n else\n result[i] = result[stack[-1]]\n end\n end\n stack << i\n end\n \n result\nend",
"def nearestGreater(a)\n \n result = []\n stack = []\n \n a.each_with_index do |el, i|\n \n while !stack.empty? and a[stack[-1]] < el\n num = stack.pop\n if result[num] == -1 || (i - num < num - result[num])\n result[num] = i\n end\n end\n \n if stack.empty?\n result[i] = -1 \n else\n if el != a[stack[-1]]\n result[i] = stack[-1]\n else\n result[i] = result[stack[-1]]\n end\n end\n stack << i\n end\n \n result\nend",
"def k_largest_elements(array, k)\nend",
"def solution(a)\n first_sum = a[0]\n second_sum = a.inject(&:+) - a.first\n result = (first_sum - second_sum).abs\n\n a[1..-2].each do |elem|\n first_sum = first_sum + elem\n second_sum = second_sum - elem\n tmp_result = (first_sum - second_sum).abs\n result = tmp_result if tmp_result < result\n end\n\n result\nend",
"def three_sum_minus(arr, k)\n min_sum = Integer::MAX\n arr = arr.sort\n n = arr.length\n i = 0\n while i <= n-3\n ele = k - arr[i]\n front = i+1\n rear = n-1\n while front < rear\n if (arr[i]+arr[front]+arr[rear]-k).abs < min_sum.abs\n min_sum = (arr[i]+arr[front]+arr[rear]-k).abs\n end\n if arr[front] + arr[rear] == ele\n rear -= 1\n elsif arr[front] + arr[rear] > ele\n rear -= 1\n else\n front += 1\n end\n end\n i += 1\n end\n # arr_result.push(arr[min_first]).push(arr[min_second]).push(arr[min_third])\n # min_sum\n i = 0\n min_first,min_second, min_third = 0, 1, n-1\n arr_result=[]\n while i <= n-3\n ele = k - arr[i]\n front = i+1\n rear = n-1\n while front < rear\n if (arr[i]+arr[front]+arr[rear]-k).abs == min_sum\n puts \"[#{arr[i]},#{arr[front]}, #{arr[rear]}]\"\n end\n if arr[front] + arr[rear] == ele\n # puts \"[#{arr[i]},#{arr[front]}, #{arr[rear]}]\"\n rear -= 1\n elsif arr[front] + arr[rear] > ele\n rear -= 1\n else\n front += 1\n end\n end\n i += 1\n end\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 my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend",
"def contig_subarrs_that_sum_to_k(k, arr) # so this problem worked with contiguous subarrays that sum to a value k\n # for example, arr[j] - arr[i] vs. arr[j]\n # if you do a running sum, any difference that equals k is what we're looking for.\n # then we can increment a counter, we can save j - i for a max size, or we can even grab the subarray.\n running_sum = 0\n arr.each_with_index do |el, index|\n end\nend",
"def solution(a)\n # write your code in Ruby 2.2\n left, right = 0, a.reduce(:+)\n min = 0\n (1...a.size).to_a.each do |i|\n left = left + a[i-1]\n right = right - a[i-1]\n diff = (left - right).abs\n if i == 1\n min = diff\n else\n min = diff < min ? diff : min\n end\n end\n min\nend",
"def my_min2(array)\n array.inject { |acc, ele| acc < ele ? acc : ele}\nend",
"def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend",
"def k_closest_a(points, k)\n points.sort_by { |point| point[0]**2 + point[1]**2 }[0,k]\nend",
"def find_difference(a, m)\n a.sort!\n first = 0\n last = 0\n i = 0\n min_diff = 1000000\n while i+m-1 < a.length\n diff = a[i+m-1] - a[i]\n if diff < min_diff\n min_diff = diff\n first = i\n last = i+m-1\n end\n i += 1\n end\n result = a[last]-a[first]\n return result\nend",
"def k_closest_points(arr, k)\n temp = []\n \n arr[0..k-1].each do |coords|\n temp << Math.sqrt((coords[0] ** 2 + coords[1] ** 2))\n end\n\n arr[k..-1].each do |coords|\n distance = Math.sqrt((coords[0] ** 2 + coords[1] ** 2))\n\n max_idx = 0\n temp.each_with_index { |temp_dist, i| max_idx = i if temp_dist > temp[max_idx] }\n\n temp[max_idx] = distance if distance < temp[max_idx]\n end\n\n temp\nend",
"def get_larger_numbers(a, b)\n new_array = []\n a.each_with_index do |num, index|\n\n # We use a ternary operator here to test what to push to our new_array\n # If the number in arr1 is greater than the number in arr2 at the same\n # index point, (this would eval to true), therefore, we will append\n # our num from arr1 to new_array. If num is NOT greater than the number\n # in arr2 at the same point in the index, then we'll append the num\n # from arr2 to our new_array.\n (num > b[index]) ? (new_array << num) : (new_array << b[index])\n end\n\n # Return our new_array containing the greatest number from each array\n # based on that spot in the index\n new_array\nend",
"def better_my_min(array)\n array.inject do |acc, ele|\n if acc <= ele\n acc\n else\n ele\n end\n end\n end",
"def minSum(a)\n\n\t# find the minimum element of A[]\n\tmin_val = a.min;\n\n\t# return the answer\n\treturn min_val * (a.length()-1)\nend",
"def max_duffel_bag_value(cake_arrays, weight_capacity)\n value = 0\n remaining_capacity = weight_capacity\n cake_arrays.sort_by! { |arr| arr[1] / arr[0] }\n cake_arrays.reverse!\n cake_arrays.each do |arr|\n number_fit = remaining_capacity / arr[0]\n\n remaining_capacity -= (number_fit * arr[0])\n value += (number_fit * arr[1])\n # return value if remaining_capacity == 0\n end\n value\nend",
"def get_larger_numbers(a, b)\n x = 0\n result = []\n loop do\n a[x] > b[x] ? result << a[x] : result << b[x]\n x += 1\n break if a[x] == nil\n end\n result\nend",
"def solution(a)\n # write your code in Ruby 2.2\n left = 0\n right = a.reduce(:+)\n difference = []\n\n for i in 1..(a.size-1) do\n left += a[i-1]\n right -= a[i-1]\n absolute = (left - right).abs\n difference.push(absolute)\n end\n #puts \"#{difference}\"\n return difference.min\nend",
"def find_k(left_nums, left_start, left_end, right_nums, right_start, right_end, k)\n length_l = left_end - left_start + 1\n length_r = right_end - right_start + 1\n\n # force smaller array to be first\n return find_k(right_nums, right_start, right_end, left_nums, left_start, left_end, k) unless length_l <= length_r\n\n # smaller array is empty, get mean of larger array\n return right_nums[right_start + k - 1] unless length_l > 0\n\n # median is the lessor of the two remaining values\n return [right_nums[right_start], left_nums[left_start]].min unless k > 1\n\n\n # preview possible route for left and right median\n new_left_k = left_start + [length_l, k/2].min - 1\n new_right_k = right_start + [length_r, k/2].min - 1\n\n if left_nums[new_left_k] > right_nums[new_right_k]\n find_k(left_nums, left_start, left_end, right_nums, new_right_k + 1, right_end, k - (new_right_k - right_start + 1))\n else\n find_k(left_nums, new_left_k + 1, left_end, right_nums, right_start, right_end, k - (new_left_k - left_start + 1))\n end\n end",
"def getMinimumCost(k, c)\n cost = 0\n c.sort.reverse.each_with_index do |price, idx|\n # (previous purchases + current purchases) * price\n sub_cost = ((idx / k) + 1) * price \n puts \"((#{idx} / #{k}) + 1) * #{price} = #{sub_cost}\"\n cost += sub_cost\n end\n cost\nend",
"def solution(a)\n return 0 if a.length < 3\n\n # Find minimum 2-slice and its index - min_2 = [a, b], idx\n min_2 = a.each_cons(2).each_with_index.reduce do |i, j|\n i[0].sum() <= j[0].sum() ? i : j\n end\n\n # Find minimum 3-slice and its index - min_3 = [a, b], idx\n min_3 = a.each_cons(3).each_with_index.reduce do |i, j|\n i[0].sum() <= j[0].sum() ? i : j\n end\n\n # Integer cross multiply instead of float divide for average\n min_2[0] = min_2[0].sum() * 3\n min_3[0] = min_3[0].sum() * 2\n \n # Return index of smaller slice\n min_2[0] <= min_3[0] ? min_2[1] : min_3[1]\nend",
"def solution(a, b, k)\n first_dividend = a\n remainder = first_dividend%k\n\n while remainder != 0 && first_dividend <= b do\n first_dividend += 1\n remainder = first_dividend%k\n end\n\n remainder == 0 ? (b - first_dividend) / k + 1 : 0\nend",
"def max_slice(a)\n n = a.length\n k1 = Array.new(n, 0)\n k2 = Array.new(n, 0)\n\n (1..(n-1)).each {|i| k1[i] = [k1[i-1] + a[i], 0].max }\n\n i = n - 2\n while i > 0 do\n k2[i] = [k2[i+1]+a[i], 0].max\n i -= 1\n end\n\n max_val = 0\n (1..(n-2)).each do |i|\n max_val = [max_val, k1[i-1] + k2[i + 1]].max\n end\n\n return max_val\nend",
"def find_closest(array, value, k)\n results_hash = {}\n \n array.each do |number|\n if number == value\n next\n else\n difference = (value - number).abs # get absolute value\n results_hash[number] = difference\n end\n end\n \n sorted_results = results_hash.min_by(k) do |number, diff|\n diff\n end\n \n sorted_results.map! do |array|\n array[0]\n end\n \n return sorted_results\nend",
"def solution(a, k)\n # array length is zero or one the array should remain the same\n if(a.length > 1)\n # if k > length we should k%length and get the remainder to be the new k\n if(k > a.length)\n k = k % a.length\n end\n\n b = a[0, a.length - k]\n a = a[a.length - k, a.length]\n a = a + b\n end\n a\nend",
"def knapSack(wt, val, capacity)\n row = wt.length + 1\n col = capacity + 1\n res = Array.new(row) {Array.new(col)}\n \n for i in 0...row\n for w in 0...col\n if i == 0 || w == 0\n res[i][w] = 0\n elsif wt[i - 1] <= w\n temp = val[i - 1] + res[i - 1][w - wt[i - 1]]\n res[i][w] = [temp, res[i - 1][w]].max\n else\n res[i][w] = res[i - 1][w]\n end\n end\n end\n res[i][w]\nend",
"def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend",
"def minimumBribes(q)\n q.each_with_index.inject(0) do |bribes, (actual, index)|\n return bribes if q[index + 1].nil?\n\n index_diff = actual - index - 1\n maximun_distance = actual - 2\n distance = if index_diff <= 0 && maximun_distance >= 0 then\n q[maximun_distance...index].all? { |x| x > actual } ? 1 : 0\n else\n [index_diff, 0].max\n end\n\n debug(actual, distance, index_diff, bribes)\n\n if distance > 2\n return \"Too chaotic\"\n break\n end\n bribes + distance\n end\nend",
"def merge(a, b, tmp, limit: TOP_K_SIZE)\n a.each_with_index{|v, i| tmp[i] = v}\n i = j = k = 0\n while k < limit && (i < tmp.size || j < b.size)\n if j >= b.size || (i < tmp.size && tmp[i] > b[j]) # descending\n a[k] = tmp[i]\n i += 1\n else\n a[k] = b[j]\n j += 1\n end\n k += 1\n end\n end",
"def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end",
"def partition(k)\n less_than_k, k_and_larger = LinkedList.new, LinkedList.new\n previous_node = nil\n while head\n node = shift\n node.data > x ? less_than_k.unshift(node) : k_and_larger.unshift(node)\n previous_node.next = node if previous_node\n previous_node = node\n end\n while k_and_larger.head\n less_than_k.unshift k_and_larger.shift\n end\n return less_than_k\n end",
"def take other\n actually_taken = [ self, other ].min\n return [ actually_taken, other.subtract( take ) ]\n end",
"def max_subarray_sum(nums, k)\n max_sum = -Float::INFINITY\n sum = 0\n start_position = 0\n end_position = 0\n\n while end_position < nums.length # 0 < 6, 1 < 6, 2 < 6, 3 < 6, 4 < 6, 5 < 6\n sum += nums[end_position] # 0 += 2 (2), 2 += 1 (3), 3 += 5 (8), 6 += 1 (7), 6 += 3 (9), 4 += 2 (6)\n if end_position >= (k - 1) # 0 >= 2, 1 >= 2, 2 >= 2, 3 >= 2, 4 >= 3, 5 >= 3\n max_sum = [max_sum, sum].max # [- inf, 8] (8), [8, 7] (8), [8, 9] (9), [9, 6] (9)\n sum -= nums[start_position] # 8 -= 2 (6), 7 -= 1 (6), 9 -= 5 (4), 9 -= 1 (8)\n start_position += 1 # 1, 2, 3, 4\n end\n end_position += 1 # 1, 2, 3, 4, 5, 6\n end\n\n max_sum == -Float::INFINITY ? 0 : max_sum # 9\nend",
"def corgi_golden_age(arr)\n\tmax_subset_sum = 0\n\tmax_i = 0\n\tmax_j = 0\n\tsum = 0\n\ti = 0\n\tj=i+1\n\twhile i < arr.length\n\t\twhile j < arr.length\n\t\t\tsum = arr[i]+arr[j]\n\t\t\tif sum > max_subset_sum\n\t\t\t\tmax_subset_sum = sum\n\t\t\t\tmax_i = i\n\t\t\t\tmax_j = j\n\t\t\tend\n\t\t\tj+=1\n\t\tend\n\t\ti+=1\n\tend\n\treturn [max_i, max_j]\n\nend",
"def k_closest(points, k)\n arr = points.map { |point| [euclidean_distance(point, [0, 0]), point] }.sort\n\n res = []\n k.times { res << arr.delete_at(0)[1] }\n res\nend",
"def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend",
"def kthSmallestInBST(t, k)\n @r = []\n travel(t)\n @r.sort.at(k - 1)\nend",
"def ullman(nums, t, k)\n return false if nums.size < k\n nums.sort[0...k].reduce(:+) < t\nend",
"def getMoneySpent(keyboards, drives, b)\n arrK = keyboards.sort.reverse\n arrD = drives.sort.reverse\n\n return -1 if keyboards.length == 1 && drives.length == 1 && (keyboards.sum + drives.sum) > b\n\n max = 0\n arrK.each do |k|\n arrD.each do |d|\n sum = k + d\n max = sum if sum <= b && sum > max\n end\n end\n\n max\nend",
"def k_closest(points, k)\n points.sort_by!{|p| p[0]*p[0] + p[1]*p[1]}[..k-1]\nend",
"def my_min2(arr)\n answer = arr[0]\n arr.each_with_index do |ele, idx|\n if idx != arr.length - 1\n answer = arr[idx] if answer >= arr[idx]\n end\n end\n answer\nend",
"def smallest_diff_between_sub_arrays(arr)\n # write your code in Ruby 2.2\n first_part = 0\n second_part = 0\n result = 0\n arr.each_with_index do |num, i|\n next if i == arr.length - 1\n\n # you just need to sum the array once\n # indeed the 'second part' of the first split is the biggest one\n # no need to do this calculation again after\n if i.zero?\n first_part = arr[0]\n second_part = arr[1, arr.length - 1].inject(:+)\n result = (first_part - second_part).abs\n else\n # after that you just need to pass over one number from the second to the first part\n # and check if diff is smaller thant current result\n first_part += num\n second_part -= num\n diff = (first_part - second_part).abs\n result = diff if diff < result\n end\n end\n result\nend",
"def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend",
"def best_swap graph\n swap.gain = MIN\n A.each do |a|\n B.each do |b|\n d = a.d + b.d - 2*c(a,b)\n if d > swap.gain\n swap.gain = d\n swap = a,b\n end\n end\n end\n return swap\nend",
"def main\n if (X-B) < 0 # X must larger than B\n p 0\n return\n end\n\n maximium = [(X-B) / A + 1, 1000_000_000].min\n maximium.downto(1).each do |n|\n digit =\n if n >= 1000_000_000\n 10\n elsif n >= 100_000_000\n 9\n elsif n >= 10_000_000\n 8\n elsif n >= 1_000_000\n 7\n elsif n >= 100_000\n 6\n elsif n >= 10_000\n 5\n elsif n >= 1_000\n 4\n elsif n >= 100\n 3\n elsif n >= 10\n 2\n else\n 1\n end\n\n if A * n + B * digit <= X\n p n\n return\n end\n end\n\n p 0\nend",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def sum_of_two_smallest_numbers(arr)\n sum = 0\n\n sum += arr.min\n arr.delete(arr.min)\n\n sum += arr.min\n\n return sum\nend",
"def smallest_difference(array1, array2)\n smallest_diff = nil\n array1.each do |num1|\n array2.each do |num2|\n if smallest_diff\n smallest_diff = (num1-num2).abs if smallest_diff > (num1-num2).abs\n else\n smallest_diff = (num1-num2).abs\n end\n end\n end\n smallest_diff\nend",
"def opt_max_sum(arr)\n result = -1000\n (0...arr.length).each do |start|\n sum = 0\n (1..arr.length).each do |size|\n if start + size > arr.length\n break\n end\n sum += arr[start + size - 1]\n if sum > result\n result = sum\n end\n end\n end\n return result\nend",
"def dp(array)\n ary_size = array.size\n queue = [0]\n for i in 0..(ary_size - 1) do\n if i == 0\n queue << array[i]\n else\n cost_1 = (queue[i - 1] - array[i]).abs\n cost_2 = (queue[i - 2] - array[i]).abs\n queue << [cost_1, cost_2].min\n end\n end\n return queue.last\nend",
"def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend",
"def k_closest(points, k)\n points.sort_by!{|p| p[0]*p[0] + p[1]*p[1]}.first(k)\nend",
"def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end",
"def dist_windows(arr, k)\n result = []\n (0..arr.size - k).each do |i|\n result << dist_nums_helper(arr[i...i + k], k)\n end\n result\nend",
"def apple_stocks(arr)\n\tmax_diff = 0\n\tmin = arr[0]\n\tfor i in 0..arr.length-1\n\t\tif arr[i] < min\n\t\t\tmin = arr[i]\n\t\tend\n\t\tif (arr[i] - min) > max_diff\n\t\t\tmax_diff = (arr[i] - min)\n\t\tend\n\tend\n\tmax_diff\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def pair_sum(array, k)\n pairs = []\n\n (0...array.length - 1).each do |i|\n (i + 1...array.length).each do |j|\n a = array[i]\n b = array[j]\n pairs << [[a, b].min, [a, b].max] if a + b == k\n end\n end\n\n pairs.uniq\nend",
"def my_min(arr)\n arr.inject{|acc, el| el < acc ? acc = el : acc }\nend",
"def solution(a, b, k)\n # write your code in Ruby 2.2\n e = b / k\n s = (a-1) / k\n\n e - s\nend",
"def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend",
"def solution(a)\n ((1..a.size + 1).to_a - a).first\nend",
"def better_contig_subsum(arr)\n max_sum = arr.inject(&:+) # O(n)\n temp_sum = max_sum\n\n loop do # O(n)\n left = temp_sum - arr.first\n right = temp_sum - arr.last\n\n if arr.length == 1\n if arr.first > max_sum\n return arr.first\n else\n return max_sum\n end\n end\n\n if right >= left\n max_sum = right if right >= max_sum\n temp_sum = right\n arr.pop\n else\n max_sum = left if left >= max_sum\n temp_sum = left\n arr.shift\n end\n end\n\n max_sum\nend",
"def max_sub(a)\na[(0...(n=a.size)).inject([]){|r,i|(i...n).inject(r){|r,j|r<<(i..j)}}.sort_by{|r|a[r].inject{|i,j|i+j}}[-1]]\nend",
"def k_diff (array,diff)\n \n array.sort!.reverse! #sort and reverse the array\n \n count,i,j = 0,0,1\n \n while j < array.size\n if array[i] < (array[j]+diff) #go to the next one\n j += 1\n elsif array [i] == (array[j]+diff)\n count += 1; i += 1; j += 1\n else\n i += 1\n end\n end\n return count\nend",
"def bisect(arr, key)\n arr.each_index do |i|\n return i if key < arr[i]\n end\n\n return arr.length\n end",
"def smallest_difference(array_one, array_two)\n array_one.sort!\n array_two.sort!\n \n index_one = 0\n index_two = 0\n\n smallest_difference = Float::INFINITY\n current_diff = Float::INFINITY\n smallest_pair = []\n\n while index_one < array_one.length && index_two < array_two.length\n first_num = array_one[index_one]\n second_num = array_two[index_two]\n\n if first_num < second_num\n current_diff = second_num - first_num\n index_one += 1\n elsif second_num < first_num\n current_diff = first_num - second_num\n index_two += 1\n else\n return [first_num, second_num]\n end\n\n if smallest_difference > current_diff\n smallest_difference = current_diff \n smallest_pair = [first_num, second_num]\n end\n end\n\n return smallest_pair\nend",
"def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend",
"def max_sub_array_len(nums, k)\n sum = 0\n max = 0\n map = {}\n\n nums.each.with_index do |num, ndx|\n sum += num\n if sum == k\n max = ndx + 1\n elsif map.key?(sum - k)\n max = [max, ndx - map[sum - k]].max\n end\n\n map[sum] ||= ndx\n end\n\n max\nend",
"def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend",
"def pair_sum(array, k)\n pairs = Set.new\n nums = Set.new\n\n array.each do |el|\n target = k - el\n if nums.include?(target)\n pairs << (el <= target ? [el, target] : [target, el])\n end\n nums << el\n end\n\n pairs\nend",
"def sliding_maximum(k,array)\n array.each_cons(k).map(&:max)\nend",
"def pair_sum(arr, k)\n hash = {}\n result = []\n i = 0\n while i < arr.length \n hash[arr[i]] = i #keep track of index \n i += 1\n end \n arr.each_with_index do |el, idx|\n diff = k - el \n if hash[diff] && idx < hash[diff]\n if diff < el \n result << [diff, el]\n else \n result << [el, diff]\n end \n end \n end \n result \nend",
"def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend",
"def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend",
"def subarray(arr,num)\n\t#sort the array, use pointers\n\tj = 0\n\ti = 0\n\tsum = 0\n\twhile j < arr.length\n\t\tif sum < num\n\t\t\t#moving up the array if sum is less than number\n\t\t\tsum += arr[j]\n\t\t\tj += 1\n\t\telse\n\t\t\tminLen = [9000, j-i].min\n\t\t\tif i == (j-1)\n\t\t\t\treturn 1\n\t\t\tend\n\t\t\tsum -= arr[i]\n\t\t\ti += 1\n\t\tend\n\t\tputs sum, \"first\"\n\t\tputs minLen, \"minfirst\"\n\t\tputs i,\"i\", j, \"j\"\n\tend\n\t\n\twhile sum >= num\n\t\tminLen = [9000, j-i].min\n\t\ti += 1\n\t\tsum -= arr[i]\n\t\tputs sum, \"second\"\n\t\tputs minLen, \"minsecond\"\n\t\tputs i,\"i\", j, \"j\"\n\tend\n\tif minLen == 9000\n\t\tputs 0\n\telse\n\t\tputs minLen\n\tend\n\nend",
"def find_difference(a, b)\n # use inject to get volume of each array and take absolute of result\n # to account for negative #'s \n (a.inject(:*) - b.inject(:*)).abs\nend",
"def slow_solution(a)\n m = 0\n a.size.times do |i|\n a[i] = a[i].abs\n m = [a[i], m].max\n end\n maxsum = a.sum # sum of absolute val of all nums in array\n # maxsum = a.map(&:abs).sum <- Ruby shortcut\n\n # If dp = 1 at an index, it means some combo of elements in a add up to that index\n dp = [0] * (maxsum + 1)\n dp[0] = 1\n\n a.size.times do |j|\n maxsum.downto(0).each do |possible_sum|\n puts \"a[j]: #{a[j]}, possible sum: #{possible_sum}\"\n if (dp[possible_sum] == 1) and (possible_sum + a[j] <= maxsum)\n\n # if possible_sum + new element a[j] is possible sum, dp = 1!\n dp[possible_sum + a[j]] = 1\n puts \"Mark #{possible_sum + a[j]} as possible sum in dp\"\n end\n end\n puts \"row: #{j}, a[j]: #{a[j]}, dp: #{dp}\"\n puts\n end\n\n min_q_minus_p = maxsum\n\n # Divide array a into 2 parts, where P = sum of part 1 and Q = sum of part 2,\n # P + Q = maxsum, and P <= maxsum / 2 <= Q.\n # We want largest possible P to get smallest possible Q-P.\n\n # loop from 0 to maxsum / 2, covering every possible P, Q division\n (maxsum / 2 + 1).times do |possible_half_sum|\n # puts \"possible_half_sum: #{possible_half_sum}\"\n if dp[possible_half_sum] == 1 # means P or Q = possible_half_sum\n q_minus_p = maxsum - 2 * possible_half_sum\n # puts \"Q - P: #{q_minus_p}\"\n min_q_minus_p = [min_q_minus_p, q_minus_p].min\n # puts \"min Q - P: #{min_q_minus_p}\"\n end\n end\n\n min_q_minus_p\nend",
"def minimumBribes(q)\n sum = 0\n q.each_with_index do |v,i|\n if v-(1+i) > 2\n puts \"Too chaotic\"\n return\n end\n bound = [v-2,0].max\n (bound..i-1).each do |j|\n sum+=1 if q[j] > v\n end\n end\n puts sum\nend",
"def kth_largest(arr, k, left = 0, right = arr.length - 1)\n if k > 0 && k <= right - left + 1\n pivot = partition(arr, left, right)\n if right - pivot == k - 1\n return arr[pivot]\n end\n\n if right - pivot > k - 1\n return kth_largest(arr, k, pivot + 1, right)\n end\n# [1,2,3,4,5]\n# if pivot is arr[2]\n# then k is k - (right - pivot + 1)\n kth_largest(arr, k - right + pivot - 1, left, pivot - 1)\n end\nend",
"def solution(a)\n # we could do radix sort and then loop over all the items in order to find the missing element\n # in the ordered list or use the Gauss theorem: https://study.com/academy/lesson/finding-the-sum-of-consecutive-numbers.html\n #\n # if we use the Gauss theorem we can do:\n # sum = (1 + N+1) * ( N / 2 )\n #\n # if (1 + N+1) % 2 == 1 we need to sum also (n+1+1)/2 + 1\n #\n # then remove every item from the sum: the remainder is the missing number\n len = a.length\n sum = (1 + len + 1) * ((len + 1) / 2)\n sum += ((len + 1) / 2.0).ceil unless (len + 1) % 2 == 0\n\n a.reduce(sum) do |sum, i|\n sum - i\n end\nend",
"def maximum_difference_2(v)\n\n integral_sum = [0]\n max = 0\n for index in (0..v.length-1) do\n integral_sum.push(integral_sum[index] + v[index])\n end\n\n for seq_len_left in (1..v.length-1) do\n for left_side in (0..(v.length-seq_len_left-1)) do\n sum_l = integral_sum[seq_len_left+left_side] - integral_sum[left_side]\n sum_l_abs = sum_l.abs\n for seq_len_right in (1..(v.length-seq_len_left)) do\n for right_side in (left_side+seq_len_left..(v.length-seq_len_right)) do\n sum_r = integral_sum[right_side + seq_len_right] - integral_sum[right_side]\n sum_r_abs = sum_r.abs\n dif = sum_l_abs + sum_r_abs\n if dif > max\n max = dif\n end\n end\n end\n end\n end\n puts \"#{max}\"\nend"
] |
[
"0.64099276",
"0.63714606",
"0.63676614",
"0.63227135",
"0.6063917",
"0.59130305",
"0.5908817",
"0.5861737",
"0.5845204",
"0.57851243",
"0.5775096",
"0.57551897",
"0.573973",
"0.5710654",
"0.56615865",
"0.56445765",
"0.55736977",
"0.5570576",
"0.5569705",
"0.55530894",
"0.5552562",
"0.5543987",
"0.5542347",
"0.5535436",
"0.5513256",
"0.55017424",
"0.5498739",
"0.54718083",
"0.5456122",
"0.544881",
"0.5427288",
"0.5423045",
"0.5377978",
"0.53738445",
"0.53538233",
"0.5325016",
"0.53127724",
"0.5300169",
"0.5295103",
"0.52916276",
"0.5280623",
"0.52708524",
"0.5270569",
"0.5254584",
"0.5244023",
"0.52391547",
"0.52382386",
"0.52369136",
"0.52305776",
"0.5220244",
"0.52154994",
"0.5211875",
"0.5211502",
"0.5208318",
"0.5205069",
"0.51867145",
"0.5176652",
"0.51765",
"0.51759803",
"0.51757014",
"0.5174787",
"0.51727754",
"0.51654875",
"0.5164534",
"0.5157924",
"0.5155578",
"0.5152751",
"0.5140506",
"0.5133054",
"0.5129038",
"0.5125308",
"0.51183254",
"0.51165813",
"0.51109993",
"0.5107239",
"0.5101857",
"0.51008904",
"0.50986296",
"0.50865924",
"0.50858605",
"0.5081648",
"0.50816417",
"0.50767314",
"0.50755686",
"0.5073972",
"0.5071721",
"0.5069101",
"0.5064253",
"0.50427574",
"0.5042314",
"0.5036013",
"0.5032352",
"0.50274897",
"0.5024707",
"0.5019148",
"0.5010218",
"0.500968",
"0.5008205",
"0.50010777",
"0.49966925"
] |
0.5856305
|
8
|
GET /users/1 GET /users/1.json
|
def show
#here session[:mad] is the session variable which holds current logged in user id.
if session[:mad]==nil
redirect_to(:controller => 'logins',:action => 'homelog')
else
@user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\nend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end",
"def list_users\n self.class.get('/users')\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def show\n render :json => User.find(params[:id])\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n json_response(User.all) \n end",
"def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n users = User.all\n render json: users \n end",
"def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end",
"def index\n users = User.all \n render json: users \n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def index\n render :json => User.all, status: 200\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end"
] |
[
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.7225407",
"0.72222257",
"0.72165024",
"0.72137505",
"0.72096044",
"0.71930283",
"0.7182953",
"0.7182144",
"0.7182144",
"0.7180289",
"0.71750754",
"0.7173851",
"0.71640617",
"0.71636444",
"0.71453786",
"0.7145053",
"0.7129776",
"0.71256554",
"0.71160513",
"0.7095665",
"0.70941204",
"0.70772994",
"0.7070785",
"0.7070607",
"0.7063351",
"0.70552826",
"0.7025071",
"0.7014598",
"0.70047677",
"0.6998373",
"0.69910055",
"0.6984177",
"0.6979766",
"0.6972448",
"0.6972228",
"0.6968384",
"0.69666255",
"0.6956339",
"0.69506294",
"0.6945614",
"0.6943135",
"0.69351804",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6932212",
"0.6927094",
"0.69255126",
"0.6925136",
"0.6917375",
"0.6907744",
"0.68947464",
"0.6882589",
"0.6875701",
"0.68749416",
"0.68633634",
"0.6861618",
"0.6858055",
"0.6855495",
"0.68530583",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.685255",
"0.6849599",
"0.6847195",
"0.6847074",
"0.6847074"
] |
0.0
|
-1
|
GET /users/new GET /users/new.json
|
def new
#here, while creating the user, the default user type(utype) is set to zero.
@user = User.new
@user.utype=0
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end",
"def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end",
"def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end",
"def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end"
] |
[
"0.8287397",
"0.8169197",
"0.8155916",
"0.80483407",
"0.8022376",
"0.8021751",
"0.8009459",
"0.7950995",
"0.793078",
"0.793078",
"0.7873476",
"0.7873476",
"0.7873476",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956"
] |
0.0
|
-1
|
POST /users POST /users.json
|
def create
@user = User.new(params[:user])
respond_to do |format|
if @user.save
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render json: @user, status: :created, location: @user }
else
format.html { render action: "new" }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end",
"def create\n user = User.create(user_params) \n render json: user, status: :created\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end",
"def create\n user= User.create(user_params)\n render json: user\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend",
"def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create(options = {})\n request(:post, '/users.json', default_params(options))\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end",
"def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end",
"def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end",
"def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end",
"def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end",
"def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end",
"def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end",
"def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end",
"def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end",
"def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end",
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end",
"def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end",
"def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end",
"def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend",
"def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend",
"def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\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(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\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: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_user(options = {})\n post \"/users\", options\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(body)\n post 'create_user', body\n end",
"def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end",
"def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end",
"def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end",
"def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end",
"def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(attributes)\n post(\"/v1/users\", attributes)\n end",
"def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end",
"def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end",
"def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end",
"def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end",
"def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end",
"def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end",
"def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end"
] |
[
"0.77179813",
"0.75206673",
"0.73831296",
"0.72405374",
"0.719841",
"0.7140812",
"0.71038526",
"0.7058827",
"0.7041636",
"0.70236504",
"0.7003128",
"0.70021695",
"0.70021695",
"0.70021695",
"0.69936967",
"0.6990463",
"0.6980393",
"0.6979075",
"0.69788617",
"0.69788617",
"0.69762856",
"0.6962628",
"0.6952247",
"0.69454783",
"0.69454783",
"0.6920555",
"0.69181055",
"0.691467",
"0.6901315",
"0.6898759",
"0.689459",
"0.6889815",
"0.6880676",
"0.6880467",
"0.6880196",
"0.68797004",
"0.6877297",
"0.686924",
"0.6855058",
"0.6851115",
"0.6844058",
"0.6814104",
"0.6803589",
"0.6777842",
"0.6776859",
"0.67678535",
"0.6757897",
"0.67471397",
"0.6738628",
"0.6734963",
"0.6733872",
"0.6720612",
"0.6711659",
"0.6670256",
"0.66581875",
"0.66573423",
"0.6654514",
"0.6638977",
"0.66325235",
"0.66199607",
"0.6615226",
"0.66148156",
"0.65989614",
"0.65910506",
"0.65792614",
"0.6578957",
"0.6573529",
"0.6573351",
"0.6557221",
"0.6553408",
"0.6551572",
"0.65466446",
"0.6540912",
"0.65399504",
"0.6538697",
"0.6535891",
"0.6533581",
"0.6526114",
"0.65116656",
"0.65072525",
"0.6507116",
"0.6503024",
"0.6490388",
"0.6488653",
"0.64881754",
"0.6473845",
"0.64722794",
"0.64702916",
"0.64702916",
"0.6469406",
"0.64682525",
"0.6462379",
"0.64619774",
"0.646129",
"0.6455196",
"0.645272",
"0.6448271",
"0.6447503",
"0.64468706",
"0.64460355",
"0.6441883"
] |
0.0
|
-1
|
PUT /users/1 PUT /users/1.json
|
def update
# here session[:ad] is the session variable which hols the id of the logged in admin and session[:mad] holds the id of the logged in user.
# an update can be made only when admin is logged in or if the update is being made on the user that is logged in currently.
#this is the functionality of this method.
@user = User.find(params[:id])
if(session[:ad]!=nil || session[:mad].to_i==@user.id)
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to @user, notice: 'User was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
else
flash[:notice]="Cannot update information of other user"
redirect_to(:controller => 'logins',:action => 'homelog')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end",
"def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end",
"def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update_user(user, options = {})\n put \"/users/#{user}\", options\n end",
"def update_user(options)\n patch(\"/user\", options, 3)\n end",
"def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end",
"def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end",
"def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end",
"def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end",
"def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end",
"def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n @user.update(user_params_update)\n json_response(@user)\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end",
"def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update \n @current_user.update(user_params)\n render json: @current_user\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end",
"def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit(id, options={})\n request(:put, \"/users/#{id}.json\", default_params(options))\n end",
"def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end",
"def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user.update(user_params)\n respond_with @user\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end",
"def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n authorize @user\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n\t\tif @user.update(users_params)\n \t\tjson_response(@user, \"User Update Successfully.\")\n \telse\n \t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n \tend\n\tend",
"def update\n @user = current_user\n if @user.update(update_user_params)\n render 'api/v1/users/show'\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end",
"def update!(options: {})\n\t\t\tuser = User.perform_request User.api_url(\"users/#{id}\"), :put, options, true\n\n\t\t\tif user\n\t\t\t\toptions.each do |key, value|\n\t\t\t\t\tself.send(\"#{key}=\", user['data'][\"#{key}\"])\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend",
"def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @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_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\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_user\n @user = User.find(params[:id])\n @user.update(params[:user])\n redirect \"/users/#{@user.id}\"\nend",
"def update\n @api_user = ApiUser.find(params[:id])\n\n if @api_user.update(api_user_params)\n head :no_content\n else\n render json: @api_user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.update(params[:user])\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend",
"def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def api_v11_users_user_name_put_with_http_info(user_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_users_user_name_put ...\"\n end\n \n # verify the required parameter 'user_name' is set\n fail \"Missing the required parameter 'user_name' when calling api_v11_users_user_name_put\" if user_name.nil?\n \n # resource path\n path = \"/api/v11/users/{userName}\".sub('{format}','json').sub('{' + 'userName' + '}', user_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, 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: DefaultApi#api_v11_users_user_name_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_user\n user = current_user\n if user.update(update_params)\n render json: { status: { updated: \"Ok\" } }\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n redirect_to @user\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\nend",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.username} successfully updated!\"\n format.html { redirect_to @user }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n authorize! :update, user\n if user.update_attributes(user_params)\n render :json => {:ok => true, :message => 'successful updated'}, :head => :no_content\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end"
] |
[
"0.74114245",
"0.73920554",
"0.73041475",
"0.7254177",
"0.7202618",
"0.70756376",
"0.70535713",
"0.7029043",
"0.70075685",
"0.69883573",
"0.6983195",
"0.694263",
"0.69409895",
"0.692315",
"0.6909438",
"0.687742",
"0.68486536",
"0.6834162",
"0.6821841",
"0.6801179",
"0.67703044",
"0.6763487",
"0.6761313",
"0.6761313",
"0.67482305",
"0.67473894",
"0.6713073",
"0.6703807",
"0.6693307",
"0.66886777",
"0.66886777",
"0.66646844",
"0.66617274",
"0.66572624",
"0.6653578",
"0.66406506",
"0.6625279",
"0.66213304",
"0.66192704",
"0.6614916",
"0.6612626",
"0.6604333",
"0.65851104",
"0.65851104",
"0.65785134",
"0.65615654",
"0.65518224",
"0.65518224",
"0.6549094",
"0.6530534",
"0.6530534",
"0.65275174",
"0.6523527",
"0.6520384",
"0.6520384",
"0.6516204",
"0.65145653",
"0.65104014",
"0.6504922",
"0.6499594",
"0.64987266",
"0.64906204",
"0.64810187",
"0.64798295",
"0.64702576",
"0.64496434",
"0.6436427",
"0.6433962",
"0.64330167",
"0.6428237",
"0.6406415",
"0.6402615",
"0.6399288",
"0.63881207",
"0.63877773",
"0.6353986",
"0.63537806",
"0.633806",
"0.63360107",
"0.6334851",
"0.632672",
"0.63260114",
"0.63179153",
"0.63173646",
"0.6317282",
"0.6316377",
"0.6316055",
"0.63120025",
"0.6293317",
"0.62857985",
"0.6282219",
"0.6280316",
"0.6264061",
"0.62624925",
"0.625522",
"0.62549126",
"0.62547195",
"0.625327",
"0.625269",
"0.6252329",
"0.6245382"
] |
0.0
|
-1
|
DELETE /users/1 DELETE /users/1.json
|
def destroy
@user = User.find(params[:id])
#here session[:ad] holds the id of the logged in admin. and the user is destroyed only if the logged in user is admin. That is the functionality of this method.
if(session[:ad]!=nil)
@user.destroy
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :ok }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end",
"def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n format.json { head :no_content }\n end",
"def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end",
"def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7245172",
"0.7242216",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177"
] |
0.0
|
-1
|
validate :a_method_used_for_validation_purposes def a_method_used_for_validation_purposes errors[:base] << "This person is invalid because ..." end
|
def a_method_before_add(comment)
puts "================== Something before comment get added! ========================"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_validation_errors(value); 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 validation; end",
"def validation; end",
"def subclass_validations ; true ; end",
"def validate\n # add errors if not validate\n end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def extra_validations\n success\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 raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\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 validate \n errors.add(:email, \"must be valid.\") unless email.include?(\"@\") \n if account.include?(\" \") \n errors.add(:account,\"cannot include spaces.\") \n end \n end",
"def no_toddlers\n if age < 5\n errors.add(:birthday, \"You are too young!\")\n end\nend",
"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 \n \n end",
"def validator; end",
"def validate\n end",
"def validate\n end",
"def validate\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 validate\n fail 'sub class to implement'\n end",
"def validate\n\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n unless params[:name] =~ /\\w+/\n @errors << 'A valid name is required'\n end\n unless params[:email] =~ /\\w+@\\w+\\.\\w+/\n @errors << 'A valid email address is required'\n end\n unless params[:message] =~ /\\w+/\n @errors << 'A message is required'\n end\n #unless simple_captcha_valid?\n # @errors << 'Captcha did not match'\n #end\n @errors.empty?\n end",
"def validate\n super\n if root? && (self.email.to_s.empty? || errors.invalid?(:email)) && self.phone.to_s.empty?\n errors.add(:base, \"Phone number or email address must be provided\".t)\n end\n if self.email\n unless self.organization.worldwide.map(&:site_domain).compact.include?(self.email_domain)\n errors.add(:email, \"not a valid email address at %{org}\".t % {:org => self.organization.root.name})\n end\n end\n 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 super \n end",
"def validate\n errors.add_to_base \"That was tricky! Passangers must be an integer between 1 and 10 inclusive.\\nYou tried:\"+passengersToBoard.to_s if number_of_passangers?\n #errors.add(\"passengers\", \"tried:\"+passengersToBoard.to_s) if number_of_passangers? \n end",
"def invalid; end",
"def validate\n super\n end",
"def validate\n raise NoMethodError, \"must define method 'validate'\"\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 literal_validation; end",
"def literal_validation; end",
"def validate\r\n\r\n 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 user_is_not_following_themselves\r\nerrors.add(:followed_user, \"message\")\r\nend",
"def validate\n errors.add_to_base(\"Missing password\") if password.blank?\n end",
"def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend",
"def errors\n super.tap do |errors|\n errors.add(:'user.email', 'is invalid') if errors[:'user.email'].empty?\n end\n end",
"def base_rule_error?\n !errors.filter(:base?).empty?\n end",
"def add_api_error_to_base\n if self.api_error.present?\n errors[:base] << self.api_error\n end\n end",
"def validate!\n # pass\n end",
"def validate\n @invalid=false\n end",
"def validate\r\n @invalid=false\r\n end",
"def errors\n raise 'Method should implemented in inherit class'\n end",
"def last_name_is_valid\n errors.add(:last_name,'Invalid empty string for last name.') unless last_name_is_valid?\n end",
"def validate(method_name)\n validations << method_name\n end",
"def validations\n [:line_style_names] + super\n end",
"def errors\n validate_or_get_results :errors\n end",
"def validated; end",
"def is_valid; end",
"def contact_errors\n error \"name\"\n error \"age\"\n error \"homepage\"\n end",
"def validate(item)\n __setobj__(item)\n super\n\n item.errors.messages.merge!(errors.messages)\n end",
"def validate\n errors.add_to_base(\"No password set\") if password_hashed.blank?\n end",
"def person_age_validation\n return unless person && pet_kind\n return unless pet_kind.name == 'Andorinha'\n return unless (person.date_of_birth + 18.years) < Date.today\n\n errors[:person] << I18n.t('activerecord.errors.pet.person_age',\n name: person.name,\n pet_kind: pet_kind.name)\n end",
"def validation\n # Rails.logger.debug \"#{self.class}.#{__method__} Default validator is empty\"\n end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def validate\n end",
"def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend",
"def pre_validation\n\n\n end",
"def validate(validator, *args); validation_chain.validate(validator, *args); end",
"def validate(resource)\n raise Error::AbstractMethod.new(method: \"Validators::Base#validate\")\n end",
"def add(attribute, msg)\n @errors[attribute.to_s] = [] if @errors[attribute.to_s].nil?\n @errors[attribute.to_s] << msg\n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def validate_subject\n errors << 'invalid email domain' unless domain_valid?\n end",
"def set_errors\n @errors = []\n\n if self.name == nil || self.name == \"\"\n @errors << \"Name cannot be blank.\"\n end\n if self.username == nil || self.username == \"\"\n @errors << \"Username cannot be blank.\"\n end\n if self.email == nil || self.email == \"\"\n @errors << \"Email cannot be blank.\"\n end\n if self.password == nil || self.password == \"\"\n @errors << \"Password cannot be blank.\"\n end\n if self.budget == nil || self.budget == \"\"\n @errors << \"Budget cannot be blank.\"\n end\n end",
"def add(attribute, msg = @@default_error_messages[:invalid])\n @errors[attribute.to_s] = [] if @errors[attribute.to_s].nil?\n @errors[attribute.to_s] << msg\n end",
"def validate\r\n validate! rescue false\r\n end",
"def errors=(_); end",
"def validated?; end",
"def char_form_error(field)\n case field\n when :supername\n \"!! Must be between 3-25 characters.\" if !@char.errors[:supername].empty?\n when :secret_identity\n \"!! Must be between 3-50 characters.\" if !@char.errors[:secret_identity].empty?\n when :char_type\n \"!! Please choose a character type.\" if !@char.errors[:char_type].empty?\n when :alignment\n \"!! #{@char.errors[:alignment][0]}\" if !@char.errors[:alignment].empty?\n when :hp\n \"!! #{@char.errors[:hp][0]}\" if !@char.errors[:hp].empty?\n when :bio\n \"!! Bio is too long - max length: 400 characters. You have used #{@char.bio.length}/400 characters.\" if !@char.errors[:bio].empty?\n end\n end",
"def your_name_is_not_dumb\n if name.include?(\"dumb\")\n errors.add(:name, \"is dumb\")\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 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 standard_validation_error options= {message: {}}\n options[:error]||= \"Unprocessable entity\"\n status = options.delete(:status)\n error!(options, status || options[:error].parameterize.underscore.to_sym || 422)\n end",
"def first_name_is_valid\n errors.add(:first_name,'Invalid empty string for first name.') unless first_name_is_valid?\n end",
"def errors\n self.class.validator.call self\n end",
"def validations\n {}\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 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 update_errors\n @errors = []\n @errors << 'Expiration date is a required field' unless expiration_date\n @errors << 'Expiration Date is not a valid date' unless expiration_date.is_a? Date\n @errors << 'Card type is a required field' unless card_type\n @errors << 'Card type is not supported' unless check_card_type\n @errors << 'Card number is not valid' unless card_number_valid?\n @errors\n end",
"def validate(options); end",
"def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end"
] |
[
"0.74915016",
"0.7408134",
"0.70487005",
"0.70487005",
"0.70481586",
"0.704153",
"0.6984929",
"0.6984929",
"0.6984929",
"0.6969289",
"0.6969289",
"0.6969289",
"0.6969289",
"0.68569046",
"0.68340254",
"0.6774232",
"0.6774232",
"0.6755191",
"0.66835773",
"0.6657226",
"0.6599348",
"0.6598925",
"0.65941375",
"0.65914285",
"0.65914285",
"0.65914285",
"0.65745705",
"0.65659523",
"0.648877",
"0.6488069",
"0.6488069",
"0.6488069",
"0.64792544",
"0.64714587",
"0.64440435",
"0.6441506",
"0.64391094",
"0.6434776",
"0.6422312",
"0.6407726",
"0.6406618",
"0.6406304",
"0.6406304",
"0.640571",
"0.63761294",
"0.636019",
"0.6344308",
"0.63387257",
"0.63353276",
"0.6315606",
"0.6314306",
"0.63107425",
"0.6287962",
"0.62871486",
"0.628641",
"0.6269215",
"0.6269165",
"0.626776",
"0.6262995",
"0.6254347",
"0.6224325",
"0.621292",
"0.6210378",
"0.6208936",
"0.6204618",
"0.6203822",
"0.61926895",
"0.61926895",
"0.61926895",
"0.61926895",
"0.61926895",
"0.61926895",
"0.61926895",
"0.61926895",
"0.61926895",
"0.61877424",
"0.6182217",
"0.6153208",
"0.61499417",
"0.6145146",
"0.6137591",
"0.6135067",
"0.6131724",
"0.6124483",
"0.6103441",
"0.6103345",
"0.61018556",
"0.6099736",
"0.60942966",
"0.6080995",
"0.60719204",
"0.6069127",
"0.60663927",
"0.6066201",
"0.6063153",
"0.6036018",
"0.603392",
"0.602618",
"0.6023643",
"0.60162354",
"0.60109985"
] |
0.0
|
-1
|
Pass a value, and a boolean flag to convert it
|
def check_bool
@output = bool_safe(bool)
render :plain => "#{bool.inspect} #{@output.inspect}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _convert_value(val)\n v = case val\n when :nil then nil\n when :false then false\n when :true then true\n else\n val\n end\n v\n end",
"def typecast_value_boolean(opts={});true;end",
"def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/i\n false\n else\n blank_object?(value) ? nil : true\n end\n end",
"def value_to_boolean(value)\n return value if value==true || value==false\n case value.to_s.downcase\n when \"true\", \"t\", \"1\" then true\n else false\n end\n end",
"def munge_boolean(value)\n case value\n when true, 'true', :true\n 'true'\n when false, 'false', :false\n 'false'\n else\n raise \"Invalid value for munge_boolean #{value}\"\n end\n end",
"def to_boolean(value)\n case value\n when :true, 'true'\n true\n else\n false\n end\n end",
"def convert(value)\n case value.to_s\n when /^(yes|y|t(rue)?|1)$/i\n return true\n when /^(no|n|f(alse)?|0)$/i\n return false\n else\n fail TypeError, \"Expected boolean type, got #{value}\"\n end\n end",
"def boolify(val)\n\nend",
"def to_bool(value)\n value.to_s.downcase == 'true' ? true : false\n end",
"def convert_opt_in_to_true_false (opt_in_value_num)\n if opt_in_value_num == 0\n opt_in_boolean = false\n elsif opt_in_value_num == 1\n opt_in_boolean = true\n end\n end",
"def convert_opt_in_to_true_false (opt_in_value_num)\n if opt_in_value_num == 0\n opt_in_boolean = false\n elsif opt_in_value_num == 1\n opt_in_boolean = true\n end\n end",
"def value=(value)\n value = (value == \"false\" || value == false) ? false : true\n super value\n end",
"def boolean\n Util.from_bytes :boolean, value\n end",
"def check_value(value)\n case value\n when 'true'\n true\n when 'false'\n false\n else\n value\n end\n end",
"def convert_to_boolean(value)\n if value == \"yes\"\n true\n else\n false\n end\nend",
"def convert_rule_flag(value)\r\n if value == 'ignore'\r\n return value\r\n end\r\n if value == 'IGNORE'\r\n return value\r\n end\r\n return (value) ? false : true\r\n end",
"def value_to_boolean(value)\n value = get_param(value) if value.is_a?(Symbol)\n ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)\n end",
"def convert_booleans(value)\n if [\"true\", \"false\"].include?(value)\n value = (value == \"true\")\n else\n value\n end\n end",
"def boolean(value)\n value ? true : false\n end",
"def to_cli_boolean(value)\n case value\n when true\n :true\n else\n :false\n end\n end",
"def value_if_true=(value)\n @value_if_true = value\n end",
"def format_value_to_boolean(value)\n value.to_s\n end",
"def convert_to_boolean(value)\n value != 'no'\n end",
"def get_boolean value #:nodoc:\n # some exceptions\n value = false if value == :low or value == 0 or value == nil or value == :off or value == :ground or value == :gnd\n !! value # double invert value in to boolean form\n end",
"def convert(value)\n case value\n when Symbol, '' # can't intern an empty string\n value\n when String\n value.intern\n when true\n :true\n when false\n :false\n else\n value.to_s.intern\n end\n end",
"def convert(value)\n case value\n when Symbol, '' # can't intern an empty string\n value\n when String\n value.intern\n when true\n :true\n when false\n :false\n else\n value.to_s.intern\n end\n end",
"def convert_string_to_bool(value)\n case value\n when \"true\"\n true\n when \"false\"\n false\n when Array\n value.map { |elem| convert_string_to_bool(elem) }\n when Hash\n value.each do |key, elem|\n value[key] = convert_string_to_bool(elem)\n end\n value\n else\n value\n end\n end",
"def to_boolean(value)\n [\"true\", \"1\", \"yes\"].include?(value.to_s) ? true : false\n end",
"def set(value)\n super(value == :true)\n end",
"def config_to_value(v)\n case v\n when 'true'\n true\n when 'false'\n false\n else\n v\n end\n end",
"def to_boolean(value)\n [\"true\", \"1\", \"yes\"].include?(value.to_s) ? true : false\n end",
"def value_or_false(value)\n if value\n if value == \"false\"\n return false\n else\n return value.to_s\n end\n else\n return false\n end\n end",
"def cast_value(val)\n raise ArgumentError.new(\"Your value is not a String! (it's a #{val.class})\") if val.class != String && val.class != TrueClass && val.class != FalseClass\n \n if (Float val rescue false)\n Float val\n elsif (Integer val rescue false)\n Integer val\n elsif val =~ /^true$/i || val == true\n true\n elsif val =~ /^false$/i || val == false\n false\n else\n val\n end\n end",
"def value_if_false=(value)\n @value_if_false = value\n end",
"def value\n return @value unless @value.nil?\n @value = value_dec == :bool_value_true\n @value\n end",
"def with_convert_smallint_to_bool(v)\n clone(:convert_smallint_to_bool=>v)\n end",
"def boolean_int!(value)\n value.to_i\n end",
"def coerce(value)\n if !value.nil? and !option.allowed_format.nil?\n case option.allowed_format\n when 'fixnum'\n value = value.to_i\n when 'float'\n value = value.to_f\n when 'boolean'\n value = true if (value == 'true' or value == 't')\n value = false if (value == 'false' or value == 'f')\n end\n end\n\n return value\n end",
"def to_enable(value)\n value == :true ? 'Yes' : 'No'\n end",
"def bool(val)\n raise ArgumentError, \"bool() requires a boolean argument\" \\\n unless val == true || val == false\n\n self.int32(val ? 1 : 0)\n end",
"def typecast_to_trueclass(value)\n if value.kind_of?(Integer)\n return true if value == 1\n return false if value == 0\n elsif value.respond_to?(:to_s)\n return true if %w[ true 1 t ].include?(value.to_s.downcase)\n return false if %w[ false 0 f ].include?(value.to_s.downcase)\n end\n nil\n end",
"def coerce_bool(value)\n case value\n when nil, false then false\n when Numeric then !value.zero?\n else\n true\n end\n end",
"def value_to_boolean(value)\n if value.is_a?(String) && value.blank?\n nil\n else\n TRUE_VALUES.include?(value)\n end\n end",
"def format_value v\n case v\n when String\n v.inspect\n when TrueClass\n 'true'\n when FalseClass\n 'false'\n else\n v.to_s\n end\n end",
"def xml_value(value)\n if value == true\n 1\n elsif value == false\n 0\n else\n value\n end.to_s\n end",
"def convert_value(val)\n case basic_type\n when nil\n val\n when /^str/i\n (val.nil? or val.empty?) ? nil : val\n when /^bool/i\n if val.is_a?(TrueClass) or val.is_a?(FalseClass)\n val\n elsif val.is_a?(String)\n !!(['1', 't', 'T'].include?(val))\n elsif val.is_a?(Numeric)\n !!val.nonzero?\n else\n val\n end\n when /^int/i\n val.to_i\n else\n val\n end\n end",
"def to_boolean(val)\n val && (val.to_s.match(/(true|t|yes|y|1)$/i) != nil)\n end",
"def value_to_boolean(value)\n if value.is_a?(String) && value.empty?\n nil\n else\n TRUE_VALUES.include?(value)\n end\n end",
"def transform_property_value(value)\n case value\n when /^0/\n # when it is a zero leading value like \"0777\" don't turn\n # it into a number (this is a mode flag)\n value\n when /^\\d+$/\n value.to_i\n when /(^(\\d+)(\\.)?(\\d+)?)|(^(\\d+)?(\\.)(\\d+))/\n value.to_f\n when /true/i\n true\n when /false/i\n false\n else\n value\n end\n end",
"def bool_conv(value)\n value == HEX_FALSE ? false : true\n end",
"def transform_property_value(value)\n case value\n when /^0/\n # when it is a zero leading value like \"0777\" don't turn\n # it into a number (this is a mode flag)\n value\n when /^\\d+$/\n value.to_i\n when /(^(\\d+)(\\.)?(\\d+)?)|(^(\\d+)?(\\.)(\\d+))/\n value.to_f\n when /true/i\n true\n when /false/i\n false\n else\n value\n end\n end",
"def bool_value(value)\n value = @filters[value] if value.is_a? Symbol\n ActiveRecord::Type::Boolean.new.cast(value)\n end",
"def convert_tinyint_to_bool=(v)\n @conversion_procs[1] = v ? TYPE_TRANSLATOR_BOOLEAN : TYPE_TRANSLATOR_INTEGER\n @convert_tinyint_to_bool = v\n end",
"def convert_literals(value)\n if value == \"#nil\"\n return nil\n elsif value == \"#true\"\n return true\n elsif value == \"#false\"\n return false\n else\n return value\n end\n end",
"def object_to_boolean(value)\n return [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value)\n end",
"def convert_optional_bool value\n return nil if value.nil?\n\n Google::Protobuf::BoolValue.new value: value\n end",
"def convert_boolean(key)\n @params[key] = _boolinze(@params[key]) if _is_bool?(get_default(key))\n end",
"def coerce_booleans(val)\n return 1 if [true, \"TRUE\", \"1\", \"true\", \"YES\", \"yes\"].include?(val)\n return 0 if [false, \"FALSE\", \"0\", \"false\", \"NO\", \"no\"].include?(val)\n\n val\n end",
"def cast_to_boolean(input)\n ActiveRecord::Type::Boolean.new.type_cast_from_user(input)\n end",
"def to_true_string(value)\n DS::Number.is_i?(value) && value.to_i == 1 ? 'true' : nil\n end",
"def bool(val)\n case val.to_s.downcase\n when 'y', 'yes', 'on', 't', 'true'\n true\n when 'n', 'no', 'off', 'f', 'false'\n false\n else\n nil\n end\nend",
"def post_process_boolean( val )\n\t\t\treturn TRUE_VALUES.include?( val.to_s.downcase )\n\t\tend",
"def convert(value) value end",
"def to_bool(value)\n ActiveModel::Type::Boolean.new.cast(value.to_s.strip)\n end",
"def to_bool\n if (self.to_bool == 1)\n puts \"TRUE\"\n elsif (self.to_bool == 0)\n puts \"FALSE\"\n elsif (self.to_bool == -1)\n puts \"NaN\"\n end\nend",
"def deserialize val\r\n case val.to_s\r\n when 'true': return true\r\n when 'false': return false\r\n end\r\n val =~ /^\\d+$/ ? val.to_i : val\r\n end",
"def bool_to_string(value)\n return 'yes' if value == true\n return 'no' if value == false\n value # if it doesn't match anything\n end",
"def to_b(value)\n [0,false,nil].include?(value) ? false : true\n end",
"def value?\n return !self.flag?\n end",
"def convert_to_boolean(variable)\n\tif variable == \"y\"\n\t\tvariable = TRUE\n\telsif variable == \"n\"\n\t\tvariable = FALSE\n\tend\nend",
"def parse_bool() true end",
"def api_boolean(value)\n {\n \"0\" => false,\n \"false\" => false,\n \"no\" => false,\n \"1\" => true,\n \"true\" => true,\n \"yes\" => true\n }[value.try(:downcase)]\n end",
"def true?\n self.value == '1'\n end",
"def normalize(value)\n return \"1\" if value.class == TrueClass\n return \"0\" if value.class == FalseClass\n return value\n end",
"def to_bool(value)\n ! FALSE_VALUES.include?(value)\n end",
"def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end",
"def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end",
"def typecast(value)\n case value\n when %r{\\Atrue\\z}i then true\n when %r{\\Afalse\\z}i then false\n when %r{\\A\\s*\\z}i then nil\n else\n begin\n begin\n Integer(value)\n rescue StandardError\n Float(value)\n end\n rescue StandardError\n unescape_value(value)\n end\n end\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def convert_to_boolean(val)\n return val if val.is_a?(TrueClass) || val.is_a?(FalseClass)\n val = val.to_s.clean\n return nil if val.blank?\n if val.match?(/\\A(false|f|n|no)\\z/i)\n false\n elsif val.match?(/\\A(true|t|y|yes)\\z/i)\n true\n end\n end",
"def convert_value(value)\n value\n end",
"def convert_to_type(value)\n if true_boolean?(value)\n return true\n elsif false_boolean?(value)\n return false\n elsif float?(value)\n converted_value = Float(value)\n elsif number?(value)\n converted_value = Integer(value)\n elsif path?(value)\n converted_value = value.strip\n elsif string?(value)\n converted_value = value.delete(\"\\\"\").strip\n elsif array?(value)\n vals = value.split(\",\")\n converted_value = vals.map { |v| v.delete(\"\\\"\").strip }\n elsif empty_setting?(value)\n fail INI::InvalidSetting, \"Invalid or blank setting value \\\n in config file: #{value}\"\n else\n converted_value = value.strip\n end\n converted_value\n end",
"def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end",
"def boolString(value)\n if value == \"0\"\n return \"false\"\n else\n return \"true\"\n end\n end",
"def set_boolean!(value)\n @objects = nil\n @memory = nil\n\n self[:type] = :boolean\n self[:values][:boolean] = if value\n 1\n else\n 0\n end\n end",
"def parse_boolean_value(value)\n value.to_s.downcase == 'true'\n end",
"def cast(value, type)\n return if value.nil?\n\n case type\n when :path then Mwc.root.join(value)\n when :bool then value == true\n else value\n end\n end",
"def value?(value) true end",
"def get_boolean_value\n\t\tend",
"def to_bool() true end",
"def coerce_boolean(value, options = {})\n value = value =~ options[:pattern] if options.has_key?(:pattern)\n !!value\n end",
"def parse_bool() false end",
"def parse_bool() false end",
"def has_value?(value)\n super(convert_value(value))\n end",
"def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end",
"def is_value?\n true\n end",
"def convert_value\n # Do nothing if value has not changed\n return true unless value_changed?\n # Cast the value and return success\n return parse_string_value(@uncast_value) if @uncast_value.is_a? String\n # Convert the value to yaml otherwise\n v = @uncast_value.to_yaml unless @uncast_value.nil?\n self[:value] = v\n end",
"def flags=(val)\n @val = val\n end",
"def write_bool(*b); end",
"def value?(value); end",
"def value?(value); end"
] |
[
"0.76891327",
"0.7603148",
"0.7395087",
"0.7267215",
"0.7242795",
"0.7169323",
"0.71594125",
"0.7080612",
"0.70476913",
"0.70445126",
"0.70445126",
"0.69600624",
"0.6936285",
"0.6900871",
"0.68703413",
"0.68611324",
"0.6836495",
"0.67875594",
"0.6785985",
"0.6783603",
"0.6763382",
"0.6758904",
"0.67573684",
"0.674207",
"0.67384297",
"0.67384297",
"0.67289555",
"0.6715719",
"0.6708831",
"0.67011946",
"0.6669444",
"0.66672385",
"0.6634374",
"0.66256833",
"0.6623108",
"0.6597176",
"0.6592323",
"0.65894806",
"0.65877414",
"0.65721166",
"0.65710706",
"0.65655667",
"0.6530417",
"0.6527653",
"0.6512072",
"0.6482944",
"0.6480439",
"0.64751613",
"0.64718163",
"0.64706033",
"0.6464055",
"0.6452207",
"0.6442341",
"0.6439574",
"0.6427213",
"0.64220905",
"0.64216024",
"0.6418802",
"0.64139664",
"0.64067554",
"0.6404363",
"0.6400232",
"0.6380881",
"0.63776296",
"0.6360123",
"0.63559073",
"0.6355119",
"0.635285",
"0.6346765",
"0.6324384",
"0.6301405",
"0.628742",
"0.62867343",
"0.6285998",
"0.62833333",
"0.627305",
"0.627305",
"0.6271243",
"0.6270892",
"0.6262902",
"0.62538135",
"0.62504005",
"0.62430954",
"0.62401474",
"0.6236362",
"0.6224758",
"0.62203413",
"0.6218136",
"0.6186911",
"0.6183722",
"0.6170504",
"0.6158352",
"0.6158352",
"0.6148469",
"0.6125885",
"0.6112347",
"0.61082166",
"0.61032677",
"0.61015004",
"0.60961515",
"0.60961515"
] |
0.0
|
-1
|
check to see if a character exists in a string. /put_character_here/ =~ operator or .match method matches the character in the string "string" =~ /character_here/ /character_here/.match("string") boolean_regex.rb
|
def has_a_b?(string)
if string =~ /b/
puts "We have a match!"
else
puts "No match here."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string_contains_reg_exp?(char_string, reg_exp)\n (char_string =~ reg_exp).nil?\nend",
"def has_special_ch?(str)\n (str =~ @@regex)?true:false\n end",
"def contains?(char)\r\n any_letter_found = false\r\n each do |letter|\r\n if char.upcase == letter.content\r\n letter.state = :found\r\n any_letter_found = true\r\n end\r\n end\r\n any_letter_found\r\n end",
"def letter?(char)\n char[/[a-zA-Z]/] == char\nend",
"def contains_char(string, char)\n i = 0\n while i < string.length\n if string[i] == char\n return true\n end\n i += 1\n end\n return false\nend",
"def check_a_string_for_special_characters(string)\n\t# match() is used to check if there is any match as in the regexp. /\\W/ means non word characters.\n\tstring.chars.select {|char| char.match(/\\W/) }.any?\nend",
"def contains_char(str, char)\n i = 0\n while i < str.length\n if str[i] == char\n return true\n end\n\n i += 1\n end\n\n return false\nend",
"def is_string_contains_another_string?(char_string, char_set)\n (char_string.sub(char_set, '**').index('**') ? true : false) if(valid_strings?(char_string, char_set))\nend",
"def letter?(s)\n\ts =~ /[A-Za-z]/\nend",
"def const_check(character)\n (character =~ /['bcdfghjklmnpqrstvwxyz']/) != nil\nend",
"def has_a_b?(string)\r\n if /b/.match(string) # =~ with /char/ you are looking for or .match is regex\r\n puts \"We have a match!\"\r\n else\r\n puts \"No match here.\"\r\n end\r\nend",
"def is_letter?(character)\n character =~ /[[:alpha:]]/ ? true : false\nend",
"def has_letter(c, word)\n word.each_char do |i|\n if i == c\n return true\n end\n end\n false\nend",
"def all_letters? str\r\n str[/[a-zA-z]+/] == str\r\nend",
"def letter?(string)\n string =~ /[A-Za-z]/\n end",
"def check_a_string_for_special_characters(string)\n true_or_false = false\n # collect all non-special characters\n chars = []\n chars = ('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a + (0..9).to_a + [\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n chars << \" \"\n # check each part of string to see if any special characters\n string.split(\"\").each {|character|\n if !chars.include?(character)\n true_or_false = true\n else\n next\n end\n }\n true_or_false\nend",
"def word_char?(char)\n char =~ /\\w+/\n end",
"def check_a_string_for_special_characters(string)\n string.include?('@') ||\n string.include?('!') ||\n string.include?('£') ||\n string.include?('$') ||\n string.include?('%')\nend",
"def check_a_string_for_special_characters(string)\n string =~ /\\W/\nend",
"def check_a_string_for_special_characters(string)\n string.scan(/\\W+/).length > 0\nend",
"def letter_match?(letter)\n if @secret.include?(letter)\n return true; end\n return false\n end",
"def match?(str)\n !!(str =~ @regex)\n end",
"def match?(str)\n !!(str =~ @regex)\n end",
"def valid_string?(string)\n if string.match(/[a-z]/).present? || string.match(/[0-9]/).present?\n @valid = false\n return \"No pongas otro caracter que no sean llaves, corchetes o parentesis\"\n else\n #assume validity\n @valid = true\n #empty array will be populated inside the loop\n @open_characters = []\n #set up a hash to translate the open character to a closing character\n translate_open_closed = {\"{\" => \"}\",\"[\"=>\"]\",\"(\"=>\")\"}\n #create an array from the string loop through each item \n string.split('').each do |e| \n #adding it to the open_characters array if it is an opening character\n @open_characters << e if e=~ /[\\[\\{\\(]/\n #if it is a closing character then translate the last open_character to \n #a closing character and compare them to make sure characters are closed in order\n #the result of this comparison is applied to the valid variable\n @valid &= e == translate_open_closed[@open_characters.pop] if e=~ /[\\]\\}\\)]/\n end\n #return validity and make sure all open characters have been matched\n @valid &= @open_characters.empty?\n return @valid\n end \n end",
"def ismatch(string)\n (string =~ @pattern) ? true : false\n end",
"def match? re, str\n re.match(str) != nil\n end",
"def letter?(letter)\n letter =~ /[[:alpha:]]/\n end",
"def contains_special(string)\n if (string.include?('!') || string.include?('#') || string.include?('$'))\n true\n else\n false\n end\nend",
"def contains_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n true\n else\n false\n end\nend",
"def letter_in_word?(letter)\n end",
"def is? str\n !!match(str)\n end",
"def is_all_this_letter?(word, character)\n a = is_all_as?(word)\n\n end",
"def match?(regexp, string, pos = 0)\n !!regexp.match(string, pos)\n end",
"def contains_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n true\n else\n false\n end\nend",
"def letter?(lookAhead)\n if lookAhead =~ /[[:alpha:]]/\n return true\n else\n return false\n end\nend",
"def valid?(string)\n r = Regexp.new(@matcher)\n \n !(string =~ r).nil?\n end",
"def contains_char(s1, s2)\n i = 0\n output = false\n while i < s1.length\n if s1[i] == s2\n output = true\n end\n i += 1\n end\n return output\nend",
"def is_match(s, p)\n # . matches a single character\n # * matches any number of the preceding character including 0\n # match to the entire string\n\n # s can be empty, only lowercase\n # p can be empty, only lowercase, plus . and *\n\n return false if p[0] == '*'\n return false if p.length == 0\n\n left_i = 0\n left_j = 0\n\n i = p.length - 1\n j = s.length - 1\n\n while i >= 0\n run = false\n letter = p[i]\n\n if letter == '*'\n i -= 1\n letter = p[i]\n run = true\n end\n\n if run\n while (s[j] == letter || letter == '.') && j >= 0\n j -= 1\n end\n else\n return false if j == -1\n return false unless s[j] == letter || letter == '.'\n j -= 1\n end\n\n i -= 1\n end\n\n j == -1\n\nend",
"def test_match_any_character\n assert(@str =~ /s/)\n end",
"def is_letter?(l)\n return l.match?(/[A-Za-z]/)\nend",
"def SimpleSymbols(str)\n letters = str.scan(/[a-z]/)\n str.scan(/\\+[a-z]\\+/).count == letters.size ? true : false\nend",
"def starts_with_consonant?(s)\r\n !!(s[0] =~ /[bcdfghjklmnprstvwxyz]+/i)\r\nend",
"def vowel? (char)\n 'aeiou'.include? (char) \nend",
"def apply?(str)\n !!(regexp.match(str))\n end",
"def vowel_check(character)\n (character =~ /['aeiou']/) != nil\nend",
"def SimpleSymbols(str)\n\n # code goes here\n possible = str.scan(/.?[a-z]./)\n matches = str.scan(/\\+[a-z]\\+/)\n if possible == matches\n true\n else\n false \n end\nend",
"def Starts_whit(string1,character)\n return string1[0] == character\nend",
"def letter(input)\n\t(/[a-zA-Z]{2,}(\\,)\\s?[A-Z]{2}(\\s)([0-9]{5}|[0-9]{5}(\\-)?[0-9]{4}|[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}(\\s|\\-)?[0-9]{1}[a-zA-Z]{1}[0-9]{1})}/i =~ input)? \"true\" : \"false\"\nend",
"def custom?\n @chars[@index] == CUSTOM_ESCAPE &&\n (next_char = @chars[@index+1]) &&\n next_char == next_char.upcase &&\n next_char != SPACE\n end",
"def validate_string(string)\n stack = []\n lookup = { '(' => ')', '[' => ']', '{' => '}', '<' => '>' }\n left = lookup.keys\n right = lookup.values\n\n string.each_char do |char|\n if left.include? char\n stack << char\n elsif right.include? char\n return false if stack.empty? || (lookup[stack.pop] != char)\n end\n end\n\n return stack.empty?\nend",
"def check_string( str )\r\n result = false\r\n return result unless validate_string(str)\r\n\r\n if str.include?( self.pattern )\r\n result = true\r\n end\r\n return result\r\n end",
"def starts_with_consonant?(s)\n # YOUR CODE HERE\n /^[b-df-hj-np-tv-z]/i.match(s) != nil\nend",
"def containsSpecial(password)\n if password.include?(\"!\") || password.include?(\"$\") || password.include?(\"#\")\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def only_vowels?(str)\n str.chars.all? { |char| char.match(/[aeiou]/) }\n # vowel = 'aeiou'\n # str.chars.all? {|char| vowel.include?(char)}\nend",
"def word_has?(letter)\n @word.include? letter\n end",
"def does_not_contain_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n false\n else\n true\n end\nend",
"def has_characters?(*args)\n characters = args.select { |_| not _.is_a? Symbol }.join('')\n if characters.empty?\n return false\n end\n true\n end",
"def valid_letter?(input)\n input.length == 1 && input.match?(/^[[:alpha:]]+$/)\n end",
"def starts_with_consonant?(s)\n consonant = /^[^aeiou\\d\\W_]/i\n return true if consonant.match(s)\nend",
"def bool_match (regexp, str)\n !(regexp =~ str).nil?\nend",
"def han?(str)\n str =~ /\\p{Han}/\nend",
"def valid?\n @chars.all? { |c| c.ord >= A && c.ord <= Z }\n end",
"def char_valid?(char, guesses, target)\n\n if target == '_'\n return !guesses.include?(char)\n end\n\n char == target\n end",
"def starts_with_a_vowel?(word)\n word.scan(/\\b[aeiou]/i) == true\nend",
"def isLetter(c) \n /[A-Za-z]/ =~ c\n #return ((?a <= c and c <= ?z) or (?A <= c and c <= ?Z))\n end",
"def matches?(input)\n !!(regexp =~ input)\n end",
"def starts_with_a_vowel?(word)\nword.match? (/\\b[aeiou]/i)\n end",
"def starts_with_consonant? s\n !!(s[0] =~ /[bcdfghjklmnpqrstvwxyz]+/i)\nend",
"def starts_with_consonant?(s)\n !!(s =~ /^[A-Z&&[^AEIOU]]/i)\nend",
"def does_not_contain_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n false\n else\n true\n end\nend",
"def is_wildcard_char? str\n self.class.is_wildcard_char? str\n end",
"def character_valid?(character)\n Amiiboproject::Amiibo.all.any? {|amiibo| amiibo.character.downcase == character}\n end",
"def starts_with_consonant?(s)\n first_symbol = s[0]\n return false if first_symbol.nil?\n\n if %w(a e i o u A E I O U).include? first_symbol\n false # vowels\n elsif ('a'..'z').include? first_symbol.downcase\n true #consolants\n else\n false #nonletters\n end\nend",
"def is_alpha(char)\n char.match?(/[a-zA-Z]/)\n end",
"def regex\n\t@string = \"the quick brown fox jumped over the lazy dog\"\n\tputs \"lets see if you can guess a word in the sentence\"\n\t@x = gets.chomp\n\n\n\t@t = @string =~ /#{@x}/i ? \"Exists\" : \"Doesn't exist\"\n \t\t puts @t\n\n\tif @t == \"Doesn't exist\"\n\t\tregex\n\telsif @t == \"Exists\"\n\t\tputs \"would you like to keep playing?(yes/no)\"\n\t\ty = gets.chomp.to_s.downcase\n\t\tif y == \"yes\"\n\t\t\tregex\n\t\telse\n\t\texit\n\t\tend \n\tend\nend",
"def starts_with_consonant?(s)\n regex = /^[AEIOU]/i\n regex2 = /^[BCDFGHJKLMNPQRSTVWXYZ]/i\n (s =~ regex2) != nil\n # regex2 = /^[BCDFGHJKLMNPQRSTVWXYZ]/i\n # if regex2.match(s) == nil\n # \tfalse\n # else true\n # end\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def match_in_string?(string, regex)\n string.match(regex).class == MatchData\nend",
"def word_has?(letter)\n @word.include?(letter)\n end",
"def letter?(lookAhead)\n lookAhead =~ /[A-Za-z]/\n end",
"def word_has?(letter)\r\n @word.include?(letter)\r\n end",
"def has_a_b?(string)\n if string =~ /b/\n puts \"MATCH!\"\n else\n puts \"No Match here!\"\n end\nend",
"def has_a_b?(word)\n if /b/.match(word)\n puts 'We have a match'\n else\n puts 'No match here...'\n end\nend",
"def is_letter?(letter)\r\n (Alphabet.include? letter.downcase) && (letter.length == 1)\r\n end",
"def starts_with_consonant?(s)\n s.match(/^[b-z&&[^eiou]]/i) != nil\nend",
"def regular_char?(int)\n int = int.ord\n if ((int > 96) & (int < 123)) | # lower case letters\n ((int > 64) & (int < 91)) | # capital letters\n ((int > 47) & (int < 58)) | # numbers\n (int == 32) | (int == 40) | # space and (\n (int == 41) | (int == 46) | # ) and .\n (int == 39) | (int == 33) | # ' and !\n (int == 44) | (int == 63) | # , and ?\n (int == 59) | (int == 58) # ; and :\n return true\n end\n return false\nend",
"def starts_with_consonant? s\n !!(s[0] =~ /[bcdfghjklmnprstvwxyz]+/i)\nend",
"def starts_with_consonant? s\n !!(s[0] =~ /[bcdfghjklmnprstvwxyz]+/i)\nend",
"def string_check(elem)\n (('a'..'z').to_a + ('A'..'Z').to_a).each { |k| return true if elem.include?(k) }\n false\n end",
"def is_vowel character\n character.is_a?(String) && !!character.match(/[aeiou]/i)\nend"
] |
[
"0.8013797",
"0.7780736",
"0.7591087",
"0.7517885",
"0.74107563",
"0.73752326",
"0.73617053",
"0.7229862",
"0.72144413",
"0.7200005",
"0.71541405",
"0.7153099",
"0.7136904",
"0.71316314",
"0.71103823",
"0.7051643",
"0.7013593",
"0.7000807",
"0.69556653",
"0.68760824",
"0.68540037",
"0.6853018",
"0.6853018",
"0.6789023",
"0.6766855",
"0.6749068",
"0.67391014",
"0.6726308",
"0.671458",
"0.67132914",
"0.6693256",
"0.66869736",
"0.6652899",
"0.66494787",
"0.664832",
"0.6643868",
"0.6637977",
"0.6624999",
"0.66147125",
"0.656909",
"0.6559329",
"0.6545866",
"0.6536894",
"0.6534776",
"0.65231425",
"0.6505527",
"0.6486569",
"0.64680487",
"0.64448106",
"0.6444133",
"0.6436634",
"0.64092857",
"0.64078385",
"0.64039403",
"0.64035344",
"0.6402025",
"0.639592",
"0.6393436",
"0.6387387",
"0.63871115",
"0.6379897",
"0.63788015",
"0.63744915",
"0.6366782",
"0.6364564",
"0.63625115",
"0.63589585",
"0.6351586",
"0.6347575",
"0.63450027",
"0.63438267",
"0.6342273",
"0.6337967",
"0.6336738",
"0.63213336",
"0.63177586",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6316041",
"0.6313157",
"0.6309577",
"0.630804",
"0.63052917",
"0.63023347",
"0.6293227",
"0.6288101",
"0.6281202",
"0.6278039",
"0.6278039",
"0.62682796",
"0.62675804"
] |
0.0
|
-1
|
Methods Exercise 9: Print Me (Part 1) Write a method named print_me that prints "I'm printing within the method!" when invoked.
|
def print_me
puts "I'm printing within the method!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_me()\n \"I'm printing within the method!\"\nend",
"def print_me\n puts \"I'm printing within the method!\"\nend",
"def print_me\n puts \"I'm printing within the method!\"\nend",
"def print_me\n puts \"I'm printing within the method!\"\nend",
"def print_me\n puts \"I'm printing within the method!\"\nend",
"def print_me\n puts \"I'm printing within the method!\"\nend",
"def print_me\n puts \"I'm printing within the method!\"\nend",
"def print_me\n puts \"I'm printing within the method!\"\nend",
"def print_me\n \"I'm printing within the method!\"\nend",
"def print_me\n puts \"I'm printing within the method!!!\"\nend",
"def print_method(*) end",
"def print_me\n \"I'm printing the return value!\"\nend",
"def print_me\n \"I'm printing the return value!\"\nend",
"def print_me\n \"I'm printing the return value!\"\nend",
"def print_me\n \"I'm printing the return value!\"\nend",
"def print_me\n \"I'm printing the return value!\"\nend",
"def print_me\n \"I'm printing the return value\"\nend",
"def print_name\n p \"Elliott Stein\"\nend",
"def print_name\n p \"Chris\"\nend",
"def print\n end",
"def print\n end",
"def print\n end",
"def print\n end",
"def print_name\n puts \"Will Meighan\"\nend",
"def print\n\n end",
"def print_name\n p \"Joshua Tukman\"\nend",
"def print_two(thing, another_thing)\n\t# this is where the method's code goes.\n\tputs \"thing 1: #{thing}, thing 2: #{another_thing}\"\nend",
"def print_me\r\n print_me = \"I'm printing the return value\"\r\n end",
"def print_something(string)\n puts string\nend",
"def print_name\n p \"Jennica\"\nend",
"def print_me\n 'I\\'m printing the return value!'\nend",
"def print_stuff\n puts \"#{private_method_hello} annnnnd buh-#{private_method_bye}\"\n end",
"def print_name(name)\n p \"#{name} is my name.\"\nend",
"def print_one(thing)\n\tputs \"thing: #{thing}\"\nend",
"def print_name\n p \"Garrett Gerdsen\"\nend",
"def print_me_2\n \"I'm printing the return value!!!\"\nend",
"def print_name\n puts \"Joshua Sherwood\"\nend",
"def print(message); end",
"def print(message); end",
"def print_name\n p \"Alexander Mathieu\"\nend",
"def print_name(name)\n p \"Name: #{name}\"\nend",
"def method_that_says(stuff)\n\tputs (stuff)\nend",
"def print_it(name)\n puts \"#{name}\"# YOUR CODE HERE\nend",
"def print_name\n p \"Kim Abcouwer\"\nend",
"def print_name\n puts \"Bailey Diveley\"\nend",
"def print_name(name)\nputs \"Name: #{name}\"\nend",
"def printDazzle\n puts \"self\"\nend",
"def print_one(arg)\r\n puts \"arg: #{arg}\"\r\nend",
"def print_name(name)\n p \"Your name is #{name}\"\nend",
"def print_name(name)\n p \"My name is #{name}\"\nend",
"def print_name\n p \"Dee\"\nend",
"def say(m); puts m; end",
"def print(num)\n puts num\nend",
"def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend",
"def print_name(name)\n p \"Get out of my house #{name}!\"\nend",
"def print_name(name)\n puts \"My name is #{name}\"\nend",
"def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend",
"def print_name(name)\n puts \"My name is #{name}.\"\nend",
"def print_name(name)\n puts \"My name is #{name}.\"\nend",
"def print\n\t\tputs name + ' ' + className + \" just \" + move + \" and said \" + call\n\tend",
"def print\r\n puts name + \" \" + className + \" says \" + \"\\\"\" + call + \"\\\"\"\r\n end",
"def printer\n\tputs \"I hope this prints...\"\n\tyield(\"John\", \"Thomas\")\nend",
"def print_name(name)\n puts \"Look there! It's #{name}!\"\nend",
"def print_name()\n p \"Severus Snape\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n p \"#{name}\"\nend",
"def print_name(name)\n puts \"This is #{name}\"\nend",
"def print_name(name)\n puts \"my name is #{name}.\"\nend",
"def print_name(name)\n p \"Albus Dumbledore\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend",
"def print_name\n p \"Severus Snape\"\nend"
] |
[
"0.8546282",
"0.85374385",
"0.85374385",
"0.85374385",
"0.85374385",
"0.85374385",
"0.85374385",
"0.85374385",
"0.8520836",
"0.8517741",
"0.7448558",
"0.7270837",
"0.7270837",
"0.7270837",
"0.7270837",
"0.7270837",
"0.72488195",
"0.7220609",
"0.7214637",
"0.70818084",
"0.70818084",
"0.70818084",
"0.7077034",
"0.70593166",
"0.70367736",
"0.70111084",
"0.7005102",
"0.70038575",
"0.69954145",
"0.6961808",
"0.69550085",
"0.6951894",
"0.6932243",
"0.69014287",
"0.6899842",
"0.68919927",
"0.6880006",
"0.68592745",
"0.68592745",
"0.6854563",
"0.68503606",
"0.68487865",
"0.68481374",
"0.68463707",
"0.683851",
"0.67956364",
"0.6786746",
"0.67860055",
"0.67814434",
"0.6772138",
"0.6768262",
"0.67599386",
"0.67521864",
"0.67439306",
"0.67429316",
"0.6740937",
"0.6738399",
"0.6718699",
"0.6718699",
"0.6713366",
"0.6705176",
"0.6702684",
"0.67009515",
"0.669968",
"0.66983384",
"0.66983384",
"0.66983384",
"0.66983384",
"0.66983384",
"0.66900516",
"0.6674409",
"0.66647327",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085",
"0.6661085"
] |
0.8505331
|
10
|
breakpoint.enabled? Returns whether breakpoint is enabled or not.
|
def enabled?()
#This is a stub, used for indexing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def breakpoint?\n type == :breakpoint\n end",
"def waiting_for_breakpoint?\n @breakpoint_listener.status == 'sleep'\n end",
"def waiting_for_breakpoint?\n @breakpoint_listener.status == 'sleep'\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n @enabled\n end",
"def enabled?\n return enabled\n end",
"def enabled?\n !!configuration.enabled\n end",
"def enable_breakpoint(bp)\n bp.enable\n end",
"def enabled?\n\n return @enabled\n\n end",
"def enabled?\n true\n end",
"def enabled?\n true\n end",
"def enabled?\n \n return @enabled\n \n end",
"def enabled?\n \n return @enabled\n \n end",
"def enabled?\n !!@enabled\n end",
"def enabled?\n !!@enabled\n end",
"def enabled?\n !@playground.collecting? || (active? && connection.is_experiment_enabled?(@id))\n end",
"def enabled?\n @enabled != false\n end",
"def enabled?\n !!@enabled\n end",
"def debug_mode?\n @@debug_mode\n end",
"def enabled?\n !!PaperTrail.config.enabled\n end",
"def enabled?\n !suspended\n end",
"def enabled?\n @enabled || false\n end",
"def enabled?\n !@test_mode || @test_mode == :enabled\n end",
"def enabled?\n inclusively { @enabled }\n end",
"def enabled?\n !Rails.env.test?\n end",
"def threshold_enabled?\n @enable_threshold\n end",
"def enabled?\n true\n end",
"def enabled?\n status == 'enabled'\n end",
"def debug?\n\t\t!!@debuggable_status\n\tend",
"def debug_mode\n @@debug_mode == 1\n end",
"def enabled?\n config.roadie.enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def is_enabled\n return @is_enabled\n end",
"def enabled?\n state.nonzero?\n end",
"def enabled?\n ENV['GIT_STORAGE_CIRCUIT_BREAKER'].present? || Feature.enabled?('git_storage_circuit_breaker')\n end",
"def enabled?\n !host.nil?\n end",
"def enabled?\n false\n end",
"def enabled?\n enabled.nil? || enabled\n end",
"def enabled?\n !disabled?\n end",
"def enabled?\n !disabled?\n end",
"def enabled?\n false\n end",
"def enabled?\n distributed_tracing_enabled? &&\n span_events_enabled? &&\n trace_observer_configured?\n end",
"def debugging?\n debugging = ENV[\"DEBUG\"]\n if defined?(Rails) && Rails.respond_to?(:env)\n debugging = true if [\"development\", \"test\"].include? Rails.env\n end\n debugging\n end",
"def enabled?\n any?(&:enabled?)\n end",
"def enabled?\n $game_switches[Yuki::Sw::Pokedex]\n end",
"def enabled?\n @metadata.fetch(:enabled, true)\n end",
"def enabled?\n if $game_system != nil && self.tag != nil &&\n $game_system.enabling_options[self.tag] == false\n return false\n end\n return true if @enabled_condition.nil?\n eval(@enabled_condition)\n end",
"def debugging?\n Options[:debug]\n end",
"def active?\n enabled\n end",
"def debug?\n debugging || !ENV['DEBUG'].nil?\n end",
"def enabled?\n if $game_system != nil && self.tag != nil &&\n $game_system.enabling_options[self.tag] == false\n return false\n end\n return true if @enabled_condition.nil?\n return eval(@enabled_condition)\n end",
"def debugging?\n ENV['DEBUG'] && ENV['DEBUG'] != ''\nend",
"def debug?\n @debug || to_bool( ENV['LAUNCHY_DEBUG'] )\n end",
"def debug?\n true\n end",
"def debug?\n true\n end",
"def enabled?\n optimization_options.values.any?\n end",
"def debug?\n !!@debug\n end",
"def tracking_enabled?\n Thread.current[track_history_flag] != false\n end",
"def peek_activerecord_enabled?\n peek_enabled?\n end",
"def debug?\n @@debug\n end",
"def enabled?\n enabled = false\n features.each do |f|\n enabled = true if f.enabled?\n end\n enabled\n end",
"def debug?\n @@debug\n end",
"def enabled?\n !!store[:enabled]\n end",
"def enabled?\n state.eql? 'active'\n end",
"def enabled?\n o = _options\n o[:enabled].nil? || o[:enabled]\n end",
"def debug?\n return @debug_mode if defined?(@debug_mode)\n @debug_mode = ENV['MOLINILLO_DEBUG']\n end",
"def debug?\n false\n end",
"def debug_through?\r\n return false\r\n end",
"def debug?\n self[:debug] == 'true'\n end",
"def breakpoint?(ip)\n Rubinius.primitive :compiledmethod_is_breakpoint\n raise ArgumentError, \"Unable to retrieve breakpoint status on #{inspect} at bytecode address #{ip}\"\n end",
"def enabled?\n @cache_enabled\n end",
"def enabled?\n @cache_enabled\n end",
"def debug?\n $DEBUG\n end",
"def debug?\n level <= DEBUG\n end",
"def enabled\n return @enabled\n end",
"def enabled\n return @enabled\n end",
"def enabled\n return @enabled\n end",
"def enabled?\n PaperTrail.enabled? &&\n PaperTrail.request.enabled? &&\n PaperTrail.request.enabled_for_model?(@record.class)\n end",
"def debug?\n @debug || ENV['HATCHET_DEBUG'] || false\n end",
"def enabled?\n PaperTrail.enabled? &&\n PaperTrail.request.enabled_for_controller? &&\n PaperTrail.request.enabled_for_model?(@record.class)\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def enabled\n @mutex.synchronize { !!@enabled }\n end",
"def debugging?\n\t\t(datastore['DEBUG'] || '') =~ /^(1|t|y)/i\n\tend",
"def debug?\n !production?\n end",
"def enabled\n !false?(configuration[:enabled])\n end",
"def breakpoints\n @breakpoint_tracker.global_breakpoints\n end",
"def debug?\n instance.options[:debug]\n end",
"def debug?\n instance.options[:debug]\n end",
"def debug?\n !!self.debug\n end",
"def enabled?\n REAPERS.include?(reaper)\n end",
"def breakpoints\n @breakpoint_tracker.global_breakpoints\n end",
"def disabled?\n self.disabled || self.account.blank? || Rails.env.development?\n end"
] |
[
"0.76685584",
"0.7057735",
"0.7028567",
"0.68170124",
"0.68170124",
"0.68170124",
"0.68170124",
"0.6726431",
"0.6704576",
"0.669025",
"0.6648542",
"0.66412187",
"0.66412187",
"0.66183513",
"0.66183513",
"0.66145736",
"0.66145736",
"0.66132134",
"0.65971726",
"0.6575421",
"0.65715533",
"0.6569058",
"0.6548443",
"0.6515734",
"0.64951056",
"0.64524",
"0.6411694",
"0.6389293",
"0.63556355",
"0.62990004",
"0.62872016",
"0.6264756",
"0.62613714",
"0.6257586",
"0.6257586",
"0.6257586",
"0.6257586",
"0.6257586",
"0.6257586",
"0.6257586",
"0.6255019",
"0.61959094",
"0.6178876",
"0.6176601",
"0.61595035",
"0.6156442",
"0.6156442",
"0.61540574",
"0.6153956",
"0.61053663",
"0.60852045",
"0.60783935",
"0.6076352",
"0.6067068",
"0.6051352",
"0.6044245",
"0.6027945",
"0.6021724",
"0.60149837",
"0.59964705",
"0.5993579",
"0.5993579",
"0.5983884",
"0.5982561",
"0.5970241",
"0.5969664",
"0.5961822",
"0.5961707",
"0.5958022",
"0.59488505",
"0.5936052",
"0.589152",
"0.5891501",
"0.5882122",
"0.5878433",
"0.5873846",
"0.5865692",
"0.58648205",
"0.58648205",
"0.58499503",
"0.5849768",
"0.5847226",
"0.5847226",
"0.5847226",
"0.5842253",
"0.58310354",
"0.58165896",
"0.5812961",
"0.5812961",
"0.5812961",
"0.5800868",
"0.5790797",
"0.5788511",
"0.5788024",
"0.5787689",
"0.5787689",
"0.5782841",
"0.5769483",
"0.57600325",
"0.5743504"
] |
0.62973887
|
30
|
breakpoint.expr > string Returns a codition expression when this breakpoint should be activated.
|
def expr()
#This is a stub, used for indexing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def at_breakpoint(_context, breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold('Condition: ') + expr\n end",
"def at_breakpoint(breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold(\"Condition: \") + expr\n end",
"def comparison_op\n @instruction.push(@enum.peek.value)\n match(%w(== != > >= < <=).map { |t| Token.new(:symbol, t) })\n end",
"def condition_op\n @instruction.push(@enum.peek.value)\n match(%w(&& ||).map { |t| Token.new(:symbol, t) })\n end",
"def expression; end",
"def expression\n @expression ||= :mp\n end",
"def complete_expression?(str); end",
"def <=(expr)\n # Ensures expr is an expression\n expr = expr.to_expr\n # Generate the signal if not existant\n # puts \"@scope=#{@scope}\"\n puts \"For @name=#{@name} @signal=#{@signal}\"\n @signal = @scope.make_inners(expr.type,@name) unless @signal\n # Performs the assignment.\n @signal <= expr\n end",
"def gte!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n\n\n type = GTE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 31:6: '>='\n match( \">=\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n\n end",
"def parse_condition(exp); end",
"def add_expr(src, code, indicator)\n case indicator\n when '=='\n add_expr_escaped(src, code)\n else\n super\n end\n end",
"def expression\n super\n end",
"def breakpoint binding; IRB.start_with_binding binding end",
"def to_expr\n return @signal.to_expr\n end",
"def select_operator\n return '>' if self.class.name.downcase.include?('arm')\n return '==' if self.class.name.downcase.include?('leg')\n end",
"def expr \n\n\t$cst.add_branch(\"Expr\")\n\t\n\tcase scout_token\n\twhen \"T_DIGIT\"\n\t\tintexpr\n\twhen \"T_QUOTE\"\n\t\tstringexpr\n\twhen \"T_LPAREN\", \"T_BOOLEAN\"\n\t\tboolexpr\n\twhen \"T_ID\"\n\t\tid\n\telse\n\t\traise FaultyTokenError.new(\"T_DIGIT, T_QUOTE, T_LPAREN, or T_ID\", $tokens[$index])\n\tend\n\t\n\t$cst.ascend\n\t\nend",
"def code\n if @deadline\n \"task_#{event_name} && (\"\\\n \"task_#{event_name}.time.to_f > #{@deadline.to_f}\"\\\n \")\"\n else\n \"!!task_#{event_name}\"\n end\n end",
"def expression_result_str\n case expression_result\n when 0 then \"False\"\n when 1 then \"True\"\n when 2 then \"Error\"\n end\n end",
"def comparison_op\n match(%w(== != > >= < <=).map { |t| Token.new(:symbol, t) })\n end",
"def geq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n type = GEQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 124:7: '>='\n match( \">=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n end",
"def flow_expression\n\n @dict.fexp\n end",
"def lex_en_expr_value; end",
"def lex_en_expr_value; end",
"def lex_en_expr_value; end",
"def get_boolean_expr_beta(expr)\n\t\tcnt=-1\n\t\tboolean_expr = \"\"\n\n\t\texpr = expr.replace_with_space(@symbols+@operators-[\"=\"])\n\n\t\t#expr_arr = expr.split(\"=\")[1]\n \t\t#expr_arr = (!expr_arr.nil? and !expr_arr.blank?) ? expr_arr.split(\" \") : expr.split(\" \")\n\t\texpr_arr = expr.split(\" \")\n\n\t\tconstants = []\n\t\tlocal_vars = []\n\n\t\texpr_arr.each{|x| constants << x if !Group.get_value(x, @system).nil? }\n\t\texpr_arr.each{|x| local_vars << x if x.match(/[a-zA-Z0-9_]+[_]{1}+[a-zA-Z0-9_]*|[a-zA-Z0-9_]/) }\n\n\t\tlocal_vars.delete_all(@keywords+@operators+@named_operators)\n\t\tconstants.uniq!\n\t\tlocal_vars.uniq!\n\n\t\t@constants = {}\n\t\t@local_vars = {}\n\t\ti = 0\n\t\tconstants.each do |c|\n\t\t\t@constants[c] = [@vars[i],@vars[i+=1]]\n\t\t\ti+=1\n\t\tend\n\t\t#j = 0\t\t\t\t\t\treturn gexpr\n\t\tlocal_vars.each do |c|\n\t\t\t@local_vars[c] = @vars[i]\n\t\t\ti+=1\n\t\tend\n\n\t\texpr_arr.each_with_index do |e, ind|\n\t\t\t\tif (@symbols-[\"!\"]).include? e\n\t\t\t\t\tboolean_expr += e\n\t\t\t\telsif (@operators+@named_operators).include? e\n\t\t\t\t\tif [\"and\", \"&\"].include? e.downcase\n\t\t\t\t\t\tboolean_expr += \" & \"\n\t\t\t\t\telsif [\"or\", \"|\"].include? e.downcase\n\t\t\t\t\t\tboolean_expr += \" | \"\n\t\t\t\t\telsif [\"xor\", \"^\"].include? e.downcase\n\t\t\t\t\t\tboolean_expr += \" ^ \"\n\t\t\t\t\tend\n\t\t\t\telsif e.to_s == \"\\'\"\n\t\t\t\t\tboolean_expr += e.to_s\n\t\t\t\telse\n\t\t\t\t\tif [\"1\",\"0\"].include? e\n\t\t\t\t\t\tboolean_expr += \" #{e.to_i == 1 ? true : false} \"\n\t\t\t\t\tend\n\t\t\t\t\tif @constants.keys.include?(e)\n\t\t\t\t\t\t# Replace Group with expression shown below\n\t\t\t\t\t\t# using it 's associated values\n\t\t\t\t\t\t# a + (b*2) + (c*4)\n\t\t\t\t\t\tgexpr = \"\"\n\n\t\t\t\t\t\tgval = Group.get_value(e, @system)\n\n\t\t\t\t\t\tgval.value.split(\",\").each_with_index do |v, ind|\n\t\t\t\t\t\t\tif ind%2 != 0\n\t\t\t\t\t\t\t\t\tgexpr += (\"!\" + @constants[e][1])\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tgexpr += (@constants[e][0]+\" & \")\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tboolean_expr += gexpr#.slice(0..-2)\n\n\t\t\t\t\telsif @local_vars.keys.include?(e)\n\t\t\t\t\t\t\tif e.match(/[a-zA-Z0-9_]+[\\=]{1}+[\\d]/)\n\t\t\t\t\t\t\t\tboolean_expr += \"\\noutput = #{(e.split(\"=\")[1].to_i == 1) ? true : false}\"\n\t\t\t\t\t\t\telsif e.match(/[a-zA-Z0-9_]+[\\=]{1}/)\n\t\t\t\t\t\t\t\tboolean_expr += \"\\noutput =\"\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tboolean_expr += @local_vars[e].to_s\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\telsif expr_arr[ind-1] == \"!\"\n\t\t\t\t\t\tcnt+=1\n\t\t\t\t\t\tboolean_expr += (\"!\"+@vars[cnt])\n\n\t\t\t\t\telsif e.downcase.match(/else|elsif/)\n\t\t\t\t\t\tboolean_expr += \"\\n\" + e + \"\\n\"\n\t\t\t\t\telsif [\"1\",\"0\"].include? e\n\t\t\t\t\t\tboolean_expr += \" \" + (e)\n\t\t\t\t\telsif [\"(\",\")\",\"{\",\"function\",\"IF\",\"ELSE IF\",\"ELSE\",\"}\",\"==\", \"!=\", \">\", \"<\", \">=\", \"<=\",\"1\",\"0\"].include? expr_arr[ind-1].to_s.strip\n\n\t\t\t\t\t\tif e.strip.match(/[a-zA-Z0-9_]+[\\=]{1}+[0-1]/)\n\t\t\t\t\t\t\toutput = e.split(\"=\")\n\t\t\t\t\t\t\tboolean_expr += \" output=#{(output[1].to_i == 1) ? true : false}\" if e != \"!\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tboolean_expr += \" \"+e.downcase+\" \"\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\n\t\t\t\t\t\tif e.strip.match(/[a-zA-Z0-9_]+[\\=]{1}+[0-1]/)\n\t\t\t\t\t\t\toutput = e.split(\"=\")\n\t\t\t\t\t\t\tboolean_expr += \"output = #{(output[1].to_i == 1) ? true : false}\" if e != \"!\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tboolean_expr += e\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\n\t\tend\n\n\t\tboolean_expr = boolean_expr.downcase.gsub(/(else+\\s+if)/,'elsif').gsub(\"function\",'').gsub(/[\\{,\\}]/,'')\n\t\tif boolean_expr.strip.match(/^if/)\n\t\t\tboolean_expr += \"\\nend\"\n\t\tend\n\n\t\treturn boolean_expr\n\tend",
"def print_short_breakpoint(breakpoint)\n id = format(\"%*d\", max_width, breakpoint.id)\n status = breakpoint.enabled? ? \"Yes\" : \"No \"\n expr = breakpoint.expr ? \" #{breakpoint.expr} \" : \"\"\n\n output.puts(\" #{id} #{status} #{breakpoint}#{expr}\")\n end",
"def operator_ruby_string\n operator_string + \" \"\n end",
"def compile_to_ruby\n operator_ruby_string + \"(\" + @expression.compile_to_ruby + \")\"\n end",
"def process_true(exp)\n \"Qtrue\"\n end",
"def scope_condition() \"1\" end",
"def conditional\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 48 )\n return_value = ConditionalReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal226 = nil\n char_literal227 = nil\n t = nil\n f = nil\n logical_or225 = nil\n\n tree_for_char_literal226 = nil\n tree_for_char_literal227 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 577:5: logical_or ( '?' t= expression ':' f= expression )?\n @state.following.push( TOKENS_FOLLOWING_logical_or_IN_conditional_3808 )\n logical_or225 = logical_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_or225.tree )\n end\n # at line 577:16: ( '?' t= expression ':' f= expression )?\n alt_51 = 2\n look_51_0 = @input.peek( 1 )\n\n if ( look_51_0 == QMARK )\n alt_51 = 1\n end\n case alt_51\n when 1\n # at line 577:19: '?' t= expression ':' f= expression\n char_literal226 = match( QMARK, TOKENS_FOLLOWING_QMARK_IN_conditional_3813 )\n if @state.backtracking == 0\n\n tree_for_char_literal226 = @adaptor.create_with_payload( char_literal226 )\n root_0 = @adaptor.become_root( tree_for_char_literal226, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_conditional_3819 )\n t = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, t.tree )\n end\n char_literal227 = match( COLON, TOKENS_FOLLOWING_COLON_IN_conditional_3822 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_conditional_3828 )\n f = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, f.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 48 )\n\n end\n \n return return_value\n end",
"def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n __COMPARITIONOPERATORS10__ = nil\n\n begin\n # at line 705:5: exp ( COMPARITIONOPERATORS exp )?\n @state.following.push( TOKENS_FOLLOWING_exp_IN_expression_1070 )\n exp\n @state.following.pop\n # at line 705:9: ( COMPARITIONOPERATORS exp )?\n alt_26 = 2\n look_26_0 = @input.peek( 1 )\n\n if ( look_26_0 == COMPARITIONOPERATORS )\n alt_26 = 1\n end\n case alt_26\n when 1\n # at line 705:10: COMPARITIONOPERATORS exp\n __COMPARITIONOPERATORS10__ = match( COMPARITIONOPERATORS, TOKENS_FOLLOWING_COMPARITIONOPERATORS_IN_expression_1073 )\n # --> action\n #Regla 8\n \t @stack_operators.push(__COMPARITIONOPERATORS10__.text)\n \t \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_exp_IN_expression_1087 )\n exp\n @state.following.pop\n # --> action\n #Regla 9\n \t\t operator = @stack_operators.pop\n \t\t operand_b = @stack_operands.pop\n \t\t operand_a = @stack_operands.pop\n \t\t result = get_avail\n \t\t generate(operator, operand_a, operand_b, result)\n \t\t free_avail(operand_a)\n \t\t free_avail(operand_b)\n \t\t free_avail_const(operand_a)\n \t\t free_avail_const(operand_b)\n \t\t @stack_operands.push(result)\n \t\t @stack_types.push(resulting_type(@stack_types.pop, @stack_types.pop, operator))\n \t \n # <-- action\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n end\n \n return \n end",
"def process_true(exp)\n return \"1\"\n end",
"def expression?\n !@no_expression\n end",
"def inspect\n meths = %w[id pos source expr hit_condition hit_count hit_value enabled?]\n values = meths.map { |field| \"#{field}: #{send(field)}\" }.join(\", \")\n \"#<Byebug::Breakpoint #{values}>\"\n end",
"def compile_expression\n write_tag '<expression>'\n compile_term\n compile_term while match('+', '-', '<', '/', '=', '>', '&', '|', '*')\n write_tag '</expression>'\n end",
"def expr\n or_expr\n end",
"def expression\n return additive_expression\n end",
"def eqq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 71 )\n\n type = EQQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 192:7: '==='\n match( \"===\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 71 )\n\n end",
"def check_equality(expr, value)\n @commands << \"test `#{expr}` = '#{value}'\"\n end",
"def condition_op\n match(%w(&& ||).map { |t| Token.new(:symbol, t) })\n end",
"def expression\n Fast.expression(@pattern)\n end",
"def leq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 33 )\n\n type = LEQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 154:7: '<='\n match( \"<=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 33 )\n\n end",
"def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end",
"def expression(operator, val)\n val = (val.is_a?(String) || val.is_a?(Symbol)) ? \"'#{val}'\" : val\n \"#{@attr} #{operator} #{val}\"\n end",
"def operator_c_string\n operator_string + \" \"\n end",
"def expression_operator()\n\n\n\n # \n if (TOKENS[look_ahead(1)] >= 25 && TOKENS[look_ahead(1)] <= 26) || look_ahead(1) == :ECOMMERCIAL || look_ahead(1) == :EQUAL || (TOKENS[look_ahead(1)] >= 35 && TOKENS[look_ahead(1)] <= 46)\n match()\n else\n raise \"Expected set\"\n end\n\n\n\n end",
"def command expression\n c = commands.select {|c, v| v.expression.expression == expression}\n (c.any?) ? c.first[1] : false\n end",
"def get_declaration(cls, bld, funItem)\n eqString = String.new\n\n bld.add(\"bool operator==\" << \"(const \" << cls.name)\n bld.sameLine(eqString << \" src\" << cls.name << \") const;\")\n\n return eqString\n end",
"def condition_operator\n return :all if read_attribute(:condition_operator).blank?\n read_attribute(:condition_operator).to_sym\n end",
"def expression\n Bumbleworks::Expression.from_fei(fei)\n end",
"def define_question_code(klass, position)\r\n \"@value==#{position.value}\"\r\n end",
"def compile_to_c\n operator_c_string + \"(\" + @expression.compile_to_c + \")\"\n end",
"def expr_eval_to_s\n if @last_eval_state.nil?\n return \"<unevaluated>\"\n end\n \n str = ''\n if @offset\n str << \"#{@offset < 0 ? '-' : ''}0x#{@offset.abs.to_s(16)}\"\n end\n \n if @last_eval_state[:special] || @last_eval_state[:register]\n if @offset\n str << '+'\n end\n if @last_eval_state[:special]\n str << @last_eval_state[:special_tok]\n elsif @last_eval_state[:register]\n str << @last_eval_state[:reg_tok]\n end \n end\n \n str\n end",
"def lte!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n\n\n\n type = LTE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 33:6: '<='\n match( \"<=\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 12 )\n\n\n end",
"def compile_to_c\n \"if (\" + @condition.compile_to_c + \") {\\n\" +\n indent_c(@then_part.compile_to_c) +\n \"\\n} else {\\n\" +\n indent_c(@else_part.compile_to_c) +\n \"\\n}\"\n end",
"def condition\n self.class.const_defined?(:CONDITION) ? Regexp.new(self.class.const_get(:CONDITION)) : @on\n end",
"def to_expr\n return self.return_value\n end",
"def t__48!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n\n\n\n type = T__48\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 25:9: '<='\n match( \"<=\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n\n\n end",
"def presentation_code_cond()\n @presentation_code.blank? and return nil # true as condition for SQL\n [\"theses.presentation_code = :code\", {:code => @presentation_code}]\n end",
"def excl\n \"else \"\n end",
"def non_complex_expression?(condition); end",
"def ge!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 58 )\n\n type = GE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 385:6: '>='\n match( \">=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 58 )\n\n end",
"def binExp_Handler(expr)\n\ttypeExpr1 = expression_Handler(expr.elems[0])\n\ttypeExpr2 = expression_Handler(expr.elems[1])\n\tif (typeExpr1 != typeExpr2)\n\t\treturn nil\n\tend\n\tcase expr.op\n\twhen /^\\/\\\\/\n\t\tif typeExpr1 == :BOOLEAN\n\t\t\treturn :BOOLEAN\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /^\\\\\\//\n\t\tif typeExpr1 == :BOOLEAN\n\t\t\treturn :BOOLEAN\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /^(=|\\/=)/\n\t\treturn :BOOLEAN\n\twhen /^[\\+\\-\\*\\/%]/\n\t\tif typeExpr1 == :NUMBER\n\t\t\treturn :NUMBER\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /^[~&]/\n\t\tif typeExpr1 == :CANVAS\n\t\t\treturn :CANVAS\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /^(<|>|<=|>=)/\n\t\tif (typeExpr1 == :NUMBER) and (typeExpr2 == :NUMBER)\n\t\t\treturn :BOOLEAN\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend\nend",
"def binExp_Handler(expr)\n\ttypeExpr1 = expression_Handler(expr.elems[0])\n\ttypeExpr2 = expression_Handler(expr.elems[1])\n\tif (typeExpr1 != typeExpr2)\n\t\treturn nil\n\tend\n\tcase expr.op\n\twhen /^\\/\\\\/\n\t\tif typeExpr1 == :BOOLEAN\n\t\t\treturn :BOOLEAN\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /^\\\\\\//\n\t\tif typeExpr1 == :BOOLEAN\n\t\t\treturn :BOOLEAN\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /^(=|\\/=)/\n\t\treturn :BOOLEAN\n\twhen /^[\\+\\-\\*\\/%]/\n\t\tif typeExpr1 == :NUMBER\n\t\t\treturn :NUMBER\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /^[~&]/\n\t\tif typeExpr1 == :CANVAS\n\t\t\treturn :CANVAS\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /^(<|>|<=|>=)/\n\t\tif (typeExpr1 == :NUMBER) and (typeExpr2 == :NUMBER)\n\t\t\treturn :BOOLEAN\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend\nend",
"def expression(rbp)\n t = @token\n @token = @lexer.next\n left = t.nud(self)\n while rbp < @token.lbp\n t = @token\n @token = @lexer.next\n left = t.led(self, left)\n end\n left\n end",
"def breakpoint?(ip)\n Rubinius.primitive :compiledmethod_is_breakpoint\n raise ArgumentError, \"Unable to retrieve breakpoint status on #{inspect} at bytecode address #{ip}\"\n end",
"def boolexpr \n\n\t$cst.add_branch(\"BooleanExpr\")\n\t\n\tif $tokens[$index].type == \"T_LPAREN\"\n\t\tmatch_token(\"T_LPAREN\", $tokens[$index])\n\t\texpr\n\t\tboolop\n\t\texpr\n\t\tmatch_token(\"T_RPAREN\", $tokens[$index])\n\telse\n\t\tboolval\n\tend\n\t\n\t$cst.ascend\n\nend",
"def to_code(extra=nil)\n \"if #{line_up_cond} \\n #{line_up_result(extra)} \\n end\"\n end",
"def condition\n node.condition\n end",
"def triple_expression?; false; end",
"def printable?; self >= 0x20 and self <= 0x7e; end",
"def expr(min_prec = 5, step = 10)\n left = atomar\n\n loop do\n if !left || !infix || @optable[peek.value][0] < min_prec\n return left\n else\n op = consume\n line = op.line\n col = op.column\n prec, assoc = @optable[op.value]\n next_prec = prec || (prec + step if assoc == 'left')\n right = expr(next_prec) || syntax_error\n left = Apparat::Byte::Binary.new([op.value, left, right], line, col)\n end\n end\n end",
"def operator?(item)\n return item.eql?(item.match(/[A-Z\\-<>(>=)(<=)(<=>)]+/m).to_s) ? true : false\n end",
"def >=(expr2)\n Operator.new(S_GTE, self, expr2)\n end",
"def jump(line)\n return line[/(JGT)|(JEQ)|(JGE)|(JLT)|(JNE)|(JLE)|(JMP)/]\n end",
"def score_key\n \"#{self.name} Expression\"\n end",
"def greater!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n type = GREATER\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 127:11: '>'\n match( 0x3e )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end",
"def get_expr_and_escapeflag(matched)\n return matched[2], matched[1] == '$'\n end",
"def active_indicator(project)\n indicator = project.current ? \"* \" : \" \"\n end",
"def add_expr_escaped(src, code)\n src << \" #{@bufvar} << _erubis_xml_helper.escape_xml((\" << code << '));'\n end",
"def add_expression(indicator, code)\n if ((indicator == '=') ^ @escape)\n add_expression_result(code)\n else\n add_expression_result_escaped(code)\n end\n end",
"def expression\n node_parts.last\n end",
"def inequality_operator(property, operand)\n if property.type == Types::Text\n operand.nil? ? 'IS NOT' : 'DBMS_LOB.SUBSTR(%s) <> ?'\n else\n operand.nil? ? 'IS NOT' : '<>'\n end\n end",
"def print_full_breakpoint(breakpoint)\n header = \"Breakpoint #{breakpoint.id}:\"\n status = breakpoint.enabled? ? \"Enabled\" : \"Disabled\"\n code = breakpoint.source_code.with_line_numbers.to_s\n condition = if breakpoint.expr\n \"#{bold('Condition:')} #{breakpoint.expr}\\n\"\n else\n \"\"\n end\n\n output.puts <<-BREAKPOINT.gsub(/ {8}/, \"\")\n\n #{bold(header)} #{breakpoint} (#{status}) #{condition}\n\n #{code}\n\n BREAKPOINT\n end",
"def insert_b(expr)\n @i = 0\n string = false\n while @i < expr.size \n string = (expr[@i] == \"\\\"\") ? (string ? false : true) : (string)\n if (expr[@i] == '-' or expr[@i] == '+') and ((expr[@i - 1] == '(') or (@i == 0)) and !string then\n expr.insert @i, '()'\n end\n @i += 1\n end\n return expr\n end",
"def to_s\n @expression.to_s\n end",
"def expression\n if is_addop @look\n emit_ln 'CLR D0'\n else\n term\n end\n while is_addop @look\n emit_ln 'MOVE D0, -(SP)' \n case @look\n when '+': add\n when '-': subtract\n else expected('Addop')\n end\n end\nend",
"def lex_en_expr_beg; end",
"def lex_en_expr_beg; end",
"def lex_en_expr_beg; end",
"def name\n if active\n expr.descending ? \"#{expr.expression}_desc\" : \"#{expr.expression}_asc\"\n else\n expr.expression\n end.to_s\n end",
"def emit_expr value\n statement :expr, value\n end",
"def expr\n space\n\n if accept(\"(\")\n self.unclosed_parens += 1\n a = or_clause\n expect(\")\")\n self.unclosed_parens -= 1\n a\n else\n term\n end\n end",
"def intexpr \n\n\t$cst.add_branch(\"IntExpr\")\n\t\n\tif $tokens[$index + 1].type == \"T_PLUS\"\n\t\tdigit\n\t\tintop\n\t\texpr\n\telse\n\t\tdigit\n\tend\n\t\n\t$cst.ascend\n\nend",
"def expression\n if is_addop($lookahead)\n emitln \"xor %eax, %eax\"\n else\n term\n end\n\n while is_addop($lookahead)\n emitln \"movl %eax, -(0x8*#{$stackdepth})(%rsp)\"\n case $lookahead\n when \"+\"\n add\n when \"-\"\n subtract\n else\n expected \"Addop\"\n end\n end\nend",
"def active_if_equal(arg1, arg2)\n \"active\" if arg1 == arg2\n end",
"def class_logger_pos(node)\n node.loc.operator ? node.children[1].loc.expression : node.loc.name\n end",
"def breakpoint?\n type == :breakpoint\n end",
"def test_condition(i)\n case self.rc_query\n when (:contains || :is)\n #i =~ #self.rc_regex\n when :does_not_contain\n #i =~ #self.rc_regex\n when :is_greater_than\n i > self.rc_integer_value\n when :is_less_than\n i < self.rc_integer_value \n when :equals\n i == self.rc_integer_value\n else\n false \n end\n end"
] |
[
"0.60961115",
"0.6030832",
"0.56119454",
"0.5579488",
"0.5509498",
"0.5367534",
"0.53491104",
"0.5175877",
"0.5140106",
"0.5128539",
"0.50933677",
"0.5053711",
"0.5004409",
"0.5003229",
"0.4993003",
"0.4980137",
"0.49778333",
"0.49630427",
"0.49523926",
"0.49256495",
"0.49137884",
"0.4878714",
"0.4878714",
"0.4878714",
"0.48749447",
"0.48720908",
"0.48668438",
"0.48653656",
"0.4859891",
"0.48591632",
"0.48441446",
"0.48410612",
"0.48393226",
"0.4838874",
"0.48330936",
"0.481771",
"0.481692",
"0.48117837",
"0.48084038",
"0.4807711",
"0.48071712",
"0.47912815",
"0.47837073",
"0.47810397",
"0.4775073",
"0.47699577",
"0.4760276",
"0.47601578",
"0.47492445",
"0.47474784",
"0.47464585",
"0.47387385",
"0.47303706",
"0.47285262",
"0.47243646",
"0.47118866",
"0.4711678",
"0.47079557",
"0.4700267",
"0.46937415",
"0.4682978",
"0.4676392",
"0.46687913",
"0.46659938",
"0.46659938",
"0.4663406",
"0.46605113",
"0.46557182",
"0.4652505",
"0.46512568",
"0.4651122",
"0.46490002",
"0.46402305",
"0.46400312",
"0.46379173",
"0.46358383",
"0.4635752",
"0.46349785",
"0.46276325",
"0.46221158",
"0.4621951",
"0.46205363",
"0.46186072",
"0.461625",
"0.46096325",
"0.46089584",
"0.4607251",
"0.45992976",
"0.45969582",
"0.45969582",
"0.45969582",
"0.4596783",
"0.45884365",
"0.45834073",
"0.45734406",
"0.4565474",
"0.45555317",
"0.45506728",
"0.4550372",
"0.4548898"
] |
0.52103394
|
7
|
breakpoint.expr = string | nil Sets the codition expression when this breakpoint should be activated.
|
def expr=(p1)
#This is a stub, used for indexing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def at_breakpoint(_context, breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold('Condition: ') + expr\n end",
"def at_breakpoint(breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold(\"Condition: \") + expr\n end",
"def breakpoint binding; IRB.start_with_binding binding end",
"def add_breakpoint(file, line, expr=nil)\n breakpoint = Breakpoint.new(file, line, expr)\n breakpoints << breakpoint\n breakpoint\n end",
"def set_breakpoint(source, pos, condition = nil)\n #This is a stub, used for indexing\n end",
"def set_breakpoint(ip, obj)\n Rubinius.primitive :compiledmethod_set_breakpoint\n raise ArgumentError, \"Unable to set breakpoint on #{inspect} at invalid bytecode address #{ip}\"\n end",
"def change(id, expression = nil)\n validate_expression expression\n\n breakpoint = find_by_id(id)\n breakpoint.expr = expression\n breakpoint\n end",
"def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end",
"def enable_breakpoint(bp)\n bp.enable\n end",
"def breakpoint()\n #This is a stub, used for indexing\n end",
"def breakpoint?(ip)\n Rubinius.primitive :compiledmethod_is_breakpoint\n raise ArgumentError, \"Unable to retrieve breakpoint status on #{inspect} at bytecode address #{ip}\"\n end",
"def code_rc_set(expr)\n code js_set(:rc => expr)\n end",
"def expression\n @expression ||= :mp\n end",
"def set_breakpoint(cm, ip, condition=nil)\n @breakpoint_tracker.on(cm, :ip => ip, :condition => condition)\n end",
"def code_point=(_); end",
"def breakpoint?\n type == :breakpoint\n end",
"def info_breakpoints\n @queue << \"i b\"\n end",
"def set_breakpoint(cm, ip)\n @breakpoint_tracker.on(cm, :ip => ip)\n end",
"def add_expr(src, code, indicator)\n case indicator\n when '=='\n add_expr_escaped(src, code)\n else\n super\n end\n end",
"def debugger_address=(_arg0); end",
"def expression; end",
"def condition_op\n @instruction.push(@enum.peek.value)\n match(%w(&& ||).map { |t| Token.new(:symbol, t) })\n end",
"def code_point; end",
"def activate_debugger(thread, ctxt, bp_list)\n @debug_thread = thread\n @interface.at_breakpoint(self, thread, ctxt, bp_list)\n end",
"def initialize(expr = nil)\n @expression = expr\n end",
"def clear_breakpoint(ip)\n Rubinius.primitive :compiledmethod_clear_breakpoint\n raise ArgumentError, \"Unable to clear breakpoint on #{inspect} at invalid bytecode address #{ip}\"\n end",
"def debugger_address; end",
"def debug it\n PryByebug::BreakCommand.new.send :add_breakpoint, \"Testo::Test#run\", nil\n # How to \"next next step\" automatically when the breakpoint is hit?\n\n begin\n run it\n raise \"Cannot reproduce. It might be a heisebug.\"\n rescue\n $!\n end\nend",
"def expression\n super\n end",
"def print_full_breakpoint(breakpoint)\n header = \"Breakpoint #{breakpoint.id}:\"\n status = breakpoint.enabled? ? \"Enabled\" : \"Disabled\"\n code = breakpoint.source_code.with_line_numbers.to_s\n condition = if breakpoint.expr\n \"#{bold('Condition:')} #{breakpoint.expr}\\n\"\n else\n \"\"\n end\n\n output.puts <<-BREAKPOINT.gsub(/ {8}/, \"\")\n\n #{bold(header)} #{breakpoint} (#{status}) #{condition}\n\n #{code}\n\n BREAKPOINT\n end",
"def presentation_code_cond()\n @presentation_code.blank? and return nil # true as condition for SQL\n [\"theses.presentation_code = :code\", {:code => @presentation_code}]\n end",
"def add_code(code)\n terminate_expression\n @src << code\n @src << ';' unless code[RANGE_LAST] == \"\\n\"\n @buffer_on_stack = false\n end",
"def add_expression(indicator, code)\n if ((indicator == '=') ^ @escape)\n add_expression_result(code)\n else\n add_expression_result_escaped(code)\n end\n end",
"def breakpoint!(text='Click anywhere to continue...', timeout=0)\n puts \">> breakpoint reached. click anywhere in the browser to continue\"\n\n text = text.gsub(\"\\\"\", \"\\\\\\\"\")\n\n execute_scopejs_script %(\n document.body.appendChild(div(\n {\n id: '_breakpoint_overlay',\n style: 'background-color: rgba(0, 0, 0, 0.6); position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; text-align: center;',\n onClick: function() { App.remove_element('_breakpoint_overlay'); }\n },\n p({ style: 'margin: 150px 100px; line-height: 60px; font-size: 50px; color: white; text-shadow: 3px 3px #000' }, \"#{text}\"))\n );\n if (#{timeout} > 0) setTimeout(function() {\n var e = document.getElementById('_breakpoint_overlay');\n e.parentNode.removeChild(e);\n }, #{timeout});\n console.log(\"** Breakpoint reached **\");\n )\n\n while execute_scopejs_script(\"return document.getElementById('_breakpoint_overlay');\") do\n sleep 0.25 # waiting a little\n end\n\n puts \">> continuing from breakpoint\"\n end",
"def initialize(expr)\r\n @expr = expr\r\n end",
"def pass_in_breakpoint!(temporal_type, task)\n if task[:breakpoint]\n case task.temporal_type\n when :sequential\n if subtask = task.subtasks.first\n subtask[:breakpoint] = true\n end\n when :concurrent\n task.subtasks.map { |subtask| subtask[:breakpoint] = true }\n end\n end\n end",
"def pry\n # rubocop:disable Lint/Debugger\n binding.pry\n # rubocop:enable Lint/Debugger\n end",
"def resume_pry\n new_binding = frame._binding\n\n run do\n if defined?(@pry) && @pry\n @pry.repl(new_binding)\n else\n @pry = Pry::REPL.start_without_pry_byebug(target: new_binding)\n end\n end\n end",
"def disasm_prefix(ip, frame_ip, cm)\n prefix = cm.breakpoint?(ip) ? 'B' : ' ' \n prefix += \n if ip == frame_ip\n '-->'\n else\n ' '\n end\n end",
"def run(args, temp=false)\n\n arg_str = args.size == 1 ? @proc.frame.line.to_s : @proc.cmd_argstr\n cm, file, line, position_type, expr, negate = \n @proc.breakpoint_position(arg_str, true)\n if file.nil?\n unless @proc.context\n errmsg 'We are not in a state that has an associated file.'\n return \n end\n file = @proc.frame.file\n if line.nil? \n # Set breakpoint at current line\n line = @proc.frame.line\n end\n end\n\n if line\n if LineCache.cache(file, settings[:reload_source_on_change])\n last_line = LineCache.size(file)\n if line > last_line\n errmsg(\"There are only %d lines in file \\\"%s\\\".\" % [last_line, \n @proc.canonic_file(file)]) \n return\n end\n syntax_errors = Trepan::ruby_syntax_errors(file)\n if syntax_errors\n msg [\"File #{file} is not a syntactically correct Ruby program.\",\n \"Therefore we can't check line numbers.\"]\n return unless confirm('Set breakpoint anyway?', false)\n else\n unless LineCache.trace_line_numbers(file).member?(line)\n errmsg('Line %d is not a stopping point in file \"%s\".' % \n [line, @proc.canonic_file(file)])\n return\n end\n end\n else\n errmsg('No source file named %s' % @proc.canonic_file(file))\n return unless confirm('Set breakpoint anyway?', false)\n end\n \n unless @proc.context\n errmsg 'We are not in a state we can add breakpoints.'\n return \n end\n\n expr = \"!(#{expr})\" if negate\n if temp\n @proc.state.context.set_breakpoint(file, line, expr)\n msg(\"Temporary breakpoint set at file %s, line %d\" % [file, line])\n else \n b = Debugger.add_breakpoint file, line, expr\n msg(\"Breakpoint %d file %s, line %d\" % \n [b.id, @proc.canonic_file(file), line])\n end\n # unless syntax_valid?(expr)\n # errmsg(\"Expression \\\"#{expr}\\\" syntactically incorrect; breakpoint disabled.\\n\")\n # b.enabled = false\n # end\n # else\n # method = line.intern.id2name\n # b = Debugger.add_breakpoint class_name, method, expr\n # print \"Breakpoint %d at %s::%s\\n\", b.id, class_name, method.to_s\n end\n end",
"def breakpoint_recipe\n recipe = tag_value(BREAKPOINT_TAG)\n end",
"def activate_debugger(thread, ctxt, bp)\n puts \"[Debugger activated]\" unless bp.kind_of? StepBreakpoint\n @debug_thread = thread\n @eval_context = @debug_context = ctxt\n\n # Load debugger commands if we haven't already\n load_commands unless @commands\n\n file = @debug_context.file.to_s\n line = @debug_context.line\n\n puts \"\"\n puts \"#{file}:#{line} (#{@debug_context.method.name}) [IP:#{@debug_context.ip}]\"\n output = Output.new\n output.set_line_marker\n output.set_color :cyan\n if bp.kind_of? StepBreakpoint and bp.step_by == :ip\n bc = @debug_context.method.decode\n inst = bc[bc.ip_to_index(@debug_context.ip)]\n output.set_columns([\"%04d:\", \"%-s \", \"%-s\"])\n output << [inst.ip, inst.opcode, inst.args.map{|a| a.inspect}.join(', ')]\n else\n lines = source_for(file)\n unless lines.nil?\n output.set_columns(['%d:', '%-s'])\n output << [line, lines[line-1].chomp]\n end\n end\n output.set_color :clear\n puts output\n\n @prompt = \"\\nrbx:debug> \"\n until @done do\n inp = Readline.readline(@prompt)\n inp.strip!\n if inp.length > 0\n process_command(inp)\n @last_inp = inp\n elsif @last_inp\n process_command(@last_inp)\n end\n end\n\n # Clear any references to the debuggee thread and context\n @debug_thread = nil\n @debug_context = nil\n @eval_context = nil\n end",
"def inspect\n meths = %w[id pos source expr hit_condition hit_count hit_value enabled?]\n values = meths.map { |field| \"#{field}: #{send(field)}\" }.join(\", \")\n \"#<Byebug::Breakpoint #{values}>\"\n end",
"def initialize(expr)\n @expr = expr\n super()\n end",
"def ir_code_binding\n tag(\"bind\",\n nodeset: \"/data/#{IR_CODE}\",\n required: \"true()\",\n relevant: \"/data/#{IR_QUESTION} = 'yes'\",\n constraint: \". = '#{override_code}'\",\n type: \"string\")\n end",
"def code=(v)\n @code = v\n end",
"def print_short_breakpoint(breakpoint)\n id = format(\"%*d\", max_width, breakpoint.id)\n status = breakpoint.enabled? ? \"Yes\" : \"No \"\n expr = breakpoint.expr ? \" #{breakpoint.expr} \" : \"\"\n\n output.puts(\" #{id} #{status} #{breakpoint}#{expr}\")\n end",
"def min(expression)\n @objective = Objective.new(:minimize, expression)\n end",
"def compilation(value)\n @ole.Compilation = value\n nil\n end",
"def is_code?(line,labelhash)\n if @to_code && line !~ /^#include \"(page|align|pass).i65\".*/ # filter chaffy includes\n if @code.nil?\n # first line is special, the label\n @label = line\nputs @label if @label == \"STUDIO\"\n @addr = labelhash[@label]\n # start with a code quote and a slider button\n @code =\n \"\\n\\n\\n<$button popup=\\\"$:/state/codeSlider\\\">code</$button>\"\\\n \"<$reveal type=\\\"nomatch\\\" text=\\\"\\\" default=\\\"\\\" \"\\\n \"state=\\\"$:/state/codeSlider\\\" animate=\\\"yes\\\">\\n\\n```\"\n end\n # append code line, filter chaff\n @code += \"\\n\"+line\n end\n # turn on code trigger after checking, to avoid capturing the `#endif`\n if (line =~ /^\\#endif$/) # non-`#if 0` should have a comment after #endif in source\n @to_code = true\n end\n end",
"def debugger_statement(var_env)\n return nil unless eql_lit?(ECMA262::ID_DEBUGGER)\n if semicolon(var_env)\n ECMA262::StDebugger.new\n else\n raise ParseError.new(\"no semicolon at end of debugger statement\", self)\n end\n end",
"def activate\n @@active = true\n bb_stack = []\n fn = lambda do |e, f, l, m, b, k|\n unless k == TracePoint or (k == Kernel && m == :set_trace_func)\n #(p e, f, l, m, b, k, @@bb_stack; puts \"---\") if $DEBUG\n if ['call','c-call','class'].include?(e)\n bb_stack << b\n elsif ['return','c-return','end'].include?(e)\n bb = bb_stack.pop\n end\n b = bb if ! b # this sucks!\n tp = TracePoint.new(e, f, l, m, b, bb)\n @@procs.each{ |fn| fn.call(tp) }\n end\n end\n set_trace_func(fn)\n end",
"def expr()\n #This is a stub, used for indexing\n end",
"def string=(code); end",
"def expression=(_arg0); end",
"def test_parent_breakpoint\n # skip \"Need to add ISEQ parent link to 1.9.2 and further check of old code\"\n # require_relative '../../lib/trepanning'\n line = __LINE__ # This is the line we set the breakpoint for.\n 1.times do\n tf = RubyVM::Frame.get\n @cmdproc.frame_setup(tf)\n run_cmd(@my_cmd, [@name, line.to_s])\n assert_equal(true, @cmdproc.errmsgs.empty?, @cmdproc.errmsgs)\n assert_equal(0, @cmdproc.msgs[0] =~ @brkpt_set_pat, @cmdproc.msgs[0])\n reset_cmdproc_vars\n end\n end",
"def expression(expression_string)\n state_depth_must_be(States::ATTRIBUTE)\n raise 'expression already defined' if @current_attribute.expression\n @current_attribute.expression = expression_string\n end",
"def breakpoint_line(line_number, initial_iseq, temp=false)\n # FIXME: handle breakpoint conditions.\n found_iseq = initial_iseq.child_iseqs.detect do |iseq|\n iseq.lineoffsets.keys.member?(line_number)\n end\n unless found_iseq\n found_iseq = initial_iseq.parent\n while found_iseq do\n break if found_iseq.lineoffsets.keys.member?(line_number)\n found_iseq = found_iseq.parent\n end\n end\n offset =\n if found_iseq\n # FIXME\n found_iseq.line2offsets(line_number)[1] ||\n found_iseq.line2offsets(line_number)[0]\n else\n nil\n end\n unless offset\n place = \"in #{iseq.source_container.join(' ')} \" if found_iseq\n errmsg(\"No line #{line_number} found #{place}for breakpoint.\")\n return nil\n end\n @brkpts.add(found_iseq, offset, :temp => temp)\n end",
"def semi!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 38 )\n\n\n\n type = SEMI\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 59:7: ';'\n match( 0x3b )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 38 )\n\n\n end",
"def at_line\n resume_pry\n end",
"def expression\n if is_addop @look\n emit_ln 'CLR D0'\n else\n term\n end\n while is_addop @look\n emit_ln 'MOVE D0, -(SP)' \n case @look\n when '+': add\n when '-': subtract\n else expected('Addop')\n end\n end\nend",
"def resume_pry(context)\n frame_position = state ? state.frame : 0\n\n new_binding = context.frame_binding(frame_position)\n\n run do\n if defined?(@pry) && @pry\n @pry.repl(new_binding)\n else\n @pry = Pry.start_without_pry_byebug(new_binding)\n end\n end\n end",
"def t__49!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n\n\n\n type = T__49\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 26:9: '='\n match( 0x3d )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 20 )\n\n\n end",
"def eqq!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 71 )\n\n type = EQQ\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 192:7: '==='\n match( \"===\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 71 )\n\n end",
"def parExp_Handler(expr)\n\treturn expression_Handler(expr.expr)\nend",
"def parExp_Handler(expr)\n\treturn expression_Handler(expr.expr)\nend",
"def breakpoint_position(position_str, allow_condition)\n break_cmd_parse = if allow_condition\n parse_breakpoint(position_str)\n else\n parse_breakpoint_no_condition(position_str)\n end\n return [nil] * 5 unless break_cmd_parse\n tail = [break_cmd_parse.condition, break_cmd_parse.negate]\n meth_or_frame, file, position, offset_type =\n parse_position(break_cmd_parse.position)\n if meth_or_frame\n if iseq = meth_or_frame.iseq\n iseq, line_no, vm_offset =\n position_to_line_and_offset(iseq, file, position,\n offset_type)\n if vm_offset && line_no\n return [iseq, line_no, vm_offset] + tail\n end\n else\n errmsg(\"Unable to set breakpoint in #{meth_or_frame}\")\n end\n elsif file && position\n if :line == offset_type\n iseq = find_iseqs_with_lineno(file, position)\n if iseq\n junk, line_no, vm_offset =\n position_to_line_and_offset(iseq, file, position,\n offset_type)\n return [@frame.iseq, line_no, vm_offset] + tail\n else\n errmsg(\"Unable to find instruction sequence for\" +\n \" position #{position} in #{file}\")\n end\n else\n errmsg \"Come back later...\"\n end\n elsif @frame.respond_to?(:file) and @frame.file == file\n puts \"parsing line and offset #{position}, #{offset_type}\"\n line_no, vm_offset = position_to_line_and_offset(@frame.iseq, position,\n offset_type)\n return [@frame.iseq, line_no, vm_offset] + tail\n else\n errmsg(\"Unable to parse breakpoint position #{position_str}\")\n end\n return [nil] * 5\n end",
"def label_assign!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 10)\n\n type = LABEL_ASSIGN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 16:16: '='\n match(?=)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 10)\n\n end",
"def add_expr_escaped(src, code)\n src << \" #{@bufvar} << _erubis_xml_helper.escape_xml((\" << code << '));'\n end",
"def code= new_code\n @code = new_code\n end",
"def comilla!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n\n\n\n type = COMILLA\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 317:3: '\\\\''\n match( 0x27 )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 16 )\n\n\n end",
"def t__48!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n\n\n\n type = T__48\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 25:9: '<='\n match( \"<=\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 19 )\n\n\n end",
"def hit_condition= symbol\n #This is a stub, used for indexing\n end",
"def break=(point)\n @queue << \"break #{point}\"\n end",
"def exp_statement(var_env)\n if (a = peek_lit(nil)).eql? ECMA262::PUNC_LCURLYBRAC\n return block(var_env)\n end\n if a.eql? ECMA262::ID_FUNCTION\n return func_declaration(var_env)\n end\n\n\n if a = exp(var_env, {})\n if semicolon(var_env)\n ECMA262::StExp.new(a)\n # There is a possibility of labelled statemet if\n # exp_statement call before labelled_statement\n else\n raise ParseError.new(\"no semicolon at end of expression statement\", self)\n end\n else\n nil\n end\n end",
"def perform\n @invalid_instruction =\n @instructions.detect do |instruction|\n instruction.match(@regexp).nil?\n end\n end",
"def bg_red; use_code(41) end",
"def flow_expression\n\n @dict.fexp\n end",
"def initialize(str)\n @expression = str\n end",
"def store_whether_this_frame_match_frame_expression current_frame_string, target, variable_name\r\n raise 'Not supported in Selenium Core at the moment'\r\n end",
"def assignment\n @name = get_name\n match '='\n expression\n emit_ln \"LEA #{@name} (PC),A0\"\n emit_ln 'MOVE D0,(A0)'\nend",
"def semi!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n type = SEMI\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 155:8: ';'\n match( 0x3b )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end",
"def qmark!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n type = QMARK\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 130:9: '?'\n match( 0x3f )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end",
"def disable_breakpoint(bp)\n bp.disable\n end",
"def parsed_expression=(value)\n @parsed_expression = value\n end",
"def source_line=(_); end",
"def is_breakpoint_deferred(ip)\r\n if !ip.kind_of? String\r\n return false\r\n end\r\n\r\n m,f = ip.split('!')\r\n\r\n if f.nil? or m.nil?\r\n return true\r\n end\r\n\r\n modules.each do |d|\r\n if d.szModule.to_s.match(/#{m}/)\r\n return false\r\n end\r\n end\r\n\r\n return true\r\n end",
"def asignacion!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n\n\n type = ASIGNACION\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 309:3: '='\n match( 0x3d )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n\n end",
"def debug=(value); end",
"def code\n @code\n end",
"def code\n @code\n end",
"def t__149!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 93 )\n\n type = T__149\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 214:10: 'firefox'\n match( \"firefox\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 93 )\n\n end",
"def breakpoints\n @breakpoints ||= []\n end",
"def jump(address)\n @pc = address\n end",
"def test_test_el__debug_ruby_eval_report\n actual = with_temp_buffer_string {\n el4r_lisp_eval %q((progn\n(el4r-debug-ruby-eval-report \"nil\")\n(el4r-debug-ruby-eval-report \"true\")\n(el4r-debug-ruby-eval-report \"false\")\n(el4r-debug-ruby-eval-report \"1 + 6\")\n(el4r-debug-ruby-eval-report \"\\\"String\\\"\")\n))\n }\n expected = <<EOB\nnil\n => nil\ntrue\n => t\nfalse\n => nil\n1 + 6\n => 7\n\"String\"\n => \"String\"\nEOB\n assert_equal(expected, actual)\n end",
"def t__13!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 4)\n\n type = T__13\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 19:9: '::='\n match(\"::=\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 4)\n\n end",
"def statement\n case @enum.peek.value\n when 'break'\n break_statement\n when 'continue'\n continue_statement\n when 'if'\n if_statement\n when 'printf'\n printf_func_call\n when 'return'\n return_statement\n when 'scanf'\n scanf_func_call\n when 'while'\n while_statement\n else\n if @local.include?(@enum.peek.value)\n @instruction.push('local[' + @local.index(@enum.peek.value).to_s + ']')\n elsif @global.include?(@enum.peek.value)\n @instruction.push('global[' + @global.index(@enum.peek.value).to_s + ']')\n else\n @instruction.push(@enum.peek.value)\n end\n match(:identifier)\n statement_tail\n end\n end",
"def t__45!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n\n\n\n type = T__45\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 22:9: '/='\n match( \"/=\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 16 )\n\n\n end",
"def code\n @code\n end",
"def code\n @code\n end"
] |
[
"0.6343736",
"0.6342272",
"0.6135151",
"0.5978265",
"0.5975826",
"0.59049606",
"0.58666414",
"0.54781944",
"0.5375797",
"0.53199506",
"0.5250446",
"0.52364224",
"0.5160919",
"0.5148373",
"0.50811243",
"0.5078002",
"0.5035016",
"0.49991992",
"0.4967007",
"0.4914151",
"0.49066538",
"0.4767354",
"0.47457856",
"0.4721393",
"0.47094312",
"0.47070748",
"0.4702466",
"0.4693053",
"0.46564242",
"0.46302056",
"0.46214482",
"0.46141416",
"0.46123844",
"0.45958704",
"0.45957103",
"0.45916924",
"0.45739546",
"0.45699182",
"0.45278057",
"0.45265815",
"0.45207113",
"0.45194197",
"0.45151985",
"0.44966343",
"0.44862875",
"0.44770876",
"0.44769996",
"0.44579718",
"0.44492236",
"0.44390154",
"0.4434853",
"0.44345576",
"0.44301534",
"0.44169766",
"0.4404991",
"0.43790588",
"0.4370112",
"0.43629384",
"0.43554476",
"0.43533355",
"0.4349923",
"0.43482286",
"0.43481967",
"0.43429473",
"0.43385822",
"0.43385822",
"0.4319591",
"0.43093973",
"0.43002206",
"0.42998123",
"0.4289083",
"0.428612",
"0.42844138",
"0.4275943",
"0.42698872",
"0.42697763",
"0.426265",
"0.4250064",
"0.42369983",
"0.4233836",
"0.42333245",
"0.42308506",
"0.4229077",
"0.4228736",
"0.42251822",
"0.42248994",
"0.42220938",
"0.42126018",
"0.42118293",
"0.42062885",
"0.42062885",
"0.4205987",
"0.4205888",
"0.42031923",
"0.41954952",
"0.4190759",
"0.41894826",
"0.4187669",
"0.4187067",
"0.4187067"
] |
0.4518698
|
42
|
breakpoint.hit_condition > symbol Returns the hit condition of the breakpoint: +nil+ if it is an unconditional breakpoint, or :greater_or_equal, :equal, :modulo
|
def hit_condition()
#This is a stub, used for indexing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def at_breakpoint(breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold(\"Condition: \") + expr\n end",
"def at_breakpoint(_context, breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold('Condition: ') + expr\n end",
"def hit_condition= symbol\n #This is a stub, used for indexing\n end",
"def below_threshold?\n coverage < threshold\n end",
"def condition_op\n @instruction.push(@enum.peek.value)\n match(%w(&& ||).map { |t| Token.new(:symbol, t) })\n end",
"def meta_send_op_gt\n <<-CODE\n t1 = stack_pop();\n t2 = stack_back(0);\n if(FIXNUM_P(t1) && FIXNUM_P(t2)) {\n j = N2I(t1);\n k = N2I(t2);\n stack_set_top((j > k) ? Qtrue : Qfalse);\n } else {\n _lit = global->sym_gt;\n t2 = Qnil;\n j = 1;\n goto perform_no_ss_send;\n }\n CODE\n end",
"def comparison_op\n @instruction.push(@enum.peek.value)\n match(%w(== != > >= < <=).map { |t| Token.new(:symbol, t) })\n end",
"def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end",
"def >=( context )\n comparison( :>= )\n end",
"def condition\n return @condition\n end",
"def condition\n return @condition\n end",
"def breakpoint?\n type == :breakpoint\n end",
"def breakpoint?(ip)\n Rubinius.primitive :compiledmethod_is_breakpoint\n raise ArgumentError, \"Unable to retrieve breakpoint status on #{inspect} at bytecode address #{ip}\"\n end",
"def get_condition\n @condition\n end",
"def parse_condition\n condition = nil\n\n # Right now we can handle very simple unary conditions like:\n # if true\n # if false\n # if 0\n # if 100 (not 0)\n # if defined? SOME_CONSTANT\n #\n # The last case will do a lookup in the registry and then one\n # in the Ruby world (using eval).\n case statement.tokens[1..-1].to_s.strip\n when /^(\\d+)$/\n condition = $1 != \"0\"\n when /^defined\\?\\s*\\(?\\s*([A-Za-z0-9:_]+?)\\s*\\)?$/\n # defined? keyword used, let's see if we can look up the name\n # in the registry, then we'll try using Ruby's powers. eval() is not\n # *too* dangerous here since code is not actually executed.\n name = $1\n obj = YARD::Registry.resolve(namespace, name, true)\n begin\n condition = true if obj || Object.instance_eval(\"defined? #{name}\")\n rescue SyntaxError, NameError\n condition = false\n end\n when \"true\"\n condition = true\n when \"false\"\n condition = false\n end\n\n if TkUNLESS === statement.tokens.first\n condition = !condition unless condition.nil?\n end\n condition\n end",
"def condition_met?(condition)\n condition = condition.to_s.strip\n if condition == 'prod' || condition == 'production'\n production?\n\n elsif condition =~ /^>=\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n # Force false in the case where a production and development\n # timestamp fall on the same date. Since the production tag\n # does not contain time information it is impossible to say\n # which one is greater\n if production? != tag.production? && timestamp? &&\n to_date == tag.to_date\n false\n else\n numeric >= tag.numeric && ((latest? || tag.latest?) || timestamp? == tag.timestamp?)\n end\n\n elsif condition =~ /^>\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n if production? != tag.production? && timestamp? &&\n to_date == tag.to_date\n false\n else\n numeric > tag.numeric && ((latest? || tag.latest?) || timestamp? == tag.timestamp?)\n end\n\n elsif condition =~ /^<=\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n numeric <= tag.numeric && ((latest? || tag.latest?) || timestamp? == tag.timestamp?)\n\n elsif condition =~ /^<\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n numeric < tag.numeric && ((latest? || tag.latest?) || timestamp? == tag.timestamp?)\n\n elsif condition =~ /^==?\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n orig_equal?(tag)\n\n else\n tag = validate_condition!(condition, condition)\n orig_equal?(tag)\n end\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def native_hit\n 95\n end",
"def check_condition binding\n return true if condition.nil? || condition.empty?\n begin\n Evaluator.eval_condition binding, condition\n rescue\n set_error_state \"Unable to evaluate condition\",\n refers_to: :BREAKPOINT_CONDITION\n false\n end\n end",
"def test_condition(i)\n case self.rc_query\n when (:contains || :is)\n #i =~ #self.rc_regex\n when :does_not_contain\n #i =~ #self.rc_regex\n when :is_greater_than\n i > self.rc_integer_value\n when :is_less_than\n i < self.rc_integer_value \n when :equals\n i == self.rc_integer_value\n else\n false \n end\n end",
"def win_condition\nend",
"def condition_op\n match(%w(&& ||).map { |t| Token.new(:symbol, t) })\n end",
"def skip_condition_met?\n points = encounter_points_needed\n return false if $game_party.encounter_points < points\n condition = troop.skip_condition\n return false unless condition\n params = condition.parameters\n result = false\n case params[0]\n when 0 # Switch\n result = ($game_switches[params[1]] == (params[2] == 0))\n when 1 # Variable\n value1 = $game_variables[params[1]]\n if params[2] == 0\n value2 = params[3]\n else\n value2 = $game_variables[params[3]]\n end\n case params[4]\n when 0 # value1 is equal to value2\n result = (value1 == value2)\n when 1 # value1 is greater than or equal to value2\n result = (value1 >= value2)\n when 2 # value1 is less than or equal to value2\n result = (value1 <= value2)\n when 3 # value1 is greater than value2\n result = (value1 > value2)\n when 4 # value1 is less than value2\n result = (value1 < value2)\n when 5 # value1 is not equal to value2\n result = (value1 != value2)\n end\n #when 2 # Self switch\n #if @event_id > 0\n #key = [$game_map.map_id, @event_id, params[1]]\n #result = ($game_self_switches[key] == (params[2] == 0))\n #end\n when 3 # Timer\n if $game_timer.working?\n if params[2] == 0\n result = ($game_timer.sec >= params[1])\n else\n result = ($game_timer.sec <= params[1])\n end\n end\n when 4 # Actor\n actor = $game_actors[params[1]]\n if actor\n case params[2]\n when 0 # in party\n result = ($game_party.members.include?(actor))\n when 1 # name\n result = (actor.name == params[3])\n when 2 # Class\n result = (actor.class_id == params[3])\n when 3 # Skills\n result = (actor.skill_learn?($data_skills[params[3]]))\n when 4 # Weapons\n result = (actor.weapons.include?($data_weapons[params[3]]))\n when 5 # Armors\n result = (actor.armors.include?($data_armors[params[3]]))\n when 6 # States\n result = (actor.state?(params[3]))\n end\n end\n when 5 # Enemy\n enemy = $game_troop.members[params[1]]\n if enemy\n case params[2]\n when 0 # appear\n result = (enemy.alive?)\n when 1 # state\n result = (enemy.state?(params[3]))\n end\n end\n #when 6 # Character\n #character = get_character(params[1])\n #if character\n #result = (character.direction == params[2])\n #end\n when 7 # Gold\n case params[2]\n when 0 # Greater than or equal to\n result = ($game_party.gold >= params[1])\n when 1 # Less than or equal to\n result = ($game_party.gold <= params[1])\n when 2 # Less than\n result = ($game_party.gold < params[1])\n end\n when 8 # Item\n result = $game_party.has_item?($data_items[params[1]])\n when 9 # Weapon\n result = $game_party.has_item?($data_weapons[params[1]], params[2])\n when 10 # Armor\n result = $game_party.has_item?($data_armors[params[1]], params[2])\n when 11 # Button\n result = Input.press?(params[1])\n when 12 # Script\n result = eval(params[1])\n when 13 # Vehicle\n result = ($game_player.vehicle == $game_map.vehicles[params[1]])\n end\n return result\n end",
"def should_hit?\n hit = true\n @values.each { |val| hit &= !(val >= 17 && val <= 21) }\n hit\n end",
"def <=( context )\n comparison( :<= )\n end",
"def comparison_op\n match(%w(== != > >= < <=).map { |t| Token.new(:symbol, t) })\n end",
"def gt\n x, y = stack.pop(2)\n push x > y\n end",
"def condition\n expect :if\n self[1]\n end",
"def greater!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n type = GREATER\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 127:11: '>'\n match( 0x3e )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end",
"def condition; end",
"def cond; end",
"def cond; end",
"def cond; end",
"def health_below_threshold?\n (plugins[Character].current_health.to_f / plugins[Character].total_health.to_f) * 100 < @health_threshold_percentage\n end",
"def if_condition; end",
"def below(x)\n return 'below' if x>0\n return 'above'\n end",
"def condition\n node.condition\n end",
"def hit_or_miss\n\t\t\treturn :win if value = svalue\n\t\t\treturn :miss if value = none_empty\n\t\tend",
"def >=(p0) end",
"def >=(p0) end",
"def >=(p0) end",
"def set_breakpoint(source, pos, condition = nil)\n #This is a stub, used for indexing\n end",
"def isLoose?\r\n @hitpoint <= 0\r\n end",
"def isLoose?\r\n @hitpoint <= 0\r\n end",
"def test_execute_threshold(value = 1)\n if value == @threshold\n then return true\n end\n return false\n end",
"def threshold\n @threshold || 95\n end",
"def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end",
"def assert_greater_than(lhs, rhs, message = \"\")\n assert_operator(lhs, :>, rhs, message)\n end",
"def above?(type)\n (!config[:below]) && (@data > config[type])\n end",
"def >( context )\n comparison( :> )\n end",
"def above?(type, val)\n !config[:below] && (val > config[type])\n end",
"def jump(line)\n return line[/(JGT)|(JEQ)|(JGE)|(JLT)|(JNE)|(JLE)|(JMP)/]\n end",
"def win? color\n return true if @took[color] >= 10\n fives = fives(color)\n return false if fives.empty?\n return true if ENV[\"DISABLE_BREAK5\"] == \"true\"\n # breakables = fives.map{|five| breakable_in(five, color)}\n return true if fives.map{|b| breakable_capturable?(b) }.inject(&:&) == false\n # moves = breakables.inject(&:&) || []\n # return true if moves.empty? # win if cannot break all with one mov\n return false\n end",
"def inspect_condition(c)\n pc = c.parsed_condition\n\n ctag_count[[c.parent, c.tag]] += 1\n\n pending_question(pc.qtag, c) if pc.qtag\n pending_answer(pc.qtag, pc.atag, c) if pc.qtag && pc.atag\n end",
"def bust?; value > 21; end",
"def gte!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n\n\n type = GTE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 31:6: '>='\n match( \">=\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n\n end",
"def symptom_passes_threshold(symptom_name, threshold_symptom = nil)\n reported_symptom = reported_condition&.symptoms&.select { |symp| symp.name == symptom_name }&.first\n # This will be the case if a symptom is no longer being tracked and the assessments table is looking for its value\n return nil if reported_symptom.nil? || reported_symptom.value.nil?\n\n threshold_symptom = get_threshold_symptom(symptom_name) if threshold_symptom.nil?\n return false unless threshold_symptom&.required?\n\n return nil if threshold_symptom.nil? || threshold_symptom.value.nil?\n\n threshold_operator = threshold_symptom&.threshold_operator&.downcase\n threshold_operator ||= 'less than'\n\n case reported_symptom.type\n when 'FloatSymptom', 'IntegerSymptom'\n return true if threshold_operator == 'less than' && reported_symptom.value < threshold_symptom.value\n return true if threshold_operator == 'less than or equal' && reported_symptom.value <= threshold_symptom.value\n return true if threshold_operator == 'greater than' && reported_symptom.value > threshold_symptom.value\n return true if threshold_operator == 'greater than or equal' && reported_symptom.value >= threshold_symptom.value\n return true if threshold_operator == 'equal' && reported_symptom.value == threshold_symptom.value\n return true if threshold_operator == 'not equal' && reported_symptom.value != threshold_symptom.value\n when 'BoolSymptom'\n return reported_symptom.value != threshold_symptom.value if threshold_operator == 'not equal'\n # Bool symptom threshold_operator will fall back to equal\n return true if reported_symptom.value == threshold_symptom.value\n end\n false\n end",
"def symptom_passes_threshold(reported_symptom, threshold_symptom = nil)\n # This will be the case if a symptom is no longer being tracked and the assessments table is looking for its value\n return nil if reported_symptom.nil? || reported_symptom.value.nil?\n\n threshold_symptom = get_threshold_symptom(reported_symptom.name) if threshold_symptom.nil?\n return false unless threshold_symptom&.required?\n\n return nil if threshold_symptom.nil? || threshold_symptom.value.nil?\n\n threshold_operator = threshold_symptom&.threshold_operator&.downcase\n threshold_operator ||= 'less than'\n\n case reported_symptom.type\n when 'FloatSymptom', 'IntegerSymptom'\n return true if threshold_operator == 'less than' && reported_symptom.value < threshold_symptom.value\n return true if threshold_operator == 'less than or equal' && reported_symptom.value <= threshold_symptom.value\n return true if threshold_operator == 'greater than' && reported_symptom.value > threshold_symptom.value\n return true if threshold_operator == 'greater than or equal' && reported_symptom.value >= threshold_symptom.value\n return true if threshold_operator == 'equal' && reported_symptom.value == threshold_symptom.value\n return true if threshold_operator == 'not equal' && reported_symptom.value != threshold_symptom.value\n when 'BoolSymptom'\n return reported_symptom.value != threshold_symptom.value if threshold_operator == 'not equal'\n # Bool symptom threshold_operator will fall back to equal\n return true if reported_symptom.value == threshold_symptom.value\n end\n false\n end",
"def assert_greater_than_or_equal_to(lhs, rhs, message = \"\")\n assert_operator(lhs, :>=, rhs, message)\n end",
"def conditional\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 48 )\n return_value = ConditionalReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal226 = nil\n char_literal227 = nil\n t = nil\n f = nil\n logical_or225 = nil\n\n tree_for_char_literal226 = nil\n tree_for_char_literal227 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 577:5: logical_or ( '?' t= expression ':' f= expression )?\n @state.following.push( TOKENS_FOLLOWING_logical_or_IN_conditional_3808 )\n logical_or225 = logical_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_or225.tree )\n end\n # at line 577:16: ( '?' t= expression ':' f= expression )?\n alt_51 = 2\n look_51_0 = @input.peek( 1 )\n\n if ( look_51_0 == QMARK )\n alt_51 = 1\n end\n case alt_51\n when 1\n # at line 577:19: '?' t= expression ':' f= expression\n char_literal226 = match( QMARK, TOKENS_FOLLOWING_QMARK_IN_conditional_3813 )\n if @state.backtracking == 0\n\n tree_for_char_literal226 = @adaptor.create_with_payload( char_literal226 )\n root_0 = @adaptor.become_root( tree_for_char_literal226, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_conditional_3819 )\n t = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, t.tree )\n end\n char_literal227 = match( COLON, TOKENS_FOLLOWING_COLON_IN_conditional_3822 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_conditional_3828 )\n f = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, f.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 48 )\n\n end\n \n return return_value\n end",
"def parse_condition; end",
"def parse_condition; end",
"def parse_condition(exp); end",
"def ge\n x, y = stack.pop(2)\n push x >= y\n end",
"def print_full_breakpoint(breakpoint)\n header = \"Breakpoint #{breakpoint.id}:\"\n status = breakpoint.enabled? ? \"Enabled\" : \"Disabled\"\n code = breakpoint.source_code.with_line_numbers.to_s\n condition = if breakpoint.expr\n \"#{bold('Condition:')} #{breakpoint.expr}\\n\"\n else\n \"\"\n end\n\n output.puts <<-BREAKPOINT.gsub(/ {8}/, \"\")\n\n #{bold(header)} #{breakpoint} (#{status}) #{condition}\n\n #{code}\n\n BREAKPOINT\n end",
"def checkGtir(before, after, instruction)\n\ta = instruction[1] #val\n\tb = instruction[2] #reg\n\tc = instruction[3] #reg\n\n\treturn (after[c] == 1 && a > before[b]) || (after[c] == 0 && a <= before[b])\nend",
"def cond_stack; end",
"def cond_stack; end",
"def cond_stack; end",
"def conditions_met?(page)\n\t\tvalue = ee_conditions_met?(page)\n\t\tfirst = first_is_comment?(page)\n\t\treturn value unless first\n\t\tcondition_comment = true\n\t\tif first =~ /^Trigger\\s*:\\s*(.+)/\n\t\t\ttrigger_data = $~[1]\n\t\t\tcondition_comment = self.send(:eval, trigger_data)\n\t\tend\n\t\treturn value && condition_comment\n\tend",
"def complex_condition?(condition); end",
"def below?(type, val)\n config[:below] && val < config[type]\n end",
"def func_gt(args)\n p1 = _eval(car(args))\n p2 = _eval(car(cdr(args)))\n\n if p1.type != LObject::OBJ_INTEGER or p2.type != LObject::OBJ_INTEGER\n if @lint\n Error.warn(\"warning: comparison with a non integer operand\")\n end\n return @o_man.nil\n end\n\n if (p1.value.i > p2.value.i)\n return @o_man.t\n end\n\n return @o_man.nil\n end",
"def specific?\n return true if @requirements.length > 1 # GIGO, > 1, > 2 is silly\n\n not %w[> >=].include? @requirements.first.first # grab the operator\n end",
"def non_complex_expression?(condition); end",
"def condition\n if @local\n @condition\n else\n Condition.convert(Cproton.pn_disposition_condition(@impl))\n end\n end",
"def >=(var_RValue)\n Common::Logger.print(Common::VAR_DEBUG, self, \"[>=]: Executing for: [#{self.to_s()}] >= [#{var_RValue.to_s()}]\")\n \n raise SyntaxError.new(\"[#{var_RValue.class.to_s()}] can't be coerced into [#{self.class.to_s()}] \")\n end",
"def hit_by?(enemyprojectile)\r\n @hurt = enemyprojectile.any? {|enemyprojectile| Gosu::distance(enemyprojectile.x, enemyprojectile.y, @x+88, @y+88) < 50}\r\n\r\n if @hurt\r\n @hp = @hp - 20\r\n #@score += 11 #<-------------works for score\r\n end\r\n end",
"def execute_JGE(operand) # Same as the JNL instruction\n\t\tis_greater_than = @flags.value[SIGN_FLAG] == @flags.value[OVERFLOW_FLAG]\n\t\tjump_conditionally_to_signed_displacement(operand, is_greater_than)\n\tend",
"def hit_or_miss (guess)\n\t\tguess === \"hit\"? \"X\" : \"0\";\n\tend",
"def probability_greater_than_or_equal(value)\n probability_for_sides(:>=, value)\n end",
"def hit_obstacle?\n future_distance = 5\n self.y -= 2 # Prevent hitting the floor.\n left_thing = what_object_hit_me_on_the :side => :right, :restrict => Unpassable, :look_ahead => 5, :margin_of_error => 25\n right_thing = what_object_hit_me_on_the :side => :left, :restrict => Unpassable, :look_ahead => 5, :margin_of_error => 25\n self.y += 2\n left_thing || right_thing\n end",
"def broken(tool_condition) #allow the tool class to be use through the parameter\n if @item_health == 0 && tool_condition.tool_health == 0 #when both health reach 0 at the same time\n puts \"Both #{@item_name} and #{tool_condition.tool_name} break at the same time!\"\n elsif @item_health <= 0 #when the item's health is 0 or below 0 before the tool's health\n puts \"The #{@item_name} breaks first!\"\n elsif tool_condition.tool_health <= 0 #when the tool's health reaches 0 or below 0 before the item's health\n puts \"Your #{tool_condition.tool_name} breaks first!\"\n else\n puts \"Nothing breaks. \\nYour #{tool_condition.tool_name}'s health is now #{tool_condition.tool_health}. \\nThe #{@item_name}'s health is now #{@item_health}.\"\n end\n end",
"def scope_condition() \"1\" end",
"def must_hit\n return true if @hand.point != \"Blackjack\" && @hand.point <= 16\n return false\n end",
"def ternary_condition(value)\n\t\tis_strike?(value) ? 10 : value\n\tend",
"def not_safe?(speed)\n\tspeed > 60 || speed < 40 ? true: false\nend",
"def condition\n condition = item_attribute('yweather:condition')\n translate! do_convertions(condition, [:code, :to_i], [:temp, :to_i], [:date, :to_date], :text)\n end",
"def hungry?\n@stuff_in_belly <= 2\nend",
"def below?(type)\n config[:below] && @data < config[type]\n end",
"def check_break?(hand_value)\n hand_value > 21 ? true : false\nend",
"def timeline_gt_80_pc?(risk_register)\n created_at = Date.parse(risk_register.created_at.strftime(\"%Y-%m-%d\"))\n target_date = risk_register.target_date\n today = Date.today\n \n timeline = date_difference(created_at, target_date)\n remaining_days = date_difference(today, target_date)\n \n eighty_pc = timeline - (timeline * 0.8)\n \n return remaining_days <= eighty_pc && remaining_days >= 0\n end",
"def unsafe?(speed)\n\t# binding.pry\n\tif speed < 40 || speed > 60\n\t\treturn true\n\tend\n\treturn false\nend",
"def not_safe?(speed)\n\tspeed < 40 || speed > 60 ? true : false\nend",
"def not_safe?(speed)\n\tspeed < 40 || speed > 60 ? true : false\nend",
"def condition\n self.class.const_defined?(:CONDITION) ? Regexp.new(self.class.const_get(:CONDITION)) : @on\n end",
"def standing_on_platform\n return nil if falling? or jumping?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end",
"def gt(min)\n Rule.new error: [:not_gt, min], predicate: -> { _1 > min }\n end"
] |
[
"0.65352756",
"0.6514767",
"0.6458988",
"0.5585574",
"0.5547592",
"0.54225415",
"0.537794",
"0.5352983",
"0.53435326",
"0.5325748",
"0.5325748",
"0.5314808",
"0.53116083",
"0.5271799",
"0.5253159",
"0.52375305",
"0.5230157",
"0.5230157",
"0.5230157",
"0.5215123",
"0.52122414",
"0.51999396",
"0.5197625",
"0.5190962",
"0.51879036",
"0.51765263",
"0.51629144",
"0.51492023",
"0.5140559",
"0.5095077",
"0.50933534",
"0.50903535",
"0.50896406",
"0.50896406",
"0.50896406",
"0.5078424",
"0.50781476",
"0.50711477",
"0.50661147",
"0.5051039",
"0.50507265",
"0.50507265",
"0.50507265",
"0.5049397",
"0.50480926",
"0.50480926",
"0.50429535",
"0.503602",
"0.502881",
"0.5023727",
"0.5017153",
"0.4986253",
"0.49802715",
"0.4970811",
"0.4961976",
"0.49570045",
"0.49551266",
"0.4944803",
"0.4944454",
"0.4940718",
"0.49268577",
"0.4919837",
"0.4918779",
"0.4918779",
"0.48975635",
"0.4891396",
"0.48839483",
"0.4883465",
"0.48722026",
"0.48722026",
"0.48722026",
"0.48673683",
"0.4839603",
"0.4835544",
"0.4814857",
"0.48049098",
"0.48030907",
"0.4800028",
"0.47999096",
"0.47935647",
"0.47812486",
"0.47751155",
"0.47597933",
"0.47556138",
"0.4754691",
"0.4752856",
"0.47520727",
"0.47482055",
"0.47416198",
"0.47354576",
"0.47350064",
"0.4733949",
"0.47237596",
"0.47106922",
"0.46875164",
"0.4673279",
"0.4673279",
"0.46681866",
"0.46669388",
"0.46652812"
] |
0.61762595
|
3
|
breakpoint.hit_condition = symbol Sets the hit condition of the breakpoint which must be one of the following values: +nil+ if it is an unconditional breakpoint, or :greater_or_equal(:ge), :equal(:eq), :modulo(:mod)
|
def hit_condition= symbol
#This is a stub, used for indexing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def at_breakpoint(breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold(\"Condition: \") + expr\n end",
"def at_breakpoint(_context, breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold('Condition: ') + expr\n end",
"def hit_condition()\n #This is a stub, used for indexing\n end",
"def set_breakpoint(source, pos, condition = nil)\n #This is a stub, used for indexing\n end",
"def set_breakpoint(cm, ip, condition=nil)\n @breakpoint_tracker.on(cm, :ip => ip, :condition => condition)\n end",
"def breakpoint?(ip)\n Rubinius.primitive :compiledmethod_is_breakpoint\n raise ArgumentError, \"Unable to retrieve breakpoint status on #{inspect} at bytecode address #{ip}\"\n end",
"def breakpoint?\n type == :breakpoint\n end",
"def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end",
"def break(breakpoint)\n if ::Thread.current[:breakpoints] &&\n ::Thread.current[:breakpoints].include?(breakpoint)\n ::Thread.current[:breakpoints_reached] << breakpoint\n puts \"breaking on #{breakpoint}\"\n self.main_thread.run\n ::Thread.stop\n end\n end",
"def set_breakpoint(ip, obj)\n Rubinius.primitive :compiledmethod_set_breakpoint\n raise ArgumentError, \"Unable to set breakpoint on #{inspect} at invalid bytecode address #{ip}\"\n end",
"def check_condition binding\n return true if condition.nil? || condition.empty?\n begin\n Evaluator.eval_condition binding, condition\n rescue\n set_error_state \"Unable to evaluate condition\",\n refers_to: :BREAKPOINT_CONDITION\n false\n end\n end",
"def print_full_breakpoint(breakpoint)\n header = \"Breakpoint #{breakpoint.id}:\"\n status = breakpoint.enabled? ? \"Enabled\" : \"Disabled\"\n code = breakpoint.source_code.with_line_numbers.to_s\n condition = if breakpoint.expr\n \"#{bold('Condition:')} #{breakpoint.expr}\\n\"\n else\n \"\"\n end\n\n output.puts <<-BREAKPOINT.gsub(/ {8}/, \"\")\n\n #{bold(header)} #{breakpoint} (#{status}) #{condition}\n\n #{code}\n\n BREAKPOINT\n end",
"def if_condition; end",
"def condition=(value)\n @condition = value\n end",
"def condition=(value)\n @condition = value\n end",
"def enable_breakpoint(bp)\n bp.enable\n end",
"def set_breakpoint(cm, ip)\n @breakpoint_tracker.on(cm, :ip => ip)\n end",
"def condition; end",
"def win_condition\nend",
"def breakpoint binding; IRB.start_with_binding binding end",
"def cond; end",
"def cond; end",
"def cond; end",
"def condition_op\n @instruction.push(@enum.peek.value)\n match(%w(&& ||).map { |t| Token.new(:symbol, t) })\n end",
"def get_condition\n @condition\n end",
"def test_condition(i)\n case self.rc_query\n when (:contains || :is)\n #i =~ #self.rc_regex\n when :does_not_contain\n #i =~ #self.rc_regex\n when :is_greater_than\n i > self.rc_integer_value\n when :is_less_than\n i < self.rc_integer_value \n when :equals\n i == self.rc_integer_value\n else\n false \n end\n end",
"def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end",
"def breakpoint!(text='Click anywhere to continue...', timeout=0)\n puts \">> breakpoint reached. click anywhere in the browser to continue\"\n\n text = text.gsub(\"\\\"\", \"\\\\\\\"\")\n\n execute_scopejs_script %(\n document.body.appendChild(div(\n {\n id: '_breakpoint_overlay',\n style: 'background-color: rgba(0, 0, 0, 0.6); position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; text-align: center;',\n onClick: function() { App.remove_element('_breakpoint_overlay'); }\n },\n p({ style: 'margin: 150px 100px; line-height: 60px; font-size: 50px; color: white; text-shadow: 3px 3px #000' }, \"#{text}\"))\n );\n if (#{timeout} > 0) setTimeout(function() {\n var e = document.getElementById('_breakpoint_overlay');\n e.parentNode.removeChild(e);\n }, #{timeout});\n console.log(\"** Breakpoint reached **\");\n )\n\n while execute_scopejs_script(\"return document.getElementById('_breakpoint_overlay');\") do\n sleep 0.25 # waiting a little\n end\n\n puts \">> continuing from breakpoint\"\n end",
"def breakpoint()\n #This is a stub, used for indexing\n end",
"def should_hit?\n hit = true\n @values.each { |val| hit &= !(val >= 17 && val <= 21) }\n hit\n end",
"def condition\n return @condition\n end",
"def condition\n return @condition\n end",
"def native_hit\n 95\n end",
"def condition\n expect :if\n self[1]\n end",
"def hit_or_miss\n\t\t\treturn :win if value = svalue\n\t\t\treturn :miss if value = none_empty\n\t\tend",
"def condition(condition)\n @storage[:condition] = condition\n end",
"def condition=(cond)\n @queue << \"condition #{cond}\"\n end",
"def run(args, temp=false)\n\n arg_str = args.size == 1 ? @proc.frame.line.to_s : @proc.cmd_argstr\n cm, line, ip, condition, negate = \n @proc.breakpoint_position(arg_str, true)\n if cm\n event = temp ? 'tbrkpt' : 'brkpt'\n opts={:event => event, :temp => temp, :condition => condition, \n :negate => negate}\n bp = @proc.set_breakpoint_method(cm, line, ip, opts)\n bp.set_temp! if temp\n return bp\n end\n end",
"def pass_in_breakpoint!(temporal_type, task)\n if task[:breakpoint]\n case task.temporal_type\n when :sequential\n if subtask = task.subtasks.first\n subtask[:breakpoint] = true\n end\n when :concurrent\n task.subtasks.map { |subtask| subtask[:breakpoint] = true }\n end\n end\n end",
"def break?\n @break\n end",
"def inspect_condition(c)\n pc = c.parsed_condition\n\n ctag_count[[c.parent, c.tag]] += 1\n\n pending_question(pc.qtag, c) if pc.qtag\n pending_answer(pc.qtag, pc.atag, c) if pc.qtag && pc.atag\n end",
"def get_breakpoint(cm, ip)\n @breakpoint_tracker.get_breakpoint(cm, ip)\n end",
"def condition\n self.class.const_defined?(:CONDITION) ? Regexp.new(self.class.const_get(:CONDITION)) : @on\n end",
"def cond_stack; end",
"def cond_stack; end",
"def cond_stack; end",
"def waiting_for_breakpoint?\n @breakpoint_listener.status == 'sleep'\n end",
"def conditions_met?(page)\n\t\tvalue = ee_conditions_met?(page)\n\t\tfirst = first_is_comment?(page)\n\t\treturn value unless first\n\t\tcondition_comment = true\n\t\tif first =~ /^Trigger\\s*:\\s*(.+)/\n\t\t\ttrigger_data = $~[1]\n\t\t\tcondition_comment = self.send(:eval, trigger_data)\n\t\tend\n\t\treturn value && condition_comment\n\tend",
"def parse_condition\n condition = nil\n\n # Right now we can handle very simple unary conditions like:\n # if true\n # if false\n # if 0\n # if 100 (not 0)\n # if defined? SOME_CONSTANT\n #\n # The last case will do a lookup in the registry and then one\n # in the Ruby world (using eval).\n case statement.tokens[1..-1].to_s.strip\n when /^(\\d+)$/\n condition = $1 != \"0\"\n when /^defined\\?\\s*\\(?\\s*([A-Za-z0-9:_]+?)\\s*\\)?$/\n # defined? keyword used, let's see if we can look up the name\n # in the registry, then we'll try using Ruby's powers. eval() is not\n # *too* dangerous here since code is not actually executed.\n name = $1\n obj = YARD::Registry.resolve(namespace, name, true)\n begin\n condition = true if obj || Object.instance_eval(\"defined? #{name}\")\n rescue SyntaxError, NameError\n condition = false\n end\n when \"true\"\n condition = true\n when \"false\"\n condition = false\n end\n\n if TkUNLESS === statement.tokens.first\n condition = !condition unless condition.nil?\n end\n condition\n end",
"def __binding_condition__() @__binding_condition__ ||= LOCK.new_cond end",
"def scope_condition() \"1\" end",
"def complex_condition?(condition); end",
"def hit; end",
"def parse_condition; end",
"def parse_condition; end",
"def jump(line)\n return line[/(JGT)|(JEQ)|(JGE)|(JLT)|(JNE)|(JLE)|(JMP)/]\n end",
"def skip_condition_met?\n points = encounter_points_needed\n return false if $game_party.encounter_points < points\n condition = troop.skip_condition\n return false unless condition\n params = condition.parameters\n result = false\n case params[0]\n when 0 # Switch\n result = ($game_switches[params[1]] == (params[2] == 0))\n when 1 # Variable\n value1 = $game_variables[params[1]]\n if params[2] == 0\n value2 = params[3]\n else\n value2 = $game_variables[params[3]]\n end\n case params[4]\n when 0 # value1 is equal to value2\n result = (value1 == value2)\n when 1 # value1 is greater than or equal to value2\n result = (value1 >= value2)\n when 2 # value1 is less than or equal to value2\n result = (value1 <= value2)\n when 3 # value1 is greater than value2\n result = (value1 > value2)\n when 4 # value1 is less than value2\n result = (value1 < value2)\n when 5 # value1 is not equal to value2\n result = (value1 != value2)\n end\n #when 2 # Self switch\n #if @event_id > 0\n #key = [$game_map.map_id, @event_id, params[1]]\n #result = ($game_self_switches[key] == (params[2] == 0))\n #end\n when 3 # Timer\n if $game_timer.working?\n if params[2] == 0\n result = ($game_timer.sec >= params[1])\n else\n result = ($game_timer.sec <= params[1])\n end\n end\n when 4 # Actor\n actor = $game_actors[params[1]]\n if actor\n case params[2]\n when 0 # in party\n result = ($game_party.members.include?(actor))\n when 1 # name\n result = (actor.name == params[3])\n when 2 # Class\n result = (actor.class_id == params[3])\n when 3 # Skills\n result = (actor.skill_learn?($data_skills[params[3]]))\n when 4 # Weapons\n result = (actor.weapons.include?($data_weapons[params[3]]))\n when 5 # Armors\n result = (actor.armors.include?($data_armors[params[3]]))\n when 6 # States\n result = (actor.state?(params[3]))\n end\n end\n when 5 # Enemy\n enemy = $game_troop.members[params[1]]\n if enemy\n case params[2]\n when 0 # appear\n result = (enemy.alive?)\n when 1 # state\n result = (enemy.state?(params[3]))\n end\n end\n #when 6 # Character\n #character = get_character(params[1])\n #if character\n #result = (character.direction == params[2])\n #end\n when 7 # Gold\n case params[2]\n when 0 # Greater than or equal to\n result = ($game_party.gold >= params[1])\n when 1 # Less than or equal to\n result = ($game_party.gold <= params[1])\n when 2 # Less than\n result = ($game_party.gold < params[1])\n end\n when 8 # Item\n result = $game_party.has_item?($data_items[params[1]])\n when 9 # Weapon\n result = $game_party.has_item?($data_weapons[params[1]], params[2])\n when 10 # Armor\n result = $game_party.has_item?($data_armors[params[1]], params[2])\n when 11 # Button\n result = Input.press?(params[1])\n when 12 # Script\n result = eval(params[1])\n when 13 # Vehicle\n result = ($game_player.vehicle == $game_map.vehicles[params[1]])\n end\n return result\n end",
"def waiting_for_breakpoint?\n @breakpoint_listener.status == 'sleep'\n end",
"def get_breakpoint(cm, ip)\n @breakpoint_tracker.get_breakpoint(cm, ip)\n end",
"def scope_condition() {} end",
"def condition_op\n match(%w(&& ||).map { |t| Token.new(:symbol, t) })\n end",
"def define_condition(&blk)\n @condition_defined = true\n define_singleton_method :invoke_condition, &blk\n end",
"def test_that_cell_status_changes_when_hit\n c = Cell.new\n assert_equal(\"missed\", c.if_hit())\n end",
"def breakpoint_line(line_number, initial_iseq, temp=false)\n # FIXME: handle breakpoint conditions.\n found_iseq = initial_iseq.child_iseqs.detect do |iseq|\n iseq.lineoffsets.keys.member?(line_number)\n end\n unless found_iseq\n found_iseq = initial_iseq.parent\n while found_iseq do\n break if found_iseq.lineoffsets.keys.member?(line_number)\n found_iseq = found_iseq.parent\n end\n end\n offset =\n if found_iseq\n # FIXME\n found_iseq.line2offsets(line_number)[1] ||\n found_iseq.line2offsets(line_number)[0]\n else\n nil\n end\n unless offset\n place = \"in #{iseq.source_container.join(' ')} \" if found_iseq\n errmsg(\"No line #{line_number} found #{place}for breakpoint.\")\n return nil\n end\n @brkpts.add(found_iseq, offset, :temp => temp)\n end",
"def condition\n if @local\n @condition\n else\n Condition.convert(Cproton.pn_disposition_condition(@impl))\n end\n end",
"def expect(symbol)\n raise HtmlConditionalComment::ParseError.new(\"Expected #{symbol}, received #{@symbol}\", @value) unless accept(symbol)\n end",
"def parse_condition(exp); end",
"def condition= new_condition\n new_condition = Condition.new(**new_condition) if new_condition.is_a? Hash\n if new_condition && !new_condition.is_a?(Condition)\n raise ArgumentError, \"expected Condition, not #{new_condition.inspect}\"\n end\n @condition = new_condition\n end",
"def test_execute_threshold(value = 1)\n if value == @threshold\n then return true\n end\n return false\n end",
"def condition(condition_code)\n VehicleTranslator.condition(condition_code)\n end",
"def below_threshold?\n coverage < threshold\n end",
"def conditionally(*) end",
"def conditionally(*) end",
"def is_breakpoint_deferred(ip)\r\n if !ip.kind_of? String\r\n return false\r\n end\r\n\r\n m,f = ip.split('!')\r\n\r\n if f.nil? or m.nil?\r\n return true\r\n end\r\n\r\n modules.each do |d|\r\n if d.szModule.to_s.match(/#{m}/)\r\n return false\r\n end\r\n end\r\n\r\n return true\r\n end",
"def breakpoint_position(args)\n first = args.shift\n name, container, position = parse_position(first, nil, true)\n if container && position\n iseq = find_iseqs_with_lineno(container[1], position) || object_iseq(first)\n unless iseq\n if @frame.iseq && \n File.basename(@frame.iseq.source_container[1]) == \n File.basename(container[1])\n iseq = @frame.iseq\n else\n errmsg(\"Unable to find instruction sequence for\" + \n \" position #{position} in #{container[1]}\")\n return [nil, nil, nil, true]\n end\n end\n if args.empty? || 'if' == args[0]\n use_offset = false \n else\n position, use_offset = parse_num_or_offset(args[0])\n end\n else\n iseq = object_iseq(first)\n position_str = \n if iseq\n # Got name and possibly position\n name = first\n if args.empty? \n # FIXME: *Still* have a bug stopping at offset 0.\n # So stop at next offset after 0.\n # 'o0' \n \"o#{@frame.iseq.offsetlines.keys.sort[1]}\"\n else\n args.shift\n end\n else\n iseq = @frame.iseq unless container\n first\n end\n position, use_offset = parse_num_or_offset(position_str)\n end\n condition = 'true'\n if args.size > 0 && 'if' == args[0] \n condition_try = args[1..-1].join(' ')\n condition = condition_try if valid_condition?(condition_try)\n end\n return [position, iseq, use_offset, condition, name]\n end",
"def run(args)\n\n ## FIXME: DRY this code, tbreak and break.\n unless args.size == 1\n cm, line, ip, condition, negate = \n @proc.breakpoint_position(@proc.cmd_argstr, false)\n if cm\n opts={:event => 'tbrkpt', :temp => true}\n bp = @proc.set_breakpoint_method(cm, line, ip, opts)\n bp.set_temp!\n else\n errmsg \"Trouble setting temporary breakpoint\"\n return \n end\n end\n @proc.continue('continue')\n end",
"def break=(point)\n @queue << \"break #{point}\"\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def breakpoint_position(position_str, allow_condition)\n break_cmd_parse = if allow_condition\n parse_breakpoint(position_str)\n else\n parse_breakpoint_no_condition(position_str)\n end\n return [nil] * 5 unless break_cmd_parse\n tail = [break_cmd_parse.condition, break_cmd_parse.negate]\n meth_or_frame, file, position, offset_type =\n parse_position(break_cmd_parse.position)\n if meth_or_frame\n if iseq = meth_or_frame.iseq\n iseq, line_no, vm_offset =\n position_to_line_and_offset(iseq, file, position,\n offset_type)\n if vm_offset && line_no\n return [iseq, line_no, vm_offset] + tail\n end\n else\n errmsg(\"Unable to set breakpoint in #{meth_or_frame}\")\n end\n elsif file && position\n if :line == offset_type\n iseq = find_iseqs_with_lineno(file, position)\n if iseq\n junk, line_no, vm_offset =\n position_to_line_and_offset(iseq, file, position,\n offset_type)\n return [@frame.iseq, line_no, vm_offset] + tail\n else\n errmsg(\"Unable to find instruction sequence for\" +\n \" position #{position} in #{file}\")\n end\n else\n errmsg \"Come back later...\"\n end\n elsif @frame.respond_to?(:file) and @frame.file == file\n puts \"parsing line and offset #{position}, #{offset_type}\"\n line_no, vm_offset = position_to_line_and_offset(@frame.iseq, position,\n offset_type)\n return [@frame.iseq, line_no, vm_offset] + tail\n else\n errmsg(\"Unable to parse breakpoint position #{position_str}\")\n end\n return [nil] * 5\n end",
"def setup_timed_hit\n @timed_hit = nil\n if @acts[1].class == Hash\n @timed_hit_setup = TIMED_HIT_SETUP.merge(@acts[1])\n return\n end\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] = @acts[1]\n button = (@acts[2].nil? ? [TIMED_HIT_DEFAULT_BUTTON] : @acts[2])\n button = [button] unless button.is_a?(Array)\n @timed_hit_setup[TIMED_HIT_BUTTON_SYMBOL] = button\n @timed_hit_setup[TIMED_HIT_ANIME_SYMBOL] = @acts[3] || TimedHit_Anim\n @timed_hit_setup[TIMED_HIT_ANIME_FOLLOW] = (@acts[4].nil? ? true : @acts[4])\n end",
"def non_complex_expression?(condition); end",
"def condition_met?(condition)\n condition = condition.to_s.strip\n if condition == 'prod' || condition == 'production'\n production?\n\n elsif condition =~ /^>=\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n # Force false in the case where a production and development\n # timestamp fall on the same date. Since the production tag\n # does not contain time information it is impossible to say\n # which one is greater\n if production? != tag.production? && timestamp? &&\n to_date == tag.to_date\n false\n else\n numeric >= tag.numeric && ((latest? || tag.latest?) || timestamp? == tag.timestamp?)\n end\n\n elsif condition =~ /^>\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n if production? != tag.production? && timestamp? &&\n to_date == tag.to_date\n false\n else\n numeric > tag.numeric && ((latest? || tag.latest?) || timestamp? == tag.timestamp?)\n end\n\n elsif condition =~ /^<=\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n numeric <= tag.numeric && ((latest? || tag.latest?) || timestamp? == tag.timestamp?)\n\n elsif condition =~ /^<\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n numeric < tag.numeric && ((latest? || tag.latest?) || timestamp? == tag.timestamp?)\n\n elsif condition =~ /^==?\\s*(.*)/\n tag = validate_condition!(condition, Regexp.last_match[1])\n orig_equal?(tag)\n\n else\n tag = validate_condition!(condition, condition)\n orig_equal?(tag)\n end\n end",
"def print_short_breakpoint(breakpoint)\n id = format(\"%*d\", max_width, breakpoint.id)\n status = breakpoint.enabled? ? \"Yes\" : \"No \"\n expr = breakpoint.expr ? \" #{breakpoint.expr} \" : \"\"\n\n output.puts(\" #{id} #{status} #{breakpoint}#{expr}\")\n end",
"def condition\n node.condition\n end",
"def detect(&condition)\n @detect = condition\n end",
"def get_condition(condition)\n current = condition['condition']\n current.gsub!(/target/i) {\"self\"}\n return current\n end",
"def conditional_statement\n unless token_is? :if\n return nil\n end\n\n @scanner.get_next_token # The 'if'\n condition = conditional_expression\n require :new_line\n require :open_block\n statement_list = []\n while (@scanner.look_ahead.is_not? :close_block)\n statement_list << statement()\n end\n\n require :close_block\n return { if: { condition: condition, statements: statement_list }}\n end",
"def break_type\n return nil if @grpc.property.nil?\n @grpc.property.detected_break &&\n @grpc.property.detected_break.type.to_sym\n end",
"def break_type\n return nil if @grpc.property.nil?\n @grpc.property.detected_break &&\n @grpc.property.detected_break.type.to_sym\n end",
"def break_type\n return nil if @grpc.property.nil?\n @grpc.property.detected_break &&\n @grpc.property.detected_break.type.to_sym\n end",
"def break_type\n return nil if @grpc.property.nil?\n @grpc.property.detected_break &&\n @grpc.property.detected_break.type.to_sym\n end",
"def get_hit(a_point)\n\toccupied_points.reject! { |point| point.is_equal(a_point) }\n\tset_state('damage') \n\tcheck_if_is_sink()\n end",
"def isLoose?\r\n @hitpoint <= 0\r\n end",
"def isLoose?\r\n @hitpoint <= 0\r\n end",
"def always_hit?\n !note[TSBS::AlwaysHit].nil?\n end",
"def always_hit?\n !note[TSBS::AlwaysHit].nil?\n end",
"def conditional\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 48 )\n return_value = ConditionalReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal226 = nil\n char_literal227 = nil\n t = nil\n f = nil\n logical_or225 = nil\n\n tree_for_char_literal226 = nil\n tree_for_char_literal227 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 577:5: logical_or ( '?' t= expression ':' f= expression )?\n @state.following.push( TOKENS_FOLLOWING_logical_or_IN_conditional_3808 )\n logical_or225 = logical_or\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, logical_or225.tree )\n end\n # at line 577:16: ( '?' t= expression ':' f= expression )?\n alt_51 = 2\n look_51_0 = @input.peek( 1 )\n\n if ( look_51_0 == QMARK )\n alt_51 = 1\n end\n case alt_51\n when 1\n # at line 577:19: '?' t= expression ':' f= expression\n char_literal226 = match( QMARK, TOKENS_FOLLOWING_QMARK_IN_conditional_3813 )\n if @state.backtracking == 0\n\n tree_for_char_literal226 = @adaptor.create_with_payload( char_literal226 )\n root_0 = @adaptor.become_root( tree_for_char_literal226, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_conditional_3819 )\n t = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, t.tree )\n end\n char_literal227 = match( COLON, TOKENS_FOLLOWING_COLON_IN_conditional_3822 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_conditional_3828 )\n f = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, f.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 48 )\n\n end\n \n return return_value\n end",
"def run_until(breakpoint=nil)\n Breakpoints.main_thread = ::Thread.current\n if breakpoint && @thread\n @thread[:breakpoints] ||= Set.new\n @thread[:breakpoints_reached] ||= Set.new\n @thread[:breakpoints] << breakpoint\n self.finish_wait\n return\n end\n\n @thread ||= ::Thread.new do\n if breakpoint\n ::Thread.current[:breakpoints] ||= Set.new\n ::Thread.current[:breakpoints_reached] ||= Set.new\n ::Thread.current[:breakpoints] << breakpoint\n begin\n @block_to_run.call\n unless ::Thread.current[:breakpoints_reached].include?(breakpoint)\n raise \"Breakpoint #{breakpoint} not reached!\"\n end\n end\n else\n @block_to_run.call\n end\n # return control back to main thread\n Breakpoints.main_thread.run\n end\n ::Thread.stop\n end"
] |
[
"0.70646346",
"0.7031818",
"0.6581376",
"0.65412825",
"0.61108035",
"0.5783104",
"0.56519616",
"0.55837977",
"0.5389279",
"0.53603435",
"0.53221023",
"0.52690893",
"0.51907635",
"0.5189416",
"0.5189416",
"0.5184524",
"0.5155536",
"0.512498",
"0.5091033",
"0.50805616",
"0.5073881",
"0.5073881",
"0.5073881",
"0.50720066",
"0.5025686",
"0.5016109",
"0.50136656",
"0.4990794",
"0.49841833",
"0.49487677",
"0.49484342",
"0.49484342",
"0.4934767",
"0.49263546",
"0.48465034",
"0.4835597",
"0.4824024",
"0.4821453",
"0.48066166",
"0.47830337",
"0.47643965",
"0.47309726",
"0.4727848",
"0.4727253",
"0.4727253",
"0.4727253",
"0.47245258",
"0.47238255",
"0.47074935",
"0.46944445",
"0.46805757",
"0.4677183",
"0.46756014",
"0.46691853",
"0.46691853",
"0.46653068",
"0.466266",
"0.46526977",
"0.46495265",
"0.46450686",
"0.46396905",
"0.46260813",
"0.462516",
"0.46234888",
"0.46208835",
"0.46111083",
"0.45959052",
"0.45956174",
"0.45896298",
"0.45818037",
"0.45795023",
"0.45759946",
"0.45759946",
"0.4570759",
"0.45706624",
"0.45431668",
"0.45371607",
"0.45228538",
"0.45228538",
"0.45228538",
"0.45173478",
"0.45050496",
"0.45015398",
"0.45011082",
"0.44957736",
"0.4493851",
"0.4485549",
"0.44820228",
"0.44705644",
"0.44645846",
"0.44645846",
"0.44645846",
"0.44645846",
"0.44603235",
"0.44557464",
"0.44557464",
"0.44525227",
"0.44525227",
"0.44493783",
"0.44441816"
] |
0.7109952
|
0
|
breakpoint.hit_count > int Returns the hit count of the breakpoint.
|
def hit_count()
#This is a stub, used for indexing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hit_count\n self[:hit_count] && self[:hit_count].to_i\n end",
"def hit_count\n item_hash.deep_find(:hit_count, 0)\n end",
"def hit_count_increament\n self.hit_count = self.hit_count + 1\n self.update\n end",
"def num_hits; @hits.size; end",
"def num_hits; @hits.size; end",
"def num_hits; @hits.size; end",
"def hit\n @access_count = DATABASE.hit(self) || @access_count\n end",
"def count\n @stack.count\n end",
"def native_hit\n 95\n end",
"def exceeded?\n count >= threshold\n end",
"def add_hit\n @hits += 1\n :hit\n end",
"def badge_counter\n @badges.count { |badge| badge == true }\n end",
"def hit_points\n @hit_points\n end",
"def filtered_hits_count\n return @filtered_results.length || 0\n end",
"def total_hits_count\n return top_hits_count + all_hits_count\n end",
"def top_hits_count\n return @top_results.length || 0\n end",
"def count\n @bitmap.count\n end",
"def matched_count\n @results[MATCHED_COUNT]\n end",
"def return_count\n return @matchedCount\n end",
"def hit\n malus_hit = has2w ? CPanel::TWHIT : 0\n [super - malus_hit, 0].max\n end",
"def blue_screen_count\n return @blue_screen_count\n end",
"def num_clicks\n self.visits.count\n end",
"def game_objects_count\n @game_objects.count\n end",
"def all_hits_count\n return @all_results.length || 0\n end",
"def frame_count\n Rubinius::VM.backtrace(1).count\n end",
"def count\n @count\n end",
"def count\n @count ||= begin\n Grim.processor.count(@path)\n end\n end",
"def count\n @target.count.to_i\n end",
"def encounter_balloon_frame_count\n TH::Encounter_Alert::Balloon_Frames\n end",
"def winning_shot\n @computer.board.hits == 5\n end",
"def increment_hit_count()\n hit = nil\n begin\n hit = hits.find_or_create_by_hit_date!(Time.now.to_date)\n rescue ActiveRecord::RecordInvalid\n hit = hits.find_by_hit_date(Time.now.to_date)\n end\n hit.count += 1\n hit.save!\n end",
"def count\n @map.count\n end",
"def hits_requested\n return BlacklightBrowseNearby::Engine.config.default_hits.to_i if @opts[:number].blank?\n @opts[:number].to_i\n end",
"def count\n @obj['count'].to_i\n end",
"def num_of_visits\n self.visits.size\n end",
"def clickCount()\n @view__.clickCount\n end",
"def pending_event_count\n\t\treturn @event_stack.value.length\n\tend",
"def hole_count\n holes.count\n end",
"def count\n Jhead.call(\"-c\", @match, @pattern).split(\"\\n\").size\n end",
"def num_clicks\n visits.count\n end",
"def count\n @count ||= 0\n @count += 1\n end",
"def howManyMineHits(path)\n path.select { |i| @structure[i] & MINE > 0 }\n end",
"def reset_hit_count\n \"0\"\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def insight_counts\n return @insight_counts\n end",
"def count\n @count ||= 0\n end",
"def app_crash_count\n return @app_crash_count\n end",
"def app_crash_count\n return @app_crash_count\n end",
"def app_crash_count\n return @app_crash_count\n end",
"def assert_hitcount(query_or_result, wanted_hitcount, qrserver_id=0, params = {})\n if query_or_result.respond_to?(:hitcount)\n assert_result_hitcount(query_or_result, wanted_hitcount)\n else\n assert_hitcount_with_timeout(5, query_or_result, wanted_hitcount, qrserver_id, params)\n end\n end",
"def count\n @count ||= get_count\n end",
"def hcount\n @hcount += 1\n end",
"def hcount\n @hcount += 1\n end",
"def execution_count\n flow_entry_count\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def count\n @history.objects.find { |o| o.name == \"count\" }.val\n end",
"def visits_count\n self.visits_count_cache || self.visits_count_cache = self.calculate_visits_count\n end",
"def count_enemies()\r\n _enemy_nb = 0\r\n for i in 0..3\r\n if @warrior.feel(DIRECTIONS[i]).enemy?\r\n _enemy_nb += 1\r\n end\r\n end\r\n return _enemy_nb\r\n end",
"def num_successful_attacks\n return @successful_attacks\n end",
"def count(use_cache=true)\n return @count if @count && use_cache\n @count = target.call().size()\n end",
"def get_count\n @count <= 0 ? DEFAULT_COUNT : @count;\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 activity_level\n\t (self.results.count + self.events.count)\n end",
"def frame_count\n image.get(\"height\") / size.y\n end",
"def app_hang_count\n return @app_hang_count\n end",
"def count_escrowed\n return @count_escrowed\n end",
"def count()\n return @i\n end",
"def score\n\n if self.annotations_count\n return self.annotations_count\n else\n return 0\n end\n\n end",
"def score\n\n if self.annotations_count\n return self.annotations_count\n else\n return 0\n end\n\n end",
"def can_hit\n if total.is_a?(Array)\n return 1\n else\n return 1 if total < 21\n end\n return nil\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def query_len; (x = @hits.first) ? x.query_len : nil; end",
"def lines_of_code\n covered_lines.size + missed_lines.size\n end",
"def count\n @hash_tags.count\n end",
"def numEnts\n num = 1\n num += @lfn_ents.size if @lfn_ents\n return num\n end",
"def count\n run.count\n end",
"def getStateStackDepth()\n\t\t\treturn @_state_stack.size\n\t\tend",
"def shots_on_target\n self.positions.where(water: false, shooted: true).count\n end",
"def count\n @flags.size\n end",
"def num_missed_calls\n missed_contacts.count\n end",
"def total_visit\n pet_histories.count\n end",
"def visits_count_cache\n @visits_count_cache || @visits_count_cache = self.visits_count_column? ? self[:visits_count] : false\n end",
"def num_successful_attacks\n return @num_success_attacks\n end",
"def responses_count\n @responses_count ||= self.responses.visible.count || 0\n end",
"def breakpoints\n @breakpoint_tracker.global_breakpoints\n end",
"def count\n @count ||= @query.count\n end",
"def stack_size()\n #This is a stub, used for indexing\n end",
"def count\n @monkeys.count\n end",
"def count\n @mutex.synchronize { @count }\n end",
"def mine_count\n grid.flatten.count { |space| space.mine }\n end",
"def lines_of_code\n coverage_statistics[:line]&.total\n end",
"def hit_count_within(duration)\n return hits.where(\"hit_date >= ?\", Time.now.to_date - duration).sum(:count)\n end",
"def count\n @atlas.count\n end",
"def item_count\n @item_count ||= except(:includes, :limit, :offset).count\n end"
] |
[
"0.77391016",
"0.69725823",
"0.653472",
"0.6135756",
"0.6135756",
"0.6135756",
"0.6075219",
"0.6005014",
"0.5868335",
"0.583589",
"0.5815476",
"0.5736305",
"0.56796646",
"0.56718105",
"0.5655607",
"0.5600057",
"0.55880976",
"0.55845207",
"0.5541998",
"0.5528223",
"0.55129576",
"0.54669666",
"0.54628515",
"0.5462269",
"0.54577917",
"0.5442819",
"0.54391754",
"0.54342526",
"0.5409229",
"0.5409164",
"0.5400346",
"0.5393637",
"0.5384135",
"0.5355628",
"0.53475714",
"0.53379494",
"0.5328995",
"0.5327685",
"0.53228575",
"0.53226066",
"0.5313309",
"0.52911687",
"0.52846104",
"0.5276614",
"0.5276614",
"0.5276614",
"0.5276428",
"0.52718115",
"0.5263867",
"0.5263867",
"0.5263867",
"0.5252739",
"0.52448875",
"0.5235218",
"0.5235218",
"0.5222799",
"0.52152175",
"0.52152175",
"0.52152175",
"0.51974696",
"0.5193959",
"0.5183918",
"0.51808345",
"0.51650405",
"0.5160427",
"0.51601124",
"0.51562655",
"0.5155923",
"0.515299",
"0.5149538",
"0.51461416",
"0.51446974",
"0.51446974",
"0.5142128",
"0.5136715",
"0.5136715",
"0.5136715",
"0.513261",
"0.5129992",
"0.5126728",
"0.5126462",
"0.51231307",
"0.51191807",
"0.5114537",
"0.5111611",
"0.5101085",
"0.51005536",
"0.5094859",
"0.5092985",
"0.5090112",
"0.508755",
"0.50859964",
"0.50856435",
"0.5081736",
"0.5079696",
"0.5078946",
"0.5071304",
"0.50623274",
"0.50580025",
"0.5057481"
] |
0.72230375
|
1
|
breakpoint.hit_value > int Returns the hit value of the breakpoint.
|
def hit_value()
#This is a stub, used for indexing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hit_value= int\n #This is a stub, used for indexing\n end",
"def native_hit\n 95\n end",
"def hit_count\n self[:hit_count] && self[:hit_count].to_i\n end",
"def hit\n malus_hit = has2w ? CPanel::TWHIT : 0\n [super - malus_hit, 0].max\n end",
"def should_hit?\n hit = true\n @values.each { |val| hit &= !(val >= 17 && val <= 21) }\n hit\n end",
"def takeHit(x)\n @hp = @hp - x\n return @hp\n end",
"def takeHit(x)\n @hp = @hp - x\n return @hp\n end",
"def hit_or_miss\n\t\t\treturn :win if value = svalue\n\t\t\treturn :miss if value = none_empty\n\t\tend",
"def skill_effect_second_hit_result(user, skill)\r\n eva = 8 * self.agi / user.dex + self.eva\r\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\r\n hit = self.cant_evade? ? 100 : hit\r\n return hit, (rand(100) < hit)\r\n end",
"def hit_points\n @hit_points\n end",
"def hit_by?(enemyprojectile)\r\n @hurt = enemyprojectile.any? {|enemyprojectile| Gosu::distance(enemyprojectile.x, enemyprojectile.y, @x+88, @y+88) < 50}\r\n\r\n if @hurt\r\n @hp = @hp - 20\r\n #@score += 11 #<-------------works for score\r\n end\r\n end",
"def item_effect_hit_result(item) \r\n return (rand(100) < item.hit)\r\n end",
"def skill_effect_first_hit_result(user, skill)\r\n hit = skill.hit\r\n if skill.atk_f > 0\r\n hit *= user.hit / 100\r\n end\r\n return hit, (rand(100) < hit)\r\n end",
"def pvalue(hit)\n R.converse \"pgev(log(#{hit.send(type)}), #{@location}, #{@scale}, #{@shape})\"\n end",
"def get_hit(a_point)\n\toccupied_points.reject! { |point| point.is_equal(a_point) }\n\tset_state('damage') \n\tcheck_if_is_sink()\n end",
"def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def hit?\n @rank >= 10\n end",
"def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end",
"def attack_effect_second_hit_result(attacker)\r\n eva = 8 * self.agi / attacker.dex + self.eva\r\n hit = self.damage < 0 ? 100 : 100 - eva\r\n hit = self.cant_evade? ? 100 : hit\r\n return (rand(100) < hit)\r\n end",
"def hit_condition()\n #This is a stub, used for indexing\n end",
"def game_value\n [VALUES.index(value) + 2, 10].min\n end",
"def hit_id\n return @hit_id\n end",
"def at_breakpoint(_context, breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold('Condition: ') + expr\n end",
"def extractHit(ahit)\n hit = ahit.to_i\n cap = (hit & CAP_MASK) >> 15\n imp = (hit & IMP_MASK) >> 13\n pos = (hit & POS_MASK)\n return cap, imp, pos\n end",
"def winning_shot\n @computer.board.hits == 5\n end",
"def can_hit\n if total.is_a?(Array)\n return 1\n else\n return 1 if total < 21\n end\n return nil\n end",
"def target_reached?\n @current_value == @target_value\n end",
"def hit\n self.damage = damage + 1\n check_boat\n end",
"def test_execute_threshold(value = 1)\n if value == @threshold\n then return true\n end\n return false\n end",
"def get_projectile_hit_area(ch)\n pix = $BlizzABS.pixel\n return case ch.direction\n when 2\n Rect.new(ch.real_x / 4 + 8, ch.real_y / 4 + 8, 16, ch.y * 32 / pix - ch.real_y / 4 + 24)\n when 4\n Rect.new(ch.x * 32 / pix + 8, ch.y * 32 / pix + 8, ch.real_x / 4 - ch.x * 32 / pix + 24, 16)\n when 6\n Rect.new(ch.real_x / 4 + 8, ch.real_y / 4 + 8, ch.x * 32 / pix-ch.real_x / 4 + 24, 16)\n when 8\n Rect.new(ch.x * 32 / pix + 8, ch.y * 32 / pix + 8, 16, ch.real_y / 4 - ch.y * 32 / pix + 24)\n end\n end",
"def hit_count\n item_hash.deep_find(:hit_count, 0)\n end",
"def hit \n \n # Determine and output the result of the damage inflicted\n damage = rand(0..@power)\n\n # Determine a critical hit\n critical_hit_chance = rand(5)\n if damage != 0 && critical_hit_chance == 4\n critical = true\n damage *= 2\n end\n\n if damage == 0\n puts \"#{@name} misses completely, doing #{damage} damage.\"\n elsif critical\n puts \"CRITICAL HIT!! #{@name} delivers #{damage} damage.\"\n elsif damage < 0.33 * @power\n puts \"#{@name} delivers a weak hit of #{damage} damage.\"\n elsif damage > 0.67 * @power\n puts \"#{@name} delivers a powerful hit of #{damage} damage!\"\n else\n puts \"#{@name} does #{damage} damage.\"\n end\n\n puts \"\"\n\n return damage\n\n end",
"def isLoose?\r\n @hitpoint <= 0\r\n end",
"def isLoose?\r\n @hitpoint <= 0\r\n end",
"def at_breakpoint(breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold(\"Condition: \") + expr\n end",
"def attack_effect_first_hit_result(attacker)\r\n return (rand(100) < attacker.hit)\r\n end",
"def hit\n hit_object = $window.tiles.select{|t| t.within_clickable?(@x, @y) and !t.content.nil?}\n return hit_object.first if !hit_object.nil?\n end",
"def didHit(pos)\n\t\treturn !pos.between?(@holeHeight, @holeHeight + @holeSize)\n\tend",
"def bust?; value > 21; end",
"def calc_hit(user, obj = nil)\n hit = ex_attr_calc_hit(user, obj)\n #noinspection RubyResolve\n if obj != nil and obj.is_a?(RPG::Skill) and obj.physical_attack\n hit += user.hit - 95\n end\n hit\n end",
"def hit(level = @skl_level)\n return @skl_levelcache[level][:hit_ratio]\n end",
"def current_score\n\t\treturn @game_stack\n\tend",
"def hit_id=(value)\n @hit_id = value\n end",
"def received_damage(hit)\n @health -= hit\n\n if @consecutive_hits != @@counter\n @consecutive_hits = 0\n @@counter = 0\n end\n\n @@counter += 1\n \n @consecutive_hits += 1\n \n if @consecutive_hits % 3 == 0 && @@counter % 3 == 0\n puts \"#{@name} is getting absolutely pummelled!!\"\n puts \"\"\n elsif @consecutive_hits % 5 == 0 && @@counter % 5 == 0\n puts \"This fight is completely one sided...\"\n puts \"\"\n end\n\n \n\n end",
"def hit_or_miss (guess)\n\t\tguess === \"hit\"? \"X\" : \"0\";\n\tend",
"def dead?\n @hit_points <= 0\n end",
"def hits_requested\n return BlacklightBrowseNearby::Engine.config.default_hits.to_i if @opts[:number].blank?\n @opts[:number].to_i\n end",
"def detect_injury \n @last_hit = time unless events['got_hit'].empty? \n if @last_hit and time - @last_hit < 4\n say('hit')\n @turn_speed = @FAST_TURN \n elsif @last_hit and (time - @last_hit < 10)\n say('not hit')\n @turn_speed = rand(1...@NORMAL_TURN) \n end \n end",
"def hit; end",
"def take_hit_at(x_coord, y_coord)\n #if @position.is_equal_to(x_coord, y_coord)\n if @position == Point.new(x_coord, y_coord)\n @is_hit = true\n end\n end",
"def bust?\n\t\tvalue_as_int > 21 ? true : false\n\tend",
"def receive_damage\n @hit_points-= 10\n end",
"def to_hit(armor_class)\n result = 21 - armor_class - [@level, 20].min\n result -= 5 if result > 20\n # Maybe refactor this, it's potentially confusing.\n result -= 1 if @strength > 16\n result\n end",
"def below_threshold?\n coverage < threshold\n end",
"def threshold\n @threshold || 95\n end",
"def hit\n @access_count = DATABASE.hit(self) || @access_count\n end",
"def hit\n @health -= 1\n end",
"def hit\n @health -= 1\n end",
"def value\n \t@calc_stack[-1]\n end",
"def defender_goal_reached(threshold = 5)\n dist = calc_dist(@tank, @goal)\n #puts \"#{@tank.index} Distance to goal = #{dist}\"\n return dist < threshold\n end",
"def is_value?(value)\n\t\tvalue.to_i < 10\n\tend",
"def value\n @value ||= 1\n end",
"def spdamage\n return (@spdamage == nil ? 0 : @spdamage)\n end",
"def critical_hit?\n @critical\n end",
"def h_value(current, goal)\n if @grid_heuristic[current.position].nil?\n [(goal.i - current.i).abs, (goal.j - current.j).abs].max\n else\n @grid_heuristic[current.position]\n end\n end",
"def happiness=(value)\n @happiness = value.clamp(0,10)\n # if value > 10\n # @happiness= 10\n # elsif value < 0\n # @happiness = 0\n # else \n # @happiness = value\n # end\n end",
"def hit(damage)\n @hp -= damage\n end",
"def busted?(total)\n total > GAME_HIGH\nend",
"def hit(damage)\n @health -= damage\n if @health <= 0\n @health = 0\n end\n end",
"def gotAttack(damage)\r\n @hitpoint -= damage\r\n end",
"def add_hit\n @hits += 1\n :hit\n end",
"def hit_count()\n #This is a stub, used for indexing\n end",
"def min_value(value, pdef)\n if(value.to_i >= pdef['MinValue'].to_i)\n true\n else\n \"Value must not be less than #{pdef['MinValue']}\"\n end\n end",
"def position(val)\n @inside = true\n return val if (low..high).cover? val\n @inside = false\n return constrain(val, low, high)\n end",
"def isBusted\n\t\tif @value > 21\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend",
"def bottom_value\n @relevant_data ? points.minimum_value : nil\n end",
"def get_threshold\n d = self.vspecs.select(:value).where(name: 'threshold').first\n return d != nil ? d.value : d\n end",
"def black_hits=(hits)\n raise TypeError, \"Given black hits must be type of Integer\" unless hits.is_a? Integer\n raise RuleViolationError, \"Cannot override black hits\" unless @black_hits == nil\n \n @black_hits = hits\n return self\n end",
"def i_hit(others, velocity); end",
"def must_hit\n return true if @hand.point != \"Blackjack\" && @hand.point <= 16\n return false\n end",
"def hit_points\n bonus_feat_hp = @feats_name.include?('Robustesse') ? @character.bonus_per_tier(5, 10, 15) : 0\n full_hp = @klass.base_hp + @constitution.total_value + (@klass.hp_per_level * (@character.level - 1)) + bonus_feat_hp\n healing_surge = (full_hp / 4).floor\n healing_surge += @constitution.modifier if @race.name == 'Drakéide'\n {\n total: full_hp,\n half_blooded: (full_hp / 2).floor,\n healing_surge: healing_surge,\n healing_surge_by_day: @klass.healing_surge + @constitution.modifier\n }\n end",
"def white_hits=(hits)\n raise TypeError, \"Given white hits must be type of Integer\" unless hits.is_a? Integer\n raise RuleViolationError, \"Cannot override white hits\" unless @white_hits == nil\n \n @white_hits = hits\n return self\n end",
"def top_value\n @relevant_data ? points.maximum_value : nil\n end",
"def gets_damage(attack_value)\n\t\t@life_points -= attack_value\n\t\tif @life_points <= 0 \n\t\t\t@life_points = 0 \n\t\t\treturn \" Le joueur #{self.name} a été tué !\"\n\t\tend\n\tend",
"def bust?\n current_score = score\n if current_score > 21\n true\n elsif current_score > 0\n false\n else\n raise \"Invalid Score\"\n end\n end",
"def get_value\n @value.to_i\n end",
"def threshold_spy\n puts \"Ergebnis:\"\n puts (@spy_level_defender - @spy_level_attacker)*0.05+0.5 \n return (@spy_level_defender - @spy_level_attacker)*0.05+0.5 \n end",
"def hit?(card_total)\n # code hit? here\n\n \nend",
"def exceeded?\n count >= threshold\n end",
"def over_five?\n\tvalue = 3\n\tputs value > 5 ? \"Over Five\" : \"Not over FIVE\"\nend",
"def max_value(value, pdef)\n if(value.to_i <= pdef['MaxValue'].to_i)\n true\n else\n \"Value must not be greater than #{pdef['MaxValue']}\"\n end\n end",
"def calculate_hit(move, attacker, defender)\n type = move_type(move)\n base_pwr = move_power(move)\n atk_mul = attack_multiplier(type, defender.type.prim, defender.type.sec)\n stab = (type == attacker.type.prim || type == attacker.type.sec) ? 1.5 : 1\n\n # TODO: Critical hits.\n cr = 1\n\n atk_bonus = attack_bonus(attacker.level)\n def_bonus = defense_bonus(defender.level)\n\n r = rand(85...100) / 100.0\n mod = stab * atk_mul * cr * r\n # base_dmg = (((attacker.level * 2 / 5.0 + 2) *\n # base_pwr * atk_bonus / 50 / def_bonus + 2) *\n # cr * r / 100 * stab * atk_mul)\n base_dmg = ((2 * attacker.level + 10) / 250.0 *\n (atk_bonus / def_bonus) * base_pwr + 2) * mod\n\n # TOOD: Check levitate, fire absorb, water absorb, volt absorb,\n # sap sipper, etc.\n return 0 if immune_from_ability?(move, defender)\n\n # Handle wonderguard mode.\n return 0 unless atk_mul > 1 if @modes.include?(:wonderguard)\n\n base_dmg.round\n end",
"def breakpoint?\n type == :breakpoint\n end",
"def full_hp?\n return @hp == MAX_HITPOINT\n end",
"def receive_damage\n @hit_points -= @damage\n end",
"def hpdamage\n return (@hpdamage == nil ? 0 : @hpdamage)\n end",
"def skill_effect_physical_hit_result(skill)\r\n # If physical attack has power other than 0\r\n if skill.power != 0 and skill.atk_f > 0\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Return True\r\n return true\r\n end\r\n # Return False\r\n return false\r\n end",
"def within_terminal_boundary?(value)\n buffer[value.position.y] && buffer[value.position.y][value.position.x]\n end"
] |
[
"0.6995996",
"0.6346121",
"0.6185641",
"0.5980916",
"0.5891098",
"0.5760935",
"0.5760935",
"0.56833166",
"0.55650693",
"0.55058306",
"0.5492335",
"0.54455924",
"0.5442931",
"0.54348075",
"0.5426388",
"0.5421468",
"0.5396576",
"0.5396576",
"0.5396576",
"0.5391494",
"0.5367503",
"0.5353955",
"0.53519815",
"0.53216255",
"0.5317661",
"0.52604145",
"0.5232122",
"0.52250665",
"0.5222668",
"0.518511",
"0.51831585",
"0.5183052",
"0.5171882",
"0.51715547",
"0.5149682",
"0.5149682",
"0.51343566",
"0.51283574",
"0.51038045",
"0.50888765",
"0.5085255",
"0.50814223",
"0.50717217",
"0.5067232",
"0.50579304",
"0.50478035",
"0.50333863",
"0.50113416",
"0.49809837",
"0.4971731",
"0.49712637",
"0.49359113",
"0.49228394",
"0.49042353",
"0.49003604",
"0.48613927",
"0.48528954",
"0.484618",
"0.48315635",
"0.48315635",
"0.48300198",
"0.48261893",
"0.4823645",
"0.48192626",
"0.48180726",
"0.48010436",
"0.4799594",
"0.4793927",
"0.4783432",
"0.47722033",
"0.47666445",
"0.47611675",
"0.4758538",
"0.47551307",
"0.47450903",
"0.47384995",
"0.47263765",
"0.47086325",
"0.470852",
"0.47074997",
"0.47061837",
"0.47027814",
"0.47010228",
"0.46955648",
"0.469552",
"0.4693093",
"0.46900496",
"0.46877772",
"0.4684167",
"0.46649784",
"0.4653771",
"0.46459574",
"0.4643358",
"0.46428108",
"0.46343008",
"0.46322414",
"0.46251574",
"0.46251282",
"0.46248788",
"0.46247932"
] |
0.6643117
|
1
|
breakpoint.hit_value = int Sets the hit value of the breakpoint.
|
def hit_value= int
#This is a stub, used for indexing
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hit_value()\n #This is a stub, used for indexing\n end",
"def hit_id=(value)\n @hit_id = value\n end",
"def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end",
"def receive_damage\n @hit_points-= 10\n end",
"def white_hits=(hits)\n raise TypeError, \"Given white hits must be type of Integer\" unless hits.is_a? Integer\n raise RuleViolationError, \"Cannot override white hits\" unless @white_hits == nil\n \n @white_hits = hits\n return self\n end",
"def native_hit\n 95\n end",
"def hit\n self.damage = damage + 1\n check_boat\n end",
"def black_hits=(hits)\n raise TypeError, \"Given black hits must be type of Integer\" unless hits.is_a? Integer\n raise RuleViolationError, \"Cannot override black hits\" unless @black_hits == nil\n \n @black_hits = hits\n return self\n end",
"def pvalue(hit)\n R.converse \"pgev(log(#{hit.send(type)}), #{@location}, #{@scale}, #{@shape})\"\n end",
"def takeHit(x)\n @hp = @hp - x\n return @hp\n end",
"def takeHit(x)\n @hp = @hp - x\n return @hp\n end",
"def hit; end",
"def add_hit\n @hits += 1\n :hit\n end",
"def set_breakpoint(source, pos, condition = nil)\n #This is a stub, used for indexing\n end",
"def hit_points\n @hit_points\n end",
"def get_hit(a_point)\n\toccupied_points.reject! { |point| point.is_equal(a_point) }\n\tset_state('damage') \n\tcheck_if_is_sink()\n end",
"def received_damage(hit)\n @health -= hit\n\n if @consecutive_hits != @@counter\n @consecutive_hits = 0\n @@counter = 0\n end\n\n @@counter += 1\n \n @consecutive_hits += 1\n \n if @consecutive_hits % 3 == 0 && @@counter % 3 == 0\n puts \"#{@name} is getting absolutely pummelled!!\"\n puts \"\"\n elsif @consecutive_hits % 5 == 0 && @@counter % 5 == 0\n puts \"This fight is completely one sided...\"\n puts \"\"\n end\n\n \n\n end",
"def reduce_hitpoint(damage)\r\n @hitpoint -= damage\r\n end",
"def hit_count_increament\n self.hit_count = self.hit_count + 1\n self.update\n end",
"def gotAttack(damage)\r\n @hitpoint -= damage\r\n end",
"def set_hit\n @hit = Hit.find(params[:id])\n end",
"def hit(damage)\n @hp -= damage\n end",
"def hit\n malus_hit = has2w ? CPanel::TWHIT : 0\n [super - malus_hit, 0].max\n end",
"def hit_count\n self[:hit_count] && self[:hit_count].to_i\n end",
"def receive_damage\n @hit_points -= @damage\n end",
"def i_hit(others, velocity); end",
"def take_damage(damage)\n @hitpoint -= damage\n end",
"def hit_or_miss\n\t\t\treturn :win if value = svalue\n\t\t\treturn :miss if value = none_empty\n\t\tend",
"def at_breakpoint(_context, breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold('Condition: ') + expr\n end",
"def hit=(_arg0); end",
"def hit_id\n return @hit_id\n end",
"def should_hit?\n hit = true\n @values.each { |val| hit &= !(val >= 17 && val <= 21) }\n hit\n end",
"def hit(damage)\n @health -= damage\n if @health <= 0\n @health = 0\n end\n end",
"def at_breakpoint(breakpoint)\n @pry ||= Pry.new\n\n output.puts bold(\"\\n Breakpoint #{breakpoint.id}. \") + n_hits(breakpoint)\n\n expr = breakpoint.expr\n return unless expr\n\n output.puts bold(\"Condition: \") + expr\n end",
"def skill_effect_first_hit_result(user, skill)\r\n hit = skill.hit\r\n if skill.atk_f > 0\r\n hit *= user.hit / 100\r\n end\r\n return hit, (rand(100) < hit)\r\n end",
"def newHit(cap, imp, pos)\n pos= 8191 if pos > 8191\n newHit = 0b0000000000000000 | cap << 15 | imp << 13 | pos\n end",
"def initialize(level=1)\n @level = level\n\n @max_damage = @max_damage || 4\n # a += 1 --> a = a + 1\n # a ||= 1 --> a = a || 1\n # @hit_points_per_level = @hit_points_per_level || 10\n @hit_points_per_level ||= 10 # set a default\n\n @hit_points = @level * @hit_points_per_level\n end",
"def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end",
"def create\n @hit_value = HitValue.new(params[:hit_value])\n\n respond_to do |format|\n if @hit_value.save\n format.html { redirect_to @hit_value, notice: 'Hit value was successfully created.' }\n format.json { render json: @hit_value, status: :created, location: @hit_value }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hit_value.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hit \n \n # Determine and output the result of the damage inflicted\n damage = rand(0..@power)\n\n # Determine a critical hit\n critical_hit_chance = rand(5)\n if damage != 0 && critical_hit_chance == 4\n critical = true\n damage *= 2\n end\n\n if damage == 0\n puts \"#{@name} misses completely, doing #{damage} damage.\"\n elsif critical\n puts \"CRITICAL HIT!! #{@name} delivers #{damage} damage.\"\n elsif damage < 0.33 * @power\n puts \"#{@name} delivers a weak hit of #{damage} damage.\"\n elsif damage > 0.67 * @power\n puts \"#{@name} delivers a powerful hit of #{damage} damage!\"\n else\n puts \"#{@name} does #{damage} damage.\"\n end\n\n puts \"\"\n\n return damage\n\n end",
"def skill_effect_second_hit_result(user, skill)\r\n eva = 8 * self.agi / user.dex + self.eva\r\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\r\n hit = self.cant_evade? ? 100 : hit\r\n return hit, (rand(100) < hit)\r\n end",
"def update\n @hit_value = HitValue.find(params[:id])\n\n respond_to do |format|\n if @hit_value.update_attributes(params[:hit_value])\n format.html { redirect_to @hit_value, notice: 'Hit value was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit_value.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hit_by?(enemyprojectile)\r\n @hurt = enemyprojectile.any? {|enemyprojectile| Gosu::distance(enemyprojectile.x, enemyprojectile.y, @x+88, @y+88) < 50}\r\n\r\n if @hurt\r\n @hp = @hp - 20\r\n #@score += 11 #<-------------works for score\r\n end\r\n end",
"def set_breakpoint(ip, obj)\n Rubinius.primitive :compiledmethod_set_breakpoint\n raise ArgumentError, \"Unable to set breakpoint on #{inspect} at invalid bytecode address #{ip}\"\n end",
"def calc_hit(user, obj = nil)\n hit = ex_attr_calc_hit(user, obj)\n #noinspection RubyResolve\n if obj != nil and obj.is_a?(RPG::Skill) and obj.physical_attack\n hit += user.hit - 95\n end\n hit\n end",
"def hit_condition()\n #This is a stub, used for indexing\n end",
"def set_breakpoint(cm, ip)\n @breakpoint_tracker.on(cm, :ip => ip)\n end",
"def score=(value)\n @score = value\n end",
"def damage=(val)\n @data[:damage] = (val.nil?) ? nil : val.to_i\n end",
"def hit_condition= symbol\n #This is a stub, used for indexing\n end",
"def hit hits\n # blackout the screen\n @watcher.observe_sensors if @serialEnable\n if hits >= 1 and hits < @frameDelay \n @black.blit @screen,[0,0]\n hits += 1\n @ducks.map &:color_trans\n end\n # Draw each duck as a white square\n if hits >= @frameDelay and hits < @frameDelay*(@ducks.count) + @frameDelay \n puts \"******** drawOffset: #{@drawOffset} ****************\"\n if hits % @frameDelay == 0\n @drawOffset += 1 \n # displays each duck for the alloted frameDelay\n @ducks.each_with_index do |duck, index| \n if (index == @drawOffset ) \n puts \"drawOffset: #{@drawOffset}, index that is white: #{index}\"\n duck.color_white()\n else\n duck.color_black()\n duck.draw @screen\n duck.color_trans()\n end\n end\n end\n\n puts \"P1 #{@whoPulledTrigger}, #{@player1Hit}\"\n puts \"P2 #{@whoPulledTrigger}, #{@player2Hit}\"\n \n # who killed the duck\n if @whoPulledTrigger == \"1\" and @player1Hit == \"1\"\n @player1Score += 1 \n @whoPulledTrigger = \"0\"\n @killDuck = true\n end\n if @whoPulledTrigger == \"2\" and @player2Hit == \"1\"\n @player2Score += 1 \n @whoPulledTrigger = \"0\"\n @killDuck = true\n end\n\n @player1Hit = \"3\" \n @player2Hit = \"3\"\n\n if @killDuck == true\n #@ducks[@drawOffset].alive = false\n @ducks.delete_at @drawOffset\n @killDuck = false\n end\n\n hits += 1\n # Go back to normal\n elsif hits >= @frameDelay*(@ducks.count) + @frameDelay \n @drawOffset = -1\n @whoPulledTrigger = 0\n @ducks.map &:duck\n @background.blit @screen, [0,0]\n hits = 0\n end\n return hits\n end",
"def track_total_hits(value)\n fresh.tap do |criteria|\n criteria.track_total_hits_value = value\n end\n end",
"def hit(timestamp)\n \n end",
"def set_Threshold(value)\n set_input(\"Threshold\", value)\n end",
"def hit\n @health -= 1\n end",
"def hit\n @health -= 1\n end",
"def item_effect_hit_result(item) \r\n return (rand(100) < item.hit)\r\n end",
"def protein_hit(hit)\n key = \"h#{hit}\"\n return nil unless str = data[key]\n @protein_hits[hit] ||= parse_protein_hit(str, data[\"#{key}_text\"], query_hits(hit))\n end",
"def breakpoint()\n #This is a stub, used for indexing\n end",
"def break(breakpoint)\n if ::Thread.current[:breakpoints] &&\n ::Thread.current[:breakpoints].include?(breakpoint)\n ::Thread.current[:breakpoints_reached] << breakpoint\n puts \"breaking on #{breakpoint}\"\n self.main_thread.run\n ::Thread.stop\n end\n end",
"def take_hit_at(x_coord, y_coord)\n #if @position.is_equal_to(x_coord, y_coord)\n if @position == Point.new(x_coord, y_coord)\n @is_hit = true\n end\n end",
"def hit(level = @skl_level)\n return @skl_levelcache[level][:hit_ratio]\n end",
"def on_hit(hit)\n if hit.attacker == self\n RPG.output \"#{self.name} landed a Critical Hit\" if hit.critical?\n return\n end\n \n damage_roll = hit.damage.roll\n critical_modifier = hit.critical? ? 2 : 1\n final_damage = damage_roll.to_i * critical_modifier\n decrease :health, final_damage\n RPG.output \"#{name} got#{' critically' if hit.critical?} hit by #{hit.attacker.name} for #{final_damage} damage (#{hit.damage}) and has #{health} health left\"\n Event.fire(:death, self) if dead?\n end",
"def attack_simulation=(value)\n @attack_simulation = value\n end",
"def gets_damage(attack_value)\n\t\t@life_points -= attack_value\n\t\tif @life_points <= 0 \n\t\t\t@life_points = 0 \n\t\t\treturn \" Le joueur #{self.name} a été tué !\"\n\t\tend\n\tend",
"def bump\n @value = bump_value(value)\n end",
"def startup_performance_score=(value)\n @startup_performance_score = value\n end",
"def show\n @hit_value = HitValue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hit_value }\n end\n end",
"def attack_effect_second_hit_result(attacker)\r\n eva = 8 * self.agi / attacker.dex + self.eva\r\n hit = self.damage < 0 ? 100 : 100 - eva\r\n hit = self.cant_evade? ? 100 : hit\r\n return (rand(100) < hit)\r\n end",
"def happiness=(value)\n @happiness = value.clamp(0,10)\n # if value > 10\n # @happiness= 10\n # elsif value < 0\n # @happiness = 0\n # else \n # @happiness = value\n # end\n end",
"def hit\n coin = spawn :coin, :x => x, :y => y-40\n coin.collect\n\n @active = false\n @inactive_timer = HIT_RATE if has_more?\n end",
"def detect_injury \n @last_hit = time unless events['got_hit'].empty? \n if @last_hit and time - @last_hit < 4\n say('hit')\n @turn_speed = @FAST_TURN \n elsif @last_hit and (time - @last_hit < 10)\n say('not hit')\n @turn_speed = rand(1...@NORMAL_TURN) \n end \n end",
"def setup_timed_hit\n @timed_hit = nil\n if @acts[1].class == Hash\n @timed_hit_setup = TIMED_HIT_SETUP.merge(@acts[1])\n return\n end\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] = @acts[1]\n button = (@acts[2].nil? ? [TIMED_HIT_DEFAULT_BUTTON] : @acts[2])\n button = [button] unless button.is_a?(Array)\n @timed_hit_setup[TIMED_HIT_BUTTON_SYMBOL] = button\n @timed_hit_setup[TIMED_HIT_ANIME_SYMBOL] = @acts[3] || TimedHit_Anim\n @timed_hit_setup[TIMED_HIT_ANIME_FOLLOW] = (@acts[4].nil? ? true : @acts[4])\n end",
"def update_pile(number,new_value)\n\t\t@game_stack[number - 1] = new_value\n\tend",
"def set_breakpoint(cm, ip, condition=nil)\n @breakpoint_tracker.on(cm, :ip => ip, :condition => condition)\n end",
"def initialize hp, *params\n super params\n @hp = hp.abs\n @hp = @hp > MAX_HITPOINT ? MAX_HITPOINT : @hp \n end",
"def each_hit(&x) #:yields: hit\n @hits.each(&x)\n end",
"def each_hit(&x) #:yields: hit\n @hits.each(&x)\n end",
"def each_hit(&x) #:yields: hit\n @hits.each(&x)\n end",
"def extractHit(ahit)\n hit = ahit.to_i\n cap = (hit & CAP_MASK) >> 15\n imp = (hit & IMP_MASK) >> 13\n pos = (hit & POS_MASK)\n return cap, imp, pos\n end",
"def make_damage(a_point)\n \tmsj = 'hit'\n\tship = ship_at(a_point)\n\tship.get_hit(a_point)\n\tif(ship.state() == 'sink')\n\t\tremove_to_the_fleet(ship)\n\t\tmsj = 'sink'\n\tend\n\tmsj\t\n end",
"def damage(value, critical)\n dispose_damage\n if value.is_a?(Numeric)\n damage_string = value.abs.to_s\n else\n damage_string = value.to_s\n end\n bitmap = Bitmap.new(160, 48)\n bitmap.font.name = \"Arial Black\"\n bitmap.font.size = 32\n bitmap.font.color.set(0, 0, 0)\n bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)\n bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)\n bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)\n bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)\n if value.is_a?(Numeric) and value < 0\n bitmap.font.color.set(176, 255, 144)\n else\n bitmap.font.color.set(255, 255, 255)\n end\n bitmap.draw_text(0, 12, 160, 36, damage_string, 1)\n if critical\n bitmap.font.size = 20\n bitmap.font.color.set(0, 0, 0)\n bitmap.draw_text(-1, -1, 160, 20, \"CRITICAL\", 1)\n bitmap.draw_text(+1, -1, 160, 20, \"CRITICAL\", 1)\n bitmap.draw_text(-1, +1, 160, 20, \"CRITICAL\", 1)\n bitmap.draw_text(+1, +1, 160, 20, \"CRITICAL\", 1)\n bitmap.font.color.set(255, 255, 255)\n bitmap.draw_text(0, 0, 160, 20, \"CRITICAL\", 1)\n end\n @_damage_sprite = ::Sprite.new(self.viewport)\n @_damage_sprite.bitmap = bitmap\n @_damage_sprite.ox = 80\n @_damage_sprite.oy = 20\n @_damage_sprite.x = self.x\n @_damage_sprite.y = self.y - self.oy / 2\n @_damage_sprite.z = 3000\n @_damage_duration = 40\n end",
"def hit_points\n bonus_feat_hp = @feats_name.include?('Robustesse') ? @character.bonus_per_tier(5, 10, 15) : 0\n full_hp = @klass.base_hp + @constitution.total_value + (@klass.hp_per_level * (@character.level - 1)) + bonus_feat_hp\n healing_surge = (full_hp / 4).floor\n healing_surge += @constitution.modifier if @race.name == 'Drakéide'\n {\n total: full_hp,\n half_blooded: (full_hp / 2).floor,\n healing_surge: healing_surge,\n healing_surge_by_day: @klass.healing_surge + @constitution.modifier\n }\n end",
"def handle_hit_obstacle(object)\n end",
"def hit_or_miss (guess)\n\t\tguess === \"hit\"? \"X\" : \"0\";\n\tend",
"def reset_hit_count\n \"0\"\n end",
"def update_timed_hit\n @timed_hit_setup[TIMED_HIT_BUTTON_SYMBOL].each do |button|\n if Input.trigger?(button)\n @timed_hit = button\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] = 1\n anim = $data_animations[@timed_hit_setup[TIMED_HIT_ANIME_SYMBOL]]\n follow = $game_temp.anim_follow\n $game_temp.anim_follow = @timed_hit_setup[TIMED_HIT_ANIME_FOLLOW]\n sprite.start_animation(anim, flip)\n $game_temp.anim_follow = follow\n on_timed_hit_success\n break\n end\n end\n @timed_hit_setup[TIMED_HIT_TIMING_SYMBOL] -= 1\n end",
"def hit_string\n # Return hex value\n [@hit.to_s].pack(\"H*\").gsub(\"\\n\", \"\")\n end",
"def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end",
"def inc_hit(key, options)\n if @hits[key]\n @hits[key]+=1\n else\n @hits[key]=1\n end\n end",
"def hit\n @access_count = DATABASE.hit(self) || @access_count\n end",
"def priority_score=(value)\n @priority_score = value\n end",
"def process_shot_result(shot_result)\n shot_result.split(/:|\\s/).each_slice(2) do |location, result|\n field[location] = result.to_sym \n has_hit(location) if field[location] == :hit\n end\n end",
"def happiness=(happiness_points)\n @happiness_points = happiness_points\n if @happiness_points > 10\n @happiness_points = 10\n elsif @happiness_points < 0\n @happiness_points = 0\n end\n end",
"def hit!(enemy)\n unless invincible?\n $window.audio_manager.play! :hurt\n hp!(0 - enemy.damage)\n invincible!(InvincibleTime)\n enemy.damage!(enemy.damage)\n end\n \n enemy.jump_back!\n end",
"def gotAttack(damage)\r\n @@probsDeflects = Array['deflect', 'deflect', 'deflect', 'deflect', 'deflect',\r\n 'deflect', 'deflect', 'deflect', 'got hit', 'got hit' ]\r\n\r\n @@probs = @@probsDeflects[rand(0..9)]\r\n if @role.upcase == \"HERO\"\r\n if @@probs == 'deflect'\r\n puts \"#{@name} deflects the attack.\"\r\n @hitpoint += damage\r\n end\r\n end\r\n @hitpoint -= damage\r\n end",
"def calculate_hit(move, attacker, defender)\n type = move_type(move)\n base_pwr = move_power(move)\n atk_mul = attack_multiplier(type, defender.type.prim, defender.type.sec)\n stab = (type == attacker.type.prim || type == attacker.type.sec) ? 1.5 : 1\n\n # TODO: Critical hits.\n cr = 1\n\n atk_bonus = attack_bonus(attacker.level)\n def_bonus = defense_bonus(defender.level)\n\n r = rand(85...100) / 100.0\n mod = stab * atk_mul * cr * r\n # base_dmg = (((attacker.level * 2 / 5.0 + 2) *\n # base_pwr * atk_bonus / 50 / def_bonus + 2) *\n # cr * r / 100 * stab * atk_mul)\n base_dmg = ((2 * attacker.level + 10) / 250.0 *\n (atk_bonus / def_bonus) * base_pwr + 2) * mod\n\n # TOOD: Check levitate, fire absorb, water absorb, volt absorb,\n # sap sipper, etc.\n return 0 if immune_from_ability?(move, defender)\n\n # Handle wonderguard mode.\n return 0 unless atk_mul > 1 if @modes.include?(:wonderguard)\n\n base_dmg.round\n end",
"def gain_point\n @score += 1\n end",
"def hit( damage )\n p_up = rand( charisma )\n if p_up % 9 == 7\n @life += p_up / 4\n puts \"[#{ self.class } magick powers up #{ p_up }!]\"\n end\n @life -= damage\n puts \"[#{ self.class } has died.]\" if @life <= 0\n end",
"def device_app_health_score=(value)\n @device_app_health_score = value\n end"
] |
[
"0.6196517",
"0.59898365",
"0.5663979",
"0.56413996",
"0.5607882",
"0.55528563",
"0.55480903",
"0.5525361",
"0.55206543",
"0.54973465",
"0.54973465",
"0.54681706",
"0.5415442",
"0.53903043",
"0.53068984",
"0.5277721",
"0.52742463",
"0.5254985",
"0.52476543",
"0.52073383",
"0.5180961",
"0.5180234",
"0.5169485",
"0.51689345",
"0.5140226",
"0.51259804",
"0.5113384",
"0.5095039",
"0.5088751",
"0.50750095",
"0.50604653",
"0.5053012",
"0.50019944",
"0.50010204",
"0.49889895",
"0.49710917",
"0.49301788",
"0.49199018",
"0.49145886",
"0.49121246",
"0.48772794",
"0.48732764",
"0.4868718",
"0.4868149",
"0.4865131",
"0.4854699",
"0.48523372",
"0.4844253",
"0.48411348",
"0.48330566",
"0.4829509",
"0.48256004",
"0.48108673",
"0.48078236",
"0.47934434",
"0.47934434",
"0.47884762",
"0.47711593",
"0.47522417",
"0.47521022",
"0.47474128",
"0.47472954",
"0.47463223",
"0.47248164",
"0.47187492",
"0.47065127",
"0.46965697",
"0.46362504",
"0.46221417",
"0.4611102",
"0.45931673",
"0.45851567",
"0.45796758",
"0.45723078",
"0.45720595",
"0.45694008",
"0.45684904",
"0.45684904",
"0.45684904",
"0.45622876",
"0.45612508",
"0.4554522",
"0.4551635",
"0.4542616",
"0.45383224",
"0.4535308",
"0.45217448",
"0.4516725",
"0.4514278",
"0.4514278",
"0.45138142",
"0.45118862",
"0.44946718",
"0.44793373",
"0.44786763",
"0.4474669",
"0.44643566",
"0.4460643",
"0.4460329",
"0.4457811"
] |
0.70791703
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.